I tried to compile OpenMP
[example](https://rosettacode.org/wiki/Concurrent_computing#Nim) from
RosettaCode but it just fails with segfault. After playing with it a bit i
found out that it compiles perfectly normal with -d:release flag, i.e.:
$ nim --passC:-fopenmp --passL:-fopenm
I recently came to Nim because of the amazing JS backend. My 2c:
The JS backend is really powerful, but it needs a bit of modernization to
continue to attract more people to the Nim ecosystem.
I've been frustrated a time or two about lack of ES6 module support. It would
be delightful to be able
The JS ecosystem is a mess - I'm sure many of us will agree regarding that
sentiment.
I'd like to gather thoughts about Nim's current FE web libraries and if we
think we should expand upon them further...
Most people, who have built a website in the past half-decade are familiar with
react and
Yes "ref" and "new" aren't the only way to create memory dynamically. I written
my post too quickly.
This thread could use some pointless grumpy whining. (Or at least that's all I
can contribute right now.)
I'm wondering about the future of `nim js`.
Nim has invested considerable effort into the JS backend - time that could have
been invested into delivering a more competitive "product" with j
> If you want your program to spawn objects during runtime you'll need ref
> objects.
Not really. For example, when you have a single value object and add() it to a
seq, it is copied -- similar as C++ vector does copy when you use
std::vector::push_back(). You can modify your value object then,
If you want your program to spawn objects during runtime you'll need ref
objects.
Sorry if I didn't give enough context... I think its mostly they had a knee
jerk reaction and didn't choose to understand it completely. Definitely not
that they tried to compile something and found it problematic.
I was giving an hour long talk at my workplace to our engineering department
(mi
The inheritance way seems to be more easy for me. The case statement in that
type declaration looks like Chinese for me (just joking :)) Well, you showed 2
methods and stated the pros and cons of those 2 methods. Thats really helpful.
Now one can easily choose what they want from this. Great. Le
You seem to be attacking my each words carefully. But I do not want to take
this as an attack. I would like to take this as a help as you said. I think
there is no XY Problem in this case. Because you understood my real problem
properly from my words. Well, You are right. My previous experience
Well said, @arnetheduck.
Honestly, for the true master, you could do some pluggable system that allowed
macro/compile-time proc-driven identifier transformation with the current rules
as a simple activation maybe as a pragma on `import`. Then people could
override that current "compromise" batc
I just read your answers carefully and I will tests these solutions, my project
is much more complex than the example.
Thank you all for taking the time to write such insightful answers.
Here you go:
type
Shape = ref object of RootObj
Rect = ref object of Shape
width:float
height:float
ConvexP = ref object of Shape
vertices:seq[float]
type Drawing = object # Don't use ref object if there is no need, th
> But strict typing is killing us
I'll repeat what I have already tried to tell you several times, based on the
examples/questions you have posted previously.
I don't think 'strict typing' is what is killing you. It is your idea to do
things "the old way", like you did them in some other langua
> I want an object field to be able to handle two differents types with a clean
> syntax on the user side
Take a look at [Object
variants](https://nim-lang.org/docs/manual.html#types-object-variants) section
in the manual, maybe that is something you can use in your case.
I guess a language- and compiler recommended style guide that a lot of people
follow increases the value of the eco-system as a whole - just like a single
developer is likely to output similar code and benefit from the familiarity
that this brings, a whole community come together and do so, decr
> What is your suggestion ?
When you already use ref object, you may consider inheritance. Or you may use
sum types (union types) -- maybe bad if memory footprint of your objects
differs a lot.
Sounds like you want [dynamic
dispatch](https://nim-lang.org/docs/manual.html#multiminusmethods). Note that
`Rect | Convex` is not a concrete type, so you can't have `seq[Rect | Convex]`.
Are you sure ? A colon ? Not an equal sign(=) ?
I also want to know the answer. I have tried a lot. But strict typing is
killing us. Now, i can compile this code only if i use 2 distinct members in
Drawing.
` type RectOrConvex: Rect | Convex `
Run
Sorry for that basic topic but I want an object field to be able to handle two
differents types with a clean syntax on the user side. No problem if the code
behinds the scene is a hacky template or something, but the user should never
need to see that.
I written a simplified example.
import iup
discard iup.open(nil,nil)
var cs : cstring = "*.txt"
echo iup.getFile(cs)
iup.close()
Run
Program crashes before show the getFile result: SIGSEGV: Illegal storage
access. (Attempt to read from nil?)
Success if press the cancel button in file dialog.
Gotcha - thanks for the explanation. I will play around with them today.
@runvnc "It's almost like there is an IQ test built into the language." This
has nothing to do with IQ, this is not fullblown monads or something, it's a
thing that people expect to be very simple and obvious and it isn't. (they
might be wrong, but don't make wrong conclusions)
Well this feature is underdeveloped and so the code contains lies/stuff not
implemented. However, `Channel` works and can be used to move a region to a
different thread. Alternatively you can have a region in a global, shared
variable and access it with a Lock.
This isn't true... the linker simply needs to know where to find the shared
library.
Depending on what compiler / linker you're using - the syntax for providing a
path to linked libraries can vary.
If you're using gcc for instance, you can set the LIBRARY_PATH env variable or
by specifying pat
27 matches
Mail list logo