Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Tue, Mar 18, 2003 at 09:28:43PM -0700, Luke Palmer wrote: Plan 1: Pass each rule a Isuccess continuation (rather than a backtrack one), and have it just return on failure. The big difference between this and your example is that Clets are now implemented just like Ctemps. Too bad Clet needs

Re: A6: Quick questions as I work on Perl6::Parameters

2003-03-19 Thread Nicholas Clark
On Wed, Mar 19, 2003 at 10:34:26AM +1100, Damian Conway wrote: Brent Dax wrote: First of all, Larry, do you have *any* idea how difficult you're making my life? :^) This stuff is damn hard to implement--I'm at 450 lines and counting, and I haven't even started the semantic analysis

A6, parameters

2003-03-19 Thread Ralph Mellor
If one deploys a sub with optional-positional parameters, one can't add a required parameter later without breaking any existing calls that make use of any o-p parameters. Right? A6: An rw parameter may only default to a valid lvalue. If you find yourself wanting it to default to an ordinary

Re: A6: Quick questions as I work on Perl6::Parameters

2003-03-19 Thread Matthijs van Duin
On Tue, Mar 18, 2003 at 11:36:13PM +, Simon Cozens wrote: Seriously, someone on IRC the other day was claiming that they already had a P6RE-in-P5 implementation, and did show me some code, but I've forgotten where it lives or their real name. http://www.liacs.nl/~mavduin/P6P5_0.00_01.tar.gz

Re: Statement modifiers (yes, again)

2003-03-19 Thread Matthijs van Duin
On Tue, Mar 18, 2003 at 08:53:23PM -0700, Luke Palmer wrote: How is a left-associative operator less special than a non-associative one? Ehm, most operators in perl are left-associative, so you probably mean R2L short-circuiting but even then I'm not sure what you're trying to say here And you

random code snippet (cooperative threading)

2003-03-19 Thread Matthijs van Duin
I recently fiddled around a bit with how one might implement cooperative threading in perl 6 using call-with-current-continuation (callcc), so I thought I'd share it with you (since continuations are often poorly understood, more examples is always better :-) This is assuming callcc exists

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Leopold Toetsch
Matthijs van Duin wrote: Which system is likely to run faster on parrot? I would propose, estimate the ops you need and test it :) E.g. call a continuation 1e6 times and communicate state with one global (a lexical is probably the same speed, i.e. a hash lookup) $ cat a.pasm new P5,

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 10:38:54AM +0100, Leopold Toetsch wrote: I would propose, estimate the ops you need and test it :) Hmm, good point Or even better.. I should just implement both examples and benchmark them; they're simple enough and the ops are available. I guess it's time to familiarize

Re: is static?

2003-03-19 Thread Angel Faus
block. Perhaps we should just go with that: property $foo = 0; Or whatever word we choose, I don't care: prop $foo = 0; What about: prof $foo; $foo = 0; Is this equivalent to prof $foo = 0? If it is not, I would claim this to be a major violation of the principle of

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 01:01:28PM +0100, Matthijs van Duin wrote: On Wed, Mar 19, 2003 at 10:38:54AM +0100, Leopold Toetsch wrote: I would propose, estimate the ops you need and test it :) Hmm, good point Or even better.. I should just implement both examples and benchmark them; they're simple

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 10:38:54AM +0100, Leopold Toetsch wrote: I would propose, estimate the ops you need and test it :) I haven't completed testing yet, however it's becoming clear to me that this is likely to be a pointless effort There are so many variables that can affect performance here

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 10:05 AM +0100 3/19/03, Matthijs van Duin wrote: But.. say you have: foo bar Would would this be implemented? When bar fails, it needs to backtrack into foo, which has already returned. Are you saying every rule will be an explicit state machine? By compile-time interpolation. foo isn't

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 10:40:02AM -0500, Dan Sugalski wrote: By compile-time interpolation. foo isn't so much a subroutine as a macro. For this to work, if we had: foo: \w+? bar: [plugh]{2,5} then what the regex engine *really* got to compile would be: (\w+?) ([plugh]{2,5}) with names

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 4:52 PM +0100 3/19/03, Matthijs van Duin wrote: On Wed, Mar 19, 2003 at 10:40:02AM -0500, Dan Sugalski wrote: By compile-time interpolation. foo isn't so much a subroutine as a macro. For this to work, if we had: foo: \w+? bar: [plugh]{2,5} then what the regex engine *really* got to

Re: is static?

2003-03-19 Thread Larry Wall
On Wed, Mar 19, 2003 at 01:18:48PM +0100, Angel Faus wrote: : Is this equivalent to prof $foo = 0? If it is not, I would claim : this to be a major violation of the principle of minor surprise. :-) : Maybe it would be saner to use: : : prop $foo is default(0); I suspect you mean

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 11:09:01AM -0500, Dan Sugalski wrote: At the time I run the regex, I can inline things. There's nothing that prevents it. Yes, at compile time it's potentially an issue, since things can be overridden later, OK, but that's not how you initially presented it :-) you

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Leopold Toetsch
Matthijs van Duin wrote: sweepoff# or bus error collectoff# or segmentation fault Please try : /* set this to 1 for tracing the system stack and processor registers */ #define TRACE_SYSTEM_AREAS 1 in dod.c (works for me). Though I don't know, if processor registers on PPC gets

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Jonathan Scott Duff
On Wed, Mar 19, 2003 at 11:09:01AM -0500, Dan Sugalski wrote: By the time the regex is actually executed, it's fully specified. By definition if nothing else--you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. Or, rather, you can but the update

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Sean O'Rourke
On Wed, 19 Mar 2003, Jonathan Scott Duff wrote: Are you implying that $fred = rx/fred/; $string ~~ m:w/ $fred { $fred = rx/barney/; } rubble / won't match barney rubble? Or, worse, that $fred = rx/fred/; $string ~~ m:w/ { $fred = rx/barney/; } $fred rubble /

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 10:41 AM -0600 3/19/03, Jonathan Scott Duff wrote: On Wed, Mar 19, 2003 at 11:09:01AM -0500, Dan Sugalski wrote: By the time the regex is actually executed, it's fully specified. By definition if nothing else--you aren't allowed to selectively redefine rules in the middle of a regex that

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 5:38 PM +0100 3/19/03, Matthijs van Duin wrote: On Wed, Mar 19, 2003 at 11:09:01AM -0500, Dan Sugalski wrote: At the time I run the regex, I can inline things. There's nothing that prevents it. Yes, at compile time it's potentially an issue, since things can be overridden later, OK, but

Re: A6, parameters

2003-03-19 Thread Larry Wall
On Tue, Mar 18, 2003 at 02:46:17PM -0600, Ralph Mellor wrote: : If one deploys a sub with optional-positional parameters, : one can't add a required parameter later without breaking : any existing calls that make use of any o-p parameters. : Right? Correct. : A6: An rw parameter may only default

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Simon Cozens
[EMAIL PROTECTED] (Dan Sugalski) writes: you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. This is precisely what a macro does. -- How should I know if it works? That's what beta testers are for. I only coded it. (Attributed to Linus Torvalds,

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 5:47 PM + 3/19/03, Simon Cozens wrote: [EMAIL PROTECTED] (Dan Sugalski) writes: you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. This is precisely what a macro does. Not once execution starts, no. --

Re: A6 Request: Change .req to .arity

2003-03-19 Thread Steffen Mueller
Damian Conway wrote: Larry wrote: On the other hand, I could see an argument that said anyone who doesn't know what .arity means shouldn't be writing routines that depend on it... That was more or less my line of thought. Now, I think I'll dare claim my English is not exactly bad for a 21

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Simon Cozens
[EMAIL PROTECTED] (Dan Sugalski) writes: At 5:47 PM + 3/19/03, Simon Cozens wrote: [EMAIL PROTECTED] (Dan Sugalski) writes: you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. This is precisely what a macro does. Not once execution

Re: A6: Named vs. Variadic Parameters

2003-03-19 Thread Larry Wall
On Sat, Mar 15, 2003 at 06:46:21PM -0800, mlazzaro wrote: : Luke Palmer wrote: : : The idea is that positional parameters are always a contiguous : sequence in the argument list. If it looked like this: : : sub foo($x, ?$y, +$k, [EMAIL PROTECTED]) {...} : : Then one might presume to

Re: A6 Request: Change .req to .arity

2003-03-19 Thread Paul
--- Steffen Mueller [EMAIL PROTECTED] wrote: Damian Conway wrote: Larry wrote: On the other hand, I could see an argument that said anyone who doesn't know what .arity means shouldn't be writing routines that depend on it... That was more or less my line of thought. Now, I

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 5:54 PM + 3/19/03, Simon Cozens wrote: [EMAIL PROTECTED] (Dan Sugalski) writes: At 5:47 PM + 3/19/03, Simon Cozens wrote: [EMAIL PROTECTED] (Dan Sugalski) writes: you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. This is

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Simon Cozens
[EMAIL PROTECTED] (Dan Sugalski) writes: Compilation's just execution of a regex, albeit the Perl6::Grammar::program regex, and that regex will need to be modified while it's in operation in order to pick up macro is parsed definitions and apply them to the rest of what it's parsing. Ah,

Re: A6 Request: Change .req to .arity

2003-03-19 Thread Austin Hastings
--- Paul [EMAIL PROTECTED] wrote: --- Steffen Mueller [EMAIL PROTECTED] wrote: Damian Conway wrote: Larry wrote: On the other hand, I could see an argument that said anyone who doesn't know what .arity means shouldn't be writing routines that depend on it... That was

Re: A6 Request: Change .req to .arity

2003-03-19 Thread Larry Wall
On Wed, Mar 19, 2003 at 04:38:51PM +0100, Steffen Mueller wrote: : Damian Conway wrote: : Larry wrote: : : On the other hand, I could see an argument that said anyone who : doesn't know what .arity means shouldn't be writing routines that : depend on it... : : That was more or less my line of

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 12:35:19PM -0500, Dan Sugalski wrote: Then I wasn't clear enough, sorry. This is perl -- the state of something at compile time is just a suggestion as to how things ultimately work. Yes, hence my surprise about actually inlining stuff, luckily that was just a

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 8:04 PM +0100 3/19/03, Matthijs van Duin wrote: On Wed, Mar 19, 2003 at 12:35:19PM -0500, Dan Sugalski wrote: I'll nudge Larry to add it explicitly, but in general redefinitons of code that you're in the middle of executing don't take effect immediately, and it's not really any different for

Re: A6: Named vs. Variadic Parameters

2003-03-19 Thread Michael Lazzaro
On Wednesday, March 19, 2003, at 09:58 AM, Larry Wall wrote: : sub foo($x, [EMAIL PROTECTED], +$k) {...}# (2) OK Fine, you can set @a using positional notation, like push(), in addition to the notations available to (1). But if you set k =, it has to be before the list, unless you pass

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 02:31:58PM -0500, Dan Sugalski wrote: Well, I'm not 100% sure we need it for rules. Simon's point is well-taken, but on further reflection what we're doing is subclassing the existing grammar and reinvoking the regex engine on that subclassed grammar, rather than

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 9:14 PM +0100 3/19/03, Matthijs van Duin wrote: On Wed, Mar 19, 2003 at 02:31:58PM -0500, Dan Sugalski wrote: Well, I'm not 100% sure we need it for rules. Simon's point is well-taken, but on further reflection what we're doing is subclassing the existing grammar and reinvoking the regex

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 03:46:50PM -0500, Dan Sugalski wrote: Right. Macro definition ends, you subclass off the parser object, then immediately call into it ... You, as a user-level programmer, don't have to track the state. The parser code will, but that's not a big deal. OK, I suppose that

Re: A6 Request: Change .req to .arity

2003-03-19 Thread Steffen Mueller
Larry Wall wrote: [...] [I wrote:] : maybe it's because I don't think a : function's arity is quite the same as it's *minimum* number of : parameters? I mean, it makes sense in a functional language... but you : don't have functions with a variable number of arguments there. Sure, but one

Re: Synopsis 6 (draft 0)

2003-03-19 Thread Damian Conway
Thanks for the valuable feedback, Hugo. As usual, the default response is unqualified agreement. None of the operator examples show a typed return value. Can they? Should they? Yes. And yes. And now one does. ;-) :Method invocants are specified in the parameter list, with a colon :terminating

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Simon Cozens
[EMAIL PROTECTED] (Matthijs Van Duin) writes: OK, I suppose that works although that still means you're moving the complexity from the perl implementation to its usage: in this case, the perl 6 parser which is written in perl 6 No, I don't believe that's what's happening. My concern is that at

Re: Synopsis 6 (draft 0)

2003-03-19 Thread Damian Conway
Err...sorry all...wrong Perl 6 mailing list. Just ignore it please. (But, yes, S6 will be out RSN!) Damian

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Larry Wall
I would like to express my sincere gratitude to all of you for working through these issues. I bent my brain on the Perl 5 regex engine, and that was just a simple recurse-on-success engine--and I'm not the only person it drove mad. I deeply appreciate that Perl 6's regex engine may drive you

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Sean O'Rourke
On Tue, 18 Mar 2003, Matthijs van Duin wrote: and maybe also: What is the current plan? although I got the impression earlier that there isn't any yet for invoking subrules :-) See line 1014, languages/perl6/P6C/rule.pm. The hack I used was to call rules like ordinary subs, and have them