foo!(bar) ==> foo{bar}

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 8 09:52:50 PDT 2008


Tomas Lindquist Olsen wrote:
> Walter Bright wrote:
>> Tomas Lindquist Olsen wrote:
>>> I just think it's funny that this has even come up and is getting 
>>> serious consideration. Walter usually don't like changing the color 
>>> of his shed! And D coders are already used to !()
>>
>> As Andrei said, I don't write a lot of templates. He does.
>>
>> What I'd really like are those funky « and » quote characters. But 
>> alas, few keyboards have them on it. (I inserted them here by cutting 
>> and pasting from somewhere else, hardly very practical. I could modify 
>> my text editor to make it easy, but what about every other ascii text 
>> editor people use?)
> 
> They're not printed on my keyboard but I can use AltGr+Z and AltGr+X to 
> produce « and » . This is actually a lot nicer to type than { } which 
> requires me to move my hands a lot more.
> 
> I think it's a real problem if some people can't produce them though... 
> Sometimes you just wanna hack a bit in some crappy console editor...

I think we can discount the chevrons as an input method. From what I see 
the display devices and fonts are well-prepared, but ASCII still rules 
on the good old keyboard.

I agree with Dave that allowing two syntaxes raises a brow. There are 
two counter-arguments to take into consideration. One is, there is a 
growing trend of improving code visuals across programming language and 
editors (syntax coloring, code folding, paren highlighting, various 
autocompletions and electric modes, error highlighting...), and to me it 
looks like transforming Foo!( into Foo«» upon typing is just a shade in 
that continuum. The second is that Walter mentioned repeatedly how neat 
it would be if certain math Unicode symbols could be used as infix 
operations. Experimenting a bit with Unicode symbols may be a pretty 
interesting activity.


Andrei



More information about the Digitalmars-d mailing list