GNU bug report logs -
#50136
28.0.50; A problem with rx-let expansion
Previous Next
Full log
View this message in rfc822 format
20 aug. 2021 kl. 15.59 skrev Michael Heerdegen <michael_heerdegen <at> web.de>:
> (rx-let ((scatter (string)
> (regex (mapconcat #'string (string-to-list string) ".*"))))
> (rx (scatter "abc"))) => useless error message
Yes, that's an unfortunate consequence of the current substitution mechanism (validating Stefan's premonitions to some extent).
However the syndrome is entirely avoidable and does not make the facility less powerful.
> Personally I would be more happy with a thing called `rx-macrolet' than
> with an extended `rx-let' to support this additional macro-like kind of
> syntax.
Noted (in the honest sense)!
> AFAIU, the current approach doesn't allow to extend this with an
> optional CHARS argument to specify with chars are allowed "in between"
> (instead of "any"). The "&optional" keyword makes it barf.
That's right. What would be the preferred semantics? For example, what value would you expect an absent optional parameter to take? `nil` isn't very useful inside rx forms, so it would only make sense inside embedded Lisp expressions.
> And I can't actually "look" at the arguments to provide a conditional
> replacement. All I can do is to use `regex' to eval a constant
> expression I specify (at run-time). This seems a quite limiting
> approach. Something more macro-like would be appropriate IMO.
Actually it's the rx `eval` form that you are looking for if you want arbitrary compile-time computation. `regexp` and `literal` are explicitly made for run-time expressions.
This bug report was last modified 3 years and 273 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.