puma icon indicating copy to clipboard operation
puma copied to clipboard

Function.prototype.bind() method fails

Open Undre4m opened this issue 9 years ago • 3 comments

Using the Function.prototype.bind() method [http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.4.5] makes the process fail or doesn't return the object correctly. E.g.:

var scope = 'global';
var order = { scope: 'THIS', getScope: Function('return this.scope;') };
var unbound_scope = order.getScope;
var order_scope = unbound_scope.bind(order);
order_scope();

or

this.x = 9; 
var module = {
  x: 81,
  getX: function() { return this.x; }
};

var retrieveX = module.getX;

var boundGetX = retrieveX.bind(module);
boundGetX();

Undre4m avatar Oct 05 '16 03:10 Undre4m

Have you got some error description? Regardless I'll check it.

nestornav avatar Aug 24 '17 00:08 nestornav

First example fails without throwing error. As for expected return in second example (which doesn't seem to fail) we should read the linked ECMA section thoroughly and check it.

Undre4m avatar Aug 24 '17 00:08 Undre4m

I'm working on it

Pignatar0md avatar Sep 08 '17 23:09 Pignatar0md