in reply to Griping about Typing
Quick quiz: What type of thing is $x anyway? What methods can you call on it? One of the great things about C++ and other strongly typed languages is that you have to prepare a holder for the thing you are requesting. It would be a lot more like:my $bork = Bork->new(); my $x = $bork->bork()->bork();
No ambiguity there. Either you get a 'Chef', or you get a compile-time error.Bork bork = new Bork(); Chef x = bork->bork()->bork();
Maybe the bork method would be able to return a number of different things, including a 'Chef', based on some sort of if (wanta('Chef')) { ... } type check.my Bork:$bork = Bork->new(); my Chef:$x = $bork->bork()->bork();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Griping about Typing
by pdcawley (Hermit) on Apr 19, 2002 at 07:04 UTC | |
by tadman (Prior) on Apr 19, 2002 at 18:51 UTC | |
by pdcawley (Hermit) on Apr 22, 2002 at 15:52 UTC | |
by Anonymous Monk on Sep 29, 2003 at 23:39 UTC |