DEV Community

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

Collapse
 
bullno1 profile image
Bach Le

How does it fit with the rest of the language? Do function calls need comma or is it like ML: f x y or io: f(x y)?

An array where each element may be some other type of expression like function call or map may look weird if they require comma.

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

There are value-lists and tuples, which are treated very similarly:

value_list = (a, b, c)
tuple = [a, b, c]

Typically you see value-lists in function calls:

pine(a,b,c)

If tuples go comma-less, then this will apply to value-lists as well. But I'm only suggesting this for multi-line lists now, not inline.

pine(
   a
   b
   c
)

That would be equivalent to pine(a,b,c)

There is a possibility to support comma-less inline notation, such as [a b c] or pine( a b c ). I'm reluctant to do this now as it may artificially restrict the syntax too early in the design, and it creates a lot of ambiguities which may not be worth it.