# Patches to Joy source

## cowan@ccil.org — 2001-03-26 04:53:20

    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

## Manfred von Thun — 2001-04-11 00:56:14

    On Mon, 26 Mar 2001 cowan@... wrote:

    ...

    >

    > 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:

    ...

    In my original reply I argued against this change. But after the

    detailed discussion by members of the group I agree to the

    (unanimous ?) opinions expressed. I'll make the change in the

    home page source, and in my working source. Thanks everybody

    for the discussion, and thanks, John, for the patch.

        - Manfred

## John Cowan — 2001-04-11 04:24:15

    Manfred von Thun scripsit:

     > In my original reply I argued against this change. But after the

    > detailed discussion by members of the group I agree to the

    > (unanimous ?) opinions expressed. I'll make the change in the

    > home page source, and in my working source. Thanks everybody

    > for the discussion, and thanks, John, for the patch.

     And after I had just hacked in a new variable "undeferror" which if true

    makes calling undefined functions an error, and if false makes them

    no-ops.

    --

    John Cowan                                   cowan@...

    One art/there is/no less/no more/All things/to do/with sparks/galore

    	--Douglas Hofstadter