caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: dra-news@metastack.com
Cc: goswin-v-b@web.de, caml-list@inria.fr
Subject: Re: [Caml-list] pattern matching and records vs tuples
Date: Fri, 17 Apr 2009 09:26:28 +0900 (JST)	[thread overview]
Message-ID: <20090417.092628.161183757.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <000b01c9beb4$ac3d50a0$04b7f1e0$@com>

From: "David Allsopp" <dra-news@metastack.com>

> The other worry in the back of my mind is that despite having
> considerably more flexible records in SML (you don't have to declare
> the types in advance and label sharing is possible), a function in
> SML still has the restriction of only being over a fixed record
> type... and when SML has odd restrictions, they're usually to do with
> the more "obvious" type system feature being undecideable. For
> example, you can't say in SML:
> 
> fun get_x r = #x r;
> 
> as the equivalent of the OCaml get_x you propose.

You can do this with SML#

http://www.pllab.riec.tohoku.ac.jp/smlsharp/

 # fun f x = #name x;
 val f = fn : ['a, 'b#{name:'a}. 'b -> 'a]
 # f {name = "Joe", age = 21};
 val it = "Joe" : string

But the compiler is rather clever...

Jacques Garrigue


  reply	other threads:[~2009-04-17  0:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14 14:12 Yoann Padioleau
2009-04-14 16:00 ` [Caml-list] " Christophe TROESTLER
2009-04-14 16:40 ` Goswin von Brederlow
2009-04-14 16:58   ` Yoann Padioleau
2009-04-14 20:01     ` Christophe Raffalli
2009-04-15  0:44 ` Yaron Minsky
2009-04-15  1:46   ` Pal-Kristian Engstad
2009-04-15  2:37     ` Yaron Minsky
2009-04-15  2:40     ` Ashish Agarwal
2009-04-16 16:05     ` Goswin von Brederlow
2009-04-16 16:59       ` David Allsopp
2009-04-17  0:26         ` Jacques Garrigue [this message]
2009-04-17 21:12         ` Goswin von Brederlow
2009-04-15  7:41   ` blue storm
2009-04-15  9:30     ` Martin Jambon
2009-04-15 11:01       ` Yaron Minsky
2009-04-15 12:04         ` Martin Jambon

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=20090417.092628.161183757.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=dra-news@metastack.com \
    --cc=goswin-v-b@web.de \
    /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;
as well as URLs for NNTP newsgroup(s).