Nim
Nim copied to clipboard
Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, an...
seq and array seems to be a special case ### Example ```nim type Seq[U] = seq[U] proc foo(s:typedesc[seq]) = echo "seq works" proc foo(s:typedesc[Seq]) = echo "Seq works" Seq.foo #works...
SslContext from net.newContext() leaks memory when destroyed. ### Example ```nim import std/net proc main() = for i in 1 .. 4: let ctx = newContext() main() ``` ### Current Output...
### Example ```nim {.experimental: "views".} type Foo = object value: openArray[string] proc main(): auto = let a = ["1", "2", "3"] let foo = Foo(value: a.toOpenArray(0, 2)) return foo echo...
ref https://forum.nim-lang.org/t/12537#77311
Seems to `when nimvm` doesn't work properly with fatal pragma. See [original forum thread](https://forum.nim-lang.org/t/9214) with useful comments! ### Example ```nim template gen_str_in_ct_1: string = when nimvm: "sisix dev" else: {.fatal:...
### Example ```nim import std/macros proc withTypedesc(T: typedesc): T = discard macro genVar(name: untyped) = newVarStmt( name, newCall( bindSym("withTypedesc"), bindSym "int" ) ) genVar foo echo foo ``` https://play.nim-lang.org/#ix=4448 ###...
### What happened? Originally described in https://github.com/pragmagic/vscode-nim/issues/198 ```nim type All = enum a1 a2 b1 b2 A = range[a1..a2] B = range[b1..b2] proc test(a: A) = echo a test(b1) ```...
### What happened? Project do not compiles. Internal error reported. ### Nim Version Nim Compiler Version 1.6.6 [Linux: amd64] Compiled at 2022-07-14 Copyright (c) 2006-2021 by Andreas Rumpf ### Current...
### Description This works fine: ```nim type Rect = tuple x, y, w, h: cint proc rect(x, y: cint; w = cint(0), h = cint(0)): Rect = result.x = x...
### Description ```nim type PBOption[defaultValue: static[auto]] = object some: bool value: typeof(defaultValue) Type1* = object a: PBOption[default(ref Type2)] Type2* = object a: PBOption[default(ref Type1)] ``` ### Nim Version Nim Compiler...