-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Moin Ãvar, On Tuesday 10 April 2007 04:14:19 Ãvar Arnfjörð Bjarmason wrote: > This incomplete patch shows the direction I'm going with this. > > I added two new callbacks for numbered capture vars and gave the > existing one a new name. Now there's store/fetch/length for $1 where > store croaks if assigned to. This means that one can write engines > where C<$1 = "one"> works as expected (depending on what you expect of > course). The logic in Perl_magic_len() was moved to a `length' > callaback that can be overridden. > > I've also added callbacks to allow the regexp engine itself to > implement a tie interface for %+ and %-. These aren't working at the > moment but when they are the code that's currently in NamedCapture.pm > and universal.c will be part of the regex engine. > > I'm going to polish the interface a little, like putting all the > named/numbered callacks in their own struct and make that a member of > the regexp_engine struct. That way other engines can just drop in a > macro to use the default behavior. The protototypes on the callbacks > also need some going over, and I have to look better at magic hashes > so that I can get %+ and %- to work properly like $1 et al. [snip] > But once this is all done there should be a pretty sane regex api in > core that re::engine::Plugin and others can target. Comments?:) I can't comment much on this (I bet in a few years we know better :), however I would like to ask you to consider not to use too-strict prototypes. For instance, exp() expects *exactly* one argument, so even when you overload exp(), you cannot do: exp($a,12); which is a limitation in the interface. Not sure if this applies to your work, but please consider that a future use might use more parameters :) all the best, tels PS: good work! - -- Signed on Tue Apr 10 19:24:58 2007 with key 0x93B84C15. View my photo gallery: http://bloodgate.com/photos PGP key on http://bloodgate.com/tels.asc or per email. "You know the world is going crazy when the best rapper is a white guy, the best golfer is a black guy, the tallest guy in the NBA is Chinese, the Swiss hold the America's Cup, France is accusing the U.S. of arrogance, Germany doesn't want to go to war, and the three most powerful men in America are named 'Bush', 'Dick', and 'Colon'. Need I say more?" -- Chris Rock -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iQEVAwUBRhvlNXcLPEOTuEwVAQI09Af8DZ6ZnGhBlk3tlSoqHPQuh52i851kGZUg A1ygfs3J4sg0G7aXWYI+C+PNsXzK5eGFO4ny2hwrKMBH884mrQ5vjlpiri3Z1WuD cBfPaLJkNe8aPaBUOI7vLEI6J4kVX4ZV+q+gi6ckJZuEMUxTmcYPSLrYyqkjuFEd AjwfTbU2Zr/+WKuCycvJRk0vQBA7PkTxlUL4Ut4IM7Od3PCY2ZUto7Rp1r8LTh+m uTn1et/tzv3eeOUfHzdu6lZn7PMKDccZg4TGMhMV6py94mjzqCUyMAaKuI/UpB7p Oy6Gx99A4C33dm1y23pvAwsVOeH2ePMrwHw8ToWkMDlUpA/wqn3FFw== =4nUA -----END PGP SIGNATURE-----Thread Previous | Thread Next