[nem-bug] [Nemerle 0000803]: Functions using only current's type this pointer should not create closures

feedback at nemerle.org feedback at nemerle.org
Wed Dec 6 20:38:15 CET 2006


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=803> 
======================================================================
Reported By:                nazgul
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   803
Category:                   Compiler
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             12-06-2006 20:38 CET
Last Modified:              12-06-2006 20:38 CET
======================================================================
Summary:                    Functions using only current's type this pointer
should not create closures
Description: 

class A {
  mutable foo : int = 1;
  
  bar () : void {
    def f () {
      foo++;
    }   
    f();
    f();
    assert (foo == 3);
  }   

  baz () : void {
    foo = 1;
    def f () {
      foo++;
    }   
    def x = f : void -> void;
    x();
    x();
    assert (foo == 3);
  }   
      
  static CheckReflection () : void
  {
    mutable count = 0;
    foreach (x when x.FullName.Contains ("closure") in typeof
(A).Assembly.GetTypes ())
      ++count;
    assert (count == 0);
  }
  
  static Main () : void {
    def x = A();
    x.bar ();
    
    CheckReflection ();   
  }
}
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
12-06-06 20:38 nazgul         New Issue                                    
======================================================================




More information about the bugs mailing list