Classifying languages by how they handle operands

Don Groves — 2007-12-20 20:54:13

It occurred to me recently that one way to differentiate programming
languages is by how they handle operands.

Operands in many languages appear in two places. They are placed
directly in expressions to be evaluated, such as a + b + c, and are
passed to functions or procedures, such as add(a,b,c).

Lisp and its cousins use operands only once, placing them in a
structure preceded by an operator, (+ a b c) , effectively combining
their passing and evaluation.

The languages of interest to this group place operands in a structure
followed by a sequence of operators, (a b c) + +, which also combines
passing and evaluation.

While admittedly low level, is this concept worthy of further
discussion? Has it been discussed before, either here or elsewhere?
--
Don

William Tanksley, Jr — 2008-01-22 17:14:39

Don Groves <dgroves@...> wrote:
> It occurred to me recently that one way to differentiate programming
> languages is by how they handle operands.

Sure thing -- sensible.

> Lisp and its cousins use operands only once, placing them in a
> structure preceded by an operator, (+ a b c) , effectively combining
> their passing and evaluation.

Let me add a word to your description:
Lisp and its cousins place operands them in a *lexical* structure
preceded by an operator, (+ a b c) , effectively combining their
passing and evaluation.

I also deleted "use operands only once", since I don't know what you
mean by that. (What did you mean?)

> The languages of interest to this group place operands in a structure
> followed by a sequence of operators, (a b c) + +, which also combines
> passing and evaluation.

...and here my modification is to stress that the structure is a *semantic* one.

The major difference is that the lexical structure is constrained to
the medium of the language -- one-dimensional text parsed into a tree.
A semantic structure can be more complex -- the operand flow for a
stack language is a digraph rather than a tree.

There are pros and cons to both.

> While admittedly low level, is this concept worthy of further
> discussion? Has it been discussed before, either here or elsewhere?

I believe Manfred looked at it before... I can't recall which paper, though.

> Don

-Wm

Don Groves — 2008-01-22 20:44:21

On Jan 22, 2008, at 19:14 , William Tanksley, Jr wrote:

> Don Groves <dgroves@...> wrote:
>> It occurred to me recently that one way to differentiate programming
>> languages is by how they handle operands.
>
> Sure thing -- sensible.
>
>> Lisp and its cousins use operands only once, placing them in a
>> structure preceded by an operator, (+ a b c) , effectively combining
>> their passing and evaluation.
>
> Let me add a word to your description:
> Lisp and its cousins place operands them in a *lexical* structure
> preceded by an operator, (+ a b c) , effectively combining their
> passing and evaluation.
>
> I also deleted "use operands only once", since I don't know what you
> mean by that. (What did you mean?)

Mea culpa, William, I should have said something like, "use operands in
only one form."

Many languages use operands in two distinct forms, one for evaluation,
x = a+b, and another for passing, DoSomethingWith(a,b). To me, the
combining of these into a single form is one of the beauties of Joy,
Lisp, etc.


>> The languages of interest to this group place operands in a structure
>> followed by a sequence of operators, (a b c) + +, which also combines
>> passing and evaluation.
>
> ...and here my modification is to stress that the structure is a
> *semantic* one.
>
> The major difference is that the lexical structure is constrained to
> the medium of the language -- one-dimensional text parsed into a tree.
> A semantic structure can be more complex -- the operand flow for a
> stack language is a digraph rather than a tree.
>
> There are pros and cons to both.
>
>> While admittedly low level, is this concept worthy of further
>> discussion? Has it been discussed before, either here or elsewhere?
>
> I believe Manfred looked at it before... I can't recall which
> paper, though.

Thanks, I'll look for it. And you make an excellent point about the
lexical
vs. semantic structure.
--
Don


>> Don
>
> -Wm
>