getAttr method
downs
default_357-line at yahoo.de
Sat Feb 2 06:59:34 PST 2008
Janice Caron wrote:
> On 2/2/08, downs <default_357-line at yahoo.de> wrote:
>>> So, if you can recommend a better operator than opAssign, one with better semantics, I'm all ears. :)
>
> The only thing that comes to mind is member assignment. e.g.
>
> stackthread.dg = { ... };
>
> instead of
>
> stackthread = { ... };
>
> You still get the braces at the end, and it's clear you're assigning a
> property of stackthread, rather than overwriting its entire value. (It
> is more typing though).
I'm not though. Semantically, I'm creating a new StackThread from a delegate. ^^
I wish we could overload arbitrary keywords. "stackthread of " or "stackthread from " would be perfect.
I'm tending towards either "stackthread/ (void delegate(int) yield) { " (in keeping with the rest of my syntax), or "stacthread ~ (void delegate(int", because ~ is less semantically burdened. Or, you know, keeping "=" :)
The best thing is probably to not read it as "assign to stackthread", but as "auto generator [= stackthread] [= (void delegate(int) yield) { ... }];" i.e. assign to generator a stackthread; assign to generator this delegate; meaning "assign to generator this delegate which is also a stackthread." :)
--downs
More information about the Digitalmars-d
mailing list