Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR #2

Open
wants to merge 35 commits into
base: newbranch
Choose a base branch
from
Open

PR #2

wants to merge 35 commits into from

Conversation

memoryleak47
Copy link
Owner

No description provided.

@RustyYato
Copy link

RustyYato commented Oct 22, 2018

    fn addition(*arg: (u32, u32)) -> u32 {
        arg.0 + arg.1
    }

I would add a code snippet showing how this is used, because my first reaction to seeing this was: this isn't doing anything new. Something like:

assert_eq!(addition(2, 3), 5);

Also, shouldn't the * be on the type? Otherwise, it looks like it's part of a pattern. If it is part of the pattern, can it be used elsewhere? Looks like no, because .. used in patterns for tuple types. In that case shouldn't we use .. in function calls, to signify variable length arguments? For consistency. After all this, having *T in type parameters sticks out like a sore thumb, so that too should be changed to use .. also for consistency (that way seeing .. means ranges or tuple types). But .. conflicts with ranges, so I think it would be better to have ... or some other sigil.

@mehcode
Copy link

mehcode commented Oct 22, 2018

Personally I feel * conflicts (mentally) with pointers too much. E.g.. *T wouldn't work as people expect that to be a raw pointer.

I strongly feel ... would be a better fit.

  • ... in patterns is deprecated in Rust 2018
  • ...x is currently illegal (unlike *x)
  • extern "C" { fn print(_: u32, ...); } is currently stable for foreign functions

// Definition (slightly prefer the second)
fn addition(...arg: (u32, u32)) -> u32 { }
fn addition(arg: ...(u32, u32)) -> u32 { }

// Call
addition(10, 20);
addition(...(10, 20));

@dlrobertson
Copy link

Are you still working on this? I was going to start working on an RFC for variadic generics, but then I noticed your pre-RFC.

@memoryleak47
Copy link
Owner Author

Not actively.
Feel free to create an RFC yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants