profiler for mac?

2022-01-13 Thread mratsim
I use Apple instruments in Time profiler mode. Compile with --debugger:native to get the Nim code in the profiler instead of the C code. See example investigations: * * *

Variable prints out its type correctly, but can't access members and I can't figure out why

2022-01-13 Thread Ethernaut
Sorry for how obtuse this code is - it's a minimal repro of the problem that more or less mimics my original project, and I wanted to keep some aspects even if they don't make a whole lot of sense here. I have a series of "Thing" types and a container that stores handles to them (a reference to

cannot instantiate: 'T' with importcpp generic

2022-01-13 Thread Hlaaftana
How are you calling `rfind_pdu` in Nim? The simplest way would be `rfind_pdu[IP](pdu)`, but if you are doing `pdu.rfind_pdu[IP]()` it may not work. This is due to the way the subscript syntax can work, with method call + generics you're better off doing `pdu.rfind_pdu[:IP]()`, which is a special

cannot instantiate: 'T' with importcpp generic

2022-01-13 Thread bj0
I am learning Nim, and I wanted to see if I could import some functionality from a cpp lib: / I decided to try to do the example they have on the front page, but I am getting stuck trying to declare a proc for this: const IP &ip = pdu.rfind_pdu();

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

2022-01-13 Thread Araq
> But it is not my question, it is just one of the assumptions that my question > base on. Well the assumptions are wrong and even if we accept them as true, the question isn't all that hard to answer. See my previous replies. And by that let me lock the thread. Feel free to read my replies as

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

2022-01-13 Thread fzrg
> the answer to your question you repeatedly ask is that different people have > different tastes in what programming language they would like to write in. > This answer should be news to -- exactly no one. I think you have misunderstand my question. I'm not trying to convince any thing. My que

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

2022-01-13 Thread xigoi
Why do you care so much what other people spend their free time on? If you want to spend your time creating Nim wrappers for Rust libraries, feel free to do that.

profiler for mac?

2022-01-13 Thread evoalg
It seems that a lot of the profilers people use for their nim executables aren't available for mac's, so what do you mac users use? I've tried nim's nimprof but what I'm interested in this the time spent in each proc, not the number of times a proc was called. I guess I could do something manua

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

2022-01-13 Thread SolitudeSF
because wrapperless, nim-native library would have more idiomatic api/design

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

2022-01-13 Thread fzrg
> It's safer than C Yes, I can understand people rewrite a feature in Nim, instead of use a wrapper around C. But why people don't just write a wrapper around Rust to save time?

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

2022-01-13 Thread Araq
It's not all that hard to understand though. Because wrapping is usually more work and usually you can get away with code that solves the problem that you actually have ("the 80% solution") instead of the problem that the Rust people solved ("the overly convoluted, hard to use, academic, bean c

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

2022-01-13 Thread fzrg
I'm not expert in Nim or Rust. Maybe when I say Rust is safer and faster is wrong. Write a Nim wrapper around Rust won't give a better quality library. But many Nim lib is in early stage, and miss feature, less actively maintened compare to a Rust or C lib. If I program in Nim, I would prefer us

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

2022-01-13 Thread fzrg
> question: why would you wrap a rust library if you lose rust's safety? :-/ If a feature exist already in Rust or Nim, why rewrite a same feature in pure Nim. We can just wrap it to save time. But I still see some people reimplement it in Nim. I don't understand why.

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

2022-01-13 Thread inv2004
Like a rust-dev for few years I cannot agree with you: when I switched from Rust to Nim, I found that nim-community is not so big, but on the opposite way Nim's libs were much better: 1. mongodb. Rust's version 1 - very slow 2 - did not suppose streams. 2. even iterrators in Rust had a probl

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

2022-01-13 Thread fzrg
> I have more fun writing Nim than writing Rust ¯_(ツ)_/¯. Write a Nim wrapper around Rust lib, or write a pure Nim lib, in both case, the developer doesn't need write Rust code. > People are allowed to have preferences. Yes, but just I don't see usefulness of doing that. Most Nim lib is in earl

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

2022-01-13 Thread Araq
Theoretically their performances are on equal footing: Static binding plus heavy focus on value types. Everything else is implementation details and yes Rust has more people working on it, this usually is reflected in the benchmarks. Why do we reinvent the wheels? Because then you can get a roun

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

2022-01-13 Thread sky_khan
Do you know its not easy to decide whether you're trolling or not ? > Did we really need to work in deep with Rust if we write just a Rust wrapper? Maybe not but... You said you're not a Nim user. Can you wrap a C library into Nim ? without knowing any of them ? Whoever wraps a Rust library mus

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

2022-01-13 Thread cblake
@fzrg \- the answer to your question you repeatedly ask is that different people have different tastes in what programming language they would like to write in. This answer should be news to -- exactly no one. Your continued pressing of the question combined with ignoring all rebuttals and the

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

2022-01-13 Thread ynfle
> As Rust doesn't have GC Neither does nim > So, I don't know, if write wrapper is easily in Nim. Why it exist still some > pure Nim library with same feature than libraries in C or Rust ecosystem? It's safer than C

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

2022-01-13 Thread cblake
@fzrg \- you are overinterpreting benchmarks (which in the Nim versions are written by Nim beginners and/or poorly optimized) and also ignoring caveats and details in the very pages you yourself link to -- all toward the result of coming to inappropriately strong conclusions, repeating yourself,

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

2022-01-13 Thread hamidrb80
question: why would you wrap a rust library if you lose rust's safety? :-/

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

2022-01-13 Thread fzrg
You have shown how easily we can access Rust ecosystem from Nim, so why some developer still develop a early stage pure Nim library with few missing feature, in this case? They can just wrap Rust lib.

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

2022-01-13 Thread hamidrb80
> and faster than Nim: have you seen this? >

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

2022-01-13 Thread fzrg
> At my job I have to learn Rust. I was just now reading about cxxbridge and > bindgen, two of the (multiple) tools Rust developers have to create bindings > for C/C++. This is a common thing to do in Rust, and it inevitably means that > one exposes oneself "to all the bugs that can arise from t

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

2022-01-13 Thread Sixte
> As Rust doesn't have GC, it should be also faster in theory That's not true. Both Rust and Nim allow for dynamic heap management and both rely on reference counting (RC) for that. The Nim compiler optimizes RC heavily (runtime elision), therefore, many refcount updates can be avoided. I doubt

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

2022-01-13 Thread fzrg
> How do you know that it's faster? There are quite a lot of benchmarks where > Nim can beat Rust. I say it base on: * * Most benchmark show Rust is faster. As Rust doesn't have GC, it

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

2022-01-13 Thread arnetheduck
Here's how to easily access Rust libraries from Nim:

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

2022-01-13 Thread cantanima
>From the "safer" webpage you linked: > All in all Nim is fairly safe if you stick to the Nim layer, but since it has > 1:1 C/C++ interop you can of course expose yourself to all the bugs that can > arise from those languages (either by yourself, or through a wrapper). At my job I have to learn

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

2022-01-13 Thread mratsim
People are allowed to have preferences. I have more fun writing Nim than writing Rust ¯\\_(ツ)_/¯. Now let's address the rest: > Rust is safer Rust is less safe than Ada Sparks or Formally Verified C. There is a reason why on audit Rustls was recommended to switch to formally verified C primiti

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

2022-01-13 Thread Yardanico
> Rust is safer and faster than Nim, How do you know that it's faster? There are quite a lot of benchmarks where Nim can beat Rust. > So a Rust libraries is better than a Nim library (safer,faster,more actively > maintened,..) Again not true - the language being "safer" doesn't mean that the l

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

2022-01-13 Thread fzrg
I'm not a Nim user. But I have a question. Many people claim don't use Nim, because Nim miss many libraries. Nim community is small, that could be difficult to develop a big Nim ecosystem libraries with pure Nim. Rust is [safer](https://uploads.peterme.net/nimsafe.html) and faster than Nim, an

Editor issues, nimsuggest reporting false errors?

2022-01-13 Thread Prestige
Editing nim code since 1.6.0 has been a pain due to (false) errors being reported by nimsuggest. See Has this not been an issue for others? I've disabled LSP support since 1.6.0, and have been compiling frequently to check for errors. Editor suppor

Man pages?

2022-01-13 Thread federico3
If it can be of help, `nim jsondoc foo.nim` generates `htmldocs/foo.json` that can be parsed to generate other formats. Unfortunately the JSON body contains chunks of HTML that would need to be converted. If you succeed could you please share the manpages?

Introducing taskpools, a small lightweight ARC/ORC threadpool

2022-01-13 Thread kobi
That sounds very cool. Is it ready for usage? What would be the api and does it have documentation?

Get formatted SQL query

2022-01-13 Thread trisub
Sounds good, should I then file an issue for this?

Get formatted SQL query

2022-01-13 Thread Araq
It would be a good idea but notice that the `db_` modules should be moved to an external package for version 2.0.

Introducing taskpools, a small lightweight ARC/ORC threadpool

2022-01-13 Thread mratsim
Adding a multithreaded event system to a threadpool can be done with the protocol described below. So in terms of vocabulary an event system allows to describe precise in/out dependencies between tasks and is also called by many names in the literature: * dataflow parallelism * graph parall

Get formatted SQL query

2022-01-13 Thread trisub
When using the `exec` function of a db_* module, is there a way to access the actual query with all parameters substituted for logging or debugging purposes? There is for example [dbFormat](https://github.com/nim-lang/Nim/blob/version-1-6/lib/impure/db_mysql.nim#L139) (link to `db_mysql`, but i

Thoughts on error vs fatal log levels?

2022-01-13 Thread zio_tom78
> When you think about this it implies your log messages are important. If they > are important, they are not logs -- it is important structured information > that you should store in a database and enjoy transaction safety and a query > language for producing reports. Well, I guess this depend

Thoughts on error vs fatal log levels?

2022-01-13 Thread Araq
When you think about this it implies your log messages are important. If they are important, they are not logs -- it is important _structured_ information that you should store in a database and enjoy transaction safety and a query language for producing reports. Yes, I know, you're in love wit

Thoughts on error vs fatal log levels?

2022-01-13 Thread zio_tom78
For me too it's hard to tell when to use "fatal", "error", and "warning". I would probably stick to "fatal" only for programmer's errors, i.e., error conditions that are not due to the user or the system where the program is running but to some flaw in the program itself. (This is the case if so