[nem-bug] [Nemerle 0000631]: Patch for quoted declarations to support ellipsis in class/interface members declaration

feedback at nemerle.org feedback at nemerle.org
Tue Feb 28 22:41:05 CET 2006


The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=631> 
======================================================================
Reported By:                OysterDva
Assigned To:                nazgul
======================================================================
Project:                    Nemerle
Issue ID:                   631
Category:                   Language Feature
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     resolved
Resolution:                 fixed
Fixed in Version:           
======================================================================
Date Submitted:             02-28-2006 11:05 CET
Last Modified:              02-28-2006 22:41 CET
======================================================================
Summary:                    Patch for quoted declarations to support ellipsis in
class/interface members declaration
Description: 
Sometimes it's convenient to provide class members list using ellipsis in
class quoted declaration in the following intuitive way:

macro metaclass(className, body)
syntax ("metaclass", className, body)
{
  def ctx = ImplicitCTX();
  mutable code = [];
  match (body) {
    | <[ { .. $props } ]> =>
      foreach(<[ $(n : name) : $(t : name) ]> in props) {
        code ::= <[ decl:
          [Accessor]
          mutable $(n.NewName("_" + n.Id) : name) : $(t : name) ;
        ]>;
      }
    | _ => Message.FatalError($"Invalid metaclass syntax, expected
properties definition, got $body");
  }
  def builder = ctx.Env.Define(<[ decl: [Record] public class
$(className.ToString() : usesite) { .. $(code.Reverse()) } ]>);
  builder.Compile();
  <[ () ]>
}

I have created a patch for compiler which allows to use this feature.
Patched source code is attached to this issue.
======================================================================

----------------------------------------------------------------------
 nazgul - 02-28-06 22:41 
----------------------------------------------------------------------
Fixed on trunk (r6141)

Issue History
Date Modified  Username       Field                    Change              
======================================================================
02-28-06 11:05 OysterDva      New Issue                                    
02-28-06 11:05 OysterDva      File Added: MainParser.n                     
02-28-06 11:05 OysterDva      File Added: ParseTree.n                      
02-28-06 11:05 OysterDva      File Added: Macros.n                         
02-28-06 11:06 OysterDva      File Added: Typer.n                          
02-28-06 13:32 OysterDva      Issue Monitored: OysterDva                    
02-28-06 13:32 OysterDva      Issue End Monitor: OysterDva                    
02-28-06 22:41 nazgul         Status                   new => resolved     
02-28-06 22:41 nazgul         Resolution               open => fixed       
02-28-06 22:41 nazgul         Assigned To               => nazgul          
02-28-06 22:41 nazgul         Note Added: 0001113                          
======================================================================




More information about the bugs mailing list