[m-dev.] syntax proposals

Peter Schachte schachte at cs.mu.OZ.AU
Wed Nov 7 11:59:51 AEDT 2001


On Wed, Nov 07, 2001 at 10:21:42AM +1100, Fergus Henderson wrote:
> > > 	fold(Op, L) = fold_2(L, 0)
> > > 		where [
> > > 			func fold_2(list(int), int) = int,
> > > 			% /* pragmas would also be allowed, e.g. */
> > > 			% pragma promise_pure(fold_2/2),
> > > 			% pragma inline(fold_2/2),
> > > 			% pragma memo(fold_2/2),
> > > 			fold_2([], S) = S,
> > > 			fold_2([X|Xs], S0) = fold_2(Xs, S0 `Op` X),
> > > 		].
> > > 
> > > Here the variable `Op' scopes over the definition of fold_2.
> > > 
> > > In general it might make sense to allow any kind of declaration at
> > > all inside the `where [ ... ]', including type declarations,
> > > type classes, etc.
> > 
> > Will the precedence of 'func' allow this without parentheses?
> 
> No, good point, the `func' declaration would need to be parenthesized.
> 
> > In any case, the precedence of :- certainly won't.
> 
> The proposal was that `:-' wouldn't be required in nested declarations,
> to be consistent with typeclass declarations.

No, I mean the :- in the predicate/function clauses.  *Everything* will have
to be parenthesized, except for functions that can be written without :- and
unit clauses.  That makes this proposal a lot less attractive, IMHO.
Particularly since nested modules almost do what you want now.


-- 
Peter Schachte              Free trade is the weapon of the strong,
schachte at cs.mu.OZ.AU        protectionism is the shield of the weak.
www.cs.mu.oz.au/~schachte/      -- William Kaiser 
Phone: +61 3 8344 9166      
--------------------------------------------------------------------------
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