Hello again !
A hash set is pretty much a hash table where the key and value types are the
same.
So, checking for the existence of an element in a hash set will do the
following :
* Check for the existence of the key based on its hash.
* Compare the associated value with the element.
I found the link by using Ctrl+F when browsing the manual. The integrated
search engine is to search the API.
Hello,
> could anyone please tell me in a simple language what does .closure. means
> and how it affected with .nimcall. ?
Sure thing !
Here is a [link](https://nim-lang.org/docs/manual.html#types-procedural-type)
the part of the language manual that talks about this topic.
In case you could
Thanks for the reply.
> For now just drop the {.raises.} annotation, the compiler can compute this on
> its own.
Yes, it works indeed, thanks a lot.
I originally intended to make a lazy version of raiseException like this:
import std/sugar
proc raiseException* [E:
Hello everyone,
I am trying to wrap the `raise` operator in a procedure like so:
proc raiseException* [E: CatchableError](e: ref E; R: typedesc): R
{.raises: [E].} =
raise e
when isMainModule:
try:
newException(IOError, "").raiseException(void)
I think it is fine since `TestType`'s members are private.
So, constructing a `TestType` from another module would require a call to
`newTestType` anyway.
Hello,
Redefining `TestType` this way allows reusing `AbstractType`, but I find it a
little repetitive:
type
TestType*[T : distinct AbstractType | AbstractType; Y : distinct
AbstractType | AbstractType] = object
a : T
b : Y
Run
Also,
Thanks for the reply.
func someFunc(f: func(): bool {.nimcall, noSideEffect.}): bool =
f()
Run
This is the workaround I use (nimcall or closure) and it does the job, though a
bit repetitive.
I forgot to tell the compiler version I used: `0.19.4`.
Hi,
I want to declare a function that takes another one as its parameter.
func someFunc(f: func(): bool): bool =
f()
Run
So I expect `someFunc` and `f` to have the `noSideEffect` pragma.
import std/typetraits
echo someFunc.type()