develooper Front page | perl.perl6.language | Postings from November 2008

Re: Files, Directories, Resources, Operating Systems

Thread Previous | Thread Next
From:
Timothy S. Nelson
Date:
November 26, 2008 16:23
Subject:
Re: Files, Directories, Resources, Operating Systems
Message ID:
alpine.LRH.1.10.0811271109290.12734@gwalcmai.nelson.org.au
 	Can I just remind everyone that (IMO) we shouldn't just be considering 
filesystems here?  I think it would be a pretty useful feature to have a 
general tree manipulation interface, and then this could be applied to 
filesystems, or XML, or LDAP, or SQL (although this doesn't map so well), or 
whatever.

 	I guess the way I see it, you'd have something like this:

role Tree::Node {...}
role Filesystem::Node inherits from Tree::Node {...}
role Filesystem::Directory inherits from Filesystem::Node {...}
class Filesystem::File does Filesystem::Node { # Interface, like DBI
 	has $implementation handles *;

 	$implementation = Filesystem::File::XML->new();
}
class Filesystem::File::XML inherits from Filesystem::File::Base {...}

 	In the case of Filesystem::Node, you would define some standard 
attribute names (eg. "owner", "is_readable"), but then they would be 
accessible through the standard Tree::Node.get_attribute() interface.  And the 
standard Tree::Node.get_children() would be implemented by Filesystem::File as 
something to fetch the contents of the file; in the case of 
Filesystem::XMLFile, it would turn the contents into a tree of XML nodes.

 	I agree about the different levels of abstractions, but just wanted to 
put in a plug for this one as one that I like.

 	:)


---------------------------------------------------------------------
| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: wayland@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-----


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About