-
Notifications
You must be signed in to change notification settings - Fork 78
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
Syntactic sugar for changing only part of a structure #592
Comments
The specific syntax for this definitely useful feature should be decided by our Syntax Committee (@slawsk and Liane) before the final implementation :) |
Results of the discussion with the syntax committee:
|
@denismerigoux should the French version be "mais remplace", or "mais en remplaçant" which is a bit more verbpse but sounds better ? |
|
Closes CatalaLang#592 A new node is added in `desugared`, and translated into an exploded structure literal during translation to `scopelang`. The main reason to put it there is that it needs to be after disambiguation, since that is used to discover the type of the structure that is being updated.
Closes CatalaLang#592 A new node is added in `desugared`, and translated into an exploded structure literal during translation to `scopelang`. The main reason to put it there is that it needs to be after disambiguation, since that is used to discover the type of the structure that is being updated.
Closes CatalaLang#592 A new node is added in `desugared`, and translated into an exploded structure literal during translation to `scopelang`. The main reason to put it there is that it needs to be after disambiguation, since that is used to discover the type of the structure that is being updated.
Closes CatalaLang#592 A new node is added in `desugared`, and translated into an exploded structure literal during translation to `scopelang`. The main reason to put it there is that it needs to be after disambiguation, since that is used to discover the type of the structure that is being updated.
Let's imagine the following code:
and that we have a structure
Person
containing lots ofdata
fields besidesincome
:age
,xx
,yy
,...We would have to define the specific structure for the person as concerned by this article (supposing
original_person
is an input of the scope):This is tedious to write, verbose, and coud introduce hard-to-spot errors. We propose a shorter syntax that would be equivalent to the code above:
Person { original_person amended with ... }
is a new, distinct structure and thatoriginal_person
is not altered in any way.amended with
keyword ok ? I am also unsure about the french equivalent (does "amendé par" work ?). Using justwith
(withoutamended
), if it's as clear, would avoid the addition of a new keyword.The text was updated successfully, but these errors were encountered: