On Mon, 23 Feb 2009, jason switzer wrote:
On Sun, Feb 22, 2009 at 9:47 PM, <pugs-comm...@feather.perl6.nl> wrote:
Added: docs/Perl6/Spec/S28-special-variables.pod
===================================================================
+=head2 Named variables (see S02):
+ $?OS # operating system compiled for
+ $*OS # operating system running under
+ $?OSVER # operating system version compiled for
+ $*OSVER # operating system version running under
How are you possibly going to get this in a remotely portable basis? How
could an implementation handle the case of compiling a perl6 script down to
native binary? Would the native binary always report the same OS and OSVER
no matter where it executes after turned into a binary?
First thing, I'm just collecting these from other places, so I may not
be the one to answer some of your questions. I don't understand all these
bits myself.
Second, please note that $?OS and $*OS are two completely separate
variables. $?OS will always be the same, $*OS may be different, depending on
where it's run.
Third, this is still very much a work in progress.
+ $?PACKAGE # current package (as object)
+ @?PACKAGE # current packages
+ $?PACKAGENAME # name of current package (see S10)
$?PACKAGENAME seems kind of redundant when I could similarly do a
$?PACKAGE.perl to get a coderef back as well. In fact, all of the variables
that are named version of the coderef version should probably be removed in
the favor of something like ~$?FOO or ~$*FOO.
There seems to be a lot of this sort of redundancy here. Larry said
on IRC:
"There are several competing design notions here. We'd like to
minimize globals that have to be set up in advance, but we'd also like to
huffmanize common vars like $*PID ".
+ $*PROGRAM_NAME # name of the program being executed
How does this differ from $*EXECUTABLE_NAME?
Good question. Anyone?
+ $?PUGS_VERSION # Pugs version (not canonical)
+ $*PUGS_HAS_HSPLUGINS # True if Pugs was compiled with support for
hsplugins
+ # (not canonical)
How do these apply to anything other than a single specific implementation?
What motivation would Rakudo or elf have for defining these?
I've removed them in my local copy; will go into the next svn commit.
+ &?ROUTINE # current sub or method (itself, see S06)
+ @?ROUTINE # current subs or methods (themselves)
I'm sure this is a typo for $?ROUTINE. Besides, I think $?SUB makes more
sense.
Well, Larry says this in S02:
&?ROUTINE Which routine am I in?
@?ROUTINE Which nested routines am I in?
&?BLOCK Which block am I in?
@?BLOCK Which nested blocks am I in?
I'd argue that if he's written '&' twice there, there's a reason for
it. As for SUB, complain to Larry.
+
+ $*OSNAME ...or some such
+ $^O $OSNAME
Doesn't correlate with the list above.
That doesn't surprise me in the least. Most of the stuff is taken
from about 4 different sources (ie. two other peoples' previous attempts at
S28, from an e-mail of Larry's, and from the other Specs).
+ $* and $# have been deprecated half of forever and are gone. $[
+ is a fossil that I suppose could turn into an evil pragma, if we
+ try to translate it at all. (Frees up * twigil for $*FOO syntax.)
I'm not even sure this makes sense to me. Is this saying that $* and $# are
largely not in use anymore (in perl6)?
Read the section on "twigils" in S02. Hopefully things will make more
sense after that. It says that $* is no longer a separate variable, but is
used for $*OSNAME, $*VM, and the like.
HTH,
---------------------------------------------------------------------
| 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-----