[nem-en] Declaring Properties in the constructor - ala Boo

d d at hell.art.pl
Sat Sep 30 16:47:43 CEST 2006


On Sep 30, 2006, at 3:49 PM, Michal Moskal wrote:

> On 9/30/06, d <d at hell.art.pl> wrote:
>>
>>   Right, the idea is nice. Quite useful. But I see Nemerle is
>> beginning to overflow with features, which will be understandable to
>> some and not quite so clear to others. My suggestion would be then,
>> to give features that are not commonly known (be it in the OO, or the
>> FP world) a clear, descriptive syntax. For example:
>>
>> def c = Cons (1, 2, x = "foo", initializers (y = "bar", z = "baz"));
>>
>>   This seems clear to me, but maybe you can think of something
>> better. You know, along those lines.
>
> I kind of like:
>
>  def c = Cone (1, 2, x = "foo") with (y = "bar", z = "baz")

  Yeah, that syntax is ok. What I was trying to point out, is to  
avoid constructs that are not self-explanatory.
  The "with" syntax appears in mathing already, so that's nice.

> It's general (not only for construction), it's easy to implement as  
> a macro.

  Right.

> It's good because VB and Pascal have 'with'. Also OCaml has it. The
> problem is that in OCaml it means to create a new object with listed
> fields changed and in Nemerle it would mean to change the object and
> return it. I would like to have both, but am not sure about the
> syntax... Also the implementation of the copying semantics is not that
> easy.

  Yeah, it would be nice to have a handy syntax for returning a new,  
modified object.

d

--
https://hell.art.pl == terror.org.pl == terror.icm.edu.pl/~d/gpg



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /mailman/pipermail/devel-en/attachments/20060930/87fb8d7e/PGP.bin


More information about the devel-en mailing list