PLDB
Languages Features Creators Calendar CSV Resources Blog About Donate Add Language
GitHub icon

Mixins

< >
Example from Python, Cython:
# https://easyaspython.com/mixins-for-fun-and-profit-cb9962760556 class EssentialFunctioner(LoggerMixin, object):
Example from Ruby:
module A def a1 end def a2 end end module B def b1 end def b2 end end class Sample include A include B def s1 end end samp = Sample.new samp.a1 samp.a2 samp.b1
// https://www.typescriptlang.org/docs/handbook/mixins.html class SmartObject implements Disposable, Activatable { } // Note: still need to do some runtime ops to make that work.
Example from Julia:
# Including the same code in different modules provides mixin-like behavior. module Normal include("mycode.jl") end module Testing include("safe_operators.jl") include("mycode.jl") end
Example from Racket:
(mixin (interface-expr ...) (interface-expr ...) class-clause ...)
Example from Xtext:
grammar org.example.domainmodel.Domainmodel with org.eclipse.xtext.common.Terminals

Languages with Mixins include Python, Ruby, TypeScript, Julia, Racket, Cython, Xtext, Static Typescript

Read more about Mixins on the web: 1.

HTML of this page generated by Features.ts

hasMethods.html 路 hasMixins.html 路 hasModules.html

View source

PLDB - Build the next great programming language Search v2023 Day 157 Docs Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com