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 --- NEW | 3 +++ README | 26 +++++++++++++++++++++++++- docs/help.txt | 2 +- docs/pod/fype.1.gz | Bin 6311 -> 6475 bytes docs/pod/fype.html | 26 ++++++++++++++++++++++++-- docs/pod/fype.man | 43 ++++++++++++++++++++++++++++++++++++++++--- docs/pod/fype.pod | 26 +++++++++++++++++++++++++- docs/pod/fype.tex | 34 +++++++++++++++++++++++++++++++++- docs/pod/fype.txt | 26 +++++++++++++++++++++++++- docs/stats.txt | 4 ++-- docs/version.txt | 2 +- examples/synonyms.fy | 5 +++++ fype | Bin 425827 -> 426303 bytes src/build.h | 2 +- src/core/function.c | 11 +++++++++++ src/core/interpret.c | 21 +++++++++++++++++++++ src/core/token.c | 2 ++ src/core/token.h | 1 + 18 files changed, 220 insertions(+), 14 deletions(-) diff --git a/NEW b/NEW index e69de29..25373a6 100644 --- a/NEW +++ b/NEW @@ -0,0 +1,3 @@ +keywords: + syms + refs 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 diff --git a/docs/help.txt b/docs/help.txt index 0e73284..db604de 100644 --- a/docs/help.txt +++ b/docs/help.txt @@ -1,4 +1,4 @@ -Fype v0.1-devel Build 9219 +Fype v0.1-devel Build 9240 Copyright by Paul C. Buetow (2005 - 2008) -e Executes given code string (see synopses) -h Prints this help diff --git a/docs/pod/fype.1.gz b/docs/pod/fype.1.gz index e39eee0..64bebfb 100644 Binary files a/docs/pod/fype.1.gz and b/docs/pod/fype.1.gz differ diff --git a/docs/pod/fype.html b/docs/pod/fype.html index 02c30c4..6400295 100644 --- a/docs/pod/fype.html +++ b/docs/pod/fype.html @@ -38,7 +38,7 @@
  • VARIABLES
  • -
  • SYNONYMS TO VARIABLES/IDENTIFIERS
  • +
  • SYNONYMS
  • BUILT IN FUNCTIONS