Ticket #1378 (new feature)

Opened 5 years ago

Last modified 5 years ago

Hash or by-string interface to interp object / interpinfo / sysinfo

Reported by: japhb Owned by: cotto
Priority: normal Milestone:
Component: none Version: 1.9.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

See  http://irclog.perlgeek.de/parrot/2009-12-18#i_1850474 for details, but basically I would like an NQP- and introspection-friendly interface to sysinfo, interpinfo, and the object returned by getinterp.

Right now, you must index these three with magic integers; this is hidden somewhat through the use of PASM macro constants, but these are not available to NQP or other HLL code.

In addition, it is not possible to cleanly introspect these to find extensions (such as special sysinfo values available only on certain OSen).

An iterable string-keyed hash interface would probably work well for this task.

Attachments

iglobals_hash_example.patch Download (1.2 KB) - added by cotto 5 years ago.
mostly incomplete patch to allow hash-flavored iglobals access and chicanery
interp_iglobals.pir Download (443 bytes) - added by cotto 5 years ago.
example of how to use (and misuse) the above patch
interp_iglobals_output.txt Download (2.7 KB) - added by cotto 5 years ago.
output of the above pir program with the above patch

Change History

Changed 5 years ago by cotto

I don't mind working on this, but I'd like to get a +1 from someone with more design sense than me as a sanity check. There's no reason the old constants-based interfaces couldn't be preserved for backwards compatibility, so I don't think deprecation would be an issue.

Changed 5 years ago by cotto

For the sake of discussion, here's some mostly incomplete example code implementing interpiglobals? as a more user-friendly way of accessing iglobals. The other interfaces would be similar. It'd probably be a good idea to make a clone of various hashes and arrays so that some enterprising PIR or HLL code couldn't wreak even more havoc than it already can. Again, this is where someone with design sense is required.

Changed 5 years ago by cotto

mostly incomplete patch to allow hash-flavored iglobals access and chicanery

Changed 5 years ago by cotto

example of how to use (and misuse) the above patch

Changed 5 years ago by cotto

output of the above pir program with the above patch

Note: See TracTickets for help on using tickets.