[m-dev.] Re: Visual vs total arity clash example [fwd]

Peter Schachte schachte at cs.mu.OZ.AU
Thu Jan 27 12:13:25 AEDT 2000


On Wed, Jan 26, 2000 at 03:46:29PM +1100, Fergus Henderson wrote:
> > I would argue that (unlike DCGs) there's no reason to allow users to
> > write EDCG clauses fully expanded.
> 
> I pretty much agree -- the only reason to support this is for
> backwards compatibility.

I assume you're talking about writing EDCG code that calls code
written to be called from DCGs (whether it was coded using actual DCG
notation or not)?  Eg,

	% existing code:
	:- pred p(int, io__state, io__state).
	:- mode p(in, di, uo) is det.

	p(X) --> ....


	% new code:
	:- pred q(int) +hidden(changed(io), changed(accum)).
	:- mode q(in) ... whatever ... is det.

	q(X) -->>
		...,
		p(X),
		....

In this case, you can tell which thingy to pass as the two extra
arguments in the call to p by type (I'm assuming accum is an int).
But in other cases the types won't distinguish them.  At best, you can
only have partial compatibility.

BTW, I can't see how this is a backward compatibility issue.  All old
code will continue to work whichever way you do it.  It's a question
of new code or old code modified to use EDCG syntax.

> It would IMHO be fine in the long run, to break code using the fully
> expanded form, so long as we do it gradually, i.e. first deprecating
> the feature, and only removing it a few years later.

It will be a *lot* easier to do this if you don't document the
translation mechanism in the Mercury documentation, and just use your
knowledge of the translation process in your code.  But you will have
to document that it is a current implementation restriction that
having two predicates with the same name and different arities in the
same module may or may not work if either or both of them have hidden
arguments, and that this is a flaw that we hope to fix later.


-- 
Peter Schachte                     When choosing between two evils, I always
mailto:schachte at cs.mu.OZ.AU        like to try the one I've never tried
http://www.cs.mu.oz.au/~schachte/  before.
PGP: finger schachte at 128.250.37.3      -- Mae West 
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list