[nem-bug] [Nemerle 0000642]: Error if list declared without
initialisation
feedback at nemerle.org
feedback at nemerle.org
Wed May 3 13:22:25 CEST 2006
The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=642>
======================================================================
Reported By: VladD2
Assigned To: nazgul
======================================================================
Project: Nemerle
Issue ID: 642
Category: Compiler
Reproducibility: always
Severity: minor
Priority: normal
Status: resolved
Resolution: fixed
Fixed in Version:
======================================================================
Date Submitted: 04-01-2006 19:09 CEST
Last Modified: 05-03-2006 13:22 CEST
======================================================================
Summary: Error if list declared without initialisation
Description:
Error reported for this code:
mutable seq : list[int];
seq = [3];
WriteLine(seq.Head);
Error message:
test-016.n:8:20:8:23: error: parse error near identifier `int': unexpected
end of token sequence
test-016.n:8:20:8:23: error: expected assignment operator =
======================================================================
----------------------------------------------------------------------
nazgul - 04-05-06 21:12
----------------------------------------------------------------------
BTW, this is our design from the beginning. We do not want any
uninitialized local variable flying around. Usually you can just do
mutable seq = null;
seq = [3];
it will work fine. And as for value types, you can always use their
parameterless constructor:
mutable x = int();
x = 4;
I'm against, but maybe we should change this design - it creates
additional problems, because we must then perform complex flow control to
prevent usage of uninitialized variables.
----------------------------------------------------------------------
nazgul - 05-03-06 13:22
----------------------------------------------------------------------
Fixed on trunk (r6217).
We decided to use the simplest approach - we now allow lack of initializer
when declaring mutable variables, but we generate the "DefaultValue(T)"
expression. Interesting point is that generated IL looks identical :)
Issue History
Date Modified Username Field Change
======================================================================
04-01-06 19:09 VladD2 New Issue
04-05-06 21:12 nazgul Note Added: 0001163
05-03-06 13:22 nazgul Status new => resolved
05-03-06 13:22 nazgul Resolution open => fixed
05-03-06 13:22 nazgul Assigned To => nazgul
05-03-06 13:22 nazgul Note Added: 0001219
======================================================================
More information about the bugs
mailing list