Template instantiation syntax

KennyTM~ kennytm at gmail.com
Sun Oct 12 13:06:57 PDT 2008


Andrei Alexandrescu wrote:
> KennyTM~ wrote:
>> Denis Koroskin wrote:
>>> On Sun, 12 Oct 2008 21:18:35 +0400, KennyTM~ <kennytm at gmail.com> wrote:
>>>
>>>> Walter Bright wrote:
>>>>> KennyTM~ wrote:
>>>>>> But will be compiler accept T«x» if I directly feed it into the 
>>>>>> compiler?
>>>>>  No.
>>>>>
>>>>>> It's no good if what you see cannot be what you type.
>>>>>  The compiler doesn't accept colored text either, but that doesn't 
>>>>> impair the usefulness of an editor that displays it that way.
>>>>
>>>> Because you can't type color, but you can type « and ».
>>>
>>> «...» is not a valid template syntax, only !(...) is supported.
>>
>> Yes I know. But if Andrei's going to write an emacs module (or 
>> whatever) that displays !(...) as «...» I think the shown characters « 
>> and » themselves should be supported as well.
>>
>> Otherwise, just drop this confusing visual-only feature.
> 
> Please understand how your suggestion to drop the visual-only feature 
> concerns only the use of an editor. There is no feature to talk about 
> even. Essentially by "dropping the feature" you are telling me how my 
> editor's screen must look like.
> 

Maybe I used the wrong wording. I mean the "feature" that replaces 
!(...) to «...» in "your" emacs module.

Since Walter made an announcement here I'll expect you'll release it 
publicly, and since this is from the official developers' team I'd 
expect this would be the de facto module for emacs. That means your 
module will not just affect your editor, but all emacs users' editors.

>>> Honestly, I don't understand why Andrei is ashamed of !(), refrains 
>>> from using/seeing it and tries to replace visual with some sugar, but 
>>> this all is is suspicious and alerting. The syntax didn't make a way 
>>> into the language so uou should get used to it and put up with it.
>>>
>>> This reminds me of some people who were coming from Pascal and using
>>>
>>> #define DO
>>> #define BEGIN {
>>> #define END }
>>>
>>> macros for the code to be more similar to their previous experience.
>>>
>>> This is a bad sign, especially if it comes from one of the language 
>>> developers.
>>
>> At least you can still use DO, BEGIN, END when you #define them. But 
>> now you can't even use what you see («...»). I say it's more evil. :)
> 
> Code folding hides entire sections of code. They are nonetheless passed 
> to the compiler. Is that evil?
> 
> 
> Andrei

But code folding is not turned on by default, and there is a clear 
visual indication (e.g. +/- on the side) that there is something more.
OK there's C# #region, but again there is a clear visual indication (the 
+/- and the gray box) that something is inside #region.

My point is that if you just colorize « and » an average user seeing the 
foreign template code will not understand that the « is not actually a 
chevron but a !(. That will be a confusion.

It's OK if the replacement is implemented as a *non-default option*. 
Just like visual whitespace (I'm surprised no one challenges me with 
this). That means if a programmer really hates !(...) they can switch it 
on and change all of them into «...». With this the programmer *knows* 
what they're doing and confusion can be minimized.



More information about the Digitalmars-d mailing list