Well, it could be done quite easily, along the lines of what's below. There
aren't function objects per se but there's nothing stopping you from
defining such classes. That's the point of interfaces like Runnable that
define a single function to be called in another thread. And for the really
malevolent programmers, that's always that public static void....
But I presume we are all Perl programmers here so never mind =)
interface Filter
{
Reader filter (Reader r)
}
class Sample implements Filter
{
Reader filter (Reader r)
{
// Read from reader
// Write to a PrintStream based on a StringStream
// Convert String to a Reader and return
}
}
class HTML.Template
{
List filters
public void addFilter(Filter f)
...
public ... output(...)
{
Iterator i = filters.iterator();
.... etc ...
}
}
----- Original Message -----
From: "Sam Tregar" <[EMAIL PROTECTED]>
To: "Philip S Tellis" <[EMAIL PROTECTED]>
Cc: "HTML::Template List" <[EMAIL PROTECTED]>
Sent: Friday, May 24, 2002 10:54 PM
Subject: RE: [htmltmpl] python and php versions
> On Fri, 24 May 2002, Philip S Tellis wrote:
>
> > > I bet it could be done by defining an interface for HTML::Template
filters
> > > (unless there's a standard interface that would be applicable). Then
the
> > > user passes you references to objects that implement that interface.
> >
> > Yeah, that's what I've been thinking of, but if Function Objects exist
> > in java, then that's a possibility too.
>
> Heh. I highly doubt that. In the church of pure objects there is only
> one true object type. There might be a standard interface like "Filter"
> or something. But I guarantee there's no special object type for
> functions! In fact, if you want to get technical, Java doesn't even have
> functions. It only has object methods and class methods. The idea of
> directly accessing a method without an object or a class just doesn't
> exist in Java.
>
> -sam
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]