added 'system.shallow'
This commit is contained in:
parent
fb35b855d5
commit
e194037ea7
2 changed files with 12 additions and 3 deletions
|
|
@ -2189,7 +2189,7 @@ template doAssert*(cond: expr, msg = "") =
|
||||||
raiseAssert(astToStr(cond) & ' ' & 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
|
## marks a sequence `s` as `shallow`:idx:. Subsequent assignments will not
|
||||||
## perform deep copies of `s`. This is only useful for optimization
|
## perform deep copies of `s`. This is only useful for optimization
|
||||||
## purposes.
|
## purposes.
|
||||||
|
|
@ -2197,7 +2197,7 @@ proc shallow*[T](s: seq[T]) {.noSideEffect, inline.} =
|
||||||
var s = cast[PGenericSeq](s)
|
var s = cast[PGenericSeq](s)
|
||||||
s.reserved = s.reserved or seqShallowFlag
|
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
|
## marks a string `s` as `shallow`:idx:. Subsequent assignments will not
|
||||||
## perform deep copies of `s`. This is only useful for optimization
|
## perform deep copies of `s`. This is only useful for optimization
|
||||||
## purposes.
|
## purposes.
|
||||||
|
|
|
||||||
11
todo.txt
11
todo.txt
|
|
@ -160,8 +160,17 @@ Version 2
|
||||||
issues can "easily" dealt with by ensuring:
|
issues can "easily" dealt with by ensuring:
|
||||||
|
|
||||||
var x = myProc() # checks myProc() initializes every pointer explicitely
|
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;
|
- rethink the syntax: distinction between expr and stmt is unfortunate;
|
||||||
indentation handling is quite complex too; problem with exception handling
|
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
|
is that often the scope of ``try`` is wrong and apart from that ``try`` is
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue