[Tutor] Useing Functions

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Aug 20 21:53:12 CEST 2004

On Fri, 20 Aug 2004, Jeff Shannon wrote:

> Chad Crabtree wrote:
> > Use Functions.  Very Very Important, it's the product of millions of
> > years of evolution.  So yes use functions.
> At work, I do a lot of programming in a very old dialect of Basic that
> doesn't *have* proper functions, or any concept of variable scope.
> (You can create "external subroutines", a separate program file that
> acts as a function, and which can only return values through the use of
> its (by-reference) parameters, but that's fairly awkward.)

[some text cut]

> Oh, how I wish I could use functions here!

Hi Jeff,

Hmmm!  Sorry for taking this in an askew direction, but how difficult
would it be to write a preprocessor?  You could write your programs in a
kind of superset of Basic that has subroutines.  This superset wouldn't be
directly executable, but would be input into a preprocessor.  This
preprocessor could then transform that super-Basic back into regular
Basic, and handle all the awkwardness of subroutine linkage, behind the

One of the powerful ideas of computation is that programs can themselves
produce other programs.  Since Basic is such a basic language, the syntax
processing involved in this might not even be too hideous.

Is there a specification on this old Basic dialect that we could look at?
Just out of curiosity, of course...  *grin*

Talk to you later!

More information about the Tutor mailing list