On Thu, Aug 31, 2000 at 02:13:23PM -0500, Christopher J. Madsen wrote:
> Jonathan Scott Duff writes:
> >do { ... last; ... }; # exit the block immediately
> >do { ... next; ... }; # equivalent to last?
> >
}
And what about continue blocks? We can attach them to bare blocks,
but not to do blocks? That's weird.
> However, I really don't want to see 'return' become a kind of 'last'
> for do{}. How would I return from a subroutine from within a do loop?
Indeed.
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
it rather than hoop-jumping a little?
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
ld about the syntax,
but I like the idea. If everything become objects under-the-hood,
then we could have:
for $a (@array) { print "$a is at $a->index\n"; }
No, I'm not wild about that either, but it's an idea.
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
2. Explicit variable between foreach and the array: might conflict
> with other proposals.
> 3. Explicit counter in the body of the for/each loop: a clean
> solution but requires a new or reused function.
What happened to explicit variable(s) *after* the list?
# Oops!
}
In this example, the programmer may realize his mistake when he sees
" is at position 0", but in the real world, the body of the loop may
be *much* more complicated. How do we help the programmer when he
screws up?
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
for (@array) $index { ... }
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
code that may throw exceptions
}
Note that's a two-block keyword.
> I don't think we should obfuscate classic try/throw/catch/finally
> from the ground up.
I'm inclined to agree with you, but as you can see, I'm not letting
that hamper my brainstorming effort :-)
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
he extra syntax? I see no gain to the programmer or to the
> perl internals.
These are my thoughts exactly.
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
ray that acts as an exception stack and each
exception knows what file/line/whatever? Then you can get both behaviors
with a simple for loop:
for (@PERL::EXCEPTIONS) {
print $_->file, "\t", $_->line, "\n";
}
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
On Tue, Aug 15, 2000 at 06:23:57PM -0600, Tony Olekshy wrote:
> Jonathan Scott Duff wrote:
> >
> > What's wrong with just using the switch statement? It seems
> > like except and catch are becoming special-purpose switches
> > to me. Is it really necessary?
&g
as to the purpose of an explicit "try."
Me too!
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
On Tue, Aug 15, 2000 at 06:01:33PM +0100, Graham Barr wrote:
> As perl is an exceptional language itself, why not have
> `freaks' instead :)
How about just "oops"? :-)
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
On Tue, Aug 15, 2000 at 11:47:32AM +0100, Graham Barr wrote:
> On Mon, Aug 14, 2000 at 10:56:36AM -0500, Jonathan Scott Duff wrote:
> > try { }
> > catch SomeException { }
> > catch SomeOtherException { }
> > finally { }
> >
> > which seems
On Mon, Aug 14, 2000 at 08:50:41PM -0600, Tony Olekshy wrote:
> Jonathan Scott Duff wrote:
> > try { }
> > catch { # ALL exceptions
> > switch ($@) {
> > case ^_->name eq 'IO' { .
> text.
This doesn't show that the exception object itself has any semantics.
If the catcher examines, the object is being passive. Does the object
*do* anything?
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
an
illegal construct?
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
ceptions
switch ($@) {
case ^_->name eq 'IO' { ... }
case ^_->canFoo { ... }
throw $@; # No cases matched, rethrow
}
}
finally { }
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
On Sun, Aug 13, 2000 at 07:27:47PM -0700, Peter Scott wrote:
> At 12:22 PM 8/12/00 -0500, Jonathan Scott Duff wrote:
> Pretty much. It screams O-O for these reasons:
>
> An exception is an 'error'. That's already a vague concept.
>
> An error has text associ
the same
breath? Does one need objects to have exceptions?
Could someone enlighten me or point me at relevant references?
thanks,
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
20 matches
Mail list logo