Redefining __dollar for a class ;)
Jarrett Billingsley
kb3ctd2 at yahoo.com
Sat Jul 29 14:58:27 PDT 2006
"Deewiant" <deewiant.doesnotlike.spam at gmail.com> wrote in message
news:eaficf$9lh$1 at digitaldaemon.com...
> This came to mind as I filed Issue 269 in the 'Zilla, so it deserves a
> bump.
>
> A possible and possibly simpler solution is that when using
> classInstance[$] it
> would just call the class's length method, which is essentially what it
> does
> with arrays. This way, foo[$] would always be equivalent to
> foo[foo.length].
That makes sense. The compiler would still be able to issue an error if no
length method existed. That does seem better.
> Using __dollar like in your code smells bad to me, since names prefixed
> with __
> are meant for the compiler's use only. If manual overloading of $ were to
> be
> allowed (i.e. not in the implicit way like I suggested above), it'd likely
> have
> to be something like opDollar.
>
> And hey, we got opSliceAssign eventually, so we might get this as well!
> <g>
Yeah, I whined about that one too, didn't I.. :)
More information about the Digitalmars-d
mailing list