Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Further to: Resumable ops and exceptions

2 views
Skip to first unread message

Jos Visser

unread,
Aug 8, 2003, 5:32:17 AM8/8/03
to Perl6 Internals (parrot)
There are a number of ops that could fail. Examples are find_lex but
also the various load and lookup ops. Options for handling failure are:

- Abort parrot
- Throw an exception
- Return a default (null) value

I think it is hard for the parrot designers to decide what language
implementors want (given the vast array of languages out there for which
parrot is a godsend). I am currently extending my OpenComal interpreter
with a parrot code generator and since Comal is a somewhat awkward
language I need different things than the average perl/python/hq9
implementor.

I would therefore vote for a feature where I (as language designer)
could indicate whether for instance a find_lex (but others too) fails
silently (null return value) or with an exception.

Maybe this should be a global something...

Real CPU's often have a control register that contains CPU-wide flags.
Maybe parrot needs one too?

++Jos.es

--
ek is so lug jy vlieg deur my
sonder jou is ek sonder patroon
"Breyten Breytenbach"

Leopold Toetsch

unread,
Aug 8, 2003, 6:41:40 AM8/8/03
to Jos Visser, Perl6 Internals (parrot)
Jos Visser wrote:

> There are a number of ops that could fail. Examples are find_lex but
> also the various load and lookup ops. Options for handling failure are:
>

> I would therefore vote for a feature where I (as language designer)
> could indicate whether for instance a find_lex (but others too) fails
> silently (null return value) or with an exception.

Or you install an exception handler that just returns, when a
LEXICAL_NOT_FOUND exception object is seen.
But this is only possible at opcode level. Anyway, we first should move
the internal_exception out of scratchpad_get (and similar) to the
opcode. Then we can do both, throw a resumable exception or ignore the
error (depending on your poposed flags). We already have ctx->warns for
e.g. PerlUndef warnings, why not an error flag too.


> ++Jos.es

leo


Piers Cawley

unread,
Aug 11, 2003, 5:29:26 AM8/11/03
to Jos Visser, Perl6 Internals (parrot)
Jos Visser <jo...@osp.nl> writes:

> There are a number of ops that could fail. Examples are find_lex but
> also the various load and lookup ops. Options for handling failure are:
>
> - Abort parrot
> - Throw an exception
> - Return a default (null) value
>
> I think it is hard for the parrot designers to decide what language
> implementors want (given the vast array of languages out there for which
> parrot is a godsend). I am currently extending my OpenComal interpreter
> with a parrot code generator and since Comal is a somewhat awkward
> language I need different things than the average perl/python/hq9
> implementor.
>
> I would therefore vote for a feature where I (as language designer)
> could indicate whether for instance a find_lex (but others too) fails
> silently (null return value) or with an exception.
>
> Maybe this should be a global something...

Not global. Or, if it is global, it needs to be dynamically scoped
since you could possibly have different modules implemented in
different languages.

--
Piers

Jos Visser

unread,
Aug 12, 2003, 5:32:25 AM8/12/03
to Piers Cawley, Perl6 Internals (parrot)
On Mon, Aug 11, 2003 at 10:29:26AM +0100 it came to pass that Piers Cawley wrote:
> > Maybe this should be a global something...
>
> Not global. Or, if it is global, it needs to be dynamically scoped
> since you could possibly have different modules implemented in
> different languages.

After some thought it occurred to me as well that a global/thread based
status register would indeed be unhandy since different routines
(written in different languages) must save/change/use/restore the
register. An exception is indeed the better way to go...

++Jos.nl

0 new messages