do...until wisdom needed...

Andrew Dalke dalke at acm.org
Sun May 6 23:09:30 EDT 2001


Douglas Alan wrote in message ...
>"Andrew Dalke" <dalke at acm.org> writes:
>[whole bunches of stuff deleted]

>It wouldn't be small if Python had procedural macros.  Most people
>would love them -- just like most people love them in Lisp.

I guess I'm stuck at the point trying to figure out how procedural
macros could be added to Python.  Is it at all possible to come
up with a hand-waving/straw example?  Everything I think of
seems to end up with a function that converts a large quoted string
into a new Python module, class or function.

>Look how long it took OO
>to catch on (another invention that grew out of Lisp).  Most of the
>arguments people make against procedural macros today, people used to
>make about about OO.

I was under the impression that OO programming grew out of Simula-67.
For example,
http://www.ifi.uio.no/~kristen/FORSKNINGSDOK_MAPPE/F_OO_start.html
or http://jeffsutherland.com/papers/Rans/OOlanguages.pdf .  Quoting from
the last reference,

] when Tony Hoare imparted his idea of a record class construct in
] ALGOL bulletin no. 21, 1965, they realised they needed some kind of
] object with record class properties. When prefixing was introduced
] in 1966, they had what they were after: an object consisting of a
] prefix layer and a main layer, the former containing references to
] its predecessor and successor and the latter accommodating its
] attributes. Combined with the exploration of string handling and
] input/output for the language by Bjoern Myhrhaug and the concept of
] classes, Simula 67, later renamed Simula was born.

>OO was invented in the '70's and it took until the '90's for it to
> catch on.

Right delta, but it was invented in '60s.  As to the later date,
I remember when Borland shipped Turbo Pascal 5.5 in May 1989.  Its
OO ideas were based off of ideas from Apple's Object
Pascal, released in '86.  I was using Turbo C++ in summer 1991
because Borland shipped Turbo C++ that February.  So I would have
dated things to "late '80s" and not "'90's".

BTW, these Turbo programs are available from community.borland.com.  To
bad I don't still have my old 8088 :(

>> c) there is a problem with the usefulness of procedural macros in
>> mainstream development
>
>They've never been used in "mainstream development" -- except to the
>extent that Lisp (and Dylan) have been used for mainstream
>development.

My apologies for using a loaded word there.  I meant something that
was the equivalent to "widely used languages" "other than Lisp" (which
you include as a widely used language even though it "only really
ever caught on in AI circles and for teaching programming").  All
quotes yours.

>Dylan proves that it can be done.  (It's derived from Lisp, but has a
>more traditional syntax.)  Macros are typically executed at
>compile-time, not run-time, which is often necessary for efficiency
>reasons.

Could you give an example of the Dylan syntax for doing macros?
Perhaps this would help with my mental block in understanding how
it could/should be applied to Python.

>Oh, I was just using a funny phrase like from a TV commercial.

Just like "mainstream development"?  :)

> In any
>case, Scheme (a dialect of Lisp) is usually considered state of the
>art for teaching Computer Science 101.  Scheme is what's used at MIT,
>Harvard, Yale, etc.

Just to double check, I looked up what language Yale uses for
their intro. classes

CPSC 110 "Elements of Computing" isn't a programming class
  http://zoo.cs.yale.edu/classes/cs110/

CPSC 112 "Introduction to Programing" uses Java
  http://flint.cs.yale.edu/cs112/index.html

CPSC 201 "Introduction to Computer Science" uses Haskell, but
http://plucky.cs.yale.edu/cs201/ says
] (Previously in this course we used the Scheme programming language.
] In some ways Haskell can be viewed as a strongly-typed variant of
] Scheme.)


On a roll, I decided to check out Harvard:
CS50 "Introduction to Computer Science I" uses C
  http://www.fas.harvard.edu/~lib50/
CS51 "Intro. to CS II" uses LISP, C++, and Java
  http://www.fas.harvard.edu/~lib51/write.cgi

Judging from your email address, I'll assume you know about
what MIT uses for their intro courses.

                    Andrew Dalke
                    dalke at acm.org






More information about the Python-list mailing list