i have not, i will take a look at that now, thank you
This is just a simple question. I have started looking at the nim compiler
source and trying to implement my own backend for nim. Is there not
documentation for the nim compiler or is it reserved for developers? I might
just not have found where it is though.
thanks i will do that
If there is no quick fix, i guess i can patch the file. but i just thought id
show this because it is weird
I got this error msg from this code
#The file is get_saves.nims
import parseopt
import "check_installed.nims"
echo check_installed.exists
var ops = initOptParser()
while true:
ops.next
case ops.kind
of cmdEnd: break
of cmdLongOption, cm
Hi, sorry I am looking into the source code filters for nim and it is actually
kind of hard to figure out what a good use case for them is, or if they have
any uses besides just generating xml. I was just wondering if anyone had any
examples of how they have used them in their projects or anywhe
ah thank you so much
So I'm just messing around and from what I understand this code should be fine,
but for some reason I'm getting an error. I am wondering if there is something
I don't understand about pointers in Nim and how to use them
proc newLead[T](oldData:T):Lead =
#copy the data if the
Wow thanks, I didn't know about this use of converters. I can simplify a lot it
code with this!
Oh I figured it out the --import argument in the computer
Sorry, I want to do something like. Include a module automatically to my
project without having to call import in every file. Like the standard library.
I'm wondering if I can do that using nimscript or something else
Might be a noobish question but I've googled for a while and I can't find
anything on being able to automatically import files in a project, like the
system module
Nice, for the amount of time you had it was a good taste of what nim can do.
Not really how to do it but it should get people interested in that
I like @Araq s suggestion as well lol
Fair enough thanks for the time
Is there anyway to undefine a symbol in nim using macros? like in C you can do
#define SYMBOL_NAME
#undefine SYMBOL_NAME
Run
you can also hold data on types by using static though then it needs to be
known at compileTime
type
typeWithData[data:static[auto]] = distinct object
var a:typeWithData[10]
echo a.data
#outputs 10
Run
thanks for the suggestions, as for my question not being smart. I didn't say
because I don't know exactly what I plan to do. I am researching options at the
moment.
the title says it all, I am wondering if anyone has suggestions for very simple
2d graphics library. I have looked at the cairo github for nim but it hasn't
been updated in 2 years so I am not sure if it still functions with the current
version of nim
I think a vote is good, will be voting no for the change though
What can they do??? Is there documentation?
Digging up a dead thread, is there anybody who knows exactly what you need to
do to make a compiler plugin?
yeah sorry, I don't use it much "typeinfo" got it
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
const Thing = 0
when declared(Thing):
const otherThing = 0
when declared(otherThing):
echo "we are here"
Run
this works
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 == nnkSym
the module typetraits might be able to help you
I might be able to help
> 1.Node is a ref object.
Yes, it is. Acting like a pointer (guessing at the inner workings of this) with
the statement
case kind: NodeKind # the ``kind`` field is the discriminator
of nkInt: intVal: int
of nkFloat: floatVal: float
Do you need to know the type at runtime?
looks like there was some other problem. you are right that example now works
I assume i was using a 32 bit version of gcc or nim or i wasnt as up to date as
i thought I will close the issue
ah, yeah fixed the indentation and case mistakes, same problem though made an
issue ticket on github
[https://github.com/nim-lang/Nim/issues/9054](https://github.com/nim-lang/Nim/issues/9054)
Might be because I'm using 0.18.0, I will see
Os and compiler?
Sometimes, I just like astetics ok guys
You realize this evaluates both statements regardless of the condition
Run
Evaluated yes
with a bit different syntax?
Run
Yes
**_IF_** you have been looking for a shorthand if statement here is some code
type
pair*[T] = (T,T)
template `|`*[A](a:A,b:A):pair[A] = (a,b)
template `?`*[T](cond:bool,res:pair[T]):untyped =
if cond:
res[0]
else:
res[1]
oh how to use it
var a = 0==1 ? 1|2 # == 2
var b = 0==0? 1|2 # == 1
#must give the same types for the result
Run
oh how to use it
var a = 0==1 ? 1|2 # == 2
var b = 0==0? 1|2 # == 1
#must give the same types for the result
Run
will do
I'm not sure if its just my computer, but that crashes something. my program
won't output anything now
going to dig up an old thread, I would still love to see
from module import type foo
Run
came up with a fix, so you cannot supply different types
type
same[T] = T
Gen[A:auto,val:static[same[A]]] = same[A]
Run
So today i was messing around with Generic types and I found something that I
think would be considered "Undefined behavior". I thought I would just share it
here in case anyone else gets the same idea.
type
Gen[val:static[auto]] = auto
true_t = Gen[true]
var a:
alright, thank you very much. Just another question do you know if its planned
for V1 or working in devl?
I have just started playing around with concepts, but I'm very confused about
what this return statement is used for with the generics converters I have
tried to do the exact same example and nothing seems to work. though I don't
understand what should be happening anyway. Any help would be grea
that seems useless
Just a quick question, the compiler flag --stdout says it outputs to stdout, am
I assuming that it gives the resulting binary to stdout incorrectly?
thank you very much
another way to say this I guess is, will a bunch of macro definitions bloat my
code?
Do macro declarations end up in the resulting C files?
I am looking for a way to evaluate Nim at run time, is there anything to
recommend?
> I am on Windows 10, Nim Compiler Version 0.18.0 [Windows: i386], MinGW GCC.
I don't know if that is just for windows 10, I am on ubuntu with 0.18.0 and I
am getting the same thing though my code is a little different
{.experimental.}
type thing = object
x:int
p:poi
well this isn't exactly delaying macro expansion I found a work around that
works for what I want
I changed getRNG into a static proc
static:
proc getRNGS():uint32 =
mz = (36969u32 * mz and high(uint32) + (mz shr 32))
#echo tobin(mz.int,64)
mw = (18000
So I am making just a small compile time RNG and having a few problems
macro getRNGF*():float =
let fh = high(uint32)
let fr = getRNG()
return fr.float / fh.float
the getRNG proc is another macro that affects some static variables declared
earlier, but the pro
nimeks, like planet namek in dragonball z
you are right, thank you
alright thank you, that narrows my search
Just a quick question, I have been looking for where the static macro is
defined so I can look at how it is implemented does anyone have an idea of
where that would be?
yeah I have noticed that too, might be a bug... I wouldn't know how to go about
stating that though
Awesome Thank you, that worked great
I have started using nim just recently as well, and I can agree with you this
language is great! My brother is the one who let me know about this language
because he has been watching me do experiments with compiler abuse in C++
(which if I wanted to do anything fun I had to abuse the compiler),
Here I have made an example of what is happening
#module A
static:
var test=0
proc test_proc(): void {.discardable,compileTime.} =
var a = test
echo a
#module B
import A
static:
test_proc()
this will
thanks, I think i learned I have a completely different problem then what I
thought was going on, I will try to figure it out before I bother more people
about it, but what is happening is that a proc I have made is using static
variables defined in one module, but when I export that proc and us
So just to start, I am very new to nim I started reading about it and
programming in it 4 days ago. I understand that using static like this
static:
var some_variable = 10
evaluates the statement at compile time and uses the Nim VM to do that
my questions are, is there
64 matches
Mail list logo