Re: How to check an auto type parameter in a proce

2018-09-26 Thread miran
> Sorry for disturbing you with my questions. Next time, when i face any > obstacles in nim coding, i will insist myself to not to ask in this forum. Please read the wiki article I linked. Not only that you shouldn't react like I was personally attacking you, but you you should see that the

Off-subject GTK check-resized signal

2018-09-26 Thread geezer9
This is a GTK2 question rather than a nim question. I hope some NIXER will disregard that and lend a hand. I have returned to a cross-platform GUI nim project after 6 months in the Javascript Wilderness. I discovered the GTK2 version of my module was exercising the check-resize callback many

Re: Nim source equivalent to C #define

2018-09-26 Thread geezer9
Many thanks for all the suggestions. Since NEEDEDFLAG can also be set by: nim c -d:NEEDEDFLAG etc.etc. Run I need to use defined(NEEDEDFLAG) instead of declared(NEEDEDFLAG). However the following inside nim.cfg worked for me: @if BGMAP:

Re: How to check an auto type parameter in a proce

2018-09-26 Thread mratsim
Asking in the forum is not an issue, but what miran said is that he feels like you might be trying to solve your issue at a low level while we could solve the actual bigger problem. (correct me if I'm wrong @miran). 1\. Auto and Any type for input params are usually not needed, using a generic

Re: How to check an auto type parameter in a proce

2018-09-26 Thread kcvinu
I don't want to use python because these reasons. 1. I need to use a third party app to make exe from python code. (I think python is not for windows) 2. Compiled exe is very large. A normal hello world gui app will size around 4-5 MBs. 3. Execution speed. I will sure consider the

Re: How to check an auto type parameter in a proce

2018-09-26 Thread kcvinu
Sorry for disturbing you with my questions. Next time, when i face any obstacles in nim coding, i will insist myself to not to ask in this forum.

Re: How to check an auto type parameter in a proce

2018-09-26 Thread miran
> [XY problem](https://en.wikipedia.org/wiki/XY_problem)

Re: setLen without 0-initialization (for efficiency)

2018-09-26 Thread cblake
+1 on the feature. I also sometimes re-use buffers that would benefit from this.

Re: Nim source equivalent to C #define

2018-09-26 Thread Hlaaftana
One that hasn't been mentioned yet is simply: const NeededFlag = defined(DependentFlag) when NeededFlag: discard # code goes here Run

Re: Nim source equivalent to C #define

2018-09-26 Thread jangko
Actually Nim has {.define: identifier.} pragma, but then it was deprecated. I'm curious to know what was the reason. Doesn't it behave similarly with '-d:' or '\--define:'?

Nim developer retention data and out-of-date packages

2018-09-26 Thread juancarlospaco
Some people are just waiting for v `1.0`

Re: Nim source equivalent to C #define

2018-09-26 Thread mratsim
I use a [nim.cfg in Arraymancer](https://github.com/mratsim/Arraymancer/blob/7edf23662328c059cd22be4cd08c00556321e4d1/nim.cfg#L43): @if cudnn: define:"cuda" @end Run

Re: Nim source equivalent to C #define

2018-09-26 Thread lotzz
i just want to say, i love how many good options nim has for such a simple thing. Nim -- a buffet for the programmers taste

Re: Nim developers leaving Nim

2018-09-26 Thread arnetheduck
Don't remember the specifics, but the conversation was around useful third-party libraries no longer maintained.. emacs mode, a few other, that sort of stuff.. and above all, anecdotal. Some hard data on this, ie how often it happens and why, would be interesting to see.

Re: How to check an auto type parameter in a proce

2018-09-26 Thread Stefan_Salewski
> I just tested it and it worked. Is there any problems using this method ? Of course you can cast refs or ptrs to int and store it in a seq of ints. But how do you do the bookkeeping? When you retrieve a value from your list, then its looks like an int. So how do you decide if it may be a ref

Re: Nim developers leaving Nim

2018-09-26 Thread Araq
To be fair, I think the "several prominent Nim developers" is blown out of proportion, it was a single person who left Nim years ago. AFAIK.

Re: Nim source equivalent to C #define

2018-09-26 Thread juancarlospaco
{. emit: """#define SOMEOPTION""" .} Run Literal, For C target.

Re: Nim developers leaving Nim

2018-09-26 Thread timothee
> Recently in the chat any links?

Nim developers leaving Nim

2018-09-26 Thread arnetheduck
Recently in the chat, there was a conversation about several prominent Nim developers moving on to different language pastures, which made me curious. When I read about people discovering Nim, they're excited - the first impression is often good - but what causes them to later leave? * Has

Nim source equivalent to C #define

2018-09-26 Thread geezer9
Is there a pragma (or some such) that performs like the C preprocessor command: #define SOMEOPTION Run I would like definition of some debugging flags to automatically define others. For example: when defined(DEPENDENTFLAG):

Re: Nim source equivalent to C #define

2018-09-26 Thread lotzz
const Thing = 0 when declared(Thing): const otherThing = 0 when declared(otherThing): echo "we are here" Run this works

Re: How to check an auto type parameter in a proce

2018-09-26 Thread kcvinu
> Three separate seqs with different data types and same name? Obviously makes > not much sense. Ha ha.. In my sense, it was like ; "Hey compiler, this is > 'one' seq but the data type is one among three. If the input value is int, > then treat this seq as a seq[int]. And when the input value

Re: problem compiling to webassembly

2018-09-26 Thread francisl
Like this I have the same error. Plus I don't see that command when i type nim --help nim c -d:useRealtimeGC -d:release -d:emscripten --os:linux --out=index.html src/cacheim.nim Run of nim c -d:useRealtimeGC -d:release -d:emscripten --os=linux

how to integrate existing react components in karax? (and vice versa)

2018-09-26 Thread timothee
/cc @araq| ---|--- * Can karax integrate arbitrary react components? if not, what are limitations? Are there examples for doing that? The more examples the better. eg: [https://github.com/brillout/awesome-react-components](https://github.com/brillout/awesome-react-components) for

Re: setLen without 0-initialization (for efficiency)

2018-09-26 Thread timothee
PR's accepted?

a small change to macros.getCustomPragmaVal

2018-09-26 Thread lotzz
real quick here is the code for the change macro getCustomPragmaVal*(n: typed, cp: typed{nkSym}): untyped = let pragmaNode = customPragmaNode(n) result = newTree(nnkPar) for p in pragmaNode: if p.kind in nnkPragmaCallKinds and p.len > 0 and p[0].kind ==

Re: A fast float to string conversion library

2018-09-26 Thread lemonboy
The underlying algorithm is nothing more than `grisu2` that's going to give you roundtrip-able values in the shortest amount of time, the tradeoff is in the 0.05% of numbers that cannot be "encoded" in the shortest possible way. For a stdlib implementation you may want to use something like

Re: Confusion about macros.

2018-09-26 Thread solo989
Thanks for the help. I didn't quite get what the not unused error was because it was so short and I was hung up on the other error.

Re: Is there any untyped list data type in Nim ?, like in python.

2018-09-26 Thread mratsim
@kcvinu @miran, yes I'm using devel. I also prefer tagged union (also called sum types) in general to avoid the pointer indirection. Just be aware that with the second solution (inheritance/polymorphism) any user of your library can extend your base type with its own and reuse the methods you

Re: Gara: pattern matching DSL

2018-09-26 Thread andrea
I am really happy to see a complete pattern matching library for Nim! Congratulations for your efforts!

Re: Confusion about macros.

2018-09-26 Thread gemath
This works: macro t2(): untyped = result = getAst(t1()) #t2() Run A macro produces an abstract syntax tree (AST) of nodes, that's what is assigned to its `result` variable. A macro call like `t1()` is replaced with the code representation of this AST,

Re: How to check an auto type parameter in a proce

2018-09-26 Thread Stefan_Salewski
miran I think your explanation is still too short for beginners... One should know that proc foo(a: seq[int|float|char]) Run is basically a short form for definition of three separate procs: proc foo(a: seq[int) proc foo(a: seq[float) proc foo(a:

Re: How to check an auto type parameter in a proce

2018-09-26 Thread miran
> This gave me error. > > `var mySeq : seq[ int | float | string]` This cannot be used for declaring a variable, but you can use it for arguments in a function: proc foo(a: seq[int|float|char]): string = return $a[0] echo foo(@[3, 5, 7]) echo foo(@[3.5, 5.7,

Re: How to access base class member from derived class ?

2018-09-26 Thread Stefan_Salewski
You may also compare your code with this example of OOP inheritance: [https://forum.nim-lang.org/t/4226](https://forum.nim-lang.org/t/4226) The corrected code of lscrd should compile and work. I think your own code on the top is a bit "strange and dangerous" as you manually initialize member

Re: Is there any untyped list data type in Nim ?, like in python.

2018-09-26 Thread miran
> (But i think you forgot to init the seq with "@[]") @mratsim is using `devel` version of Nim, and in it (and in the upcoming v0.19) you don't have to explicitly do that anymore. (The same goes for strings)