From 580d85d233044b22c98ad8b6cae2369b250c289f Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 8 Sep 2012 20:51:50 +0200 Subject: implemented 'pure' enums --- doc/manual.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'doc') diff --git a/doc/manual.txt b/doc/manual.txt index e5814b9d6..c8d40c476 100755 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -795,6 +795,19 @@ values to use: As can be seen from the example, it is possible to both specify a field's ordinal value and its string value by using a tuple. It is also possible to only specify one of them. + +An enum can be marked with the ``pure`` pragma so that it's fields are not +added to the current scope, so they always need to be accessed +via ``TMyEnum.value``: + +.. code-block:: nimrod + + type + TMyEnum {.pure.} = enum + valueA, valueB, valueC, valueD + + echo valueA # error: Unknown identifier + echo TMyEnum.valueA # works String type -- cgit 1.4.1-2-gfad0