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

feat: add nested type constructor expressions #351

Merged
merged 1 commit into from
Nov 25, 2022

Conversation

jvanstraten
Copy link
Contributor

It's currently impossible to formulate expressions like (field 0 - field 1, field 0 + field 1) (using (x, y) as a two-field struct):

  • struct literals don't work because the fields aren't literals;
  • mask expressions don't work because the fields aren't pure field references;
  • extension functions don't work in general unless one is made specifically for structs with the desired number of fields, the desired nullability, and the desired type variation.

The same applies for lists and maps, though if we ignore type variations, the same could hypothetically be done for them with a finite number of function extensions in core.

This construct effectively makes struct/list/map literals and (I think) mask expressions redundant, but I didn't deprecate them because they at least feel different.

@jacques-n
Copy link
Contributor

jacques-n commented Oct 3, 2022

I'm generally supportive of this change (+1). It feels cleaner as an expression than trying to introduce as functions. (As functions, type declaration would get nasty quickly.)

@westonpace and @cpcloud , are you supportive of this?

@westonpace
Copy link
Member

Took me a moment to figure this out but I think I get it now. I'm +1.

@CLAassistant
Copy link

CLAassistant commented Oct 6, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@jacques-n jacques-n left a comment

Choose a reason for hiding this comment

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

Merging on lazy consensus

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.

4 participants