[Chicken-users] an ode to Spiffy

2005-05-25 Thread Michele Simionato
As most people, I usually post to the mailing list when I get in trouble on when
I have something to complain about. However, this does not mean that I am
always unhappy with Chicken. So, just for love of equity, I have decided this
time to write a support message for Spiffy. Great job, Felix! :-)
Spiffy works pretty nice, in a morning I think I have got most of it without
big issues (or maybe I am so happy only because it is so much better of
http-server ;). I can run spiffy in a separate thread, add resources
from the REPL, see what happens in real time,  correct the errors and
use the interpreter for anything else, all without restarting the server.
A few things are missing  (for instance form validation) but I can implement
it in minutes with a nice macro in a completely interactive way. Plus, I
like SXML at least as much as I hate HTML :)
I think I will write a small tutorial about how to use Spiffy for writing simple
Web interfaces, which is the thing I am interested in, since I want to use
Scheme to do fast prototyping of Web applications. Scheme is *extremely*
suitable for this job, it sad that most people don't realize that because of
Scheme general attitude to discourage users making things harder than 
needed (Chicken is maybe an exception to this general rule, since Felix
clearly shows some concerns for usability and practicality).

In short  Felix, thank you for your hard work and for your revolutionary
effort in putting Scheme out of the ivory tower ;)

 Michele Simionato


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-25 Thread Michele Simionato
> (You meant, "to discourage users *by* making things harder than needed", 
> right?)

Yep, the "by" slipped off!

> As you suggested earlier, Michele, it would be great to have better
> error reports (and decent tracebacks, please!). I'd also love a
> remote-REPL facility, to connect to a running spiffy server... A few
> tools like this, and spiffy/Chicken could easily become my framework
> of choice for Web app prototyping.

I think to get a remote REPL is not difficult, but I have serious doubts
about getting better tracebacks, since I have never seen a Scheme
implementation with good error reporting :-(

Guido van Rossum says that he will never make Python tail recursive 
since it does not want to lose nice tracebacks. I don't know if it is
technically
possible to get both tail recursion and nice tracebacks, and how difficult
it is.
 
> Heck -- if we can throw in a consistent DB API, a MySQL egg, a few
> handy webapp framework components, and a good tutorial, then you've
> got a serious contender in the silent masses' quest for the ideal LAMP
> (LAMS?) framework. (Well, maybe, if the silent masses can learn to
> digest parentheses.)
> 

Well, this is called being optimistic! ;-)


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-25 Thread Graham Fawcett
On 5/25/05, Michele Simionato <[EMAIL PROTECTED]> wrote:
> I think I will write a small tutorial about how to use Spiffy for writing 
> simple
> Web interfaces, which is the thing I am interested in, since I want to use
> Scheme to do fast prototyping of Web applications. Scheme is *extremely*
> suitable for this job, it sad that most people don't realize that because of
> Scheme general attitude to discourage users making things harder than
> needed (Chicken is maybe an exception to this general rule, since Felix
> clearly shows some concerns for usability and practicality).

(You meant, "to discourage users *by* making things harder than needed", right?)

Great idea -- such a tutorial would be excellent!

As you suggested earlier, Michele, it would be great to have better
error reports (and decent tracebacks, please!). I'd also love a
remote-REPL facility, to connect to a running spiffy server... A few
tools like this, and spiffy/Chicken could easily become my framework
of choice for Web app prototyping.

Heck -- if we can throw in a consistent DB API, a MySQL egg, a few
handy webapp framework components, and a good tutorial, then you've
got a serious contender in the silent masses' quest for the ideal LAMP
(LAMS?) framework. (Well, maybe, if the silent masses can learn to
digest parentheses.)

> In short  Felix, thank you for your hard work and for your revolutionary
> effort in putting Scheme out of the ivory tower ;)

+1. From my POV, Chicken is the Scheme sweet-spot; thanks Felix for
your tremendous effort.

-- Graham


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-25 Thread Graham Fawcett
On 5/25/05, Michele Simionato <[EMAIL PROTECTED]> wrote:
> I think to get a remote REPL is not difficult, but I have serious doubts
> about getting better tracebacks, since I have never seen a Scheme
> implementation with good error reporting :-(
> 
> Guido van Rossum says that he will never make Python tail recursive
> since it does not want to lose nice tracebacks. I don't know if it is
> technically
> possible to get both tail recursion and nice tracebacks, and how difficult
> it is.

I feared that might be the case. Still, any tool that could instrument
my code to provide some kind of "this source-snippet is probably the
problem" report would be beneficial. Maybe I need to do some reading
on Scheme debuggers...

> > Heck -- if we can throw in a consistent DB API, a MySQL egg, a few
> > handy webapp framework components, and a good tutorial, then you've
> > got a serious contender in the silent masses' quest for the ideal LAMP
> > (LAMS?) framework. (Well, maybe, if the silent masses can learn to
> > digest parentheses.)
> >
> 
> Well, this is called being optimistic! ;-)

I know, but Fortune favours the bold! I never saw Ruby on Rails
coming, why not Chicken on Road? (Except that it would be impossible
to google.  :-)

-- Graham


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-25 Thread Michele Simionato
On 5/25/05, Graham Fawcett <[EMAIL PROTECTED]> wrote:
> On 5/25/05, Michele Simionato <[EMAIL PROTECTED]> wrote:
> > I think to get a remote REPL is not difficult, but I have serious doubts
> > about getting better tracebacks, since I have never seen a Scheme
> > implementation with good error reporting :-(
> >
> > Guido van Rossum says that he will never make Python tail recursive
> > since it does not want to lose nice tracebacks. I don't know if it is
> > technically
> > possible to get both tail recursion and nice tracebacks, and how difficult
> > it is.
> 
> I feared that might be the case. Still, any tool that could instrument
> my code to provide some kind of "this source-snippet is probably the
> problem" report would be beneficial. Maybe I need to do some reading
> on Scheme debuggers...

You may start from

# chicken-setup debug

and see how far you can go.

   Michele Simionato


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


RE: [Chicken-users] an ode to Spiffy

2005-05-25 Thread Dominique Boucher
Hi,

I finally decided to install Chicken 1.89 this morning and upgrade
gcc/libtool on cygwin to properly handle dlopen. I then installed spiffy via
chicken-setup. Everything went smoothly. Great job, Felix!

But:

> I can run 
> spiffy in a separate thread, add resources from the REPL, see 

How do you do that? Spiffy must be started in a separate thread, but it
seems that the REPL blocks all other threads (at least under cygwin,
AFAICT). I need to issue a (thread-sleep! 10) when I want to test a new
resource handler. Am I missing something obvious?

Thanks,

Dominique Boucher
 




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-25 Thread Michele Simionato
On 5/25/05, Dominique Boucher <[EMAIL PROTECTED]> wrote:
> 
> > I can run
> > spiffy in a separate thread, add resources from the REPL, see
> 
> How do you do that? Spiffy must be started in a separate thread, but it
> seems that the REPL blocks all other threads (at least under cygwin,
> AFAICT). I need to issue a (thread-sleep! 10) when I want to test a new
> resource handler. Am I missing something obvious?

Maybe not, cygwin gave me lots of troubles in the past (bizarre installation
issues). I am using this

  (define (start-server-debug . args)
   (thread-start!
(lambda ()
  (apply start-server
(append args (list root: "." debug: #t))

and it works under Linux, but I cannot test it under cygwin.

   Michele Simionato


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


RE: [Chicken-users] an ode to Spiffy

2005-05-25 Thread Dominique Boucher
> Maybe not, cygwin gave me lots of troubles in the past 
> (bizarre installation issues). I am using this

Chicken compiled out-of-the-box, as well as all the eggs I installed. That
was not the case a year ago.

>   (define (start-server-debug . args)
>(thread-start!
> (lambda ()
>   (apply start-server
> (append args (list root: "." debug: #t))
> 
> and it works under Linux, but I cannot test it under cygwin.

That's basically what I tried. The remote REPL would be a better approach
under cygwin, I guess.

Dominique




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-25 Thread Graham Fawcett
On 5/25/05, Michele Simionato <[EMAIL PROTECTED]> wrote:
> On 5/25/05, Graham Fawcett <[EMAIL PROTECTED]> wrote:
> > I feared that might be the case. Still, any tool that could instrument
> > my code to provide some kind of "this source-snippet is probably the
> > problem" report would be beneficial. Maybe I need to do some reading
> > on Scheme debuggers...
> 
> You may start from
> 
> # chicken-setup debug
> 
> and see how far you can go.

The debug egg is useful, but it's not clear how to get it working in
the context of an error in a resource handler. But you're right, of
course; it's a good starting point. I'll read through the spiffy code
and see if I can find out how to make them play nicely together.

-- Graham


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-25 Thread felix winkelmann
On 5/25/05, Michele Simionato <[EMAIL PROTECTED]> wrote:
> 
> In short  Felix, thank you for your hard work and for your revolutionary
> effort in putting Scheme out of the ivory tower ;)
> 


Ah (It's mail like this that keeps me going).

But: let's not forget all who send bug-reports and help getting
rid of all those bugs I put into the code and the manual.

So, a big thank you back to y'all!


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-25 Thread felix winkelmann
On 5/25/05, Michele Simionato <[EMAIL PROTECTED]> wrote:
> 
> I think to get a remote REPL is not difficult, but I have serious doubts
> about getting better tracebacks, since I have never seen a Scheme
> implementation with good error reporting :-(
> 

Yes, macros and tailcalls make this pretty difficult, unless you have a
powerful syntactic framework and disable tail-recursion.
Note that the debug egg does the latter in most cases.


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-25 Thread felix winkelmann
On 5/25/05, Graham Fawcett <[EMAIL PROTECTED]> wrote:
> 
> Great idea -- such a tutorial would be excellent!

Yes, that would be *very* nice!

> 
> As you suggested earlier, Michele, it would be great to have better
> error reports (and decent tracebacks, please!). I'd also love a
> remote-REPL facility, to connect to a running spiffy server...

Using the following code you should be able to connect
to a running csi via telnet:

(use tcp)

; Make sure to start csi with the "-:c" option to force
; display of the prompt.

(define (remote-repl #!optional (port ))
  (let ((listener (tcp-listen port)))
(let-values (((i o) (tcp-accept listener)))
  (current-input-port i)
  (current-output-port o)
  (current-error-port o)
  (when (provided? 'debug)
(set! ##dbg#command-input-port i)
(set! ##dbg#command-output-port o) ) ) ) )

When running this with a separate spiffy thread, I had to press
return once on the console where I started csi. From then on
you have a repl in your telnet session.

> 
> Heck -- if we can throw in a consistent DB API, a MySQL egg, a few
> handy webapp framework components, and a good tutorial, then you've
> got a serious contender in the silent masses' quest for the ideal LAMP
> (LAMS?) framework. (Well, maybe, if the silent masses can learn to
> digest parentheses.)
> 

BTW, has anybody a good idea for a AJAX api? I hacked sajax a little
and got it basically working, but I'm not sure how to integrate this nicely into
spiffy.


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-26 Thread felix winkelmann
On 5/25/05, Dominique Boucher <[EMAIL PROTECTED]> wrote:
> 
> > I can run
> > spiffy in a separate thread, add resources from the REPL, see
> 
> How do you do that? Spiffy must be started in a separate thread, but it
> seems that the REPL blocks all other threads (at least under cygwin,
> AFAICT). I need to issue a (thread-sleep! 10) when I want to test a new
> resource handler. Am I missing something obvious?
> 

Hm. Could you try this, please:

$ cat repltest.scm
 (use srfi-18)

 (set! ##sys#read-prompt-hook
(let ([old ##sys#read-prompt-hook]
  [thread-yield! thread-yield!] )
  (lambda ()
(when (or (##sys#fudge 12) (##sys#tty-port? ##sys#standard-input))
  (old)
  (##sys#thread-block-for-i/o! ##sys#current-thread 0 #t)
  (thread-yield! ) 

(repl)  
$ csc repltest.scm
$ ./repltest
#;> (thread-start! (lambda () (let loop ((i 0)) (print i)
(thread-sleep! 1) (loop (add1 i)
; from now on you should still be able to eval expressions...

[This is normally done in srfi-18.scm, but is disabled on Windows.
Should this work with cygwin (requires select(2)), I'll disable it
exclusively for Windows/MSVC (which doesn't have select(2) on
file/stdio fd's)]


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-26 Thread Magnus Therning
On Wed, May 25, 2005 at 07:54:26AM -0400, Michele Simionato wrote:
>As most people, I usually post to the mailing list when I get in
>trouble on when I have something to complain about. However, this does
>not mean that I am always unhappy with Chicken. So, just for love of
>equity, I have decided this time to write a support message for Spiffy.
>Great job, Felix! :-) Spiffy works pretty nice, in a morning I think I
>have got most of it without big issues (or maybe I am so happy only
>because it is so much better of http-server ;). I can run spiffy in a
>separate thread, add resources from the REPL, see what happens in real
>time,  correct the errors and use the interpreter for anything else,
>all without restarting the server.  A few things are missing  (for
>instance form validation) but I can implement it in minutes with a nice
>macro in a completely interactive way. Plus, I like SXML at least as
>much as I hate HTML :) I think I will write a small tutorial about how
>to use Spiffy for writing simple Web interfaces, which is the thing I
>am interested in, since I want to use Scheme to do fast prototyping of
>Web applications. Scheme is *extremely* suitable for this job, it sad
>that most people don't realize that because of Scheme general attitude
>to discourage users making things harder than needed (Chicken is maybe
>an exception to this general rule, since Felix clearly shows some
>concerns for usability and practicality).

I'm sure you've read what Paul Graham has to say after using Lisp
(almost as nice as Scheme :-) for web applications in ViaWeb?

/M

-- 
Magnus Therning(OpenPGP: 0xAB4DFBA4)
[EMAIL PROTECTED]
http://magnus.therning.org/

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

Crypto is not mathematics, but crypto can be highly mathematical,
crypto can use mathematics, but good crypto can be done without a
great reliance on complex mathematics.
  -- W T Shaw


pgp5erSJclNPt.pgp
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-26 Thread Sunnan
Magnus Therning <[EMAIL PROTECTED]> writes:

> I'm sure you've read what Paul Graham has to say after using Lisp
> (almost as nice as Scheme :-) for web applications in ViaWeb?

He used CPS because full continuations weren't available; maybe Scheme
could do it nicer.

-- 
.i mi'e snan .i mi rodo roda fraxu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-26 Thread Peter Busser
> > A few things are missing  (for
> >instance form validation) but I can implement it in minutes with a nice
> >macro in a completely interactive way. Plus, I like SXML at least as
> >much as I hate HTML :) I think I will write a small tutorial about how
> >to use Spiffy for writing simple Web interfaces, which is the thing I
> >am interested in, since I want to use Scheme to do fast prototyping of
> >Web applications. Scheme is *extremely* suitable for this job, it sad
> >that most people don't realize that because of Scheme general attitude
> >to discourage users making things harder than needed (Chicken is maybe
> >an exception to this general rule, since Felix clearly shows some
> >concerns for usability and practicality).
>
> I'm sure you've read what Paul Graham has to say after using Lisp
> (almost as nice as Scheme :-) for web applications in ViaWeb?

BTW, while talking about SXML, has anyone looked at getting LAML to work on 
Chicken? (http://www.cs.auc.dk/~normark/laml/)

It contains also some papers about SXML and XML transformation in Scheme.

Groetjes,
Peter.


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-26 Thread felix winkelmann
On 5/26/05, Peter Busser <[EMAIL PROTECTED]> wrote:
> 
> BTW, while talking about SXML, has anyone looked at getting LAML to work on
> Chicken? (http://www.cs.auc.dk/~normark/laml/)
> 

I have started once but lost interest. It shouldn't be too hard to port,
though...

(Hint, hint!)


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


RE: [Chicken-users] an ode to Spiffy

2005-05-26 Thread Dominique Boucher
Felix, 

> Hm. Could you try this, please:
> [...]
> $ ./repltest
> #;> (thread-start! (lambda () (let loop ((i 0)) (print i) 
> (thread-sleep! 1) (loop (add1 i) ; from now on you should 
> still be able to eval expressions...
> 

That worked out of the box for me.

> [This is normally done in srfi-18.scm, but is disabled on Windows.
> Should this work with cygwin (requires select(2)), I'll 
> disable it exclusively for Windows/MSVC (which doesn't have 
> select(2) on file/stdio fd's)]

Please, do so!

Thanks a lot, 

Dominique





___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-26 Thread Mario Domenech Goulart
On Thu, 26 May 2005 11:35:16 +0200 felix winkelmann <[EMAIL PROTECTED]> wrote:

> On 5/26/05, Peter Busser <[EMAIL PROTECTED]> wrote:
>> 
>> BTW, while talking about SXML, has anyone looked at getting LAML to work on
>> Chicken? (http://www.cs.auc.dk/~normark/laml/)
>> 
>
> I have started once but lost interest. It shouldn't be too hard to port,
> though...
>
> (Hint, hint!)

It may look a bit silly and ugly, but some time ago I made something
that looks like that (if my guess about what LAML is is correct --
couldn't read the papers yet).

It's at http://www.inf.ufrgs.br/~mario/english/utils/web-scheme

Disclaimer:

- I made it without looking for previous work about this topic. So, if
  some ideas are badly implemented or if there things that just look too
  silly, it's my fault.

- The code is far from being good (horrible, in fact :-))

Originally it was just an attempt to get rid of some even more ugly
scripts I use to generate headers and footers to some of my html pages
and to use some programming stuff embedded in web pages with a cleaner
syntax.  Now it's not even that because I didn't convert those
pages. :-)

Best whishes,
Mario



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-26 Thread felix winkelmann
On 5/26/05, Mario Domenech Goulart <[EMAIL PROTECTED]> wrote:
> 
> It may look a bit silly and ugly, but some time ago I made something
> that looks like that (if my guess about what LAML is is correct --
> couldn't read the papers yet).
> 
> It's at http://www.inf.ufrgs.br/~mario/english/utils/web-scheme
> 
> Disclaimer:
> 
> - I made it without looking for previous work about this topic. So, if
>   some ideas are badly implemented or if there things that just look too
>   silly, it's my fault.
> 
> - The code is far from being good (horrible, in fact :-))
> 
> Originally it was just an attempt to get rid of some even more ugly
> scripts I use to generate headers and footers to some of my html pages
> and to use some programming stuff embedded in web pages with a cleaner
> syntax.  Now it's not even that because I didn't convert those
> pages. :-)
> 

Well, I think this looks (and works) pretty well. Would it be ok for you if
we turn this into an egg?


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-27 Thread Mario Domenech Goulart
On Fri, 27 May 2005 07:44:16 +0200 felix winkelmann <[EMAIL PROTECTED]> wrote:

> Well, I think this looks (and works) pretty well. Would it be ok for you if
> we turn this into an egg?

Sure.

If there is something I can do to help you, just tell me.

Best wishes,
Mario


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] an ode to Spiffy

2005-05-27 Thread felix winkelmann
On 5/26/05, Dominique Boucher <[EMAIL PROTECTED]> wrote:
> Felix,
> 
> > Hm. Could you try this, please:
> > [...]
> > $ ./repltest
> > #;> (thread-start! (lambda () (let loop ((i 0)) (print i)
> > (thread-sleep! 1) (loop (add1 i) ; from now on you should
> > still be able to eval expressions...
> >
> 
> That worked out of the box for me.
> 

Very good. Here is a patch for srfi-18.scm:

466c466
< (unless (eq? (software-type) 'windows)
---
> (unless (eq? (build-platform) 'msvc)


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users