[nem-bug] [Nemerle 0000749]: Uninitialized local variables.

feedback at nemerle.org feedback at nemerle.org
Fri Sep 8 19:05:10 CEST 2006


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=749> 
======================================================================
Reported By:                IT
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   749
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     feedback
======================================================================
Date Submitted:             09-03-2006 01:40 CEST
Last Modified:              09-08-2006 19:05 CEST
======================================================================
Summary:                    Uninitialized local variables.
Description: 
using System;

public module Program
{
    Main() : void
    {
      mutable str : string;
      _ = str.Substring(0);
    }
}

No error, no warning. It differs from C# behaviour.
======================================================================

----------------------------------------------------------------------
 malekith - 09-05-06 01:50 
----------------------------------------------------------------------
It is expected, kind of.

The semantics of "mutable x" in Nemerle is exactly the same as "mutable x
= null".   

There is no control flow analisis for definitive assignment, as we felt
this feature is not going to be used often enough to warrant such a
complicated analisis. 

Of course we might have been wrong :-)

----------------------------------------------------------------------
 VladD2 - 09-05-06 02:04 
----------------------------------------------------------------------
It's not as in C#. It's required additional description in site.

----------------------------------------------------------------------
 IT - 09-08-06 19:05 
----------------------------------------------------------------------
Right, at least it should be documented. C# was introduced this feature as
one of the major thing that prevents developers from making kind of C++
mistakes.
On the other side, C# does not require to initialize class fields and
always initialize them by default.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
09-03-06 01:40 IT             New Issue                                    
09-05-06 01:50 malekith       Note Added: 0001437                          
09-05-06 01:50 malekith       Status                   new => feedback     
09-05-06 01:50 malekith       Description Updated                          
09-05-06 02:04 VladD2         Note Added: 0001438                          
09-08-06 19:05 IT             Note Added: 0001444                          
======================================================================




More information about the bugs mailing list