From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 07BA2BC69 for ; Sat, 5 Jan 2008 20:41:03 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq4HAGVsf0dDWxLC/2dsb2JhbACBV6gR X-IronPort-AV: E=Sophos;i="4.24,249,1196636400"; d="scan'208";a="7468828" Received: from ip67-91-18-194.z18-91-67.customer.algx.net (HELO server1.bertec.net) ([67.91.18.194]) by mail3-smtp-sop.national.inria.fr with ESMTP; 05 Jan 2008 20:41:02 +0100 Received: from kuba.bertec.net (kuba.bertec.net [192.168.2.16]) by server1.bertec.net (Postfix) with ESMTP id B0DB2105831 for ; Sat, 5 Jan 2008 14:41:01 -0500 (EST) From: Kuba Ober 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 User-Agent: KMail/1.9.6 (enterprise 0.20071123.740460) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801051441.00892.ober.14@osu.edu> X-Spam: no; 0.00; syntax:01 non-uniform:01 ocaml:01 syntax:01 non-uniform:01 pointers:01 ocaml:01 compiler:01 cleanest:98 polymorphic:01 polymorphic:01 rec:01 syntactic:01 tuple:02 data:02 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