Return-Path: Delivered-To: apmail-incubator-esme-dev-archive@minotaur.apache.org Received: (qmail 43871 invoked from network); 28 Nov 2009 15:40:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Nov 2009 15:40:01 -0000 Received: (qmail 97014 invoked by uid 500); 28 Nov 2009 15:40:01 -0000 Delivered-To: apmail-incubator-esme-dev-archive@incubator.apache.org Received: (qmail 96963 invoked by uid 500); 28 Nov 2009 15:40:01 -0000 Mailing-List: contact esme-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: esme-dev@incubator.apache.org Delivered-To: mailing list esme-dev@incubator.apache.org Received: (qmail 96952 invoked by uid 99); 28 Nov 2009 15:40:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Nov 2009 15:40:01 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of hirsch.dick@gmail.com designates 209.85.220.216 as permitted sender) Received: from [209.85.220.216] (HELO mail-fx0-f216.google.com) (209.85.220.216) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Nov 2009 15:39:58 +0000 Received: by fxm8 with SMTP id 8so2035153fxm.27 for ; Sat, 28 Nov 2009 07:39:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=hSMD9oDrkG9QKNxbfrr6c9l7euZF/VJdgeXBkXsv7ms=; b=vsnDTYRGOuuQQ3ZYZJem2j/9Q+VPlNfkHeP/P/slyOMyALnm0vN9+vnmn9EYnjqJsQ RJu3cfGMqyui6aVbe5ZWOWYJgvRKuHrdhWg0ggQ+vWnIrJP1TONCki9ScEgM4Sc0/sAl zOtK8lG2WvYLAGe4bsre5IE3f8gw7q7o7JbpA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=bmB1pOV4zOleqRVE6TUG/Ozwx6Uymv4Rn2BdPzdc3YD8FLwzl0iJTOtIX4oiCpSreh sePKO6ix34R7a9GaIuFBAmAsSWsY2+VxR0+eF0TCgGut/t/AV8c1kaZ/ijkh8oDuDeel 3PUOy3ZQrYJ5YTMe5tFMMIhcFF+lgxkX30dkA= MIME-Version: 1.0 Received: by 10.103.122.22 with SMTP id z22mr784920mum.123.1259422776935; Sat, 28 Nov 2009 07:39:36 -0800 (PST) In-Reply-To: <771905290911280737o66aa5ff3w8d8e9e63eeedfa9a@mail.gmail.com> References: <771905290911280600k5ddac2f8rb1ecc8bae2d8aae3@mail.gmail.com> <771905290911280605i15fce304t4cf2e1530b621b38@mail.gmail.com> <771905290911280736s1e588101h2f710d9d66f10c6@mail.gmail.com> <771905290911280737m562af5aalcac62cfe0c55a319@mail.gmail.com> <771905290911280737o66aa5ff3w8d8e9e63eeedfa9a@mail.gmail.com> Date: Sat, 28 Nov 2009 16:39:36 +0100 Message-ID: Subject: Re: Memory allocation and lazy vals From: Richard Hirsch To: esme-dev@incubator.apache.org Content-Type: text/plain; charset=ISO-8859-1 Vassil just did a commit, so it could already be fixed. I'd try it out. :-> D. On Sat, Nov 28, 2009 at 4:37 PM, Markus Kohler wrote: > W00T! > ESME will fly as soon as this is fixed! > Markus > > On Nov 28, 2009 2:36 PM, "Vassil Dichev" wrote: > > I found a weird thing today. Lazy vals don't act lazy under certain > conditions. > > For those who are not familiar with lazy values, they are values which: > - are calculated on demand > - are memoized so that the next invocation won't compute the same code again > > You can find a nice article about behavior of lazy vals here: > http://blogs.tedneward.com/2009/03/29/Laziness+In+Scala.aspx > > In ESME's case, lazy values are used to format a message into XML and > XHTML only once per instance (does that ring any bells?). What happens > in Message, though, is that digestedXHTML, toXml and originalXml, > which are all lazy, are executed again and again on each consecutive > call! I'm not sure why that is, but if I change the access of object > text to returning a hardcoded value, it works as expected, and gets > evaluated only once. > > I'm currently trying to find the reason for this phenomenon and find > workarounds. This detail undermines our implementation of caching > messages, but at least now we know what causes the strange behavior > observed by Markus. >