Re: [Chicken-users] Backslash-symbol changed from \ to \\ between 4.5.0 and 4.6.0

2010-10-07 Thread Felix
From: Peter Danenberg p...@roxygen.org
Subject: Re: [Chicken-users] Backslash-symbol changed from \ to \\ between 
4.5.0 and 4.6.0
Date: Wed, 6 Oct 2010 19:52:24 -0500

 Quoth Felix on Prickle-Prickle, the 60th of Bureaucracy:
 This change is intentional. `\' is now a (single) escape character.
 The reading of keywords is indeed incomplete, yet.
 
 Ok; is the consensus, then, that I should escape all my backslashes in
 symbols with another backslash from 4.6.0 onwards?
 
 I agree with Peter Bex, though, that R5RS seems to be mum on the
 matter of backslashes in identifiers; according to 7.1.1 [1], in fact,
 these are the only explicitly allowed symbols in addition to letters
 and numbers:
 
 ! $ %  * / :  =  ? ^ _ ~ + - . @
 
 It might have been presumptuous of me to depend on the 4.5.0
 behaviour; but it would be nice, on the other hand, to document the
 change somewhere.
 

See the manual chaprter Non-standard read syntax - Escapes in symbols.


cheers,
felix

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


Re: [Chicken-users] CHICKEN_INCLUDE_PATH and require

2010-10-07 Thread Felix
From: Mario Domenech Goulart mario.goul...@gmail.com
Subject: [Chicken-users] CHICKEN_INCLUDE_PATH and require
Date: Tue, 05 Oct 2010 09:17:07 -0400

 Hi
 
 I'm confused about the `require' semantics for compiled and
 interpreted code and regarding to CHICKEN_INCLUDE_PATH.  Here's
 an example:
 
[...]
 
 Why doesn't the compiled code work?
 

csi incorrectly also searches extensions in CHICKEN_INCLUDE_PATH. 
I'll change that and update the docs. Thanks for pointing out this
inconsistency.


cheers,
felix


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


Re: [Chicken-users] dev-snapshot 4.6.3

2010-10-07 Thread Jim Ursetto
On Wed, Oct 6, 2010 at 07:58, Felix
fe...@call-with-current-continuation.org wrote:
 - the `regex' library unit has been removed and is separately
  available as an extension which should be fully backwards-
  compatible

Just wanted to clarify that if you are upgrading over an older version
in the same install location, you will have to rebuild any eggs that
relied on regex.  Otherwise at load time you will get an error
regarding an undefined reference to C_regex_toplevel (at least on OS
X).  Once the eggs are rebuilt they appear to work with both older and
newer Chicken versions.

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


[Chicken-users] Using irregex safely responsibly [Was: Re: dev-snapshot 4.6.3]

2010-10-07 Thread Peter Bex
Hello!

Since there are a few pitfalls to updating eggs to work with the new
Chicken 4.6.2, I've decided to draw up a quick list of pitfalls I noticed.

If you're just using the regex API or the regex API with a few irregex
things, usually all you need is to add (needs regex) to your egg's meta
file and you're done (but read on!).

If you are only using the irregex API and don't want to drag in another
dependency just to keep older Chickens happy, here's a way to depend
on just irregex in either old or new Chicken.  Add the following to your
.setup file:

(define regex-version
  (if (version=? (chicken-version) 4.6.2)
  'total-irregex
  'irregex-through-regex))

and alter your compilation line to read something like this:

(compile -s -D ,regex-version my-egg.scm -j my-egg)

In your egg's file, where you would previously use this idiom:

(require-library regex)  ; or (use regex) for the lazy  sloppy
(import irregex)

you can now replace it with this block (you can delete emulation of
procedures you are sure you aren't using):

(cond-expand
 (total-irregex
  (use irregex))
 (else
  (require-library regex)
  (import (rename irregex
  (irregex-match-start irregex-match-start-index)
  (irregex-match-end irregex-match-end-index)))
  (define irregex-num-submatches irregex-submatches)
  (define irregex-match-num-submatches irregex-submatches)
  (define (irregex-match-valid-index? m i)
(and (irregex-match-start-index m i) #t))
  (define (maybe-string-sre obj)
(if (string? obj) (string-sre obj) obj

We need to do this because the irregex-match-{start,end} procedures have
been suffixed -index.  But be careful!  They also have slightly changed
semantics.  If you pass an index of a submatch which did not get matched,
irrgex-match-start-index will throw an exception.  You first need to
test whether it matched.  That's what irregex-match-valid-index? is
for, which we simulate in older Chickens by simply attempting to fetch
the start index and checking whether it succeeded.
We also define irregex-[match-]num-submatches as irregex-submatches.
The old procedure accepted both match objects and irregex objects, while
the new procedures are more consistent with the rest of the API and only
accept their corresponding types.  The maybe-string-sre is just copied
from the irregex-core.scm file.

One last pitfall to take care of is the fact that the new irregex has
a few new procedures.  For example, the old Chicken's irregex simply
didn't have the chunked matching API at all.  Here's a list of things
that are unavailable in older Chickens:

irregex-extract
irregex-fold/chunked
irregex-match?
irregex-match-end-index (but see emulation code above)
irregex-match-end-chunk
irregex-match-names
irregex-match-start-index   (but see emulation code above)
irregex-match-start-chunk
irregex-match-subchunk
irregex-match-valid-index?  (but see emulation code above)
irregex-match/chunked
irregex-num-submatches  (but see emulation code above)
irregex-opt
irregex-quote
irregex-split
make-irregex-chunker
maybe-string-sre   (but see emulation code above)

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

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


Re: [Chicken-users] Backslash-symbol changed from \ to \\ between 4.5.0 and 4.6.0

2010-10-07 Thread Peter Danenberg
Quoth Felix on Setting Orange, the 61st of Bureaucracy:
 See the manual chaprter Non-standard read syntax - Escapes in
 symbols.

Thanks for adding that, Felix.

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


Re: [Chicken-users] Using irregex safely responsibly [Was: Re: dev-snapshot 4.6.3]

2010-10-07 Thread Jim Ursetto
On Thu, Oct 7, 2010 at 15:53, Peter Bex peter@xs4all.nl wrote:
 In your egg's file, where you would previously use this idiom:

 (require-library regex)      ; or (use regex) for the lazy  sloppy
 (import irregex)

 you can now replace it with this block (you can delete emulation of
 procedures you are sure you aren't using):

 (cond-expand
  (total-irregex
  (use irregex))
  (else
  (require-library regex)
  (import (rename irregex
                  (irregex-match-start irregex-match-start-index)
                  (irregex-match-end irregex-match-end-index)))
  (define irregex-num-submatches irregex-submatches)
  (define irregex-match-num-submatches irregex-submatches)
  (define (irregex-match-valid-index? m i)
    (and (irregex-match-start-index m i) #t))
  (define (maybe-string-sre obj)
    (if (string? obj) (string-sre obj) obj

Does this mean for every egg that uses the irregex API directly, I
need to insert this blob of code?

There is some inconsistency in the docs:

irregex-match-num-submatches: Returns the number of numbered
submatches that are defined in the
irregex or match object.
irregex-match-valid-index?: Returns {{#t}} iff the {{index-or-name}}
named submatch or index is defined in the {{match}} object.

But below, *-valid-index? says undefined when *-num-submatches says defined:

#;1 (define m (irregex-search (irregex (abc)|(def)|(ghi)) ghi))
#;2 (irregex-match-num-submatches m)
3
#;3 (irregex-match-valid-index? m 2)
#f

The valid-index? predicate does not return a boolean #t value:

#;9 (irregex-match-valid-index? m 3)
0
#;9 (irregex-match-substring m 3)
ghi

Failure behavior for match-start-index and match-substring is
unspecified in the docs.  The former throws an error and the latter
returns #f:

#;3 (irregex-match-start-index m 2)
Error: (irregex-match-start-index) not a valid index
#regexp-match (3 submatches)
2

#;6 (irregex-match-substring m 2)
#f

I prefer the old behavior for consistency because if irregex tells me
that 3 submatches exist, I expect to be able to access them without an
exception being thrown.

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