Re: Paravim - a Vim-based editor for Nim

2020-03-19 Thread nepeckman
I learned Clojure using your Nightcode IDE, excited to play around with paranim + paravim!

Re: Nerve: RPC framework for Nim

2019-11-27 Thread nepeckman
Bumping the thread for another release. Notable changes: * Added server generation for JavaScript target * Added configuration options to control generation of server/client code * Added hooks into the service macro to provide imports specific to servers/clients * Added hooks into the ser

Re: Nerve: RPC framework for Nim

2019-07-25 Thread nepeckman
ome. The github repo has more information, and I've started documenting the individual modules as well. [https://github.com/nepeckman/nerve-rpc](https://github.com/nepeckman/nerve-rpc)

Re: Nerve: RPC framework for Nim

2019-07-02 Thread nepeckman
Well what if I also modify the server procs and pass in some sort of session param? Then you can use that session information to get the appropriate client connection, and pass that into the client proc, then sending a request to the same client that invoked the server. Apologies for the back-an

Re: Nerve: RPC framework for Nim

2019-07-02 Thread nepeckman
Just had an idea that I really like as a solution to this issue. I can modify the param signature of every remote proc to add a transport function with a default as the last argument. So a proc like `proc greet(greeting, name: wstring): Future[wstring]` gets modified to `proc greet(greeting, nam

Re: Nerve: RPC framework for Nim

2019-07-02 Thread nepeckman
Ideally, I think that should be handled at the api level. Say program A sends a request to service X on program B, and as a result program B needs to send a request to service Y on program A. My solution would have service X import a client for service Y (with no global state in the transport me

Re: Nerve: RPC framework for Nim

2019-07-02 Thread nepeckman
The `routeRpc` macro does not actually send the result to the client, it just does the procedure dispatch and comes back with the response. It falls on the user to implement the network code, HTTP server, websocket server, or whatever else, then they can use `routeRpc` inside that network code.

Re: Nim's future: GC and the newruntime

2019-06-28 Thread nepeckman
> Here's the thing. I've played with Rust a little bit and one of things that > put me off it, apart from the syntax, is the ownership/borrowing mechanism. > This is great for use-case #3 as you can have safe memory management, an > annoyance for use-case #2 and a huge overhead for use-case #1 w

Re: Nerve: RPC framework for Nim

2019-06-28 Thread nepeckman
Hmmm I see the issue. I think I already need some configuration macros to determine when to build a client vs a server for each service, and I think I can work multiple clients with different connections into that need. Thanks for all the feedback, gonna work hard to make sure this is a solid li

Re: Nerve: RPC framework for Nim

2019-06-28 Thread nepeckman
Sure thing, was thinking something like: proc newTransportFunction(conn: Connection) = result = proc (req: JsonNode): Future[JsonNode] = conn.send(req) let conn = connectToClient() rpc Hello, newTransportFunction(conn): # remote proc definitions

Re: Nerve: RPC framework for Nim

2019-06-28 Thread nepeckman
> I have nothing against callback, though i am bit unsure how it would work in > case where we would like client to connect to multiple servers. Seems like > this callback would depend on some kind of global state which probably > assumes there is one client in application. I was originally thi

Re: Nerve: RPC framework for Nim

2019-06-27 Thread nepeckman
> Example makes it look like library is transport-agnostic. Seems like we could > have both ends host their own APIs and one end could call another's APIs and > we just pass messages between them. The server is transport agnostic. The dispatch function that it generates takes a JSON object, eit

Re: Nerve: RPC framework for Nim

2019-06-21 Thread nepeckman
Not yet. I've been considering taking the connection over websockets and allowing both the client and server to expose an API. The logic there is a little trickier though, so I didn't consider it for first release. Also in the running for future feature is a native HTTP client.

Nerve: RPC framework for Nim

2019-06-21 Thread nepeckman
This is a little project I've been kicking around for a while, and I'm finally in a place that I'd like to show it off for feedback/suggestions. [Nerve](https://github.com/nepeckman/nerve-rpc) is a RPC framework that produces a fully typed JavaScript client using nothing but a m

Re: How do I read user input on the same line a string echos

2019-06-20 Thread nepeckman
Can you be more specific about what didn't work? The code I posted puts the prompt on the same line as the input being read, which seems like what you were asking. Link to hosted version: [https://repl.it/repls/LovingOpulentOffice](https://repl.it/repls/LovingOpulentOffice)

Re: How do I read user input on the same line a string echos

2019-06-20 Thread nepeckman
`echo` automatically prints line end, you want `write`. write(stdout, "This is the prompt -> ") var input = readLine(stdin) Run

Re: Owned refs

2019-03-26 Thread nepeckman
I've got some questions as I'm trying to grok this. First, to make sure I understand: unowned refs would need to be set to nil so the type based allocater can free them, and owned refs will be automatically freed when they leave the scope. Is that summary correct? If I create a owned ref and pas

Re: Newbie question about reading asynchronous text file line by line

2019-02-11 Thread nepeckman
The code doesn't compile as presented because of the redefinition of `file`. If you change the second invocation of `openAsync` to `file = openAsync(filename, fmRead)` the code will compile. The index error you get from running the code is another matter though. I think its a potential bug in th

Nim plugin for web bundler

2019-01-17 Thread nepeckman
a web bundler, just compile the Nim code and point the bundler towards the compiled file. But I do enough web development that is was worth it to me to write a plugin to make the process zero friction. This is a plugin for my preferred bundler, Parcel: [https://github.com/nepeckman/parcel-plugi

Re: How to parse JSON at compile time?

2018-12-17 Thread nepeckman
I'm not sure its possible to parse JSON at compile time. I've tried reading the file with `staticRead` and passing the resulting `const string` to the JSON module, but it doesn't seem like the VM had the capability to parse JSON. If you do figure out a way to do it, I'd love to hear it.

Re: Explaination on GC-safety warning of Nim compiler

2018-12-03 Thread nepeckman
I'm far from a Nim expert, but I think GC safety is determined by access of global variables. Does this section of the manual reference anything useful? [https://nim-lang.org/docs/manual.html#threads-gc-safety](https://nim-lang.org/docs/manual.html#threads-gc-safety)

Re: toSeq(countTable.values) doesn't work

2018-12-03 Thread nepeckman
This file compiles and executes as expected for me: import tables, sequtils var counter = initCountTable[char]() echo toSeq(counter.values) Run Not sure why it isn't working for you. What version of the Nim compiler are you using?

Re: jsExport: CommonJS module export

2018-11-20 Thread nepeckman
Glad you find it useful! The macro checks for an existing `module.exports` object, and if one exists, it appends its exports to the existing object without overriding previous exports. There could be collisions if two different files try to export an object with the same name, but for now I thin

jsExport: CommonJS module export

2018-11-19 Thread nepeckman
monJS module exports object, and this macro makes that a little easier. Not sure if it's useful to anyone else, but figured I'd put it out there. Feedback is welcome! [https://github.com/nepeckman/jsExport.nim](https://github.com/nepeckman/jsExport.nim)

Re: Does Nim need package-level visibility?

2018-10-09 Thread nepeckman
Ah yeah, that makes sense. I've been primarily using procs to access object fields, so I haven't run up against that problem. I definitely see the utility of package level visibility, but I wouldn't want to introduce unnecessary complexity to the language. I really like the cleanliness of `*` ex

Re: Does Nim need package-level visibility?

2018-10-09 Thread nepeckman
I don't know if this is sufficient for your purposes, but I've emulated package-level visibility in a side project I've been developing. Each folder has a `.nim` file that imports the other modules in the folder, and exports the public interface of that folder. So package-level visibility is em

Question regarding --warning[ProveField] and proc params

2018-10-03 Thread nepeckman
I recently learning about the --warning[ProveField] flag for object variants, and enjoy the increased level of type checking that it provides. However, I have a small issue using this flag alongside procedures that take a specific branch of the object variant. The procedures shouldn't be used on