With block proposal

Freeman ant108 at aol.com
Thu Aug 27 08:43:18 PDT 2009


James McComb Wrote:

> I've said it before, I think that D-style with blocks lack the 
> readability (and auto-complete editor support) of other languages.
> 
> Example:
> 
> with(a){ x = y; }
> 
> This is ambiguous and could mean a.x = y or x = a.y
> or a.x = a.y or even just x = y. D-style with blocks actually
> *reduce* the readability of the code, which makes them
> a bit pointless, in my opinion.
> 
> PROPOSAL: Introduce a symbol (for the sake of argument, :)
> that acts like a dot in with blocks in other languages.
> Then the code is no longer ambiguous, is more readable,
> and a list of properties can pop up in the editor
> automagically when you type :.
> 
> Example:
> 
> with(a)
> {
>    :x = x;  // Unambiguously means a.x = x
>    :x = .x; // Unambiguously means a.x = .x
> }
> 
> This syntax does not use the dot operator,
> which is already taken to indicate global scope. The syntax
> could even be optional (at the expense of a little ambiguity.)
> 
> I don't mind if a different character than : is used.
> 
> And then the language will be perfect. ;)




More information about the Digitalmars-d mailing list