internal/local template memebers

Bill Baxter wbaxter at gmail.com
Sat Oct 25 13:16:42 PDT 2008


On Sun, Oct 26, 2008 at 3:54 AM, Bill Baxter <wbaxter at gmail.com> wrote:
> On Sat, Oct 25, 2008 at 10:34 PM, Denis Koroskin <2korden at gmail.com> wrote:
>> On Sat, 25 Oct 2008 17:08:28 +0400, Bill Baxter <wbaxter at gmail.com> wrote:
>>
>>> On Sat, Oct 25, 2008 at 8:48 PM, Denis Koroskin <2korden at gmail.com> wrote:
>>>>
>>>> On Sat, 25 Oct 2008 08:05:41 +0400, BCS <ao at pathlink.com> wrote:
>>>>
>> This is because you usual templates and mixin templates are completely
>> different, mixin'ing usual template or instantiating template that is
>> intended for being mixed-in makes no sense in the majority of real cases.
>
> Good point.  I can't think of any case where something I've written as
> a mixin would be useful as a stand-alone template.
> I usually end up calling my mixin templates something with "Mix" in the name.
>
> But it does seem like it would be tricky for the compiler to determine
> which case you meant.   Unless you told it which case... which is
> exactly what you suggest next.
>
>> Moreover, I would prefer to separate these terms and so their syntax:
>>
>> mixin template Bar
>
> That sounds quite reasonable to me.  (Though it's 4am and I just woke
> up, so I may not be at my peak right now)

Actually, I realized I do actually have some code that I use as either
mixin or standalone.
It's a template full of utility functions.  Sometimes it's convenient
just to mix all those utility functions into a class directly rather
than having to go through the GeomUtil!(PointType) template.  But it's
a convenient set of functions that doesn't particularly need to be
mixed in to be useful.

--bb



More information about the Digitalmars-d mailing list