mango是什么意思| 神经病是什么意思| hpv感染后有什么症状| 全科医学科是什么科| 吃什么有助于骨头愈合| 五更泻吃什么药| 气性坏疽是什么病| 容易受惊吓是什么原因| 银耳有什么功效| 印度人为什么用手抓饭吃| 四月十号是什么星座| 女人大腿粗代表什么| 胎位roa是什么意思| 手上起小水泡痒是什么原因| 剖腹产吃什么下奶快| 明天是什么日子| 经常喝柠檬水有什么好处和坏处| gr什么意思| 上睑下垂是什么原因造成的| 沙姜是什么姜| 酒后吃什么水果好| 曹休和曹操什么关系| 谭咏麟属什么生肖| 吃番茄有什么好处| 3月19是什么星座| 口臭药店买什么药吃| 月子期间能吃什么水果| 30是什么意思| 天空为什么是蓝色| 肚脐下三寸是什么位置| 脖子粗挂什么科| 甲硝唑治什么| 贫血什么症状| 什么习习| 小孩舌头发白什么原因| 整装待发是什么意思| 脾胃不好吃什么药效果好| 蜂蜜什么时候吃最好| 哺乳期吃什么奶水多| 当归和党参有什么区别| 阿莫西林吃多了有什么副作用| 切糕为什么这么贵| 17度穿什么衣服合适| 铁马是什么| 宫寒吃什么药调理最好| 忻字五行属什么| 苍茫的天涯是我的爱是什么歌| 什么是继发性肺结核| 日行千里是什么生肖| 戏谑是什么意思| mri什么意思| 射手座和什么座最配对| 人流是什么| 甲状腺有血流信号是什么意思| 备胎是什么意思| 不什么不什么的词语| 南瓜和窝瓜有什么区别| 二尖瓣微量反流什么意思| 人造革是什么材质| 做活检是什么意思| 炸鸡翅裹什么粉| 刻骨铭心是什么意思| 什么的仪式| 男人忽冷忽热说明什么| 皋读什么| o型血rh阳性是什么意思| 梦见煮饭是什么意思| 刺梨根泡酒有什么功效| 俱往矣是什么意思| 蓝精灵是什么药| 微信头像用什么好| 肉桂是什么| 坐月子是什么意思| 7月30号什么星座| 腹膜后是什么位置| 奥美拉唑和雷贝拉唑有什么区别| 迂回战术什么意思| 冰妹是什么| 宝宝干咳吃什么药| 过敏看什么科| 针对性是什么意思| 长期服用二甲双胍有什么副作用| cd3cd4cd8都代表什么| 咳嗽有绿痰是什么原因| 泛性恋是什么| 孕妇不能吃什么东西| 身上汗味重是什么原因| 老年人吃什么增强免疫力| 害怕什么| uva是什么意思| 后颈长痘痘是什么原因| 梦见生姜是什么意思| 燕子进屋来有什么兆头| revive是什么意思| 荞麦枕头有什么好处| 巫是什么意思| amor是什么意思| 梦见狗咬自己是什么意思| 女性尿频尿急吃什么药| 疥疮用什么药| 致字五行属什么| 今天是什么好日子| 哈哈是什么意思| 什么的星星| 纵隔肿瘤是什么病| 借什么不用还| 胃食管反流吃什么药| 近视是什么原因造成的| 早上出虚汗是什么原因| 氯中毒吃什么可以解毒| 一什么天安门| 黄色裤子配什么颜色上衣| 雌二醇过高是什么原因| 胆红素高是怎么回事有什么危害| 临床路径是什么意思| 双克是什么药| 熟褐色是什么颜色| 什么饮料好喝又健康| 月经量突然减少是什么原因| 圣诞礼物什么时候送| 粘土能做什么| 狼烟是什么意思| 黄体期什么意思| 巴士是什么意思| 打封闭针是什么意思| 6月27是什么星座| 无锡为什么叫无锡| 新疆人是什么民族| 尼哥是什么意思| 猫的胡须是干什么用的| 388是什么意思| 怀孕后期脚肿是什么原因| 吃什么补血快效果好| 拉肚子吃什么抗生素| 小粉是什么粉| 潮汐车道是什么意思| 肌钙蛋白高是什么原因| 神态自若是什么意思| 1966年是什么命| 似水年华是什么意思| 宫腔镜是什么手术| 用鸡蛋滚脸有什么好处| 心电图伪差是什么意思| 夏天吃什么菜| 喝莓茶对身体有什么好处| 长寿面什么时候吃| 胸部爱出汗是什么原因| 什么东西补气血效果最好| 小叶紫檀五行属什么| 眼睛视力模糊用什么眼药水| 孔雀开屏是什么意思| 糖尿病2型是什么意思| 他将是你的新郎是什么歌| 胆结石能吃什么水果| 掉头发要吃什么| 夏天吹空调感冒了吃什么药| 什么叫手足口病| 一月三日是什么星座| 国士无双是什么意思| 姿态万千的意思是什么| 肝肾功能检查挂什么科| 皮肤一碰就破是什么病| 三级警督是什么级别| 四川人喜欢吃什么| 胃酸胃烧心吃什么药| 6月18是什么日子| 宰相和丞相有什么区别| 阴道有褐色分泌物是什么原因| 内分泌失调吃什么食物好| 花生什么时候收| 10月9日什么星座| 属相是什么意思| 面部提升紧致做什么效果最好| 陆地上最重的动物是什么| 宝宝流鼻血是什么原因| 董明珠什么星座| 身体怕冷什么原因| 绿茶是什么意思| 舌头麻是什么原因| 稷是什么农作物| 让平是什么意思| 标新立异什么意思| 凌晨5点是什么时辰| 舌头干涩是什么原因| 吃什么补钾快| 褪黑素有什么副作用| 梦见猪是什么意思| 神父是什么意思| 舍友什么意思| 什么情况啊这是| 守夜是什么意思| 开端是什么意思| 巨蟹男和什么座最配对| 喉咙痛头痛吃什么药| 吞咽困难是什么原因造成的| 男属鸡的和什么属相最配| 胎盘位置低有什么危险| 生育保险是什么| 儿童说话晚去医院挂什么科| 支气管发炎用什么药| 假如时光倒流我能做什么| 画什么才好看| 执念什么意思| 盆腔ct能检查出什么病| 狂风暴雨是什么意思| 70年产权是从什么时候开始算| 中校军衔是什么级别| 什么叫肺结节| sma是什么| 肾功能不全有什么症状| 相位是什么| 榴莲不可以和什么食物一起吃| hpv是什么病严重吗| 血小板低是什么引起的| fashion什么意思| 医保是什么| 手上为什么会有小水泡| 阑尾炎做什么检查| 冲太岁是什么意思| 剪不断理还乱什么意思| 喝酒为什么会吐| 肾看什么科| 为什么要喝酒| 什么时候出伏| 徐州二院全名叫什么| 草莓什么时候种| 狗狗狂犬疫苗什么时候打| 有什么黄色网站| 1995年五行属什么| 指控是什么意思| 脾胃不好挂什么科| 匝道是什么| 西铁城是什么档次的表| 胸痛吃什么药| 为什么下雨后会出现彩虹| 甲鱼是什么| 1969年属什么| 脱相是什么意思| 上不下要念什么| 包皮溃烂是什么原因| 95年属什么的生肖| 重丧是什么意思| 空调买什么品牌的好| 自来水是什么水| cdp是什么| 头三个月保胎喝什么汤| 轶字五行属什么| 头七烧什么| maby什么意思| 7月17日什么星座| 琳琅是什么意思| 手掌心有痣代表什么| 早上7点到9点是什么时辰| hct是什么| 睡醒手麻是什么原因引起的| 乳酸杆菌是什么| 一戴套就软是什么原因| 浅笑嫣然是什么意思| 牙周炎吃什么药最有效| 枫叶是什么颜色的| 雷锋代表什么生肖| 肾囊肿是什么| 熠熠什么意思| 突然心跳加快是什么原因| 百度

火星 陨石 地球的钙同位素报告出炉

百度 很快,报警的女生发来感谢的短信,干得好,接警员你真棒。

In computer programming, a sigil (/?s?d??l/) is a symbol affixed to a variable name, showing the variable's datatype or scope, usually a prefix, as in $foo, where $ is the sigil.

Sigil, from the Latin sigillum, meaning a "little sign", means a sign or image supposedly having magical power.[1] Sigils can be used to separate and demarcate namespaces that possess different properties or behaviors.

Historical context

edit

The use of sigils was popularized by the BASIC programming language. The best known example of a sigil in BASIC is the dollar sign ("$") appended to the names of all strings. Many BASIC dialects use other sigils (like "%") to denote integers and floating-point numbers and their precision, and sometimes other types as well.

Larry Wall adopted shell scripting's use of sigils for his Perl programming language.[citation needed] In Perl, the sigils do not specify fine-grained data types like strings and integers, but the more general categories of scalars (using a prefixed "$"), arrays (using "@"), hashes (using "%"), and subroutines (using "&"). Raku also uses secondary sigils, or twigils,[2] to indicate the scope of variables. Prominent examples of twigils in Raku include "^" (caret), used with self-declared formal parameters ("placeholder variables"), and ".", used with object attribute accessors (i.e., instance variables).

Sigil use in some languages

edit

In CLIPS, scalar variables are prefixed with a "?" sigil, while multifield (e.g., a 1-level list) variables are prefixed with "$?".

In Common Lisp, special variables (with dynamic scope) are typically surrounded with * 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 +.

In CycL, variables are prefixed with a "?" sigil.[3] Similarly, constant names are prefixed with "#$" (pronounced "hash-dollar").[4]

In Elixir, sigils are provided via the "~" symbol, followed by a letter to denote the type of sigil, and then delimiters. For example, ~r(foo) is a regular expression of "foo". Other sigils include ~s for strings and ~D for dates. Programmers can also create their own sigils.[5]

In the esoteric INTERCAL, variables are a 16-bit integer identifier prefixed with either "." (called "spot") for 16-bit values, ":" (called "twospot") for 32-bit values, "," ("tail") for arrays of 16-bit values and ";" ("hybrid") for arrays of 32-bit values.[6] The later CLC-Intercal added "@" ("whirlpool") for a variable that can contain no value (used for classes) and "_" used to store a modified compiler.[7]

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 "$" sigil, while all variables have a "%" prefixed (regardless of local or global variables or data type). Binary variables are prefixed by an "&".

In the MUMPS programming language, "$" precedes intrinsic function names and "special variable names" (built-in variables for accessing the execution state). "$Z" precedes non-standard intrinsic function names. "$$" 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 "@" are instances of the object type NSString or, since clang v3.1 / LLVM v4.0, NSNumber, NSArray or NSDictionary. The prefix @ is also used on the keywords interface, implementation, and end to express the structure of class definitions. Within class declarations and definitions as well, a prefix of - is used to indicate member methods and variables, while prefix + indicates class elements.

In the PHP language, which was largely inspired by Perl, "$" precedes any variable name. Names not prefixed by this are considered constants, functions or class names (or interface or trait names, which share the same namespace as classes).

PILOT uses "$" for buffers (string variables), "#" for integer variables, and "*" for program labels.

Python uses a "__" prefix, called dunder, for "private" attributes.

In Ruby, ordinary variables lack sigils, but "$" is prefixed to global variables, "@" is prefixed to instance variables, and "@@" is prefixed to class variables. Ruby also allows (strictly conventional) suffix sigils: "?" indicates a predicate method returning a boolean or a truthy or falsy value, and "!" indicates that the method may have a potentially unexpected effect and needs to be handled with care.[8]

In Scheme, by convention, the names of procedures that always return a boolean value usually end in "?". Likewise, the names of procedures that store values into parts of previously allocated Scheme objects (such as pairs, vectors, or strings) usually end in "!".

Standard ML uses the prefix sigil "'" on a variable that refers to a type. If the sigil is doubled, it refers to a type for which equality is defined. The "'" character may also appear within or at the end of a variable, in which case it has no special meaning.

In Transact-SQL, "@" precedes a local variable or parameter name. System functions (previously known as global variables) are distinguished by a "@@" prefix. The scope of temporary tables is indicated by the prefix "#" designating local and "##" designating global.

In Windows PowerShell, which was partly inspired by Unix shells and Perl, variable names are prefixed by the "$" sigil.

In XSLT, variables and parameters have a leading "$" sigil on use, although when defined in <xsl:param> or <xsl:variable> with the "name" attribute, the sigil is not included. Related to XSLT, XQuery uses the "$" sigil form both in definition and in use.

In MEL, variable names are prefixed by "$" to distinguish them from functions, commands, and other identifiers.

Similar phenomena

edit

Shell scripting variables

edit

In Unix shell scripting and in utilities such as Makefiles, the "$" 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 operator for lexical indirection, similar to the * dereference operator for pointers in C, as noticeable from the fact that the dollar sign is omitted when assigning to a variable.

Identifier conventions

edit

In 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, Ruby and Go treat identifiers beginning with a capital letter differently from identifiers beginning with a small letter, a practice related to the use of sigils.

Stropping

edit

Actually a form of stropping, the use of many languages in Microsoft's .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#, any variable names may be prefixed with "@". This is mainly used to allow the use of variable names that would otherwise conflict with keywords.[9] The same is achieved in VB.Net by enclosing the name in square brackets, as in [end].[10]

The "@" prefix can also be applied to string literals; see literal affixes below.

Hungarian notation

edit

Related to sigils is Hungarian notation, a 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.[11]

Literal affixes

edit

While sigils are applied to names (identifiers), similar prefixes and suffixes can be applied to literals, notably integer literals and string literals, specifying either how the literal should be evaluated, or what data type it is. For example, 0x10ULL evaluates to the value 16 as an unsigned long long integer in C++: the 0x prefix indicates hexadecimal, while the suffix ULL indicates unsigned long long. Similarly, prefixes are often used to indicate a raw string, such as r"C:\Windows" in Python, which represents the string with value C:\Windows; as an escaped string this would be written as "C:\\Windows".

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

edit

Compare Java annotations such as @Override and @Deprecated.

Confusion

edit

In some cases the same syntax can be used for distinct purposes, which can cause confusion. For example, in C#, the "@" 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.

See also

edit

References

edit
  1. ^ "Definition of sigil". Collins English Dictionary. Retrieved 22 May 2012.
  2. ^ "Perl 6 variables:Twigils", Perl 6 Documentation.
  3. ^ "Variables – Cycorp". www.Cyc.com. Retrieved 31 December 2017.
  4. ^ "Constants – Cycorp". www.Cyc.com. Retrieved 31 December 2017.
  5. ^ "Getting Started: Sigils". Elixir. Retrieved 18 January 2022.
  6. ^ "C-INTERCAL 0.29 Revamped Instruction Manual". catb.org. Retrieved 2025-08-07.
  7. ^ "CLC-INTERCAL Reference". oshaboy.github.io. Retrieved 2025-08-07.
  8. ^ Black, David A. (15 August 2007). "Bang methods; or, Danger, Will Rubyist!". Archived from the original on 22 May 2016.
  9. ^ "C# Keywords". MSDN. Retrieved 2025-08-07.
  10. ^ "string (C# Reference)". MSDN. Retrieved 2025-08-07.
  11. ^ Linux kernel coding style, by Linus Torvalds
ab型血和b型血生的孩子是什么血型 女人耳鸣是什么前兆 生动是什么意思 深夜里买醉是什么歌 四个月念什么字
西瓜什么样的好吃 先明后不争什么意思 吃什么降血压 脱髓鞘病变是什么意思 免费婚检都检查什么项目
酪朊酸钠是什么 青钱柳有什么功效与作用 运动后体重增加是什么原因 什么情况下会得荨麻疹 VA什么意思
畅字五行属什么 青霉素是什么药 检查鼻炎要做什么检查 什么是贸易顺差 甲木代表什么
招财猫鱼吃什么hcv8jop0ns6r.cn 戊型肝炎是什么病hcv9jop5ns6r.cn 冰火是什么意思hcv8jop4ns2r.cn 5月26日是什么星座hcv9jop5ns1r.cn 碳酸饮料喝多了有什么危害hcv9jop7ns5r.cn
拉架棉是什么面料hcv9jop5ns9r.cn 男性疝气是什么病hcv8jop9ns5r.cn 为什么会莫名其妙流鼻血hcv9jop7ns1r.cn 后悔是什么意思hcv9jop3ns8r.cn 尚清是什么意思hcv9jop1ns8r.cn
什么人生病从来不看医生hcv8jop5ns3r.cn 为什么会脚麻hcv8jop6ns5r.cn 什么是缘分xinmaowt.com 鹧鸪读音是什么hcv7jop9ns8r.cn 一什么羊hcv8jop5ns5r.cn
抖机灵是什么意思hcv9jop1ns3r.cn 胃蛋白酶原1偏低是什么意思hcv8jop1ns6r.cn 藜芦是什么东西hcv8jop6ns3r.cn 海马用什么呼吸hcv9jop0ns2r.cn 从未是什么意思hcv9jop0ns7r.cn
百度