Kartik Agaram: > Why do we care where the 'left edge' is? As you know, you need to know where an expression indents, and where it ends. If you read in a line, and it has the same indentation level, that should end the previous expression. If its indentation is *less*, it should close out all the lines with deeper or equal indentation.
But I'm trying to *minimize* the changes to the language, and in particular, I don't want to change the "read" interface and I'm not assuming arbitrary amounts of unread-char. Let's say you have: . . foo . . . bar . . eggs . . cheese You would expect this to return three datums: (foo bar), eggs, and cheese. It won't, here's why. First read(): Reads foo, bar, and it consumes the indentation of "eggs" so that it can determine that another is at the same level. It returns (foo bar). Second read(): Reads eggs with NO indentation, because the indentation was consumed by the first read(). It then reads the indentation of cheese, which has an indentation more than zero. It returns (eggs cheese), and we've consumed it all. Solutions: * If you have unlimited unread-char, there is no problem. But many Lisps don't have that. * Read could store indentation state associated with the port, but the user could call other routines. You'd have to re-wrap the entire I/O system if I really wanted to be able to undo the indentation reliably. Ugh, and lousy for performance. And there is a big *benefit* to disabling indentation processing on indent: It provides a trivial escape, improving backwards-compatibility. Thus, if you have old code, you can just insert a space at the beginning of each line & then, even if it has code like: (compute me) (show me) It would still "just work". I'd like this reader to be a drop-in replacement for read(), so minimizing incompatibilities is important. --- David A. Wheeler ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Readable-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/readable-discuss
