On Tue, 16 Dec 2008, jason switzer wrote:

You can already easily mix it in using 'does':

$fstab = open('/etc/fstab', :r);
$fstab does WhitespaceTrim;

I don't think it's really necessary to include that into open(),
though it might be useful syntactic sugar.

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? If so, how do you specify direction?

I've had somewhat related ideas in the past, but they always involved feed operators somehow. I don't think I've got enough of a grip on things to suggest specifics, but I thought I'd throw the idea into the mix.

Also, if the wishlist covers filesystems as well as files (ie. opendir-type stuff), my wishlist involves having general tree-manipulation stuff that works with filesystems just as well as with XML; we could use XPath-like globs on filesystems, which would completely replace eg. File::Find, among other things. So you could ask for "/path/to/directory/child::*", which would get you the children, but not the parent ".." or the self ".". I've actually started code in this direction (ie. of a role, not the IO side of things), but stopped while waiting on the further development of Rakudo (ie. operator overloading).

        Anyway, just some thoughts thrown into the mix.

        :)


---------------------------------------------------------------------
| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: wayl...@wayland.id.au    | I am                           |
---------------------------------------------------------------------

----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----

Reply via email to