Bill Baxter wrote:
> On Mon, Mar 2, 2009 at 11:55 AM, Daniel Keep
> <[email protected]> wrote:
>>
>> Frits van Bommel wrote:
>>> Sean Kelly wrote:
>>>> Daniel Keep wrote:
>>>>> extern(C) void __identifier("blah$UNIX2003")(int);
>>>> That would be awesome.
>>>>
>>>>> A beneficial side-effect is that I can finally get rid of all those
>>>>> mixins that are just doing this:
>>>>>
>>>>> mixin(`void `~name_of_fn~`(int a)
>>>>> {
>>>>> // ... rest of function ...
>>>>> }`);
>
> I'm sure you've thought of this, so why can you not do
> mixin(`void `~name_of_fn~`(int a) { implementation_of_function(a); }`);
> or
> mixin(`alias implementation_of_function `~name_of_fn~`);
Simple enough to break:
mixin(Property("foo", int));
mixin(Property("bar", float));
You can't use alias. You have to have some way of generating unique
symbol names in a context you don't have any control over. There are
also little issues with this like how the name of the function, when
debugging, won't be what you expect it to be.
No, you can't use templates because you can't mixin functions with
non-public protection with templates.
-- Daniel