I gave a talk at London Ruby User Group yesterday, based on the work I’ve been doing on Heist, my Scheme interpreter project. I wrote the core of a basic Scheme interpreter in about 15 minutes as a live-coded demo (well, kind of – the coding was pre-recorded so I could focus on talking), which [...]
Another quick update: PackR received an update today that means that when you use its :shrink_vars mode, it won’t minify any variables called $super. In Prototype, $super is used to implement inheritance and your class definitions will break if you change its name. I didn’t really want to make PackR inconsistent with Dean’s original, but [...]
I’m telling you, this language keeps surprising me. You’ll need Prototype for this one. Function.prototype.toSelfCurrying = function(n) { n = n || this.length; var method = this; return function() { if (arguments.length >= n) return method.apply(this, arguments); return method.curry.apply(arguments.callee, arguments); }; }; Make a simple function: var adder = function(a,b,c) { return a + b [...]
Saq made a couple of comments on my ChainCollector article about how to queue up functions to respond to Ajax calls, and whether I could write something up to shed a bit of light on how this might be done. Today, I’m going to implement some methods that allow to GET from/POST to a URL, [...]
Though the API docs seem to make no mention of it, there is this little gem sitting in Prototype 1.6.0: Function.prototype.methodize = function() { if (this._methodized) return this._methodized; var __method = this; return this._methodized = function() { return __method.apply(null, [this].concat($A(arguments))); }; }; What that does is it returns a new function that calls the original [...]
Tiny update: after adding 16 characters (“this._object || “), Reiterate is now compatible with Prototype 1.6.0′s revised Hash API. Also, the gzipped copy is now even smaller, thanks to a different compression strategy. Essentially, when using Packer (or PackR for that matter), using ‘shrink variables’ plus gzip compression will result in the smallest an fastest-to-execute [...]
Update: from what I can gather from going through the source code, $super in Prototype actually refers to the method in the parent class, rather than the old method in the current class. My point about the other libraries mentioned below stands, though. Also, my apologies to Dan, whom I cornered at @media Ajax and [...]
Yes, it only came out a couple days ago, but it’s a 0.9.x release, so it’s still being developed. If you downloaded JS.Class over the last couple days, I strongly recommend you upgrade to the latest version. First off, it improves performance substantially over the initial release by inspecting method definitions to find out if [...]
After mentioning Prototype’s inheritance model the other day, one rather important thing struck me about it. I was going to borrow their model for some of my own work when I realised that, if you use Prototype’s $super feature, your code will break if you compress it using a variable-shrinking algorithm (all the decent compressors [...]
So Prototype 1.6 has finally hit the streets, and it looks to be a very nice piece of work. Though I’m no longer using Prototype at my day job (we use YUI, plus a layer of syntactic sugar that I’m in the process of writing), I’m interested to see what is possible with the JavaScript [...]
© The If Works. Powered by WordPress using the DePo Skinny Theme.