Which patches/mods exists for current versions of the DMD parser?

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 16 10:09:30 PDT 2014


On 8 September 2014 09:51, via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> I've started to make some minor mods to the DMD parser to tailor it to my
> own taste, but there is no reason to do double work, even if experimental.
> So I wonder which patches are available or in the works by others?
>
> I'm currently working on the following mods (not thoroughly tested yet):
>
> in : templatename‹params›
> out: templatename!(params)
>
> in : templatename«params»
> out: templatename!"params"
>
> in : a := expr
> out: auto a = expr
>
> in : a :== expr
> out: immutable a = expr
>
> And plan to continue with:
>
> in :  √x+y
> out:  sqrt(x) + y
>
> in :  a•b
> out:  a.opInner(b) // dot product, maybe some other name?
>
> in :  #arr;
> out:  arr.length //or perhaps something more generic?
>
> What are you working on and what patches do you have?
>
> What kind of syntactical sugar do you feel is missing in D?


You should read up on a programming language called Neat.   Though I
can't say that the crazier unicode syntax made it to the publicly
available product, some of the things that it does do are (I'm
guessing here):

// Essentially a foreach
while auto id <- lines[1 .. $] { }

// Because parenthesis are optional, uses ':' to terminate a loop condition.
for st <- splitAt(",", id): doSomething(st);

// Casting.
int x = 0; float y = float:x;

// Formatted strings do local/global variable lookups.
writeln("FPS: $fps");

// No clue what he was thinking here...
template Blorg(T) <<EOT
  struct Blorg {
    T t;
  }
EOT


Iain.



More information about the Digitalmars-d mailing list