groups for types? interface in Nim?

2021-02-11 Thread kobi
Ah I see, thank you very much

macros - backquote

2021-02-11 Thread Araq
And please don't scream `NUMBER_OF_REALS`, it's really not that terrible.

SSL: how to inspect and manually accept an unknown self-signed certificate?

2021-02-11 Thread idf35
I have created an issue for a getter of sslHandle

macros - backquote

2021-02-11 Thread shirleyquirk
if you `dumpTree` the type you want, it'll show you the AST you need to generate. You might not be able to use `quote do` for that bit but you can always construct the ast manually.

SSL: how to inspect and manually accept an unknown self-signed certificate?

2021-02-11 Thread benob
After fiddling quite a bit, I have succeeded in handling self-signed certificates in . There were multiple tricks: * Always activate certificate checking with SSL_VERIFY_PEER (client and server). * make sure the TLS handshake is finished before reading the c

createInterpreter in a DLL

2021-02-11 Thread dsrw
Your example works for me if I build and run it like this: nim c --app:lib --define:useNimRtl interpdll.nim nim r --define:useNimRtl interptest.nim Run You'll need to build `nimrtl.dll` from the instructions at a

How to set filepermissions

2021-02-11 Thread tubbs
Thank you Clonk!!!

macros - backquote

2021-02-11 Thread mantielero
I am trying to write a macro: macro genModelInstance*( NUMBER_OF_REALS, NUMBER_OF_INTEGERS, NUMBER_OF_BOOLEANS, NUMBER_OF_STRINGS, NUMBER_OF_STATES, NUMBER_OF_EVENT_INDICATORS: static[int]): untyped = #echo NUMBER_OF_REALS # just an int (7

groups for types? interface in Nim?

2021-02-11 Thread yglukhov
That's because: echo type(@[Dog(), Dog2()]) Run is `seq[RootRef]`, and `RootRef` doesn't implement `Animal`. Similar case [here](https://github.com/yglukhov/iface/issues/7). You can hint nim by coercing first element in the literal to correct type: var

groups for types? interface in Nim?

2021-02-11 Thread kobi
I'm not on a dev environment right now, but earlier something like this didn't seem to work: import iface iface Animal: proc say() type Dog = ref object of RootRef type Dog2 = ref object of RootRef proc say(d: Dog) = echo "bark" proc say(d: Dog2) =

Is "global_state" a special name in Nim's internals?

2021-02-11 Thread dPixie
Yes, that was my conclusion as well (see above), but I'm very confused why this wouldn't result in a warning at compile time :) Generally not something you want to do, and - as noted - can lead to hard to find bugs (if you are not aware) ...

Status Desktop - private messenger and more using Nim + QT

2021-02-11 Thread arnetheduck
It's in beta, so that might be expected, but if there are specifics, they're very interested in feedback (for example in the form of issues in the repo)

Is "global_state" a special name in Nim's internals?

2021-02-11 Thread shirleyquirk
Haven't tested, but I suspect it has to do with the fact that `var global_state` shadows the module name, `globalstate`

Is "global_state" a special name in Nim's internals?

2021-02-11 Thread dPixie
@Araq I made a repo for the project, it was on my todo list for this week anyway. You can find it on a branch with the broken code here: If you rename `global_state` to `state` it works ... I'd love to know why :) Disclaimer: First Nim pro

Is "global_state" a special name in Nim's internals?

2021-02-11 Thread dPixie
Tested renaming the var to globalState instead, just to rule out the symbol lookup problem I suggested above - still got the same error. So it wasn't that.

Is "global_state" a special name in Nim's internals?

2021-02-11 Thread dPixie
Could there be an issue where the declared variable got exported to the symbol table as literally "global_state" and all the call sites correctly looked for "globalState"? It's the only thing I could think of that would explain it. I did have it exported :) But it was one of the first things I c

groups for types? interface in Nim?

2021-02-11 Thread yglukhov
Interesting. This seems to fix it: echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4).to(Expression))) Run Here's a reduced sample for you to submit to somewhere... ;) type Expression = ref object Literal = ref object PlusExpr =

groups for types? interface in Nim?

2021-02-11 Thread yglukhov
> Thanks Always welcome) > Do you plan on publishing it in Nimble? Sure, just not sure if I like the erm... interface of it). `iface` name is awkward, and definition syntax doesn't look as natural nim as I want it to. And there's a [nim issue](https://github.com/nim-lang/Nim/issues/16613) whic

createInterpreter in a DLL

2021-02-11 Thread bobd
Thanks yeah I stuck an echo std in the DLL to confirm and it's the correct path. For my app I actually deploy a separate Nim install to avoid conflicts but for these tests I'm using the choosenim toolchain.

groups for types? interface in Nim?

2021-02-11 Thread Yardanico
> As for async, I don't see how it is not supported currently. Async procs are > just those that return Future[T], interfaces don't care. Of course you're right, something's got in my head! Thanks :) > And there's a nim issue which makes ifaces close to unusable unless you > compile in a while

groups for types? interface in Nim?

2021-02-11 Thread Yardanico
Thanks for `iface`, it loos really cool! I have a couple of questions: * Do you plan on publishing it in Nimble? * Would it be possible to have closures (esp. async ones) in interfaces?

groups for types? interface in Nim?

2021-02-11 Thread yglukhov
> it comes close, but doesn't support a seq[ISomeInterface]. Could you please clarify how it doesn't support it? In `iface` an interface is a valid type, it can be stored anywhere, in a seq or anything else. The following code works: import iface iface Animal: proc s