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

Re: [Caml-list] static class member....

Expand Messages
  • james woodyatt
    [please reply to ocaml_beginners@yahoogroups.com] On Wednesday, Aug 6, 2003, at 09:12 US/Pacific, on the main Ocaml ... I would strongly second this advice.
    Message 1 of 2 , Aug 6, 2003
    • 0 Attachment
      [please reply to ocaml_beginners@yahoogroups.com]

      On Wednesday, Aug 6, 2003, at 09:12 US/Pacific, on the main Ocaml
      mailing list, brogoff@... wrote:
      >
      > As a side advice to the OP, it would be worthwhile to avoid the OOP
      > and just
      > get used to the ML part of Caml first.

      I would strongly second this advice. When I came to Ocaml from C++, I
      did not heed this advice-- and I wasted a lot of time learning why that
      was a mistake.

      In fact, the first piece of advice I would pass along to Java/C++
      programmers who are new to Ocaml is this:

      + Don't use classes unless functors and module inclusion fail to
      satisfy your requirements.

      There are many fine ways to obtain the kinds of relationships in the
      Ocaml type system that C++ and Java both only use classes to offer. In
      Ocaml, the object class and class type semantic is only one of the ways
      to skin a particular kind of cat. It's not, in fact, the most
      straightforward one either. Until you understand the tradeoffs for
      choosing it, I recommend avoiding it. You can do *almost* everything
      with 'functor' and 'include' and/or phantom polymorphic variant type
      parameters on abstract types with parameter variance annotations.

      That said, the class and class type semantic is an indispensable aspect
      of the language, from my point of view. It's just not very easy
      explaining why I say that to a newbie.


      --
      j h woodyatt <jhw@...>
      that's my village calling... no doubt, they want their idiot back.
    • Richard Jones
      ... Can you explain what this means with examples? Rich. -- Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj Merjis Ltd.
      Message 2 of 2 , Aug 7, 2003
      • 0 Attachment
        On Wed, Aug 06, 2003 at 10:20:44PM -0700, james woodyatt wrote:
        > [please reply to ocaml_beginners@yahoogroups.com]
        > There are many fine ways to obtain the kinds of relationships in the
        > Ocaml type system that C++ and Java both only use classes to offer. In
        > Ocaml, the object class and class type semantic is only one of the ways
        > to skin a particular kind of cat. It's not, in fact, the most
        > straightforward one either. Until you understand the tradeoffs for
        > choosing it, I recommend avoiding it. You can do *almost* everything
        > with 'functor' and 'include' and/or phantom polymorphic variant type
        > parameters on abstract types with parameter variance annotations.

        Can you explain what this means with examples?

        Rich.

        --
        Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
        Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you.
        'There is a joke about American engineers and French engineers. The
        American team brings a prototype to the French team. The French team's
        response is: "Well, it works fine in practice; but how will it hold up
        in theory?"'
      Your message has been successfully submitted and would be delivered to recipients shortly.