« first day (417 days earlier)      last day (4537 days later) » 

1:00 AM
because of the huge community and knowledge that came from all kind of sides
 
make dom-shim use $, make pd use _, mimick the APIs which is actually favored, increase readability, reliability, speed, decrease complexity and kb, and i may use them both
 
well, maybe not really fixing some, but at least work around in way that works anyhow
 
ie6 world wide usage last month: 7.9%
ie6 world wide usage this month: 8.3%

WTF?!
 
@Thomas: what means, "use $" ?
 
bwahahaha
 
1:02 AM
@jAndy :)
 
That means someone installed 8 million fucking copies of the thing.
are people insane?
 
@Incognito: bot network in redmond :p
 
i suspect the same thing
 
@ThomasBlobaum screw you
 
sounds reasonable anyway, again asia, india
 
1:03 AM
maybe its because healthcare stuff picking up because of the winter :P
 
russia even maybe
 
@Raynos _ for pd is actually a good idea
 
pd is 600B. pd has a sensible API, if you have real objections, mention them
 
@jAndy Russia's fine, 2%.
 
Then use _ I dont care what you name it
var _ = require("pd");
 
1:04 AM
be underscore's zepto
and be fully async
 
pd and underscore are not related at all
@ThomasBlobaum Y U TROLL
 
they are too
 
underscore -> functional sugar
pd -> prototypical sugar
 
underscore is bloated compared to pd though
 
I don't even know what pd is
rofl
 
1:06 AM
police department
 
@ThomasBlobaum windows is bloated compared to chrome
 
heh
 
pd does some of the same things
 
Like what, extend?
 
1:06 AM
it would be neat if it matched underscore
people might actually read the project, perhaps following it
 
@ThomasBlobaum it does match it
_.extend and pd.extend have the same API
There is zero equivelance for pd, pd.make or pd.beget
 
yes now you are getting it
 
now quit your trolling and actually read my fucking documentation
 
i already read the funny manual and it looked like i had to understand @Raynos before i could understand pd
 
If you have some real comments on why my documentation is not readable please share them
 
1:09 AM
where is the doc
 
ok I just thought there is some link to an external page
 
Nop
 
all im saying is to add some of the api methods from underscore and such
they are solving the same problem
 
so basically pd removes the verbosity of .defineProperties and all kind of ES5 .bind(), .create()
into an api ?
 
1:11 AM
@ThomasBlobaum no, theres no reason to port any functionality from underscore into pd
 
ofc underscore solves a ton of other shit, some of which you could make more efficient
 
@jAndy pd handles general ES5 OO verbosity
 
things people actually want a toolkit for
@Raynos there is room for node.js/async underscore variant right now
 
var o = pd.make(proto, someObj, someOtherObject);
// ES5
var o = Object.create(proto);
Object.defineProperties(o, pd(someObj));
Object.defineProperties(o, pd(someOtherObj));
 
I see, I guess I have to like it then, even without knowing it, thats really a mess if you want to use all those methods natively
 
1:13 AM
put tmpl3 into pd and rename it to _ and you'll be halfway there
 
note that pd just implements es6 : getOwnPropertyDescriptor
 
but actually, its the same talk we had earlier about oldish browsers. I'm still pretty sceptical to write an app/website which totally makes usage of all ES5 OO features. It again just means I drop all those users we talked about
 
pd also supports prototypical OO with some sugar
 
there is no shim for all shiny things, unfortunately
 
var Klass = pd.Base.make({
  /* class props */
});

var SubKlass = Klass.make({
  /* more class props */
});

var instances = SubKlass.beget(...);
 
1:15 AM
thats why it could be aimed at node.js stuff
 
@jAndy pd only uses es5 oo features that are shimmable
 
anyways, brb
 
I dont promote using non shimmable es5 oo features
 
@Raynos You're like a troll magnet these days, I love it. I'm sitting here with popcorn.
 
@ThomasBlobaum as much as there is a room for a node/async underscore variant its not pd
 
1:16 AM
 
@Raynos: thats good! but I wasn't after pd when I said that. I actually urgently WANT to use all es5 greatness.. but something holds me back ^^
 
You want that, write another project
 
maybe the bad feeling of doing it
 
@jAndy what's stopping you from <script src="es5-shim.js" />
 
its not shimming everything
by far not, at least when I looked at the project a few days ago
 
1:17 AM
Why cant you use the shimmable subset of ES5 ?
I mean what's the problem with learning the safe subset of ES5 and using it today
I will have to do the same with the dom-shim
100% shim is impossible
all I can do is shim the safe subset
 
well.. some really nice features I'd actually love to use arent shimmable
 
Like?
Name them.
 
.defineProperties with all its options
.freeze
 
The only thin which isn't shimmable and a real problem are getter/setters
@jAndy why can't you emulate freeze as a no op?
 
stuff like that
 
1:19 AM
Your unit tests in chrome will fail if you abuse the freeze contract
 
@Raynos: I'm not talking about noops
 
Why do you use freeze?
what does it give you?
 
in my very own case, a pretty nice way to have a framework soft-protected
so its not possible to do damage by excident
 
Ok
So if you damage it by accident, how do you catch it?
Browser throws an error, right?
Your unit tests catch that error, right?
 
I'm just saying its a nice method to freeze objects
but if you use it, you want to rely on it
 
1:21 AM
Isn't enough to catch that error in one browser rather then all browsers?
 
probably
 
So having freeze as a no-op does no harm
 
you only need freeze for developing, which you do in a browser that supports freeze hopefully
 
why is that
 
it only has the positive effect of allowing you to debug the security in a compliant browser
freeze is a developer tool, not an end user tool
You as the developer use it to assert your code behaves
and it crashes if it doesnt behave
 
1:22 AM
its a still a great method for production code, especially for librarys or frameworks which just don't want to allow modifying their objecs
 
Rather then being something that has to work everywhere
It's something that has to fail somewhere
 
the people using the framework cannot make their hacks work in good browsers
so they won't do it
 
You can use a fail somewhere today as long as you test in a browser that fails it
@jAndy is your objection to ES5 that you dont want your library users to be forced into using the es5 shim?
 
Ben
/herp
 
@Raynos: not really, I only want to be sure that I can use any feature no matter what. but that is .. dreaming I guess
 
1:24 AM
I mean someone hacks your framework in IE6 because he can write but then opens up chrome and error is thrown ?
 
@Esailija: ...
you didn't get it
if your objects need to be secured or are highly depenend on integrity, its a nice way to have those methods on your side
 
But it wouldn't matter if freeze is a no-op in IE and works in chrome
 
ofc its not dead necesarry, but it would be a 'nice to have'
lets forget about freeze
 
and object.keys shim just sucks
 
which other methods can't get shimmed really ?
 
1:27 AM
@jAndy but why must security work on all browsers? :\
Why is it not enough for security to work in just one browser
 
keys() really?, wouldn't it just be a loop over objects with a simpley hasOwnProperty check?
 
well there isn't anything really.. getters and setters..
yeah I didn't say it wouldnt work
but the whole point is the speed of the native one
 
you realise Object.freeze is not a real security feature right?
 
@Raynos: ofc not
just for integrity
 
@jAndy getOwnPropertyNames will fail
 
1:29 AM
so is .seal()
 
getter/setters fail
Object.create(null)
freeze/seal etc don't fail as badly
non-enumerability is a bug fail
enumerability is a "Must work in all platforms" thing
same with getOwnPropertyNames
writablity, freezing, sealing, configurability is a "must fail on one platform" thing
anything thats a "fail on one platform" is "safe" to emulate with a "no-op"
same for es5 strict
 
@Raynos: no matter if the shim implementation is noop or does crazy stuff, does it mean your list above is just not usable in order to have code that works ?
 
what it means is that Object.create(null) acts differently cross-browser and causes convergent code paths that do not throw errors
Object.freeze acts differently cross browser but causes convergent code paths where one throws an error and the other doesn't
I think the former is worse then the latter
 
I try to imagine a scenario iwhere you really must rely on a complete empty object
which would fail if that is not given
 
only Object.create(null), non-enumerability, getOwnPropertyNames and getter/setters are major breakers
Object.create(null) isn't that important. There are some use-cases like nice dictionaries dict["toString"] etc
 
1:33 AM
would only like getters and setters and those are kind of "meh" as well :/
 
Oh and Object.getPrototypeOf fails for bad code. But that's not really a problem you care about
@Esailija getter/setters are the devil >_>
 
can you create real private (hidden) properties in the prototype chain only with shimmed methods?
 
how would you recognize that a setter was called from outside
a function in js is never aware of anything
 
@jAndy sorry?
var Klass = (function () {
  var privates = pd.Name();

  return {
    setMagic: function (v) { privates(this).magic = v; },
    getMagic: function () { return privates(this).magic; }
  };
})();
The best way to do private state with prototypes is to attach private state to a "class"
 
@Raynos: I'm just asking, didn't really do object creation/inheritance entirely with es5 goodies so far. Is it actually possible to hide/create somewhat private properties with Object.create(), .defineProperties() and stuff?
 
1:37 AM
unless you have a handle to the privates method you cannot read it.
 
or is that task still up to closures
 
that's just a closure hack that will not be worth it at all
 
@jAndy it's the task of closures. But you there are clever gateway techniques
 
@Raynos: so even with es5 greatness you can't hide properties on the prototype?
 
@Esailija well it's slightly different because my version doesn't encur the all methods must be in the constructor penalty
@jAndy why would you want to? How would it work?
No you can't
to be able to access private data you need a key
to hide a key, you need a closure
 
1:39 AM
yeah but hidden properties are for developers, you can just use public properties prefixed with _ and not incur any penalty at all
 
@Raynos: enumerable, configurable.. I thought that stuff was just made for tasks like that
 
@Esailija true there is some run-time penalty to get the privates object bound to the instance
@jAndy how would it work?
 
@Raynos: I have no clue, thats why I'm asking :)
 
I personally think pd.Name is the most elegant solution we have in ES5
 
well it's better than creating shit ton of closures on every instantiation D:
 
1:40 AM
@Raynos: why would I actually set enumerable:false and configurable:false on a property then ?
 
the privates function takes an object and returns a "secret" object
@jAndy enumerable: false to remove it from for ... in
configurable : false to have delete foo.prop fail
 
so its also basically just pseudo-hidding and integrity
 
writable : false to have foo.prop = newVal fail
@jAndy yes, pseudo hiding from enumeration and integrity
all freezing is done is make all properties non writable and non configurable
or was that sealing?
 
dunno, but it was pretty similar :p
 
Note that Object.getOwnPropertyNames returns a enumerable properties
freezing does everything
sealing just makes the object non configurable but leaves properties writable
Oh and pd.Name basically returns a weakmap
So your privates object is a private WeakMap<instance> = secret
private to the "class" object
 
1:45 AM
hmmm+
that sounds to me.. like Function.prototype.bind() is probably the most important part at all in ES5 for OO sugar
 
No
 
plus Object.create
 
.bind is the most important part in ES5 for functional programming
 
you can shim .bind easily since javascript 1.0
 
.bind has nothing to do with OO
 
1:46 AM
yay you know what I mean
you can do lots of neat calls with bind
and yes, its actually easily handwritten
however, it happened to be no one really used that before it was 'official'
 
and wtf do you do with object.create it's just an harder to use alternative to new :P as described in es5 standards
 
I guess its too much trouble with new
 
how so
 
and it also allows for some simplistic prototypal inheritance
very easily
just looks more convinient, doesnt it
 
it doesn't matter if you do .create or new, it's still prototypical
 
1:49 AM
@Esailija not really
 
as in, objects inherit from other objects
 
with new you have to have those.. prototypal assignments somewhere "outside" and wierd stuff that comes along
 
The thing about new is that constructor functions are retarded
The thing about prototypical OO is dont use constructor functions
dont do .prototype = bla
@jAndy .bind has nothing to do with inheritance
 
no, you could make an empty constructor if your class was really that simple
but anyway
 
var Klass = {
  /* props */
};

var o = new Klass;
 
1:50 AM
@Raynos: I know, but it allows for sweet sugar
 
the main point is that objects inherit from other objects
 
Doesn't work because new sucks :(
 
not how you construct it
 
@jAndy what sugar?
@Esailija correct, but es3 oo doesnt make it easy at all whatsoever
 
@Raynos, sure that sucks for the default api
 
1:51 AM
So you cant do new <Object> pd allows you to do
 
@Raynos: mostly, calling conventions
 
but it's not hard to make your example work with new easily
 
var Klass = pd.Base.make({
  /* props */
});

var o = Klass.beget();
 
and what is so great about Klass.beget() vs new Klass :D
 
var Klass = function () { ... };

Klass.prototype = {
  /* props */
};

Klass.prototype.constructor = Klass;

var o = new Klass();
 
1:52 AM
yeah that's the default way
 
@Esailija the thing is your handle on the Klass is the prototype. Where as with ES3 you have to do Klass.prototype
 
you need a very small inheritance library to make it easy with new
 
but it looks, just.. wierd
 
and you have this annoying handle on some function
 
you don't even need to create a function =)
 
1:53 AM
@Esailija meh
If you want to support new, its easy
var Klass = Klass.constructor;

var o = new Klass;
 
$class( "Application.Person", {sayHello: function(){}} );

var a = new Application.Person();
 
Using new with prototypes is easy, you just let KlassHandler = KlassPrototype.constructor
@Esailija an API like that deserves to be shot :P
The main problem is you dont need new or constructor functions
the main problem is that that is classical OO emulation
it should be avoided
 
you don't even need prototype chains actually
^^
 
You do
 
the concept objects inherite from objects works just like that in es
 
1:55 AM
it doesn't matter what the API is, it shows you can easily do with new if you make a small mini framework
 
prototype chains are a must for live class change reflection
@Esailija I know you can, I actively don't want to use new is all
It's a design choice I made. To not be reliant on new
 
@Raynos: I don't get that. live class change reflection? we're just talking about objects, whether it is a special named "prototype" or just any other object you pass throught and somewhat let other objects "inherit"
 
That framework is awesome that you don't need to call parent constructors at all
 
like good old crockford showed
 
$class( "Person", {

	Person: function( name, age ){
	this.name = name;
	this.age = age;
	},

	toStrin: function(){
	return this.name + " " + this.age;
	}

}
);

$class( "SubPerson", Person, {

	toStrin: function(){
	return this.name + " sub " + this.age;
	}


});


$class( "SubSubPerson", SubPerson, {

	SubSubPerson: function(){
	this.parent( arguments );
	},

	toStrin: function(){
	return this.name + " sub " + this.age;
	}
});

test = new Person( 12, 12 );
test1 = new SubPerson( 12, 12 );
test2 = new SubSubPerson( 12, 12 );
 
1:57 AM
@jAndy you need inheritance for it to work
@Esailija hello classical OO emulation.
 
all persons will have automatically age and name
without me having to call any constructors
 
@Esailija hello doing it wrong. Get rid of this classical OO nonsense
 
in the sub classes
 
var o = {};
var b = Object.create(o);
o.foo = 42;
assert(b.foo === 42);
 
also supports final, override, static
 
1:59 AM
@jAndy live property changes reflecting down prototype change is why you need inheritance
@Esailija c# / java troll. Seriously you know classical OO emulation is doing it wrong right
 
^^ it's still prototypical <3
 
All you want is a some small building blocks that pd offers
 
objects inherit from other objects at the backgrounds
it's just not so obvious anymore
 
You can do it differently if you wanted to.
var SubKlass = pd.make(Klass, props);

var instances = pd.beget(SubKlass);
 

« first day (417 days earlier)      last day (4537 days later) »