chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] Re: #281: promote irregex to full unit


From: Chicken Trac
Subject: [Chicken-janitors] Re: #281: promote irregex to full unit
Date: Sat, 31 Jul 2010 16:42:58 -0000

#281: promote irregex to full unit
-----------------------------------------------------------------------+----
 Reporter:  zbigniew                                                   |       
Owner:  felix   
     Type:  enhancement                                                |      
Status:  accepted
 Priority:  major                                                      |   
Milestone:          
Component:  core libraries                                             |     
Version:  4.5.x   
 Keywords:  regex irregex movin-on-up to-the-east-side deluxe-apt sky  |  
-----------------------------------------------------------------------+----

Comment(by sjamaan):

 I know Ivan has changed abnf a lot (I saw lots of changes when svn
 up'ing), but I don't know what exactly he changed.  I'd have to dig in to
 fix that.  Not sure if it's worth it..

 The irregex errors happen only with the new chicken, and that's because
 irregex now returns an error for nonmatched named submatches. It seems to
 me that that is a bug:

 {{{
 (define m (irregex-match `(or (submatch-named foo "foo")
                               (submatch-named bar "bar"))
                          "foo"))

 (irregex-match-substring m 'foo) => "foo"

 (irregex-match-substring m 'bar) => #f  ;; In Chicken 4.5.0

 (irregex-match-substring m 'bar) => Error: unknown match name: bar ;; In
 total-irregex
 }}}

 This completely breaks backwards compatibility, since I used the fact that
 it returned #f to simplify the code to check for which alternative was
 used:

 {{{
 (or (irregex-match-substring m 'foo) (irregex-match-substring m 'bar))
 }}}

 This would always give me either "foo", "bar" or #f depending on what
 matched, if anything. In code this is very convenient. Much more
 convenient than catching an exception to handle the case where it didn't
 match or requesting all the names and checking whether the match exists
 before extracting it.

 I hope Alex reads this, and can pitch in.

-- 
Ticket URL: <http://www.irp.oist.jp/trac/chicken/ticket/281#comment:18>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]