[nem-bug] [Nemerle 0001019]: Feature request: Extension macros

feedback at nemerle.org feedback at nemerle.org
Sun May 20 19:47:18 CEST 2007


The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=1019> 
======================================================================
Reported By:                VladD2
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   1019
Category:                   Compiler (parser/macros engine)
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             05-20-2007 19:47 CEST
Last Modified:              05-20-2007 19:47 CEST
======================================================================
Summary:                    Feature request: Extension macros
Description: 
For many tasks will be useful Extension macros. For example Extension
macros will be useful for implementing DLinq (Linq to SQL) functionality.

I think syntax of Extension macro should be:
macro MacroName[T](this : Info[TypeForExtending[T]][..., argExprN])
{
  ...
}
where [..., argExprN] is a any numbers of parametr
or:
macro MacroName[T](this : Info[TypeForExtending[T]], params paramArray :
array[PExpr])
{
  ...
}
or:
macro MacroName[T](this : Info[TypeForExtending[T]], params paramArray :
list[PExpr])
{
  ...
}



Example:
macro Where[T](this : Info[IQueryable[T]], lamdaExpr)
{
  def linqExpr = ToLinqExpression(lamdaExpr);
  <[ System.Linq.Queryable.Where($(this.PExpr), $linqExpr) ]>
}

Info give information about type of "this" parametr and in PExpr/TExpr
representation.

using:
SomeMethod(queryable : IQueryable[Customer])
{
  queryable.Where(c => c.Name.StartsWith("J"))
}

I think Extension macros is possible implement under Extension methods. We
can create one Extension method for each Extension macro and replace method
call to macro call when type of first parametr be known.
======================================================================

Issue History
Date Modified  Username       Field                    Change              
======================================================================
05-20-07 19:47 VladD2         New Issue                                    
======================================================================




More information about the bugs mailing list