code block determines indentation, rathen than indentation determines code block #182
NoahStoryM
started this conversation in
General
Replies: 1 comment 2 replies
-
For what it's worth, I started with the same opinion. But after trying to implement things and write examples, I ended up in favor of indentation-sensitive parsing (to my surprise). |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I try to program in Python, one of the annoyances is that it uses indentation to indicate a block of code. Indentation represents code blocks sounds very good, it requires programmers to think about the appearance of the code strictly. But in fact, almost all editors support one-click indentation. Generally speaking, programmers don't need to waste too much time on code indentation. But whenever I try to move a piece of code to other places, I have to manually adjust the indentation (I believe this is the editor's job, not the programmers'. In my experience, several problems are caused by accidentally pressing the tab, which is hard to see at the time). What's worse, some codes may mix spaces with \tab to represent indentation.
I think it should be the code block to determine the indentation (so that the editor can help a lot), instead of the indentation to determine the code block (I have encountered some problems caused by this reason, and debugging them later is a very bad experience).
Python's
:
does look much better than{
,begin
, etc.. In C language,;
is used to indicate the end of a statement. Will it be more elegant to use:
and;
to indicate a code block?Beta Was this translation helpful? Give feedback.
All reactions