Program that using OpenMP crashes with segfault without -d:release flag

2018-11-24 Thread Widowan
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

Re: FE web libraries

2018-11-24 Thread bketelsen
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

FE web libraries

2018-11-24 Thread carterza
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

Re: Need help for a generic object field

2018-11-24 Thread DTxplorer
Yes "ref" and "new" aren't the only way to create memory dynamically. I written my post too quickly.

Re: The future of NIM's WASM?

2018-11-24 Thread Libman
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

Re: Need help for a generic object field

2018-11-24 Thread Stefan_Salewski
> 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,

Re: Need help for a generic object field

2018-11-24 Thread DTxplorer
If you want your program to spawn objects during runtime you'll need ref objects.

Re: Should we get rid of style insensitivity?

2018-11-24 Thread metasyn
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

Re: Need help for a generic object field

2018-11-24 Thread kcvinu
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

Re: Need help for a generic object field

2018-11-24 Thread kcvinu
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

Re: Should we get rid of style insensitivity?

2018-11-24 Thread cblake
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

Re: Need help for a generic object field

2018-11-24 Thread DTxplorer
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.

Re: Need help for a generic object field

2018-11-24 Thread mratsim
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

Re: Need help for a generic object field

2018-11-24 Thread miran
> 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

Re: Need help for a generic object field

2018-11-24 Thread miran
> 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.

Re: Should we get rid of style insensitivity?

2018-11-24 Thread arnetheduck
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

Re: Need help for a generic object field

2018-11-24 Thread Stefan_Salewski
> 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.

Re: Need help for a generic object field

2018-11-24 Thread GULPF
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]`.

Re: Need help for a generic object field

2018-11-24 Thread kcvinu
Are you sure ? A colon ? Not an equal sign(=) ?

Re: Need help for a generic object field

2018-11-24 Thread kcvinu
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.

Re: Need help for a generic object field

2018-11-24 Thread juancarlospaco
` type RectOrConvex: Rect | Convex ` Run

Need help for a generic object field

2018-11-24 Thread DTxplorer
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.

iup.getFile fails

2018-11-24 Thread juanv
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.

Re: Memory regions / gc:regions

2018-11-24 Thread carterza
Gotcha - thanks for the explanation. I will play around with them today.

Re: Should we get rid of style insensitivity?

2018-11-24 Thread alehander42
@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)

Re: Memory regions / gc:regions

2018-11-24 Thread Araq
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.

Re: classic "can not open sdl2" ...

2018-11-24 Thread carterza
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