x.sizeof vs typeid(x)

Sergey Gromov snake.scaly at gmail.com
Wed Feb 6 10:43:08 PST 2008


Are you sure this is to the better ?  I'm not quite fond of D's freedom
in syntax.  It already allows to write an unreadable code like this:

use(context) in (GL gl) {draw(gl);}

auto GetEven = stackthread = (int delegate() read, void delegate(int) yield) {...}

Less typing is often => less maintainable.  And Perl's slogan, "there is
more than one way to do things," is exactly what makes Perl
a write-only language.

SnakE

Janice Caron Wrote:
> I believe there are plans afoot to remove the distinction, so that
> f(x) and x.f are, in general, interchangable. If and when that day
> comes, perhaps we'll be able to write sizeof(x) and x.typeid as well?
> 
> On 06/02/2008, Sergey Gromov <snake.scaly at gmail.com> wrote:
> > I wonder why .sizeof is implemented as a property while typeof() and
> > typeid() are functions.  I can see no reasons for such inconsistency.
> > It's not that obvious for typeof() because it yields a type instead
> > of a value, but even then, why not ?
> >




More information about the Digitalmars-d mailing list