> 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
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
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:
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
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
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.
> [XY problem](https://en.wikipedia.org/wiki/XY_problem)
+1 on the feature. I also sometimes re-use buffers that would benefit from this.
One that hasn't been mentioned yet is simply:
const NeededFlag = defined(DependentFlag)
when NeededFlag:
discard # code goes here
Run
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:'?
Some people are just waiting for v `1.0`
I use a [nim.cfg in
Arraymancer](https://github.com/mratsim/Arraymancer/blob/7edf23662328c059cd22be4cd08c00556321e4d1/nim.cfg#L43):
@if cudnn:
define:"cuda"
@end
Run
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
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.
> 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
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.
{. emit: """#define SOMEOPTION""" .}
Run
Literal, For C target.
> Recently in the chat
any links?
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
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):
const Thing = 0
when declared(Thing):
const otherThing = 0
when declared(otherThing):
echo "we are here"
Run
this works
> 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
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
/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
PR's accepted?
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 ==
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
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.
@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
I am really happy to see a complete pattern matching library for Nim!
Congratulations for your efforts!
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,
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:
> 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,
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
> (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)
35 matches
Mail list logo