2022 Developer Survey is open! Take survey.

Questions tagged [nim-lang]

Nim (formerly known as "Nimrod") is a statically typed, imperative programming language that tries to give the programmer ultimate power without compromises on runtime efficiency. This means it focuses on compile-time mechanisms in all their various forms.

Filter by
Sorted by
Tagged with
1 vote
1 answer
107 views

Function comparing two strings slower in nim than python

I am a novice in nim, but want to use it to write functions to use in python. I am using nimpy and nimporter for importing nim functions to python. This function in python: def pcompare(a, b): ...
user avatar
0 votes
1 answer
30 views

How do I iterate over the fields of a ref object in nim?

I have a ref object type and would like to iterate over all of its fields and echo them out. Here an example of what I want: type Creature* = ref object s1*: string s2*: Option[string] n1*:...
user avatar
0 votes
1 answer
32 views

Jsony newHook has `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` when deserializing into ref-objects

I am writing a web-application and am deserializing via jsony into norm-model-object types. Norm-model-types are always ref objects. Somehow my code which is very similar to the default example in ...
user avatar
-1 votes
1 answer
39 views

How do I call Mix_GetError from the nim SDL2 Mixer bindings?

There are multiple references in the nim SDL2 mixer.nim file to Error messages can be retrieved from Mix_GetError(). However, I can't seem to find this function defined in the mixer.nim file How can I ...
user avatar
  • 2,728
1 vote
1 answer
42 views

How to properly read and parse data from Firebase in Nim?

I have a database in Firebase which currently I can access through CURL like this curl "https://mydb.firebaseio.com/my_data.json?auth=XKJYED78634jsvdffwu7riugwer" I want to make a Nim script ...
user avatar
  • 56
0 votes
1 answer
54 views

How do I access an object field via its field name in string form?

I'm figuring out at compile-time the name of a specific field of an object that I want to access. Before I compile, I do not necessarily know which field that is going to be, so I just have that field ...
user avatar
1 vote
1 answer
59 views

Check if a string ends with something, case insensitive?

I want to check if a file has a certain extension, which I can do with filename.endsWith(".ext"). But I also want to match against .EXT. How can I do this?
user avatar
0 votes
1 answer
58 views

how to pass +, -, etc. to macro in Nim

I want to do something like this macro in Nim #define BINARY_OP(op) \ do { \ double left = getLast(); \ double right = getLast(); \ push(right op left); \ } while (false) I ...
user avatar
  • 335
1 vote
1 answer
101 views

How to generate C headers from Nim

I wrote a library which is intended to be used in C as well. Compiling the library to a .dll/.so/.lib itself is well documented and works as expected. However, I cannot find anything regarding the ...
user avatar
  • 110
1 vote
1 answer
85 views

nim, how to get the result of multithreading execution immediately, without any delay?

I'm absolute beginner in Nim Lang. I have been practicing python for the last 4 years, before that there was a sharp. Nim is great, but I don't understand how to comprehend him yet. I'm trying to ...
user avatar
0 votes
1 answer
27 views

Norm - Querying entries within generics causes type mismatch compilation error

I write a web application in the nim programming language and use norm as my ORM. There I follow the standard repository pattern, meaning you have associated with a given URL a controller which calls ...
user avatar
1 vote
1 answer
39 views

How do you align string containing accents in nim

In Nim, how do you align strings containing accented characters? For example the following code var maxLen = 20 var s1 = alignLeft("John le Carré", maxLen) var s2 = alignLeft("John le ...
user avatar
  • 15k
1 vote
1 answer
39 views

The runtime constant in forward declaration

How do we do runtime constant in forward definition/declaration by any way around (tried hard not work on using let) let n :int proc m : int = let i=1 var u=n+i n=m() error for this or for other ...
user avatar
1 vote
0 answers
46 views

Change Directory and exit program in that directory in Linux

I have a simple program that I run from a terminal which changes the working directory (via setCurrentDir) and performs some other work which creates some new files in that folder. When the program ...
user avatar
  • 15k
1 vote
1 answer
61 views

Nim lang syntax a = b = c = 7

How to solve error on syntax var a = b = c = 7 being one RHS value for many LHS just like in C: int a,b,c ; a = b = c = 7 ; so on Nim lang: Error: invalid indentation Help out, thanks in advance
user avatar

15 30 50 per page
1
2 3 4 5
37