From: james woodyatt <jhw@wetware.com>
To: tim@fungible.com (Tim Freeman)
Cc: alex@baretta.com, caml-list@inria.fr
Subject: Re: [Caml-list] Allow declaring classes "final" so self type has no type variables?
Date: Tue, 10 Sep 2002 22:09:33 -0700 [thread overview]
Message-ID: <A8B216CF-C544-11D6-B249-000393BA7EBA@wetware.com> (raw)
In-Reply-To: <20020911002531.088C57F4F@lobus.fungible.com>
On Tuesday, Sep 10, 2002, at 17:16 US/Pacific, Tim Freeman wrote:
>
> Well, I actually wanted the class to be final so its "self" didn't
> have to be polymorphic while it was being defined.
Well that's problematic, of course. The reason class types are harder
to use than record types is basically the same reason that polymorphic
variant types are harder to use than regular variant types.
Perhaps someone with deeper knowledge of the issue will comment on
whether and how it would cause problems if the self type in a class
body could be unified with a closed object type.
> It's harder to get the types to work out when some of the type
> variables running around are useless.
I have a technique for avoiding this kind of trouble. Don't use class
types where record types and/or functors are sufficient. Keep class
types simple, and use signatures to hide internals. When subtyping
without method inheritance is all you need, consider using functions
and abstract types with polymorphic variants as phantom type parameters.
There's a lot you can do with Caml without using the 'object' keyword.
Use classes only when all other language facilities are insufficient.
> No big deal, though.
Okay. Hope I've been helpful anyway.
--
j h woodyatt <jhw@wetware.com>
markets are only free to the people who own them.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
prev parent reply other threads:[~2002-09-11 5:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-06 19:12 Tim Freeman
2002-09-06 20:18 ` james woodyatt
2002-09-06 20:38 ` Alessandro Baretta
2002-09-06 21:15 ` james woodyatt
2002-09-11 0:16 ` Tim Freeman
2002-09-11 5:09 ` james woodyatt [this message]
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=A8B216CF-C544-11D6-B249-000393BA7EBA@wetware.com \
--to=jhw@wetware.com \
--cc=alex@baretta.com \
--cc=caml-list@inria.fr \
--cc=tim@fungible.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