[m-rev.] field syntax (was: smart recompilation)

Peter Ross peter.ross at miscrit.be
Wed Jul 4 08:46:13 AEST 2001


On Wed, Jul 04, 2001 at 06:42:58AM +1000, Simon Taylor wrote:
> 
> On 03-Jul-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > On 03-Jul-2001, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > > The lack of distinction between fields and functions was deliberate.
> > > It's useful to be able to redefine a field as a pair of functions
> > > without changing any of the code that uses the field.
> > 
> > The proposal above preserves that property.  The advantage is that
> > it makes it obvious when a function is intended to be used as a field
> > accessor, and when a field accessor is used as a function.  It avoids
> > accidental overloading between field names and functions or constructors
> > that happen to have the same name.  If you want to refer to the field
> > accessor as a function (e.g. to pass to a higher-order function such as
> > `list__map'), you can still do so, you just have to use 'foo =' rather
> > than 'foo'.
> 
> I still don't see the point. Why is accidental overloading between
> field accessors and functions worse than accidental overloading between
> functions and constructors?
> 
For me it is important when defining a mapping between dotnet objects
and mercury type classes.

One could argue that dotnet properties are best represented by
field accessors.  This means that we have to know whether or not a function
represents a field accessor.  This is not possible with the current
naming scheme.

Of course it may turn out that it is better that we add an explicit
pragma to mark certain methods as properties.  The decision still hasn't
been made.

Pete
--------------------------------------------------------------------------
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