POV-Ray : Newsgroups : povray.off-topic : All bow to the mighty Python : Re: All bow to the mighty Python Server Time
4 Sep 2024 13:16:53 EDT (-0400)
  Re: All bow to the mighty Python  
From: Warp
Date: 21 Apr 2010 07:25:39
Message: <4bcee0b3@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> >   Relying on the use of whitespace for actual syntax is idiotic (with the
> > exception of separating tokens with at least one whitespace character,
> > while not being important how many).

> Actually it's pretty logical. You might argue that requiring the 
> programmer to manually type a semicolon at the end of each line when 
> it's obvious that each line is a seperate statement is illogical.

  You don't type a semicolon at the end of each line. You type it at the
end of each statement. There may be more than one statement in a line, or
a statement may be split into several lines, and for example function
definitions are not ended with a semicolon.

  Anyways, semicolons are seldom lost when you post a response to an online
blog post.

> >   I'm not concerned about typos. I'm concerned about whitespaces being lost
> > in transfer and different types of whitespace.

> The only real problem with using whitespace is that it tends to get 
> mangled in emails, forum posts, etc. This isn't a problem when you're 
> writing programs. This is *only* a problem if you try to post code 
> snippets on forums and so forth. (And yes, it's kind of irritating.)

  Some editors also might convert spaces at the beginning of lines to tabs
(or the other way around) if you are not careful with the settings. This
doesn't really matter with normal programming languages.

> >>         Why would this be a concern?
> > 
> >   Because when your editor can autoindent your code, it makes programming
> > enormously easier (similarly to how syntax highlighting does).

> And to think that I do all my programming with an editor which doesn't 
> give me syntax hilighting *or* automatic indentation...

  Why? Try some editor which is able to color your code, use it for a few
weeks, and you'll never switch back.

  It naturally depends on the specific language, but with some languages
syntax highlighting and autoindentation actually help to catch typos as
you are writing your code. For example, if emacs starts autoindenting in
a completely crazy way, I immediately know that there's a typo somewhere
(maybe a missing curly bracket or semicolon). Likewise if the code gets
colored completely wrongly (for example if you forget to close a string).
Not that this happens often, but when it does, it's a great help.

> (Then again, I've yet to see an editor with auto-indent which actually 
> indents stuff the way that *I* want it to, rather than the way the guy 
> who wrote the editor wants it to.)

  In many advanced editors you can configure how the autoindentation works.
For example emacs has quite a lot of configuration options. (Of course that
doesn't mean it's *easy* to configure.)

  It's just really handy when a line is wrongly indented, I just press tab
(regardless of where the cursor is on that line currently, and regardless
of whether the line was indented too much or too little), and emacs indents
it just like I want.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.