Newsgroups: comp.lang.lisp.x
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!newshost.marcam.com!zip.eecs.umich.edu!caen!hearst.acc.Virginia.EDU!murdoch!usenet
From: "Steven D. Majewski" <sdm7g@Virginia.EDU>
Subject: more on: compound-object-proto's in xlisp-stat
In-Reply-To: <Pine.A32.3.90.950628090307.1773A-100000@elvis.med.Virginia.EDU>
X-Sender: sdm7g@elvis.med.Virginia.EDU
X-Nntp-Posting-Host: elvis.med.virginia.edu
Content-Type: TEXT/PLAIN; charset=US-ASCII
Message-ID: <Pine.A32.3.90.950628103255.24180B-100000@elvis.med.Virginia.EDU>
To: Xlisp List <stat-lisp-news@umnstat.stat.umn.edu>
Sender: usenet@murdoch.acc.Virginia.EDU
Organization: University of Virginia
References: <Pine.A32.3.90.950628090307.1773A-100000@elvis.med.Virginia.EDU>
Mime-Version: 1.0
Date: Wed, 28 Jun 1995 15:21:53 GMT
Lines: 45


I should add that there *is* a #'map-elements function that
will map on compound-data-proto objects, as well as other
types of sequences, so in that respect it's not as broken
as I had first thought. 

On the other hand: "(length cdata)" is an error, and NOT
the equivalent of "( send cdata :data-length )" [ - which
is worse than I had thought!] 

What makes this all more than just a minor anoyance is that using
compound-data objects in any but the most restricted cases
becomes dangerous because of compound-data-proto "contagion": 
other sequences resulting from operations on compund-data 
objects can be silently promoted to compound-data objects, and then
fail on a sequence operation somewhere down the line due to that
contagion. Lisp programmers soon get used to using the most 
general sequence operations if it's likely that a function ought
to work for both CONSes and vectors, but this seems to add an
even harsher set of restrictions and problems. 

There is some control of this contagion due to the fact that 
map-elements ( and the vectorized function of two or more 
sequences ) take the result type from the first sequence. 
With careful programming, lots of attention to the order 
of arguments and more than a few typecases, you can probably 
write foolproof code. ( Maybe be redefining a typecased length,
and with some ugly coercions, you can avoid typecasing your
functions. ) 

However, after thinking and experimenting a bit more, I'm led
to the stronger assertion: that the incomplete implementation
of compound-data-objects is probably dangerous and more of a 
problem than a solution. ( Still: if it worked "right" it 
would be so useful that I hope there is some minimal set of
fixes that could rescue it! I'ld be even happier if someone
could show me that I'm missing some obvious solution that doesn't
require major surgery! )


---|  Steven D. Majewski   (804-982-0831)  <sdm7g@Virginia.EDU>  |---
---|  Computer Systems Engineer          University of Virginia  |---
---|  Department of Molecular Physiology and Biological Physics  |---
---|  Box 449 Health Science Center    Charlottesville,VA 22908  |---

