added system.typed and system.untyped aliases

This commit is contained in:
Araq
2015-04-07 00:06:39 +02:00
parent 5bb3534f10
commit 82f8948a10
4 changed files with 12 additions and 6 deletions

View File

@@ -76,6 +76,10 @@ type
void* {.magic: "VoidType".} ## meta type to denote the absence of any type
auto* = expr
any* = distinct auto
untyped* {.magic: Expr.} ## meta type to denote an expression that
## is not resolved (for templates)
typed* {.magic: Stmt.} ## meta type to denote an expression that
## is resolved (for templates)
SomeSignedInt* = int|int8|int16|int32|int64
## type class matching all signed integer types

View File

@@ -3,12 +3,12 @@ discard """
line: 18
errormsg: "undeclared identifier: \'b\'"
"""
template declareInScope(x: expr, t: typeDesc): stmt {.immediate.} =
template declareInScope(x: untyped, t: typeDesc): untyped {.immediate.} =
var x: t
template declareInNewScope(x: expr, t: typeDesc): stmt {.immediate.} =
template declareInNewScope(x: untyped, t: typeDesc): untyped {.immediate.} =
# open a new scope:
block:
block:
var x: t
declareInScope(a, int)

View File

@@ -2,8 +2,6 @@ version 0.10.4
==============
- make 'nil' work for 'add' and 'len'
- introduce typed/untyped types
version 1.0
===========

View File

@@ -69,6 +69,10 @@ News
spacing around binary operators. Later versions of the language will parse
these as unary operators instead so that ``echo $foo`` finally can do what
people expect it to do.
- ``system.untyped`` and ``system.typed`` have been introduced as aliases
for ``expr`` and ``stmt``. The new names capture the semantics much better
and most likely ``expr`` and ``stmt`` will be deprecated in favor of the
new names.
Language Additions