shouting versus dotting

Tom S h3r3tic at remove.mat.uni.torun.pl
Sun Oct 5 10:37:46 PDT 2008


Andrei Alexandrescu wrote:
>> ... 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.

Hm, I didn't think so when working on ctrace or Bind...
I could similarly say that parentheses look bad and we should change 
them to something else because a screenful of them looks ugly when 
calling lots of functions.


>> I would not like to have compile-time and run-time merged visually in 
>> code.
This statement was likely misleading, sorry for that. I don't see it as 
a bad thing that some functions will be running at compile-time 'behind 
my back'. I just wouldn't like the visual distinction between normal 
function calls and template evaluations to go away as long as they are 
fundamentally different.


> You already do in template argument deduction.

Point. But for a different purpose - eliminating a lot of redundant code 
and making some meta programming feasible. It's a bit different from 
pretending template evaluation is like function calls.


> The times go against the style of coding 
> that separates compile-time stuff from run-time stuff.

The times? I'd say that these times have already been ;) You may not 
have this distinction e.g. in Lisp. But if you consider that D only has 
one 'compile time', while you could freely operate on anything at any 
time in Lisp, it makes more sense to have the compile-time phase stand 
out a bit. Especially because template code is still very different than 
normal D code (it's functional and memoized, after all). I'd be tempted 
to change my mind here if D had more meta-facilities, but at the current 
state of things, I'd say that the 'times' are pretty stagnant for D.


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

Would you elaborate on this? I'd rather believe Ary if nothing else is 
provided to your point. Ary is the creator of the most advanced IDE for 
D as far as I know.


>> What's the point in pretending that run-time is the same as compile-time?
> 
> Because you shouldn't care.

I wish I could! But then, I can't process types at run-time.


>> 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.

Or the code is a 'normal' module that mixes some meta constructs and 
standard non-parametrized stuff. The "!" may be very common in modules 
such as std.algorithm, but you won't see as many in the usual stuff, 
like, most of Tango.


-- 
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode



More information about the Digitalmars-d mailing list