A lot of criticism of python often mentions the whitespace as lexical scope tokens, and that criticism is usually posited by users of the language.
As implementer of an interpreter, did you feel that whitespace for lexical scoping made the job of writing the lexer significantly more complex?
nomel•51m ago
And, there are multiple white space symbols!
<space><space><tab><space>
is different than
<space><tab><space><space>
So you also have to track the actual sequence of counts of white space used for each level, rather than just a simple count.
rmunn•40m ago
Or you just forbid mixing spaces and tabs in the same indentation sequence, the way most whitespace-sensitive languages seem to end up doing. Or you make a slightly more reasonable rule: spaces may follow tabs, but no tabs may follow a space. That's at least unambiguous.
fc417fc802•10m ago
But it also feels arbitrary and annoyingly restrictive. On top of that there are at least 25 whitespace codepoints in UTF. Should your language really be opinionated about when, where, and in what order (for example) the "mongolian vowel separator" appears?
jubilanti•27m ago
> <space><space><tab><space> is different than <space><tab><space><space>
in my view, both are the same, both `is` (or ===) an IndentationError raise
fc417fc802•8m ago
It's just a stack containing strings at the end of the day. Really not a big deal.
ni5arga•50m ago
the blog post is pretty well-written! loved how he wrote about the the code-golfing part.
teddyh•40m ago
For those who actually need something like this in production, there is Snek: <https://sneklang.org/> “Snek is a tiny embeddable language targeting processors with only a few kB of flash and ram.”
hankbond•39m ago
Good use of free will and well-written. Very nice walkthrough austin!
Scubabear68•39m ago
I was very disappointed that this is “interpreting” some tiny made up language.
This is not Python, or even within three orders of magnitude of Python.
SPBS•11m ago
It’s true, the title should have said “Python-like”
tempodox•15m ago
This seems to be in the same spirit as Justine Tunney's SectorLISP. Very cool.
TZubiri•1h ago
As implementer of an interpreter, did you feel that whitespace for lexical scoping made the job of writing the lexer significantly more complex?
nomel•51m ago
<space><space><tab><space>
is different than
<space><tab><space><space>
So you also have to track the actual sequence of counts of white space used for each level, rather than just a simple count.
rmunn•40m ago
fc417fc802•10m ago
jubilanti•27m ago
in my view, both are the same, both `is` (or ===) an IndentationError raise
fc417fc802•8m ago