diff options
author | Araq <rumpf_a@web.de> | 2012-09-08 20:51:50 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-09-08 20:51:50 +0200 |
commit | 580d85d233044b22c98ad8b6cae2369b250c289f (patch) | |
tree | 016887480d2891d354e43c4a5e2be5a6f2be3df3 /doc | |
parent | 46e9ff61394794245e323034fbb93c24774b8c5c (diff) | |
download | Nim-580d85d233044b22c98ad8b6cae2369b250c289f.tar.gz |
implemented 'pure' enums
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/manual.txt | 13 |
1 files changed, 13 insertions, 0 deletions
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 |