x.sizeof vs typeid(x)

Sergey Gromov snake.scaly at gmail.com
Thu Feb 7 12:44:32 PST 2008


Tom S <h3r3tic at remove.mat.uni.torun.pl> wrote:
> Sergey Gromov wrote:
> > 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);}
> 
> And when I actually asked for comments about that syntax, no one stated 
> that it was unreadable ... thanks for the (mislocated) feedback.

I don't know where or when you have asked for this.  It's not my job to 
read through years of discussions, and I'm not obligated to read every 
single post even though I do monitor the group.

Someone has cited this code in D.learn asking what it does.  That's 
exactly what I mean.

> As for the exact form of that use() in .. statement, I made it so with 
> the sole purpose of it being *readable*. It may be new to you; it 
> usually makes people think that the construct is built into D, resulting 
> in some confusion ("did I miss anything in the spec?"). Yet ultimately 
> using the language's features to write code which looks built-in makes 
> code easier to read. If my statement is false, then using AST macros in 
> lisp makes the code less readable as well.

I'm not familiar with Lisp.  Anyway, when I say 'readable,' I mean that 
I can look into an unfamiliar code written by other person and 
understand, in general, what's happening.  This class is having this 
method called with these arguments.  That template is instantiated with 
those types.  Basically, it should be enough to read language 
specification to understand the code.  In your case you're inventing a 
construct which doesn't quite fit into specs, which in turn causes 
confusion.

-- 
SnakE



More information about the Digitalmars-d mailing list