Uniform Function Call Syntax?

Lass Safin via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 7 04:58:51 PST 2016


On Monday, 7 March 2016 at 07:58:53 UTC, Era Scarecrow wrote:
> On Monday, 7 March 2016 at 06:57:48 UTC, Ola Fosheim Grøstad 
> wrote:
>> immutable π = 3.14;
>>
>> Oh, the horror!
>
>  With the assumption pi is declared elsewhere (say, in 
> std.math), what i wonder is the number for pi vs 2 letters. 
> Unicode 03C0h, so now i have to convert that to decimal, code 
> 960. Alt+960 = └
>
>  That's not pi... Looking up the symbol by itself in the 
> character map was annoying enough. No, this is not a good idea 
> unless it's easily accessible, preferably with 2 or fewer 
> keystrokes to symbolize pi.
>
>
>  As a reminder most of us are programmers, not scientists or 
> mathematicians. Having specialized symbols won't give us any 
> benefit. It's not like we're filling out a complex formula with 
> college level math for a thesis.

Have you ever heard of .XCompose?
For linux: https://github.com/kragen/xcompose
For windows: https://github.com/samhocevar/wincompose
How it works:
You choose a compose key, then use it to compose special 
characters with specific sequences.

Examples:
     ComposeKey, *, p: π.
     ComposeKey, s, s: ß
     ComposeKey, ComposeKey, d, e, g, c (degree Celsius): ℃

It is not impossible to use unicode special characters on a daily 
base easily, with the use of this tool. No need to use the 
character map or anything.
I think it would be very nice, if one had the option of using 
these special characters.
E.g. → instead of >>, if you desire that; std.math defining π as 
π.
Small gimmicks like these are things I find to be good for a 
language to have.


More information about the Digitalmars-d mailing list