Skip to content

Conversation

@Kodiologist
Copy link
Member

@scauligi I decided it was best not to add a core macro, which would add to our already large set of core macros, for this rarely used feature.

`name` need not be a symbol here: it can be various kinds of compound assignment target.
@Kodiologist Kodiologist force-pushed the chained-assignment branch from 211b974 to 9033963 Compare June 1, 2025 14:06
@scauligi
Copy link
Member

scauligi commented Jun 2, 2025

Fair enough!
For completeness, maybe add a test that uses multiple :chain assignments in the same setv?
And for the hy2py test, I think a slightly more precise test is chain-assigning an object (even literally object()), then asserting chained1 is chained2 is chained3.

edit: now that I say it aloud, I realize the test-within-the-test for hy2py doesn't really matter -- but having an is-based test would be useful in the main setv tests just to make sure that eg (setv :chain [x y] (object)) never gets compiled to x = object() ; y = object() instead of x = y = object()

@Kodiologist Kodiologist closed this Jun 2, 2025
@Kodiologist Kodiologist reopened this Jun 2, 2025
@Kodiologist
Copy link
Member Author

Makes sense. Done.

Copy link
Member

@scauligi scauligi left a comment

Choose a reason for hiding this comment

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

lgtm! :shipit:

@Kodiologist Kodiologist merged commit 556bc76 into hylang:master Jun 4, 2025
20 checks passed
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