I don't really understand your problem, but what you want is probably a
combination of named and default arguments?
proc newPerson(name: string, age: int, job: Option[string] = none(string)):
Person =
# ...
let a = newPerson(name = "John", age = 30)
let b = newPer
Update:
new url:
[https://nimfrontpage-fun.vercel.app](https://nimfrontpage-fun.vercel.app)
Todo:
* dark/light theme switch
* implement playground
* add featured projects (games, library, etc...)
What's up guys,
I'm trying to pass multiple parameters into my procedure based on the key-value
pairs of a Json object.
I have many procedures, all having various amounts of parameters and types. I'm
trying to have a single proc that places the appropriate parameters into the
appropriate posit
So while trying to cross-compile a pretty simple Nim program for Windows, I get
the following error message during compilation:
Error: execution of an external compiler program
'/usr/bin/x86_64-w64-mingw32-gcc -c -w -mno-ms-bitfields -O2 -g -pipe -Wall
-Werror=format-security -Wp
It's a bug:
[https://github.com/nim-lang/Nim/issues/7432](https://github.com/nim-lang/Nim/issues/7432)
Thanks.. I should have looked at the nimble options again, I think I have used
this before!
Nimble has a mode for that, `nimble develop`. I think it fits your use case
I'm working on a project where I've separated libraries/applications into
different nimble packages to make things more organized and reusable. However
my worry is that if I forget to run a "nimble install" command when I've made
changes to a library, I could have trouble debugging code that isn
You both might be interested in something called "Aggregate Bit Vectors". The
idea is simple: for each big 64-bit or whatever word in your bit vector, let
that be just 1 bit in a "level higher" structure if _any_ bit is on and zero if
they are all off. You can then do the same trick again for a
Also, if you want to make the code look more recursive (maybe subjective...),
you can add a for-loop macro to some `thatDef.nim` module:
import macros # This needs {.experimental: "forLoopMacros".}
macro toItr*(x: ForLoopStmt): untyped =
## Convert factory proc call f
**Hi**! I really like your videos! Can you make a video about
**metaprogramming**? I think it will be interesting
Hey I made one as well :)
[https://github.com/treeform/bitty](https://github.com/treeform/bitty)
I think bit operations are fun.
#24 is live at: [https://youtu.be/aME-tyPCPvE](https://youtu.be/aME-tyPCPvE)
Objects.
> Not in a strongly typed language. A char is a character while a range[0 ..
> 255] is an integer in the range 0 to 255.
@spip of course the type system distinguishes between char and range[0..255] as
types. My last comment was about a char that can be seen as a (printable)
character like 'w' o
Nim is not (kinda) typeless as C. You cant assign integer values to a char
variable directly in Nim. So, if you declare it's parameters as char, you would
have to convert your integers to char like rgb(chr(255),chr(0),chr(0))
Not in a strongly typed language. A `char` is a character while a `range[0 ..
255]` is an integer in the range 0 to 255.
Just like the temperature of my oven can not be interpreted as an amount in my
wallet!;-)
That's just a matter of perspective: one can interpret a char as a character or
as a plain byte ;)
Because rgb("w","t","f") doesnt make sense :)
Here is a real world example excerpt taken from some of my C code (with
anonymized function and var names) so you can see how it looks like:
#include
//...
typedef struct {
uint32_t P checked[128];
uint32_t Q checked[128];
} FOO_State;
//...
u
You must understand what it's about and how it works. If you just use it like a
normal C compiler, it will behave like that (specifically like clang) which
isn't particularly useful and adds nothing in terms of safety/correctness.
For that you must "annotate" the C code, in particular arrays and
My initial consideration was that range[0..255] doesn't require a explicit type
cast but the program has to ensure that the argument is indeed between 0 and
255. In the end the compiler either knows the value of the arguments at compile
time or the value is determined at run time (i.e. by readin
Hi,
I stumbled on the Microsoft opensource (MIT) "Checked C" project, has anyone
tried using this safer c compiler (based on clang/llvm) as NIM compiler? I
guess being able to use "Checked C" with NIM would build an even stronger case
for NIM as a safe programming language.
[https://www.micros
so you can construct it with any integer arguments.
Hello guys,
while browsing the Nim standard library I noticed that a contructor for the
[Color](https://nim-lang.org/docs/colors.html#rgb%2Crange%5B%5D%2Crange%5B%5D%2Crange%5B%5D)
type is defined as follows:
proc rgb(r, g, b: range[0 .. 255]):
Run
Why would one limi
24 matches
Mail list logo