From: skaller <skaller@maxtal.com.au>
To: Francisco Valverde Albacete <fva@tsc.uc3m.es>
Cc: Ohad Rodeh <orodeh@cs.cornell.edu>, caml-list@inria.fr
Subject: Re: Stdlib regularity
Date: Sat, 09 Oct 1999 00:56:26 +1000 [thread overview]
Message-ID: <37FE061A.7DA264A2@maxtal.com.au> (raw)
In-Reply-To: <37FC6572.719AD12D@tsc.uc3m.es>
Francisco Valverde Albacete wrote:
> But we never got into
> OCaml strictly for time-efficiency reasons, did we?
In my case, no, but it is still vital, otherwise
I'd use Haskell instead :-)
In particular, because procedural algorithms can be
implemented in ocaml just like in C++, the same complexity
_should_ be obtainable, and work on optimisation plus
standard library support should allow 'close' to
unit performance factors.
There are several cases where the core language prevents
this, because it lacks functionality available in C++: the ability
to create uninitialised values, and the ability to destroy them
are two that I've become aware of trying to build a variable length
array module. Both these features seem mandatory. Both are unsafe.
A reasonable compromise might be:
do not implement the features in the standard bytecode interpreter
do not allow these features in the compiler unless a special switch is
specified
Unfortunately, I do not think it is 'enough' to provide a variable
length array in the standard library, because that is only one
data structure which cannot be implemented efficiently or cleanly
without these features.
There is another more serious problem: ocaml doesn't
handle recursive types well. I'm not sure I fully understand this.
When all values are boxed, all recursion of algebraic types is sound.
[Proof: it is sound in C, where all non datum values are represented
by pointers; note that _initialising_ the structure may not be possible
in ocaml unless uninitialised values are permitted]
It is not clear to me if the result extends to modules.
However, the lack of recursion across module boundaries is also
pain. In trying to implement a variable length array, I found
that I needed to work around the inability to create an uninitialised
array by using a functor whose argument supplied the array value
type and special value of that type to initialise the array with.
Unfortunately, the type of the instantiated functor's
aggregate component was a variant of the type over which it
needed to be instantiated. So this solution cannot work.
To exhibit the problem more plainly, it is something like:
type t' = X | Y of G.t
where module G = V.Make(sig type t = t'; val default = X)
[In the actual code, the type of a python expression, 'expr', includes
a case Initial suitable for initialising an array, and a case
'V of expr varray', where varray is a variable length array of
expressions, this works as is, but I cannot make varray from a
functor that needs t = expr and default = Initial; even if
the recursion could work, there is no syntax for it]
--
John Skaller, mailto:skaller@maxtal.com.au
1/10 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
downloads: http://www.triode.net.au/~skaller
next prev parent reply other threads:[~1999-10-09 21:16 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-06 13:25 Ohad Rodeh
1999-10-06 16:18 ` Markus Mottl
1999-10-08 14:06 ` Matías Giovannini
1999-10-10 20:09 ` Pierre Weis
1999-10-10 20:12 ` Matías Giovannini
1999-10-08 14:10 ` skaller
1999-10-08 19:21 ` Markus Mottl
1999-10-09 21:14 ` Dave Mason
1999-10-06 18:50 ` John Prevost
1999-10-07 7:33 ` skaller
1999-10-07 9:18 ` Francisco Valverde Albacete
1999-10-08 14:56 ` skaller [this message]
1999-10-09 22:26 ` Francois Rouaix
1999-10-10 5:38 ` skaller
1999-10-10 20:44 ` William Chesters
1999-10-10 21:43 ` Hongwei Xi
1999-10-11 0:36 ` skaller
1999-10-12 7:20 ` David Mentr{'e}
1999-10-08 16:38 ` Proposal for study: Add a categorical Initial type to ocaml skaller
1999-10-09 22:43 ` John Prevost
1999-10-10 3:18 ` chet
1999-10-10 6:14 ` skaller
1999-10-10 21:05 ` William Chesters
1999-10-10 22:36 ` chet
1999-10-10 22:38 ` chet
1999-10-11 19:30 ` John Prevost
1999-10-12 8:34 ` Option types and O'Labl merger Jacques Garrigue
1999-10-12 14:38 ` William Chesters
1999-10-13 5:35 ` Frank A. Christoph
1999-10-13 8:48 ` Jacques Garrigue
1999-10-11 0:51 ` Proposal for study: Add a categorical Initial type to ocaml skaller
1999-10-11 12:40 ` John Prevost
1999-10-12 19:20 ` skaller
1999-10-12 11:33 ` Jean-Francois Monin
1999-10-10 16:10 ` chet
1999-10-09 16:58 Stdlib regularity William Chesters
1999-10-10 0:11 ` Matías Giovannini
1999-10-12 16:21 Damien Doligez
1999-10-13 12:18 ` Matías Giovannini
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=37FE061A.7DA264A2@maxtal.com.au \
--to=skaller@maxtal.com.au \
--cc=caml-list@inria.fr \
--cc=fva@tsc.uc3m.es \
--cc=orodeh@cs.cornell.edu \
/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