Path: utzoo!attcan!uunet!munnari.oz.au!cluster!andrewt From: andrewt@cs.su.oz (Andrew Taylor) Newsgroups: comp.lang.prolog Subject: Re: incrementing values Message-ID: <704@cluster.cs.su.oz> Date: 7 Feb 90 23:44:53 GMT References: <17467@megaron.cs.arizona.edu> <31462@shemp.CS.UCLA.EDU> <34699@iuvax.cs.indiana.edu> <17483@megaron.cs.arizona.edu> <7926@cognos.UUCP> Sender: news@cluster.cs.su.oz Reply-To: andrewt@cluster.cs.su.oz (Andrew Taylor) Organization: Basser Dept of Computer Science, University of Sydney, Australia Lines: 28 I've thought of writing of pre-processor to effectively allow a variable's scope to include more than one predicate. The user would declare a "scope" indicating the predicates involved, the entry point and the variables to be global to the scope. There would a notation for destructive assignment to a global variable which would be converted by the preprocessor to an assignment to a new version of the variable. Here's an example which writes helloworld. scope(main/0, [main/0, a/0, b/0], X). main :- X = hello, a, write(X). a :- b. b :- write(X), X <- world. /* The preprocessor would output */ main :- X0 = hello, a(X0, X), write(X). a(X0, X) :- b(X0, X). b(X0, X) :- write(X0), X = world. Lately I've been writing a lot code which be much easier to read and less tedious to write the above preprocessor was used. Has anyone done something like this already, or think its a bad idea? Andrew