Eliminating assignments and variable syntax (accessors)
bparsia at email.unc.edu
Sat Aug 14 15:02:35 UTC 1999
At 1:05 AM -0400 8/14/99, Lex Spoon wrote:
>Bijan Parsia <bparsia at email.unc.edu> wrote:
>> At 10:55 PM -0400 8/11/99, Lex Spoon wrote:
>> >Well, it's certainly open to discussion :) I'd think it best to count the
>> >first indent as just part of method definition. So to get a block inside a
>> >method, you'd have to add *another* indentation, like this:
>> > myMethod
>> > | x y z |
>> > x := 1
>> > y := 2
>> > z := 3
>> Blargh! That's gross! Imagine the errors! You can't *tell*, without a
>> comment, whether this is a misindentation or a block. *Silent*, *SEMANTIC*
>> errors due to copy and paste are evil. Python doesn't have *that* problem.
>Well, I'm sure people would get real careful with how far they indent.
No, the problem is if this is *someone else's* code, or old code of mine
and I can't *remember* what I wanted to do. I can't look at the code and
*be sure* that it's intended to be a block. And the compiler couldn't help
> And we'd get real good at reading it, too, so long as we don't read
>source code from *other* smalltalks. When indentation has a lot of
>significance, it should be as easy to mis-indent as it would to
>accidentally place a BEGIN keyword in the middle of somewhere: possible but
But a misplaced BEGIN is syntactically incorrect, and can be caught by the
compiler. The error I'm pointed out is *semantic* and *can't* be caught by
the compiler. One thing that makes Python work is that a misindentation
*standardly* causes a syntax error.
And geez! You want people to be real careful? To *have* to be real careful?
>In fact, it's surely easier for an author to notice an extra tab floating
>around, than it is for them to notice an extra [ tossed in somewhere.
Not when My Friend the Compiler puts a little arrow and some text saying,
"You bonehead! don't you think ye old right bracket here would be a good
Give that we aren't working in a text editor, but have the power of parse
based pretty print, I don't see why we need to mess with the syntax to get
what you want.
Oh, for a *neat* way of "eliminating" the brackets etc. you do need to
check out Golgi the outliner, which is still floating around, I think.
(Though I haven't heard from Michael in a while. Michael! You still out
there?) It allowed you to use and outliner in a code pane, and the little
line handles were semantically significant (i.e., the handle for the temp
declaration was a |, for a block it was a [, but you didn't have to type
the characters, and you didn't have to close them).
More information about the Squeak-dev