Id of doesn't work with bignums

When I had bignums on, I tried using the id of, and, it just reported 0. Every value I put in reported 0. When I turned off bignums, it worked perfectly fine.

Sorry, what's id of meant to report?

the value you put in, even if it's text.

edit: I realized it makes a copy of the value, so id of list will be a different list.

, deep copies for lists.

@djdolphin

The bignums version of the "of" primitive needs to be updated to add that option, I suppose.

Maybe it would be better for bignums to be a toggleable option instead of an extension (or just always using bignums, as you would prefer IIRC)? If the bignum and non-bignum versions of the primitives coexisted in the source code right next to each other, it would be much harder to update one without updating the other. It would also be impossible for a project to include an outdated version of bignums as is possible now.

yeah, I looked at the bignums js, I found the of reporter, and there were all the options except id.

I'd love that! But Jens hates the whole idea of supporting the Scheme numeric tower (both for speed reasons and because of concerns about fragility) and barely tolerates the library. It says here Javascript is getting native support for bignums, but not exact rationals or complex numbers, and Jens is hoping that the former will be fast and reliable, while the latter can become entirely-in-Snap! abstract data types.

To make that a real possibility, we're talking about building in support for ADTs, which mostly means methods to read and display them. I guess we'd also add ADTs to the type menu in the IS __ A __? block.


or something like that.

Personally I think that'd work well for exact rationals, but that Jens underestimates the difficulty of implementing transcendental functions of complex numbers.

This is fixed in the next release.

cool!