RFC: Tuples
~TODO~
@Polygn thoughts on Tuples? I feel like Tuple support without full-on pattern matching throughout the system is useless. I like the idea of pattern matching though I feel like languages that use it right now cause the syntax/semantics to look super messy (Rust is a great example of a good idea gone terribly ugly insofar as pattern matching, in my opinion).
@Qix- Here's my idea on Tuples in this language.
Yes, tuples without full pattern matching would indeed be useless. And as far the syntax for the possible pattern matching?
... Could be something like this [not going to do anything like Rust, cause it is, as you said, "terribly ugly"]
let foo = 4
foo => { 1: print("Stuff"), 2: print("Matched 2"), 3: print("Matched 3"), _: print("Some default print") }
I don't know, I'm trying to think as concise and simple as I can. If you have some thoughts on this, definitely throw some critique on this!
What does that example intend to do?
Another idea:
on Foo
fn do_something()
# ...
foo1 Foo
foo2 Foo
(foo1, foo2).do_something()
Which is similar to Pythons:
[x.do_something() for x in (foo1, foo2)]
and functionally equivalent to
foo1.do_something()
foo2.do_something()