Minor extension to cast syntax [Uniformization of function and templates]

Bruno Medeiros brunodomedeiros+spam at com.gmail
Sat Nov 3 08:04:00 PDT 2007


Bruce Adams wrote:
> Gregor Richards Wrote:
> 
>> Gregor Richards wrote:
>>>> There is that idea in language design that if it can be done as a 
>>>> function it should be unless there is a good reason not to.
>>> In highly dynamic languages where performance isn't a primary objective, 
>>> yes. Dynamic arrays, anyone?
>>>
>> I should also mention, while I'm at it, that this can NOT be done as a 
>> function.
>>
>>   - Gregor Richards
> 
> It could if your language was dynamic enough to support types as first class objects so that no meta syntax was required. :)
> 

D could very well allow types as function parameters, and that wouldn't 
require any particular dynamicness or anything like that to the 
language. It would just a be a uniformization of function and template 
syntax for invocation and declaration, and, if done well, it could be a 
very cool addition (especially with the coming of AST macros). We have 
already some advances in this, like CTFE. Indeed, templates are really 
just compile time functions, which are also able to take some 
compile-time only constructs (such as types, aliases, etc.).



-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list