[m-rev.] Version types for review

Ralph Becket rafe at cs.mu.OZ.AU
Fri Sep 3 16:22:29 AEST 2004


Julien Fischer, Friday,  3 September 2004:
> 
> extras for the moment - although it would be nice if they
> were in the standard library eventually.

Agreed.

> > Do things need to pass in Java, .NET and with
> > agc to go in the library?  If so, I can sort those details out.
> 
> You could just provided default Mercury clauses that throw an
> exception for .NET and Java - I suspect the problems the
> Java backend has with RTTI would probably stop versions structures
> working properly even if you did provide Java implementations.

Righto.

> I'm not sure about the agc here.

Over to you, Fergus!

> >     % version_array(Xs) returns an array constructed from the items in the list
> >     % Xs.
> >     %
> > :- func version_array(list(T)) = version_array(T).
> >
> I think for consistency with the rest of the standard library
> you should probably call this from_list or at least provide
> a synonym called from_list.

That's a bad convention, IMHO, and one that is not consistently applied.
Note that we have array.array(list(T)) = array(T) in array.m, so this is
consistent with what we have after all :-)

> >     % list(A) = Xs where Xs is the list of items in A
> >     % (i.e. A = version_array(Xs)).
> >     %
> > :- func list(version_array(T)) = list(T).
> >
> It would be more consistent with the standard library if this function
> were called to_list.

I really don't like the idea of prefixing "type casts" with `to_'.

> >     % foldl(F, A, X) is equivalent to list.foldl(F, list(A), Xs).
> >     %
> > :- func foldl(func(T1, T2) = T2, version_array(T1), T2) = T2.
> >
> >     % foldr(F, A, X) is equivalent to list.foldr(F, list(A), Xs).
> >     %
> > :- func foldr(func(T1, T2) = T2, version_array(T1), T2) = T2.
> 
> Some predicate versions of foldl, foldr plus foldl2, foldl3
> (the usual suspects) would be nice as well.

Righto.

> A comment describing the thread safety (or lack thereof) of the code
> in this section would be nice for future maintainers.

Righto.

> Our C coding guidelines suggest putting a space between for and the
> parentheses.  Likewise for while loops, if statements etc.

Yuck.  Okay, I'll do it that way.

> More later.

Ta!
-- Ralph
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list