Ilya Zakharevich said:
[A complimentary Cc of this posting was sent to
Anno Siegel
I know better than to accuse you of making no sense, but please, in what
*sense* are they part of the regex? Textually they aren't. That is what
the user sees.
Assume that separation into "the REx" and "the operator which uses the
REx" makes some sense (one could say: it is just a script, and I do not
care what happens inside this script; it would be hard to discuss this
topic with such a person, right? And in some situations this point of
view is very productive...).
Insightful, yes. Productivity depends on what you want to produce. In
the context of clpm, I'm interested in a terminology that is useful in
discussing Perl programs. As such, its distinctions should be as obvious
as possible. It is useful to distinguish the regex proper from the
operators that use it (m//, s///, qr//). At the surface of things,
the modifiers are clearly part of the operators, not only textually, but
also because the operator determines which modifiers are possible.
I think, for everyday discourse it is wisest to go with that concept.
A terminology that carefully distinguishes between modifiers that are
part of the regex and others that truly belong to the operator may
carry deeper insight, but it is impractical.
If we draw the separation line according to implementation, then the
modifiers 's', 'm', 'i', 'x' modify the match REx, while other
/g also modifies the match in scalar context.
modifiers modify the operator which will do the match. Of course,
infinitely many other ways to pass this line may be chosen; however,
one I choose is the only one which has some pseudo-objective ground. ;-)
I'll rather stick to the hard facts of syntax, even if they lie about
the deeper reality of implementation. Taken to an extreme, we couldn't
discuss a program without first de-parsing it. That is not a direction
I want to go.
If you think so straight as you pretend ;-), try to spell out where
this 'm' belongs to in this example:
print for split m(foo), qw(bar), -1;
Now you've lost me again. What has the role of 'm' in the split expression
to do with the distinctions among the /gmisox... modifiers?
Of course there is something strange about the first parameter of split(),
it is not evaluated like a function parameter would (and split() doesn't
have a prototype). As far as I'm concerned, that's a peculiarity of the
syntax introduced by the keyword "split" and has little to do with regular
expressions and their operators.
Anno