Revisiting the War on RDF, especially folder lookup

Ben Bucksch ben.bucksch at beonex.com
Wed Jan 23 11:11:36 UTC 2013


On 23.01.2013 02:50, Joshua Cranmer wrote:
> I should be able to call any method (say, addMessageToFolder) without 
> having to first call a method (say, createStorageIfMissing).

jcranmer++

> In an async world, you'd need to do:
> function deleteMessage(msg) {
>   getTrashFolder(function (folder) {
>     folder.addMessage(msg, this, function () {
>       this.reallyDeleteMessage(msg);
>     });
>   });
> }
>
> ... I'm purposefully showing this in a JS syntax, since the XPCOM C++ 
> model for this is extremely painful. 

Agreed, to both. Async is necessary (including for disk) for a 
responsive and smooth feeling app, but painful to code. What you show 
above is the ideal form that I also use heavily, and even that is 
somewhat unpretty.

Note that even in JS, that would mean changing a *lot* of code and 
bitrotting a huge number of patches in Mozilla and outside, as well as 
breaking pretty much every non-trivial Thunderbird extension under the sun.

That said, this is how it should have been from the start. Exactly what 
you propose.

> It is possible to have a mixed sync/async world by making the sync 
> operations be internally async (prematurely presuming success) but 
> making all operations accumulate in a pending buffer queue. This API 
> is easier on consumers, but it is definitely a world of pain for 
> implementers.

That smells like hidden bugs with dataloss consequences.

Ben



More information about the tb-planning mailing list