这是indexloc提供的服务,不要输入任何密码
Skip to content

Add typed/srfi/19 to typed-racket-more #22

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

Closed
wants to merge 1 commit into from

Conversation

lexi-lambda
Copy link
Member

This should include accurate types for all the bindings exported from srfi/19. (I'd add tests, but I don't think there are any tests for typed-racket-more at the moment. Let me know if there are, and I'll add them.)

@lexi-lambda lexi-lambda force-pushed the srfi-19-typed branch 2 times, most recently from efdba60 to 2be24b4 Compare February 2, 2015 17:23
@lexi-lambda
Copy link
Member Author

@samth Can I get an update on this?

@samth
Copy link
Member

samth commented Feb 6, 2015

@lexi-lambda Sorry about the delay with the review here -- this all looks quite good. Do the error messages show the fake struct you create ever?

@lexi-lambda
Copy link
Member Author

@samth I've tested it in various situations, and I haven't managed to make TR print the fake struct in any error messages. The only possible problem is that there isn't actually way, as far as I can tell, to introspect what the types of the aliases actually are.

For example, evaluating (:print-type make-time) simply prints this:

(-> Time-Type Nanosecond Second Time)

It doesn't actually print what, say, Nanosecond actually is, and there doesn't appear to be any way to find out. It's actually an Index, but short of looking at the srfi/19 documentation, I don't think there would be any way to be aware of that.

@samth
Copy link
Member

samth commented Feb 6, 2015

Ok, seems reasonable. @takikawa @stamourv @shekari Any thoughts on the alias printing issue?

@lexi-lambda
Copy link
Member Author

Actually, I've thought of another problem which makes me reconsider this hack. As much as I like its elegance, I don't think it's a good idea to use in actual code. This is why:

(define x : Index (time-nanosecond (current-time)))

The above code fails to typecheck.

@samth
Copy link
Member

samth commented Feb 6, 2015

Yeah, that's not ok, especially since just changing Index to Number will also not type check.

I think the right solution is to just not use the type aliases, given the error message issues.

/me should do something more sensible with error messages.

@lexi-lambda
Copy link
Member Author

@samth Fixed. It would be nice to have better error messages, though, so that something like that is at least possible.

@samth
Copy link
Member

samth commented Feb 6, 2015

Ok, great, I'll merge soon.

@samth samth closed this in ece97e5 Feb 9, 2015
@lexi-lambda lexi-lambda deleted the srfi-19-typed branch February 10, 2015 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants