[nem-en] closures in constructors

Dmitry Ivankov divanorama at gmail.com
Sun Apr 1 09:24:36 CEST 2007


On 4/1/07, Don Reba <don_reba at inbox.ru> wrote:
>
> Ran into this bug. In the example below, a function nested inside a
> constructor attempts to assign a class member, but fails, since it is part
> of a closure. If this is done inside the constructor itself, and not inside
> a nested function, everything is fine.
>

I think it is closer to a feature than to a bug.
Both "f" and "this" are
objects, why should we allow some special interaction between them?
If some day i'll need code like that i'd prefer separate syntax, smth like
this() {
 def f () {
  @i = 3; //it'll mean not a field of this, but "free" object i
 }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/pipermail/devel-en/attachments/20070401/3c69bad4/attachment.html


More information about the devel-en mailing list