Re: pointer elimination in C

rbe@yrloc.ipsa.reuter.COM (Robert Bernecky)
Mon, 1 Nov 1993 16:09:53 GMT

          From comp.compilers

Related articles
[3 earlier articles]
Re: pointer elimination in C doug@netcom.com (1993-10-19)
Re: pointer elimination in C pop@dcs.gla.ac.uk (Robin Popplestone) (1993-10-22)
Re: pointer elimination in C macrakis@osf.org (1993-10-22)
Re: pointer elimination in C henry@zoo.toronto.edu (1993-10-22)
Re: pointer elimination in C mcdonald@kestrel.edu (1993-10-28)
Re: pointer elimination in C ted@crl.nmsu.edu (1993-10-29)
Re: pointer elimination in C rbe@yrloc.ipsa.reuter.COM (1993-11-01)
Re: pointer elimination in C mcdonald@kestrel.edu (1993-11-03)
Re: pointer elimination in C macrakis@osf.org (1993-11-03)
| List of all articles for this month |
Newsgroups: comp.compilers
From: rbe@yrloc.ipsa.reuter.COM (Robert Bernecky)
Keywords: APL
Organization: Snake Island Research Inc, Toronto
References: 93-10-032 93-10-096
Date: Mon, 1 Nov 1993 16:09:53 GMT

Robin Popplestone <pop@dcs.gla.ac.uk> writes:
|> I would be interested to know what that language is - any serious language
|> -does- in effect provide pointers, but restricts the operations you can do
|> on them in the interests of hygene. LISP for example, provides almost
|> nothing but pointers - typically only short integers and possibly short
|> floats will not be pointers.


APL and J support recursive data structures this way:


      xyz =. <X
(denoted box or enclose)
where X is any array, produces a scalar which is a representation of
the array X. These scalars (which are implemented as pointers)
can be catenated, selected, etc, as any other array elements.


      >xyz
(denoted open or disclose)
produces an array which is the value of X as of the time that the
enclose was performed.


Thus X <--> ><X for all X.


Enclose gives you the ability to build tree-like data structures,
manipulate large array collections as simple entities, etc.


In the above example, changing X (assuming it was a named variable, rather
than a temp) would NOT affect the value pointed to by xyz. Techniques
such as static analysis or reference counts ensure that such side effects
can't occur.


The end result is that enclose/box produces an alias-free method of
pointer support. The only problem with this approach is that since it's
side-effect free, you cannot change the original X via a reference from
xyz, even if you want to.


If you could, we'd be back into the world of aliasing problems.


Bob


ps: Source and binaries for J are available by anonymous ftp from
watserv1.waterloo.edu (aka watserv1.uwaterloo.ca) in /languages/j.


Robert Bernecky rbe@soliton.com
Snake Island Research Inc (416) 203-0854
18 Fifth Street, Ward's Island
Toronto, Ontario M5J 2B9, Canada
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.