Skip to content

Conversation

@joergen7
Copy link
Contributor

@joergen7 joergen7 commented Apr 14, 2025

The type XExpr has been defined as follows:

(define-type XExpr
  (U XML-Misc Cdata Positive-Index
     Number String Symbol
     (Pair Symbol (Pair (Listof XExpr-Attribute) (Listof XExpr)))
     (Pair Symbol (Listof XExpr))))

The above definition includes the superfluous type Number but is missing the type Pcdata.

The type Number is superfluous because so-called valid characters (valid-char?) are already covered by Positive-Index. Pcdata structs are covered by xexpr?, but are missing from the above type definition.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 0 files in this pull request and found no issues.

@samth
Copy link
Member

samth commented Apr 14, 2025

I worry a little about restricting the space of numbers like this. The change means that (- 2 1) no longer typechecks as XExpr.

@joergen7
Copy link
Contributor Author

joergen7 commented Apr 14, 2025

I see your point. I had assumed this restriction to be a feature, since now you have to make an argument for the subtraction result to be positive for XExpr to type: (assert (- 2 1) positive?).

Which is preferable?

@joergen7
Copy link
Contributor Author

joergen7 commented Apr 16, 2025

The pr now introduces only Pcdata, thus, strictly widening the definition of XExpr.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 0 files in this pull request and found no issues.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 0 files in this pull request and found no issues.

@samth
Copy link
Member

samth commented Apr 21, 2025

Unfortunately this goal is not possible. Consider 55926. It is a Positive-Index but not a valid-char?.

@joergen7
Copy link
Contributor Author

I understand. Thanks, @samth for your patience. The current change strictly widens the definition of XExpr.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 0 files in this pull request and found no issues.

@samth samth merged commit 8fce645 into racket:master Apr 23, 2025
5 checks passed
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