« Return to Thread: mixins etc.

Re: mixins etc.

by Jochen Theodorou :: Rate this Message:

Reply to Author | View in Thread

Graeme Rocher schrieb:
[...]
> The main purpose of my post here was to try and differentiate what a
> mixin and a trait is because in my view they're different concepts

according to the wiki article Alexandru linked mixins are affecting the
heirarchy.

Anyway, this won't lead to anything. Let us make a matrix consisting of
heirarchy affecting or not and being a runtime or compile time
construct. Further let us not give names to these, but think what we
want to use it for. Groovy is a pragmatic language and as such we don't
want to adapt a concept of another programming language just for the
name of it. there must be a usage for this and the usage should be the
primary focus here.. I mean... why adding a useless concept? If we then
have defined this and agreed to implement it, then we should think about
a name

As for the definitions... I haven't ever seen a formal and general
definition of either traits or mixins. For example it is said that Ruby
modules are like traits... I am sure the modules are no compile time
construct. About 3 years ago or so I tried to discuss the difference
with a few people (not on this list), but got no real result. It is
simply too unclear and different from language to language.

The only language I know implementing Traits is Scala and there it is
done to simulate multiple inheritance. Seems like the idea was to give a
portion of Ruby mixins and Java interface in a bottle and shake it. As
Scala is a static language traits are of course a compile time construct
there... but that does not mean it has to be in Groovy such a construct too.

As you can see in http://www.scala-lang.org/intro/mixin.html Scala has
also mixins but these are really traits. Maybe
http://www.cs.utah.edu/plt/publications/aplas06-fff.pdf is of interest
as well... surely scheme is not known to be a compile time language. The
first definition I can find is
http://www.iam.unibe.ch/~scg/Research/Traits/ and there it says nothing
about compile or runtime, but it tells that the hierarchy is not changed
by traits... If anything, then I would say our categories and DGM and
this Alex' mixins are traits then. At last if you take "affects the
hierarchy" as key.

But as I said... let us first look at what we want, what we have and how
we want to use it before giving it real names

bye blackdrag

--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: mixins etc.

LightInTheBox - Buy quality products at wholesale price