in reply to Re^4: Reverting the internals of an IV to their original states
in thread Reverting the internals of an IV to their original states

I think we're all aware of the problem with round-tripping JSON, where it decodes a JSON number as a scalar, then if you use a string operation on it (such as a regex) and write it back out, you get a string instead of a number. And I think we all agree that it's unfortunate, but just a part of the philosophical mismatch between Perl and JavaScript, and not really anything that can be "fixed".

So, I would say that it is generally a problem to have any code that makes assumptions based on the corrent flags of a scalar. Ideally, you should change the XS code's API to expect a string or number rather than guessing, and let the user tell you which type it is. (and I realize this is generally hard for nested data structures.)

  • Comment on Re^5: Reverting the internals of an IV to their original states