c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Should it be possible to splat normal arguments?

Open lerno opened this issue 1 year ago • 4 comments

fn void foo(int x, int y) { ... }
fn void foo2(int x, int...) { ... }

fn void main()
{
  int[2] a = { 1, 2 };
  foo2(1, ...a); // Works today
  foo(...a);     // Maybe this should work
  foo2(...a);    // Should this work?
}

What should be possible?

lerno avatar Jul 27 '24 00:07 lerno

I am in favor of this change! Ot would be sweet of this would work for vectors as well.

AineeJames avatar Jul 30 '24 03:07 AineeJames

What would you use it for?

lerno avatar Aug 05 '24 10:08 lerno

Another one on this topic, being able to splat arrays of any with automatic "unwrapping" would be cool.

Dodzey avatar Aug 07 '24 07:08 Dodzey

Another one on this topic, being able to splat arrays of any with automatic "unwrapping" would be cool.

In a function context? That seems very bug prone?

lerno avatar Aug 07 '24 09:08 lerno