Forums

generic mixin

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

generic mixin

Postby gauthier » Sun Nov 01, 2009 7:48 am

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.
gauthier
 
Posts: 116

Re: generic mixin

Postby Charles » Mon Nov 02, 2009 10:15 pm

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.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: generic mixin

Postby gauthier » Tue Nov 03, 2009 4:38 pm

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 :)
gauthier
 
Posts: 116


Return to Discussion

Who is online

Users browsing this forum: No registered users and 11 guests