Skip to content

Instantly share code, notes, and snippets.

@petsel
petsel / Array.flatten.js
Last active October 10, 2016 09:45
"Math.average", "Math.sum", "Array.flatten", "Array.shuffle", "Enumerable.shuffle", "Array.unique", "Enumerable.unique"
composable("composites.Array_flatten", function (require, global) {
"use strict";
var
environment = require("environment_extended_introspective_core"),
environment_introspective = environment.introspective,
@petsel
petsel / Function.afterFinally.js
Last active September 1, 2020 21:55
possible implementation of prototypal method modifier [afterFinally].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Function.afterThrowing.js
Last active September 1, 2020 21:44
possible implementation of prototypal method modifier [afterThrowing].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Function.around.js
Last active September 1, 2020 21:45
possible implementation of prototypal method modifier [around].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Function.after.js
Last active September 1, 2020 21:48
possible implementation of prototypal method modifier [after].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Function.before.js
Last active September 1, 2020 21:36
possible implementation of prototypal method modifier [before].
(function (Function) {
const fctPrototype = Function.prototype;
const FUNCTION_TYPE = (typeof Function);
function isFunction(type) {
return (
(typeof type == FUNCTION_TYPE)
&& (typeof type.call == FUNCTION_TYPE)
&& (typeof type.apply == FUNCTION_TYPE)
@petsel
petsel / Function.toApplicator.js
Last active December 23, 2016 10:00
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.
/**
*
* 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.)
@petsel
petsel / Die-vielen-Talente-von-JavaScript.md
Created June 5, 2014 10:10
Die-vielen-Talente-von-JavaScript.md

#Die vielen »Talente« von JavaScript

[TOC]

##Die vielen Talente von JavaScript Rollen-orientierte Programmieransätze wie Traits und Mixins verallgemeinern zu können

###TL;DR / Abriss

@petsel
petsel / The-many-Talents-of-JavaScript.md
Last active February 21, 2017 11:33
The-many-Talents-of-JavaScript.md

#The many »Talents« of JavaScript

[TOC]

##The many talents of JavaScript for generalizing Role Oriented Programming approaches like Traits and Mixins

###TL;DR / Summary

@petsel
petsel / __thoughts-about-how-to-adopt-principles-of-aop-to-javascripts-dynamic-and-functional-nature.md
Last active December 17, 2015 23:39
1) thoughts about how to adopt the principles of aspect oriented programming to JavaScripts dynamic and functional nature.2) point (1) now gets accompanied by a working implementation - "modification.ao.js" - of an aspect oriented system as proof of concept.3) there is a working "logging" example now too as always if one needs to justify the exi…

roughly sketched

  • runtime based only and not using any kind of JavaScript "transpilers" or JavaScript build tools for "code weaving" as in e.g. AspectJ.
  • thus being forced focusing on what ES3 language core does provide.
  • implementation of prototypal method modifiers e.g. Function.prototype.before, Function.prototype.after, Function.prototype.around as minimal set of a kind of an AOP base that already supports library / framework agnostic modification of function based control flow by just wrapping additional behaviors / advice handlers around existing methods / functions.
  • clarify role of Joinpoint, Pointcut, Advice, Aspect; especially from this point of view of what makes them distinct from existing approaches in compiled and/or non dynamic and/or non functional programming languages.