bob at redivi.com
Fri Oct 20 13:53:41 PDT 2006
On 10/20/06, Brendan Eich <brendan at mozilla.org> wrote:
> On Oct 20, 2006, at 4:35 PM, Bob Ippolito wrote:
> > On 10/20/06, Brendan Eich <brendan at mozilla.org> wrote:
> >> On Oct 20, 2006, at 4:11 PM, Bob Ippolito wrote:
> >> > The encoder should have an object hook the same way the decoder
> >> does.
> >> Symmetry, what a good idea. TG1 members should consider this
> >> seriously.
> >> > Throw away the filter.
> >> There was some desire to filter without copying.
> > What was the use case for filtering? I've never seen anyone do that.
> The use case is taking a vanilla object that may have ad-hoc
> properties that should not be serialized. The filter could be used
> to whitelist or blacklist properties.
That sounds mostly like hand-waving... I don't think that actually
happens in a way where the filter function would really help out.
Also, the idea that the filter function should be done without copying
is kinda silly. Is it faster to make N function calls (returning false
M times), or to make 1 function call that copies an object with N-M
key:value pairs (only when M>0)?
I'd imagine that for most values of N and M, that the latter is
better. When M is zero, which is probably usually will be, then there
is no copy made. It also provides symmetry with decoding and is
infinitely more flexible and useful.
More information about the Es4-discuss