An inconvenient truth

KennyTM~ kennytm at gmail.com
Wed Oct 8 07:27:21 PDT 2008


Aziz K. wrote:
> On Wed, 08 Oct 2008 14:21:02 +0200, Andrei Alexandrescu 
> <SeeWebsiteForEmail at erdani.org> wrote:
> 
>> Walter discovered a showstopper for the curls.
>>
>> class A : B
>> {
>> }
>>
>>
>> Andrei
> 
> How about if we leave the current syntax as it is and introduce an 
> alternative syntax using Unicode mathematical letters?
> Here's a template function using the Unicode angle brackets "〈〉":
> 
> template ToString〈ulong U〉
> {
>     static if (U < 10)
>     const char[] ToString = "" ~ cast(char)(U + '0');
>     else
>     const char[] ToString = ToString〈U / 10〉 ~ ToString〈U % 10〉;
> }
> 
> The advantages:
> 
> *) Programmers can still use the normal ASCII template instantiation 
> syntax.
> *) The new syntax doesn't create any grammar ambiguities.
> *) More potential converts from the C++ world.
> 
> The disadvantages:
> 
> *) Using the angle brackets would require some effort, although smart 
> editors could alleviate this problem if it detects that an identifier is 
> a template or if you specify a macro that turns <- into 〈 and -> into 〉.
> *) Practically any font I tried in kwrite/kate didn't render the angle 
> brackets at all and instead showed a rectangular box. Interestingly 
> enough a few other special Unicode mathematical characters are rendered 
> correctly.
> 
> Here is a nice page of all mathematical Unicode characters: 
> http://tlt.its.psu.edu/suggestions/international/bylanguage/mathchart.html

What about «XXX», as it is in ISO-8859-1 and I can type them with 
Option+\ and Option+Shift+|. Oh poor Windows users you've to type with 
Alt+171 and Alt+187.

I think characters outside the ASCII range shouldn't be considered 
unless there are no ASCII solutions left. We can still consider:

  a!(b)
  a@(b)



More information about the Digitalmars-d mailing list