Real World usage of D, Today (was Re: challenge #2: implement the varargs_reduce metafunction)

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Fri Jan 26 09:34:50 PST 2007


Frits van Bommel wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> The syntax that I am proposing does away with storageof and is very 
>> much in spirit with the current D:
>>
>> S int foo(S, T)(S T t) { }
>>
>> It does exactly what it says it does, in a clear and terse manner, and 
>> is 100% within the spirit of existing D:
>>
>> * It's customized on symbols S and T
>>
>> * It's matching (by sheer position of S and T) the storage (i.e., all 
>> of the gooey fuzzy nice information about the argument passed) and the 
>> type of the incoming argument
>>
>> * In this example it uses the storage in the result type (e.g. const 
>> goes to const)
>>
>> * Inside the function can easily use either T separately or S T as a 
>> group that transports the storage around. You have total flexibility 
>> (and don't forget that juxtaposition is always easier than extraction).
>>
>> So far we're only thinking of storage-like attributes, but a good deal 
>> of information can be encoded under the loose declaration of "storage".
> 
> Would it also be possible to 'cherry-pick' attributes?
> So that e.g something like S.constness expands to either 'const' or ''?
> 
> And would this mean 'raw' storage attributes would be valid template 
> parameters? So that something like foo!(const) would be valid syntax?

You will be able to cherry-pick with "is" tests. Walter is opposed to 
manipulating the raw storage attributes.

Andrei



More information about the Digitalmars-d mailing list