Pythons None in Nim

2021-12-18 Thread pietroppeter
Not your use case but in case you have a single optional input (it becomes impractical when optional inputs increase) another option (haha) is to have separate overloads (which usually can share the logic): proc foo(x: int) = echo “no y” proc foo(x: int, y: int) = echo “y: “, y

Issues with proxy authentication

2021-12-18 Thread xioren
Yeah cURL and my python test code use basic auth too. My naive assumption is that there is something different about how the "proxy-authorization" header is handled with Nim. I'm currently reading through the source code to see if I can figure it out.

Pythons None in Nim

2021-12-18 Thread evoalg
For someone new to Nim and coming from python, I like your suggestion of using int.low... proc foo(x: int, y=int.low) = if y == int.low: echo "y wasn't given" else: echo "y = ", y foo(1, 2) # y = 2 foo(1) # y wasn't given Run int.l

A rant about Nim bugs

2021-12-18 Thread jasonfi
I've never had a problem with Nim that was the compiler's fault. It was typically lack of documentation or examples. But people on the forum are helpful and I always found a way forward. Now I plan to deploy a system (Production) by around March 2022. Similarly to sdmcallister, Nim is the least

Issues with proxy authentication

2021-12-18 Thread ZadaZorg
Nim Proxy support only basic authentication. So there is chance, that proxy which fail uses something else. You can verify this by reading Proxy-Authenticate header response from proxy.

Pythons None in Nim

2021-12-18 Thread ElegantBeef
Nim's `options` gives this abillity, alternatively you could use a specific value like `-1` or `int.low` but that's up to you. import std/options proc foo(x, y = none(int)) = if y.isNone: echo "y = None" else: echo y.get foo(some(1), some(2))

Pythons None in Nim

2021-12-18 Thread Jocker
I'm trying to rewrite some Python code in Nim but I am currently struggling at this codeblock. I have multiple optional Inputs (ints) and need to check whether they are set or not. def foo(x, y=None): if y is None: print("y=None") else: print(y)

Check nim compiler version during compilation

2021-12-18 Thread demotomohiro
Please read the system module document:

Check nim compiler version during compilation

2021-12-18 Thread BarrOff25
Thank you very much this is exactly what I have been looking for!

Check nim compiler version during compilation

2021-12-18 Thread BarrOff25
Hello, I would like to call different code, depending on the version of the nim compiler used. Some code uses the deprecated version of `readChars` found [here](https://nim-lang.org/docs/io.html#readChars%2CFile%2CopenArray%5Bchar%5D%2CNatural%2CNatural). Converting it to the new overload works

A rant about Nim bugs

2021-12-18 Thread ElegantBeef
> It seems to me that many features are implemented without a proper spec or > considering edge cases This is very true in my view, many issues where "X should work but does not" is simply someone forgetting some obscure AST can exist since many steps require you to think deeply about "what AST

Nim 1.6.2 released

2021-12-18 Thread Pumpus
In Q2 2022 we start using NIM in production for our business. Merry Christmas Thank you for your work

Nim with curly brace and tab

2021-12-18 Thread sdmcallister
sure, but this is normal for dart/flutter lol. In vscode it tries to make things better by auto-inserting comments to tell you what each closing brace is for.

A rant about Nim bugs

2021-12-18 Thread sdmcallister
I use Nim in 'production' and Nim is honestly the least of my problems.

A rant about Nim bugs

2021-12-18 Thread sekao
I don't have any insight into whether the dev process could be improved, maybe you have a point there. But just as a data point: I'm closing in on two years using nim, including heavy use of generics and macros. I reported [a generics bug](https://github.com/nim-lang/Nim/issues/15101) and it was

Issues with proxy authentication

2021-12-18 Thread xioren
last addition: Apart from cURL, similar code also works in Python so I'm not sure there isn't some issue with Nims proxy auth handling.

A rant about Nim bugs

2021-12-18 Thread Hlaaftana
No one is really obligated to do anything except what they get paid for, so you need some kind of motivation. This motivation is not easy to come by if you don't have a specific goal. I don't think Nim has a specific goal (so it's "general purpose"), and I'm perfectly fine with this. There are s

Nim with curly brace and tab

2021-12-18 Thread SolitudeSF
thats just a bad braces style. if you trail braces/brackets lisp style it looks way more manageable.

Nim 1.6.2 released

2021-12-18 Thread 12398890
Any ETA about Nim 2.0?

Nim with curly brace and tab

2021-12-18 Thread sdmcallister
I wish other languages did what Nim does. Take dart for example: class _SunflowerState extends State { double seeds = 100.0; int get seedCount => seeds.floor(); @override Widget build(BuildContext context) { return MaterialApp( d

Nim with curly brace and tab

2021-12-18 Thread Hlaaftana
Keyboard only is definitely not peak productivity for things that aren't programming, but since all code requires a keyboard to write the friction is much higher. Mouse is better for 2D things like first person cameras or some menus, which almost applies to code, but generally code is still 1D.

A rant about Nim bugs

2021-12-18 Thread konsumlamm
Disclaimer: Note that I don't want to attack anyone, this is just my personal opinion. I've wanted to talk about this for a while now: Nim, specifically the compiler, is very buggy in my experience. And I'm not talking about experimental features, where bugs are to be expected, but (supposedly)

Nim with curly brace and tab

2021-12-18 Thread demotomohiro
I'm using this vim plugin to move cursor between blocks: > `IndentWise` is a Vim plugin that provides for motions based on indent depths > or levels in normal, visual, and operator-pending modes.

Why windows.h file is always included into compilation on Windows?

2021-12-18 Thread demotomohiro
Here is result of `git grep windows.h` on latest devel Nim. Some APIs are imported on several places. For example, `GetLastError` is declared in `lib/system/excpt.nim` and `lib/system/threadlocalstorage.nim`. These APIs should be moved to `winlean` module? `GetCurrentFiber` is not used in Nim r

Nim with curly brace and tab

2021-12-18 Thread cblake
Couple points. First, for decades (at least the 70s & 80s) before Python, Lisp people would say, in defense of its many parentheses, "one always reads by indentation anyway with some Emacs auto-shaper". This was so commonly uttered one might call it a "refrain". So, Python (copying ABC, actually

Nim with curly brace and tab

2021-12-18 Thread SolitudeSF
its a joke

Nim with curly brace and tab

2021-12-18 Thread IridiumPoint
I'm not going to argue the validity of your claim, but that's a terrible argument even if it was true - there are Trackmania pros who play on keyboard.

Nim 1.6.2 released

2021-12-18 Thread kobi
Merry Christmas everyone!!

How can I convert a generic Type?

2021-12-18 Thread rnd83
Ok, I found a solution. Seems **converter** is selected based on the type of the result. So I can define it like this: converter toPointInt*[T](pt: Point[T]): Point[int] = result.x = int(pt.x) result.y = int(pt.y) converter toPointFloat*[T](pt: Point[T]): Point[

Nim with curly brace and tab

2021-12-18 Thread Araq
Keyboard-only interfaces like Vim are objectively highly unproductive though... Proof: No competitive Esport player uses a keyboard-only interface.

Nim with curly brace and tab

2021-12-18 Thread mashingan
My superficial preference with braces is simply easier to navigate to end of block by pressing `%` with vim. Other than that, it doesn't really matter.

Nim with curly brace and tab

2021-12-18 Thread Araq
That's another case where I unconsciously picked the "design from first principles": Syntax is hard to judge objectively, but at least the indentation based syntax is shorter and that's an objective criterion.

Nim with curly brace and tab

2021-12-18 Thread awr1
If you feel awkward coming to Nim after getting so used to braced languages, believe me, after a while you will get used to it and maybe end up preferring it in the end. Discussions about syntax can be important (to provide an extremely arbitrary example: Nim doesn't "cheapen" the syntax at the

Why windows.h file is always included into compilation on Windows?

2021-12-18 Thread greenfork
> Maybe, Raylib is supposed to be used for making simple game quickly and not > supposed to be used with other libraries. Or maybe not. I'm not as much interested in the metaphysics of the original intent, I just want to make it work.