[nem-bug] [Nemerle 0000416]: allow extending existing classes
feedback at nemerle.org
feedback at nemerle.org
Wed May 3 18:31:21 CEST 2006
The following issue has been marked as UNRELATED TO issue 0000427.
======================================================================
<http://nemerle.org/bugs/view.php?id=416>
======================================================================
Reported By: malekith
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 416
Category: Language Feature
Reproducibility: always
Severity: minor
Priority: high
Status: confirmed
======================================================================
Date Submitted: 04-21-2005 20:13 CEST
Last Modified: 05-03-2006 18:31 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 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 - 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: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: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 20:19
----------------------------------------------------------------------
The discussion we have had is there:
http://nemerle.org/mailman/pipermail/devel-en/2004-October/000305.html
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
======================================================================
More information about the bugs
mailing list