Re: Nim newbie request/challenge

2017-09-01 Thread jzakiya
As I stated, Nim was not installed via these distros, and was being installed per the process given on Nim's website. Putting in the suggested PATH did solve the problem though, so thanks. $ export PATH=~/nim-0.17.0/bin:$PATH However, this just highlights the inadequacies of

Re: Compile Nim on centos 5

2017-09-01 Thread cdunn2001
I see. I had done a test which mislead me. Yes, as far as I can tell, everything works now. Thanks. ... Ugh. I just pulled Nim@devel (a43eae8e6c77149be77082388bb0fa546b9c97a7) and rebuilt according to readme.md: c_code/2_2/stdlib_osproc.o: In function

Re: Type inference side effect

2017-09-01 Thread Stefan_Salewski
What is the goal of these silly bot messages? [https://forum.nim-lang.org/t/2682#16605](https://forum.nim-lang.org/t/2682#16605)

Re: Compile Nim on centos 5

2017-09-01 Thread cdunn2001
> Please create a proper pull request. We can introduce -d:oldLinux for example > for this feature. Is that still the plan? If so, why did you close my PR?

Re: Compile Nim on centos 5

2017-09-01 Thread Araq
`posix.nim` contains `{.deadCodeElim: on.}` and so this should just work. If not, that's a separate issue. but I would guess that we simply need to update the C sources.

Re: Compile Nim on centos 5

2017-09-01 Thread cdunn2001
What's the plan for `execvpe()`, the GNU extenion? While it's in `posix.nim`, I cannot build Nim.

Re: Convert tuple into a Object

2017-09-01 Thread Arrrrrrrrr
What is the use case? I can't think of one, unless it is just for experimenting.

Should/can we get explicit concepts?

2017-09-01 Thread Lando
Recently, a thread starting with a simple question went OT and became a different exchange starting [here](https://forum.nim-lang.org/t/3128/2#19739). The short version: "Methods (inheritance based dispatch) and concepts (user defined type classes with VTable based dispatch) are two solutions

Re: Convert tuple into a Object

2017-09-01 Thread jacmoe
Get off my lawn, dude. Passing a tuple to a factory proc is definitely a neat, and clean, thing to do. You can construct a tuple and pass it in, and use that to construct an object. Much neater than a huge parameter list, I think. Sometimes. It depends. As always. Are you sure you want to

Re: Convert tuple into a Object

2017-09-01 Thread Krux02
@jacmoe, no it's not. It is [code smell](https://en.wikipedia.org/wiki/Code_smell)

Re: Nim newbie request/challenge

2017-09-01 Thread mashingan
CMIIW, Nim folder is self contained. @jzakiya, very likely you already have Nim installed from package manager, and its installation done like usual any package. If you put the path in front of `$PATH`, it'll solve your problem. $ export PATH=~/nim-0.17.0/bin:$PATH In your

Re: Nim newbie request/challenge

2017-09-01 Thread jacmoe
For what it's worth, I have built Nim several times without incident on my Debian box - following the instructions to the letter - so I guess the problem you have is specific to your machine.

Re: Compile Nim on centos 5

2017-09-01 Thread Araq
Fix should be ready by tonight, it's not a coincidence `os.nim` has been refactored to make it easier to see what's going on.

Re: Nim newbie request/challenge

2017-09-01 Thread cdunn2001
$ export PATH=$PATH:~/nim-0.17.0/bin The problem might be the expansion of `~` in the default shell on some O/S. Try $ export PATH=$PATH:$HOME/nim-0.17.0/bin You could create an "Issue" in Nim's GitHub repo so this specific problem can be discussed there, separate

Re: Convert tuple into a Object

2017-09-01 Thread jacmoe
Creating an object from a tuple using a macro is actually very neat!

Re: Get base object from inherited object.

2017-09-01 Thread Stefan_Salewski
Calling getType() multiple times may give you the parents, I did that here: [https://github.com/StefanSalewski/gintro/blob/master/gintro/gimpl.nim#L12](https://github.com/StefanSalewski/gintro/blob/master/gintro/gimpl.nim#L12) I got it from a hint of Araq, I have no idea what really is

Re: Convert tuple into a Object

2017-09-01 Thread Krux02
My intuition tells me that you did something wrong in your types, if you want to convert an object to a tuple or vice versa. Try to redesign your code so that you either only use tuples or only use objects, but don't try to make mixing them up easy. If you still want to make it easy to mix up

Re: Get base object from inherited object.

2017-09-01 Thread enthus1ast
memo to myself, read: [https://github.com/loloiccl/Nim/commit/5fc1b3a95ad73951e8383dcbc09fab3056827ec1](https://github.com/loloiccl/Nim/commit/5fc1b3a95ad73951e8383dcbc09fab3056827ec1)

Get base object from inherited object.

2017-09-01 Thread enthus1ast
hi, i'm trying to fix issue #5856 (that json.to() is not marshaling the base object). When i look into the macro it calls getType. Everything then looks fine (to me). It seems that the child type does not know about its base type. Is there a way to also get the base object atributes? OR can

Re: Disable debug for specific function

2017-09-01 Thread LeuGim
Try pragams like `{.checks: on.}`/`{.checks: off.}` and the like (there are ones for specific checks), better via `{.push checks: off.}` and then `{.pop.}`, so for the rest of the code checks are still contolled by configs and command line. For the 2nd, try `GC_disable`/`GC_enable` (inside the

Re: Nim newbie request/challenge

2017-09-01 Thread euant
I've been considering creating a Snap package and/or AppImage for Nim for a while. Maybe I'll have a proper look at it after my holiday.

Re: Convert tuple into a Object

2017-09-01 Thread Tiberium
My macro: import macros macro createObj(typ: typedesc, data: untyped): untyped = # This macro only accepts tuples in parenthesis, but this can be changed assert data.kind == nnkPar # Object construction syntax result = newTree(nnkObjConstr) #

Re: Convert tuple into a Object

2017-09-01 Thread LeuGim
Why they should be truncated, if they are of the same size? And your macro assigns fields by names... That is, it in the end doesn't allow you to write like `createRef(O, (5, 6.6, 7i8, 8i8))`, just providing a type and values.

Disable debug for specific function

2017-09-01 Thread skyfex
I am trying to create a callback procedure to be passed to a C library (SDL2 mixer). My problem is that unless I use "-d:release" the callback procedure causes the program to crash. Is it possible to compile the program in debug mode, but disable debug for that specific procedure? Is it also

Re: Convert tuple into a Object

2017-09-01 Thread zuko95
@LeGuim I guess bits would be truncated if you do the unsafe cast. I created the following macros. It's a bit too verbose though - considering the python/c++. macro settattr(attr:static[string]): typed = newNimNode(nnkAsgn).add(

Re: Convert tuple into a Object

2017-09-01 Thread LeuGim
An unsafe but fast and clean way - just to cast your tuple to your object type: proc createRef(typeinfo: typedesc, data: tuple): auto = result = new(typeinfo) result[]=cast[typeinfo](data) Be aware you should provide a tuple of values of needed types, or the

Re: Convert tuple into a Object

2017-09-01 Thread Tiberium
You can definitely do this with a macro

Convert tuple into a Object

2017-09-01 Thread zuko95
I started learning Nim recently. Is there a way to convert a tuple into a object? What I want is to do the following. proc createRef(typeinfo:typedesc, data:tuple):auto = result = new(typeinfo) #fill the result object with the values in the tuple ???

Re: Nim newbie request/challenge

2017-09-01 Thread Tiberium
Maybe you can't access Nim directory from user account because it has wrong permissions? And also maybe you have another Nim installed?