The bowl and ingredient analogy is confusing—Preceding unsigned comment added by 141.154.250.176 (talk • contribs) 14:53, 2 June 2004
| This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
The bowl and ingredient analogy is confusing—Preceding unsigned comment added by 141.154.250.176 (talk • contribs) 14:53, 2 June 2004
Also the term WHOPPER is used without any reference. What a wrapper is, is somewhat clear (wraps something, usually a function), but a whopper sounds like Burger King. — Preceding unsigned comment added by 129.247.247.239 (talk) 17:58, 18 May 2022 (UTC)
I always wondered: are Mixin's "bad"? I'm sure the proper answer is that they're useful in some scenarios, but detrimental in others. What should I look out for? What are similar paradigms that get mistakenly used as Mixin's? I don't want to suffer from Golden hammer syndrome, if there's something that answers the problem better... --Eddie Parker 13:19, 2 May 2005 (UTC)
Link to Flavors needs a substantive page.—Preceding unsigned comment added by 217.43.207.44 (talk • contribs) 22:42, 18 June 2005
Inheritance can indeed be used to refactor common behavior, so mixins are just another way of getting the same functionality, AFAIK. (*)
Well, CLOS generic functions allow multiple dispatching, but I don't know if this has something to do with mixins... Maybe it cannot be donne (except for the trick in Visitor) with the other sintax?
(*) Mixins add the benefit of being suitable for some aspect-oriented programming. This is because they can refactor methods from classes that have nothing in common (so it would be a bad practice to make them inherit from a common base). This is also true with the very similar way of ArtScript for defining class attributes. Anyway I wonder wether the benefits of AOP which mixins bring couldn't be reached using multiple inheritance...
Could someone familiar with this concept provide a simple code example? John (Jwy) 18:22, 1 April 2006 (UTC)
I've just accidentically stumbled into this article, and I get the severe feeling that it is misleading and incomplete. Most importantly it doesn't really give substantial information, what a mixin is. Then, it is too fixated on specific programming languages. Using mixins is a a programming style, which by and large can be used in nearly every programming language. Just google for Mixin+C++ to get a hint. E.g. Smaragdakis and Batory.
I only have time for this notice right now, but I'll have a try at the article in the future.
Pjacobi 12:30, 12 April 2006 (UTC)
Yeah, I'd also like some elaborations. 5 years later the above message, I read this and still have no clue on what those things are. Reading this page or not is pretty much the same. It's so vague I don't even have an idea on what I'd like to know more!
MaxDZ8 talk 18:06, 9 September 2011 (UTC)
Maybe I'm being dense but this article doesn't describe what problems mixins are supposed to solve? It's funny that the very fisrt paragraph is all about the history of simula in the 70s or something instead of some clear and non vague reason for the existence of this concept (seperately from interfaces and multiple inheritance I mean).
The way I understand it if B inherits A, C inherits A and you attempt do to multiple inheritance like in D inherits B and C, then if B and C can be instantiated (have a constructor) you either have to somehow choose how the A part in D will be constucted (which constructor to use), or have two copies of A in D. So mixins basically say that B and C can't be constructed like that, they can't exist on their own with their own A, so you just put an A part and complete the hierarchy. — Preceding unsigned comment added by 94.68.184.180 (talk) 17:59, 12 September 2011 (UTC)
I read this article, several times and I still do not have a clue as to what it is talking about. I suggest an example using a fairly well known language such as Java or C++ or C# rather than Lisp. The first part of this topic should provide a more layman's type of description of a mixin then follow that up with a section of esoterica, clearly labeled as such, so that those of us who just want the basic concept can get that and move on. 08 November, 2011. — Preceding unsigned comment added by 141.165.211.254 (talk) 21:58, 8 November 2011 (UTC)
I think the #1 reason it is confusing is that it mistakenly uses the word "mixin" for both the class in which the composition takes place (in the first sentence) and also for the classes which implement the orthogonal functionalities to be composed (in the Python example). It has other flaws aswell. I recommend putting some warning ontop that it is of low quality (I have seen such on other pages). — Preceding unsigned comment added by 46.249.133.113 (talk) 16:48, 3 January 2014 (UTC)
Given the popularity of Javascript, it should probably get added to the list of languages that use Mixin for object creation. In Javascript, you define the class and add the methods afterwards. You can add methods new at runtime. data64 17:59, 24 September 2006 (UTC)
The first JavaScript example that used Underscore.js was broken in many ways. I just tried to rewrite it, and it works now, but I don't know if it's the best example. Let99 (talk) 07:13, 25 October 2015 (UTC)
I removed PHP. How can you have mixins in PHP when PHP only has single inheritance? That gives you no room to "mix in" the mixin class. The best you can do is declare a class as abstract and inherit from there, but how can that be a "mixin"? Cburnett 03:20, 26 June 2007 (UTC)
I also removed ColdFusion. Again, like PHP, it does not have multiple inheritances so how can mixins work? Cburnett 23:35, 27 June 2007 (UTC)
How can a programmer in mixin enabled programming languages decide which methods/attributes of a superclass shall be mixed in to the to developed subclass and which not? --Abdull (talk) 15:57, 8 February 2008 (UTC)
"However, mixins introduce their own set of compromises."
What compromises? What compromises of multiple inheritance do mixins avoid?
Fresheneesz (talk) 17:50, 26 April 2010 (UTC)
The paragraph starting with "A mixin can defer definition..." in the introduction states properties of mixins that are not general; they probably occur in a specific language that the writer had in mind. I think that it should not appear in the intro. AmirOnWiki (talk) 15:52, 3 June 2010 (UTC)
Under Commentary:
In my reading, references 6 and 7 conclude that mixins are NOT supported by C#. Reference 5, in my opinion, falls short of showing support for mixins. —Preceding unsigned comment added by 68.55.206.131 (talk) 22:34, 8 February 2011 (UTC)
C++ does support mixins for example with virtual inheritance, where the top corner is the interface, the middle classes are the mixins, and the bottom class is the one you build up with the lego-like mixins. Agree to add it? Dgutson (talk) —Preceding undated comment added 06:30, 27 May 2011 (UTC).
C++ also supports static (compile time) mixins with open inheritance templates. A template class/struct can use a template parameter to be its parent class, making the class plug-able to exiting functionalities, augmenting them.
template<typename O>
struct Hello:O {
void hi() {cout<<"augmented hello...";}
};
struct Existing {};
using myType=Hello<Existing>;//composing
//from now on we can use `myType` to build objects and they will have both the functionalities of `Existing` and `Hello` classes/struct
What about "Class helpers" in Object Pascal resp. Delphi, can they be seen as an implementation of this concept? — Preceding unsigned comment added by 89.204.153.98 (talk) 09:28, 15 February 2012 (UTC)
"a mixin (or mix-in) is a class that contains methods for use by other classes without having to be the parent class of those other classes."
According to this sentence that means that in Java, a public static method is a mixin. It can be used by other classes and also it does not need to be a parent class. Well, I am not sure that it is a mixin according to some other sites. — Preceding unsigned comment added by 109.245.225.91 (talk) 14:49, 20 January 2021 (UTC)
In object-oriented programming languages, a mixin (or mix-in) is a class that contains methods for use by other classes without having to be the parent class of those other classes.
A mixin class acts as the parent class, containing the desired functionality.
Pink pipes (talk) 14:13, 14 March 2025 (UTC)In object-oriented programming languages, a mixin (or mix-in) is a class that contains methods for use by other classes without having to be the primary parent class of those other classes.
A Mixin class is not a class that is a combination of methods from other classes. It is simply a class that is meant to to be inherited by some class that is also inheriting from one or more other classes and is meant to provide a specific service to its clients. Thus it is its clients that are using multiple inheritance (and are thus "a combination from other classes", but I would choose not to express it in these terms) -- but they are not the Mixin classes. Raaronson (talk) 23:10, 5 January 2014 (UTC)
Go has mixins. Actually they are very important as there is no inheritance. — Preceding unsigned comment added by 203.161.136.173 (talk) 23:20, 28 June 2017 (UTC)
Hello fellow Wikipedians,
I have just modified one external link on Mixin. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.
This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).
Cheers.—InternetArchiveBot (Report bug) 00:03, 3 February 2018 (UTC)
The V language was summarily blocked from inclusion by certain opposing editors. Arguably unfair special new criteria or language preferences are imposed, beyond having a Wikipedia page and notability.
V, based on TIOBE and GitHub rankings, is verifiably about or more popular than Less, D, Groovy, and Vala, which were languages placed in the article unchallenged and without abrasive reversions. Wukuendo (talk) 06:44, 28 May 2025 (UTC)
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.