On Friday 04 April 2008 14:17:28 daniel.c.buenzli wrote:
> On 4 avr, 11:50, Jon Harrop <[EMAIL PROTECTED]> wrote:
> > Alas, that is impossible with OCaml's current design because it can't do
> > monomorphization. All the OCaml compiler ever sees is a completely
> > polymorphic:
> >
> >   a = b
> >
> > and it has no idea that this will later be erroneously applied to an
> > abstract type as well as its correct applications to other types.
>
> You cannot issue such a warning if you are using List.mem with an
> abstract datatype. However I think
> it can be done if the application of = is made on an abstract datatype
> in a monomorphic context (witness the specialisation done by ocaml for
> the comparison of ints).

Yes. However, that is not likely to catch many bugs.

> > What is "the bt"?
>
> The bugtracker.

This is a fundamental design flaw in OCaml that will almost certainly never be 
fixed.

> > Brevity also reduces the cognitive load. If you look at the OCaml
> > equivalent of "set [1 .. 1000]" it is clearly entirely superfluous piffle
> > that does nothing whatsoever to help the reader understand what is going
> > on. Indeed, it is *more* likely to be buggy.
>
> A little bit of it of course, too much of it no. A balancing act.
>
> > A triumph of hope over reality, I am afraid. Numeric types are often used
> > in conjuction, such as scalars, vectors and matrices.
>
> Note you are talking about something different. I was talking about
> using different scalar types in the same context.

Even for scalars it is common to mix different numeric types: int8, int, int64 
etc.

> > The thread on the caml-list even detailed a complete example that does
> > exactly this for int and int64 in an attempt to overcome some of OCaml's
> > other problems.
>
> No in that thread he said he needs to use int64 he then wants
> operators for each the types but he doesn't say he wants to mix them.

In a different thread, Sylvain wrote a pair of mutually recursive functions 
that mix int and int64 types. Indeed, it is difficult not to when so many of 
the functions in Int64 use other scalar types.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html
-~----------~----~----~----~------~----~------~--~---

Reply via email to