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

revert current-check-around void? contract #126

Merged
merged 1 commit into from Oct 28, 2020
Merged

Conversation

stchang
Copy link
Contributor

@stchang stchang commented Oct 21, 2020

I would like to discuss reverting part of 1fbc98e

There doesn't seem to be a reason to limit the behavior, it's different from what the docs specify, and it breaks existing programs.

I would like to discuss reverting part of 1fbc98e

There doesn't seem to be a reason to limit the behavior, it's different from what the docs specify, and it breaks existing programs.
@samth
Copy link
Sponsor Member

samth commented Oct 21, 2020

cc @jackfirth

@jackfirth
Copy link
Sponsor Collaborator

I'm open to reverting it. Could you share more information about the breakage this caused?

@stchang
Copy link
Contributor Author

stchang commented Oct 21, 2020

Sure. RacketScript's test suite is currently set up to have the test thunks return a value.

Long story short, since it is not checking Racket programs, it cannot operate completely using Rackunit forms, and instead it inspects and compares stdout and stderr streams returned by a test.

@jackfirth
Copy link
Sponsor Collaborator

jackfirth commented Oct 23, 2020

There's this bit in the docs:

A check checks some condition and always evaluates to (void).

I believe it was intended that checks never be allowed to return anything other than void?, so current-check-around should also never return anything other than void?. There's certainly no existing checks in rackunit that return non-void so I wouldn't be surprised if creating checks that return useful values causes parts of rackunit to break, especially if those checks return multiple values.

This was never enforced by any of the check creation forms however. We could consider changing the docs to officially allow checks to return values, but we'd need to be pretty thorough about adding tests for that.

@samth
Copy link
Sponsor Member

samth commented Oct 23, 2020

The 7.9 release is about to come out. I think we should definitely revert a change that breaks existing code, and do it soon.

cc @racket/release

@stchang
Copy link
Contributor Author

stchang commented Oct 26, 2020

Ok I see that line now.

But it still seems like void? is overly restrictive? It doesn't seem like anything would break by reverting?

Regarding multiple return values, would any/c prevent that?

@bennn
Copy link
Contributor

bennn commented Oct 26, 2020

Yep, any/c requires 1 return value. Sounds like rackunit should use this contract instead of void?

Welcome to Racket v7.8.0.5 [cs].
> (define f (contract (-> any/c) (lambda () 42) '+ '-))
> (f)
42
> (define g (contract (-> any/c) (lambda () (values 4 2)) '+ '-))
> (g)
; g: broke its own contract;
;  expected 1 value, returned 2 values
;   in: the range of
;       (-> any/c)
;   contract from: +
;   blaming: +
;    (assuming the contract is correct)
; [,bt for context]

@rfindler
Copy link
Member

I agree that we should not let this change into the release, as it is known to be a breaking change and we don't know the limit of the damage yet

@samth
Copy link
Sponsor Member

samth commented Oct 28, 2020

Can we change the result contract to any, and then merge this ASAP? The release process is waiting.

@jackfirth
Copy link
Sponsor Collaborator

Yeah, let's do that.

@stchang
Copy link
Contributor Author

stchang commented Oct 28, 2020

isnt that what this pr does?

@jackfirth
Copy link
Sponsor Collaborator

Yes, I'll merge it.

(I've been a little out of it lately.)

@samth
Copy link
Sponsor Member

samth commented Oct 28, 2020

This PR uses any/c, which restricts the result to a single value.

@jackfirth jackfirth merged commit c0df926 into master Oct 28, 2020
@jackfirth
Copy link
Sponsor Collaborator

Did multiple values ever work before?

@stchang
Copy link
Contributor Author

stchang commented Oct 28, 2020

This PR uses any/c, which restricts the result to a single value.

I though we wanted to restrict to a single value?

@samth
Copy link
Sponsor Member

samth commented Oct 28, 2020

Ah, ok. I'll do the release branch bit now.

samth pushed a commit that referenced this pull request Oct 28, 2020
I would like to discuss reverting part of 1fbc98e

There doesn't seem to be a reason to limit the behavior, it's different from what the docs specify, and it breaks existing programs.

(cherry picked from commit c0df926)
@samth
Copy link
Sponsor Member

samth commented Oct 28, 2020

Done 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.

None yet

5 participants