Re: Yet another switch/goto implementation

2001-12-29 Thread Nicholas Clark
On Wed, Nov 07, 2001 at 05:15:14PM -0500, Dan Sugalski wrote: *) The program is fully parsed *) There are no string eval, do, or requires *) There are no symbolic references on the LHS of any assignment *) There is no use of MY within the block or in any subs c

Re: Yet another switch/goto implementation

2001-11-08 Thread Dan Sugalski
At 07:27 PM 11/8/2001 -0500, Ken Fox wrote: >Dan Sugalski wrote: > > Gack. Looks like a mis-placed optimization in perl 5. The list of a > foreach > > is *supposed* to flatten at loop start and be static. Apparently not. :) > >Is anybody keeping a list of things that are *supposed* to be static?

Re: Yet another switch/goto implementation

2001-11-08 Thread Ken Fox
Dan Sugalski wrote: > Gack. Looks like a mis-placed optimization in perl 5. The list of a foreach > is *supposed* to flatten at loop start and be static. Apparently not. :) Is anybody keeping a list of things that are *supposed* to be static? Is the list changing much with Perl 6? > Care to fil

Re: Yet another switch/goto implementation

2001-11-08 Thread Sam Tregar
On Thu, 8 Nov 2001, Dan Sugalski wrote: > Yes, it is a bug. There's an array in list context--it's supposed to be > flattened before the foreach loop gets evaluated. (And if there are > multiple arrays in the list it works as you'd expect) Sorry, I quoted the wrong section. It really isn't a bu

Re: Yet another switch/goto implementation

2001-11-08 Thread Dan Sugalski
At 05:41 PM 11/8/2001 -0500, Sam Tregar wrote: >On Thu, 8 Nov 2001, Dan Sugalski wrote: > > > Gack. Looks like a mis-placed optimization in perl 5. The list of a foreach > > is *supposed* to flatten at loop start and be static. Apparently not. :) > > > > Care to file the perl 5 bug report, or shal

RE: Yet another switch/goto implementation

2001-11-08 Thread Sam Tregar
On Thu, 8 Nov 2001, Brent Dax wrote: > That doesn't support your argument. The point is that in the statement: > > foreach(@array) { > ... > } > > @array should only be evaluated once, at the beginning of the loop. In > effect (using := here, but otherwise Perl 5 code)

RE: Yet another switch/goto implementation

2001-11-08 Thread Brent Dax
Sam Tregar # On Thu, 8 Nov 2001, Dan Sugalski wrote: # # > Gack. Looks like a mis-placed optimization in perl 5. The # list of a foreach # > is *supposed* to flatten at loop start and be static. # Apparently not. :) # > # > Care to file the perl 5 bug report, or shall I? # # It's not a bug. Check

Re: Yet another switch/goto implementation

2001-11-08 Thread Sam Tregar
On Thu, 8 Nov 2001, Dan Sugalski wrote: > Gack. Looks like a mis-placed optimization in perl 5. The list of a foreach > is *supposed* to flatten at loop start and be static. Apparently not. :) > > Care to file the perl 5 bug report, or shall I? It's not a bug. Check out the "Foreach Loops" sect

Re: Yet another switch/goto implementation

2001-11-08 Thread Dan Sugalski
At 07:53 PM 11/7/2001 -0500, Ken Fox wrote: >Dan Sugalski wrote: > > No it isn't. It can get the integer length of the array and stuff it in a > > register at the beginning of the loop, or do an integer compare when it > > needs to, depending on the semantics of the loop. > >Wow. Did you just come

RE: Yet another switch/goto implementation

2001-11-05 Thread Brent Dax
Michael Fischer: # On Nov 04, Brent Dax <[EMAIL PROTECTED]> took up a keyboard # and banged out # > Michael Fischer: # > # In the goto case, we spin. And perhaps I am broken there. End # > # really wants to return, not just set the pc, but I hadn't thought # > # of a clever way to do that corner c

Re: Yet another switch/goto implementation

2001-11-04 Thread Daniel Grunblatt
Yes, and thanks to Michael Fischer I'm already working on that as I described on a previos mail. I hope to post it in a few hours. Daniel Grunblatt. On Sun, 4 Nov 2001, Dan Sugalski wrote: > At 02:45 PM 11/4/2001 -0300, Daniel Grunblatt wrote: > >Sure, I alredy knew that, may be I'm just having

Re: Yet another switch/goto implementation

2001-11-04 Thread Dan Sugalski
At 02:45 PM 11/4/2001 -0300, Daniel Grunblatt wrote: >Sure, I alredy knew that, may be I'm just having a hard time to make my >self clear. > >What I mean was: > >On those unixes, with cc (NOT GCC), that Benoit Cerrina pointed, Can we >use computed goto? No. And Unix generally doesn't enter into i

Re: Yet another switch/goto implementation

2001-11-04 Thread Daniel Grunblatt
Sure, I alredy knew that, may be I'm just having a hard time to make my self clear. What I mean was: On those unixes, with cc (NOT GCC), that Benoit Cerrina pointed, Can we use computed goto? or in other words: Is there any other compiler besides gcc that implements computed goto? Daniel Grun

Re: Yet another switch/goto implementation

2001-11-04 Thread Dan Sugalski
At 02:37 PM 11/4/2001 -0300, Daniel Grunblatt wrote: >So, on those other unixes that come with cc we can't use computed goto? Computed goto is, at the moment, a GCC-specific feature. It's not OS specific, just compiler-specific. Dan -

Re: Yet another switch/goto implementation

2001-11-04 Thread Daniel Grunblatt
So, on those other unixes that come with cc we can't use computed goto? Daniel Grunblatt. On Sun, 4 Nov 2001, Benoit Cerrina wrote: > > > > I think your approuch is much better and cleaner than mine, my brain was > > limited to unix :) so I never worried about anything besides gcc. > > It would

Re: Yet another switch/goto implementation

2001-11-04 Thread Dan Sugalski
At 02:33 PM 11/4/2001 -0300, Daniel Grunblatt wrote: >Did you put an eye on my implementation? what's the point in using >computed goto when tracing, checking bounds or profiling? There's not a huge amount of win over a switch, but there is a benefit over the function dispatch method.

Re: Yet another switch/goto implementation

2001-11-04 Thread Daniel Grunblatt
Did you put an eye on my implementation? what's the point in using computed goto when tracing, checking bounds or profiling? Daniel Grunblatt. On Sun, 4 Nov 2001, Michael Fischer wrote: > On Nov 04, Brent Dax <[EMAIL PROTECTED]> took up a keyboard and banged out > > Michael Fischer: > > # In th

Re: Yet another switch/goto implementation

2001-11-04 Thread Benoit Cerrina
> I think your approuch is much better and cleaner than mine, my brain was > limited to unix :) so I never worried about anything besides gcc. > It would also be nice if you can decide which dispatch method use instead > of asking. Hum, I think you mean linux, maybe BSD, but the other unixes com

Re: Yet another switch/goto implementation

2001-11-04 Thread Michael Fischer
On Nov 04, Brent Dax <[EMAIL PROTECTED]> took up a keyboard and banged out > Michael Fischer: > # In the goto case, we spin. And perhaps I am broken there. End > # really wants to return, not just set the pc, but I hadn't thought > # of a clever way to do that corner case, and wanted to see what >

RE: Yet another switch/goto implementation

2001-11-04 Thread Brent Dax
Michael Fischer: # In the goto case, we spin. And perhaps I am broken there. End # really wants to return, not just set the pc, but I hadn't thought # of a clever way to do that corner case, and wanted to see what # the behavior would be without it. I suspect I need it. Can't you just break()? -

Re: Yet another switch/goto implementation

2001-11-04 Thread Michael Fischer
On Nov 04, Daniel Grunblatt <[EMAIL PROTECTED]> took up a keyboard and banged out > > > On Sun, 4 Nov 2001, Michael Fischer wrote: > > > On Nov 04, Daniel Grunblatt <[EMAIL PROTECTED]> took up a keyboard and >banged out > > > I really suggest that you do a do_op.c and a do_op.h and that you c

Re: Yet another switch/goto implementation

2001-11-04 Thread Daniel Grunblatt
On Sun, 4 Nov 2001, Michael Fischer wrote: > On Nov 04, Daniel Grunblatt <[EMAIL PROTECTED]> took up a keyboard and banged >out > > First of all you miss typed: > > -if ($c{do_opt_t} eq 'goto' and $c{cc} !~ /gcc/i ) { > > +if ($c{do_op_t} eq 'goto' and $c{cc} !~ /cc/i ) { > > hmm. Thats not wh

Re: Yet another switch/goto implementation

2001-11-04 Thread Dan Sugalski
At 12:19 PM 11/4/2001 -0500, Michael Fischer wrote: >On Nov 04, Daniel Grunblatt <[EMAIL PROTECTED]> took up a keyboard >and banged out > > First of all you miss typed: > > -if ($c{do_opt_t} eq 'goto' and $c{cc} !~ /gcc/i ) { > > +if ($c{do_op_t} eq 'goto' and $c{cc} !~ /cc/i ) { > >hmm. Thats no

Re: Yet another switch/goto implementation

2001-11-04 Thread Michael Fischer
On Nov 04, Daniel Grunblatt <[EMAIL PROTECTED]> took up a keyboard and banged out > First of all you miss typed: > -if ($c{do_opt_t} eq 'goto' and $c{cc} !~ /gcc/i ) { > +if ($c{do_op_t} eq 'goto' and $c{cc} !~ /cc/i ) { hmm. Thats not what my diff has. Point is, if you chose 'goto', $c{cc} /isn'

Re: Yet another switch/goto implementation

2001-11-03 Thread Daniel Grunblatt
First of all you miss typed: -if ($c{do_opt_t} eq 'goto' and $c{cc} !~ /gcc/i ) { +if ($c{do_op_t} eq 'goto' and $c{cc} !~ /cc/i ) { On Sat, 3 Nov 2001, Michael Fischer wrote: > Ok, attached dispatch.diff is the smallest changes > I could think of to get a Configure.pl time choice > for func/sw