Path: utzoo!attcan!uunet!seismo!dimacs.rutgers.edu!rutgers!cmcl2!uupsi!sunic!news.funet.fi!hydra!hylka!jpiitulainen From: jpiitulainen@cc.helsinki.fi Newsgroups: comp.lang.misc Subject: Re: Re^2: Some things that pointer-less languages can't do efficiently Message-ID: <3407.2720318d@cc.helsinki.fi> Date: 20 Oct 90 11:14:21 GMT References: <26739:Oct1023:44:2690@kramden.acf.nyu.edu> <65450@lanl.gov> <10397:Oct1212:55:1090@kramden.acf.nyu.edu> <3975@goanna.cs.rmit.oz.au> <415@data.UUCP> <+CI6:YD@xds13.ferranti.com> Organization: University of Helsinki Lines: 48 In article <+CI6:YD@xds13.ferranti.com>, peter@ficc.ferranti.com (Peter da Silva) writes: > In article <415@data.UUCP> kend@data.UUCP (Ken Dickey) writes: >> There are a number of programming languages, Scheme and ML among them, >> which do not have a pointer abstraction. > > The *only* abstractions in scheme are a pair of pointers or a value. It is a pair of values. Pointers to values, as separate from values, do not exist. Pointers (addresses) are usually used in the implementation, because pairs are required to retain their unique identities when they are stored in data structures: the same pair (or vector, or character, or string, ...) can be stored in several data structures at the same time. In C you use pointers for this, and it is a different thing to store an int in a record, or to store a pointer to an int there. In Scheme, any pair or vector can hold arbitrarily big values---even itself---pointers are not needed and there is no such thing as a pointer to an integer. I find the difference as real as Ken Dickey evidently does. (Also, I find your emphasis on "only" very strange. At least, if pairs are abstractions, then vectors and strings should be, too. Procedure formation has long been called "abstraction" in Scheme community, and Scheme is really more about lambda than about data structures. Is this a different use of the word?) > ... > And you accidentally return (cdr list) instead of list, you have all the > problems as you do in C when you return a pointer to the middle of the > array. Oh, sure, the *symptoms* are different, but when you have an > object (a C pointer, or a dotted pair) that can point to any arbitrary > place in any non-atomic language object (a string, or a list) you have the > exact same problem. The same problems are there, when applicable. Lists are just chains of pairs, or pairs who's cdr fields are pairs, and the cdr pair can be a part of some other list, too. Thus mutation is dangerous. You can't have a "pointer" to the middle of a vector or a string, though. A value in the middle of a vector can have many names, but it will not provide access to any other vector element. > Peter da Silva. `-_-' > +1 713 274 5180. 'U` > peter@ferranti.com Jussi Piitulainen jpiitulainen@hylka.helsinki.fi