Closed havocp closed 9 years ago
a few minor comments, but I think help clean up serializedvalue a bit.
It turns out that for LazyValue, we want to compare tag.key not tag (to avoid Type.equals and Mirror.equals), and we can only do it as an optimization because SPickler[Fruit]
can be the pickler and Unpickler[Apple]
the unpickler.
@havocp Yeah, that's right, tag.key not tag. As a side note, my next Yak to shave is reworking how FastTypeTag works in pickling to avoid concurrency bugs in construction.
This LGTM,and tests pass.
Instead of duplicating the type discriminator out-of-band, add a way to test the usual type discriminator. This is obviously not compatible with duck typing.
We don't want to just use SerializedValue.parse[T] because failed matches would incur exception-throwing overhead, and because we really don't want duck typing in this context because we might accidentally match the wrong kind of event.