why ; ?
Bill Baxter
dnewsgroup at billbaxter.com
Tue May 6 12:48:12 PDT 2008
Nick Sabalausky wrote:
> "bearophile" <bearophileHUGS at lycos.com> wrote in message
> news:fvnk34$m27$1 at digitalmars.com...
>> Tomasz Sowinski:
>>> I like the version without ; but how can you tell where a block ends
>>> without braces? indents?
>> Where there is a de-dent.
>> There's a known language that's designed like this ;-)
>
> Oh man, now you've got me started on one of my pet peeves...
>
> Semantically-meaningful indentation: That is exactly the reason I truly,
> truly hate Python (Well, that and a complete lack of variable declarations.
> Hello, hidden bugs!).
>
> Python's semantically-meaningful indentation was intended to fix the problem
> of poorly-indented code by enforcing proper indentation in the language and
> compiler. But the problem is, it *doesn't* actually enforce it. In fact, it
> *can't* enforce it because it doesn't have enough information to enforce it.
> All it really does (and all it's able to do) is run around *assuming* your
> code is properly indented while silently drawing semantic conclusions from
> those (obviously not always correct) assumptions.
>
> In fact it's really the same root problem as "no variable declarations". In
> both cases, the compiler does nothing but assume that what you wrote is what
> you meant, thus silently introducing hidden bugs 1. Whenever you didn't
> *really* want the new variables "my_reponse" and "my_responce" in additon to
> "my_response" (VB/VBScript coders use "option explicit" *for a reason*), and
> 2. Whenever you didn't *really* want to break out of that loop/conditional.
I like Python, but I agree the whitespace structure thing is at best a
wash. Not having to type braces does make the code look cleaner, but
causes other problems. If there were such a thing as curly-brace
Python, I'd probably use that.
--bb
More information about the Digitalmars-d
mailing list