On 04-04-2008, Jon Harrop <[EMAIL PROTECTED]> wrote: > >> >> 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.
I am not sure about that. Coming to mix different type are not that common. In fact, most of the time, i am really annoyed by the different type cast done by the compiler... I really do prefer to do typecast explicitely. At least half of the time i don't get the expected behavior and this is a huge source of bugs in C/C++ program. I like the way OCaml doesn't mix this. > >> > 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. > The technic i use is general. You can apply it to many other languages (C/C++...). For example you can switch big_num/int64/int with the same scheme. This is just a question of using what is best at a moment. Maybe it can be automatically deduced by compiler... But i think most of the time, it will end up with beginning to compute things with the biggest type (big_num). Regards, Sylvain Le Gall --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
