Special variables: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
No edit summary
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 18:
 
There are far too many attributes to list here, but a standard informative list can be found in Annex K of the documentation if you have it installed.
Or Here: [http://www2.adacore.com/gap-static/GNAT_Book/html/aarm/AA-K.html Annex K - Language-Defined Attributes]
 
=={{header|AutoHotkey}}==
Refer to [http://www.autohotkey.com/docs/Variables.htm#BuiltIn Built-in Variables] for the complete special variables (those variables are global, except noticed).
 
=={{header|ALGOL 68}}==
Line 396 ⟶ 393:
otherwise it is processed according to the settings of XCPLIMIT etc.
%</lang>
 
=={{header|AutoHotkey}}==
Refer to [http://www.autohotkey.com/docs/Variables.htm#BuiltIn Built-in Variables] for the complete special variables (those variables are global, except noticed).
 
=={{header|AWK}}==
Line 418:
* RSTART - An informative variable that provides the start index of the currently matched substring
* SUBSEP - A control variable that specifies the subscript separator for multidimensional arrays
 
=={{header|Batch File}}==
By typing the <code>SET</code> command (without any parameters) in the command prompt, it will display the current environment variables and their current values.<br>
However, there are some special variables that are not listed in the variables displayed by the SET command because their values might change over time. These variables are as follows:<br>
<pre>%CD% - expands to the current directory string.
 
%DATE% - expands to current date using same format as DATE command.
 
%TIME% - expands to current time using same format as TIME command.
 
%RANDOM% - expands to a random decimal number between 0 and 32767.
 
%ERRORLEVEL% - expands to the current ERRORLEVEL value
 
%CMDEXTVERSION% - expands to the current Command Processor Extensions
version number.
 
%CMDCMDLINE% - expands to the original command line that invoked the
Command Processor.
 
%HIGHESTNUMANODENUMBER% - expands to the highest NUMA node number
on this machine.</pre>
(Source: by typing <code>SET/?</code> command in the command prompt)
 
=={{header|BBC BASIC}}==
Line 451 ⟶ 474:
@wparam% The WPARAM value (for use with ON MOUSE, ON MOVE and ON SYS)
</pre>
 
=={{header|Batch File}}==
By typing the <code>SET</code> command (without any parameters) in the command prompt, it will display the current environment variables and their current values.<br>
However, there are some special variables that are not listed in the variables displayed by the SET command because their values might change over time. These variables are as follows:<br>
<pre>%CD% - expands to the current directory string.
 
%DATE% - expands to current date using same format as DATE command.
 
%TIME% - expands to current time using same format as TIME command.
 
%RANDOM% - expands to a random decimal number between 0 and 32767.
 
%ERRORLEVEL% - expands to the current ERRORLEVEL value
 
%CMDEXTVERSION% - expands to the current Command Processor Extensions
version number.
 
%CMDCMDLINE% - expands to the original command line that invoked the
Command Processor.
 
%HIGHESTNUMANODENUMBER% - expands to the highest NUMA node number
on this machine.</pre>
(Source: by typing <code>SET/?</code> command in the command prompt)
 
=={{header|bc}}==
Line 489:
The names of the built-in functions <code>alc, arg, asc, chr, chu, clk, d2x, dbg, den, div, fil, flg, glf, fre, get, low, lst, mem, mod, new, pee, pok, put, ren, rev, rmv, sim, str, swi, sys, tbl, upp, utf, whl, x2d</code> can be used as variable names or names of user defined object member functions, but not as names of user defined functions. Conversely, the name <code>hash</code> can be used for user defined functions, but not for variables. Currentlty, <code>hash</code> is the only predefined object type.
 
If Bracmat starts in interactive mode, a few more variables are predefined: <code>!v</code> evaluates to a string telling which version of Bracmat you are running. <code>!w</code> and <code>!c</code> evaluate to sections 11 and 12 of the GPL. More vital is the variable <code>main</code>, which is the interpreter's main loop. Setting it to another value changes the behaviour of the interpreter. When running in interactive mode, <code>!</code> or <code>!""</code> evaluates to the last answer, so the empty string is the name of yet another special variable. These variables can be reassigned.
 
=={{header|C}}==
Line 580:
 
One special boolean variable is __ctfe, that is read-only and it's true inside functions when they are evaluated at compile-time, and false otherwise.
=={{header|Déjà Vu}}==
Calls to some of the standard library functions can be optimized into certain opcodes or sequences of opcodes, namely:
<pre>set setglobal local get getlocal return recurse drop dup swap rot over
[] {} pop-from push-to push-through has get-from set-to raise reraise
call for pass</pre>
In addition, <code>eva</code> is special:
<lang dejavu>!print "hey" #is really short for
eva!print "hey"</lang>
EVA is the part of the standard library that takes care of communication with the outside world. It makes extensive use of the method call syntax, unlike the rest of the standard library, that is why it is special.
 
=={{header|DWScript}}==
Line 603 ⟶ 594:
}
print(8.double())</lang>
 
=={{header|Déjà Vu}}==
Calls to some of the standard library functions can be optimized into certain opcodes or sequences of opcodes, namely:
<pre>set setglobal local get getlocal return recurse drop dup swap rot over
[] {} pop-from push-to push-through has get-from set-to raise reraise
call for pass</pre>
In addition, <code>eva</code> is special:
<lang dejavu>!print "hey" #is really short for
eva!print "hey"</lang>
EVA is the part of the standard library that takes care of communication with the outside world. It makes extensive use of the method call syntax, unlike the rest of the standard library, that is why it is special.
 
=={{header|Erlang}}==
Line 946 ⟶ 947:
tolist topara ucpboxdraw
unboxfkeys unboxskeys winmax </pre>
 
 
=={{header|Java}}==
Line 1,105:
Further to those, LiveCode comes with a plethora of built-in constants, which are readily listed with the following command:
<lang LiveCode>put the constantNames</lang>It also provides colours as built-ins, accessible through <lang LiveCode>the colornames</lang> You can search the dictionary in the IDE using text "names" to discover more such as the ''propertyNames'' & the ''commandNames'', though are not strictly pertinent to this task.
 
 
=={{header|Lua}}==
Line 1,118 ⟶ 1,117:
 
The list will include built-in global functions, whose availability depends on the implementation and compile time configuration.
 
=={{header|M2000 Interpreter}}==
There some read only variables. We can use Help dir$ to get help about dir$.
Line 1,170:
width, x.twips, y.twips
</pre>
 
 
 
=={{header|Mathematica}}==
Line 1,219 ⟶ 1,217:
$TracePattern $TracePostAction $TracePreAction $Urgent
$UserAddOnsDirectory $UserBaseDirectory $UserBasePacletsDirectory $UserDocumentsDirectory</lang>
 
 
 
 
=={{header|Maxima}}==
Line 1,509 ⟶ 1,504:
%ENV # associative container holding the environment variables
%SIG # associative container holding signal handlers</pre>
 
=={{header|Perl 6}}==
 
It is probably useful to briefly explain normal variables in Perl 6 before tackling special variables.
 
Variables in Perl 6 have a prefix sigil to distinguish them from named subroutines, functions, classes, and so on. There is a system of sigils to mark the fundamental structural type of the variable:
<lang perl6> $foo scalar (object)
@foo ordered array
%foo unordered hash (associative array)
&foo code/rule/token/regex
::foo package/module/class/role/subset/enum/type/grammar</lang>
Sigils indicate overall interface, not the exact type of the bound object. Different sigils imply different minimal abilities. Ordinary sigils indicate normally scoped variables, either lexical or package scoped. Oddly scoped variables include a secondary sigil (a twigil) that indicates what kind of strange scoping the variable is subject to:
<lang perl6> $foo # ordinary scoping
$.foo # object attribute public accessor
$^foo # self-declared formal positional parameter
$:foo # self-declared formal named parameter
$*foo # dynamically overridable global variable
$?foo # compiler hint variable
$=foo # Pod variable
$<foo> # match variable, short for $/{'foo'}
$!foo # object attribute private storage
$~foo # the foo sublanguage seen by the parser at this lexical spot</lang>
 
Special Variables:
 
Perl 6 has deprecated most of the "line-noise" variables from Perl 5 in favor of named variables.
 
<lang perl6> $_ # The implicit variable lexically scoped to the current block
@_ # Implicit array of parameters to the current block. Still available but rarely used or needed with the improved sub signatures
$! # Current Exception object
$/ # Last match
$0, $1, $2... # Captured values from match: $/[0], $/[1], $/[2] ...
$?ARCH # Host architecture
$?XARCH # Target architecture
@*ARGS # command-line arguments
$*ARGFILES # The magic command-line input handle
&?BLOCK # current block (itself)
::?CLASS # current class (as package or type name)
$?CLASS # current class
@=COMMENT # All the comment blocks in the file
%?CONFIG # configuration hash
$*CWD # current working directory
$=DATA # data block handle (=begin DATA ... =end)
@=DATA # Same as above, but array
%?DEEPMAGIC # Controls the mappings of magical names to sub definitions
$?DISTRO # Which OS distribution am I compiling under
$*DISTRO # Which OS distribution am I running under
$*EGID # effective group id
%*ENV # system environment variables
$*ERR # Standard error handle
$*EUID # effective user id
$*EXECUTABLE_NAME # executable name
$?FILE # current filename of source file
$?GRAMMAR # current grammar
$*GID # group id
$*IN # Standard input handle; is an IO object
@*INC # where to search for user modules (but not std lib!)
$?KERNEL # operating system compiled for
$*KERNEL # operating system running under
%?LANG # What is the current set of interwoven languages?
$*LANG # LANG variable from %*ENV that defines what human language is used
$?LINE # current line number in source file
%*META-ARGS # Meta-arguments
$?MODULE # current module
%*OPTS # Options from command line
%*OPT... # Options from command line to be passed down
$*OUT # Standard output handle
$?PACKAGE # current package
$?PERL # Which Perl am I compiled for?
$*PERL # perl version running under
$*PID # system process id
%=POD # POD
$*PROGRAM_NAME # name of the Perl program being executed
%*PROTOCOLS # Stores the methods needed for the uri() function
::?ROLE # current role (as package or type name)
$?ROLE # current role
&?ROUTINE # current sub or method (itself)
$?SCOPE # Current "my" scope
$*TZ # Local time zone
$*UID # system user id
$?USAGE # Default usage message generated at compile time
$?VM # Which virtual machine am I compiling under
$?XVM # Which virtual machine am I cross-compiling for</lang>
 
Also, not really a variable but...
<lang perl6> * # A standalone term that has no fixed value, instead it captures the notion of "Whatever",
# the meaning of which is decided lazily by whatever it is an argument to.
# See the "*" section of http://perlcabal.org/syn/S02.html#Built-In_Data_Types</lang>
 
=={{header|Phix}}==
Line 1,727 ⟶ 1,634:
names that are bound to these parameters are not special, and can be
changed or hidden.)
 
=={{header|Raku}}==
(formerly Perl 6)
 
It is probably useful to briefly explain normal variables in Perl 6 before tackling special variables.
 
Variables in Perl 6 have a prefix sigil to distinguish them from named subroutines, functions, classes, and so on. There is a system of sigils to mark the fundamental structural type of the variable:
<lang perl6> $foo scalar (object)
@foo ordered array
%foo unordered hash (associative array)
&foo code/rule/token/regex
::foo package/module/class/role/subset/enum/type/grammar</lang>
Sigils indicate overall interface, not the exact type of the bound object. Different sigils imply different minimal abilities. Ordinary sigils indicate normally scoped variables, either lexical or package scoped. Oddly scoped variables include a secondary sigil (a twigil) that indicates what kind of strange scoping the variable is subject to:
<lang perl6> $foo # ordinary scoping
$.foo # object attribute public accessor
$^foo # self-declared formal positional parameter
$:foo # self-declared formal named parameter
$*foo # dynamically overridable global variable
$?foo # compiler hint variable
$=foo # Pod variable
$<foo> # match variable, short for $/{'foo'}
$!foo # object attribute private storage
$~foo # the foo sublanguage seen by the parser at this lexical spot</lang>
 
Special Variables:
 
Perl 6 has deprecated most of the "line-noise" variables from Perl 5 in favor of named variables.
 
<lang perl6> $_ # The implicit variable lexically scoped to the current block
@_ # Implicit array of parameters to the current block. Still available but rarely used or needed with the improved sub signatures
$! # Current Exception object
$/ # Last match
$0, $1, $2... # Captured values from match: $/[0], $/[1], $/[2] ...
$?ARCH # Host architecture
$?XARCH # Target architecture
@*ARGS # command-line arguments
$*ARGFILES # The magic command-line input handle
&?BLOCK # current block (itself)
::?CLASS # current class (as package or type name)
$?CLASS # current class
@=COMMENT # All the comment blocks in the file
%?CONFIG # configuration hash
$*CWD # current working directory
$=DATA # data block handle (=begin DATA ... =end)
@=DATA # Same as above, but array
%?DEEPMAGIC # Controls the mappings of magical names to sub definitions
$?DISTRO # Which OS distribution am I compiling under
$*DISTRO # Which OS distribution am I running under
$*EGID # effective group id
%*ENV # system environment variables
$*ERR # Standard error handle
$*EUID # effective user id
$*EXECUTABLE_NAME # executable name
$?FILE # current filename of source file
$?GRAMMAR # current grammar
$*GID # group id
$*IN # Standard input handle; is an IO object
@*INC # where to search for user modules (but not std lib!)
$?KERNEL # operating system compiled for
$*KERNEL # operating system running under
%?LANG # What is the current set of interwoven languages?
$*LANG # LANG variable from %*ENV that defines what human language is used
$?LINE # current line number in source file
%*META-ARGS # Meta-arguments
$?MODULE # current module
%*OPTS # Options from command line
%*OPT... # Options from command line to be passed down
$*OUT # Standard output handle
$?PACKAGE # current package
$?PERL # Which Perl am I compiled for?
$*PERL # perl version running under
$*PID # system process id
%=POD # POD
$*PROGRAM_NAME # name of the Perl program being executed
%*PROTOCOLS # Stores the methods needed for the uri() function
::?ROLE # current role (as package or type name)
$?ROLE # current role
&?ROUTINE # current sub or method (itself)
$?SCOPE # Current "my" scope
$*TZ # Local time zone
$*UID # system user id
$?USAGE # Default usage message generated at compile time
$?VM # Which virtual machine am I compiling under
$?XVM # Which virtual machine am I cross-compiling for</lang>
 
Also, not really a variable but...
<lang perl6> * # A standalone term that has no fixed value, instead it captures the notion of "Whatever",
# the meaning of which is decided lazily by whatever it is an argument to.
# See the "*" section of http://perlcabal.org/syn/S02.html#Built-In_Data_Types</lang>
 
=={{header|REXX}}==
Line 1,919 ⟶ 1,915:
for (_ <- 1 to 10) doIt() // Discarded val
def f: T; def f_=(t: T) // Combo for creating mutable f member.</pre>
 
=={{header|Smalltalk}}==
Talking about special (reserved) names, there are:
Line 2,063 ⟶ 2,060:
=={{header|VBA}}==
VBA does not have special variables.
 
=={{header|XLISP}}==
XLISP provides the following built-in variables:
10,327

edits