Talk:Sigil (computer programming)
This is the talk page for discussing improvements to the Sigil (computer programming) article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||
|
Talk
edit"In the PHP language, which was largely inspired by Perl" <--- uhh, what? I can't see any resemblence between PHP or Perl...
Quote:
This is the source of the long tradition of using "i", "j", "k" etc as the loop indexes of "for loops" in many programming languages—few of which have implicit typing).
It seems like this comes from math instead. As in, x sub i and x sub j
There is one thing that I find confusing about this article. In the second paragraph it is stated that Perl's sigils were adopted from the shell sigils. On the other hand, the first paragraph of Language comparision state that the $ in shell scripting is not a sigil. Isn't that a contradiction?
BernhardSchmalhofer (talk) 19:22, 27 March 2010 (UTC)
“$” precedes any variable name: I'd say it's an operator as in shell scripts. If $a is 1234, $ref is 'a' then $$ref is 1234. Which is understandable, because in PHP simply writing 'test' (without $ or quotes) means the string 'test' (if there's no constant defined as 'a')
Shell scripting, operator or not?
editThis page is confused as to whether shell scripting's '$' is a sigil or an operator. Historical context says "Larry Wall adopted shell scripting's use of sigils for his Perl programming language." but Similar phenomenon says "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 * indirection operator for pointers in C, as noticeable from the fact that the dollar sign is omitted when assigning to a variable." — Preceding unsigned comment added by 68.227.46.192 (talk) 03:49, 12 December 2013 (UTC)
- Yes, the $ operator is not a sigil. It means "what follows is special expansion syntax". Variables do not inherently have sygils. Witness:
FOO=123 # no "sigil" in assignment export FOO # none here either unset FOO # nor here echo $FOO # In expansion, distinguishes ordinary word FOO from variable echo ${FOO} # Alternative VAR=$(ls -l) # $(...) denotes process expansion
- The
$
character is not some superfluous sigil, but a necessary escape which indicates that what follows has special meaning. This allows most of a shell command line to be literal text that is minimally processed by breaking into words.
Nonsense about Lisp
editIn the "earmuffs" convention, the asterisks do not surround a variable name in any sense. They are part of the symbol name. They are not a sigil any more than C
is a sigilon class names in the Microsoft Foundation Classes or ATL, or _t
is a sigil in some C typedef names.
Look:
$ clisp -q [1]> (symbol-name '*standard-output*) "*STANDARD-OUTPUT*"
The name of the *standard-output*
symbol is the character string "*STANDARD-OUTPUT*"
, asterisks and all.
The first paragraph of the article makes it clear that sigil is "attached to" a name. Something part of a name isn't attached to a name.
Origin of BASIC's $ sigil?
editI know that Darthmouth BASIC didn't support strings at all, and Microsoft's Altair BASIC used the $. In between, I know nothing. Does anyone know if it was Microsoft that originated this feature? 147.0.139.66 (talk) 15:11, 23 November 2016 (UTC)
Hungarian notation is NOT a convention for variable-naming that specifies variable type
editRegarding:
- ... is Hungarian notation, a convention for variable-naming that specifies variable type ...
No, that is the gross misinterpretation by Microsoft documentation writers (near "inadvertently invented what came to be known as Systems Hungarian"), not at all what the inventor had in mind (explicitly stated several times in the original paper).
See also 04 mins 00 secs - 06 mins 35 secs in Triangulation 277.