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

Add more base types and type aliases. #1254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NoahStoryM
Copy link
Contributor

@NoahStoryM NoahStoryM commented Jul 3, 2022

This PR adds more type aliases (see also #1242):

Flonum-Complex

Single-Float
Nonpositive-Single-Float
Negative-Single-Float
Nonnegative-Single-Float
Positive-Single-Float
Single-Float-Nan
Single-Float-Zero
Single-Float-Negative-Zero
Single-Float-Positive-Zero

Rational
Exact-Nonpositive-Rational
Nonpositive-Rational
Exact-Negative-Rational
Negative-Rational
Exact-Nonnegative-Rational
Nonnegative-Rational
Exact-Positive-Rational
Positive-Rational

Exact-Integer
Nonpositive-Exact-Integer
Exact-Nonpositive-Integer
Negative-Exact-Integer 
Exact-Negative-Integer
Nonnegative-Exact-Integer
Positive-Exact-Integer

ExtFloat
Nonpositive-ExtFloat
Negative-ExtFloat
Nonnegative-ExtFloat
Positive-ExtFloat
ExtFloat-Nan
ExtFloat-Zero
ExtFloat-Negative-Zero
ExtFloat-Positive-Zero

Box
Weak-Box
Custodian-Box

None

MPair

And here is something I'm not sure how to deal with:

  1. Complex and Number
    TR reference says "Number and Complex are synonyms.", but Exact-Number and Exact-Complex are different, is there any special reason? Should I modify it and regard Exact-Complex as an alias for Exact-Number?

[edit]: Exact-Complex should not contain numbers like 0+1i, 1+0i, etc..

  1. More base types
    I notice that there are some types defined in rep/base-types.rkt and rep/numeric-base-types.rkt and REPL already uses them, but they are not provided. Should TR provide them?
Welcome to Racket v8.5 [cs].
> 8.3
- : Flonum [more precisely: Positive-Float-No-NaN]
8.3
> (:kind Positive-Float-No-NaN)
string:1:7: Type Checker: parse error in type;
 type name `Positive-Float-No-NaN' is unbound
  in: Positive-Float-No-NaN
 [,bt for context]
> (:kind Positive-Float)
*
Byte-Larger-Than-One
Positive-Index-Not-Byte
Positive-Fixnum-Not-Index
Positive-Integer-Not-Fixnum
Negative-Integer-Not-Fixnum
Positive-Rational-Not-Integer
Negative-Rational-Not-Integer
Positive-Float-No-NaN
Negative-Float-No-NaN
Positive-Single-Flonum-No-Nan
Negative-Single-Flonum-No-Nan
Float-Imaginary
Single-Flonum-Imaginary


Base-Regexp
Byte-Base-Regexp
OtherSystemPath
Compiled-Non-Module-Expression
Base-Place-Channel
Negative-ExtFlonum-No-NaN
Positive-ExtFlonum-No-NaN
Dead-Code

@samth
Copy link
Member

samth commented Jul 3, 2022

Yes, anything that can appear printed should be legal to write.

@NoahStoryM NoahStoryM force-pushed the type-alias branch 2 times, most recently from 061b2e7 to aa05640 Compare July 4, 2022 03:53
@NoahStoryM
Copy link
Contributor Author

Hi @jackfirth, Resyntax / build (pull_request_target) always fails with error message: ref refs/heads/master doesn't represent a pull request. Is there something wrong here?

@NoahStoryM NoahStoryM changed the title More type aliases. Add more base types and type aliases. Jul 4, 2022
@jackfirth
Copy link
Contributor

@NoahStoryM The Resyntax integration is broken for pull requests from forks. I'll have to rework the check so that the analysis step and the pull request comment step are split into different workflows. Feel free to ignore the failures for now.

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.

3 participants