Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!uhog.mit.edu!bloom-beacon.mit.edu!gatech!howland.reston.ans.net!EU.net!Germany.EU.net!eso.org!Munich.Germany.EU.net!ecrc!news
From: micha@ecrc.de (Micha Meier)
Subject: Re: symbolic global constants (not)
Message-ID: <D7y004.97H@ecrc.de>
Sender: news@ecrc.de
Reply-To: micha@ecrc.de
Organization: European Computer-Industry Research Centre
References: <3nq7vp$ihl@goanna.cs.rmit.edu.au>
Date: Tue, 2 May 1995 08:38:28 GMT
Lines: 41

In article ihl@goanna.cs.rmit.edu.au, ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) writes:
> stevew@debretts.comp.vuw.ac.nz (Stephen Wray) writes:
> >I've been wondering why prolog dosn't support symbolic global constants.
> 
> >It would be nice if at every place in my code, instead of the magick
> >number, I could use foo.
> 
> It would be horrible for anyone trying to mention the _name_ foo.
> The thing about Prolog terms is that what you see is exactly what you get.
> There are no exceptions.
> 
> >As it is, I (appear to) need to say
> >foo(1056).
> 
> >at the top-ish of my code, then to say
> 
> >foo(FOO),
> 
> >at appropriate places in my code.
> 
> That's right.  Why is this a problem for you?

I'm afraid this is not a good justification. One could as well say
"you cannot use a predicate foo(X) to define your global constant because that may
be confused with a *real* predicate foo/1". I don't see any problems at all
with having macro expansion in Prolog and indeed, many systems do have
expand_term/2. So it is not precisely true that WYSIWYG holds for Prolog.
In case this macro expansion is local to a module, the possibility of misunderstanding
is limited to the 'normal' level (IMHO).


--Micha


---
Micha Meier			------------------------------------------------
ECRC, Arabellastr. 17		The opinions expressed above are private
D-81925 Munich 81		and may not reflect those of my employer.
micha@ecrc.de, Tel. +49-89-92699-108, Fax  +49-89-92699-170


