[nem-bug] [Nemerle 0000752]: ref parametrs bug

feedback at nemerle.org feedback at nemerle.org
Sun Sep 10 10:08:40 CEST 2006


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=752> 
======================================================================
Reported By:                VladD2
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   752
Category:                   Compiler
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     acknowledged
======================================================================
Date Submitted:             09-10-2006 04:29 CEST
Last Modified:              09-10-2006 10:08 CEST
======================================================================
Summary:                    ref parametrs bug
Description: 
using System.Console;

class C
{
    public static Method(i : ref int) : int
    {
        i = i + 1;
        i
    }
}

def MM(i : ref int) : int
{
    i = i + 1;
    i
}

mutable x = 5;

WriteLine(C.Method(ref x));
WriteLine(MM(ref x));

=================================================
print:
Main.n(12,1,12,26): error : nested ref/out type found
Main.n(14,5,14,14): error : needed a writable location for assignment
target, got a reference to local symbol `a function parameter i', which is
read-only
Main.n(14,9,14,14): error : in argument http://nemerle.org/bugs/view.php?id=1 of
+.s, needed a int, got void:
void is not a subtype of int
Main.n(12,1,12,26): error : expected int, got void in function return
type: void is not a subtype of int
Main.n(21,11,21,13): error : wrong number of parameters in call, needed 0,
got 1

======================================================================

----------------------------------------------------------------------
 malekith - 09-10-06 09:12 
----------------------------------------------------------------------
We don't support ref/out parameters for local functions. We theoretically
could do that for functions that are not first class.

For functional values it is impossible, because you cannot have a generic
type like Func[ref int,int] (and this is BTW what the error message
referrs to).

Another problem is that inferring types for them is not going to be
simple.

----------------------------------------------------------------------
 VladD2 - 09-10-06 10:08 
----------------------------------------------------------------------
> We don't support ref/out parameters for local functions. We theoretically
could do that for functions that are not first class

Then it is necessary to change the error message. This message is ugly.
Ncc must say something such "Local functions not support ref/uot
parametrs."

Issue History
Date Modified  Username       Field                    Change              
======================================================================
09-10-06 04:29 VladD2         New Issue                                    
09-10-06 07:27 aleksey        Issue Monitored: aleksey                     
09-10-06 09:11 malekith       Severity                 minor => feature    
09-10-06 09:11 malekith       Status                   new => acknowledged 
09-10-06 09:11 malekith       Description Updated                          
09-10-06 09:11 malekith       Additional Information Updated                    
09-10-06 09:12 malekith       Note Added: 0001445                          
09-10-06 09:12 malekith       Description Updated                          
09-10-06 09:12 malekith       Additional Information Updated                    
09-10-06 10:08 VladD2         Note Added: 0001446                          
======================================================================




More information about the bugs mailing list