Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Leo White <leo@lpw25.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Subtyping (or something like it)
Date: Fri, 17 Nov 2017 11:32:42 -0500	[thread overview]
Message-ID: <1510936362.3494872.1176049824.44FB0912@webmail.messagingengine.com> (raw)
In-Reply-To: <CALLFq5RoG5Obhndk_G++Uc92qdweLGcfVGSih73WZ+auGjzeJQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

> Where the extension character is shift+number of bytes (at least on my
> keyboard...) I'm a bit worried that it'll start> looking like Perl, but time will tell.

Personally, I would go with something like:

  module B1 = struct
    let ( .%{ } ) = get_1byte_int
  end

  module B2 = struct
    let ( .%{ } ) = get_2byte_int
  end

  module B4 = struct
    let ( .%{ } ) = get_4byte_int
  end

  module B8 = struct
    let ( .%{ } ) = get_8byte_int
  end

Which gives you similar convenience:

  foo.B1.%{index}
  foo.B2.%{index}
  foo.B4.%{index}
  foo.B8.%{index}

without drifting into Perl territory.

Regards,

Leo

[-- Attachment #2: Type: text/html, Size: 1385 bytes --]

      reply	other threads:[~2017-11-17 16:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 21:46 Reed Wilson
2017-11-17  0:49 ` Yawar Amin
2017-11-17  2:05   ` Reed Wilson
2017-11-17 13:01 ` octachron
2017-11-17 16:13   ` Reed Wilson
2017-11-17 16:32     ` Leo White [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1510936362.3494872.1176049824.44FB0912@webmail.messagingengine.com \
    --to=leo@lpw25.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox