Is this is bug or not?

Don Clugston dac at nospam.com.au
Fri Mar 17 02:05:01 PST 2006


Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Victor Nakoryakov schrieb am 2006-03-11:
>> Hi all,
>>
>> Here is a snipet:
>>
>> import std.stdio;
>>
>> struct A(T, T x0)
>> {
>> T x = x0;
>> }
>>
>> int main(char[][] args)
>> {
>> alias A!(int, 8) Ai; // test.d(11)
>> Ai ai;
>> writefln(ai.x);
>> return 0;
>> }

If that had worked, it would have been a new feature. You're obtaining a 
type AND a value! Note that value parameters only work for basic types 
and char[]. It would be very cool, though -- it would enable a lot of 
code reuse for metaprogramming.

For example, pow!(real z, int n) and pow!(creal z, int n) would be able 
to share a common implementation. The fact that they can't has been 
bugging me for some time.



More information about the Digitalmars-d mailing list