From: Brian Hurt <bhurt@spnz.org>
To: brogoff <brogoff@speakeasy.net>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: Ant: [Caml-list] The "Objective" part of Objective Caml
Date: Tue, 8 Nov 2005 16:04:42 -0600 (CST) [thread overview]
Message-ID: <Pine.LNX.4.63.0511081550440.32476@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.58.0511080953550.22345@shell3.speakeasy.net>
On Tue, 8 Nov 2005, brogoff wrote:
>> I think I'm with Skaller here- Objects in Ocaml are much less powerfull
>> than they are in (for example) Java or Python.
>
> They're not "much less powerful" than they are in Java. They certainly lack
> some features of the Java object system, but they posses many others. If
> "powerful" means "supports multiple inheritance", Java is far less powerful.
> If it means "supports" downcasting, ...
Also, the structural typing in Ocaml allows for some neat tricks that are
basically impossible in Java.
I suppose it depends upon what you mean by "powerful" more or less. I
meant it in terms of "widely usefull". Objects are usefull in Ocaml, but
you can write large and very complex programs without them. It's
impossible to even write "hello, world" in Java without objects.
> As far as static vs dynamic, dynamic type systems are inherently more
> capable. There is no "slack" in a dynamically typed language. But the
> possibility of a runtime exception is of course there.
Yes. For example, Ocaml will reject this code:
let f n =
if (n > 0) && (is_prime (2*n)) then
"bad idea"
else
false
;;
despite the fact that "bad idea" will never, ever be returned (given the
obvious definition of is_prime, anyways).
But if we restrict ourselves to the domain of correct programs, now I'm
not so sure. Well, maybe, in the extreme fringes, there are correct
programs which are being disallowed by the Ocaml type systems. I've only
been programming in Ocaml a couple of years now- I may just have not run
across them yet. But everything I've wanted to do in Ocaml I've been able
to do, working with the type system and not against it.
> The flip side of this is that OCaml is like Perl, with lots of ways to do
> things, and many overlapping features. The fact that OCaml has classes and
> modules is good, and that's how I think OO languages should be, but I would
> expect that protection and hiding be done only by modules and not objects.
To my knowledge, they are. How do you declare a private or protected
method for a class variable *without* using modules to do so?
Brian
next prev parent reply other threads:[~2005-11-08 22:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-04 22:45 Florian Weimer
2005-11-07 21:41 ` Ant: [Caml-list] " Martin Chabr
2005-11-07 21:55 ` Florian Weimer
2005-11-08 1:47 ` skaller
2005-11-08 2:15 ` Brian Hurt
2005-11-08 7:15 ` Daniel Bünzli
2005-11-08 15:02 ` Brian Hurt
2005-11-08 15:39 ` Alexander Fuchs
2005-11-08 15:42 ` Matt Gushee
2005-11-08 15:56 ` Michael Wohlwend
2005-11-08 18:16 ` brogoff
2005-11-08 22:04 ` Brian Hurt [this message]
2005-11-08 23:40 ` brogoff
2005-11-09 9:00 ` skaller
2005-11-11 15:28 ` Florian Weimer
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=Pine.LNX.4.63.0511081550440.32476@localhost.localdomain \
--to=bhurt@spnz.org \
--cc=brogoff@speakeasy.net \
--cc=caml-list@inria.fr \
/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