caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "John Hughes" <jfh@cs.brown.edu>
To: "'Ocaml Mailing List'" <caml-list@inria.fr>
Subject: RE: [Caml-list] Unboxing options, was RE: assertions or exceptions?
Date: Thu, 15 Jul 2004 18:25:00 +0200	[thread overview]
Message-ID: <20040715162459.54A1310EF06@clark.cs.brown.edu> (raw)
In-Reply-To: <Pine.LNX.4.44.0407151015180.4202-100000@localhost.localdomain>

I'd like to suggest that this isn't really a problem. 
The key is the idea of "exception", which is that it's
an *exception* to what ordinarily happens. The same goes
for errors -- they should be exceptional. As such, making the
code associated with these things more efficient (as opposed
to more readable, maintainable, whatever else) should be WAAAY
down on your priority list. 

--John Hughes 

> -----Original Message-----
> From: owner-caml-list@pauillac.inria.fr 
> [mailto:owner-caml-list@pauillac.inria.fr] On Behalf Of Brian Hurt
> Sent: Thursday, July 15, 2004 5:38 PM
> To: Ocaml Mailing List
> Subject: [Caml-list] Unboxing options, was RE: assertions or 
> exceptions?
> 
> 
> One of the problems with returning error conditions instead 
> of throwing exceptions is the cost of boxing a 'a option.  
> I'd like to advocate for the idea of unboxing 'a options.
> 
> The idea works like this: None, rather than being represented 
> internally as an integer value, would instead be an invalid 
> pointer- either the NULL pointer or a pointer to a specially 
> allocated object in a memory space that is never collected.  
> But the key idea is that None is a value that can never be a 
> valid variable value.  Once that is the case, we don't need 
> to box Some 'a, we can unbox it.
> 
> I can see two disadvantages with this proposal.  The first is 
> that it breaks backwards compatibility.  Code compiled to 
> work the new way won't work with code compiled to work the 
> old way.  C code would have to be changed (although the 
> difference would be pretty easy to manage with some 
> preprocessor work).  The second problem is that Some(None) isn't
> representable- that'd just be None.
> 
> Thoughts?
> 
> --
> "Usenet is like a herd of performing elephants with diarrhea 
> -- massive, difficult to redirect, awe-inspiring, 
> entertaining, and a source of mind-boggling amounts of 
> excrement when you least expect it."
>                                 - Gene Spafford Brian
> 
> -------------------
> 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
> 

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


  reply	other threads:[~2004-07-15 16:25 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-15  8:03 [Caml-list] " Radu Grigore
2004-07-15 10:18 ` Richard Jones
2004-07-15 10:28   ` Daniel Andor
2004-07-15 12:49   ` Radu Grigore
2004-07-15 13:33     ` Richard Jones
2004-07-15 13:58       ` Radu Grigore
2004-07-16 18:53         ` Aleksey Nogin
2004-07-17  2:55           ` John Prevost
2004-07-17 14:24             ` David MENTRE
2004-07-15 12:35 ` Jon Harrop
2004-07-15 13:45   ` Radu Grigore
2004-07-15 14:33     ` Jon Harrop
2004-07-15 15:05       ` Radu Grigore
2004-07-15 16:24     ` skaller
2004-07-15 15:38 ` [Caml-list] Unboxing options, was " Brian Hurt
2004-07-15 16:25   ` John Hughes [this message]
2004-07-15 17:00     ` Brian Hurt
2004-07-15 17:20   ` John Prevost
2004-07-15 19:14     ` Radu Grigore
2004-07-15 19:56     ` John Carr
2004-07-15 20:48       ` Brian Hurt
2004-07-15 20:49         ` John Carr
2004-07-15 21:15           ` John Prevost
2004-07-15 21:15           ` Karl Zilles
2004-07-15 21:26           ` Brian Hurt
2004-07-15 21:04       ` John Prevost
2004-07-15 21:17     ` skaller
2004-07-15 21:35       ` Brian Hurt
2004-07-15 21:51         ` skaller
2004-07-15 21:42       ` skaller
2004-07-16  0:35     ` Jacques GARRIGUE
2004-07-16  1:03       ` John Prevost
2004-07-16  2:00         ` Jacques GARRIGUE
2004-07-16 16:40         ` Xavier Leroy
2004-07-19  8:58           ` Damien Doligez

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=20040715162459.54A1310EF06@clark.cs.brown.edu \
    --to=jfh@cs.brown.edu \
    --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;
as well as URLs for NNTP newsgroup(s).