From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 56443BB84 for ; Wed, 10 May 2006 04:42:33 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k4A2gWGu032158 for ; Wed, 10 May 2006 04:42:32 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA08340 for ; Wed, 10 May 2006 04:42:32 +0200 (MET DST) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k4A2gVcZ032154 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 10 May 2006 04:42:31 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Fdeed-0005TI-BS for caml-list@inria.fr; Wed, 10 May 2006 04:42:23 +0200 Received: from cpe-68-174-95-226.ucwphilly.res.rr.com ([68.174.95.226]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 May 2006 04:42:23 +0200 Received: from geoffw by cpe-68-174-95-226.ucwphilly.res.rr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 May 2006 04:42:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Geoffrey Alan Washburn Subject: Re: OO design Date: Tue, 09 May 2006 22:41:15 -0400 Message-ID: <446152CB.5010605@cis.upenn.edu> References: <53c655920605050235k64e70333je8df813239ea3c53@mail.gmail.com> <20060508.121743.65190532.garrigue@math.nagoya-u.ac.jp> <200605082329.36911.David.Teller@ens-lyon.org> <445FB9C7.4040703@cs.washington.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org Cc: caml-list@yquem.inria.fr X-Gmane-NNTP-Posting-Host: cpe-68-174-95-226.ucwphilly.res.rr.com User-Agent: Thunderbird 1.5.0.2 (X11/20060420) In-Reply-To: <445FB9C7.4040703@cs.washington.edu> Sender: news X-Miltered: at concorde with ID 44615318.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 44615317.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; upenn:01 monadic:01 ocaml:01 runtime:01 wrote:01 idiom:01 alan:01 purely:02 functional:02 types:02 types:02 seems:03 seems:03 programming:03 uses:06 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Dan Grossman wrote: > Phantom types are a programming idiom that can often pull off this sort > of thing. Maybe I'm just not smart enough, but I can't seem to think of a way to do this in an effectful language without getting bitten by aliasing. In a purely functional setting, a monadic approach seems plausible, but if you can create a "ref" anywhere, as in OCaml, it seems straightforward to subvert any uses of phantom types for implementing protocols. I suppose one could look at it from the angle that phantom types make it harder for cooperative users to make mistakes, but I can't see how they can prevent the need for runtime checks.