Issue #20949 has been updated by Henrik Lindberg.

There are obvious difficulties with the lexing and parsing of the current 
regexp syntax; it can only appear in certain places in the grammar because of 
the ambiguities for the '/' character - is it division or start of regexp. 
There is really no problem in allowing a regexp "pattern" to be a r-value and 
passing it around. In fact, in the work for puppet binder / data in modules 
/arm-8, the type system has Pattern as a first class data object. I think we 
should use a different syntax for it though to make it appear anywhere.

In ARM-8 it is suggested that the syntax `Pattern[<the reguglar expression>]` 
could be used (i.e. a reference to an instance of the Pattern type) - somewhat 
similar to Ruby's `%r{...}` syntax, but more explicit. Other alternatives 
including using something that makes start of regexp non-ambiguous like ~/

Also in ARM-8, since data is expressed in Puppet DSL form, there is no issue in 
expressing it.
Still, the issue with how to express non JSON intrinsic objects without having 
to type everything remains to be designed.

----------------------------------------
Feature #20949: Regexps should be allowed as rvalues
https://projects.puppetlabs.com/issues/20949#change-94696

* Author: Erik Dalén
* Status: Needs Decision
* Priority: Normal
* Assignee: Henrik Lindberg
* Category: parser
* Target version: 
* Affected Puppet version: 
* Keywords: regex rvalue
* Branch: 
----------------------------------------
It would be good to be able to store regexps in variables and pass them to 
functions, classes, defines and resources as parameters.

One problem though is that regexps can't be represented in JSON, so puppetdb 
won't be able to return them as json :(
That is not a problem for function arguments though.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to