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

dot in OCaml syntax in Dynamic types

Expand Messages
  • Sergei Steshenko
    Hello All, since I came to OCaml through Perl, I first of all want to have in OCaml what I enjoy in Perl, namely, hierarchical data structures. But, of course,
    Message 1 of 3 , Feb 6, 2013
    • 0 Attachment
      Hello All,

      since I came to OCaml through Perl, I first of all want to have in OCaml what I enjoy in Perl, namely, hierarchical data structures.

      But, of course, Perl is not strictly typed while OCaml is.

      Trying to reinvent the wheel I came across "Dynamaic types" - http://www.lexifi.com/blog/dynamic-types . I think it's a really good beginning for what I want to achieve.

      In the web page I see the following pieces of code:

      let rec variantize: type t. t ty -> t -> variant =
      let rec devariantize: type t. t ty -> variant -> t =
      let rec variantize: type t. t ty -> t -> variant =

      .

      Pay attention there is dot after 't' in the lines of code above


      I am myself a RTFM saying person, so, do I guess correctly that I need to read chapters on OCaml OO in order to understand what the dot is ? Or it's something more basic ?

      So, anyway, I'd like to be pointed to the appropriate web pages and I'll go from there.

      Thanks,
        Sergei.
    • Esther Baruk
      Hi, It indicates that the function is polymorphic. It means : for all type t, the variantize function takes a value of type t ty and a value of type t and
      Message 2 of 3 , Feb 6, 2013
      • 0 Attachment
        Hi,

        It indicates that the function is polymorphic. It means : "for all type t,
        the variantize function takes a value of type t ty and a value of type t
        and returns a value of type variant."
        It is explained here, as a recent language extension:
        http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#htoc107
        In section 7.13 just below, there is the explanation of the "type t"
        construct.


        Esther Baruk


        On Wed, Feb 6, 2013 at 6:39 PM, Sergei Steshenko <sergstesh@...>wrote:

        > **
        >
        >
        >
        >
        > Hello All,
        >
        > since I came to OCaml through Perl, I first of all want to have in OCaml
        > what I enjoy in Perl, namely, hierarchical data structures.
        >
        > But, of course, Perl is not strictly typed while OCaml is.
        >
        > Trying to reinvent the wheel I came across "Dynamaic types" -
        > http://www.lexifi.com/blog/dynamic-types . I think it's a really good
        > beginning for what I want to achieve.
        >
        > In the web page I see the following pieces of code:
        >
        > let rec variantize: type t. t ty -> t -> variant =
        > let rec devariantize: type t. t ty -> variant -> t =
        > let rec variantize: type t. t ty -> t -> variant =
        >
        > .
        >
        > Pay attention there is dot after 't' in the lines of code above
        >
        > I am myself a RTFM saying person, so, do I guess correctly that I need to
        > read chapters on OCaml OO in order to understand what the dot is ? Or it's
        > something more basic ?
        >
        > So, anyway, I'd like to be pointed to the appropriate web pages and I'll
        > go from there.
        >
        > Thanks,
        > Sergei.
        >
        >
        >


        [Non-text portions of this message have been removed]
      • Sergei Steshenko
        Thanks.
        Message 3 of 3 , Feb 6, 2013
        • 0 Attachment
          Thanks.



          ----- Original Message -----
          > From: Esther Baruk <esther.baruk@...>
          > To: ocaml_beginners@yahoogroups.com
          > Cc:
          > Sent: Wednesday, February 6, 2013 8:13 PM
          > Subject: Re: "ocaml_beginners"::[] dot in OCaml syntax in Dynamic types
          >
          > Hi,
          >
          > It indicates that the function is polymorphic. It means : "for all type t,
          > the variantize function takes a value of type t ty and a value of type t
          > and returns a value of type variant."
          > It is explained here, as a recent language extension:
          > http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#htoc107
          > In section 7.13 just below, there is the explanation of the "type t"
          > construct.
          >
          >
          > Esther Baruk
          >
          >
          > On Wed, Feb 6, 2013 at 6:39 PM, Sergei Steshenko
          > <sergstesh@...>wrote:
          >
          >> **
          >>
          >>
          >>
          >>
          >> Hello All,
          >>
          >> since I came to OCaml through Perl, I first of all want to have in OCaml
          >> what I enjoy in Perl, namely, hierarchical data structures.
          >>
          >> But, of course, Perl is not strictly typed while OCaml is.
          >>
          >> Trying to reinvent the wheel I came across "Dynamaic types" -
          >> http://www.lexifi.com/blog/dynamic-types . I think it's a really good
          >> beginning for what I want to achieve.
          >>
          >> In the web page I see the following pieces of code:
          >>
          >> let rec variantize: type t. t ty -> t -> variant =
          >> let rec devariantize: type t. t ty -> variant -> t =
          >> let rec variantize: type t. t ty -> t -> variant =
          >>
          >> .
          >>
          >> Pay attention there is dot after 't' in the lines of code above
          >>
          >> I am myself a RTFM saying person, so, do I guess correctly that I need to
          >> read chapters on OCaml OO in order to understand what the dot is ? Or
          > it's
          >> something more basic ?
          >>
          >> So, anyway, I'd like to be pointed to the appropriate web pages and
          > I'll
          >> go from there.
          >>
          >> Thanks,
          >>   Sergei.
          >>
          >>  
          >>
          >
          >
          > [Non-text portions of this message have been removed]
          >
          >
          >
          > ------------------------------------
          >
          > Archives up to December 31, 2011 are also downloadable at
          > http://www.connettivo.net/cntprojects/ocaml_beginners
          > The archives of the very official ocaml list (the seniors' one) can be found
          > at http://caml.inria.fr
          > Attachments are banned and you're asked to be polite, avoid flames
          > etc.Yahoo! Groups Links
          >
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.