[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 11:05:29 CET 2006


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=631> 
======================================================================
Reported By:                OysterDva
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   631
Category:                   Language Feature
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             02-28-2006 11:05 CET
Last Modified:              02-28-2006 11:05 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.
======================================================================

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                     
======================================================================




More information about the bugs mailing list