in reply to Re: AbstractClassFactory
in thread AbstractClassFactory

I am still trying to find a use for a closure that is used as an object reference. I guess that like any form of recursion its more effecient to "flatten" it out.

Thanks for the comments; but what is a "cargo cult line"?

Replies are listed 'Best First'.
Re^3: AbstractClassFactory
by diotalevi (Canon) on Jan 14, 2003 at 14:28 UTC

    You put the code $class = ref($class) || $class into your module. There's no good reason for you to do that. People here go on endlessly about this specific meme but in your particular case it is particularly extraneous. The only possible reason you would have for it in this example is for cargo cult reasons. See cargo cult programming. It should merely be left as my $class = shift without the "maybe clone this object but not really" meaning you're getting. Part of my original objection was that you didn't even need the blessing for what you were doing and this part I'm quibbling over muddies the waters even more.

    The other thing you're missing is that there is a universe of uses for closures and that isn't about "trying to find a use". If you really want to give your mind a spin go read up on Capabilities and faceted objects over at E in a Walnut. You'll come out better for it (it's only 70 pages and if you feel like it most of the middle can be skipped).


    Fun Fun Fun in the Fluffy Chair