An excellant idea, in my opinion.
It would be a very appropriate use of structure handling to address system APIs
with structures as parameters or returns. Indeed, stat, localtime, and other
firends could be handled via predefined structure definitions. This is not to say
that we should eliminate -M (and friends), and not to say that we shouldn't have a
built-in date feature that is friendlier than the localtime system call.
Chaim Frenkel wrote:
> Fixed hashes, such as the return from stat() can be handled in the
> compiler. (Ala perl5's pseudo hash.)
>
> This could possibly be combined with the proposed direct pack/unpack
> handling of structures. So that the stat buffer would be transformed
> into a hash refering to a structure buffer.
>
> $stat{ino} could directly access the structure.
> $stat{$field} would go via the hash interface.
>
> <chaim>
>
> >>>>> "SS" == Steve Simmons <[EMAIL PROTECTED]> writes:
>
> >> =head1 IMPLEMENTATION
>
> SS> I strongly support Damiens suggestion on a hashref, and would go so
> SS> far as to say it should be a pseudo-hash, with all the attendant
> SS> misspelling protections and speed obtained.
>
> SS> Passing lists around can be expensive, manipulating hashes can be
> SS> expensive. I'd extend Damiens suggestion to allow the programmer
> SS> to specify only the sub-data desired, eg:
>
> SS> # undef context, store results in passed hashref
>
> SS> my %data_wanted = \(mode => 0, nlink => 0);
> SS> stat( $filename,\$data_wanted);
>
> SS> This could even be done in a list context, with a possible
> SS> implementation suggested:
>
> SS> # List context, return only the two values requested in order
>
> SS> ($mode,$nlink) = stat($filename,\('mode','nlink'));
>
> --
> Chaim Frenkel Nonlinear Knowledge, Inc.
> [EMAIL PROTECTED] +1-718-236-0183
--
Glenn
=====
There are two kinds of people, those
who finish what they start, and so
on... -- Robert Byrne
____________NetZero Free Internet Access and Email_________
Download Now http://www.netzero.net/download/index.html
Request a CDROM 1-800-333-3633
___________________________________________________________