election details *PLEASE READ*
Todd Blanchard
tblanchard at mac.com
Sat Feb 24 18:36:33 UTC 2007
You really ought to look into ObjectiveC's Protocols. Because they
blow interfaces all to hell in terms of flexibility and Java's
interfaces are borrowed from that (if one is to believe the Gosling
apologists).
I really like ObjectiveC's protocols and categories. To me, traits
look like categories with the class parameterized. This is to say -
you can declare a set of extension method in ObjectiveC as an
extension on a particular class. It would be nice to be able to
declare that set of extension methods, then say later on to what
classes they should be applied (which is kind of what traits does).
I really dislike Java's interfaces because they still leave you
copying and pasting code like crazy or hand stitching glue.
They only semi-sane strategy I've seen for sharing code is to store
it in the interface as static methods (you can put static methods in
an interface with implementation).
Then, you get to hand write a bunch of glue like this:
interface Foo
{
abstract void bar();
static void bar_impl(Foo f) { /*default implementation of foo */}
}
class Baz implements Foo
{
void bar() { return Foo.bar_impl(this); }
}
Which seems like a lot of busy work to me and makes me develop facial
ticks everytime I contemplate using a large interface widely.
-Todd Blanchard
On Feb 23, 2007, at 10:35 PM, Andreas Raab wrote:
> Java interfaces are "nothing but abstract virtual base classes in C+
> +" - which coincidentally, was the only way that MI ever worked in C
> ++, which itself has two dozen ways of doing MI wrong and exactly
> ONE to do it right (abstract virtual base classes). Java choose a
> stand on that and it worked (which is pretty impressive given that
> it was the first language that used interface to that extent).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070224/f47d16b1/attachment.htm
More information about the Squeak-dev
mailing list
|