Am 14.11.2013 21:02, schrieb David A. Wheeler: > I said: > >>> If you could help us integrate the rest of your changes into the >>> code, that'd be great. >>> >> >> Sure. Which one are missing by now? > > Here's what I think is missing. I'm hoping you'll join the mailing list > soon, and that we can discuss these publicly. These shouldn't be hard, > but we need to *not* bust guile support. In fact, we include support for > some fairly old versions of guile, because that's what some people have.
Sure! especially now that GNUmake supports guile too. In fact I'll have to install it on my machine one day. > NOTE: First patch hunk - we've switched to flush-output-port, > but we need to address throw vs. raise. > > --- srfi-110.orig.scm 2013-11-07 14:13:43.000000000 +0100 > +++ srfi-110.test.scm 2013-11-13 11:30:31.000000000 +0100 > @@ -2009,13 +2020,19 @@ > ; Call on sweet-expression reader - use guile's nonstandard catch/throw > ; so that errors will force a restart. > (define (t-expr-catch port) > - > +#| > ; Default guile stack size is FAR too small > (debug-set! stack 500000) > > (catch 'readable > (lambda () (t-expr port)) - (lambda (key . args) > (read-to-unindented-line port) (t-expr-catch port)))) + (lambda (key . > args) (read-to-unindented-line port) (t-expr-catch port))) +|# + (guard + > (ex ((eq? ex 'readable) (read-to-unindented-line port) (t-expr-catch > port)) + (else (raise ex))) + (t-expr port)) +) > > ; > ----------------------------------------------------------------------------- > ; Write routines So what is this "debug-set!" - does this have to be called for each t-expr-catch call? Or would it be enough to call this once in the initialization of the code? You comment about "old guile" refers to the use of guard/raise at all, doesn't it? I see to solutions: a) cond-expand on guile the definition of t-expr-catch right where it is b) move this definition into the compatibility section. The latter would be better to keep the compat-stuff together, the former would cluster the code according to the logic. I'd prefer the former. How about you? The "raise" I'd suggest to do like (define-syntax raise (syntax-rules () ((_ x) (throw x))) in the compat section for guile and keep the srfi-34/r7rs compatible code in the main body. > @@ -173,7 +173,17 @@ > ; define the module > ; this ensures that the user's module does not get contaminated with > ; our compatibility procedures/macros > - (define-module (readable kernel)))) > + (define-module (readable kernel))) > + (chicken > + (define string->keyword > + (let ((kwprefix (string (integer->char 0)))) > + (lambda (tok) > + (##sys#intern-symbol > + (if (eq? 0 (##sys#size tok)) > + ":" > + (##sys#string-append kwprefix tok)) )))) > + ) > + (else )) > (cond-expand > ; > ----------------------------------------------------------------------------- > ; Guile Compatibility > @@ -1268,10 +1280,11 @@ > ((char=? c #\| ) > ; Read |...| symbol (like Common Lisp and R7RS draft 9) > (get-barred-symbol port)) - (#t ; Nothing else. Must be > a symbol start. - (string->symbol (fold-case-maybe port - (list->string - > (read-until-delim port neoteric-delimiters))))))))))) + (else ; Nothing > else. Must be a symbol start. + (let ((s (fold-case-maybe port > (list->string (read-until-delim port neoteric-delimiters))))) + (if (eq? > (string-ref s (sub1 (string-length s))) #\:) + (string->keyword > (substring s 0 (sub1 (string-length s)))) + (string->symbol s)))))))))) > > ; > ----------------------------------------------------------------------------- > ; Curly Infix > So how would this work for guile? Does it have a string->keyword? Or was is a symbol->keyword? /Jörg ------------------------------------------------------------------------------ DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk _______________________________________________ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss