Skip to content

Conversation

@c42f
Copy link
Member

@c42f c42f commented Aug 18, 2024

Disallow generator syntax with trailing non-delimited expressions

(y for x in xs a)
(y for x in xs a, b)

Allow parameter syntax such as

f(y for x in xs; a)

because the flisp parser allowed this it's used in Base in at least one location.

Disallow the almost-equivalent block syntax for now:

(y for x in xs; a)

because the flisp parser disallowed it and users can always get the same thing with some extra parentheses.

Fixes #407

Disallow generator syntax with trailing non-delimited expressions

    (y for x in xs a)
    (y for x in xs a, b)

Allow parameter syntax such as

    f(y for x in xs; a)

because the flisp parser allowed this it's used in Base in at least one
location.

Disallow the almost-equivalent block syntax for now:

    (y for x in xs; a)

because the flisp parser disallowed it and users can always get the same
thing with some extra parentheses.
@codecov
Copy link

codecov bot commented Aug 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.18%. Comparing base (6532515) to head (a74fb9c).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #497      +/-   ##
==========================================
- Coverage   96.21%   96.18%   -0.04%     
==========================================
  Files          13       13              
  Lines        4171     4033     -138     
==========================================
- Hits         4013     3879     -134     
+ Misses        158      154       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@c42f c42f merged commit 30109d4 into main Aug 18, 2024
@c42f c42f deleted the caf/disallow-trailing-generator-junk branch August 18, 2024 10:49
c42f added a commit to JuliaLang/julia that referenced this pull request Oct 17, 2025
Disallow generator syntax with trailing non-delimited expressions

    (y for x in xs a)
    (y for x in xs a, b)

Allow parameter syntax such as

    f(y for x in xs; a)

because the flisp parser allowed this it's used in Base in at least one
location.

Disallow the almost-equivalent block syntax for now:

    (y for x in xs; a)

because the flisp parser disallowed it and users can always get the same
thing with some extra parentheses.
topolarity pushed a commit to JuliaLang/julia that referenced this pull request Nov 14, 2025
Disallow generator syntax with trailing non-delimited expressions

    (y for x in xs a)
    (y for x in xs a, b)

Allow parameter syntax such as

    f(y for x in xs; a)

because the flisp parser allowed this it's used in Base in at least one
location.

Disallow the almost-equivalent block syntax for now:

    (y for x in xs; a)

because the flisp parser disallowed it and users can always get the same
thing with some extra parentheses.
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.

Parsing of generators allows skipping a comma

1 participant