ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Quick questions: multi submethod and undef.method
by Ingo Blechschmidt other posts by this author
Jun 5 2005 1:25PM messages near this date
Re: What the heck is... wrong with Parrot development? | Re: Quick questions: multi submethod and undef.method
Hi,

two quick questions:


Are multi submethods allowed?


  my $x = undef;
  my $y = $x.some_method;
  # $y now contains an unthrown exception object, saying that undef
  # doesn't .can("some_method"), right?
  say $y; # Only now it dies, correct?

This is important if you have a sub which may either return a custom
object or undef:
  my $x = sub_which_returns_an_object_or_undef();
  my $y = $x.some_method;

One builtin example is "caller":
  my $x = caller(5555);  # undef if there's no such stack frame
  my $y = $x.line;       # unthrown exception object


--Ingo

-- 
Linux, the choice of a GNU | Elliptic paraboloids for sale.  
generation on a dual AMD   | 
Athlon!                    | 
Thread:
Ingo Blechschmidt
Larry Wall

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved