make txexpr a match-expander
#8
Merged
AlexKnauth
merged 6 commits from match-expander
into master
6 years ago
Loadingā¦
Reference in New Issue
There is no content yet.
Delete Branch 'match-expander'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Closes #7.
The
define-module-boundary-contract
form is only available on versions 6.0.1 and later.@mbutterick do we really need to support Racket 6.0? It's almost 5 years old now...
Yes, otherwise I have to rev
pollen
too.I think if you branch and version-exception this one you donāt have to do that for pollen - as long as you donāt use the txexpr match form in pollen
Why not just copy the source for
define-module-boundary-contract
into this repo.If thatās on the table, wouldnāt it be better to make a package that only provides
define-module-boundary-contract
? Normally it would just reprovide the form fromracket/contract/base
, but it would have a version exception for version 6.0. The package could be calledāmodule-boundary-contract-compatā
.Other packages would depend on this package so that they donāt need a version exception themselves.
āBetterā in an abstract sense, though I still prefer the dumb solution (copy & paste) because itās temporary. At some point next year I will drop support for Rackets < 6.3, and that day, I can delete the code.
There have been a lot of things I've noticed I use a lot which were added between 6.0 and 6.0.1. Particularly in Typed Racket things improved a lot with that version change, and apparently this too.
P.S. I was curious and it looks like the particular commit that added
define-module-boundary-contract
immediately used it to help Typed Racket so that's interesting I guessc321f6dd0c (diff-f335d0535dec069ee865477e5c19228bR144)
Why not just give the match expander a separate name, like
tx
? Doesnāt that avoid all the trouble?That would avoid the problem, but it also means that we will need to support
tx
from now on for backward compat, even after Racket 6.0 is not supported anymore (that is, even when we can support thetxexpr
form easily). Are you OK with that?Also, most match-expander seems to be a constructor name (
list
,vector
,box
, etc.). I don't know what's the cost for breaking the convention.I'm having a lot of trouble implementing the "copy & paste" solution in 6.0, because it relies on the idea of a val-first projection contract, which was only introduced in 6.0.1.
Also, how is this match expander different from just
(list (? txexpr-tag?) (? txexpr-attrs?) (? txexpr-elements?))
In the same ways that
(txexpr->values tx)
is different from(apply values tx)
, I guess. And that's the whole reason this package is super useful in the first place.Edit: You probably meant
(list-rest (? txexpr-tag?) (? txexpr-attrs?) (? txexpr-elements))
, which breaks the correspondence withapply values
. Buttxexpr->values
's handling of the two different forms of txexprs, with and without the attributes list, is still important for this.If I controlled this package I would probably:
for-v-up-to-6.0
that starts the same as the currentmaster
branch.git://github.com/mbutterick/txexpr#for-v-up-to-6.0
master
forward in ways that are compatible with 6.0.1 and above, but don't have to be compatible with 6.0, and leavefor-v-up-to-6.0
the way it is.Thar she blows.
Apparently the version exception is not working. Iāve never used it before. Do you know how I resolve this error?
Oh, I think that's because Racket version 6.0 didn't understand that the
.git
extension meant it was a git repo. I think if you remove the.git
and changehttps://
togit://
that will fix it. But you might have to (on the Package Catalog) say that it's "not" a git repo, that it's just a simple urlgit://github.com/mbutterick/txexpr#6.0-version-exception
to do that.P.S. according to the History annotations in the docs Racket only started recognizing the
.git
extension in version 6.1.1.1, so for versions before then we had to usegit://
orgithub://
to specify thatf5ae897159
.Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Gitea.