It is necessary that Parrot's filesystem interface make user-visible the
_event_ of measuring the attributes of a path _or_ an already open
filesystem object (e.g. calling stat() or fstat()).  It must also represent
the bundle of measurements returned as some kind of PMC.  (handwave handwave)

I agree with that.

Perl 5 does this (fairly crudely) by returning a list of values from stat()
or lstat() which you can examine at leisure, and by special-casing the "_"
filehandle to mean "results of last stat".

We have stat() and lstat() working as well as perl 5 stat and lstat.

The above-quoted example is only plausible if it's shorthand for, e.g.:

    $P1 = $P0.stat   # or lstat
    $P1.is_dir()
    $P1.is_file()


Looking to this code, $P0.stat should return a Stat PMC object, so we can call is_dir and is_file. Other option is to specify that 'is_dir' and 'is_file' stat the file everytime they are called.

For me, both options are reasonable. Chip's proposal have the advantage of caching the info. Using is_dir and is_file to stat everytime, have the advantage of not having a specific Stat PMC object.
Other option, is having one is_dir() and one cached_is_dir().


--
Alberto Simões - Departamento de Informática - Universidade do Minho
                 Campus de Gualtar - 4710-057 Braga - Portugal

Reply via email to