added 'system.shallow'

This commit is contained in:
Araq
2012-02-09 23:52:14 +01:00
parent fb35b855d5
commit e194037ea7
2 changed files with 12 additions and 3 deletions

View File

@@ -2189,7 +2189,7 @@ template doAssert*(cond: expr, msg = "") =
raiseAssert(astToStr(cond) & ' ' & msg)
proc shallow*[T](s: seq[T]) {.noSideEffect, inline.} =
proc shallow*[T](s: var seq[T]) {.noSideEffect, inline.} =
## marks a sequence `s` as `shallow`:idx:. Subsequent assignments will not
## perform deep copies of `s`. This is only useful for optimization
## purposes.
@@ -2197,7 +2197,7 @@ proc shallow*[T](s: seq[T]) {.noSideEffect, inline.} =
var s = cast[PGenericSeq](s)
s.reserved = s.reserved or seqShallowFlag
proc shallow*(s: string) {.noSideEffect, inline.} =
proc shallow*(s: var string) {.noSideEffect, inline.} =
## marks a string `s` as `shallow`:idx:. Subsequent assignments will not
## perform deep copies of `s`. This is only useful for optimization
## purposes.

View File

@@ -160,8 +160,17 @@ Version 2
issues can "easily" dealt with by ensuring:
var x = myProc() # checks myProc() initializes every pointer explicitely
- guards for the 'case' statement; generalized case statement;
a guard looks like:
case x
of nkStmtList if x.value == 0:
a generalized case statement looks like:
- generalized case statement (requires better transf)
case x with `=~`
- rethink the syntax: distinction between expr and stmt is unfortunate;
indentation handling is quite complex too; problem with exception handling
is that often the scope of ``try`` is wrong and apart from that ``try`` is