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

Introduce Any.are(type --> Bool:D) #5571

Merged
merged 1 commit into from
May 26, 2024
Merged

Introduce Any.are(type --> Bool:D) #5571

merged 1 commit into from
May 26, 2024

Conversation

lizmat
Copy link
Contributor

@lizmat lizmat commented May 18, 2024

This would allow a shorter way to say:

sub a(@a where .are ~~ Int) { }

namely:

sub a(@a where .are(Int)) { }

Further advantages:

  • shortcircuiting as soon as an offending type is encountered
  • instead of returning False, return a Failure with more error information such as expected / gotten type and the element number that offended

After this, we'd only need to make X::TypeCheck::Binding::Parameter actually show the message of the Failure, instead of "anonymous constraint to be met".

This would allow a shorter way to say:

    sub a(@A where .are ~~ Int) { }

namely:

    sub a(@A where .are(Int)) { }

Further advantages:
- shortcircuiting as soon as an offending type is encountered
- instead of returning False, return a Failure with more error information
  such as expected / gotten type *and* the element number that offended

After this, we'd only need to make X::TypeCheck::Binding::Parameter
actually show the message of the Failure, instead of "anonymous constraint
to be met".
@lizmat lizmat merged commit 23b94de into main May 26, 2024
7 of 11 checks passed
@lizmat lizmat deleted the lizmat-aretype branch May 26, 2024 10:17
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

1 participant