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!
==Similar phenomena== ===Shell scripting variables=== In Unix [[shell scripting]] and in utilities such as [[Makefile]]s, the "<code>$</code>" is a unary operator that translates the name of a variable into its contents. While this may seem similar to a sigil, it is properly a [[unary operation|unary operator]] for lexical [[indirection]], similar to the <code>*</code> [[dereference operator]] for pointers in [[C (programming language)|C]], as noticeable from the fact that the dollar sign is omitted when assigning to a variable. ===Identifier conventions=== In [[Fortran language features|Fortran]], sigils are not used, but all variables starting with the letters I, J, K, L, M and N are [[integers]] by default. Fortran documentation refers to this as "implicit typing". Explicit typing is also available to allow any variable to be declared with any type. Various programming languages including [[Prolog]], [[Haskell (programming language)|Haskell]], [[Ruby (programming language)|Ruby]] and [[Go (programming language)|Go]] treat [[identifier]]s beginning with a capital letter differently from identifiers beginning with a small letter, a practice related to the use of sigils. ===Stropping=== {{main|Stropping (syntax)}} Actually a form of [[stropping (syntax)|stropping]], the use of many languages in Microsoft's [[.NET Framework|.NET]] [[Common Language Infrastructure]] (CLI) requires a way to use variables in a different language that may be keywords in a calling language. This is sometimes done by prefixes. In [[C Sharp (programming language)|C#]], any variable names may be prefixed with "<code>@</code>". This is mainly used to allow the use of variable names that would otherwise conflict with keywords.<ref>{{cite web |url=http://msdn.microsoft.com/en-us/library/x53a06bb.aspx |work=MSDN |title=C# Keywords |access-date=2011-03-23 }}</ref> The same is achieved in [[VB.Net]] by enclosing the name in square brackets, as in <code>[end]</code>.<ref>{{cite web |url=http://msdn.microsoft.com/en-us/library/362314fe.aspx |work=MSDN |title=string (C# Reference) |access-date=2011-03-23 }}</ref> The "<code>@</code>" prefix can also be applied to string literals; see [[#Literal affixes|literal affixes]] below. === Hungarian notation === Related to sigils is [[Hungarian notation]], a [[Naming convention (programming)|naming convention]] for variables that specifies variable type by attaching certain alphabetic prefixes to the variable name. Unlike sigils, however, Hungarian notation provides no information to the compiler; as such, explicit types must be redundantly specified for the variables (unless using a language with [[type inference]]). As most standard compilers do not enforce use of the prefixes, this permits omission and also makes code prone to confusion due to accidental erroneous use.<ref name="Linux kernel coding style">[https://slurm.schedmd.com/coding_style.pdf Linux kernel coding style], by Linus Torvalds</ref> ===Literal affixes=== While sigils are applied to names (identifiers), similar prefixes and suffixes can be applied to [[Literal (computer programming)|literals]], notably [[integer literal]]s and [[string literal]]s, specifying either how the literal should be evaluated, or what data type it is. For example, <code>0x10ULL</code> evaluates to the value 16 as an unsigned long long integer in C++: the <code>0x</code> prefix indicates hexadecimal, while the suffix <code>ULL</code> indicates unsigned long long. Similarly, prefixes are often used to indicate a [[raw string]], such as <code>r"C:\Windows"</code> in Python, which represents the string with value <code>C:\Windows</code>; as an escaped string this would be written as <code>"C:\\Windows"</code>. As this affects the semantics (value) of a literal, rather than the syntax or semantics of an identifier (name), this is neither stropping (identifier syntax) nor a sigil (identifier semantics), but it is syntactically similar. ===Java annotations=== Compare [[Java annotation]]s such as @Override and @Deprecated. ===Confusion=== In some cases the same syntax can be used for distinct purposes, which can cause confusion. For example, in [[C Sharp (programming language)|C#]], the "<code>@</code>" prefix can be used either for stropping (to allow reserved words to be used as identifiers), or as a prefix to a literal (to indicate a [[raw string]]); in this case neither use is a sigil, as it affects the syntax of identifiers or the semantics of literals, not the semantics of 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)