sbt / sbt-remote-control

Create and manage sbt process using unicorns and forks
Other
74 stars 14 forks source link

Add SerializedValue.hasTag replacing MessageSerialization.makeSimpleName #259

Closed havocp closed 9 years ago

havocp commented 9 years ago

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.

jsuereth commented 9 years ago

a few minor comments, but I think help clean up serializedvalue a bit.

havocp commented 9 years ago

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.

jsuereth commented 9 years ago

@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.

jsuereth commented 9 years ago

This LGTM,and tests pass.