Nim Side-Effects

2023-08-17 Thread termer
For proc authors I'd agree with @Araq that using `var` means you're stating your intentions and it's not a big deal. The issue is that it's not clear to consumers necessarily, and it's harder to depend on `{.noSideEffects.}`. But, as with any other language, there are usually flags that should b

Potential users

2023-08-17 Thread termer
You label it more precisely than most, but I'd rather not rehash a conversation that's been had numerous times on IRC/Discord. I do think it's important that you pointed out fun though. That's the primary reason I use Nim these days.

Kubernetes operator in Nim?

2023-08-17 Thread Araq
Ask an AI to translate a Go/Python/Rust kubernetes operator to Nim. ;-)

Potential users

2023-08-17 Thread arik
I use it for science gateway development at my uni. Mummy is just great for our usecase.

Kubernetes operator in Nim?

2023-08-17 Thread nimian
How would one go about making a kubernetes operator in NIM?

strange osproc.waitForExit crash

2023-08-17 Thread enthus1ast
pr.peekExitCode indeed returns the correct exit code (if not killed by signal). Then maybe i could even go without restarting the application.

Nim Side-Effects

2023-08-17 Thread LokeX
Well, at least var T is explicit - so, that should not be a cause of astonishment. So strict func will be default eventually: you've made me such a happy critter! You know: you could have just told me so - but then again: we wouldn't have had all this fun :-) I think I have what I came for - Tha

Nim Side-Effects

2023-08-17 Thread Araq
Well it works out since point (2) is poorly phrased. `var x = noSideEffectF()` is a state change outside of the scope of the function so nothing happens if we extend it to cover `noSideEffectF(#[byvar]# x)`. (Also definitions usually don't repeat the word 'ever' three times in a row and use more

Nim Side-Effects

2023-08-17 Thread LokeX
Splendid! Then you just make ""strict func" the default and then {.noSideEffect.} will actually mean no side effect - no astonishment any longer.

Nim Side-Effects

2023-08-17 Thread Araq
A function is considered pure when two conditions are met: 1. Given a specific input it must always return the same output, so that: it cannot rely on any state outside its scope that is not certifiably invariant. 2. Under no condition - what so ever - must the inner workings of the function

Nim Side-Effects

2023-08-17 Thread LokeX
"Think about it." Araq, I already did - and you have my opinion. Make of it what you will...

strange osproc.waitForExit crash

2023-08-17 Thread janAkali
I'd guess you're hitting some kind of system limit. I have this status line script - . Sometimes IO operations just fail, though in my case error is less unambigious, ExceptionMsg is "OS error: Bad file descriptor". It appears in log file once in 24 hours, but it c

Nim Side-Effects

2023-08-17 Thread SolitudeSF
feel free to add `{.gigafunc.}` pragma that rejects `var` parameters.

Nim Side-Effects

2023-08-17 Thread Araq
My terminology is in fact correct as there is no universal definition of "side effect"...

Nim Side-Effects

2023-08-17 Thread LokeX
If that's your issue so be it. But I'm not wrong: your terminology (no-side-effects) is wrong...

Nim Side-Effects

2023-08-17 Thread LokeX
The point is that the term no-side-effects is a de facto technical term: when you use it you better mean: no-side-effects - or you violate the principle of least astonishment. I happen to think that Nims use of the "func" keyword is a potential stroke of genius, but it would require strict chec

Nim Side-Effects

2023-08-17 Thread Araq
> Yeah, I thought there might be some technical stuff behind that decision. But > you're violating the principle of least astonishment here. I don't, it is just that you're wrong: func split(s: string): seq[string] = result = @[] for w is words(s): result.add w

strange osproc.waitForExit crash

2023-08-17 Thread enthus1ast
In a long running application i periodically call (linux) executables and collect their return code and output. Sometimes `waitForExit` excepts with "Invalid argument", but it still collects the stdout. I tried to reproduce the crash. The application below crashes after a few seconds. When usin

Nim Side-Effects

2023-08-17 Thread LokeX
It's crucial for parallel and concurrency: if no side-effects actually means absolutely no side-effects, you're provably free of data-races. If you're going through somebody's code and you can determine at a glans, that this routine can make zero surprises, that's a selling point. Current behavi

Nim Side-Effects

2023-08-17 Thread guzba
I understand the theory, however I think what you said is still true of var types in funcs assuming it is a value / non-ref type. A copy would be made on any assignment or whatever down the road if there were inter-thread communication. The ref object situation is different, both in the func be

Nim Side-Effects

2023-08-17 Thread guzba
Maybe I'm missing why this is a big deal, but why would you just not have the `var` in the parameter type if you absolutely do not want any modification? It seems like `var` explicitly says mutate-me and it is not a side-effect, it is the literal main effect. I'm not big on theory-crafting thoug

Nim Side-Effects

2023-08-17 Thread LokeX
Yeah, I thought there might be some technical stuff behind that decision. But you're violating the principle of least astonishment here. Wouldn't it be preferable to be strict (absolutely strict) by default, and then provide opt outs for special cases?

Nim Side-Effects

2023-08-17 Thread LokeX
Nims func keyword is defined as "shorthand for the {.noSideEffect.} pragma". No side effects is a Functional term to describe function purity: A function is considered pure when two conditions are met: 1. Given a specific input it must always return the same output, so that: it cannot rely on

Nim Side-Effects

2023-08-17 Thread Araq
Because it's more useful this way. Note that with the new "strict funcs" features only `var T` parameters continue to be allowed to be mutated and since there is no reason to use `var T` when a `T` would have sufficed this allows us to use `func` for a very important class of functions that are

Potential users

2023-08-17 Thread Hobbyman
I forgot -besides companies- the non-commercial organisations which can also potentially be consumers of Nim-programs, like schools, universities, municipalities, hospitals etc.

Potential users

2023-08-17 Thread Hobbyman
Potential users Hi all, I want to philosofize a bit about Nim and its potential users, use-cases, and user-growth. First of all I want to distinguish some groups important to Nim. I see 5 (+1) major groups being: Nim's core-developpers, lib-developpers (=semi-users; hybrids of developpers and u

What is the best way to learn nim for someone who is fluent with python

2023-08-17 Thread walkr
I'd like to point out is also a pretty good resource for beginners since the examples are short and well organized, and thus you can quickly get a feel for the language.