Notalib/LYT — Issue #91: So... I made a tiny mistake
Author: Flambino
Created: 2012-02-02 16:43:01+00:00
State: open
Labels: code improvement

So I'm technically not working on this anymore, but I just realized that I made a tiny mistake in my use of the `Deferred` object. It's nothing critical and everything works fine as-is, but fixing it would ensure some stability.

Basically, I wrote the code to return a `Deferred` object in a bunch of places, but in fact it should be returning a _promise_ object rather than the deferred object itself.

The difference is that if you return the deferred, the function that receives it can call `reject` and `resolve` on it, which it shouldn't be able to. A `promise` object is almost identical to a Deferred object, except it can't be resolved or rejected directly, which means it's "safe" to pass around.

It's all kinda hard to explain, but in practice it's a simple correction. Almost every time a function returns `deferred`, it should instead return `deferred.promise()`

I might just end up making the corrections myself sometime during the weekend, unless anyone has any objections. Might as well clean it up myself. As mentioned, it should change anything at all, but it'd ensure some stability.