-
I didn't understand what difference of symbols and sigils have, from doc. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Right so... A symbol is basically a word that when pushed on the stack it is evaluated and manipulated the stack -- this is fairly easy to understand and let's say it is similar to a function in non-concatenative programming languages. A sigil is a prefix you put in front of a string, and it is just a shorthand for calling a symbol with one string input value. System sigils typically use special characters and if you think about it you use them all the time:
Instead of:
Or:
Instead of:
When the string input value contains spaces, you have to use double quote as you would with a string, so:
Then there's user-defined sigils. User-defined sigils typically are longer than one character and they can only contain valid symbol characters (so letters, numbers, underscores, dashes, etc) so typically you'd want to use them with double-quoted strings really. You could for example define a sigil for, I don't know, whatever takes a string input value:
Basically, sigils are nothing more than syntactic sugar 😊 |
Beta Was this translation helpful? Give feedback.
Right so... A symbol is basically a word that when pushed on the stack it is evaluated and manipulated the stack -- this is fairly easy to understand and let's say it is similar to a function in non-concatenative programming languages.
A sigil is a prefix you put in front of a string, and it is just a shorthand for calling a symbol with one string input value.
System sigils typically use special characters and if you think about it you use them all the time:
Instead of:
Or:
Instead of:
When the string input value contains spaces, you have to use double quote as you would with a string, so:
Then t…