Loading ...
Sorry, an error occurred while loading the content.
 

Re: "ocaml_beginners"::[] big data as argumnts -> is this a performance lack?

Expand Messages
  • Jon Harrop
    ... Exactly. This confused me when I first came to OCaml from C++ because I was used to having to work out which structs to pass by value and which to pass by
    Message 1 of 9 , May 31, 2005
      On Wednesday 01 June 2005 01:04, Oliver Bandel wrote:
      > So even if it looks "slow", when "thinking in C", because there are no
      > pointers... ...that does not mean that it is slow...

      Exactly. This confused me when I first came to OCaml from C++ because I was
      used to having to work out which structs to pass by value and which to pass
      by reference.

      The key concept here is called "referential transparency". Essentially,
      immutable data doesn't need to be copied - it can just be referred back to.
      So OCaml takes the approach of doing everything by referencing (pointers)
      data rather than copying it. This allows ocamlopt to compile functional
      programs into efficient machine code.

      So this is just one less thing to worry about when converting from C/C++ to
      OCaml.

      --
      Dr Jon D Harrop, Flying Frog Consultancy Ltd.
      Objective CAML for Scientists
      http://www.ffconsultancy.com/products/ocaml_for_scientists
    Your message has been successfully submitted and would be delivered to recipients shortly.