Very interesting stuff, Joy!
In the process of setting up Joy on my system, I have made a few
small patches to the source, which I now share.
1) In line 40 of scan.c:
40c40
< if feof(infile[ilevel])
---
> if (feof(infile[ilevel]))
This keeps the compiler (gcc 2.95) happy. Saying "if feof" depends
on whether feof is a C macro whose body begins with '(. If it's
a function, this is a syntax error.
2) In line 165 of scan.c:
165c165
< { if (strcmp(id,"LIBRA") == 0)
---
> { if (strcmp(id,"LIBRA") == 0 || strcmp(id,"DEFINE") == 0)
This allows me to type DEFINE as an alternative to LIBRA, as I feel
funny saying "LIBRA" when typing short definitions directly to the
interpreter.
3) After line 825 of interp.c
825a826,827
> if (stepper->u.ent->u.body == NULL)
> execerror("definition", stepper->u.ent->name);
This makes it a fatal error to execute an undefined user symbol:
$ joy
JOY - compiled at 20:40:38 on Mar 23 2001
LIBRA b == 3.
b.
3
a.
run time error: definition needed for a
[a] i.
run time error: definition needed for a
I'm now investigating the following more complex ideas:
a) allowing user symbols in set literals iff the symbol evaluates
to a single int or char
b) generic functions -- I haven't worked out the details yet