Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Mixin
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Programming languages that use mixins== Other than Flavors and CLOS (a part of [[Common Lisp]]), some languages that use mixins are: *[[Ada (programming language)|Ada]] (by extending an existing tagged record with arbitrary operations in a generic) *[[C Sharp (programming language)|C#]] (since C# 8.0, by means of ''default methods'' of interfaces)<ref>{{Cite web |last=Bill Wagner |title=Create mixin types using default interface methods |url=https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/mixins-with-default-interface-methods |access-date=2022-04-18 |website=docs.microsoft.com |language=en-us}}</ref> *[[Cobra (programming language)|Cobra]] *[[Adobe ColdFusion|ColdFusion]] (Class based using includes and Object based by assigning methods from one object to another at runtime) *[[Curl (programming language)|Curl]] (with Curl RTE) *[[D (programming language)|D]] (called [http://www.digitalmars.com/d/template-mixin.html "template mixins"]; D also includes a [http://dlang.org/mixin.html "mixin"] statement that compiles strings as code.) *[[Dart (programming language)|Dart]] *[[Eiffel (programming language)|Eiffel]] (called "non-conforming inheritance"; uses normal classes inherited using the "inherit {NONE}" keyword)<ref>{{Cite web |date=2024-06-03 |title=ET: Inheritance |url=https://www.eiffel.org/doc/eiffel/ET-_Inheritance#Non-conforming_inheritance |access-date=2024-11-05 |website=www.eiffel.org}}</ref> *[[Factor programming language|Factor]]<ref>{{cite web |author=slava |date=2010-01-25 |title=Factor/Features/The language |url=http://concatenative.org/wiki/view/Factor/Features/The%20language |accessdate=2012-05-15 |publisher=concatenative.org |quote=Factor's main language features: … Object system with Inheritance, Generic functions, Predicate dispatch and ''Mixins''}}</ref> *[[Groovy (programming language)|Groovy]] *[[Go (programming language)|Go]] (by struct embedding) *[[Java (programming language)|Java]] (since Java 8, by means of ''default methods'' of interfaces) *[[JavaScript#Delegative|JavaScript Delegation - Functions as Roles (Traits and Mixins)]] *[[Kotlin (programming language)|Kotlin]] *[[Less (stylesheet language)|Less]] *[[Magik (programming language)|Magik]] *[[MATLAB]]<ref>{{Cite web|url=https://in.mathworks.com/help/matlab/mixin-classes.html|title = Classes - MATLAB & Simulink - MathWorks India}}</ref> *[[OCaml]]<ref>{{cite web | url = https://www.lexifi.com/blog/ocaml/mixin/ | title = Mixin objects | author = Alain Frisch | date = 2013-06-14 | publisher = LexiFi | accessdate = 2022-03-29 }}</ref> *[[Object REXX|ooRexx]] *[[Perl]] (through [[Moose (Perl)#Roles|roles]] in the Moose extension of the Perl 5 object system) *[[PHP]]'s "[[Trait (computer programming)|traits]]" *[[Python (programming language)|Python]] *[[Racket (programming language)|Racket]] ([http://docs.racket-lang.org/guide/classes.html#(part._.Mixins) mixins documentation]) *[[Raku (programming language)|Raku]] *[[Ruby (programming language)|Ruby]] *[[Rust (programming language)|Rust]] *[[Sass (stylesheet language)|Sass]] *[[Scala (programming language)|Scala]]<ref>{{cite web |url=http://docs.scala-lang.org/tutorials/tour/mixin-class-composition.html | title=Mixin Class Composition |publisher=[[École polytechnique fédérale de Lausanne]] |accessdate=16 May 2014}}</ref> *[[Smalltalk]] *[[Swift (programming language)|Swift]] *[[SystemVerilog]] *[[XOTcl]]/[http://wiki.tcl.tk/18152 TclOO] (object systems builtin to [[Tcl]])<ref>{{Cite web |title=XOTcl - Tutorial |url=http://media.wu-wien.ac.at/doc/tutorial.html#mixins |access-date=2023-05-23 |website=media.wu-wien.ac.at}}</ref> *[[TypeScript]] ([https://www.typescriptlang.org/docs/handbook/mixins.html mixins documentation]) *[[Vala (programming language)|Vala]] Some languages do not support mixins on the language level, but can easily mimic them by copying methods from one object to another at runtime, thereby "borrowing" the mixin's methods. This is also possible with [[static typing|statically typed]] languages, but it requires constructing a new object with the extended set of methods. Other languages that do not support mixins can support them in a round-about way via other language constructs. For example, [[Visual Basic .NET]] and C# support the addition of extension methods on interfaces, meaning any class implementing an interface with extension methods defined will have the extension methods available as pseudo-members.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)