On Thu, May 24, 2001 at 09:59:36AM -0400, Chip Turner wrote:
> darren chamberlain <[EMAIL PROTECTED]> writes:
> 
> The nice thing about closures is they could hide any interface at all
> behind them; all that is required is that the function that generates
> the closure follow the very simple convention of "return the formvar
> of the name starting with the first parameter you're called with."
> There is absolutely no reliance upon the underlying object structure.
> What you're suggesting is equivalent to assuming the object is derived
> from some kind of base class that supports the param() method though
> without actually having to be ISA of that class.  That's naughty OO
> programming :)  Just because perl lets you be typeless doesn't mean
> it's always in the best interest of clean design to do so.

I don't find a problem with passing an object that has a certain set
of method signatures.  This is functionally loosely equivalent to a
Java Interface..  Any perl object can implement a particular interface
just by implementing the methods..  No base class required..

But I agree, closure are very cool, and allow for an additional layer
of abstraction between the objects, without having to create a proxy
class..

> Closures are excellent in hiding implementation details of simple
> operations, and I think in this case they fit quite well.  The system
> can even be written to work just fine without the user using closures
> if they're using CGI.pm, as in my previous example.

-- 
Paul Lindner
[EMAIL PROTECTED]

Reply via email to