caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Diego Olivier FERNANDEZ PONS <diego.fernandez_pons@etu.upmc.fr>
To: "Stéphane Glondu" <steph@glondu.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Type inference inside exceptions ?
Date: Fri, 13 Oct 2006 14:23:17 +0200	[thread overview]
Message-ID: <20061013142317.z70cu8q30g40gckc@webmail.etu.upmc.fr> (raw)
In-Reply-To: <452D753E.1020607@glondu.net>

     Bonjour,

Quoting Stéphane Glondu <steph@glondu.net>:
> I don't really understand what you are doing: why do you generate a list
> of continuations instead of a single one?

Reordering the continuations to continue the computation in an other  
branch than the deepest try ... fail is a classical technique in  
combinatorial optimization. The way you order your continuations  
defines a "node ordering strategy", most usual being :
- stack -> depth first search
- queue -> limited discrepancy search
- priority queue -> best first search

> Don't you want a kind of lazy list?

I first wrote a code that solves the problem completely.
Then I modified the code to handle continuations of the form (unit ->  
somthing)
Then I replaced (unit -> something) with a lazy list
Finally I kept the list of continuations but send it back by function  
return instead of an exception [And type inference DOES work in that  
case !]

I am "complaining" because the compile DOES infer types within  
exceptions but does not allow you to let him fix the type the way he  
needs. It only says "It is not what I was expecting, so your function  
won't compile, sorry".

As far as I understand the reason is to avoid polymorphic exceptions  
but this could have been done just forbidding the final result to be  
polymorphic or typechecking and not compiling, or giving me a way to  
just typecheck without creating the value.

> Does this code really do what you expect?

Reasonably

>> lets try ...
>
> Is this the end of your mail?

Unless you want a complete log of everything I tried when developping  
that code...

         Diego Olivier


  reply	other threads:[~2006-10-13 12:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-06 18:16 Diego Olivier FERNANDEZ PONS
2006-10-06 20:20 ` [Caml-list] " ketty .
2006-10-10 10:28   ` Diego Olivier FERNANDEZ PONS
2006-10-11 22:50 ` Stéphane Glondu
2006-10-13 12:23   ` Diego Olivier FERNANDEZ PONS [this message]
2006-10-13 12:42     ` Pietro Abate
2006-10-14 19:56       ` Reordering continuations (was :Type inference inside exceptions ?) Diego Olivier FERNANDEZ PONS
2006-10-16  9:25         ` [Caml-list] " Diego Olivier FERNANDEZ PONS
2006-10-17 12:33           ` Diego Olivier FERNANDEZ PONS
2006-10-19  7:32             ` Looking for references to usage of ocaml in data mining, knowleadge discovery, etc  Dr. Axel Poigné 
2006-10-19 14:06               ` [Caml-list] " Markus Mottl

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=20061013142317.z70cu8q30g40gckc@webmail.etu.upmc.fr \
    --to=diego.fernandez_pons@etu.upmc.fr \
    --cc=caml-list@inria.fr \
    --cc=steph@glondu.net \
    /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).