jneen / pjs

Classes for javascript that don't suck.
MIT License
195 stars 29 forks source link

Cut features back down to <0.4kb #22

Closed laughinghan closed 10 years ago

laughinghan commented 10 years ago

Ignore the first 2 commits, they're from jayferd#21.

So there's minimalism, "do only a few things and do them well", yada yada, which I needn't repeat. But moreover, if there's features that we want to discourage people from using and that they also don't use, we should remove them.

I wasn't expecting you to roll out v5 so quickly, but I highly doubt anyone/hope no one is using the object literal shorthand, for the reasons listed in 751317e6c74d98c71abab52db7c200b7bf3d2c23, which is the only documented back-compat break in this PR, so I don't feel bad about rolling this out as a minor version (v5.1) if you don't.

I had a lot of fun watching the minified size go down, can you think of anything else to cut? If we cut .extends, .constructor, and .Bare we can get it down to 300 bytes, but I like all those.

jneen commented 10 years ago

uhhhh, you realize that people are using the object literal shorthand in like, production, right? That's not getting cut. And passing the class itself as this is used in Parsimmon, iirc. Also not getting cut. Other than those two things, these look good.

jneen commented 10 years ago

Also, for the future, I'll update the README on releases only, because holy crap the merge conflicts

laughinghan commented 10 years ago

Hehe yeah rebasing sucked, the README conflicted every single commit.

Parsimmon is not using this as the class anywhere that I can see, but Fragment in MathQuill is, which it shouldn't and I want to change, is what I'm saying.

Who is using the object literal shorthand (which, for a shorthand, has a really long name) in prod and why? It's like using 2-line if-statements without braces, but worse for everyone! :crushing_my_dreams: :anguished:

jneen commented 10 years ago

oh, so i already merged a modified version of this (and fixed the issue I commented on), so i'll close for now. Object literals are often used for small extensions, or small abstract classes, like

var Cell = P({ get: abstract, set: abstract });
laughinghan commented 10 years ago

Fair, I'll close this. (Btw, isn't it good git etiquette to preserve author information when cherry-picking commits? Not that I really care, it's already pushed)