Skip to content

Array splicing #374

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

Open
glaebhoerl opened this issue Oct 8, 2014 · 6 comments
Open

Array splicing #374

glaebhoerl opened this issue Oct 8, 2014 · 6 comments
Labels
A-array Array related proposals & ideas A-expressions Term language related proposals & ideas A-syntax Syntax related proposals & ideas A-update-syntax Struct update syntax related proposals & ideas T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@glaebhoerl
Copy link
Contributor

Analogously with functional struct updates, we could also allow "functional array updates", or in other words splicing of fixed-length arrays:

let a: [int, ..3] = [1, 2, 3];
let b = [..a, ..a, ..a];

Here b: [int, ..9]. Unlike FSU, there can be any number of array splices in any positions.

This has some syntactic overlap with replication:

let c = ['c', ..10];
let d = ['d', ..x];

but even the latter case can always be disambiguated based on the type of x (it's either an integer or an array; it can't be both).

(Also, we may want postfix rather than prefix .. in this case, removing the overlap completely. But we should also want that for FSU.)

@aturon
Copy link
Member

aturon commented Oct 8, 2014

There's perhaps some relation to the splicing proposed for variadic generics.

@petrochenkov petrochenkov added the T-lang Relevant to the language team, which will review and decide on the RFC. label Jan 19, 2018
@Centril
Copy link
Contributor

Centril commented Oct 7, 2018

Triage: @glaebhoerl any thoughts on taking this to the "next level"?

@glaebhoerl
Copy link
Contributor Author

Thanks for triaging! I don't think I'll have the bandwidth (or, to be totally honest, the desire) to work on RFCs any time in the near future.

@Centril
Copy link
Contributor

Centril commented Oct 7, 2018

@glaebhoerl can you elaborate re. "desire"? is that specific to this feature?

@glaebhoerl
Copy link
Contributor Author

Nah I just don't have stamina/motivation for the RFC process.

@Centril
Copy link
Contributor

Centril commented Oct 7, 2018

Ah ok; sad to hear that particularly since you always make great contributions.

@Centril Centril added A-expressions Term language related proposals & ideas A-update-syntax Struct update syntax related proposals & ideas A-array Array related proposals & ideas A-syntax Syntax related proposals & ideas labels Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-array Array related proposals & ideas A-expressions Term language related proposals & ideas A-syntax Syntax related proposals & ideas A-update-syntax Struct update syntax related proposals & ideas T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

4 participants