[nem-bug] [Nemerle 0000416]: allow extending existing classes

feedback at nemerle.org feedback at nemerle.org
Mon May 22 18:03:35 CEST 2006


The following issue has been CLOSED
======================================================================
<http://nemerle.org/bugs/view.php?id=416> 
======================================================================
Reported By:                malekith
Assigned To:                nazgul
======================================================================
Project:                    Nemerle
Issue ID:                   416
Category:                   Language Feature
Reproducibility:            always
Severity:                   minor
Priority:                   high
Status:                     closed
Resolution:                 fixed
Fixed in Version:           
======================================================================
Date Submitted:             04-21-2005 20:13 CEST
Last Modified:              05-22-2006 18:03 CEST
======================================================================
Summary:                    allow extending existing classes
Description: 
But, from the good news, some time ago we were discussing idea of adding
new stuff to existing library classes. For example you have the
System.String class and want the Nemerle.Utility.NString.Split  static
method, that works on lists and not on arrays, to be one of the regular
String.Split overloads. We're not interested in really extending the class
-- some syntactic sugar should be enough.

There is a thread discussing it starting here
http://nemerle.org/mailman/pipermail/devel-en/2004-October/000305.html
======================================================================

----------------------------------------------------------------------
 nazgul - 04-21-05 20:19 
----------------------------------------------------------------------
The discussion we have had is there:
http://nemerle.org/mailman/pipermail/devel-en/2004-October/000305.html

----------------------------------------------------------------------
 malekith - 04-21-05 22:50 
----------------------------------------------------------------------
Oops, missed your note. But anyway, now I'm thinking about something like
this:

module NString 
{
  [ForwardFrom (System.String)]
  public Map (s : string, f : char -> char) : void
  {
  }
}

----------------------------------------------------------------------
 nazgul - 04-21-05 22:54 
----------------------------------------------------------------------
Well, with macro attached to method this would be even reasonably easy to
implement. First ForwardFrom macro would add current method to class
hierarchy, then it would add a macro, which should be expanded at every
call to this method.

----------------------------------------------------------------------
 malekith - 04-21-05 22:57 
----------------------------------------------------------------------
That is it would be easy if we had macros attached to method calls
implemented?



----------------------------------------------------------------------
 nazgul - 04-21-05 22:59 
----------------------------------------------------------------------
Exactly. They should be expanded after typer has choosen particular method
and their result should replace the original call. Maybe some antilooping
mechanism (if macro gets expanded to the same function call)

----------------------------------------------------------------------
 malekith - 05-09-06 13:08 
----------------------------------------------------------------------
A hiding mechanism compatible with C# 3.0 has been implemneted on trunk
(r6252). This finishes the implementation I guess.

----------------------------------------------------------------------
 nazgul - 05-09-06 13:10 
----------------------------------------------------------------------
There is still issue with extension method in IEnumerable[T] and array/list
not using it

----------------------------------------------------------------------
 nazgul - 05-14-06 13:15 
----------------------------------------------------------------------
So, it is now fully implemented.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
04-21-05 20:13 malekith       New Issue                                    
04-21-05 20:19 nazgul         Note Added: 0000707                          
04-21-05 21:41 malekith       Description Updated                          
04-21-05 22:50 malekith       Note Added: 0000708                          
04-21-05 22:54 nazgul         Note Added: 0000709                          
04-21-05 22:57 malekith       Note Added: 0000710                          
04-21-05 22:57 malekith       Note Edited: 0000710                         
04-21-05 22:59 nazgul         Note Added: 0000711                          
04-23-05 14:47 nazgul         Status                   new => confirmed    
04-27-05 12:56 malekith       Relationship added       related to 0000427  
05-03-06 18:31 nazgul         Relationship deleted     related to 0000427  
05-09-06 13:08 malekith       Note Added: 0001265                          
05-09-06 13:10 nazgul         Note Added: 0001266                          
05-14-06 13:15 nazgul         Status                   confirmed => resolved
05-14-06 13:15 nazgul         Resolution               open => fixed       
05-14-06 13:15 nazgul         Assigned To               => nazgul          
05-14-06 13:15 nazgul         Note Added: 0001283                          
05-14-06 13:15 nazgul         Description Updated                          
05-22-06 18:03 nazgul         Status                   resolved => closed  
======================================================================




More information about the bugs mailing list