Search the web
Sign In
New User? Sign Up
OSCAR-PROJECT · OSCAR is an open source REBOL interpreter
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Continuations, back to the future............   Message List  
Reply | Forward Message #1006 of 1031 |
Hello again everybody,

I've been away in Scheme world these last few weeks,
however I've subsequently greatly increased my understanding
of possible PRIMO / REBOL implementation methods.

It all started about a month ago when I was thinking about
REBOL and it language ancestry, Forth & Scheme are obvious
antecedents with lots of similar ideas & features, and indeed
REBOL creator Carl Sassenrath worked on implementations of
of both these language families earlier in his career.

I was also intrigued by certain features of ICON and their
similarity REBOL, but what also caught my attention was
some of the more powerful ICON functions / procedures like
the iterators & generators which have the ability to return
possibly multiple values, it's basis of goal directed evaluation
which our Ladislav is a big fan of if I'm correct? and also it's
co-expressions and co-routines which have the ability to be
suspended & also resume.

There was some synchronicity in this, as I also regularly follow
Python & Perl development, I read items on the new iterator &
generator constructs which are now available in Python 2.2 and
also some work being done on "microthreads" which are a very
lightweight threads implementation, much more lightweight than
other system or language threads, and are used for scalable multiple
concurrency programming. I delved deeper into this and found out
than this had been partially incorporated into core Python from
some research work & implementations done in STACKLESS Python which
was inspired by certain features in ICON & SCHEME and based on a
programming construct called "CONTINUATIONS" which enable you to
do wierd & wonderful things with the control flow of a program.

Now I remembered that REBOL too had continuations once, back in
REBOL v1.x days, it also had tail-call optimisation too which enable
functional programming and deep recursion. I looked up one of the
early REBOL manuals from the "shoebox" at www.rebolforces.com and
found that this indeed was the case. This heightened my curiosity
and I decided to investigate this much deeper.

My query was / is this; If REBOL is so carefully designed, and as we
are often told Carl spent the best part of two decades formulating
his ideas & designs, IF Continuations were in REBOL originally it
must have been because Carl decided that they were an important
feature of the language, desirable enough that much was made of
REBOL having "first class continuations" and would soon also have
"pre-emptive multitasking", why then were these features dropped
from REBOL versions 2.x onwards?

That is a slightly rhetorical question, because I know the answers
which were given at that time, I started using REBOL either just before
or just after the change which was some time in 1998 if I remember
correctly. It was stated that REBOL was moving from a Scheme based
"Continuations" model of interpretation to be based on a Forth like
stack based engine for reasons of speed and efficiency. Without knowing
the implementation details, we can only speculate that this was because
REBOL Version 1 was comparatively slow and inefficient compared to
some other popular and available languages and RT Inc. being a commercial
company had to make the commercial decision to drop some pretty powerful
features for the sake of speed & efficiency if the language was to gain
any traction and uptake with users / developers.

My perspective is that this was a decision taken with one eye on the
commercial needs & imperatives of RT Inc. which needed to quickly
grow a user base to have any viability. If we divorce ourselves from
the commercial needs of RT Inc. and consider them a non issue on
technical grounds, which pursuing open source as interested parties or
hobbyists, and presumably able to sustain ourselves, we can "afford" to
take the long term view on these matters, are first class continuations
and tail-call optimisation desirable features for a language?

My view is that they are desirable, REBOL's designer obviously thought
so too and hence put them in REBOL in the first place.

My question was {Was it the "continuations model" that made REBOL version
ONE slow?} or was it a combination of the method in which continations
were originally implemented in REBOL as well as some other factors which
needed improved?

Larry Palmiter on the REBOL list, as well as some other people, have done
some benchmarking of REBOL against other languages, one of which was
DR SCHEME, which has first class continuations and tail call optimisation,
and whilst current REBOL performs quite well overall, DR Scheme beat or
equalled REBOL on certain functions / algorithms, and generally faired
quite well overall. The conclusion that I drew from this was that it
was most probably then the implementation design used that made original
REBOL slower ( as well as probably some other implementation features
which needed fixed. )

I decided I should investigate deeply SCHEME implementations and have
immersed myself in SCHEME world for the past month, reading and studying
everything I can about the language, it's features and implementation.
I've discovered and learned lots of things. Firstly REBOL is indeed a
much prettier language and I'm glad I favoured REBOL style and syntax
over the antiquated LISPish syntax that Scheme has. Also REBOL has richer
datatypes and inbuilt internet capabilities which are a massive plus,
however that's about it. On everthing else SCHEME wins hands down, though
to be fair REBOL is less than five years old whreas Scheme is twenty five
years old and LISP is over forty years old, so much more is understood
and developed in these languages. The SCHEME resources are immense and
I've been reading voraciously and studying code of various aspect of
Scheme features and implementation techniques and standards.

Scheme is also favoured much in academia and much has been written
and implemented, with sources, on lots of the practical (and esoteric)
problems of computer languages and ther implementation.

What I soon learned that best performing SCHEME implementations are
Chez Scheme, PetiteChez Scheme & Dr Scheme / MzScheme. Other useful
implementaions are Systas scheme & R-scheme.

For alittle bit of background;

ChezScheme is a commercial implementation available from Cadence Research
and is based on a very fast incremental compiler, there is also the freely
available PetiteChez scheme which is a token threaded interpreter.
Source code is not available for either of these however their chief
designer and implementer is R. Kent Dibvig, formerly of Indiana University
and who is a leading Scheme luminary and who has written volumes of essays
and example of thier practical implementation, code examples, as well as
in depth analysis of continuations, recursion, macros, garbage collection,
compilers etc. etc. Of special interest are his writings on continuations
and multiple return values and concurrency on stack based interpreters.

Dr Scheme / MzScheme are an exellent open source implementation of a lot
of Kent Dybvig's implementation ideas and writings. Also of interest is
Systas Scheme by Tom Lord which is also open source free software with
implementation documentation. Tom Lord was previously a lead developer
and author on SCM sheme and GUILE the GNU project extension language
which is alos used in GNOME desktops.

So from all this I've learned a lot of useful implementation ideas for
PRIMO and how to bring back first class continuations and tail call
optimisation as useful control structures and language features.
With these all sorts of wonderful things become possible, here's a
short of the sort of functions and concurrency and control features
you can get ;
tail-recursion optimisation, iterators, generators, co-expressions,
co-routines, microthreads, exceptions & error handling, escape procedures,
one shot continuations,first class continuations,co-operative multitasking
pre-emptive multitasking.

As another piece of synchronicity, Joel Neely posted a piece on the REBOL
list about the Little Languages Conference, upon which reading it made
mention of Joe Marshall who helped implement a big part of original
REBOL which was described as Scheme with filed off parenthesis.

Continuations, back to the future............


cheers,

Mark Dickson



Fri Nov 30, 2001 6:05 pm

robbo1mark
Offline Offline
Send Email Send Email

Forward
Message #1006 of 1031 |
Expand Messages Author Sort by Date

Hello again everybody, I've been away in Scheme world these last few weeks, however I've subsequently greatly increased my understanding of possible PRIMO /...
Robbo1Mark@...
robbo1mark
Offline Send Email
Nov 30, 2001
6:05 pm

Continuations are a too highlevel mean to do lowlevel tasks. Scheme as a teaching language and in it's emphasis on "purity" and "theoretical elegance" has a...
Jochen Schmidt
poirierde
Offline Send Email
Nov 30, 2001
7:04 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help