Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-18 Thread Ask Bjoern Hansen
On Tue, 17 Apr 2001, Tim Bunce wrote: [...] That beautiful code will be beautifully _open_ to _external_ extensions. And that is how I imagine that Perl 5 support should be implemented. Exactly. I am pretty sure that already at the meeting in Monterey someone suggested that Perl5 should

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-17 Thread John Porter
Tim Bunce wrote: If the file doesn't start with Perl 6 thingy then it's Perl 5. Period. To mandate the impossible is to mandate failure. "Nothing can parse perl like Perl." Why is that? My reading of Larry's comments is that it won't be "in" our "new beautiful co

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-17 Thread Dan Sugalski
At 10:16 AM 4/17/2001 +0100, Tim Bunce wrote: On Mon, Apr 16, 2001 at 02:49:07PM -0500, Jarkko Hietaniemi wrote: People seem to think that telling Perl 5 apart from Perl 6 is trivial. My reading of Larry's comments is that it will be _made_ trivial at the file scope level. If the file doesn't

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-17 Thread Larry Wall
Dan Sugalski writes: : At 10:16 AM 4/17/2001 +0100, Tim Bunce wrote: : On Mon, Apr 16, 2001 at 02:49:07PM -0500, Jarkko Hietaniemi wrote: : People seem to think that telling Perl 5 apart from Perl 6 is trivial. : : My reading of Larry's comments is that it will be _made_ trivial at the : file

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-17 Thread Edward Peschko
On Tue, Apr 17, 2001 at 09:23:56AM -0400, John Porter wrote: Tim Bunce wrote: If the file doesn't start with Perl 6 thingy then it's Perl 5. Period. To mandate the impossible is to mandate failure. "Nothing can parse perl like Perl." Why is that? Because perl has a bunch

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Peter Scott
At 12:11 PM 4/16/01 -0400, Dan Sugalski wrote: There are a number of reasons to *not* claim to parse perl 5 code. *) We won't load any perl 5 XS code *) We won't be getting the corner cases, and perl5 has a *lot*. *) It complicates the interpreter if we need to add code to support things

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Dan Sugalski
all sorts of bytecode-compiled languages. :) You want to write the parser for the perl 5 code? (And yes, I do know how inherently silly that question was... :) I want the runtime to be able to handle Python too, but that doesn't mean we're going to be shipping a parser for it. The problems I

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Simon Cozens
On Mon, Apr 16, 2001 at 12:11:41PM -0400, Dan Sugalski wrote: I hereby declare that a package declaration at the front of a file unambiguously indicates you are parsing Perl 5 code. ^^^ Grand. To play devil's advocate here for a moment

Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Dan Sugalski
of Perl.) If the programmer wants perl 5, then he/she/it/they should *use* perl 5. It's not going to rot. ii) Because Larry said so, *and* declared how to do it: I hereby declare that a package declaration at the front of a file unambiguously indicates you are parsing Perl 5 code. If you

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Dan Sugalski
At 05:20 PM 4/16/2001 +0100, Simon Cozens wrote: On Mon, Apr 16, 2001 at 12:11:41PM -0400, Dan Sugalski wrote: I hereby declare that a package declaration at the front of a file unambiguously indicates you are parsing Perl 5 code

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Simon Cozens
On Mon, Apr 16, 2001 at 12:25:15PM -0400, Dan Sugalski wrote: *cough* s/parse/interpret/; Seems a bit of a shame to parse it and then not do anything with it, especially if we're trying to push Perl 6 as a common language runtime for running all sorts of bytecode-compiled languages. :) --

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Jonathan Scott Duff
On Mon, Apr 16, 2001 at 12:19:38PM -0700, Peter Scott wrote: Er, I don't get it. I'm proposing that if perl 6 determines it's been given perl 5 code, it does "exec perl5 $0". So thereafter it's as though perl 6 never existed as far as that code is concerned; whatever it wan

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Nathan Wiger
Dan Sugalski wrote: Besides the size and clunkiness issues, there's another problem. String evals in a perl 5 section of code will expect to be parsed as perl 5, which kinda precludes the whole "compile perl 5 to bytecode and pass it through the p526 converter" solution. Ma

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Dan Sugalski
At 11:50 AM 4/16/2001 -0700, Nathan Wiger wrote: Dan Sugalski wrote: Besides the size and clunkiness issues, there's another problem. String evals in a perl 5 section of code will expect to be parsed as perl 5, which kinda precludes the whole "compile perl 5 to bytecode and

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Dan Sugalski
At 12:19 PM 4/16/2001 -0700, Peter Scott wrote: Or were you espousing the notion that perl 6 programs should be able to contain sections of perl 5 code? That gives me strange palpitations. This is what I've been arguing against. Unless I misunderstand (and it wouldn't be the first time

RE: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread David Whipp
Dan Sugalski wrote At 12:19 PM 4/16/2001 -0700, Peter Scott wrote: Or were you espousing the notion that perl 6 programs should be able to contain sections of perl 5 code? That gives me strange palpitations. This is what I've been arguing against. Unless I misunderstand

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Jarkko Hietaniemi
k and work has been for nothing and we have failed. People seem to think that telling Perl 5 apart from Perl 6 is trivial. In certain special cases, yes, such as the "module"/"class" versus "package" distinction described by Larry, but in the general case that is no

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Dan Sugalski
At 09:47 AM 4/16/2001 -0700, Peter Scott wrote: At 12:11 PM 4/16/01 -0400, Dan Sugalski wrote: There are a number of reasons to *not* claim to parse perl 5 code. *) We won't load any perl 5 XS code *) We won't be getting the corner cases, and perl5 has a *lot*. *) It complicates the interpreter

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Dan Sugalski
At 02:49 PM 4/16/2001 -0500, Jarkko Hietaniemi wrote: Thinking about the 5-6 migration and coexistence is good and useful, but since that doesn't advance the Prime Directive, thinking about it *too* much now or fighting over the niggly details is somewhat wasted effort. We have been stuck in a

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Uri Guttman
"DS" == Dan Sugalski [EMAIL PROTECTED] writes: DS We have been stuck in a sort of Gilbert and Sullivan debate, DS haven't we? Silly, definitely silly. o/' perl6 is the very model of a modern major interpreter o/' :-) uri -- Uri Guttman - [EMAIL PROTECTED] --

Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)

2001-04-16 Thread Edward Peschko
On Mon, Apr 16, 2001 at 03:23:04PM -0400, Dan Sugalski wrote: At 12:19 PM 4/16/2001 -0700, Peter Scott wrote: Or were you espousing the notion that perl 6 programs should be able to contain sections of perl 5 code? That gives me strange palpitations. This is what I've been arguing against

Re: Perl 5 compatibility (Re: Larry's Apocalypse 1)

2001-04-06 Thread Dave Storrs
On Thu, 5 Apr 2001, John Porter wrote: Nathan Wiger wrote: the more compatible with Perl5 Perl6 is, the more likely it is to be accepted. I don't believe that's necessarily true. If Perl6 proves to be a significantly better Perl than Perl5, people will adopt it, especially if they're

Re: Perl 5 compatibility (Re: Larry's Apocalypse 1)

2001-04-06 Thread John Porter
Dave Storrs wrote: being backwards compatible is unlikely to _cost_ us adherents and might well gain us some. Yes, all other things being equal. But will they be? IOW: at what cost backwards compatibility? -- John Porter

Perl 5 compatibility (Re: Larry's Apocalypse 1)

2001-04-05 Thread Nathan Wiger
nds in 6. Yep, something like this would be cool. But as Dan suggested we'll probably have to let Larry clarify his intent here. I read it as "it would be cool to assume that we're getting real Perl 5 code", rather than as just assuming Perl 5 non-strict policies, but actual Perl 6 co

Re: Perl 5 compatibility (Re: Larry's Apocalypse 1)

2001-04-05 Thread John Porter
Nathan Wiger wrote: the more compatible with Perl5 Perl6 is, the more likely it is to be accepted. I don't believe that's necessarily true. If Perl6 proves to be a significantly better Perl than Perl5, people will adopt it, especially if they're inclined toward the Perl philosophy anyway. (And

Re: Perl 5 compatibility (Re: Larry's Apocalypse 1)

2001-04-05 Thread Dan Sugalski
cool to assume that we're getting real Perl 5 code", rather than as just assuming Perl 5 non-strict policies, but actual Perl 6 code. I agree with Ed that, if you think about it, parsing Perl 5 in the Perl 6 detachable-lexer-parser model shouldn't (hopefully) be any harder than parsing Python

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-16 Thread brian d foy
On Fri, 15 Dec 2000, Deven T. Corzine wrote: On 15 Dec 2000, Randal L. Schwartz wrote: "Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven As for special-case rules, I believe that my proposed modification would Deven REMOVE a special-case semantic rule, at the cost of added

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-16 Thread brian d foy
On Fri, 15 Dec 2000, Deven T. Corzine wrote: If we want the first interesting match, and we're preferring early matches and short matches, I believe that "bd" is more interesting. then write a regex that describes that pattern. the pattern is one b followed by

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-16 Thread brian d foy
On Fri, 15 Dec 2000, Simon Cozens wrote: On Fri, Dec 15, 2000 at 11:39:08AM -0800, Randal L. Schwartz wrote: Tell me how you can do that without breaking much existing code. Pssst, Randal, this is Perl 6, not p5p. well, we do have to translate 95% of that code to Perl 6 without a hitch. i

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread brian d foy
On Thu, 14 Dec 2000, Deven T. Corzine wrote: Here is a simple example: (tested with perl 5.005_03) $_ = ""; ($greedy) = /(b.*d)/; # "" (correct) ($non_greedy) = /(b.*?d)/; # "d" (should be "bd"!) Does anyone

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On Thu, 14 Dec 2000, Nathan Torkington wrote: Deven T. Corzine writes: I haven't even SEEN an example where the current behavior is actually preferable than my proposed behavior, have you? (And I'd expect at least a FEW, though I suspect there are probably more counterexamples.) I

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On Fri, 15 Dec 2000, Jonathan Scott Duff wrote: On Fri, Dec 15, 2000 at 01:13:13PM -0500, Deven T. Corzine wrote: Not at all. I don't want it to keep looking after it finds the first match. I want it to make sure that match isn't unnecessarily long, if non-greedy matching was in use.

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Randal L. Schwartz
"Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven What surprised me was how vigorously people would defend the Deven status quo, and insist on the correctness of the current Deven behavior without thinking it through. No, I thought it through quite completely. As have others. Deven

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Randal L. Schwartz
"Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven As for special-case rules, I believe that my proposed modification would Deven REMOVE a special-case semantic rule, at the cost of added complexity at the Deven implementation level. (The cost decision of whether that added complexity

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Uri Guttman
"DTC" == Deven T Corzine [EMAIL PROTECTED] writes: DTC The pattern in question is "b.*?d". Obviously, this matches "b", DTC followed by something else, followed by "d". What "something DTC else" should be is the issue at hand. That portion of the regexp DTC is just ".*?" -- the "."

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On Thu, 14 Dec 2000, Jarkko Hietaniemi wrote: On Thu, Dec 14, 2000 at 04:19:15PM -0700, Nathan Torkington wrote: Deven T. Corzine writes: I haven't even SEEN an example where the current behavior is actually preferable than my proposed behavior, have you? (And I'd expect at least a

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
affects relatively few regexps. What surprised me was how vigorously people would defend the status quo, and insist on the correctness of the current behavior without thinking it through. Maybe I should have expected this -- it's probably an old debate people are tired of having. But if there's ever

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Jarkko Hietaniemi
Please give it a rest. I think everybody got it by now. Everybody understands how the current implementation works and what the semantics are, and you disagree with the current semantics. I think that's the end of story since changing current default semantics is simply not an option. We

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Kevin Walker
"Deven T. Corzine" [EMAIL PROTECTED] writes: I've yet to see a concrete example of where the current behavior is helpful, What about matching C comments? ($first_comment) = $code =~ m!(/\*.*?\*/)!s; # (ignore issues with quoted strings in $code Works correctly under the current

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Jarkko Hietaniemi
More generally, it seems to me that you're hung up on the description of "*?" as "shortest possible match". That's an ambiguous Yup, that's a bit confusing. It's really "start matching as soon as possible, and stop matching as soon as possible". (The usual greedy one is, of course, "keep

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
ld make regex in Perl entirely unlike the regex in every other language. Not gonna happen. I've NEVER seen non-greedy matching in any other regular expression system before Perl 5 introduced it. Ever since then, I've only seen it in other systems that imitate (or use outright) Perl's regex

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
I made a mistake in phrasing it this way, because it seemed to suggest that I thought it was an implementation bug that it returns "d" instead of "bd". I didn't make it clear that I was trying to approach this as a purely SEMANTIC question, considered in isolation from the

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On 15 Dec 2000, Randal L. Schwartz wrote: "Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven As for special-case rules, I believe that my proposed modification would Deven REMOVE a special-case semantic rule, at the cost of added complexity at the Deven implementation level.

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
ed on Perl 4's magic behavior with @'s in double-quoted strings, yet Perl 5 broke them all with a fatal error during the compile phase. People survived. They adapted and moved on. Unlike that incompatibility, this one would probably affect few programs. I'm likely to give up this battle and move o

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
, and the "leftmost" behavior is 100% consistent with greedy matching. Nope. These are orthogonal, unrelated concpets. Yet Perl 5 added non-greedy modifiers, changing a fundamental aspect of every preceding regex system, and still called it a regex... Whether a match should be minimal or maximal

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Kevin Walker
I wrote: More generally, it seems to me that you're hung up on the description of "*?" as "shortest possible match". That's an ambiguous simplification of what "*?" means. It might better be described as "match until you find a match for the rest of the regex" ('d' in your example). If

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
I want the maximum level of OVERALL consistency for regular expressions as We're there, thank you very much. "Find a match" is the over-riding sentiment, the principle semantic. It is completely consistent with this. You've got greed/nongreed very wrong. a whole, rather than immutable

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On Thu, 14 Dec 2000, James Mastros wrote: On Thu, Dec 14, 2000 at 04:10:12PM -0500, Deven T. Corzine wrote: The crux of the problem is that non-greedy qualifiers don't affect the "earliest match" behavior, which makes the matches more greedy than they really ought to be. Right. We've

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On Fri, 15 Dec 2000, Deven T. Corzine wrote: Not at all. I don't want it to keep looking after it finds the first match. I want it to make sure that match isn't unnecessarily long, if non-greedy matching was in use. Conceptually (I don't think this would be a good implementation), you

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
Really? I haven't taken a survey, but I did ask one co-worker for his first impression of what the regexp (from my example) would match. Not being an experienced Perl programmer, but being familiar with regular expressions, he believed he understood the idea of non-greedy matching. His

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Simon Cozens
On Fri, Dec 15, 2000 at 11:39:08AM -0800, Randal L. Schwartz wrote: Tell me how you can do that without breaking much existing code. Pssst, Randal, this is Perl 6, not p5p. -- "There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence." -

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
y we could. Maybe we shouldn't, but we could do it. Many, many existing programs depended on Perl 4's magic behavior with @'s in double-quoted strings, yet Perl 5 broke them all with a fatal error during the compile phase. People survived. They adapted and moved on. Red herring. Unlike that incom

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On Fri, 15 Dec 2000, Tom Christiansen wrote: Actually, I'm not sure -- it's conceivable that the ending point would ALSO move inward for a different starting point within the original match. But the ending point should NEVER be advanced further -- that's where the "leftmost over nongreedy"

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On Fri, 15 Dec 2000, Simon Cozens wrote: On Fri, Dec 15, 2000 at 11:39:08AM -0800, Randal L. Schwartz wrote: Tell me how you can do that without breaking much existing code. Pssst, Randal, this is Perl 6, not p5p. That's why I never suggested fixing it in Perl 5 -- the chance of breaking

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
Actually, I'm not sure -- it's conceivable that the ending point would ALSO move inward for a different starting point within the original match. But the ending point should NEVER be advanced further -- that's where the "leftmost over nongreedy" rule should apply instead... Please show us your

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
On Fri, 15 Dec 2000, Tom Christiansen wrote: As for special-case rules, I believe that my proposed modification would REMOVE a special-case semantic rule, at the cost of added complexity at the implementation level. What is this alleged "special-case rule" you are talking about? There

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Nathan Torkington
Tom Christiansen writes: We may have to "agree to disagree". I shan't be doing that. I think you should, or at least agree to take it private and report back to the list once you both come to a decision. Once you've stated your position twice, there's not really much point in saying it a

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
l 4's magic behavior with @'s in double-quoted strings, yet Perl 5 broke them all with a fatal error during the compile phase. People survived. They adapted and moved on. Red herring. Counterexample to the assumption that we can't break existing code by changing the semantics. It's been done bef

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
become one. I'd like to make sure that everyone, Deven, Tom, and the rest of the list, relax and realize that it's just a programming language. This _is_ a minor issue. I'm very much looking forward to Perl 6; since Perl 5 is such a joy to use, I fully expect Perl 6 to be even better. And I'l

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On Fri, 15 Dec 2000, Tom Christiansen wrote: You can't explain why "d" matches without making reference to the absolute priority of the leftmost rule. "bd" would still make sense (locally) without reference to that rule. Nope. Nope, nope, and nope. Th8is /d/

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
That would be a strange regexp, but I never suggested it. I suggested the regexp /b.*?d/ and pointed out that I believe "bd" is a more intuitive match than "d". That was the matching text, not the regexp, sorry if I didn't make that clear. Fine. What you said is first

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
At worst, this should take no more than double the amount of time that the single pass did, probably less. Hardly a cause to concern ourselves with the heat death of the universe. Oh really? We have shown that for the kind of global overall analysis that you are asking for, that in the general

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
More generally, it seems to me that you're hung up on the description of "*?" as "shortest possible match". That's an ambiguous Yup, that's a bit confusing. It's really "start matching as soon as possible, and stop matching as soon as possible". (The usual greedy one is, of course, "keep

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
Have you thought it through NOW, on a purely semantic level (in isolation from implementation issues and historical precedent), I've said it before, and I'll say it again: you keep using the word "semantic", but I do not think you know what that word means. --tom

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Tom Christiansen
Take. It. To. Private. Email. Please. I'm going to do better. I'm taking it to /dev/null. It's not worth my wasting my life over. Nobody agrees with this guy, so it doesn't matter. --tom

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
On Fri, 15 Dec 2000, Tom Christiansen wrote: At worst, this should take no more than double the amount of time that the single pass did, probably less. Hardly a cause to concern ourselves with the heat death of the universe. Oh really? We have shown that for the kind of global overall

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Simon Cozens
On Fri, Dec 15, 2000 at 05:20:35PM -0500, Deven T. Corzine wrote: It's a pattern, not a program. Yes, it's straightforward to treat it as a step-by-step procedure for matching that pattern, but by doing so, you lose something of the gestalt of the whole. You may deal in patterns, but

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-15 Thread Deven T. Corzine
precedent is a always a justification not to change anything. Of course, that argued against the wonderful regex extensions that Perl 5 added, since they went against the way "it's always been"... 1) It is obviously faster to come to an answer earlier on in the execution tha

Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Deven T. Corzine
Non-greedy matching is a very valuable Perl 5 regular expression feature that simplifies many regular expressions. However, early on I discovered what seems to be a failure of the mechanism -- matches were MORE greedy than necessary. I'm not sure if other people noticed this, or just failed

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Tom Christiansen
Does anyone disagree with the premise, and believe that "d" is the CORRECT match for the non-greedy regexp above? Yes. The Camel's regex chapter reads: You might say that eagerness holds priority over greed (or thrift). For what it's worth, here's a quote from a Perl 5.005_03

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Nathan Torkington
Deven T. Corzine writes: I haven't even SEEN an example where the current behavior is actually preferable than my proposed behavior, have you? (And I'd expect at least a FEW, though I suspect there are probably more counterexamples.) I think the biggest problem with your idea is that it

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Jarkko Hietaniemi
On Thu, Dec 14, 2000 at 04:19:15PM -0700, Nathan Torkington wrote: Deven T. Corzine writes: I haven't even SEEN an example where the current behavior is actually preferable than my proposed behavior, have you? (And I'd expect at least a FEW, though I suspect there are probably more

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Tom Christiansen
d likewise *be* different. I didn't need the long-winded explanation, and I don't need help with understanding how that regexp matches what it does. I understand it perfectly well already. I'm no neophyte with regular expressions, even if Perl 5 does offer some regexp features I've never bothered

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Randal L. Schwartz
"Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven I'm not pushing for this to be fixed in Perl 5; it's been out Deven there long enough, and there's no point worrying about it in Deven that version. But that doesn't mean that the same design flaw Deven should be kept in Pe

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Randal L. Schwartz
"Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven I haven't even SEEN an example where the current behavior is Deven actually preferable than my proposed behavior, have you? (And Deven I'd expect at least a FEW, though I suspect there are probably Deven more counterexamples.) If I

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Deven T. Corzine
nded explanation, and I don't need help with understanding how that regexp matches what it does. I understand it perfectly well already. I'm no neophyte with regular expressions, even if Perl 5 does offer some regexp features I've never bothered to exploit... My point is that the current

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Deven T. Corzine
This workaround DOES work, but it wouldn't be necessary in the first place if the design of the regular expression didn't have this subtle flaw to begin with. (And not all regexps will be so trivially patched up, either.) I'm not pushing for this to be fixed in Perl 5; it's been out the

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Jeff Pinyan
On Dec 14, Deven T. Corzine said: You're asking for something like /(?!b)(b.*?d)/ which is an "optimization" you'll have to incorporate on your own. Thanks for the example. Unfortunately, your attempted workaround doesn't even work for the example string; the "a" preceding "d"

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Deven T. Corzine
ble than my proposed behavior, have you? (And I'd expect at least a FEW, though I suspect there are probably more counterexamples.) This is certainly a minor issue, but I believe the design is flawed in the current Perl 5 implementation; why not fix the design properly for Perl 6? Deven

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Nathan Wiger
($greedy) = /(b.*d)/; # "" (correct) ($non_greedy) = /(b.*?d)/; # "d" (should be "bd"!) I'm sure this will complicate the NFA for the regexp, but it seems like this really ought to be fixed, at least in Perl 6. (There's a good case t

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Jeff Pinyan
On Dec 14, Randal L. Schwartz said: Deven I haven't even SEEN an example where the current behavior is Deven actually preferable than my proposed behavior, have you? (And Deven I'd expect at least a FEW, though I suspect there are probably Deven more counterexamples.) If I want the leftmost B

Re: Perl 5's non-greedy matching can be TOO greedy!

2000-12-14 Thread Deven T. Corzine
Oh, my. I fear I may have ruffled some feathers here. I apologize; I was hoping to spark a debate, not a flame war. Could we all please take a step back and cool off for a bit, and not let this get personal? I'm afraid it may seem like I'm ranting about Perl 5's regular expressions, when I

Re: a syntax derived from constant-time hash-based n-dim matrices in perl 5

2000-09-02 Thread c . soeller
"David L. Nicol" wrote: Nathan Wiger wrote: Well, this is not bad, only it's not without its problems. Say you wanted to get your indices implicitly: @a[getindices()]; @a[$r-get_x, $r-get_y]; @a["@{\(getindices())}"]; @a[join $",$r-get_x, $r-get_y];

Re: a syntax derived from constant-time hash-based n-dim matrices in perl 5

2000-09-01 Thread David L. Nicol
Nathan Wiger wrote: Well, this is not bad, only it's not without its problems. Say you wanted to get your indices implicitly: @a[getindices()]; @a[$r-get_x, $r-get_y]; @a["@{\(getindices())}"]; @a[join $",$r-get_x, $r-get_y]; Either of these could return an

Re: a syntax derived from constant-time hash-based n-dim matrices in perl 5

2000-09-01 Thread Karl Glazebrook
"David L. Nicol" wrote: Nathan Wiger wrote: Well, this is not bad, only it's not without its problems. Say you wanted to get your indices implicitly: @a[getindices()]; @a[$r-get_x, $r-get_y]; @a["@{\(getindices())}"]; @a[join $",$r-get_x, $r-get_y];

Re: a syntax derived from constant-time hash-based n-dim matrices in perl 5

2000-08-31 Thread David L. Nicol
Nathan Wiger wrote: "David L. Nicol" wrote: @a["$i $j $k","$a $y $z"] # two points in DN n-dim syntax One problem that immediately jumps out at me is how to do this: @a[[@x], [@y]]; That is, dynamically get your indices. The above seems ok when you know them in

a syntax derived from constant-time hash-based n-dim matrices in perl 5

2000-08-31 Thread David L. Nicol
Jeremy Howard wrote: That's true. I still think it's confusing to have such similar syntaxes mean such different things. I'd also like to be able to say: @a[[$i,$j,$k], [$x,$y,$z]] to get two points. Just in case anyone isn't aware of this: using a "stuff'em into hash keys" N-dim

<    1   2   3   4