#The many »Talents« of JavaScript
[TOC]
##The many talents of JavaScript for generalizing Role Oriented Programming approaches like Traits and Mixins
###TL;DR / Summary
(function (Function, Array) { | |
var | |
function_prototype = Function.prototype, | |
isFunction = (function (TYPEOF_FUNCTION) { | |
return function (type) { | |
return ((typeof type == TYPEOF_FUNCTION) | |
&& (typeof type.call == TYPEOF_FUNCTION) |
(function (Object) { | |
var | |
expose_internal_value = Object.prototype.valueOf, | |
NULL_VALUE = null, |
composable("composites.Range", function (require, global) { | |
"use strict"; | |
require("environment_extended_introspective_core"); |
composable("composites.Array_flatten", function (require, global) { | |
"use strict"; | |
var | |
environment = require("environment_extended_introspective_core"), | |
environment_introspective = environment.introspective, |
/** | |
* | |
* Prevent function based "Role" pattern implementations[1] like "Mixin"s, | |
* "Trait"s or "Talent"s from getting instantiated by turning them into | |
* callable objects. Thus creating real objects but providing [call] and | |
* [apply] as standard call/delegation methods to them. | |
* | |
* The concept will be promoted as "Applicator" in order to distinguish | |
* it from "Constructor". (Though in theirs wording both do follow the | |
* same track.) |
trait customTrait { | |
use { Trait_A, Trait_B, Trait_C } | |
apply all | |
apply all without { methodName_z, methodName_y } | |
apply { Trait_A } |
#The many »Talents« of JavaScript
[TOC]
##The many talents of JavaScript for generalizing Role Oriented Programming approaches like Traits and Mixins
###TL;DR / Summary
(function (global) { | |
'use strict'; | |
var | |
Array = global.Array, | |
Object = global.Object, | |
RegExp = global.RegExp, | |
Function = global.Function, |
// file "Object.getMaxDepth.js" | |
const Object = global.Object; | |
const object_prototype_toString = Object.prototype.toString; | |
const object_keys = Object.keys; | |
const math_max = global.Math.max; | |
const isArray = global.Array.isArray; |