Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Conversation

@joelburget
Copy link

It's sometimes convenient to specify something as an integer, rather
than supplying a possible range. This implementation is probably not
robust enough and should be backed by bignum, but I'm treating it as an
experiment.

Generalizing, it would be nice to add a primitive String type.

I understand the appeal in having a minimal language with a small
surface area, however builtins are rather convenient.

Test plan:

It's sometimes convenient to specify something as an integer, rather
than supplying a possible range. This implementation is probably not
robust enough and should be backed by bignum, but I'm treating it as an
experiment.

Generalizing, it would be nice to add a primitive `String` type.

I understand the appeal in having a minimal language with a small
surface area, however builtins are rather convenient.

Test plan:
* `npm test`
* Run this contract:
  https://gist.github.com/joelburget/7b9693bb4abde38a046ad2ab3e758e62
@joelburget
Copy link
Author

By the way, this is more of an RFC than a serious pull request. Curious whether there's interest in something like this in the language.

@dgryski
Copy link

dgryski commented Jul 6, 2016

The problem with having unconstrained integers is that you can't exhaustively search through them in the check phase.

@ongardie-sfdc
Copy link
Collaborator

I'd be ok with an Integer as shorthand for a (signed/unsigned?) number that's at least 32 bits large. That's pretty much what your PR implements, so that's cool. I'm trying to keep it possible for a more efficient compiler to execute models without storing model state on the heap, so I'd like to avoid bignum if at all possible. For the same reason, Vector[Integer] should probably be disallowed, as that'd allocate gigabytes of memory.

Strings feel like a separate discussion. I've thought about having string literals for print statements before (or better yet, format strings). Do you have a use case for manipulating strings at runtime?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants