The Joy != operator

John Cowan — 2001-05-30 21:37:24

Since ! is now a terminator equivalent to ., the != operator
does not work. I have changed it to /=, a non-backward-compatible
change. /= is the form used in Common Lisp and Ada.

--
There is / one art || John Cowan <jcowan@...>
no more / no less || http://www.reutershealth.com
to do / all things || http://www.ccil.org/~cowan
with art- / lessness \\ -- Piet Hein

Manfred von Thun — 2001-06-05 02:03:03

On Wed, 30 May 2001, John Cowan wrote:

> Since ! is now a terminator equivalent to ., the != operator
> does not work. I have changed it to /=, a non-backward-compatible
> change. /= is the form used in Common Lisp and Ada.

I'm not so keen.

If the question had arisen before Joy1 existed,
I would have reasoned: "I never liked != anyhow, it is used in
some languages (like C), I know, so if you want to change it to
/= that is fine with me", because Joy has little in common with C."

But now the many additions that you have made to Joy1 make much of
the lexicon so very similar to C, that any departures from that
will stand out unnecessarily. So I would prefer leaving != .
Having a lexicon that people are familiar with is of course
a new consideration for Joy, though barely a new one for language
desighn in general.

Actually it should be easy to do:

scan.c file
getsym function
...
switch(ch)
...
case '.' (BACK TO ORIGINAL)
sym = PERIOD; getch; return;
...
default:
...
id[i] = ...
if (strcmp(id,"!") == 0) (NEW)
sym = PERIOD; (* no getch *) return; (NEW)
if (isupper...

I have not tested this, though. The NEW test will barely make any
difference to efficiency.

What thinkest thou, O Joymaster?

- Manfred

John Cowan — 2001-06-05 05:20:04

Manfred von Thun scripsit:
>
> On Wed, 30 May 2001, John Cowan wrote:
>
> > Since ! is now a terminator equivalent to ., the != operator
> > does not work. I have changed it to /=, a non-backward-compatible
> > change. /= is the form used in Common Lisp and Ada.
>
> I'm not so keen.

I have followed your advice: latest version at
http://www.ccil.org/~cowan/joy.tar.gz as always.
The Win32 executable is not updated yet.

--
John Cowan cowan@...
One art/there is/no less/no more/All things/to do/with sparks/galore
--Douglas Hofstadter

Billy Tanksley — 2001-07-02 23:21:10

From: Manfred von Thun [mailto:phimvt@...]
>On Wed, 30 May 2001, John Cowan wrote:

>> Since ! is now a terminator equivalent to ., the != operator
>> does not work. I have changed it to /=, a non-backward-compatible
>> change. /= is the form used in Common Lisp and Ada.

>I'm not so keen.

Me neither -- mainly because I think that using "!" for "." is a terrible
hack, which could be removed by modifying the syntax slightly to make "30."
always parse as an integer followed by a period. If you want a float, you
have to include a fractional part, such as "30.0".

> - Manfred

-Billy (crotchety, aren't I?) :-)

John Cowan — 2001-07-03 04:43:36

Billy Tanksley scripsit:
> From: Manfred von Thun [mailto:phimvt@...]
> >On Wed, 30 May 2001, John Cowan wrote:
>
> >> Since ! is now a terminator equivalent to ., the != operator
> >> does not work. I have changed it to /=, a non-backward-compatible
> >> change. /= is the form used in Common Lisp and Ada.
>
> >I'm not so keen.
>
> Me neither -- mainly because I think that using "!" for "." is a terrible
> hack, which could be removed by modifying the syntax slightly to make "30."
> always parse as an integer followed by a period. If you want a float, you
> have to include a fractional part, such as "30.0".

I've already backed this change out: != is restored. However, ! as a terminator
is still with us.

I'd love to make "." the only terminator, and change the xyntax as you
suggest, but I just can't figure out how to achieve this in the joy1
code.

--
John Cowan cowan@...
One art/there is/no less/no more/All things/to do/with sparks/galore
--Douglas Hofstadter