mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-22 07:15:22 +00:00
added 'system.shallow'
This commit is contained in:
@@ -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.
|
||||
|
||||
11
todo.txt
11
todo.txt
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user