Steffen Mueller a écrit : > On 05/05/2013 11:45 PM, Sébastien Aperghis-Tramoni wrote: >> Now, did I miss something so blindingly obvious that I didn't see why >> it cannot work? is it silly? >> >> Thanks in advance for your comments and critics. >> >> In the mean time, I'll try to write a proof of concept. > > I'm not sure that what you want to do is possible, but I'd sure love to see you try since it's been a sore spot wrt. Sereal[1] since the beginning. > > Before you start prototyping, I would strongly suggest that you look up Chip's emails and branches/patches such as "chip/magicflags7". He'd worked towards the same goal: Being able to tell whatever type a scalar originated as. I even did some CPAN smoking then and there wasn't too much breakage. Oh, nice to know there was already some ongoing work. I already tried a naive approach because I apparently misread sv.h and thought that there were one or two free bits in the SV flags for IV/NV/PV. But experiments proved me wrong. > Chip, what was the ultimate reason why your changes never made it to blead? > > Best regards, > Steffen > > [1] Sereal could do quite a bit better than it does already. Right now, it defensively uses the biggest type a scalar currently holds. Which is not only space inefficient, but also occasionally wrong. I played with improved heuristics (erring on the side of safety but getting the most effective type where possible). Not only did that melt my brain, I ran out of time and ditched the branch. Patches welcome, for real. In my previous $jobs, I didn't use serialized data that much. But in my current job, there's a lot of serialized data, both JSON and XML-RPC. I've subclassed the serializers so they use B.pm to detect whether the SV is a IV, NV or PV, which is semantically more correct but still leave some corner cases uncovered. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.Thread Previous | Thread Next