Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Syntax ideas for non-uniform memory (near/far etc)
@ 2008-01-05 19:41 Kuba Ober
  2008-01-05 20:18 ` [Caml-list] " Richard Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Kuba Ober @ 2008-01-05 19:41 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-05 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-05 19:41 Syntax ideas for non-uniform memory (near/far etc) Kuba Ober
2008-01-05 20:18 ` [Caml-list] " Richard Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox