added system.typed and system.untyped aliases
This commit is contained in:
parent
5bb3534f10
commit
82f8948a10
4 changed files with 12 additions and 6 deletions
|
|
@ -76,6 +76,10 @@ type
|
||||||
void* {.magic: "VoidType".} ## meta type to denote the absence of any type
|
void* {.magic: "VoidType".} ## meta type to denote the absence of any type
|
||||||
auto* = expr
|
auto* = expr
|
||||||
any* = distinct auto
|
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
|
SomeSignedInt* = int|int8|int16|int32|int64
|
||||||
## type class matching all signed integer types
|
## type class matching all signed integer types
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ discard """
|
||||||
line: 18
|
line: 18
|
||||||
errormsg: "undeclared identifier: \'b\'"
|
errormsg: "undeclared identifier: \'b\'"
|
||||||
"""
|
"""
|
||||||
template declareInScope(x: expr, t: typeDesc): stmt {.immediate.} =
|
template declareInScope(x: untyped, t: typeDesc): untyped {.immediate.} =
|
||||||
var x: t
|
var x: t
|
||||||
|
|
||||||
template declareInNewScope(x: expr, t: typeDesc): stmt {.immediate.} =
|
template declareInNewScope(x: untyped, t: typeDesc): untyped {.immediate.} =
|
||||||
# open a new scope:
|
# open a new scope:
|
||||||
block:
|
block:
|
||||||
var x: t
|
var x: t
|
||||||
|
|
||||||
declareInScope(a, int)
|
declareInScope(a, int)
|
||||||
|
|
|
||||||
2
todo.txt
2
todo.txt
|
|
@ -2,8 +2,6 @@ version 0.10.4
|
||||||
==============
|
==============
|
||||||
|
|
||||||
- make 'nil' work for 'add' and 'len'
|
- make 'nil' work for 'add' and 'len'
|
||||||
- introduce typed/untyped types
|
|
||||||
|
|
||||||
|
|
||||||
version 1.0
|
version 1.0
|
||||||
===========
|
===========
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,10 @@ News
|
||||||
spacing around binary operators. Later versions of the language will parse
|
spacing around binary operators. Later versions of the language will parse
|
||||||
these as unary operators instead so that ``echo $foo`` finally can do what
|
these as unary operators instead so that ``echo $foo`` finally can do what
|
||||||
people expect it to do.
|
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
|
Language Additions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue