Are mixins considered a design pattern? Structural?
+2
A:
Yes, it is in D.
"A design pattern is a general reusable solution to a commonly occurring problem in software design" -- Wikipedia
D is compiled to machine code and with the use of mixins you can use it to make templates even more useful than they are in something like C++.
Tim Matthews
2009-02-12 21:25:01
+1
A:
They're a language feature. A "pattern" is different from a feature, in that it resolves a set of forces that may influence a situation in contradictory ways. Features, by their presence or absence, tend to create the forces that patterns resolve. Many design patterns (Double Dispatch is a good example) came about to work around language limitations (in this case method dispatching on a single argument).
Morendil
2009-02-12 22:07:02
Not in .NET. It's more like a pattern.
4thSpace
2009-02-12 23:10:14
If you know the answer, why are you asking the question ? ;)
Morendil
2009-02-12 23:46:21
keyword is "like". That sounds unsure to me.
4thSpace
2009-02-13 01:19:41
OK, I guess that answers the above. What will you do different based on whether it's considered a pattern or something else ?
Morendil
2009-02-13 15:10:19
Looks like we're back to subjectivity so lets leave it where it is. To answer your question - nothing. Would you say mixins are similar to the visitor pattern? And in .NET through extensions - decorators?
4thSpace
2009-02-13 17:14:25