Hacker News new | ask | show | jobs
by dragonwriter 4152 days ago
> Python's lambda semantics are limited due to the syntatic limitations created by Python's significant identation.

(nitpick: you seem to consistently use "identation" in place of "indentation".)

I'm pretty sure that plenty of proposals consistent with Python's significant indentation have been proposed; python's lambda syntax is limited due to the BDFL not being convinced of the utility of more capable lambdas over using named functions enough to want to make Python's syntax more complicated to achieve it.

> Also, computers don't deal well with it.

Computers deal fine with it.

1 comments

> nitpick: you seem to consistently use "identation" in place of "indentation".

Consequence of English not being my first language, and "indentation" being way too similar in it. I just can't spot the change.

I've seen a couple of proposals, yes they'd work, but they seem to be always ugly. But the problem is not that significant indentation makes it hard to create lambdas (Haskell's ones, for example are fine), but that it's hard to think about rules that won't create some kind of problem. On Python it's lambdas, on Haskell it's that they are often actually harder to write than explicit blocks (good thing Haskell has explicit blocks too).

And no, computers don't deal fine with it. To minimise some Python code you need almost an entire Python parser. Assembling Python code from small pieces (something that is really important for Javascript) is a frightening problem.

> And no, computers don't deal fine with it.

Sure they do.

> To minimise some Python code you need almost an entire Python parser.

I don't think source-to-source transformations requiring a parser for the source is an indication that it is problematic for computers to handle something. I mean, to execute the source code you need a parser, too, and no one says that needing a parser for execution is a sign that computers don't handle a language well.

> Assembling Python code from small pieces (something that is really important for Javascript) is a frightening problem.

Sure, assembling by cut-and-paste is a problem with significant indentation, especially when using media (like the web) which do not respect indentation well.

OTOH, using significant amount of cut-and-paste coding (rather than reuse by library code) is a sign of a problem with the language, development process, and/or execution environment, anyway, so I don't see it as a particular problem that a language structure isn't friendly to copy-paste coding.