Subject: Re: RFC: Lisp/Scheme with less parentheses through Python-like significant indentation? From: Erik Naggum <erik@naggum.net> Date: 2000/08/09 Newsgroups: comp.lang.lisp Message-ID: <3174842187091565@naggum.net> * Paul Fernhout <pdfernhout@kurtz-fernhout.com> | Has this been tried before? If so, what was the outcome? You have broken the property of Lisp that code can be read as data, and code printed as text to be read back in. You don't seem to be aware of the fact that Lisp code is readable by the Lisp system, but instead treat it as if Lisp were a language with a syntax it could not itself simply "read", like Python. And like Scheme. This is where Scheme departed most clearly from the Lisp camp, years ago. Scheme code is made up of characters and tokens. Lisp code is made up of lists and elements. The difference is _monumental_ in scope. | One advantage to such an approach it that it might make it easier to | compose Lisp on devices without keyboards. An indent-line button and an | unindent-line button would be useful in that case. I think "down" and "up" are equally useful/likely "buttons". I use Emacs with these operations all the time, in fact. Very seldom do I type invididual parentheses. | Significant indentation might make it easier for developers who don't | know Lisp well to understand a Lisp program's structure. Nonsense. | Every additional character on the screen takes more time for the eye | and mind to process. This silly metric runs counter to much cognitive science. forinstanceithaslongbeenknownthataddingsuperfluouscharacterslike whitespaceandpunctuationmarksimprovereadabilitysignificantly | In practice, experienced Lisp developers will rely on the | indentation anyway -- as editors are used to count parentheses. If you rely on something, would you be happy if someone removed that which what you rely on rests? I would be unhappy, as that which I rely on is now in danger of collapsing, as surely your syntax would as soon as the next clever idea comes along. | Such code will be faster to create. Drop the marketing and your credibility will improve. | There is less typing, and no worry about unbalanced parentheses. Again, drop the marketing. How do you determine the indentation? That alone looks like _more_ typing to me. | Also, with significant indentation, indentation can not as often be | misleading as it can be with parentheses. Your credibility is suffering with this line, too. | ======= Some disadvantages ======= | | I'm sure people will point out lots. Send 'em on! This idiocy hints that you're ill-prepared for your own proposal. | The major one is that this is non-standard and not available. The major one is that you're breaking a very significant property of the language, and you're not even aware of it. Oh, right, you're thinking in Scheme, which _is_ a language that breaks this important property of Lisp, and has a character-level syntax, like Algol. | ======= More issues to consider ======= | | One issue is that parenthesization is redundant when you use | indentation. Predictable redundancy is what keeps people sane. | Another way to look at it is, in practice, a Lisp coder is already | doing these rules implicitly as part of the conventional indentation | process. You seem to think that Lisp "coders" indent their code by hand. They don't. | So this approach just loses some of the extra burden of worrying | about quite a few of the parentheses, which are syntactically | redundant if proper indentation is in place. Lisp programmers (I take exception to "coders") don't count parens, but use automatic re-indentation to check that they got it right. When you remove one of these "redundant" parts, you remove the tool that makes indentation sufficient _after_the_fact_. | Yes, people put down Lisp saying it stands for "Lots of Infernal Stupid | Parentheses". Rather than be defensive, here is an approach that might | do something about what much of the world perceives as a difficulty in | reading and writing Lisp code. Rather than be defensive, be smart and ignore the infernal idiots. | Making indentation significant works for Python. | Why not make it work for Lisp too? Because Lisp doesn't have _syntax_ the way Python has. You have redesign the Lisp reader and printer to be able to perform this incredibly silly stunt, and you aren't even _aware_ of that, either. Go do your homework, and be creative when you know what your "good ideas" are affecting. | Learning from Python's mistakes (tabs are allowed and they are | expanded inconsistently on various systems) I would suggest always | requiring two spaces per level of indentation. But you don't even understand how the current indentation is used! | I'm not going to say this wouldn't take some getting used to for | experienced Lisp hackers. Hey, not to worry, most of the experienced Lisp hackers around have been to one more universities, and anyone who has been to any university has seen the freshman who knows how to run the whole place better than everybody who has ever actually run a university. "Clever" novices is old hat to us old farts. | ======= Psychobabble justification ======= | | Some level of complexity in any task exists. It can often be pushed | around however, or refactored into different chunks. Sometimes, a | refactoring of compelxity will fit more naturally onto what most | human minds do well. Pardon me, but most human minds don't to programming well at all. The few that do, tend to be very diverse. Much more so than those that do, e.g., plumbing or carpentry well. Programming is like an art in many ways because of this diversity of its performers. Some like Lisp because Lisp is Lisp. You don't. That may mean your mind doesn't work the way that other Lisp programmers' minds work. I know my mind doesn't work the way Perl programmers' minds work, and while I think Perl is the suckiest language ever, I don't handle the way purely functional languages work very well, either, and while I could be "proud" of being "above" Perl, I can't be proud of being "below" functional languages, as those are somehow "better". I have come to recognize that I understood SGML very well because my mind works very well with hierarchical, nested structures and languages that describe them. If your mind doesn't work that way, come to peace with yourself and do something else: I have "decided" not to work with Perl and C++ and such things, in the sense that I know that I couldn't be so good at it that it would be rewarding in itself to work with these languages. It _is_ rewarding in itself to work with Lisp. For me. | This is because the human mind is quirky that way. Some day, I hope you will recognize that "the human mind" is one of the stupidest things you can say. We're not 6 billion people who differ only in fingerprints, you know. We're surprisingly different mentally, too. _Diversity_ is the name of the game. Accepting it is not very different from getting used to people having different color skins. After you accept it, you automatically accept that people who are like-minded in any of whole range of different ways will congregate. Lisp programmers congregate for such reasons, and they don't _need_ your misplaced, misunderstood syntax. | For example, it is easier to remember a seven digit phone number | than a fifteen digit number. But it's easier to remember an eight-digit phone number with a large degree of systematic relation to something you know well, such as geography, than to remember a six-digit phone number that appears to be randomly allocated. (Empirical results from the expansion of the Norwegian phone number system, which went from 5- and 6-digit local numbers with 1- or 2-digit area codes to a uniform 8-digit system.) It's also easier to remember a ten-digit phone number than to take short-cuts and remember only the seven last digits and _hope_ you're in the right area. (Empirical evidence from area code splits in the U.S., repeated many times, and well documented in telephone circles.) | Together these let you run about seven digits (each digit itself a | chunk) through your mind while you dial a seven digit telephone | number. Remembering phone numbers are similar to musical memory. We don't remember individual digits, but somehow find an internal "rhythm" to them. Much recent research into memory has concentrated on the "rhythm" theories, both in spelling and remembering numbers, music, exact quotes, poems, stories, names, etc. People who are unable, for a variety of reasons, to map events to rhythms, lose out. This has absolutely nothing to do with the theory you ascribe to numbers. | ======= Conclusion ======= | | Lisp uses structure to replace much of what other languages do with | syntax. This is simply WRONG. Do your homework, and come back later. | Have I missed something technical that makes indentation unworkable? | Obvious it faces an uphill battle for social acceptance and | implementation into specific Lisp and Scheme systems. You will meet much less resistance in the Scheme camps, as they have already dispensed with the notion that code should be readable as data. Hell, they don't even believe in compile-time manipulation of the code, so there's no _need_ to be able to read it as data. | If people think this idea is interesting and has no obvious technical | flaws, I may proceed to try and see if I can get this to work in | DrScheme. That sounds like a good idea. However, I suggest you keep Common Lisp out of your experiment. #:Erik -- If this is not what you expected, please alter your expectations.