Enabling compression on socket send/receive.

2024-08-22 Thread Clonk
> And all socket sends are handled by client.sendProc(data: string) type Compression = enum uncompressed, gzip, deflate NNTPContext = object c: NNTP comp: Compression AsyncNNTPContext = object c: AsyncNNTP comp: C

choosenim 0.8.5 release announcement?

2024-08-21 Thread Clonk
Since 2.2 is around the corner, I think they'll be a wave of announcement when that comes out (I could be wrong)

NimConf 2024 - registrations

2024-08-19 Thread Clonk
Happy to see nimconf back !

Enabling compression on socket send/receive.

2024-08-18 Thread Clonk
> Any idea what I am doing wrong and how to fix it ? Instead of storing the proc as a field, why not use the type for static dispatch ? proc sendProc(s: AsyncNNTP, ...) = discard proc sendProc(s: NNTP, ...) = discard proc new(T: typedesc[NNTP | AsyncNNTP], host: string,

Enabling compression on socket send/receive.

2024-08-12 Thread Clonk
> that is not relevant to the topic You can use the exact same logic shown in the example with `std/socksts`, who had send / recv proc on string See :

Enabling compression on socket send/receive.

2024-08-12 Thread Clonk
You have explicit example of that in `zippy` :

Nim rose to the top of median salary leaderboard in 2024 Stack Overflow Developer Survey

2024-07-30 Thread Clonk
More likely it's because the people the people who have the freedom to use Nim in a professional settings are probably already higher-up the chain (or work at Status :p)

how to use JsonNode in macro

2024-07-30 Thread Clonk
Untyped macros works on NimNode and happens at compile-time. Your JSON is run-time (compile-time constant is declared with `const`, `let` is for immutable data). What exactly are you trying to accomplish ? Having your type be declared in a JSON instead of source code is probably wrong. If you

tag effects differ

2024-07-29 Thread Clonk
> allocChunk is an approach that enables users to customise their own allocator > types. Are you sure this is necessary ? From my experience, the people who needs a custom allocator knows how to implement it and the people who don't know how to implement an allocator shouldn't touch that stuff

tag effects differ

2024-07-29 Thread Clonk
Respecting the Stream API of raises and allowed tags (`raises: [Defect, IOError, OSError], tags: [WriteIOEffect]`) gives a better error message : `/usercode/in.nim(14, 114) template/generic instantiation from here` `/usercode/in.nim(16, 15) Error: allocChunk(s.al) can have an unlisted effect: R

Novice parallelization question

2024-07-25 Thread Clonk
For malebolgia, look into maybe ? You can pass bulk argument with it to avoid creating too many thread for low computation overhead. Araq covered the topic in his video :

varargs[untyped] in template

2024-07-24 Thread Clonk
There is little you cannot do with a macro and since the macros is entirely resolve at compile-time, very little benefit of trying to express compile-time information / logic outside of code.

Novice parallelization question

2024-07-24 Thread Clonk
There are multiple way to parallelize : * Use a library that already supports it, like Arraymancer * Use `||` which is the openmp operator * Use a thread pool library like or

What's stopping Nim from going mainstream? (And how to fix it?)

2024-07-24 Thread Clonk
Good idea !

Tooling update

2024-07-24 Thread Clonk
Will the next release of Nim 2.2.0 include Nimble 0.16.0 ?

varargs[untyped] in template

2024-07-24 Thread Clonk
With macros you can start by observing the AST generated with `dumpTree` or `dumpAstGen`. So start with : import std/[macros] dumpTree: type Person* = object name*: string job*: string email*: string Run

first impression, strange `=destroy`

2024-07-24 Thread Clonk
For reference this is the 6 hooks in question in case you want to know more :

What's stopping Nim from going mainstream? (And how to fix it?)

2024-07-24 Thread Clonk
Yes, there were tons of improvement in tooling in the last year or so. Atlas is getting better and better. The VSCode extension just works better than ever. Nimsuggest doesn't crash my computer anymore. Kudos to everyone involved

Nesper updates!

2024-07-24 Thread Clonk
Awesome work ! Also I haven't had the chance to do much embedded stuff in the last few years, it's awesome to see Nim usable in that space.

Blog post: How Nim's runtime checks are optimized out

2024-07-23 Thread Clonk
Very good stuff ! I'd be curious to run the same demo but on nester loops instead

How to Efficiently Implement Microservices with Nim?

2024-07-22 Thread Clonk
> what are the best libraries to use in Nim I would use for a web server nowadays - it seems like the best one currently. There is also httpbeast and httpx (used by karax and prologue if I am not mistaken). > How do I find and integrate them seamlessly?

Setter for Base and Inherited Class

2024-07-19 Thread Clonk
Good things we are on a programming forum and not political one then

Small libraries you'd like to see ported to Nim?

2024-07-19 Thread Clonk
Standard back-end component like a Cassandra DB Client and a Kafka Nim API

Atlas shrugged...

2024-07-15 Thread Clonk
> I just want to have my repository where I wish and not necessarily in a > workspace I think you are over complicating things. Here is how I split-it personally : `~/Workspace/` => Atlas workspace for non-specific project. `~/Projects/[Project1]` => Atlas workspace specific to project 1 `~/Pr

help

2024-07-12 Thread Clonk
> var currentPtr = > cast[LPLOCALGROUP_MEMBERS_INFO_2](https://forum.nim-lang.org/bufptr) On that line you declare that currentPtr is of type `LPLOCALGROUP_MEMBERS_INFO_2` through (unsafe) casting. If you want to use the `[]` operator on the type it needs to be defined. If you want a pointer t

help

2024-07-12 Thread Clonk
Please format your code so it is lisible. Indentation is important in Nim and right now there is none in your message. Try to provide more details, what are you trying to do, what platform are you on and what exactly happens. "Something went wrong" is not a descriptive error.

Atlas shrugged...

2024-07-08 Thread Clonk
Yes, that works. I have done that several times. You only need 2 file essentially : * atlas.workspace (generated by atlas init) * atlas.lock (generated by with atlas pin) Once you clone, the repository, all you need to do is `atlas rep`. You can use locally `atlas env` too to fix the comp

simpleargs - Dead simple CLI parsing.

2024-07-05 Thread Clonk
Same. cligen all the way for me.

Small game written in Nim with a from-scratch-engine written in Nim (on Steam now)

2024-07-03 Thread Clonk
FYI, you might also be interested in beamdog who write game in Nim :

Fake Nim books an Amazon, which ones are real?

2024-06-28 Thread Clonk
TL;DR of the threads : If want a Nim book, you want this one and not anything else: * Mastering Nim: A complete guide to the programming language, by Andreas Rumpf

Openziti (zero trust networking)

2024-06-20 Thread Clonk
Hi, C FFI is very easy in Nim. There is essemtially 3 way of doing it : * Manually wrap the thing you need. * Use [c2nim](https://github.com/nim-lang/c2nim) to generate a starting point for your bindings and work from there * Use [futhark](https://github.com/PMunch/futhark) to generate bin

Oh threadpool, my threadpool

2024-06-17 Thread Clonk
* Why do you think Malebolgia is 'very very bad' compared to thredpool ? * There is

Realtime thread in Nim (SCHED_FIFO) in Linux

2024-06-17 Thread Clonk
> Maybe copy/paste createThread into createThreadRealtime, add scheduling and > put into Nimble package. That was my idea, yes. All you need to modify from the base proc `createThread` is a few `posix. pthread_attr_setinheritsched`, `posix. pthread_attr_setschedpolicy` etc. Another possibility

Realtime thread in Nim (SCHED_FIFO) in Linux

2024-06-17 Thread Clonk
All the functions you use are in std/posix so you can implement it in pure Nim. You could also use `createThread` as a starting point which already has a pthread_attr struct in usage :

mm:sharedOrc

2024-06-17 Thread Clonk
> I know you all like "isolation" but I find it lacking and it's hardly used > out there, afaict. Could you (or someone else) expand on that - and that'd be a great blog post as well - on what / why isolation is lacking ? What problem does --mm:atomicArc / --mm:sharedOrc solve and what do they

What Araq thinks about HappyX?

2024-06-12 Thread Clonk
Hijacking @moigagoo 's joke suggestion to ask if we could have the monthly (or once every 2/3 month if that is too oftem) Nim meet-up online back.

Introducing an async library inspired by Go in Nim

2024-06-11 Thread Clonk
There is also [std::execution](https://github.com/NVIDIA/stdexec) made by Nvidia; they submitted as a std cpp

Cheap exceptions, opinionated error handling

2024-05-30 Thread Clonk
With this mechanism can we still disallow certain type of exception in proc signature or does this becomes a raises nothing / raise everything scheme ?

Where the .. does that echo come from?

2024-05-29 Thread Clonk
You could do something like this : template trace*(words: varargs[typed, `$`]) = echo getStackTrace() echo "=> ", words proc main() = trace "Hello, world !" Run This will only work if you have the stacktrace in your build (see

Wrapping ESP-IDF for embedded - Futhark - PlatformIO

2024-05-28 Thread Clonk
The idea was that maybe the author don't have time to update it at the moment, but would review a PR updating it rather than starting a new thing from scratch.

Wrapping ESP-IDF for embedded - Futhark - PlatformIO

2024-05-28 Thread Clonk
Are you sure NEsper is unmaintained ? There are commits as of 2 month ago. Try opening an issue to ask @elcritch as I think he is still active

Which IDE to use in 2024?

2024-05-24 Thread Clonk
Sublime text or VSCode works well out of the box. Neovim requires a little more setup but can also be really good if you enjoy vim.

Nim “free(): invalid pointer” segfault (dynlib)

2024-04-26 Thread Clonk
This is described in the manual . Apparently this is link to the pragma _stdcall so i'll refer you to the microsoft documentation : (googling will prob work too).

What's the best way to match a standard file into a single data structure for editing it?

2024-04-21 Thread Clonk
Many Nim library handle generic Json serialization. is my favorite, but if you just search for Json using NIm language on github you have multiple choices. You can also use existing serialization protocol like Protobuff or messagepack for instance. Finally,

Sublime Text user experience

2024-04-08 Thread Clonk
As someone who uses Sublime text and NimLime with LSP, I am of the opinion that it's safe to merge both plugins as long as there is an option to disable LSP in NimLIme. Thanks for your work btw, it's great to see Sublime getting some love :)

Help needed: binarylang issue

2024-04-05 Thread Clonk
You can always fork the repo, fix it in your fork while the maintainer respond. If you use atlas for external dependencies it is quite easy to resolve the dependencies using your own fork instead of the original repo.

Access operator on distinct type of array

2024-03-27 Thread Clonk
I think this is because `[]` is not a normal proc but a magic proc :

sending to a channel before opening it doesn't create an error

2024-02-28 Thread Clonk
Hi, If I am not mistaken the recommended channels to use for multithreading is Otherwise, as far as i know there is no compile time mechanism to determine if the channel has been opened.

Local library development and editor tooling

2024-02-21 Thread Clonk
I recommend using atlas. It keeps all your library and dependency locally and only update config files. The way atlas works is that you define a root folder as the basis of the workspace and put your dependencies / library on level below it. Atlas will generate config file for you that update -

GUI app with nim

2024-02-21 Thread Clonk
There are multiple GUI library available, just pick one : . There's also and QML bindings You can also create web-based GUI quite easily with Nim

Looking for a python-flask like nim web framework.

2024-02-19 Thread Clonk
Depends what you mean by production ready :). The project appears to be healthy; it has a good structure, tests, documentation, lots of functionality, development is active. I cannot speak about stability or maintainability since these criteria can only be determined over time and the project i

Looking for a python-flask like nim web framework.

2024-02-18 Thread Clonk
You have Haptyx : and prologue :

Is there a way to create a musl binary (static binary) in a project using libcurl.nim?

2024-02-16 Thread Clonk
If you want a static binary, you will need to rebuild a static version of libcurl (so not a .so) and patch the libcurl.nim file to statically link against it. According to CURL docs you need to add an option to the configure steps : ./configure --disable-sha

Nim Community Survey 2023

2024-02-01 Thread Clonk
Thank you for the hard work !

Getting resources from other sources for the current source.

2024-01-27 Thread Clonk
Do you mean embedding a resources at compile time inside the binary and accessing it at run time ?

How to determine whether Import expected packages?

2024-01-26 Thread Clonk
It's not clear what you mean, but there should never be a case where you need to check in library code the import of the user code. If your library has required dependencies, then your module should re-export them. For example : # Package foo # src/foo/bar.nim proc ba

Nim Community Survey 2023

2024-01-23 Thread Clonk
Any news ?

cannot open file: db_connector/db_sqlite

2024-01-23 Thread Clonk
If you run `atlas use db_connector` it should automatically add it to your local package nimble file

cannot open file: db_connector/db_sqlite

2024-01-21 Thread Clonk
Try `nimble install db_connectors`

Custom constructors

2024-01-10 Thread Clonk
Here are multiple ways of initializing an object : type Dollar = distinct float Transaction = object amount: Dollar = Dollar(3.0) proc `$`*(x: Dollar): string {.borrow.} proc `$`*(x: Transaction): string = $x.amount & "$" pro

Nim v2: what would you change?

2024-01-10 Thread Clonk
This is something that should be handled by your IDE about how many tabs are inserted when you press tabs for .nim and .nims file.

Nim v2: what would you change?

2024-01-04 Thread Clonk
I mean that var fooBar = 12 echo foo_bar echo foobar Run will not compile with --styleCheck:error option. As always, having fooBar, foo_bar and foobar be 3 different things is a huge code smell and will eventually cause problem in a code base.

Nim v2: what would you change?

2024-01-04 Thread Clonk
You can treat case insensitivity as error using compiler option so I don't understand how it can be the only blocking point.

Is there any working tutorial for setting up debugging in VS Code?

2024-01-03 Thread Clonk
The recommended extension is the one published by nim-lang.org . It is relatively recent so it has less downloads than the other two. The one by Konstantin Zaitsev is not under development and hasn't been for a while. The one by saem is the one that was forked by the the Nim org and that is bei

Is there any working tutorial for setting up debugging in VS Code?

2023-12-27 Thread Clonk
FYI this extension has been forked and the recommended one to use is :

Direct C/C++ interop without generating wrappers?

2023-12-19 Thread Clonk
> should work in V as V-lang I wouldn't put too much faith into any claim coming from V-lang. There is a history of over-promising and under-delivering. Everytime I've seen people try to check their claims, they ended up finding compiler bugs or edge cases not handled.

scinim - how to contribute a package

2023-12-18 Thread Clonk
Hello, Indeed, at least Hugo, Vindaar and me - at least - are still active. We're still figuring out github discussions, so in the meantime you can open an issues on the getting started and so we get notification (since there is none) on this

hardware-software interaction in Nim

2023-12-06 Thread Clonk
I'll say this bluntly : this is too big of a project for someone who hasn't done any low-level software already. Nim aside, start small and simple, define clearly what you want to accomplish then iterate. Learn how things works then you can decide which tools is the best to use. Generally spea

Infiltrating Rust with Nim packages

2023-12-05 Thread Clonk
Congratulation @mratsim. It would be great, if you have the time and will, to explain your choice of Nim over Rust for this package. I'm curious to hear the reasoning of creating a Nim-based Rust package instead of using Rust directly.

How to make a generic type parameter be late bound for evaluating proc parameter types?

2023-12-04 Thread Clonk
No need for complex solution here. Compile time dispatch is easy with Nim's type system : proc testImpl(t: string) = echo "string" proc testImpl(t: int) = echo "int" proc testImpl[T](t: T) = echo "not string|not int" proc test[T: not int a

NIR

2023-11-28 Thread Clonk
IC is incremental compilation.

[] operator and converter are not compatible.

2023-11-23 Thread Clonk
I wouldn't recommend using converter as it makes your code less readable and can often create ambiguity when compiling, especially for something as trivial as an assignment. You could rewrite your code as this : type SEQ*[T] = object data*: seq[T] proc asSEQ*[T](x: s

Question from one of my customers.

2023-11-20 Thread Clonk
> The main PROS of Nim are : * Strongly typed, statically compiled language that comes with battery included (the stdlib is not perfect, but it is a very good toolbox) * Readable syntax * Strong meta-programming which allows you to * Write better, more readable API * Find generic so

`nimpkgs` the nimble.directory alternative no one asked for

2023-11-14 Thread Clonk
I suggest to order by numbers of github start instead of alphabetically

Why is building the community and ecosystem such a struggle?

2023-10-26 Thread Clonk
The community is overall very nice. It's just mostly on Discord more so than the forum. Just pop by a,d say hi & you'll see plenty of people willing to help new comers.

Why is building the community and ecosystem such a struggle?

2023-10-24 Thread Clonk
Nim has all the technical quality to succeed. It just lacks marketing. It's been the same core issue for years. If you want to have an official marketing department, you need 3 things : an official structure (like the Rust foundation), people actually skilled in communication and good tooling t

Are any of you as excited about the Zed editer

2023-05-11 Thread Clonk
>From the license : > 5\. OWNERSHIP > > Zed retains all right, title, and interest in and to the Network Based > Service, Editor, **and any software, products, works or other intellectual > property created, used, provided, or made available by Zed** under or in > connection with the Network B

unique refs > `isolate`

2023-05-11 Thread Clonk
How will isolate works with `importcpp` type ?

Is ORC considered production-ready? What is the consensus on its use?

2023-05-02 Thread Clonk
> It is not correct or safe to share a ref object between multiple threads Isn't that what channels are for ?

2.0 RC new and old

2023-04-11 Thread Clonk
> With each new version of Nim - all the time something is removed or added. > Projects simply do not support new versions of Nim, thereby having to rewrite > the code almost from scratch or to develop a project without updates on a > static basis. Do you have concrete examples of this happenin

Nim v2.0.0 RC2 is out

2023-04-01 Thread Clonk
Did something change regarding Nimble dependency resolution ? Some repo don't find dependency when the packages is installed.

My Nim Development Weekly Report (3/26)

2023-03-31 Thread Clonk
Are `=copy` / `=sink` going to be removed for `=dup` ?

A list of programs

2023-03-15 Thread Clonk
There is

Can I type a parameter as supporting `$`?

2023-03-14 Thread Clonk
Nim concept predates C++20 Concept

Can I type a parameter as supporting `$`?

2023-03-14 Thread Clonk
Concept are a good solution. You can also use `when compiles` with generic or templates : type Stringable = object NonStringable = object proc `$`(s: NonStringable) {.error: "NonStringable type is non stringable".} proc `$`(s: Stringable) : string =

Nimble package submission process broken?

2023-02-27 Thread Clonk
PR are merged manually as far as I know. I don't know if it's how it should work - it's probably less than ideal.

Trouble with Nim debugging in VS Code

2023-02-15 Thread Clonk
Yes, tooling overall needs improvement but AFAIK it was on the roadmap behind "incremental compilation" which was supposed to arrive after --mm:orc by default and 2.0 migration. So it might just be a question of time and manpower.

Variable Declaration in Templates

2023-02-15 Thread Clonk
You need to use the pragma `inject`. See

Numerical libraries for data science

2023-01-17 Thread Clonk
> Nim would be a good option to produce fast python packages? Not really. While it is possible - there are package like `nimporter` who can export Nim code to Python - it's overly complicated for little benefit. If you start using Nim, it's best to work entirely in Nim and use C++ library throug

Workaround if you are curious about “couldn’t render historic post”

2023-01-10 Thread Clonk
When I see post like this I can't help but go back to @dom96's comment and laugh : > The forum is a great showcase of what Nim can do and allows us to dogfood > which makes Nim better for everyone. In 2023, if you want to see post history on forum you need to manually download rst file. What a

Nim v2: what would you change?

2023-01-07 Thread Clonk
You can use `using ...` to make proc declaration less verbose as well : type MyType = object using self : MyType proc doStuff*(self; arg0: int, arg1: string, arg3 : float) : string = discard Run

Nim version 2.0 RC1

2022-12-22 Thread Clonk
That's a big milestone, congratulation to all the core team members and contributors.

Trouble with Nim debugging in VS Code

2022-12-19 Thread Clonk
Debugging with the compile time switch : `--debugger:native --stacktraces:on -d:useMalloc --mm:orc`; I haven't had any issues using GDB and Valgirnd (at least no more than I would have had for a similar C++ program).

Trouble with Nim debugging in VS Code

2022-12-19 Thread Clonk
Do you compile with --debugger:native ?

A question about random returns

2022-12-09 Thread Clonk
Try formatting your code and posting a complete minimal reproducible example, otherwise it's hard to help you

Forum subscription feature

2022-12-05 Thread Clonk
Sorry but saying the forum is good enough is simply not true.I'm gonna repeat some stuff from this thread (that I btw had to google from memory because I have no way of accessing my own history...) * The search feature is broken. That means that all t

How can I get the fields and field-types of an sqlite-database?

2022-11-11 Thread Clonk
Your best option is to use

Newbie first impressions

2022-10-23 Thread Clonk
> I mean, who uses Ubuntu, right? This openSSL occurs on Ubuntu 22.04 as well. And yeah it's annoying. It's also worrying to ask the user to downgrade sytem security library. This type of problem where things don't work out of the box and you need to tinker a bit are very common in many languag

First program does not compile and is hard to debug

2022-08-23 Thread Clonk
> const g_var: g_Func = g_wrapper(h_var) This line is the problem most likely. You need to use `let` instead of `const` (const is for compile time variable; let is for run time immutable variable). So it become : `let g_var: g_Func = g_wrapper(h_var)` The error you encounter is a codegen error

Can't get basic example of creating reference objects to work. Compilation errors.

2022-08-22 Thread Clonk
> I'm having some success with C++ since this morning & Code::Blocks is much > nicer than VSCode. I hate VSCode now too. You have to fight it to compile > some code... Code::Blocks works out-of-the-box, Yeah it's a well kept secret that Code::Blocks is in fact the superior solution and ultimate

  1   2   3   4   >