Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site redwood.UUCP
Path: utzoo!linus!decvax!tektronix!hplabs!hpda!fortune!redwood!rpw3
From: rpw3@redwood.UUCP (Rob Warnock)
Newsgroups: net.lang
Subject: Re: Reading programs left-to-right.
Message-ID: <210@redwood.UUCP>
Date: Fri, 16-Aug-85 08:26:18 EDT
Article-I.D.: redwood.210
Posted: Fri Aug 16 08:26:18 1985
Date-Received: Mon, 19-Aug-85 21:30:10 EDT
References: <6571@boring.UUCP> <103600002@ima.UUCP>
Organization: [Consultant], Foster City, CA
Lines: 71

Historical Note: The programming language "MARY" (Mark Rain, Reidar
Conradi, Per Holager, and maybe others, circa 1972) did the assignment
operator left-to-right, but the definition operator  of defining local
variables of "const" was right-to-left (as in C initializers). Example:

	int i := 5;
	int j;

defines "i" to be the constant "5" (for the scope of "i"), while
"j" is a "variable". The value of "j" could be set as follows:

	i + 5 =: j;

This was intended to mirror the way assignment is done in assembly
language. (MARY is a systems implementation language).

It is interesting that some rather bizarre things could be done in MARY
that are rare in higher-level languages but common in assembler, due to the
left-to-right assignment and the strange (to most of us) idea in MARY that
labels and "goto"s are typed and carry values. In MARY it is legal to say:

	int x, y, z, w;
	label int foo;
	...
	if y > 0 then y + 3 go foo;
	x + 37 foo: + z =: w;

so that if the goto is taken, the effect is

	(y + 3) + z =: w;

and if the goto did not branch, you get the effect

	(x + 37) + z =: w;

This is exactly the same as in assembler, where sometimes one
computes a partial result and then jumps into some place to
finish the computation and store a result. MARY just happens
to have strong typing of the goto and label to "clean up"
that notion a bit. Yes, I suppose that putting a label in
an expression must cause a cast of whatever is to the left of
the label to the type of the label! So that

	3.12 foo: + 4.23 =: q;

would have to cast 3.12 to int (since "foo" is int) and then float
the result. This is necessary since "foo" may be jumped to with
an int value!

Anyway, COBOL wasn't the only language with left-to-right assignment...


Rob Warnock
Systems Architecture Consultant

UUCP:	{ihnp4,ucbvax!dual}!fortune!redwood!rpw3
DDD:	(415)572-2607
USPS:	510 Trinidad Lane, Foster City, CA  94404

References:

R. Conradi & P. Holager, "A Study Of MARY's Data Types in a Systems
	Programming Application", 24 July 1973. [Published in "Machine
	Oriented Higher Level Languages", van der Poel & Maarssen, eds.,
		North-Holland Publishing Co., 1974.]

M. Rain & P. Holager, "The Most Present Recent Final Word about
	Labels in MARY", Machine Oriented Languages Bulletin #1,
	October 1972. [ Reference found in M. Rains, "A Possible
	Resolution of the Subroutine Calling Interface Problem
	In Machine Oriented Languages", in "M.O.H.H.L.", op. cit.]