shouting versus dotting
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Oct 5 11:00:35 PDT 2008
Tom S wrote:
> 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.
You couldn't because f(a, b) is already used in math for function
invocation. "Word!" is already used. For shouting that is.
>>> 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.
They are and they stay different. One oughtn't be shouting at you though.
>> 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.
Well parens are already used for more than function calls and nobody
seems to mind.
>> 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.
More meta-facilities are coming D's way, not less. As far as Lisp is
concerned, at least in Scheme (I forgot how you do it in Lisp) macro
invocation isn't distinguished in any way. For example "and" in (and a b
c) is a macro.
>>> 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.
A template name without arguments has no members, except inside the very
template definition, when you'd rarely use it.
>>> 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.
Well then here's the distinction that you wanted :o).
>>> 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.
By and large we'd want seamless and smooth integration of various styles
and techniques, wouldn't we? Shouting doesn't fit into this.
Andrei
More information about the Digitalmars-d
mailing list