How to incrementally convert a C or C++ project?

2023-01-13 Thread Araq
Why keep `main` in C? That's where you should start the "incremental" rewrite. Have the main in Nim instead and call the C code. But it also depends on the project. Many projects esp if written in C are only big because they are written in C. The C code is an endless repetition of malloc wrappe

How do I fix this?

2023-01-13 Thread Araq
What command did you use that produced this? That koch is missing is not the real problem, looks like a compiler regression to me.

nint128 - 128-bit integers

2023-01-13 Thread rockcavera
Some updates: * Added optimized `div` and `mod`, when divisor is static, for `UInt128`. Based on [libdivide](https://github.com/ridiculousfish/libdivide). * Added `mul128by128ToTwo128` to `UInt128`. Includes a version that detects overflow. * Added facilities to work with subtraction when

Multilungual Nimdoc

2023-01-13 Thread Hlaaftana
I have no idea if this works, but as an idea maybe you could do: proc foo*() = when defined(englishDocs): ## English docs here when defined(chineseDocs): ## Chinese docs here Run then build docs with `nim doc -d:englishDocs foo.nim` for Engli

How do I fix this?

2023-01-13 Thread Nlits
I get this error out of nowhere: Warning: Using the environment variable: NIMBLE_DIR='/home/runner/GoldNim/nimble-env' Verifying dependencies for goldnim@0.1.0 Info: Dependency on cligen@>= 1.5.37 already satisfied Verifying dependencies for cligen@1.5.37 Building

Multilungual Nimdoc

2023-01-13 Thread termer
Hi, I'm currently writing a library, and I'd like to translate its documentation into Chinese. Is there a structured method for writing documentation in multiple languages, or do I just need to write it in multiple languages within the same Nimdoc comments? Alternatively, I suppose I could crea

static assert fails

2023-01-13 Thread bw98
I am on a m2 mac and any nim program I try to compile with the **\--cpu:arm** option It gives me the error _STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "Pointer size mismatch between Nim and C/C++ backend. You probably need to setup the backend compile

Illformed AST?

2023-01-13 Thread Hlaaftana
The error message you should have gotten is "expected colon-separated entry in table expression but got `"ceil"`" or something. It's so easy to improve these error messages, I don't know why it's such a rare area of contribution

How to incrementally convert a C or C++ project?

2023-01-13 Thread ggibson
... with the least friction? Incremental adoption was in my mind one of Nim's strong points, but I don't actually know what that workflow looks like. Ignoring a build system at the moment, below is one approach. I'd love to hear more ideas. Incremental adoption is where the intended design of t

Illformed AST?

2023-01-13 Thread matkuki
..., "ceil", ceil, "floor", floor } Run should probably be ..., "ceil": ceil, "floor": floor } Run

Illformed AST?

2023-01-13 Thread Nlits
What is wrong with this code? Can the `{}` syntax not have idents? Hint: used config file '/home/runner/.choosenim/toolchains/nim-1.6.10/config/nim.cfg' [Conf] Hint: used config file '/home/runner/.choosenim/toolchains/nim-1.6.10/config/config.nims' [Conf] .

How do you write a test with mock?

2023-01-13 Thread Isofruit
As the author of said lib I would like to very, very heavily emphasize: The tooling provided there _does not work on generics or anything other than explicit procs/funcs_ The reason for that being that generic procs are not actual procs, but a kind of template in a sense that gets copy-pasted a

What would be the bast way to get parsing and validation of parameters (option:value)

2023-01-13 Thread jackhftang
I realized that what I foresee the way to implement may not be what you get. Since I have not coded nim for some time, I decided to do an exercise... but it took longer than I thought T^T... Anyway, the following program have done 1. string option with choices 2. int option range validation

Nim v2: what would you change?

2023-01-13 Thread PMunch
I'd say it's an argument for style insensitivity, I mean that's a user who had to go ask someone on the internet and wait 4 hours for a reply because `SDL_QUIT` and `SDL_Quit` where two different things.. I could see an argument for being able to disable it with a `{.caseSensitive.}` macro or so

This Month with Nim: November and December 2022

2023-01-13 Thread giaco
Juan Carlos is on fire!

Nim v2: what would you change?

2023-01-13 Thread ElegantBeef
Those are so badly named I cannot tell if this is a commentary for or against style insensitivity :P

Nim v2: what would you change?

2023-01-13 Thread mratsim
SDL_QUIT vs SDL_Quit: