Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Kuba Ober <ober.14@osu.edu>
To: caml-list@yquem.inria.fr
Subject: Syntax ideas for non-uniform memory (near/far etc)
Date: Sat, 5 Jan 2008 14:41:00 -0500	[thread overview]
Message-ID: <200801051441.00892.ober.14@osu.edu> (raw)

I'm trying to adapt Ocaml syntax to embedded uses. There, memory is often
non-uniform and variables can live in different areas, say near/far/rom.

I was wondering what would be the "cleanest" syntax for that. I presume that
adding near/far/rom as keywords and using them similarly to "rec" would work,
e.g.

let print rom s = ... (* prints a string with a rom address *)

The truth is that "rom/near/far" is really part of the type, as if a function 
has a parameter living say in rom
then it won't take one in ram. So maybe one could have

let print (s : rom) = ....
of type string -> unit

For those unfamiliar with embedded work, think 16-bit x86 with near/far 
pointers and whatnot.

I'm all ears for other ideas as to how it might be implemented. Any syntactic 
sugar to make it cleaner looking?

I presume that an extension of this idea is to have multi-faceted types, where 
each type is really a tuple of "types", such that some could be polymorphic 
and some not.

Say one wants to have a function which will work on data put anywhere:

let print (s : 'c, string) = ....

where 'c is the "storage class", here polymorphic, and string is the good old 
type.

Of course none of this would use *the* OCaml compiler, I'm trying to write (or 
port, rather) my own.

Kuba


             reply	other threads:[~2008-01-05 19:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-05 19:41 Kuba Ober [this message]
2008-01-05 20:18 ` [Caml-list] " Richard Jones

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=200801051441.00892.ober.14@osu.edu \
    --to=ober.14@osu.edu \
    --cc=caml-list@yquem.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