grain icon indicating copy to clipboard operation
grain copied to clipboard

Record spread syntax

Open ospencer opened this issue 4 years ago • 1 comments

I forget, do we have record spread syntax? { ...config, caseSensitive: caseSensitive } (caseSensitive could also be punned)

Originally posted by @phated in https://github.com/grain-lang/grain/pull/680#discussion_r667370729

ospencer avatar Jul 11 '21 15:07 ospencer

Would this syntax be constrained to only creating records of the same type but with some values changed (like with in OCaml) or could it be used to create a record of one type from another that has a subset of the fields? For example in JS you could do {...first, ...second} to "merge" two objects together, which can be useful.

alex-snezhko avatar Oct 12 '22 01:10 alex-snezhko