begin quoting Chuck Esterbrook as of Wed, Jan 02, 2008 at 06:44:02PM -0800:
> On Jan 2, 2008 2:40 PM, SJS <[EMAIL PROTECTED]> wrote:
> > begin quoting Chuck Esterbrook as of Wed, Jan 02, 2008 at 02:22:29PM -0800:
> > > My experience in talking to people is that folks who have used Python
> > > know how straightforward and safe indentation-for-blocks is while
> > > former Cobol and Fortran users fear the whitespace due to false
> > > associations between indentation-for-blocks and the various problems
> > > that those languages had.
> >
> > It's not fear, it's wisdom.
>
> No, it's over-generalization like so: Cobol and Fortran used spaces in
> certain ways therefore any language that does something with spaces
> must be bad/stupid/toyish.
Far more reasonable than the other overgeneralization of "people use
indentation to indicate scope, therefore all you need is indentation to
indicate scope." Or even "people are scared of braces, so funny-looking
characters shouldn't be used".
It's not "doing something with spaces" that is the problem, only
indentation-as-syntax (IAS). We're not arguing that all whitespace is bad;
quite the contrary. Whitespace tokenization is a *good* thing. I'm
even okay with mandatory whitespace around _all_ operators.
Nor has anyone taken up the position that C syntax is perfect. Or that
C-style syntax is the only way to go.
The problem is that there are real and valid concerns with IAS that
are patronizingly dismissed, and the reason for _THAT_ is, I believe,
that we don't recognize that not everyone is wired up the same way.
"If you only give it an honest go, you'd see how great it is, and
you'd come around to my way of thinking. As you don't agree, you must
be dishonest, foolish, scared, or stupid!"
> Here's a similar argument: C++ is hard to learn and use therefore any
> language with curly braces should be avoided.
Well... it is pythonic dogma....
> > And I've been finding a stronger correlation between preferred brace
> > styles and acceptance of indentation-as-whitespace.
> >
> > Folks who don't mind:
^^^^^^^^^^^
"Whitesmiths style":
> > if (expression)
> > {
> > code
> > }
> > or
> >
"GNU style":
> > if (expression)
> > {
> > code
> > }
> >
> > Mostly seem to have no (or little) objection to indentation-as-syntax.
> >
> > Folks who prefer
> >
"1TB style" or "K&R variant style":
> > if (expression) {
> > code
> > }
> >
> > or
"Allman style":
> > if (expression)
> > {
> > code
> > }
> >
> > Mostly seem to object to indentation-as-syntax.
>
> Well I'm a counterpoint. At different times I've been the last two and
> I never objected to indentation-for-blocks.
That's not the assertion.
Do you _mind_ the first two? Or do they drive you batty?
Lots of people don't mind, or "are comfortable with" the second pair;
they don't have a problem with IAS. But that's not my theory. I'm
looking for people who can't STAND the Whitesmith or GNU styles, who
also like IAS languages.
Some people Just Don't Care At All. They're comfortable with all of the
brace and indentation styles; I consider them the sort of people who can
enjoyably read _Moby Dick_ or _Gravity's Rainbow_ -- people capable of
amazing feats, but not someone who's advice I'll consider credible.
[snip]
> > Then you should go with 8 spaces. If you're going to normalize things,
> > then normalize 'em to the, well, normal definition, no?
>
> No. I've worked with so many developers that use 4 (whether actual
> spaces or tabs) that 8 just feels like a bizarre relic from decades
> ago. Kind of like wrapping code to 80 columns. I don't have an 80
> column display anymore! (Heh, another hook for a religious war.)
I do wrap at 80 columns. I don't use just one editor window, after all,
and arbitrary line-lengths pretty much forces me to edit just one file
at a time. (I worked with a guy -- a pythoner, in fact -- who did not
like the '80 character restriction'. He was always resizing windows,
which meant he frequently was grabbing the mouse. Quite the PITA.)
I also print out code (yes! On paper!) every so often; to the printer,
tabs are 8 spaces; with long lines and 4-space tabs, it ends up
truncated (and unusable) or wrapped (and even harder to read).
Nothing beats a pen and a printout for puzzling out the really tricky
stuff -- at least, not for me. And when it comes to IAS code, a pen
and a straightedge is essential!
> > No, it wasn't.
> >
> > It wasn't a simple <pre>...</pre> block -- it was some sort of CSS
> > monster with div and span tags everywhere. All hail the new Web!
>
> Still not too hard. You can strip HTML tags.
...and reformat by hand. Yes. The problem is I wasn't willing to go thru
that sort of work just to try out a script to see if it did what it
promised. Instead of taking five minutes with a perl script to clean
up the potentially-useful python code, I spent ten minutes with a perl
script and did the job myself, AND had something I trusted when I was
done.
> Look I'm not saying you didn't have this experience or that
> indentation-for-blocks is perfect. But I've cranked so much Python
> that I know it's not a major factor in day-to-day development. I
> didn't spend time every day dealing with mangled code. Or even every
> week or month.
Indeed. And that's not the expectation. Day-to-day, the problem with IAS
is that I can't comfortably read it. The ability to comfortably and
unambiguously READ code is important to me.
But code gets trashed often enough, by accident; having a way to recover
is very *important* to me. And minor off-by-one-column corruptions in
the code happen all the time, especially with "smart" editors, but they
don't affect functionality, so they're not really a problem.
I acknowledge that what I consider important is often largely irrelevent
to others. That doesn't make it any less important, nor will I shut up
in the face of overwhelming conformism... (else I'd never have run Linux
all those years ago).
[snip]
> > And I've never been able to read python. I can puzzle my way through
> > many (real) languages, but in python, the scoping is impossible to keep
> > track of.
>
> I don't even know what to say. I've never heard this before. Python
> looks a lot like pseudo-code. Real question: Can you read psuedo-code
> in C.S. books? It's typically indented and, yes, with an "end" at the
> end of blocks. If you can, was it that "end" that shifted you from a
> "cannot read" extreme to a "no problem" extreme?
Actually, that is /exactly/ what I do. I put a closing token for each
block, and I'm good. (But annoyed, for having to do that.)
I'm not hard-over on braces; I *am* hard-over on delimiters. Be they
C's }, pascal's end, PCPL's &end, or Objective-C's ], I need those
unambiguous block delimiters.
What's amusing is that when I do read python or IAS psuedocode in a book
(or printed out), I annotate it with vertical lines from the initial
keyword to the closing block. That is,
while expression1 while expression1
if expression2 | if expression2
do something ===> | | do something
else | else
do something else | |__do something else
|_____
...which strikes me as just as practical as whitespace. "Pipes-as-syntax"
has all the advantages of whitespace, plus it avoids the whole space/tab
issue entirely without forcing one or the other.
> I have seen Python code that I couldn't read because it had an
> atrocious structure and identifiers. But we've seen that in all
> languages.
Yup.
There's no language in which it is the least bit difficult to write
incomprehensible code.
[snip]
> No, I was responding to your statement that Python is a toy language.
> It's perfectly valid to say "$X is a big company with some great
> products used by lots of people. $X used $Y, therefore $Y--whatever
> it's flaws--is not a toy."
I have less faith in big companies than you do, it would seem.
"Perfectly valid" does not at all describe my opinion of that statement. :-P
> For example, I like Amazon, but I don't like Java. But I know Java is
> not a toy because some of Amazon is powered by it and that's a serious
> environment.
You probably don't want my opinion on J2EE.... or rather, I'm not sure
I want to take the time to vent that much.
[snip]
--
For every product $Z, $Z is shiny, $Z is great, and $Z is cool,
And if you can't bring yourself to love my $Z, then you're a tool!
Stewart Stremler
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg