Wrapping C++ classes and constructors lead me to compilation errors global vs local, stable vs devel

2023-06-23 Thread sls1005
According to , a default constructor (one that without parameters) is automatically generated only when there's no user-defined constructor. Since you have defined a constructor taking one argument, you should not be able to use `My

Multithread with js target

2023-06-23 Thread termer
There is no convenient library for doing multithreading with workers in Nim right now. As for `-d:threads`, that's simply not going to work since JS doesn't have threads built into the language.

How doeas NIM differ from Mojo programming language?

2023-06-23 Thread oyster
the short answer is: NIM IS a software product, while Mojo is a PPT-ware till now.

Does Nim has the same features that D has when interfacing to Objective-C?

2023-06-23 Thread przemyslawo
I need a programming language that let me to use both the standard library and no-GC. I think I will need everything in the standard library because I'm planning to write several programs in the future. Do you know if I could work with Objective-C protocols in Nim?

How to easy get a object !??? member name all too longer!!!

2023-06-23 Thread Angluca
Yeah... Have more game engine in nimble, Because this library is very efficient, So I want to try this library and learn opengl, Hope the code written in the future can be better :)

regex find all w/captures

2023-06-23 Thread Araq
I only use strscans these days.

How to easy get a object !??? member name all too longer!!!

2023-06-23 Thread Angluca
It look like well, I can often easy get object when I use importc pragma and c language struct all small, So many people want to simply get object even without "importc pragma" can easy get object too type xxx = object {.importc "...".} a,b,c:int f: float var x =

How to easy get a object !??? member name all too longer!!!

2023-06-23 Thread Isofruit
I assume you mean ? And yeah, that seems annoying, but why not write a constructor-proc then? The following is pseudo-code I wrote on the fly and did not try to compile, should be enough to get the idea across though proc newColorAttachmentActi

How to easy get a object !??? member name all too longer!!!

2023-06-23 Thread Araq
And for gaming there are better libraries out there, written in Nim, providing idiomatic Nim APIs so that you can focus on your game...

How to easy get a object !??? member name all too longer!!!

2023-06-23 Thread Angluca
I use sokol-nim, more object and member name are too longer , var passAction = PassAction( colors: [ ColorAttachmentAction( loadAction: loadActionClear, storeAction: storeActionStore, clearValue: (1, 0, 0, 0)), ColorAttachmentAction( loadAction: loadActionClear,

How to easy get a object !??? member name all too longer!!!

2023-06-23 Thread Araq
So use a template to make it shorter or use some AI to generate the code for you.

regex find all w/captures

2023-06-23 Thread dwhall256
I'm hoping there is something more elegant than a simple generic: iterator genRegexCaptures[T](s: string, pattern: Regex): string = var captured: T ... Run yuck: for addr_str in genRegexCaptures[array[1, string]](file_contents, re" address='0x

Wrapping C++ classes and constructors lead me to compilation errors global vs local, stable vs devel

2023-06-23 Thread giaco
been talking with @jmgomez on IRC about this, he proposed to move some insights here talking about case OPT = 2 18:54 It works by coincidence really 18:54 `N_LIB_PRIVATE MyClass objbugg_6 = {0}` 18:55 it's calling the constructor you defined without intending to. If y

regex find all w/captures

2023-06-23 Thread dwhall256
I'm trying to implement in Nim, the following line of Python `addr_strs = re.findall(" address='0x([0-9a-f]{8})' ", file_contents)` The `re.findAll()` in Nim doesn't seem to handle captures, so I am filling in this missing piece. I have code that works, but it has a bit of hard-coded badness:

A good word for idiomatic nim?

2023-06-23 Thread basedtheorem
Nimonic.

Wrapping C++ classes and constructors lead me to compilation errors global vs local, stable vs devel

2023-06-23 Thread giaco
Would you explain to me what's happening here? I'm having different compiler behaviours when intdefine OPT = 1, 2 , 3 or 4 I don't get if `MyClass()` default constructor is a legal C++ call or not if `MyClass(short a)` constructor has been defined. I also don't get the differences between local

how to importcpp a C++ class within namespaces in non-sloppy way

2023-06-23 Thread jmgomez
> Which is not C. You are still using the C++ backend :P I misread your comment, I thought you were referring to what some people in the community is doing by picking the hard path of wrapping something that can easily be done in C++, in C. That said, the small facades are the way to go sometim

Does Nim has the same features that D has when interfacing to Objective-C?

2023-06-23 Thread awr1
nim can technically "compile to Obj-C" and produce loose method calls through `{.importObjc.}`, [found here in the docs](https://nim-lang.org/0.20.0/manual.html#implementation-specific-pragmas-importobjc-pragma). however this interface is pretty much one-way: e.g. you can't subclass in pure nim

how to importcpp a C++ class within namespaces in non-sloppy way

2023-06-23 Thread jmgomez
> a small wrapper written in C++ that exposes a more simple-to-consume facade Which is not C. You are still using the C++ backend :P > edit: "wait for nim 2.1" is a good example of the above: it means that you > cannot be productive in nim-C++ wrapping for the next 2 years This can be applied t

how to importcpp a C++ class within namespaces in non-sloppy way

2023-06-23 Thread arnetheduck
> @arnetheduck hope that's a bad joke and you are trolling around :P not really - the semantic mismatch between nim and (modern) C++ is significant, starting with trivial basic stuff like `r-value refs` and `const` that have no semantic equivalent in Nim - on the other hand, the one thing that p

how to importcpp a C++ class within namespaces in non-sloppy way

2023-06-23 Thread jmgomez
@giaco if you are in devel you will soon be able (hopefully) to specify your own replacement for `nimbase.h` so you can add your base types there. If not, wait for 2.1 I guess. In the meantime you can use a custom pragma that wraps header if it bothers you too much or just fork `nimbase.h` and a

how to importcpp a C++ class within namespaces in non-sloppy way

2023-06-23 Thread giaco
thanks for the answer

Does Nim has the same features that D has when interfacing to Objective-C?

2023-06-23 Thread mratsim
> Does Nim has support for all these? Nim can compile to Objective C so worst case, you can resort to {.emit: """ /*obj-c code*/""".} Run for what isn't supported. I don't know if it currently supports everything, but you won't be limited by the absence of support since

how to importcpp a C++ class within namespaces in non-sloppy way

2023-06-23 Thread arnetheduck
every c++ problem can be solved with a wrapper written in c++ that exposes a C api instead ;)