shouting versus dotting

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Oct 5 07:03:22 PDT 2008


Tom S wrote:
> I don't like using "." for template instantiation. The tokenizer in my 
> eyes clearly separates constructs at ".". On the other hand, "!" as a 
> graphical character is more 'filled', thus doesn't separate the 
> identifier and arguments that much visually.
> 
> foo.bar          <-  obviously member access
> foo.(bar, baz)   <-  multiple member access?

I hear you. I would have chosen the colon if it wasn't ambiguous.

> ... It looks like it should yield a tuple containing bar and baz :P
> 
> 
> foo!(bar, baz)   <-  distinct, no issue.

Looks great until you have twenty or thirty of these on a code screen. 
Then you're like, boy this is one ugly language. Believe me, I *tried* 
to put up with it.

> As for the other queries, I like how template instantiation stands out 
> right now with the exclamation mark.

I wouldn't mind it either if I only had few of those.

> I would not like to have 
> compile-time and run-time merged visually in code.

You already do in template argument deduction. Compile-time evaluation 
erodes the distinction further. The times go against the style of coding 
that separates compile-time stuff from run-time stuff.

> And I don't forget to 
> put the exclamation mark there when programming templates.

Ok.

> Let's also keep in mind what Ary said, that using "." will cause 
> problems for IDEs.

No it won't.

> What's the point in pretending that run-time is the same as 
> compile-time?

Because you shouldn't care.

> You can't instantiate compile-time constructs with 
> run-time arguments, the costs are very different, too. Heck, when I see 
> too many "!" in the code, it indicates that there may be a design issue 
> and some massive bloat involved. I would not like this additional 
> insight into the code removed from my eyes.

Conversely, if you have too few of those, I come and say you're doing 
too much manual work.


Andrei



More information about the Digitalmars-d mailing list