3 ms·
There’s at least one downside: only having lambda expressions instead of full anonymous functions. Python’s grammar works great for expressions-inside-statemen
by pansa2 1y ago
There’s at least one downside: only having lambda expressions instead of full anonymous functions.
Python’s grammar works great for expressions-inside-statements (and expressions-inside-expressions), but it can’t do statements-inside-expressions. Every attempt to support the latter turns out really ugly, at least in corner cases.
- dontlaugh 1y agoIt works just fine for F#, for example. It’s doable, but it’s too late for Python.
- sinisterMage 1y agoYep, W++ lambdas are statement-level on purpose My high school teacher once told me lambdas are “university-level,” so I made them the default function syntax in W++. It’s my way of saying: “nah, these aren’t scary — they belong in scripting too.” That said, I totally agree that full anonymous functions would be useful (especially for more complex logic). Might explore adding those later, but I love the message the current model sends.