Page 1 of 1

generic mixin

PostPosted: Sun Nov 01, 2009 7:48 am
by gauthier
I don't know if this should be supported, but for completeness of weird syntax tests:

mixin IsOk<of T>
var isOk as bool is public
def getFoo(v as T) as T
return v
class Ok adds IsOk<of int>
pass

namespace MixinWithinNamespaces
class Program
shared
def main
ok = Ok()
print ok.isOk
#print ok.getFoo(1)


will get the following compile error
Code: Select all
test.cobra(4): error: Cannot return T because "getFoo" is declared to return a int.

Re: generic mixin

PostPosted: Mon Nov 02, 2009 10:15 pm
by Charles
As you've discovered, the mixin support is incomplete. Some of this is documented at the mix-in wiki page. Nevertheless, thanks for the reports.

I probably won't get to this soon as there are a number of small items and patches I'll attend to first.

Re: generic mixin

PostPosted: Tue Nov 03, 2009 4:38 pm
by gauthier
I missed the wiki page, sorry about that.

So I updated it to state theses limitations, I'm going to work arround theses in my code :)