From: Albert Chou Date: 2003-10-22T08:25:39+09:00 Subject: weird(?) thought about programming languages This is a multi-part message in MIME format. ------_=_NextPart_001_01C3982A.667BB4DC Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable This thought isn't necessarily about Ruby specifically, though the occasional wish expressed here that Ruby have Lisp-like macros added to it resonates with it. I've been reading Paul Graham's _On Lisp_ to finally learn what all this talk of Lisp macros is about, and I've read enough (I'm into chapter 15 so far) to understand a lot of it, generally speaking. I spent some time trying to understand how it might be possible to use macros to give Lisp (or Scheme) a syntax that's easier for me to read (for instance, I find most of the function names I've encountered in Common Lisp to be pretty incomprehensible). I even came across a USENET posting from about 1991 from a guy who had done that with Scheme, but I couldn't find any more references or a way to contact him. Further searches of the Web turned up another discussion about making Scheme need fewer parentheses that finally taught me what I think is a core lesson about language syntax: it's difficult, if not impossible, to change the punctuation of a programming language using its own mechanisms. By punctuation I mean how tokens are delimited/defined. The discussion about making a less-parenthesized version of Scheme concluded that you'd have to write a special-purpose reader (basically parser, IIRC) to accomplish the task. Thus you can write as highly abstracted and domain-specific a language as you like on top of Lisp/Scheme, as long as you adhere to the way these parent languages uses parentheses, whitespace, and alphanumeric characters to define language tokens. Adding words (and even language constructs, in a language that has macros) to a language's vocabulary is easy, but redefining how to define words is impossible without stepping outside the language. Of course, you could write a parser for your extended language in the language you're extending, but my point is there's no way to make a parser for the original language work with the extended language if you violate the parent language's punctuation rules. Whew, just wanted to say that somewhere that someone would understand it. Comments welcome, but not necessary. Al --=20 Albert Davidson Chou, QA Manager TeaLeaf Technology, Inc. (415) 932-5031 AChou@TeaLeaf.com | http://www.TeaLeaf.com/ ------_=_NextPart_001_01C3982A.667BB4DC Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable weird(?) thought about programming languages

This thought isn't necessarily about Ruby = specifically, though the occasional wish expressed here that Ruby have = Lisp-like macros added to it resonates with it.

I've been reading Paul Graham's _On Lisp_ to finally = learn what all this talk of Lisp macros is about, and I've read enough = (I'm into chapter 15 so far) to understand a lot of it, generally = speaking.  I spent some time trying to understand how it might be = possible to use macros to give Lisp (or Scheme) a syntax that's easier = for me to read (for instance, I find most of the function names I've = encountered in Common Lisp to be pretty incomprehensible).  I even = came across a USENET posting from about 1991 from a guy who had done = that with Scheme, but I couldn't find any more references or a way to = contact him.  Further searches of the Web turned up another = discussion about making Scheme need fewer parentheses that finally = taught me what I think is a core lesson about language syntax:  = it's difficult, if not impossible, to change the punctuation of a = programming language using its own mechanisms.  By punctuation I = mean how tokens are delimited/defined.

The discussion about making a less-parenthesized = version of Scheme concluded that you'd have to write a special-purpose = reader (basically parser, IIRC) to accomplish the task.  Thus you = can write as highly abstracted and domain-specific a language as you = like on top of Lisp/Scheme, as long as you adhere to the way these = parent languages uses parentheses, whitespace, and alphanumeric = characters to define language tokens.  Adding words (and even = language constructs, in a language that has macros) to a language's = vocabulary is easy, but redefining how to define words is impossible = without stepping outside the language.  Of course, you could write = a parser for your extended language in the language you're extending, = but my point is there's no way to make a parser for the original = language work with the extended language if you violate the parent = language's punctuation rules.

Whew, just wanted to say that somewhere that someone = would understand it.  Comments welcome, but not necessary.


Al
--
Albert Davidson Chou, QA Manager
TeaLeaf Technology, Inc.
(415) 932-5031
AChou@TeaLeaf.com | http://www.TeaLeaf.com/

------_=_NextPart_001_01C3982A.667BB4DC--