<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/1e676f8fcefbaa708f890932f7547f19"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-10T16:54:10"
  subject="Re: [Caml-list] Question"
  prev="2003/12/0a730e95e9a98ca965d70ceb4206faf5"
  next="2003/12/644d57efdd9d2acc90b0e089df817412"
  prev-in-thread="2003/12/3f8a533bf7e11400eeb0d02ff50c1716"
  next-in-thread="2003/12/562803867fd4a377b41a8e3a465f43b7"
  prev-thread="2003/12/cf645abf5fbb4bfeb95e8a52ae1ca918"
  next-thread="2003/12/50bb73b39cc484fbbec77b6fee08aa8d"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Question">
<msg 
  url="2003/12/035f1d364ebb8d8bd82cfe75d186759a"
  from="sebastien FURIC &lt;sebastien.furic@t...&gt;"
  author="sebastien FURIC"
  date="2003-12-01T15:43:11"
  subject="[Caml-list] Question">
<msg 
  url="2003/12/e78561a3930717ed85eecf809e6dfd38"
  from="Remi Vanicat &lt;vanicat@l...&gt;"
  author="Remi Vanicat"
  date="2003-12-01T17:48:10"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/928ebdb82757524a715d3934786a2a64"
  from="sebastien FURIC &lt;sebastien.furic@t...&gt;"
  author="sebastien FURIC"
  date="2003-12-01T18:06:41"
  subject="Re: [Caml-list] Question">
</msg>
</msg>
<msg 
  url="2003/12/c9c38da4d98cb927dc5e77c8fe1605c9"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2003-12-03T14:01:41"
  subject="Re: [Caml-list] Question">
</msg>
<msg 
  url="2003/12/3f8a533bf7e11400eeb0d02ff50c1716"
  from="Pierre Weis &lt;pierre.weis@i...&gt;"
  author="Pierre Weis"
  date="2003-12-10T10:28:02"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/1e676f8fcefbaa708f890932f7547f19"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-10T16:54:10"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/562803867fd4a377b41a8e3a465f43b7"
  from="Luc Maranget &lt;luc.maranget@i...&gt;"
  author="Luc Maranget"
  date="2003-12-11T09:52:48"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/00762880f710a47d94d59f5f9e80641e"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-11T15:20:30"
  subject="Re: [Caml-list] Question">
<msg 
  url="2003/12/aecf296ada293906c355ef91f393e249"
  from="Luc Maranget &lt;luc.maranget@i...&gt;"
  author="Luc Maranget"
  date="2003-12-11T16:56:07"
  subject="Re: [Caml-list] Question">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
On Wed, 2003-12-10 at 21:27, Pierre Weis wrote:
&gt; [...]
&gt; &gt;  I was expecting "when" to be right distributive over "|". I find
&gt; &gt; OCaml's behaviour not very intuitive in such a situation.
&gt; [...]
&gt; 
&gt; The when construct introduces a guard to a pattern matching
&gt; clause. This means that a when construct is global to the entire
&gt; pattern of the clause it appears in; it means in particular that no
&gt; when construct can be nested into a pattern and the question of its
&gt; distributivity wrt any other construct is pointless.
&gt; 
&gt; &gt;  Is there a good reason for this?
&gt; 
&gt; Yes: simplicity, complexity invariants preservation for runtime
&gt; pattern analysis decisions even in the presence of when clauses,
&gt; easier understanding of the compiler warnings, simplicity and
&gt; well-definedness semantics (in particular the desired invariance wrt
&gt; the order of evaluation).

Whoa! Can you say that slower? Felix allows nested when clauses
in patterns (however it doesn't allow alternatives yet). 
The current implementation is unoptimised, 
I just evaluate the match of each pattern in turn until one matches.

One small difference .. the argument of a when clause is
an expression .. and felix expressions are purely functional
so there is no issue of order of evaluation changing anything.

So, what have I lost?


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

</contents>

</message>

