Article View: comp.lang.prolog
Article #3028Re: Destructive predicates (random musings - part-I).
From: Saumya Debray
Date: Tue, 01 Mar 1988 15:16
Date: Tue, 01 Mar 1988 15:16
29 lines
1811 bytes
1811 bytes
lagache@violet.berkeley.edu (Edouard Lagache) writes:
> [ ... ] what would be wrong with having a "fully" destructive
> append that would be used only in the situations without reversibility
> and backtracking.
In general, it isn't enough to have directionality and determinism. You
have to make sure that the "old" value of the (sub)structure being
destructively assigned to isn't accessible from anywhere else. In other
words, it isn't enough to combine mode and determinacy analysis with
a simple live variable analysis to figure out when a structure can
be reused: sharing patterns between structures have to be looked at as
well. As an example, consider
p(X,Y,Z,W) :- W = [a|X], append(X,Y,Z).
where p/4 has the mode <ground, ground, free, free> -- then, given
the usual implementation of unification for the literal "W = [a|X]",
append/3 cannot use destructive assignment even though its use in
this context is directional and deterministic.
Maurice Bruynooghe has done some work on static analyses to detect
situations where destructive assignment can be introduced as a compiler
optimization, see his paper in SLP87.
--
Saumya Debray CS Department, University of Arizona, Tucson
internet: debray@arizona.edu
uucp: {allegra, cmcl2, ihnp4} !arizona!debray
Technical Details
Message-ID:
<4087@megaron.arizona.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!hao!noao!arizona!debrayReferences:
<7289@agate.BERKELEY.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!hao!noao!arizona!debray From: debray@arizona.edu (Saumya Debray) Newsgroups: comp.lang.prolog Subject: Re: Destructive predicates (random musings - part-I). Message-ID: <4087@megaron.arizona.edu> Date: 1 Mar 88 15:16:21 GMT References: <7289@agate.BERKELEY.EDU> Organization: U of Arizona CS Dept, Tucson Lines: 28 Keywords: Destructive predicates, LISP vs PROLOG Philosophy Summary: need to consider sharing between structures