scala / pickling

Fast, customizable, boilerplate-free pickling support for Scala
lampwww.epfl.ch/~hmiller/pickling
BSD 3-Clause "New" or "Revised" License
831 stars 79 forks source link

Support for common collections traits #15

Closed ConnorDoyle closed 11 years ago

ConnorDoyle commented 11 years ago

First of all, thanks for doing this work -- very cool and practical idea.

Is there a plan in place to handle automatic pickler dispatch for e.g.

Seq(1, 2, 3).pickle

Unfortunately, it's one of the first examples I tried. I think I understand the concept; custom pickler plug-ins could potentially provide a DPickler to handle this reflectively. However, would there be a way to relieve every plug-in author of having to do this, perhaps by importing some optional implicits?

I started work on custom picklers for Apache Avro in topology-io/pickling-avro. This is currently on hold at least until the stable release, mod spare time. I have another project which uses runtime reflection to serialize/deserialize arbitrary types to Avro in GenslerAppsPod/scalavro and am hoping to improve upon that implementation by taking advantage of the macros provided in scala-pickling.

heathermiller commented 11 years ago

First off, pickling-avro looks awesome! From first glance, it seems like for most types, you'd end up with a decent performance boost if you were to manage a custom pickler for Avro.

Regarding this issue– this actually appears to be a regression for which we had no test case. Thanks for pointing this out at the time you did, we'll make sure that this fix is in the upcoming release. (Not sure that it has anything to do with a DPickler, rather, I think this is an issue with abstract types and custom picklers. Looking into it though!)

Thanks! Hopefully we can get this resolved for you in the coming days!

hrj commented 11 years ago

Any progress with this?

With 0.8 SNAPSHOT, I am having trouble with pickling Array of non-primitive types.

I notice you have a testcase for Array but that tests only Array[Int] which I can confirm as working in my environment too.

(Not sure if I should file a new issue; let me know if so)

heathermiller commented 11 years ago

We've got a fix that we're currently working on – it keeps getting interrupted, however. @phaller by any chance do you have an update on this and/or an ETA?

heathermiller commented 11 years ago

For what it's worth, @phaller, I've also gotten a couple emails from folks having the same problem. So I think this is something we should resolve ASAP. Could you let me know what the status is? If you need me to work-steal, I can, just let me know where you are with this. Danke!! :)

phaller commented 11 years ago

Just pushed my progress to branch topic/wip-issue-15. The above example using Seq already works, but since this ticket is about "common collections" it would be good to add support for other types as well.

phaller commented 11 years ago

Arrays of non-primitive element types are now supported as well (see commit e99fa45399656ffea6396367ae63786f6759a72f).

heathermiller commented 11 years ago

Ok, so the verdict is that this fix requires that we revisit and rethink our approach to handling collections. @phaller let's meet up sometime in person this week to work out a solution together – maybe we can come up with something together?