B
Brian Palmer
I was thinking about writing a patch to modify how Marshal handles
floats, right now it dumps them using sprintf(3) and stores the
resulting string in the Marshal stream. I'd like to see it handle
floats the same way that Array#pack does:
[400.53].pack('g').length == 4
[400.53].pack('G').length == 8
while
Marshal.dump(400.53).length - 3 == 22
(and is slower, to boot)
I want to make sure, though, that this would be an acceptable patch.
I can't think why it would be OK for Array#pack to work this way and
not Marshal, but is there any particular reason why it can't be done?
Obviously it would break backwards compatability with older Marshal
dumps, but I don't think they're often used for long-term storage,
are they?
-- Brian Palmer
floats, right now it dumps them using sprintf(3) and stores the
resulting string in the Marshal stream. I'd like to see it handle
floats the same way that Array#pack does:
[400.53].pack('g').length == 4
[400.53].pack('G').length == 8
while
Marshal.dump(400.53).length - 3 == 22
(and is slower, to boot)
I want to make sure, though, that this would be an acceptable patch.
I can't think why it would be OK for Array#pack to work this way and
not Marshal, but is there any particular reason why it can't be done?
Obviously it would break backwards compatability with older Marshal
dumps, but I don't think they're often used for long-term storage,
are they?
-- Brian Palmer