python: print(x, end=" ")

2021-08-27 Thread miran
> Sometimes I guess that Nim is sponsored by keyboard manufacturers -- the > space bare of my keyboard will soon dye, as tabs are not permitted. Nah, you just don't know to configure your editor — I just press tab key to insert two indentation spaces. (and four for Python) And of course, lines

Goodboy Galaxy - Kickstarter and demo now live!

2021-08-27 Thread Fire
Loved it. 100%.

Goodboy Galaxy - Kickstarter and demo now live!

2021-08-27 Thread exelotl
Hi everyone! For the last 2 years I've been making a Game Boy Advance game in Nim with a friend on the weekends. Yesterday we launched a [Kickstarter](https://www.kickstarter.com/projects/penguinrik/goodboy-galaxy-exploration-platform-game-gba-pc-and-switch) campaign along with a [demo](https:

Any plans for better optional arguments?

2021-08-27 Thread ElegantBeef
"Very clear what's going on" well not really since `nil` in Nim means `nil pointer` and you're using it like a type, but turns out `void` is the magical thing since the following works: proc somefn(a = 100, b = 300, v: int | void = void) = when v is void: echo "defaul

How to make a const array in a proc w/ template?

2021-08-27 Thread Hlaaftana
No, static[int] is the old syntax, static int is just a new more convenient syntax.

How to make a const array in a proc w/ template?

2021-08-27 Thread ggibson
Thank you! Is there a difference between `static int` and `static[int]`? I've never seen the former.

How to make a const array in a proc w/ template?

2021-08-27 Thread ggibson
Why does the following fail to compile? The "cannot evaluate at compile time" seems wrong to my intuition about what's available here at compile time by using `untyped` and a template. # example that is not compiling template makeArray(SIZE:untyped):untyped = var a:ar

How to make a const array in a proc w/ template?

2021-08-27 Thread Hlaaftana
This is reported on GitHub: Most convenient workaround afaik is `const arr = (proc: auto = makeArray(3))()`

c2nim and Stringification

2021-08-27 Thread giaco
thanks for the answer and the examples

python: print(x, end=" ")

2021-08-27 Thread demotomohiro
`dump` macro in `sugar` module is different from your `jecho`, but easy to print expressions. import std/sugar var x = "Hello" y = 100 z = 42.0 #dump x, y, z # Compile error dump (x, y, z) dump x & $y dump z Run Output:

Any plans for better optional arguments?

2021-08-27 Thread haxscramper
type Defaulted = distinct char const noVal = Defaulted('0') proc somefn(v: int | Defaulted = noVal) = when v is Defaulted: echo "defaulted" else: echo "explicitly" somefn() somefn(12) Run You can already write it like

Any plans for better optional arguments?

2021-08-27 Thread alexeypetrushin
I personally would prefer this `proc somefn(v: int | nil = nil) = echo v`

Any plans for better optional arguments?

2021-08-27 Thread alexeypetrushin
> Basic data types, plain object etc. cannot be nil Yes, and it's a good thing (would be even better if `ref` also couldn't be nil unless explicitly specified). > But this introduces nilability to value types, which completely breaks all > all assumptions. No, it doesn't introduce nullability

Mac GUI

2021-08-27 Thread whiterock
Hey, nice work! Are there any plans on adding a canvas element of sorts? like something which is freely drawable - for instance when creating a photoshop like program or generative art or slideshow things etc

Any plans for better optional arguments?

2021-08-27 Thread haxscramper
What are possible possible improvements though? Introduce some implicit argument state like "was defaulted" vs "was specified explicitly" and allow user to switch based on that?

Any plans for better optional arguments?

2021-08-27 Thread haxscramper
But this introduces nilability to value types, which completely breaks all all assumptions. Basic data types, plain `object` etc. Cannot be nil, but `int | nil` implies (at least syntactically) exactly that.

c2nim and Stringification

2021-08-27 Thread demotomohiro
It just convert given expression to string literal. And as it is a feature of preprocessor, an argument to the macro is not checked by C compiler unless the macro expand given argument. #include #define STRINGIFY(x) #x int main() { printf(STRINGIFY(main(11+3

Any plans for better optional arguments?

2021-08-27 Thread alexeypetrushin
Currently there are couple of ways to define optional arguments, but none looks good. Any plans for improvement? [play](https://play.nim-lang.org/#ix=3x9n) import options # 1 Nil # proc somefn(v: int = nil) = echo v # doesn't work for primitives # 2 Overlo

c2nim and Stringification

2021-08-27 Thread giaco
I have this define in C header file: define SOAP_STRINGIFY(s) #s Run I'm not an experienced C programmer, but this seems c2nim fails to parse it. I've been trying with different #def in #C2NIM block,

test222222

2021-08-27 Thread benja
hello

python: print(x, end=" ")

2021-08-27 Thread Stefan_Salewski
Yes, maybe that is currently the best available solution. Remembering the module and command name, and pressing the {} keys on the German keyboard is not that easy, but I guess I will finally learn and remember it. echo x, " ", y, " ", z echo fmt"{x} {y} {z}" jecho x, y, z

python: print(x, end=" ")

2021-08-27 Thread miran
Use `strformat`: import strformat var x = "Hello" y = 100 z = 42.0 echo fmt"{x} {y} {z}" Run

how to reverse string in nim

2021-08-27 Thread Yardanico
Please, please use the search in the module docs and real time chats :) Reverse in-place - Out-of-place -

Is there no way to pass a specific overload to a macro?

2021-08-27 Thread treeform
Thank you for your answers! Both methods appear to work.

how to reverse string in nim

2021-08-27 Thread Kalbhairab
is there a way to reverse string in nim as python [: : -1] or way to reverse list

Is there no way to pass a specific overload to a macro?

2021-08-27 Thread jyapayne
@treeform you could also do something like this: import macros import strformat type Stuff = object x: int y: int proc foobar(x: string): string = discard proc foobar(x: int): int = discard proc foobar(x: Stuff,

python: print(x, end=" ")

2021-08-27 Thread Stefan_Salewski
Yes, the issue are the missing spaces. Sometimes one wants to just write echo str1, val1, str2, char1, float Run without inserting a " " after each value. Your [x, y, z].join(" ") example above works only when all data have the same type. And typing a custom output pr

python: print(x, end=" ")

2021-08-27 Thread PMunch
Not quite sure what you mean. This works fine: var x = "Hello" y = 100 z = 42.0 echo x, y, z # Outputs "Hello10042.0" Run If you want them to be separated by spaces you'll need to build the string with $ and join, or write your own procedure