From 3d7b35bb37c066489546751e100c2c2b823ccba3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 19 Oct 2008 17:48:21 +0000 Subject: refs and syms --- README | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'README') 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 -- cgit v1.2.3