From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 74937BCAE for ; Mon, 27 Jun 2005 00:44:40 +0200 (CEST) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id j5QMieLN008913 for ; Mon, 27 Jun 2005 00:44:40 +0200 Received: (qmail invoked by alias); 26 Jun 2005 22:44:39 -0000 Received: from p54A32FCA.dip0.t-ipconnect.de (EHLO [192.168.2.136]) [84.163.47.202] by mail.gmx.net (mp021) with SMTP; 27 Jun 2005 00:44:39 +0200 X-Authenticated: #20477425 From: Michael Wohlwend To: caml-list@yquem.inria.fr, james woodyatt Subject: Re: [Caml-list] state pattern... Date: Mon, 27 Jun 2005 00:45:05 +0200 User-Agent: KMail/1.8 References: <200506262157.02201.micha-1@fantasymail.de> <3fce1487ee8fd9f28edbe70276980346@wetware.com> In-Reply-To: <3fce1487ee8fd9f28edbe70276980346@wetware.com> X-Face: S)[vu%Bha1d&ej9GfwAq~7C}A,y[B.uS}+D6'hb~xPwsxymw$fnCOaMe<=?utf-8?q?*bnUajSBR=5Fm=3FR=0A=09?=@V3;iX8[A}z`.%pEQ1r7iZhN8#ktTCBQ}&mkx>=RH&l|l6\]NZI@ MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506270045.05724.micha-1@fantasymail.de> X-Y-GMX-Trusted: 0 X-Miltered: at nez-perce with ID 42BF2FD8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 woodyatt:01 ...:98 ...:98 wrote:01 imperative:01 tend:02 parameter:02 functional:02 limitations:02 pattern:03 pattern:03 context:04 context:04 applied:04 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Monday 27 June 2005 00:13, james woodyatt wrote: > I tend to work in the functional style first, then transfer what I've > done into imperative style if there is a performance gain to be had by > it. Here's what I would do to make something like what you want: really very helpful, your code snippet. > > You get into a problem pretty quickly if the state class needs to be > aware of the full type of the context in order to compute the next > state. What that really means is that the context *is* the state, and > you need to rethink how the pattern is supposed to be applied to your > design. that's why in my code the function which does the work of the state and sets the new one gets the context as a parameter, but I didn't get this right. I know that the pattern has it's limitations... thanks Michael