🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1530

Re: Writing portable code.

#1530
From: Fergus James HENDERSON
Date: Thu, 01 Oct 1992 12:39
38 lines
2354 bytes
bevan@cs.man.ac.uk (Stephen J Bevan) writes:

>When all said and done, you prefer the separate language approach and
>I prefer the single language approach (preferably using partial
>evaluation).  I'm not out to convince anyone that the single language
>approach is best and am willing to be convinced by the other side of
>the argument, however I've yet to see a technical argument for it
>(i.e. something other than "I don't like ...").  Is there a technical
>argument of any sort or is this a purely subjective issue?

There *is* a technical argument for using a separate preprocessing language.
Often it is not just names (retractall vs. retract_all) that differ between
compilers, sometimes it is the very syntax of the language itself that varies.
In these cases you need the two-level approach so that you can prevent
the compiler from attempting to parse something that it cannot possibly
understand.

Fortunately for Prolog users, the syntax of Prolog is very simple and fairly
standardized. Most of the various language extensions are confined to
Prolog's ?- or :- directives, the Prolog equivalent to C's #pragma.
However even amoung these there are some cases when one might require
the two-level approach. For example:

#if nu_prolog
    ?- foo(X) when X.	% other systems may choke on this
    foo(X) :- foo1(X).
#else
    foo(X) :- (var(X) -> error('argument to foo is not bound') ; foo1(X)).
#endif

I'm sure there are many other such examples. Another that comes
to mind is type declarations.

-- 
Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
This .signature virus is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!
Technical Details
Message-ID: <9227522.29543@mulga.cs.mu.OZ.AU>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
References: <1a3srjINNsgm@darkstar.UCSC.EDU> <ALBERTO.92Sep28113506@karna.cs.umd.edu> <14758@goanna.cs.rmit.oz.au> <ALBERTO.92Sep29141859@karna.cs.umd.edu> <BEVAN.92Sep30090243@tiger.cs.man.ac.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.prolog
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: Writing portable code.
Message-ID: <9227522.29543@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU
Organization: Computer Science, University of Melbourne, Australia
References: <1a3srjINNsgm@darkstar.UCSC.EDU> <ALBERTO.92Sep28113506@karna.cs.umd.edu>  <14758@goanna.cs.rmit.oz.au> <ALBERTO.92Sep29141859@karna.cs.umd.edu> <BEVAN.92Sep30090243@tiger.cs.man.ac.uk>
Date: Thu, 1 Oct 1992 12:39:09 GMT
Lines: 38