DEV Community

Discussion on: Help design a language: What about tuples without commas?

Collapse
 
andy profile image
Andy Zhao (he/him) • Edited

You probably know this already, but your question reminds me of how Ruby has two options for building certain arrays:

# the "conventional" way of creating an array of strings
words = ["apple", "banana", "Leaf"]
#=> ["apple", "banana", "Leaf"]

# another way of creating an array of strings
words = %w(apple banana Leaf)
#=> ["apple", "banana", "Leaf"]

I guess it's Perl inspiredsrc, but one limitation is that you can't create an array of numbers by the percent literal notation. Maybe that's a solution that you'd be interested in. Personally, I like having both options, and also think the "conventional" way should have commas.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

That second one looks like a word splitting regex, or is it really a specialized syntax to create an array of strings?