Re: [Chicken-users] Web generation + localization.

2008-03-06 Thread Peter Bex
On Wed, Mar 05, 2008 at 06:17:05PM -0800, Robin Lee Powell wrote:
 
 So I gots me a web app to write.
 
 I also want to be prepped for other (spoken) languages, for similar
 reasons, and because I'm nerdy that way. There are libraries that
 will allow insertion of arbitrary Scheme into otherwise normal HTML
 files (i.e. spiffy's ssp stuff). There are other libraries that
 allow writing a web page as Scheme (i.e. hart).
 
 Does any one have any other suggestions, or preferences amongst
 those options, or anything?

I've spent a bit of time thinking about this (unfortunately, no time
to code it up yet).  At work we use Drupal, which simply requires
you to wrap translatable strings with a function call to t(...).
This is a solution that absolutely does not scale well because everytime
it sees a t() call, it hits the database to retrieve the string.
It caches pages, but still we see a lot of overhead in the roundtrips
to the database for uncached pages.

So I've been thinking, if you use sxslt translations (or similar
s-expression based templates), you can first extract all translatable
strings by folding over the template _just_ before you rewrite the
s-expressions to HTML/XML strings, then you do one big query to request
them all at once, and then you insert the strings as needed.

Example:

`(html
   (head (title (trans this is a test)))
   (body
 (h1 (trans My first test))
 (p (trans we have some testing stuff here

Then, you have one translation step that extracts all the (trans ..)
things, resulting in the list (this is a test, My first test,
we have some testing stuff here) which then can be used in one query
that returns the translations.
After that, you go through the sxml again and replace all (trans ..)
by their translation.

Sorry for the hand-waving - I wouldn't have put this out without code to
back it, but it would be a shame if you would go about it the Drupal way
and then would have to reimplement something.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth


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


Re: [Chicken-users] Re: regex and named subpatterns

2008-03-06 Thread felix winkelmann
On Thu, Mar 6, 2008 at 3:40 PM, John Cowan [EMAIL PROTECTED] wrote:
 Alex Shinn scripsit:


   Chicken regexp's historically weren't tied to PCRE, and
   provided a fairly minimal feature set to accomodate all the
   backends equally.  It now always uses PCRE, and you could
   get at the named subpatterns with pcre_get_named_substring()
   if you returned the match object, but personally I don't
   think it should be bound too strongly to PCRE.

  I think the contrary: since we are committed to allowing access to the
  extended regex features of PCRE (which helps portability: no more random
  lossage because I use an extension that your regex package doesn't have),
  we should also provide access to the API of PCRE.  This seems to me much
  more Chicken-y.

Hm, I think not: committing to PCRE ensures all use the same regexp
flavor, not more. If we need more API at all, it should go into:

http://chicken.wiki.br/regex-extras


cheers,
felix


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


Re: [Chicken-users] web-scheme hart

2008-03-06 Thread Graham Fawcett
On 05 Mar 2008 23:29:19 -0300, Mario Domenech Goulart
[EMAIL PROTECTED] wrote:
  On Wed, 5 Mar 2008 17:45:42 -0800 Robin Lee Powell [EMAIL PROTECTED] wrote:

   It seems to me that web-scheme and hart do more-or-less the same
   thing.
   2.  What's the difference between web-scheme and hart?  Do people
   have preferences between the two?

  I don't know much about hart.  I think Graham can write about it.

Briefly, Hart is a syntax extension that tries to turn as much of your
html expression into simple print statements at macro-expansion
time. The base-case, where nothing in your expression requires
variable-substitution, turns into a single print statement:

#;2 ,x (hart (h1 (@ (id main)) hello))
(noop (begin (hart-print h1 id=\main\hello/h1)))

Adding variables makes it a bit more verbose at expansion time.

#;2 ,x (hart (h1 (@ (id my-h1-id)) (t: my-h1-text)))
(noop (begin
(hart-print h1)
(let ((g3 my-h1-id))
  (when g3 (hart-print  id=\ (hart-html-escape g3) \)))
(hart-print )
(apply hart-print (map hart-html-escape (list my-h1-text)))
(hart-print /h1)))

My goal was to develop a nice syntax, but also to reduce runtime
overhead as much as possible. I've never properly benchmarked it
against other options (I haven't used Mario's egg; I used to use the
shtml-html option in the htmlprag egg). Also, I haven't really tried
to optimize it, beyond compiling with an -On flag, and using a
fast-if-primitive html-escape routine. I guess I found that it was
efficient enough for my needs.

One thing I'd like to add is better support for HTML entities,
probably following SXML syntax:

(hart (p Come back to the five  ( amp)  dime, Jimmy Dean...))

right now you need to use a (raw: ...) or (scheme: ...) block to do that:

(hart (p (raw: Come back to the five amp; dime, Jimmy Dean...)))
(hart (p Come back to the five  (raw: amp;)  dime, Jimmy Dean...))
(hart (p Come back to the five  (scheme: (print amp;))  dime,
Jimmy Dean...))

Hope this helps. Comments and suggestions are always welcome.

Graham


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


Re: [Chicken-users] INI files in Scheme? (or something similar)

2008-03-06 Thread Kon Lovett


On Mar 3, 2008, at 5:58 PM, Mario Domenech Goulart wrote:


Hi Hans,

On Mon, 03 Mar 2008 20:22:11 -0500 Hans Nowak  
[EMAIL PROTECTED] wrote:



Is there a standard way to do INI files (or similar kinds of
initialization files, ala .bashrc etc) in Scheme?  For example,
something like this:



snip


Of course, there are many other ways.


SRFI-29



Best wishes,
Mario


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


Best Wishes,
Kon




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


Re: [Chicken-users] Revised Chapter 1 (reminder)

2008-03-06 Thread Vincent Manis

On 2008 Mar 06, at 01:01, felix winkelmann wrote:

On Wed, Mar 5, 2008 at 10:09 PM, Vincent Manis [EMAIL PROTECTED]  
wrote:
A couple of weeks ago, I posted a draft of a new version of Chapter  
1 of
the manual, and asked for comments. There have been a few things  
added,
and I think that the new version is almost ready. There are still  
some

links to add, and a couple of more substantive things.


Absolutely great! Should this chapter just replace the current  
Overview

page, then?


I think it can...I kept all the content from the current page.

-- v


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


[Chicken-users] Trashing of Egg documentation changes?

2008-03-06 Thread Robin Lee Powell

On Eggs Unlimited 3, the top of the Web programming section looks
like this (rendered, not source):

Web programing

chickenegg name=web-unity license=BSD author=sjamaan description=Web 
app unification framework for CGI/SCGI/FCGI/Spiffy webservers/

ajax Using xmlHttpRequest with the Spiffy web-server MIT [[felix winkelmann]] 
Dependencies

I've fixed both these problems (the web-unity failure and the
[[...]] around felix's name) twice now, but they keep being
regenerated.

Is this page auto-generated?  If so, could the page *explain* this
at the top, so I can change the right stuff?

Also, I've made some minor clarifying changes to the spiffy docs at
http://chicken.wiki.br/spiffy ; is that going to be trashed too?

-Robin

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


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


Re: [Chicken-users] readline blocks threads

2008-03-06 Thread Shawn Rutledge
On Wed, Mar 5, 2008 at 11:50 PM, Shawn Rutledge
[EMAIL PROTECTED] wrote:
  So they're using Unix sockets.  It's already non-blocking, so F_SETFL
  doesn't change the behavior.

But I guess I'm being stupid... readline (or the terminal? as you say)
is blocking, not dbus.  But it's good to know definitely what dbus is
using.

On Thu, Mar 6, 2008 at 12:53 AM, Elf [EMAIL PROTECTED] wrote:
  the problem isnt nonblocking status.
  the problem is that all the term settings get munged by readline - how else
  could it interpret arrows, tabs, do paren bouncing, etc.

You mean the same settings that can be changed via stty?  I don't
understand what effect that has.  The usual kind of blocking that can
be turned on is that when you are sitting at a shell prompt,
keystrokes are not sent one-by-one, but rather it can wait until you
hit the enter key and send the whole command all at once; this is a
feature that can help with slow serial connections or packet networks.
 But I don't think that mode is in use much these days, and readline
would be turning off that feature, right? because it has to see each
keystroke in order to do all the tricks.  Or you think it's on the
output side, that the threads are blocked because output going from
csi to the screen does not pass through until it is flushed?  Then
maybe a thread which does no output would run fine, but one which
displays status messages would block?

  i am working on a pure scheme readlineish lib to compensate with 
 approximately
  the same feature set as what is presently there.  it should be done shortly.

OK I'll look forward to it.

So you don't have any philosophical problem with the idea that an egg
which does polling should automatically start a thread to do that?

  however, instead of coding right now, im going through the almost 500 eggs
  to make sure that the licence data is correct (ie, the licence tag and the

Doesn't sound like much fun.


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


Re: [Chicken-users] Web generation + localization.

2008-03-06 Thread Robin Lee Powell
On Thu, Mar 06, 2008 at 10:22:32AM +0100, Peter Bex wrote:
 I've spent a bit of time thinking about this (unfortunately, no
 time to code it up yet).  At work we use Drupal, which simply
 requires you to wrap translatable strings with a function call to
 t(...). This is a solution that absolutely does not scale well
 because everytime it sees a t() call, it hits the database to
 retrieve the string. It caches pages, but still we see a lot of
 overhead in the roundtrips to the database for uncached pages.

Beyond not scaling well, that approach is flawed from the get-go;
see
http://search.cpan.org/~petdance/Locale-Maketext-1.12/lib/Locale/Maketext/TPJ13.pod

I'm planning on writing a maketext-alike for Chicken.

That's somewhat a seperate issue, however.  I was planning on using
backing files rather than a database, but your (snipped) point about
going to the backing source (whatever it happens to be) as few times
as possible is a good one; thanks.

-Robin

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


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


Re: [Chicken-users] Revised Chapter 1 (reminder)

2008-03-06 Thread Vincent Manis

On 2008 Mar 06, at 09:08, Ashley Bone wrote:
I'd suggest combining the paragrapsh on the MinGW/msys builds and  
just noting that makefiles exist for cmd.exe and msys.

Done.

John Cowan asked what the point of having both flavors. Back when I  
was doing
Windows stuff, I normally built things via bash scripts (just as I do  
today
on OSX). I did use MinGW/MSys (curse their weird capitalization) for  
exactly
that, once or twice. But most of my coworkers were kind of locked into  
Windows,
and trying to explain shell scripts to them would have been very  
stressful
on all of us. So had I been building something for them to use, I  
probably
would have created a batch file for building it, on the grounds that  
they

would be more likely to understand it than a shell script.

So my vote (even though I have no machines at present that need or  
even could

use MinGW) goes to keeping both.

-- v


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


[Chicken-users] Anyone working on a BDD framework?

2008-03-06 Thread Robin Lee Powell

I'm a big fan of rspec/jbehave/etc's Given/When/Then framework for
doing BDD specifications.  Before I go off and write my own (read:
before I hack testbase to do it), has anyone already got such a
thing for Chicken I can use?

-Robin

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


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


Re: [Chicken-users] google summer of code

2008-03-06 Thread Alex Shinn
 Alaric == Alaric Snell-Pym [EMAIL PROTECTED] writes:

Alaric I'm also keen on a proper library/module system,
Alaric though. I'd like to be able to use multiple
Alaric macro systems in the same source file, for a
Alaric start. So something where chicken itself has a
Alaric notion of a macro environment, and macro systems
Alaric just register closures in an alist or whatever
Alaric that (define-syntax ...) dispatches on to
Alaric convert whatever the user supplies into a
Alaric closure that rewrites syntax objects, then when
Alaric the macro is invoked, that closure can be
Alaric applied to perform the rewrite. Then the module
Alaric system needs to know that there are two
Alaric environments - values and syntax - to expose
Alaric from modules and import into places, and all
Alaric should be well. Surely?

Actually, that would be far more work than I'd be interested
in.  The different macro systems all have their own
representations of hygiene information, and getting them all
to work together would be a pain.

What I would probably end up doing is choosing a single
macro system to be required for the module system.  Probably
riaxpander because Taylor Campbell will actively support it
and it already handles syntax-rules, syntactic-closures and
explicit renaming.  Implementing syntax-case on top of it
wouldn't be much work either if people really, honestly felt
they wanted that (except identifier-syntax - it would be
easy enough for someone else to add but I couldn't bring
myself to dirty the macro semantics so badly).

Though if people want syntax-case I'd like some rationale
before working on it, and clear reasons as to why they don't
like the more straightforward alternatives.

Again, interoperability with non-module eggs is an important
goal, so this wouldn't affect any existing eggs.

-- 
Alex


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


Re: [Chicken-users] srfi-29 egg problems: [EMAIL PROTECTED] doesn't seem to work?

2008-03-06 Thread Robin Lee Powell
On Thu, Mar 06, 2008 at 09:46:49AM +0100, felix winkelmann wrote:
 
 You need a version of format that is more capable than the
 builtin one (which builds on [sf]printf). Install format-modular
 or format, and load that before srfi-29.

Did that; now I get:

Error: (vector-ref) out of range
#(12:00 Fred)
2

Call history:

syntax(localized-message (quote goodbye) myname)
syntax(quote goodbye)
syntax(display #\newline)
eval  (display (localized-message (quote time) 12:00 
myname))
eval  (localized-message (quote time) 12:00 myname)
eval  [localized-message] (apply format (cons 
(localized-template (quote hello-program) message-name) args))
eval  [localized-message] (cons (localized-template (quote 
hello-program) message-name) args)
eval  [localized-message] (localized-template (quote 
hello-program) message-name) --

Code attached.  Not that it matters, as srfi-29 isn't sufficient for
me (see
http://search.cpan.org/~petdance/Locale-Maketext-1.12/lib/Locale/Maketext/TPJ13.pod
) but now I'm curious.  :)

-Robin


-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
(require-extension format-modular)
(require-extension srfi-29)

(let ((translations
   '(((en) . ((time . Its ~a, ~a.)
(goodbye . Goodbye, ~a.)))
 ((fr) . ((time . [EMAIL PROTECTED], c'est ~a.)
(goodbye . Au revoir, ~a.))
  (for-each (lambda (translation)
  (let ((bundle-name (cons 'hello-program (car translation
 (declare-bundle! bundle-name (cdr translation
 translations))

(define localized-message
  (lambda (message-name . args)
(apply format (cons (localized-template 'hello-program
message-name)
args

(current-language 'fr)
(let ((myname Fred))
  (display (localized-message 'time 12:00 myname))
  (display #\newline)

  (display (localized-message 'goodbye myname))
  (display #\newline))
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Revised Chapter 1 (reminder)

2008-03-06 Thread John Cowan
Vincent Manis scripsit:

 John Cowan asked what the point of having both flavors. Back when I
 was doing Windows stuff, I normally built things via bash scripts
 (just as I do today on OSX). I did use MinGW/MSys (curse their
 weird capitalization) for exactly that, once or twice. But most of
 my coworkers were kind of locked into Windows, and trying to explain
 shell scripts to them would have been very stressful on all of us. So
 had I been building something for them to use, I probably would have
 created a batch file for building it, on the grounds that they would
 be more likely to understand it than a shell script.

Quite so, which is why I'd suggest that the msys version be scrapped
and that everyone on Windows use either the cygwin or the mingw version.

-- 
Andrew Watt on Microsoft:   John Cowan
Never in the field of human computing   [EMAIL PROTECTED]
has so much been paid by so manyhttp://www.ccil.org/~cowan
to so few! (pace Winston Churchill)


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


Re: [Chicken-users] chicken-setup broken

2008-03-06 Thread Ivan Raikov

Hi Jim,

   Can you try r9257? I have committed some fixes to chicken-setup
that would hopefully solve your problems. 

   -Ivan

Jim Ursetto [EMAIL PROTECTED] writes:

 Hi,

 chicken-setup seems to be broken (r9210).

 --  Install of egg located in current directory fails:

 [EMAIL PROTECTED] ~$ echo $TMPDIR $CHICKEN_TMPDIR

 [EMAIL PROTECTED] ~$ ll objc.egg
 -rw-r--r--   1 root  jim  64708 Jan 14 01:00 objc.egg
 [EMAIL PROTECTED] ~$ sudo chicken-setup objc
 Error: (open-input-file) can not open file - No such file or
 directory: /tmp/chicken-setup-3-root/downloads/objc.egg

 --  Install of downloaded egg fails:

 [EMAIL PROTECTED] ~$ sudo chicken-setup hostinfo
 The extension hostinfo does not exist.
 Do you want to download it ? (yes/no/abort) [yes] yes
 downloading hostinfo.egg from (www.call-with-current-continuation.org
 eggs/3 80)
 Error: (open-input-file) can not open file - No such file or directory:
 /tmp/chicken-setup-3-root/downloads/tmp/chicken-setup-3-root/downloads/hostinfo...


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


Re: [Chicken-users] Revised Chapter 1 (reminder)

2008-03-06 Thread Vincent Manis

On 2008 Mar 06, at 21:22, John Cowan wrote:





Quite so, which is why I'd suggest that the msys version be scrapped
and that everyone on Windows use either the cygwin or the mingw  
version.
Well, I actually don't care one way or the other. I'll change the  
documentation

if a consensus emerges.

-- v


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


Re: [Chicken-users] chicken-setup broken

2008-03-06 Thread Jim Ursetto
Ivan,

Installation of downloaded eggs now works.

However, installing an egg located in the current directory
still fails, with a different path in the error.

[EMAIL PROTECTED] ~$ ll objc.egg
-rw-r--r--   1 root  jim  64708 Jan 14 01:00 objc.egg

[EMAIL PROTECTED] ~$ sudo chicken-setup objc
Error: (open-input-file) can not open file - No such file
  or directory: objc.egg


On 3/6/08, Ivan Raikov [EMAIL PROTECTED] wrote:

 Hi Jim,

 Can you try r9257? I have committed some fixes to chicken-setup
 that would hopefully solve your problems.

 Jim Ursetto [EMAIL PROTECTED] writes:

  -- Install of egg located in current directory fails:
 
  [EMAIL PROTECTED] ~$ echo $TMPDIR $CHICKEN_TMPDIR
 
  [EMAIL PROTECTED] ~$ ll objc.egg
  -rw-r--r-- 1 root jim 64708 Jan 14 01:00 objc.egg
  [EMAIL PROTECTED] ~$ sudo chicken-setup objc
  Error: (open-input-file) can not open file - No such file or
  directory: /tmp/chicken-setup-3-root/downloads/objc.egg


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