ohua-dev / ohuac

A standalone compiler for ohua algorithms
Eclipse Public License 1.0
1 stars 0 forks source link

Support tuples as return types #2

Closed Feliix42 closed 6 years ago

Feliix42 commented 6 years ago

While working on ohua-dev/ohua-rust-runtime#7, I noticed that the following dummy ohuac file does not compile

ns some_ns;

use sf tuples (append_to_string, extend_string, output_values);

fn main(input_number: i32, input_string: String) -> (i32, String, usize) {
    let intermediate = append_to_string(input_string, input_number);
    let extended = extend_string(intermediate);
    output_values(input_number, extended)
}

indicating that tuples are not supported by ohuac right now. As returning tuples is not that uncommon I would love seeing them added.

JustusAdam commented 6 years ago

I am not sure why that fails. Tuples should be supported in any place that accepts a type annotation, including return annotations.

JustusAdam commented 6 years ago

Is your compiler on the newest version? You should check that your stack.yaml in ohuac mentions the clike-parser in a decently recent version. Otherwise you probably should pull ohuac again

JustusAdam commented 6 years ago

I have tested your example as well now, and it parses correctly.

Feliix42 commented 6 years ago

🤦‍♂️ All good, the most obvious step is most often times the one I forget about. Sorry for the interruption.

JustusAdam commented 6 years ago

It's okay. Happens to everyone 😉