A while ago, when we had a typeclass inheritance like this:

typeclass Foo[s] { virtual proc foo: s; }
typeclass Bar[s] { virtual proc bar: s; }

typeclass FooBar[s] {
  inherit Foo[s];
  inherit Bar[s];
}

we had to declare the instances like this:

instance Foo[int] {
  proc foo (x:int) { println$ "foo: " + (str x); }
}

instance Bar[int] {
  proc bar (x:int) { println$ "bar: " + (str x); }
}

instance FooBar[int] {}

in order to do:

open FooBar[int];

However, now it looks like you don't need the extra "instance FooBar[int] {}":

///////////////////////////////
typeclass Foo[s] { virtual proc foo: s; }
typeclass Bar[s] { virtual proc bar: s; }

typeclass FooBar[s] {
  inherit Foo[s];
  inherit Bar[s];
}

instance Foo[int] {
  proc foo (x:int) { println$ "foo: " + (str x); }
}

instance Bar[int] {
  proc bar (x:int) { println$ "bar: " + (str x); }
}
open FooBar[int];

foo 5;
bar 6;
///////////////////////////////

Prints out:
foo: 5
bar: 6

So, the question is, is this just a coincidence that it's working now,
or is this really not needed any more?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to