Feature request: function prototypes

Bruce Adams tortoise_74 at yeah.who.co.uk
Sat Feb 9 02:02:46 PST 2008


On Fri, 08 Feb 2008 18:58:14 -0000, Robert Fraser  
<fraserofthenight at gmail.com> wrote:

> Jarrett Billingsley wrote:
>> "Robert Fraser" <fraserofthenight at gmail.com> wrote in message  
>> news:fohlg3$acr$1 at digitalmars.com...
>>> This may seem like a pretty stupid request, but since I use a lot of  
>>> version() statements in my code; it'd be really cool to have something  
>>> like function signatures at the top of my file. When I declare my  
>>> versioned functions, I'd love to be able to have them checked against  
>>> prototypes declared above their use, as a first line of defense (so I  
>>> don't need to r-test it on different OSes and libraries if I make an  
>>> obvious change to one of the signatures or something).
>>  Would it be possible to put the version statement inside the function  
>> bodies?  Yes, it's somewhat more typing, but it means you only have to  
>> actually declare each function once (and write ddoc for them once, as a  
>> bonus).
>
> That's what I'm mostly doing now, but I'd rather be able to group stuff  
> together (i.e. "here's the Tango functions, here's the Phobos ones), and  
> Ddoc the stuff up with the prototypes at the top. But maybe it's not a  
> big enough deal to justify a language change.

Would it be overkill to use interfaces and several separate implementation
classes instead? That is what polymorphism is about after all. Also you  
would
be able to refactor any common code which is hard to do with version  
statements
all over the place.

Bruce.



More information about the Digitalmars-d mailing list