a more consistent const syntax

Bill Baxter dnewsgroup at billbaxter.com
Tue Aug 7 18:21:32 PDT 2007


Derek Parnell wrote:
> On Sun, 05 Aug 2007 14:42:09 +0200, Daniel919 wrote:
> 
> 
>> The "define proposal" is not such a big change in the language,
> 
> I love the 'define' proposal. It is totally unambiguous and clear what is
> intended by the code writer, and totally unambiguous and clear about what
> we expect of the compiler.

What I think would really rock is if 'define' could also be used for 
types and maybe expressions.

I've long felt it was silly that aliases were backwards from normal 
assignments.

define x = 1;
define myInt = int;

I'd love that.
Then just get rid of alias.  :-)

Or maybe just allow alias to use either syntax:

alias x = 1;
alias 1 x;
alias myInt = some_complex_expr_to_compute_a_type!(int);
alias some_complex_expr_to_compute_a_type!(int) myInt;

In my opinion it's a lot easier to read the assignment syntax (alias 
sym=thing) than the current alias syntax (alias thing sym).  Mainly 
because, as you see above, often the 'thing' is really long, but usually 
the 'sym' is something very short.  It makes it easier to see the thing 
you care about in the end which is the sym that comes out of the 
statement that you'll be using in subsequent code.

--bb



More information about the Digitalmars-d mailing list