On Tue, Dec 16, 2008 at 7:04 AM, jason switzer <jswit...@gmail.com> wrote:
> I hadn't seen a Nameable role mentioned yet, so I wasn't able to understand
> any such concept.

The list was not meant to be exhaustive. There are a lot more roles
that have something to do with IO but were missing: Asynchronous IO,
Datagram sockets, and more (specially when you add in platform
specific stuff). The whole idea is that almost any operation you can
do on one kind of handle can be done on some other kind too. There is
a lot of overlap between seemingly unrelated types of handles. In this
case, files and unix domain sockets are created and used in rather
different ways, but both have a place in the filesystem, so it would
be appropriate that they share the interface for retrieving that
location.

> That is a good idea, but the idea is so general that
> anything can be nameable and thus the specificity of the role could quickly
> become lost. I was suggesting specific naming functionalities be added to
> the File role. If you want to abstract that, that's fine, but beware that
> something like Nameable can be too broad of a role (maybe just IONameable?).

I agree Nameable isn't the best name. How about Locatable? Having said
that, I suppose a generic Nameable role providing a human readable
designation to a handle (as opposed to one for computers) would be
useful too, if only for error messages.

> I haven't spent the time to understand mix-ins yet, but this does look like
> a feasible (clean) idea. However, how do you specify one/more filters? For
> example, say you want to :rw a file. How can you provide an input filter and
> an output filter (or multiples of either)? Can you layer filters if done
> with mix-ins?

Stacking can be done:

$fstab does WhitespaceTrim does TranslateKlingon;

I'm not sure if this is the best way to approach the problem though.
This is a power drill, a screwdriver will also do in many cases.

> If so, how do you specify direction?

That would be a problem with this approach. You'd probably need
separate roles for readers and writers.


Regards,

Leon Timmermans

Reply via email to