where will we die to?
on the #catalyst channel today we had lots of pains debugging where a die will go to eventually, within a cascade of eval { }s and what not. In Perl 6 one thing that could ease this is to be able to easily know where we will die to, without having to walk the stack and checking which scope entries have a catch block. The other thing is to be able to trace an exception: if we have 'die foo but traced' then the exception should print cought at rethrowed as it's doing that. This second thing is much harder for me to pretend to implement -- () Yuval Kogman [EMAIL PROTECTED] 0xEBD27418 perl hacker /\ kung foo master: /me tips over a cow: neeyah!! pgpv0ddyWDvMt.pgp Description: PGP signature
Re: where will we die to?
On Thu, Mar 23, 2006 at 02:27:07PM +0200, Yuval Kogman wrote: : on the #catalyst channel today we had lots of pains debugging where : a die will go to eventually, within a cascade of eval { }s and what : not. : : In Perl 6 one thing that could ease this is to be able to easily : know where we will die to, without having to walk the stack and : checking which scope entries have a catch block. How else would you implement it that doesn't impact performance? One of the main reasons for having exceptions is that they're exceptional, and should be pessimized with respect to ordinary code. Having to write a stack introspection routine is not that big of a hardship. : The other thing is to be able to trace an exception: if we have 'die : foo but traced' then the exception should print cought at : rethrowed as it's doing that. : This second thing is much harder for me to pretend to implement Maybe have the debugger .wrap all CATCH blocks? Larry
Re: why no negative (auto reversed) ranges?
On Mon, Mar 20, 2006 at 01:26:03PM +0100, TSa wrote: : HaloO, : : S03 does explicitly disallow auto-reversed ranges. : And I'm not sure if the upto operator has a downto : cousin where ^-4 == (-1, -2, -3, -4) returns a list : that is suitable for indexing an array from the back. : Why is that so? I suppose because nobody else wanted it yet. If we were to add such an operator opposite to ^4, I suspect it'd be v-4 or some such, but maybe negative version numbers are more useful. :-) But Huffman coding says that symmetry *should* be broken when a thing is used much more frequently than its opposite. : With negative ranges, negative array and list length : becomes a logical extension and .reverse just flips : the sign of the array. But I know that code snippets : like 'if @array 10 {...}' then need to be upgraded : to explicitly take the abs: 'if abs @array 10 {...}' : which is good documentation but somewhat inconvenient. People would certainly rebel. : OTOH, using contentless arrays as kind of integer becomes : even more attractive ;) Though you can always use $array as an arrayless content... : Is there a .reversed property for arrays, lists and : ranges that allows to query the direction of growth? Not with a standard array. : And is .reverse working lazily with respect to the : list or array and just flips this property? .reverse isn't a mutator. It merely presents a reversed view of whatever, and is hopefully as lazy as the underlying object allows in reverse. (To reverse an array in place we'd use .=reverse.) Larry
Re: where will we die to?
On Thu, Mar 23, 2006 at 08:14:03 -0800, Larry Wall wrote: On Thu, Mar 23, 2006 at 02:27:07PM +0200, Yuval Kogman wrote: How else would you implement it that doesn't impact performance? One of the main reasons for having exceptions is that they're exceptional, and should be pessimized with respect to ordinary code. Having to write a stack introspection routine is not that big of a hardship. Oh, i mean without *manually* walking the stack - present some standard library function like 'caller()' but only for catching frames. This is purely a usability issue... Perhaps Perl 6 should ship with some core modules for development, with this general stuff in place? For example, a help() function, like Python has, things like Devel::DumpVar, Benchmark, Test::WithoutModule, a profiler, Devel::Loaded and other such introspection shortcuts, Devel::SymDump, and even yours truely's Devel::Sub::Which (which will just be a quick hack with the MOP introspection) and Devel::STDERR::Indent ;-) These tools should be useful for writing/hacking the compiler toolchain itself - that is they should operate both within a runtime, and if possible, on the intermediate representations as well. Maybe have the debugger .wrap all CATCH blocks? That sounds nice -- Yuval Kogman [EMAIL PROTECTED] http://nothingmuch.woobling.org 0xEBD27418 pgpb1i4cgMp0u.pgp Description: PGP signature