develooper Front page | perl.perl6.language | Postings from May 2005

Argument Type Checking

Thread Next
Joshua Gatcomb
May 19, 2005 12:28
Argument Type Checking
Message ID:
I was hoping the following would give me an outright error

sub foo (Int $bar) {
    say $bar;

I seem to recall, probably incorrectly, that one of the differences
with int, Int, and no type declaration at all is that one would
happily autoconvert for you, 1 would autoconvert but forget it ever
happened, and 1 would be an outright failure.

Ok - so could someone set me straight?
What should that code snippet do?  Would it do anything different if
Int had been int?

Joshua Gatcomb
a.k.a. L~R

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About