Need help implementing bind for C for webview.h

2021-04-19 Thread shirleyquirk
omg even more infuriating when {.cdecl.} and {.nimcall.} are identical on every target other than win32. even there i've got my doubts. {.cdecl.} must die.

Need help implementing bind for C for webview.h

2021-04-19 Thread shirleyquirk
ah yes you also need to define your bindCproc to match the WebviewCb type, i should have mentioned proc bindCProc(sequ:cstring, req:cstring, arg: pointer) {.exportc,cdecl.} = let idx = cast[int](arg) ... Run theres no benefit to using the c backend i was ju

How to access n theJS backend Bootstrap's "modal" method?

2021-04-19 Thread halloleo
Aha! So the `proc` definition is only important for the Nim-side (i.e. if Nim needs an `Element`, the proc needs to be defined as taking an `Element` param, if Nim needs a `JSObject`, the proc has to be defined accordingly). The only thing I now have to figure out, is how to call Bootstrap's "mo

Documentation comments before the item being commented?

2021-04-19 Thread timothee
both these work: const Answer1* = 42 ## doc comment here const Answer2* = 42 ## doc comment here Run if you can't find this in docs, please make a PR

test

2021-04-19 Thread fitruga
6

test

2021-04-19 Thread fitruga
test

Need help implementing bind for C for webview.h

2021-04-19 Thread francisl
Thanks, I didn't saw it. But from what I read, it's for GTK only and it's also using the old version.

Need help implementing bind for C for webview.h

2021-04-19 Thread Clonk
Have you taken a look at ? I believe it is based on webview as well It was announced in a forum thread

Simple RPC, call remote Nim functions as if its local, experimenting...

2021-04-19 Thread Clonk
> It's working, but needs some refactoring and implementing the network > transport in a more efficient way with TCP and asyncdispatch, and, I haven't > published it to Nimble yet. As a suggestion, you could try using the ZMQ library. It comes with "battery included" regarding efficiency and co

Accessing {.emit.}'d variables across modules?

2021-04-19 Thread exelotl
I've settled on the following solution of using a helper module which emits the symbol to be importc'd (thanks to @clyybber for the idea!) # main.nim import mymodule echo foo # Works! import helper # Add helper to the build. Run

Need help implementing bind for C for webview.h

2021-04-19 Thread francisl
Thanks for the answer. Sadly I can't get that compiled either. /webview/examples/minimal/minimal.nim(12, 2) Error: type mismatch: got but expected one of: proc connect(w: Webview; name: cstring; fn: WebviewCb) first type mismatch at position: 3 required type for

Simple RPC, call remote Nim functions as if its local, experimenting...

2021-04-19 Thread alexeypetrushin
Thanks, I updated the server function, now it works with pragma as `proc pi: float {.sfun.} = 3.14`, nice :) But can the client function also be used with pragma? As `proc pi: float {.sfun.}` without the function body?

ArrayBuffer

2021-04-19 Thread treeform
I have ArrayBuffer/DataView wrapped in my library:

Need help implementing bind for C for webview.h

2021-04-19 Thread shirleyquirk
i also managed to get your example to compile with the c backend, it's an utter hack and of dubious use. but hey: in the config file define: gcc.exe = "g++" gcc.linkerexe = "g++" -passC:-fpermissive #to allow converting char* to const char* Run and change the

Need help implementing bind for C for webview.h

2021-04-19 Thread shirleyquirk
the `void* arg` is for the user callback to be able to take an argument. it's `void*` so it can be of any type. the `void* arg` is for the user callback to be able to receive a parameter, it's `void*` so it can be any type, the user callback then casts it to the type it needs you're getting an

Accessing {.emit.}'d variables across modules?

2021-04-19 Thread exelotl
What would that look like? Is there a way to ensure different codegendecl output depending on whether the variable is being accessed in `mymodule.nim` or `main.nim`?

Accessing {.emit.}'d variables across modules?

2021-04-19 Thread juancarlospaco
codegendecl

Need help implementing bind for C for webview.h

2021-04-19 Thread francisl
Hi, A couple of month back I tried to make the webview work for Nim against the new version. () The implementation link on the page use the old version, which is buggy and terribly slow, and is not upgradable. I had the basic working fine, but now if I want

Accessing {.emit.}'d variables across modules?

2021-04-19 Thread exelotl
In my game I'm using {.emit.} to achieve some things that are [currently](https://github.com/nim-lang/RFCs/issues/257#issuecomment-805816584) [difficult](https://forum.nim-lang.org/t/5192) in Nim. Unfortunately, {.emit.}'d variables are awkward... When using {.importc.} to bring them back into

Simple RPC, call remote Nim functions as if its local, experimenting...

2021-04-19 Thread shirleyquirk
sfun and cfun could be macro pragmas, enabling this syntax: #server.nim proc pi:float{.sfun.} = 3.14 #client.nim proc pi:float{.cfun.} Run

How to access n theJS backend Bootstrap's "modal" method?

2021-04-19 Thread geotre
You can replace `JsObject` with `Element`, or do something like this (so `.modal()` cannot be called on just any `Element`: type ModalElement = ref object of Element proc selectModal(query: cstring): ModalElement = result = document.querySelector(query).ModalElement

Simple RPC, call remote Nim functions as if its local, experimenting...

2021-04-19 Thread juancarlospaco
Unix Sockets, Postgres use it.

How to use macros for an intermediate compiler step?

2021-04-19 Thread Sixte
> The seq is still a tree but also allows for linear traversals as well as for > recursive traversals. That's the beauty of it. The beauty is, as always, in the eye of the beholder. With `packedAst` you are going for 32bit padding now (20 Bytes...) which I regard as a good thing due to a low me

Simple RPC, call remote Nim functions as if its local, experimenting...

2021-04-19 Thread alexeypetrushin
Hi, would like to share an interesting approach how to simplify RPC in Nim. So that calling remote function is as easy as if it's local. [Video Demo, 10min](https://youtu.be/KUb15vva0vw) # Example Nim Server, exposing `pi` and `multiply` functions. import ./rpcm, web/serverm

Multi-threaded features needed for Server

2021-04-19 Thread alexeypetrushin
Spent couple of days watching latest Web tech, meditating, and finally found solution for Nim Web :). I use nim for data processing, it works well, and I want to use it for Web-tier too. The problem is that features I need will be available in Nim in 2-5 years. And I need it now. Not just multi

python: print(x, end=" ")

2021-04-19 Thread PMunch
`echo` prints with a newline `stdout.write` prints without newline, which is why I brought it up as that is what `end = " "` is typically used for in Python.

python: print(x, end=" ")

2021-04-19 Thread enthus1ast
Do not forget to stdout.flushFile() when you want to display the string. Also '&' is nims string concatenation procedure.

Unicode string print - the four faces look different when printing - why?

2021-04-19 Thread lscrd
You are right. I have tried with classic classic emojis which have code from U+1F600 to U+1F64F. And, in my terminal, they are correctly displayed. But the four emojis which have code from U+01F466 to 01F469 are not correctly displayed. I tried to display them in a text editor, with no success.

How to access n theJS backend Bootstrap's "modal" method?

2021-04-19 Thread halloleo
Thanks. makes sense. However when I try your approach I get an compile error, because `modalDialog` is not a `JsObject`, it is of type `Element`. (I want to do as much in normal Nim code, so that's why I get the dialog via `var modalDialog = document.querySelector("#myModal")` as an Nim `Elemen

Documentation comments before the item being commented?

2021-04-19 Thread stu002
While I'm asking questions about documentation comments, can I confirm that for a single line `const` declaration like: const Answer* = 42 ## doc comment here Run The documentation comment must be on the same line as the declaration, and not one of these?

How to access n theJS backend Bootstrap's "modal" method?

2021-04-19 Thread halloleo
In JavaScript I open Bootstrap's [modal dialogs](https://getbootstrap.com/docs/4.6/components/modal) via > $('#myModal').modal(options) where `#myModal` is the id of the dialog and `options` is a JS attribute dictionary. I know how to get the DOM element in Nim (without the $/jQuery syntax):

Documentation comments before the item being commented?

2021-04-19 Thread stu002
I should also take this opportunity to say how smooth and fast Nim development is, so many thanks for that to everyone involved.

Recommended method to build nim for M1 Macs?

2021-04-19 Thread stu002
Yep, that worked like a charm: Nim Compiler Version 1.5.1 [MacOSX: arm64] Compiled at 2021-04-19 Copyright (c) 2006-2021 by Andreas Rumpf git hash: f8038af5ecfa20deaa0b9b1e0d8a5f5915dd9780 active boot switches: -d:release Run

Documentation comments before the item being commented?

2021-04-19 Thread stu002
We're probably in the realm if personal taste here but I find: comment comment comment code code code Run easier to scan and read than: code comment comment comment code code Run I find the proc signat

How to access n theJS backend Bootstrap's "modal" method?

2021-04-19 Thread PMunch
Well you'll have to import it from JavaScript. Something similar to `proc modal(obj: JsObject, options = "") {.importc, nodecl.}`. Have a look at:

Documentation comments before the item being commented?

2021-04-19 Thread Araq
1. To support preceding comments would require significant doc generator changes. 2. People would fight over which style to use. 3. Worst of all: It's typically _less readable_. It helps quite a bit if you've seen the proc signature before reading the "fine print". It also leads to a docum