caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Dave Berry" <Dave@kal.com>
To: "Miles Egan" <miles@caddr.com>, <caml-list@inria.fr>
Subject: RE: [Caml-list] a reckless proposal
Date: Wed, 25 Jul 2001 10:30:09 +0100	[thread overview]
Message-ID: <8E31D6933A2FE64F8AE3CC1381EEDCE70B2AEA@NT.kal.com> (raw)

> From: Miles Egan [mailto:miles@caddr.com]
> Sent: 24 July 2001 19:08
> 
> Records are confusing because they resemble C
> structs and are used in similar ways, but are really quite 
> different.  Objects are confusing because their use is mildly
> discouraged and because their functionality significantly
> overlaps that of the module system.
> 
> The most frustrating feature of records, of course, is that 
> each record field name must be globally unique.  Objects seem
> to provide more struct-like semantics, i.e. field names need
> only be unique within their class definition.

So perhaps Ocaml should adopt the approach used in Dylan and Moby,
where field names in class definitions have module scope.  Then
records and objects would have similar scoping rules, instead of
the current clash, and the distinction between modules and objects
would be clearer.

> For example, if object
> fields were directly accessible by default, one could use:
> 
> class point =
>   object
>     val x = 0
>     val y = 0
>   end
> 
> and access p.x and p.y directly, 

But if you then replace the field with an accessor method, you
have to edit all uses of that field.  It's a common recommendation
that OO languages should only access field by accessor methods (or
at least use the same syntax as accessor methods).  As you point
out, Ruby does it this way.  Dylan and Eiffel are other examples.

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


             reply	other threads:[~2001-07-25  9:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-25  9:30 Dave Berry [this message]
2001-07-26 15:35 ` Miles Egan
2001-07-30 12:21   ` Bruce Hoult
  -- strict thread matches above, loose matches on Subject: below --
2001-07-24 18:08 Miles Egan
2001-07-24 19:44 ` Brian Rogoff
2001-07-24 21:02   ` Miles Egan
2001-07-25 15:15     ` Brian Rogoff
2001-07-26 15:27       ` Miles Egan
2001-07-26 15:47         ` Brian Rogoff
2001-07-26 16:01           ` Miles Egan
2001-07-26 21:19   ` John Max Skaller
2001-07-24 20:26 ` Sven
2001-07-24 20:51   ` Miles Egan
2001-07-25  8:30 ` FabienFleutot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8E31D6933A2FE64F8AE3CC1381EEDCE70B2AEA@NT.kal.com \
    --to=dave@kal.com \
    --cc=caml-list@inria.fr \
    --cc=miles@caddr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).