Why Ruby?

spir denis.spir at gmail.com
Sun Dec 12 12:17:19 PST 2010


On Sun, 12 Dec 2010 12:23:03 -0600
Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:

> Going now 
> back to D, we can imagine the following lowering:
> 
> fun (a, b ; c) stmt
> 
> =>  
> 
> fun(c, (a, b) { stmt })

It seems to me that lowering is analog to redefine "shallow" syntax (in fact, syntactic sugar) into a deeper syntax mirroring that actual AST. The syntax tree for foreach/iteration could be written as:

iteration:
	collection: c
	loopVarNames: ['a','b']
	block: stmt

And generalised into:

blockOperation:
	source: c
	loopVarNames: ['a','b']
	block: stmt
where your 'func' is a "block-wise operation". What do you think?

But I do not see in what Ruby-like syntax and point of view are clearer; actally, I find D far more readable.
And even less what this would bring to D. This is interesting in highly reflexive languages; even more reflexive than Ruby in fact, where one could tweak the block at runtime. But this is not the perspective of D, I guess.


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list