caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Miles Sabin <miles@milessabin.com>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: rich.neswold@gmail.com, caml-list@inria.fr
Subject: Re: [Caml-list] Preventing values from escaping a context
Date: Tue, 9 Feb 2010 08:24:22 +0000	[thread overview]
Message-ID: <30961e501002090024l18a9b458y8b3a7bd910626d38@mail.gmail.com> (raw)
In-Reply-To: <20100209.123813.39168535.garrigue@math.nagoya-u.ac.jp>

On Tue, Feb 9, 2010 at 3:38 AM, Jacques Garrigue
<garrigue@math.nagoya-u.ac.jp> wrote:
> From: Rich Neswold <rich.neswold@gmail.com>
>> My question is this: Is there a way to make the compiler reject a function
>> parameter from returning the context parameter? For instance, the identity
>> function should be disallowed since the context is invalid outside the scope
>> of 'usingContext'. It's true that a returned context would be unusable,
>> since its resources are gone, but it would be nice to prevent contexts from
>> escaping the 'usingContext' function entirely.
>
> The short answer is no.
> Types are not sufficient to prevent values from escaping.

I appreciate that mention of Scala is borderline off-topic on this
list, however that's a very broad negative statement, so broad
counterexamples seem appropriate ... ;-)

Philippe Haller of EPFL is working on a uniqueness types extension of
Scala which provides exactly this, packaged as a compiler plugin for
scalac (my hope is that it will be rolled into the main scala
distribution during the 2.8.x series, so this isn't solely academic
exercise).

An example here,

  http://tinyurl.com/ya6f7jv

and the corresponding compiler-time error,

  http://tinyurl.com/yzgnus5

Full details can be found in his technical report here,

  http://lamp.epfl.ch/~phaller/capabilities.html

Scala isn't the only language which supports linear/uniqueness types,
however it's the only which does and has some prospect of becoming
mainstream.

Cheers,


Miles

-- 
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin


  reply	other threads:[~2010-02-09  8:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09  3:07 Rich Neswold
2010-02-09  3:38 ` [Caml-list] " Jacques Garrigue
2010-02-09  8:24   ` Miles Sabin [this message]
2010-02-09  8:43     ` Jacques Garrigue
2010-02-09 17:18     ` Rich Neswold
2010-02-09  8:31   ` Tiphaine Turpin
2010-02-09 18:09     ` Rich Neswold
2010-02-09 18:45       ` Tiphaine Turpin
2010-02-10  0:39         ` Rich Neswold
2010-02-10  8:55           ` Goswin von Brederlow
2010-02-10 18:00             ` Rich Neswold
2010-02-10 21:37               ` Goswin von Brederlow
2010-02-09 17:13   ` Rich Neswold
2010-02-09  3:59 ` Yaron Minsky
2010-02-09 17:16   ` Rich Neswold
2010-02-11 10:39   ` Alexey Rodriguez
2010-02-11 11:05     ` rossberg
2010-02-11 13:52       ` Alexey Rodriguez
2010-02-11 15:17         ` rossberg

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=30961e501002090024l18a9b458y8b3a7bd910626d38@mail.gmail.com \
    --to=miles@milessabin.com \
    --cc=caml-list@inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    --cc=rich.neswold@gmail.com \
    /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).