aardappel / lobster

The Lobster Programming Language
http://strlen.com/lobster
2.24k stars 121 forks source link

Use of anonymous arguments multiple times in an expression causes a name collision #228

Closed MoonKraken closed 1 year ago

MoonKraken commented 1 year ago

Not sure if this is as designed, but it seems like something that should be doable:

let ans = a.filter(): _ % 2 == 0
    .map(): _ + 1

yields an "identifier shadowing" error on _, but the function bodies for both the filter closure and the map closure should both have their own isolated scopes right?

aardappel commented 1 year ago

Given precedence of ., it is probably trying to parse this as 0.map(): _ + 1 which is probably not what you intended. Try putting () around the whole filter ?