Remember that it's only in the general case that you can't
solve the halting problem. Many specific cases are easy to
solve, and things can be designed to make it easier to solve
those cases. In this particular case you'll note that,
unlike Perl 5's dynamic scoping of the current successful match, Perl 6 makes $0 lexically scoped. That makes it pretty easy to tell how you've used $0 and its progeny within a particular block. Furthermore, the opaque $0 object is really not much more complicated than Perl 5's hidden match object. For most of the match, you've got to keep track of your state somewhere anyway. Perl 6 will undoubtedly do the same trick as Perl 5, and produce $1, $2,
etc. lazily from the information.
Named captures are really no different in that respect. The name is really representing an offset into a capture table, and no hash is ever really built, except to hold the symbol at compile time. Perl 6 also will likely escape the $& problem by
using copy-on-write semantics generally. | [reply] |
You mean, perl6 won't have eval?
Abigail
| [reply] [d/l] |
Perl 6 will have eval. Some of the things you can do with regexes will cause some speed degradations--there's nothing much for it. If enabled, some functionality will also be conditionally optimized, such that if a feature isn't known to be needed at compile time, it'll be optimized away and not available to evals later.
Yes, you can turn this behaviour off, in which case the slower way will be used, which is fine. (As it's what you asked for) Which will be the default way is up to Larry.
| [reply] |