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...
### Description Any code that imports `std/math` library fails to compile to objectiveC with "Error: undeclared identifier: 'c_isnan'" Example: ```Nim # main.nim import std/math ``` ``` $ nim objc main.nim...
### Description I allocated 10 bytes of memory, one byte occupied by the `dummy` field. ```nim type ChunkObj = object data: UncheckedArray[byte] proc alloc(size: int): ref ChunkObj = unsafeNew(result, size)...
### Description ```nim import std/sequtils proc foo(x: string) = echo x & "abc" foo(cast[string](repeat('a', 6))) ``` The error log points to this code: ```c T3_ = rawNewString(x_p0.len + 3);appendString((&T3_), x_p0);appendString((&T3_)...
### Example 1 `lent type(expr)` gives Error: type mismatch ```nim proc byLent2[T](a: T): lent type(a[0]) = a[0] # Error: type mismatch: got # proc byLent2[T](a: T): lent typeof(a[0]) = a[0]...
**a.nim** ```nim type foo* = object x: int y: int ``` **b.nim** ```nim type testing* = object z: int proc foo*(t: testing) = echo "doink!" ``` **c.nim** ```nim import a,...
Module A: ``` macro ona*(body: untyped): untyped = discard macro on*(body: untyped): untyped = discard ``` Module B: ``` import modulea ona: echo "a" # no problem on: echo "b"...
Sample: ``` nim const hasThreadSupport = compileOption("threads") type SomeObj*[T] = object when hasThreadSupport: channel: ptr Channel[T] # Error: undeclared identifier: 'Channel' ``` The error occurs when you try to compile...
The issue that I want to talk about is the following for both templates and generic function implementations: When a function symbol can't be resolved in the template definition, it...
Discussing the snippet below on #nim it was suggested this was worth filing an issue. My expectation was that it would be fine to do this: ``` import strutils proc...
The compiler cannot match procedure types like `proc (_: T): R`. See https://nim-lang.org/docs/manual.html#overload-resolution for the definition of "generic match" ### Example ```nim type Callback*[S,R] = proc(_:S): R State = object...