Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Sigil (computer programming)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Sigil use in some languages== In [[CLIPS]], scalar variables are prefixed with a "<code>?</code>" sigil, while multifield (e.g., a 1-level list) variables are prefixed with "<code>$?</code>". In [[Common Lisp]], special variables (with dynamic scope) are typically surrounded with <code>*</code> in what is called the "[[earmuff convention]]". While this is only convention, and not enforced, the language itself adopts the practice (e.g., *standard-output*). Similarly, some programmers surround constants with <code>+</code>. In [[CycL]], variables are prefixed with a "<code>?</code>" sigil.<ref>{{cite web|url=http://www.cyc.com/cycl/syntax/variables/|title=Variables β Cycorp|website=www.Cyc.com|access-date=31 December 2017}}</ref> Similarly, constant names are prefixed with "<code>#$</code>" (pronounced "hash-dollar").<ref>{{cite web|url=http://www.cyc.com/cycl/syntax/constants-0/|title=Constants β Cycorp|website=www.Cyc.com|access-date=31 December 2017}}</ref> In [[Elixir (programming language)|Elixir]], sigils are provided via the "<code>~</code>" symbol, followed by a letter to denote the type of sigil, and then delimiters. For example, <code>~r(foo)</code> is a regular expression of "foo". Other sigils include <code>~s</code> for strings and <code>~D</code> for dates. Programmers can also create their own sigils.<ref>{{cite web | url=https://elixir-lang.org/getting-started/sigils.html | title=Getting Started: Sigils | website=Elixir | access-date=18 January 2022}}</ref> In the [[Esoteric programming language|esoteric]] [[INTERCAL]], variables are a 16-bit integer identifier prefixed with either "<code>.</code>" (called "spot") for 16-bit values, "<code>:</code>" (called "twospot") for 32-bit values, "<code>,</code>" ("tail") for arrays of 16-bit values and "<code>;</code>" ("hybrid") for arrays of 32-bit values.<ref>{{Cite web |title=C-INTERCAL 0.29 Revamped Instruction Manual |url=http://catb.org/~esr/intercal/ick.htm#Constants-and-Variables |access-date=2022-06-30 |website=catb.org}}</ref> The later CLC-Intercal added "<code>@</code>" ("whirlpool") for a variable that can contain no value (used for [[Class (computer programming)|classes]]) and "<code>_</code>" used to store a modified [[compiler]].<ref>{{Cite web |title=CLC-INTERCAL Reference |url=https://oshaboy.github.io/clc_intercal_docs/expressions.html#variables |access-date=2022-06-30 |website=oshaboy.github.io}}</ref> In [[MAPPER]] (aka BIS), named variables are prefixed with "<" and suffixed with ">" because strings or character values do not require quotes. In [[mIRC script]], identifiers have a "<code>$</code>" sigil, while all variables have a "<code>%</code>" prefixed (regardless of local or global variables or data type). Binary variables are prefixed by an "<code>&</code>". In the [[MUMPS (programming language)|MUMPS]] programming language, "<code>$</code>" precedes intrinsic function names and "special variable names" (built-in variables for accessing the execution state). "<code>$Z</code>" precedes non-standard intrinsic function names. "<code>$$</code>" precedes extrinsic function names. Routines (used for procedures, subroutines, functions) and global variables (database storage) are prefixed by a caret (^). The last global variable subtree may be referenced indirectly by a caret and the last subscript; this is referred to as a "naked reference". System-wide routines and global variables (stored in certain shared database(s)) are prefixed with ^%; these are referred to as "percent routines" and "percent globals". In [[Objective-C]], string literals preceded with "<code>@</code>" are instances of the object type <code>NSString</code> or, since [[clang]] v3.1 / [[LLVM]] v4.0, <code>NSNumber</code>, <code>NSArray</code> or <code>NSDictionary</code>. The prefix <code>@</code> is also used on the keywords <code>interface</code>, <code>implementation</code>, and <code>end</code> to express the structure of class definitions. Within class declarations and definitions as well, a prefix of <code>-</code> is used to indicate member methods and variables, while prefix <code>+</code> indicates class elements. In the [[PHP]] language, which was largely inspired by Perl, "<code>$</code>" precedes any [[variable (programming)|variable]] name. Names not prefixed by this are considered [[constant (computer science)|constants]], [[function (computer science)|functions]] or [[Class (computer programming)|class]] names (or interface or trait names, which share the same namespace as classes). [[PILOT]] uses "<code>$</code>" for buffers (string variables), "<code>#</code>" for integer variables, and "<code>*</code>" for program labels. [[Python (programming language)|Python]] uses a "<code>__</code>" prefix, called ''dunder'', for [[name mangling#Python|"private" attributes]]. In [[Ruby programming language|Ruby]], ordinary variables lack sigils, but "<code>$</code>" is prefixed to [[global variable]]s, "<code>@</code>" is prefixed to [[instance variable]]s, and "<code>@@</code>" is prefixed to [[class variable]]s. Ruby also allows (strictly conventional) suffix sigils: "<code>?</code>" indicates a predicate method returning a [[Boolean function|boolean]] or a [[truth value#Computing|truthy or falsy]] value, and "<code>!</code>" indicates that the method may have a potentially unexpected effect and needs to be handled with care.<ref>{{cite web|last=Black|first=David A.|title=Bang methods; or, Danger, Will Rubyist!|date=15 August 2007|url=http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist|archive-url=https://web.archive.org/web/20160522235741/http://dablog.rubypal.com/2007/8/15/bang-methods-or-danger-will-rubyist|archive-date=22 May 2016}}</ref> In [[Scheme (programming language)|Scheme]], by convention, the names of procedures that always return a boolean value usually end in "<code>?</code>". Likewise, the names of procedures that store values into parts of previously allocated Scheme objects (such as pairs, vectors, or strings) usually end in "<code>!</code>". [[Standard ML]] uses the prefix sigil "<code>'</code>" on a variable that refers to a type. If the sigil is doubled, it refers to a type for which equality is defined. The "<code>'</code>" character may also appear within or at the end of a variable, in which case it has no special meaning. In [[Transact-SQL]], "<code>@</code>" precedes a local variable or parameter name. System functions (previously known as global variables) are distinguished by a "<code>@@</code>" prefix. The scope of temporary tables is indicated by the prefix "<code>#</code>" designating local and "<code>##</code>" designating global. In [[Windows PowerShell]], which was partly inspired by [[Unix shell]]s and Perl, variable names are prefixed by the "<code>$</code>" sigil. In [[XSLT]], variables and parameters have a leading "<code>$</code>" sigil on use, although when defined in <code><xsl:param></code> or <code><xsl:variable></code> with the "<code>name</code>" attribute, the sigil is not included. Related to XSLT, [[XQuery]] uses the "<code>$</code>" sigil form both in definition and in use. In [[Maya Embedded Language|MEL]], variable names are prefixed by "<code>$</code>" to distinguish them from functions, commands, and other identifiers.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)