How about 'pure' for constants?

Oskar Linde oskar.lindeREM at OVEgmail.com
Thu Dec 13 05:59:58 PST 2007


Hxal wrote:
> Don Clugston Wrote:
> 
>> pure real pi = 3.141592564;
>> ...
>> pure int foo(int a, int b);

I don't think pure is the optimal solution, but it is much better than 
enum and I could definitely live with it.

> Greetings fellow D community members. (since this is my first post.)
> 
> I'm not terribly fond of either the enum or the pure idea.
> 
> Perhaps this discussion is the perfect opportunity to revise the use of alias
> declarations. Suppose we changed the alias syntax to the form of "alias x = y;"
> We could amend its semantics to allow aliasing of values which would give us
> what this discussions seems to be about - named values taking no memory space.
> 
> If we wanted to be able to specify the type we could further change the syntax
> to either "alias optionaltype x = y;" or "optionaltype alias x = y;".

I agree.

It feels like lately, the design of D has left that of the free 
outside-the-box thinker and attained a C++ mindset where simplicity and 
elegance is rendered irrelevant. I hope I am wrong. :)

-- 
Oskar



More information about the Digitalmars-d mailing list