Re: Help with hash sets needed

2020-04-07 Thread thenjip
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.

Re: {.nimcall.} and {.closure.}

2020-03-26 Thread thenjip
I found the link by using Ctrl+F when browsing the manual. The integrated search engine is to search the API.

Re: {.nimcall.} and {.closure.}

2020-03-25 Thread thenjip
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

Re: Using a generic type in 'raises' pragma's argument

2019-08-09 Thread thenjip
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:

Using a generic type in 'raises' pragma's argument

2019-08-08 Thread thenjip
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)

Re: Weird behaviour with generic type

2019-07-13 Thread thenjip
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.

Re: Weird behaviour with generic type

2019-07-13 Thread thenjip
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,

Re: Procedural type and 'func' keyword

2019-02-17 Thread thenjip
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`.

Procedural type and 'func' keyword

2019-02-16 Thread thenjip
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()