summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-10-19 17:48:21 +0000
committerPaul Buetow <paul@buetow.org>2008-10-19 17:48:21 +0000
commit3d7b35bb37c066489546751e100c2c2b823ccba3 (patch)
treea507be11afc3c55807e254ce5b24c5412367aa46 /README
parentd4657a5d7029ea66d19a5d238a9dd6bf75fe5bb0 (diff)
refs and syms
Diffstat (limited to 'README')
-rw-r--r--README26
1 files changed, 25 insertions, 1 deletions
diff --git a/README b/README
index 5c8b9b6..4e82ce6 100644
--- a/README
+++ b/README
@@ -205,7 +205,7 @@ VARIABLES
say foo;
}
-SYNONYMS TO VARIABLES/IDENTIFIERS
+SYNONYMS
Each variable can have as many synonyms as wished. A synonym is another
name to access the content of a specific variable. Here is an example of
how to use synomyms:
@@ -221,6 +221,30 @@ SYNONYMS TO VARIABLES/IDENTIFIERS
normal variables but can be also used for function and procedure names
etc.
+ # Create a new procedure baz
+ proc baz { say "I am baz"; }
+
+ # Make a synonym baz, and undefine baz
+ my bay = \baz;
+
+ undef baz;
+
+ # bay still has a reference of the original procedure baz
+ bay; # this prints aut "I am baz"
+
+ The syms keyword gives you the total number of synonyms pointing to a
+ specific value:
+
+ my foo = 1;
+ say syms foo; # Prints 1
+
+ my baz = \foo;
+ say syms foo; # Prints 2
+ say syms baz; # Prints 2
+
+ undef baz;
+ say syms foo; # Prints 1
+
BUILT IN FUNCTIONS
In Fype, operators are built in functions as well. The difference is,
that they may be written in infix notation instead in front of the