[Edu-sig] Another Forth remark
Thu, 12 Oct 2000 10:44:26 -0700
I haven't studied your source in detail at this point, but do
have a question.
My idea of what it'd mean to actually implement a part of FORTH
in Python would be to provide a command line in which users
could enter legal FORTH syntax (without modifications), and
get the expected output. My understanding (I could be wrong),
is FORTH is similar to Python in defining a CLI (command line
interface) or REPL (read, execute, print loop).
As I recall, Python actually ships with a class designed to
provide a user prompt. You could subclass this, and a parser,
which automatically analyzes user input into tokens somehow.
Then it would be up to you to pass this data to methods for
execution, in order to come up with a printed result.
So from a Python prompt it might look something like this:
>> import forth
Welcome to Pseudo-FORTH -- a Python project
> 1 1 +
> 2 3 *
Or whatever it is.
Is that the kind of thing you're doing? Short of this, I
think there's a way of using Python to "give the flavor" of
another language. This is what I was doing with Scheme --
not implementing Scheme in Python (not even trying), put
using the two syntaxes in parallel to highlight similarities
and differences. Typically, when Scheme and C and placed
side by side, or Scheme and BASIC, you're showing how
_different_ they are (emphasis on "contrast" vs. "compare"),
but in the case of Python, you maybe want to bring the
_similarities_ into the foreground.
I did study FORTH from a book a long time ago but I don't
think I ever had a CLI to play with (memory hazy). In
any case, I've pretty much forgotten whatever I learned.
My friend Ron was writing a book on FORTH and one point,
and I think even a compiler, but so far as I know, that
whole project reached a dead end, perhaps because FORTH
stopped being so "hot".
Like you say (or implied, by sharing that quote giving
the hopes of the FORTH folks), these languages come and go.
If we want Python to stick around, we'll have to develop
a bigger user base, and, to me, that means gain more
exposure for it in K-12. But not as an end in itself
(not Python for the sake of Python), but as a means to
an end (making programming languages more accessible in
general, with Python providing an easy on-ramp, and
quick access to a lot of the central ideas in an interactive
environment -- thereby serving as a stepping stone to
other languages _in addition_ to being a productive real
world language in its own right).
So my hope is that some Java folks, for example, won't
necessarily say "no no, you shouldn't be doing Python
in middle school, you should be doing Java!" More,
a lot of them will be saying "Java is pretty hard and
middle school is probably too early to dive into it
deeply -- but Python has a lot in common with Java,
so we support middle schools adopting that, knowing
in the long run this will produce a stream of Java
programmers as well." I think some Schemers (not all),
might have the same attitude.