Show HN: Theory.js – Abstraction layer for cross-platform JavaScript
github.com
github.com
It is thoroughly tested: IE6-10, FF3.6-23, Opera 11+, Safari 5+, Android 2.3.4+, iOS 6.1.3+, Windows 8phone, Chrome, and Node.
All code is just three things: Data, Manipulation, and Communication. Theory represents having good control over data, with strong type checking.
Do you mean that figuratively or literally? I can't tell if you're working towards some super OOP magic or good support for like 3D vectors and events.
However you mean, I like the sound. Looking forward to seeing what else shakes out!
EDIT: I am now noticing your myojs stub and thinking that you mean "tactile-spatial" quite literally.
I'm going to hazard a guess that your work has been predominately if not exclusively as a solo dev. This is effectively your personal utility library. That's cool. The problem is that virtually all software eventually ends up being a team effort, if nothing else than by the guy/gal who has to work on it after you. You may not like how JS does some things (like zero-indexing), but that guy already knows JS, he doesn't know your library. By revamping core semantics of JS, you're forcing him to learn your opinions. Are you so sure of your opinions that you can confidently say it's worth everyone else undergoing that effort? Are your opinions really so important as to break compatibility with every other piece of JS?
I gather from your comments that you intend this library as the base of a larger project. I'd encourage you to base that project on more widely known foundations -- pick your favorite module system, and use underscore.js or one of the other widely vetted and tested utility libraries.
The only library I have been able to consistently trust is jquery. At a certain point as a developer you have to decide what is best for you and your code, and in my case it is relying on this library, because I know I can trust it.
You might like lodash.js if cross-browser consistency is your true goal.
Generally I have found that the libraries that are loud and popular wind up performing inferior to more obscure libraries which I use. Not that the loud ones are bad, they just can't handle my specific projects.
"a reliable yet tiny library (at 7KB gzipped) that would
normalize everything so any code written would literally
work everywhere"
I felt the same way about needing to normalise client and server side, but the goal seems forever ambitious, considering not even IE8 can handle an extra trailing comma. This is not the only universal solution you will be using.Suppose I'm thinking, "hmm, is this text?" or "is this a number?"
To do this with the API you have looks like this:
a.text.is(myVariable); // to check if myVariable is text
a.num.is(myVariable); // to check if myVariable is a number
But just reading the code makes is backwards with respect to the phrase it represents (my bias). A more intuitive API call might be: a.is.text(myVariable); // reads like the phrase
a.is.num(myVariable); // reads like the phrase
Even better might be: is(myVariable).text(); // nearly self documenting this way
is(myVariable).num(); // ditto
Just some thoughts. Reading the API calls the way they are keeps sounding wrong in my head (clearly a bias).Check out my gist I posted, should be on a comment-branch nearby.
a(myVariable).is.text
or
a(myVariable).is().text
Either way for me.
https://gist.github.com/amark/6298069 include as a dependency then use as "a.is(myVariable).text"!
ex: obj.get('a.*.b') -> returns all b's in objects that are of the array 'a'
Shameless plug: https://github.com/dclowd9901/lscenery