[nem-bug] [Nemerle 0000703]: [0.9.3] Immutable fields are not marked with initonly

feedback at nemerle.org feedback at nemerle.org
Sat Jul 1 19:10:47 CEST 2006


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=703> 
======================================================================
Reported By:                Snaury
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   703
Category:                   Compiler
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             07-01-2006 19:10 CEST
Last Modified:              07-01-2006 19:10 CEST
======================================================================
Summary:                    [0.9.3] Immutable fields are not marked with
initonly
Description: 
This allows the following code:

using Nemerle.Collections;

public class Program
{
  public static void Main()
  {
    RList<int>.Empty = null;
  }
}

to run successfully, which might lead (theoretically) to hard to trace
bugs later. In contrary, in C#, the following declarations:

  public static readonly object Field = new System.Object();
  public readonly object InstanceField = new System.Object();

are marked with initonly:

  .field public static initonly object Field
  .field public initonly object InstanceField

which prevents field modifications by any .NET code, not only Nemerle.
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
07-01-06 19:10 Snaury         New Issue                                    
======================================================================




More information about the bugs mailing list