Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an SML implementation of the IntInf_* primitives #60

Open
MatthewFluet opened this issue Jun 18, 2014 · 4 comments
Open

Provide an SML implementation of the IntInf_* primitives #60

MatthewFluet opened this issue Jun 18, 2014 · 4 comments

Comments

@MatthewFluet
Copy link
Member

Resolving issue #59 would eliminate the dependency on GMP for compiled programs that do not use structure IntInf. However, there may be programs that use structure IntInf in a non-performance critical way or that indirectly use structure IntInf (e.g., by using structure Time, where time values are implemented using IntInf.int), but would like to avoid the dependency on GMP.

It should be possible to provide an alternative implementation of the IntInf_* primitives in SML. Then use a command line flag -int-inf-impl {gmp,sml} (similar in spirit to the -default-type type flag) which would (among other effects) define an MLB path variable (again, similar to what is done with the -default-type type flag) that would be used to select an appropriate implementation of the IntInf_* primitives for use in the rest of the Basis Library.

It would clearly be less performant than the GMP implementation, but it would probably suffice for many applications where structure IntInf was used, but not used extensively.

@robsimmons
Copy link
Contributor

This seems pretty straightforward, I'd really like to see #59 resolved, and so I'd be interested in trying to attack this over the next couple days if noone else has already started.

@MatthewFluet
Copy link
Member Author

Agreed that this should be pretty straightforward. Feel free to work on it.

You might consider implementing/replacing either:

The advantage of the former is that it is a smaller interface. The disadvantage of the former is that it occurs very early in the Basis Library implementation, and you will have little more than the primitive arithmetic and vector/array functions available.

The advantage of the latter is that it occurs much later in the Basis Library implementation and you will have many more arithmetic and vector/array functions available. The disadvantage is that it is a larger interface.

@robsimmons
Copy link
Contributor

Here's a small oddity - the first line of https://github.com/MLton/mlton/blob/master/basis-library/integer/int-inf0.sml is clearly a typo, since it cuts off Suresh Jagannathan's name. This was introduced in dcb42e5, presumably this should correctly say 2013 Matthew Fluet?

@MatthewFluet
Copy link
Member Author

Yes, looks like it should be 2013 Matthew Fluet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants