views:

108

answers:

6

Well obviously Ruby and Sass, but what are some other ones?

A: 

Well, Flavors of course. This morphed into CLOS.

Doug Currie
A: 

JavaScript supports them. You can add functions/fields to an object's prototype anytime.

Sam
monkey patching != mixins
Matt Briggs
@Matt Briggs However, given certain flavors of JS -- in particular ones that supports setting `__proto__` -- you can get a similar effect as Ruby mixins by manually managing the `[[prototype]]` chains. You can also do something similar with crafted Constructor definitions, I believe, but in that case the `[[prototype]` is still fixed at construction time making it more of a 'dynamically set SI' hybrid.
pst
@Matt Briggs, you're right, and adding functions to the prototype and mixing in other functionality is different from Monkey Patching. Monkey patching is related but separate; replacing existing functionality by assigning replacement functions to the prototype. Luckily JS supports both.
Sam
+1  A: 

Both versions 1 and 2 of D support mixins.

Mark Rushakoff
+4  A: 

Wiki has a list

http://en.wikipedia.org/wiki/Mixin#Programming_languages_that_use_mixins

To quote:

Programming languages that use mixins

Other than Flavors and CLOS (a part of Common Lisp), some languages that use mixins are:

* ColdFusion (Class based using includes and Object based 
  by assigning methods from one object to another at runtime)
* Curl(with Curl RTE)
* D (called "template mixins")
* Factor[citation needed]
* Fantom
* Ioke
* JavaFX Script
* JavaScript
* Object REXX
* OpenLaszlo
* Perl[3]
* PLT Scheme (mixins documentation)
* Python
* Ruby
* Scala
* Smalltalk
* Strongtalk
* Vala
* Visual Dataflex
* XOTcl/TclOO (object systems for Tcl)[4]

Some languages like ECMAScript (commonly referred to as JavaScript) 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. Note that this is not possible with statically typed languages, where an object's signature is fixed at compile time.

DVK
A: 

Perl's Roles could be called mixins.

Gabe
+1  A: 

_why's potion language leaps to mind. The idea is that objects have state, and methods. In most languages, state happens in the object, methods happen on the class. In potion, objects have only state, methods are completely handled with mixins.

To quote from the readme

EVERYTHING IS AN OBJECT. EVEN MIXINS ARE OBJECTS. AND, OF COURSE, CLOSURES ARE OBJECTS.

However, OBJECTS AREN'T EVERYTHING. THEY ARE USELESS WITHOUT MIXINS.

on a side note, I miss why. we need more people doing wild stuff like this

Matt Briggs