DEV Community

Discussion on: Future Javascript: Records and Tuples

Collapse
 
opensas profile image
opensas • Edited

This is great news, but I wonder if there's a reason why we can't have something like this instead of the "#" thing

val myRecord = {
    name: "New Record",
    tags: ['some', 'tags', 'go', 'here']
}

val myTuple = ['some', 'other', 'set', 'of', 'array', 'items'];
Enter fullscreen mode Exit fullscreen mode
Collapse
 
smpnjn profile image
Johnny Simpson

You can use Record() and Tuple() afaik if you have that preference

Collapse
 
opensas profile image
opensas

Yes, I understood it, I just think it would be more elegant and clear.
Here's my message on the thread discussing this proposal:
twitter.com/opensas/status/1499729...

Collapse
 
petsel profile image
Peter Seliger • Edited

The most obvious reason is to be able to pass records and tuples directly to functions as literals. Thus, in order to let the engine know how to handle such data, it needs its own syntax. Just another variable keyword doesn't cover this in future very common use case.