arua-meta icon indicating copy to clipboard operation
arua-meta copied to clipboard

RFC: Tuples

Open Qix- opened this issue 9 years ago • 4 comments

~TODO~

Qix- avatar May 31 '16 09:05 Qix-

@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- avatar Jun 04 '16 10:06 Qix-

@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!

corbin-r avatar Aug 31 '16 23:08 corbin-r

What does that example intend to do?

Qix- avatar Sep 01 '16 06:09 Qix-

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()

Qix- avatar Nov 01 '16 22:11 Qix-