Is is possible to check to see whether an attribute exists on a given
object, or at least catch an exception if it doesn't? I've tried to set
up an exception handler, but Parrot exits without anything being caught.
A code snippet follows:
.local pmc class
.local int type
.local pmc foo
.local pmc val
# The Foo class only has a "bar" attribute.
newclass class, "Foo"
addattribute class, "bar"
# Create a Foo object
find_type type, "Foo"
new foo, type
# Try to access the invalid "baz" attribute.
getattribute val, foo, "baz"
print "* caught an exception!\n"