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
Stack-oriented 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!
=== Variables and dictionaries === The evaluation of different expressions has already been analysed. The implementation of variables is important for any programming language, but for stack-oriented languages, it is of special concern, as there is only one way to interact with data. The way variables are implemented in stack-oriented languages such as PostScript usually involves a separate, specialized stack which holds ''dictionaries'' of [[key–value pair|key-value pair]]s. To create a variable, a key (the variable name) must be created first, with which a value is then associated. In PostScript, a name data object is prefixed with a <code>/</code>, so <code>/x</code> is a name data object which can be associated with, for example, the number <code>42</code>. The <code>define</code> command is <code>def</code>, so <code>/x 42 def</code> associates with the name <code>x</code> with the number <code>42</code> in the dictionary atop the stack. A difference exists between <code>/x</code> and <code>x</code> – the former is a data object representing a name, and <code>x</code> stands for what is defined under <code>/x</code>.
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)