Twitter in 100 lines of Nim, no JS

2022-01-17 Thread ajusa
I've been using HTMX quite a bit recently, so I went ahead and updated the Simple Twitter repository I had . With HTMX, you have something similar to the original post where interactions hit the server, but you control where the HTML goes. This usually me

cannot instantiate: 'T' with importcpp generic

2022-01-17 Thread bj0
It looks like the last missing piece to get it to work is handling a function that returns a cpp reference. It's segfaulting. The cpp code is: Tins::IP &ip = pdu.rfind_pdu(); Run but I can only get nim to produce: Tins::IP ip = pdu.rfind_

Should constructors be `newObject` or `initObject`?

2022-01-17 Thread ElegantBeef
`initT` is for non reference objects and `newT` is for reference objects. This makes it easier to track your memory allocations.

Should constructors be `newObject` or `initObject`?

2022-01-17 Thread elcritch
When creating a constructor for an object, I'm not clear if it should be `newMyObject` or `initMyObject`? This is probably noted somewhere, but I can't ever find it. Is it in the Nep style? I've seen both formats and I always forget what the recommend name. Is it based on ref vs value types? M

Cleanup at program end - open files automatically closed?

2022-01-17 Thread marcomq
So - this is how C/C++ handles files: The OS might skip closing files in case of an early application exit - when the application does exit with some error return value. SIGKILL or SIGABRT for example will not close file handles and will also not flush files. Unwritten cache will be dropped with

Cleanup at program end - open files automatically closed?

2022-01-17 Thread planetis
You can make it yourself: type ScopedFile = distinct File proc `=destroy`(x: var ScopedFile) = close(File(x)) proc `=copy`*(dest: var ScopedFile; source: ScopedFile) {.error.} proc main = var f = ScopedFile(open("temp.txt", fmWrite))

Why don't build Nim libraries ecosystem on Rust ecosystem?

2022-01-17 Thread cantanima
> A Nim wrapper around Rust should be reliable, I guess. Have you tried to bind Rust to other languages? It's not fun, and safety is not really guaranteed for non-trivial systems. > Why [Nim] developer don't focus the effort to improve the Nim tooling > ecosystem, instead of spend time to devel

Why don't build Nim libraries ecosystem on Rust ecosystem?

2022-01-17 Thread bpr
I thought @arnetheduck's response was the mic drop; there's no reason Nim can't use Rust (or C, C++, or JS ...) libraries. If the OP wants Nim bindings over Rust, they can write them. If the question is rather, 'why doesn't someone else do what I want', that has many answers. As a Rust fan (and

Why don't build Nim libraries ecosystem on Rust ecosystem?

2022-01-17 Thread PMunch
We don't really know their actual intent though. They might not have English as a first language, and are honestly wondering why we don't wrap Rust libraries more often. Besides, since this is still on-topic (apart from these last couple messages - this will be my final comment on the matter in

Program does not compile with ARC/ORC

2022-01-17 Thread piyushrungta25
Thank you. I have switched to the work around mentioned on the issue.

Nim Community Survey 2021

2022-01-17 Thread ynfle
Would it be expanded?

Nim Community Survey 2021

2022-01-17 Thread Araq
> Really? What would be replacing untyped then? Nothing really, you would use `typed` and a `typed` expression can be one that didn't semcheck -- for undeclared identifiers that would be `nkIdent`, for example.

Nim Community Survey 2021

2022-01-17 Thread auxym
Really? What would be replacing untyped then? Explicitly returning NimNode? I can see that working for macros, not sure for templates. I'm not against it btw. Typed and untyped was _very_ confusing for me until I got it, sort of at least.

Nim Community Survey 2021

2022-01-17 Thread auxym
Agreed that a cool embedded project write-up using Nim would be pretty cool. Eg something that could get featured in on HackADay, etc. I think all the pieces are there on the Nim side, between PMunch's Badger (which could be repurposed for another application on AVR aka Arduino), elcritch'd Nes

Why don't build Nim libraries ecosystem on Rust ecosystem?

2022-01-17 Thread planetis
Well some people on the Nim channels have claimed, the OP had malicious intend, especially judging by the fact that he repeats in his replies certain phrases word by word a dozen times.

Why don't build Nim libraries ecosystem on Rust ecosystem?

2022-01-17 Thread PMunch
No need to lock the thread, it's still not off-topic, albeit a bit repetitive. It's also not particularly disruptive, and everyone are acting civil.

Using waitForExit when a timeout is given, on a process blocked by IO

2022-01-17 Thread jarv
Using `waitForExit` I see different behavior in the stdlib when a process is blocked on IO Example that doesn't timeout: import osproc import streams let args = ["-c", "cat"] let process = startProcess(command = "/bin/sh", args = args) let ret = waitForExit(p =

How to dynamically link LGPL nim library to closed-source nim application?

2022-01-17 Thread giaco
yes, I'm considering using NimQml for a proprietary application (at least for it's prototype). I've opened an issue on github. Thanks