| From: Matthias Felleisen (matthias at ccs.neu.edu) Date: Mon Oct 22 20:50:21 EDT 2007 |
|
Use let/ec for local function exists, e.g.,
(module foo mzscheme
(require (lib "list.ss"))
(define (f lx)
(let/ec exit-from-f
(foldr (lambda (x a) (if (= x 0) (exit-from-f 0) (* x a))) 1
lx)))
(printf "~s=0\n" (f '(1 2 3 0 4)))
(printf "~s=24\n" (f '(1 2 3 4))))
-- Matthias
On Oct 22, 2007, at 8:27 PM, Eric Domeshek wrote:
> Noel,
>
> Thanks for the advice. By dint of about 12 hours of hacking, I got
> my stuff mostly ported to 371. I got explicit about managing
> session state in the move from unit-based to module-based
> servlets. I also ran into a problem with all my old "define-macro"
> macros no longer working so I finally had to learn about "define-
> syntax" macros and then rewrite all my macros.
>
> The good news is that the symptom that motivated this upgrade seems
> to have been fixed by moving to 371. The server no longer hangs if
> I click a second time before getting the result of the first click.
>
> The bad news is I've just spent another hour diagnosing a new
> problem that's turned up: it seems that now I can't use call/cc in
> my code. I have an implementation of the Porter stemming algorithm
> that uses call/cc to emulate CommonLisp's ability to do non-local
> returns from a block or function. When I invoke it from inside my
> servlet I get the error message: "call-with-composable-
> continuation: cannot capture past continuation barrier"
>
> Any clue what this is about? Or do you happen to have an
> implementation of the Porter stemming algorithm hanging about that
> doesn't use call/cc, or have a better way to do non-local exits?
>
> Thanks again,
>
> --Eric
>
>
> Noel Welsh wrote:
>> Hi Eric,
>>
>> I'm afraid the best advice I can give is to upgrade to 371, as it
>> incorporates many important improvements and fixes (and I've even
>> encourage you to try one of the nightly builds). It shouldn't be
>> that
>> onerous. The conversion from unit to module based servlets should be
>> straightforward, and you get better error checking with modules,
>> so it
>> is a bit of a win. To load the web server configuration you can take
>> example code from instaweb. Search for
>>
>> configuration-table->web-config@
>>
>> in
>>
>> http://planet.plt-scheme.org/package-source/schematics/
>> instaweb.plt/1/8/instaweb.ss
>>
>> HTH,
>> Noel
>>
>> On 10/19/07, Eric Domeshek <domeshek at stottlerhenke.com> wrote:
>>
>>> Gang,
>>>
>>> I have used PLT 360 to build an elaborate web application. I have
>>> noticed that if, from a particular page, I click a link that
>>> invokes an
>>> extended computation/display, and before the new page comes up, I
>>> click
>>> another link on the original page, then the server seems to hang and
>>> never respond to either click. All these links are generated using
>>> embed/url inside a send/suspend/dispatch. I've been using
>>> Firefox 2 as
>>> my browser.
>>>
>>> Before I get all hung about about possible threading issues and the
>>> possibility of unsafe data modifications, I thought I'd ask if
>>> there is
>>> a simpler explanation (and fix) or if anyone else has seen and can
>>> account for this behavior.
>>>
>>> Also, as an aside, I've downloaded PLT 371 and considered
>>> upgrading, but
>>> it doesn't appear to be a smooth path, since many things have
>>> changed
>>> (but I'm not sure the docs have kept up). The way I set my
>>> configuration no longer works (I think the 'load-configuration'
>>> function
>>> is gone and I can't figure out what has replaced it). I also
>>> think I
>>> read in a post to this list that unit-based servlets are no longer
>>> supported (which is how I've built my two major servlets).
>>>
>>> Anyway, thanks for any help or pointers you folks can offer...
>>>
>>> --Eric
>>>
>>> ====================================================================
>>> Eric Domeshek Phone: 617-616-1291
>>> AI Project Manager Fax: 617-616-1290
>>> Stottler Henke Associates, Inc. EMail: domeshek at stottlerhenke.com
>>> 48 Grove St., Somerville, MA 02144 Web: www.stottlerhenke.com
>>> ====================================================================
>>>
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme