Profile cover photo
Profile photo
Matthias Keil
1 follower
1 follower
About
Posts

Post has attachment
TreatJS 2.*
TreatJS 2.* is a redesign and a reimplementation of the TreatJS 1.* contract system for JavaScript. Even through it preserves most of the existing features,  t her e a re some significant differences bet wee n both versions. It gets rid of the four-valued l...

Post has attachment
Play arround with TreatJS Invariants
This post demonstrates TreatJS-Invariants and a new special FunctionContract for Constructors . Both implementations are still in a draft state and will be extended with more features over time. A first implementation will be available in TreatJS 1.4.1 PoC ...

Post has attachment
Play arround with TreatJS Invariants
This post demonstrates TreatJS-Invariants and a new special FunctionContract for Constructors . Both implementations are still in a draft state and will be extended with more features. A first implementation will be available in TreatJS 1.4.1 PoC .

Consid...

Post has attachment
TreatJS Temporal Contracts
A first taste of Temporal Contracts in TreatJS . (Upcoming TreatJS 1.4.* ) Temporal Contracts on Functions: function plus (x, y) {
return x+y;
}

var Plus = Contract.assert(plus, Contract.With(this,
Contract.Yield(Contract.Constructor(function(plus)...

Post has attachment
JavaScript and the Object-Identity
What does a === b = true mean ? 1. == is weak ? function testEq (a, b) {
return ( a == b ) ? typeof a : "false";
} testEq("1", true); // string
testEq(true, "1"); // boolean testEq ("1", 1); // string
testEq (1, "1"); // number The values are equals, but ...

Post has attachment
Implementing Pseudo-Proxies in JavaScript
JavaScript Proxies are an upcoming extension to the JavaScript standard.
However, some features of proxies can be mimicked by normal objects using getter/setter function. Have a look: For Object: function Placebo(target, handler) {
var placebo = {}
for...

Post has attachment
JavaScript Functions with Dynamic Global Global Objects
In JavaScript it is still possible to set the this -reference of a function. function add () {
return this.x + this.y;
}
add.apply({x:1,y:1}); // 2 But, a sandbox encapsulation can also change the global-object of a function. var x = 1;
var y = 1;
function...

Post has attachment
About JavaScript Proxies
An all-traps Example of JavaScript Proxies   Corresponding to the API Handler  (Version: May 26 2014)    function Handler() {
this.getOwnPropertyDescriptor = function(target, name) {
return Object.getOwnPropertyDescriptor(target, name);
};
...
About JavaScript Proxies
About JavaScript Proxies
matthiaskeil.blogspot.com

Post has attachment
JavaScript Object Id
Sometimes a developer would like to have an unique object id, which may be used as identifier or counter.    var x = new X();
x.id; // ? Unfortunately JavaScript does not have anything
like that.  Object.defineProperty(Object.prototype, "id", {
get: (fun...
JavaScript Object Id
JavaScript Object Id
matthiaskeil.blogspot.com

Post has attachment
An all-traps Example of JavaScript Proxies
function Handler() {
this.getOwnPropertyDescriptor = function(target, name) {
var desc = Object.getOwnPropertyDescriptor(target, name);
if (desc !== undefined) desc.value = desc;
return desc;
};
this.getOwnPropertyNames = funct...
Wait while more posts are being loaded