Skip to content

General support for Starred syntax in the parser + support for few simple cases in blue functions - #710

Open
paugier wants to merge 11 commits into
spylang:mainfrom
paugier:blue-starred
Open

paugier wants to merge 11 commits into
spylang:mainfrom
paugier:blue-starred

Conversation

@paugier

@paugier paugier commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

I'd like to work on the support for OpSpec(impl_str, [*m_args]) (parser and interpreter).

I think it is doable with current SPy and that it will be needed for "enough metaprogramming capabilities to implement e.g. dataclasses" (see https://fluiddyn.pages.heptapod.net/spy-book/metaprog-dataclass/ for the long term goal).

Note that this PR is not about *args in red functions.

@antocuni

Copy link
Copy Markdown
Member

I'd like to work on the support for OpSpec(impl_str, [*m_args]) (parser and interpreter).

sounds like a good idea to me, thanks!
But, isn't [*x] the same as list(x)?
Maybe it might be easier to just implement list(x)?

@paugier

paugier commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

I agree that for this case, list should be much simpler!

My plan was to work on the parser to support Starred syntax that I think is more generally useful.

@paugier

paugier commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Also, in SPy, tuple and list are blue.generic so they cannot be called without the type(s).

Should they become something else than just a generic to allow list(m_args)?

I seems to me that this is a different work that what I planned with this PR. But it can be interesting!

@antocuni

Copy link
Copy Markdown
Member

Also, in SPy, tuple and list are blue.generic so they cannot be called without the type(s).

Should they become something else than just a generic to allow list(m_args)?

oh right, didn't think about it. Yes, we need to invent something to support list(something), not sure what is the best way to achieve it.

I seems to me that this is a different work that what I planned with this PR. But it can be interesting!

agreed. If your goal is to implement Starred, go ahead! The title of the PR is a bit misleading though :)

@paugier paugier changed the title Blue OpSpec(impl_str, [*m_args]) General support for Starred syntax in the parser + support for few simple cases in blue functions Sep 24, 2026
@paugier
paugier force-pushed the blue-starred branch 2 times, most recently from f87a298 to c916b50 Compare September 28, 2026 13:24
@paugier
paugier force-pushed the blue-starred branch 2 times, most recently from 483a93b to 45b9c19 Compare October 5, 2026 13:40
@paugier
paugier marked this pull request as ready for review October 5, 2026 13:40
@paugier

paugier commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

I think this is ready for a first review.

I don't know how to organize the tests and where to put them.

I would also need feedback on the implementation.

This branch has not been deployed

No deployments
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.

2 participants