shouting versus dotting
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Oct 5 11:24:42 PDT 2008
Ary Borenszweig wrote:
> Andrei Alexandrescu escribió:
>> 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.
>
> I don't think it's because of that, but the IDE could check that if
> what's before the "." is a template, suggest instantiation. So after
> thinking about it again, I agree with you that it won't be problematic.
>
> Anyway, I don't like the .() syntax. :-P
And why should I care? I got superdan's drunken vote! :oD
Andrei
More information about the Digitalmars-d
mailing list