W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2011

[whatwg] WebWorkers and images

From: Jorge <jorge@jorgechamorro.com>
Date: Thu, 13 Jan 2011 17:40:55 +0100
Message-ID: <34585514-882F-416F-B5D2-DF019A5E4406@jorgechamorro.com>
On 13/01/2011, at 16:27, Marijn Haverbeke wrote:

>> But if you could make it unreachable on the sending end then there would be no need to duplicate it, just to pass a reference to the worker, it would take about < 1 ns.
> 
> Yes, but the sender might have gotten this value from anywhere. All
> other code using the value will have to know that it is going to be
> invalidated, or it will use it and break. This complicates APIs and
> leads to subtle bugs in a way comparable to C's memory management.


Of course, you would have to write your code with this in mind. You wouldn't pass any object, you'd pass an object whose purpose is to be passed, special because it would be subject to some constraints, e.g. that once passed will become unreachable (and throw on access, or return null, or I don't what would be best). I don't think that would be a problem. You should code accordingly, or guard accesses with try/catch blocks. But the benefits would be huge, imo.
-- 
Jorge.
Received on Thursday, 13 January 2011 08:40:55 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:29 UTC