Hacker News new | ask | show | jobs
by pansa2 385 days 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.

2 comments

Yep, 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.

It works just fine for F#, for example. It’s doable, but it’s too late for Python.