Skip to content

Conversation

@alex-snezhko
Copy link
Member

@alex-snezhko alex-snezhko commented Feb 11, 2023

Support for putting the spread syntax at any position in a list (also spread support for arrays).

Example:

let listA = [1, 2, 3]
let listB = [...listA, 4]
let arrA = [> 1, 2, 3]
let arrB = [> ...arrA, 4]

Closes #288

Copy link
Member

@ospencer ospencer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the approach looks good here. Just a few things to clean up :)

Comment on lines +1136 to +1138
// We have to compose this list by hand because of the complexity of if a list item
// is followed by a comment, the comma must come before the comment.
// It also impacts how we force a new line for a line ending comment at the end of a list
// without introducing an extra blank line when bringing the indentation back in again
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my list of things to do is create a new parsetree node for lists, now that it's a part of the compiler. Seems like I should hurry up and do that so we can rebase this on top to prevent this from getting even more complex?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, if you'd like; I don't think it should be too much work to rebase this off of such a feature

@alex-snezhko
Copy link
Member Author

I addressed the majority of the feedback, will wait until list ADT nodes gets merged to un-bork the formatter :P

@alex-snezhko
Copy link
Member Author

What should the fate of this PR be? Should it be tabled until further notice or is it still planned for 0.6? There was some discussion in a community meeting a little while ago to completely change list syntax (using arrows to connect elements or something of the sort), but that would cause the current syntax to be breaking regardless

@alex-snezhko alex-snezhko force-pushed the arbitrary-pos-spread branch from 8af0f18 to 732027f Compare June 5, 2023 03:35
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.

Lang: List spread should work in any position in a new list

2 participants