The fate of Nim Editors

2021-10-19 Thread didlybom
You don’t mention Teo of the most important topics: navigation and refactoring. As @juancarlospaco said I don’t think that statistical completion helps for these while a good la gauge server does.

Continuous use of parseJson causes software crash

2021-10-19 Thread jasonfi
Your diagnosis of the problem doesn't sound right. Why would your program crash just because of a slow component? What you should do is mock your calls to parseJson so that it always returns a static JsonNode containing test values. This would confirm that parsing JSON is the cause if the crashe

Nim 1.6 is out!!

2021-10-19 Thread oyster
nimble does not fit nim 1.6 yet. the [unhandled exception: key not found: url [KeyError]](https://github.com/nim-lang/nimble/issues/950) lives

Issues trying to use pattern matching

2021-10-19 Thread miran
> I was trying to make this OCaml example in Nim: If it doesn't have to be the same as OCaml examle, you can use the [built-in sum proc](https://nim-lang.github.io/Nim/math.html#sum,openArray%5BT%5D). And if you want to do it yourself, I would do it the same way the above function is [implemen

Continuous use of parseJson causes software crash

2021-10-19 Thread nnahito
I'm using a library called wNim to create GUI software. It is a chat client in Nim that uses WebSocket. The server sends the data in JSON. So I am using parseJson to parse JSON. | However, when I run the software, the software suddenly crashes. At first I couldn't figure out the cause

strange-like behavior in openArray in multiple types

2021-10-19 Thread ElegantBeef
I'd argue it's a bug, but I think it's designed this way intentionally. It really kills composabillity and sadly the new `iterable` falls into the same design flaw.

strange-like behavior in openArray in multiple types

2021-10-19 Thread puruneko
to @demotomohiro I see already there is the same issue. Is it correct to consider that this problem is a bug? to @ynfle great! This is what I needed. thank you.

The fate of Nim Editors

2021-10-19 Thread aEverr
usually the completion plugins themselves implement "statistical completion", usually called buffer complete or something like that for vim (at least it was called that in nvim-compe).

Reporting security issues

2021-10-19 Thread riceman
Hey there, I didn't see any information on the nim-lang.org site related to security. Is secur...@nim-lang.org the correct place to report security vulnerabilities? I found the address in IRC logs and emailed about disclosing some issues, but am now realizing that email might not be correct. C

Nim 1.6 is out!!

2021-10-19 Thread timothee
Nice to see that hackernews, reddit posts generate discussions that go beyond the usual suspects of syntax and GC :) * * / *

Nim 1.6 is out!!

2021-10-19 Thread dom96
Ahh, cool. Glad it works! I submitted to track :)

Does Nim support name for anonymous procedures?

2021-10-19 Thread geekrelief
Yeah, I was trying to do something with macros, but @shirleyquirk nailed it!

Does Nim support name for anonymous procedures?

2021-10-19 Thread ElegantBeef
Here's the simplest way to get this odd behaviour: type Callback = proc() template namedCallback(name, body: untyped): CallBack = proc name() = body name var callbacks: seq[Callback] callbacks.add: namedCallback(hello): echo "Hello"

Nim 1.6 is out!!

2021-10-19 Thread Clavismax
"Does the C:\Users\rtdie\\.nimble directory exist when it's trying to copy these?" A perfect Hint, Thank you! First I created a Dir C:\Users\rtdie\\.nimble\bin then I Exclude C:\Users\rtdie\AppData\Local\Temp\ for Defender. After that I run choosenim stable --firstinstall and it worked without

Does Nim support name for anonymous procedures?

2021-10-19 Thread gcao
Your solution is pretty much what I was looking for. Thanks a lot!

Issues trying to use pattern matching

2021-10-19 Thread ElegantBeef
For the cheapest cost slices you want to use `toOpenArray`, this gives you a view into the collection and as such is cheaper than slicing the collection and making a new collection.

Does Nim support name for anonymous procedures?

2021-10-19 Thread gcao
You & geekrelief's solutions are a little clumsy. My request is that the name should be associated with the proc itself so that the stacktrace will show descriptive name.

The fate of Nim Editors

2021-10-19 Thread tsojtsoj
Is there some kind of extension for statistical completion for vscode? I did a quick google search and I didn't find anything. There are some things that are quite useful (jump-to-definition, find all usages, safe refactoring), that need a language server as far as I know. I am not sure how som

Does Nim support name for anonymous procedures?

2021-10-19 Thread ynfle
I'd recommend using `seq[(proc(x, y: int): int, string)]` instead. It's a lot more compact and easier to maintain.

Issues trying to use pattern matching

2021-10-19 Thread ynfle
Yes, because it copies the values.

Does Nim support name for anonymous procedures?

2021-10-19 Thread shirleyquirk
How about: import macros macro named(name:static string,f:proc):untyped = f.expectKind(nnkLambda) result = nnkProcDef.newNimNode() f.copyChildrenTo(result) let id = ident(name) result[0] = id result = quote do: block: `res

Issues trying to use pattern matching

2021-10-19 Thread RainbowAsteroids
> splitting up a seq into (head, tail) sections is slow Does this include using list splices too? func sum(arr: seq[int]): int = if arr == @[]: 0 else: arr[0] + (sum arr[1..^1]) Run

Does Nim support name for anonymous procedures?

2021-10-19 Thread demotomohiro
Anonymous procedures exists for writing a simple code when passing a small simple proc to other proc. If your proc is not small and sometimes requires debug, I think you should use a named procedure. Is there reason you need to use anonymous procedure instead of named procedure?

Does Nim support name for anonymous procedures?

2021-10-19 Thread geekrelief
You could do something like this: import macros, std / genasts, strformat template named(name: string) {.pragma.} var procs: seq[proc(a, b: int): int] var procNames: seq[string] macro addCallback(cb: untyped): untyped = result = genAst(cb, name =

Does Nim support name for anonymous procedures?

2021-10-19 Thread gcao
Here is an example: var callbacks: seq[proc()] callbacks.add proc() = discard callbacks.add proc() = raise for callback in callbacks: callback() Run If I don't want to open the file to se

Typescript as compilation target

2021-10-19 Thread scobra
I have used nim and svelte together successfully by wrapping the immer library to handle reactivity. Unfortunately I have lost the code now but I used a macro or template to wrap the produce function quite nicely.

Does Nim support name for anonymous procedures?

2021-10-19 Thread ynfle
You can either define the proc separately, or assign it to a variable

Does Nim support name for anonymous procedures?

2021-10-19 Thread juancarlospaco
"Named anonymous procedures" feels kinda weird feature...

Does Nim support name for anonymous procedures?

2021-10-19 Thread gcao
Agree with the definition. What I want to do is to give a callback a name. It seems it's not working. callbacks.add proc doSomething() = ... Run

The fate of Nim Editors

2021-10-19 Thread treeform
I think Nim is doing fine. Here is why: # Completion I think semantic completion (where is code is parsed) is dead. I been using statistical completion for a decade. Its been put into overdrive with modern AI stuff like [tabnine](https://www.tabnine.com/). I don't see how semantic completion

The fate of Nim Editors

2021-10-19 Thread juancarlospaco
I tried Debugging from inside VSCode and it works

Does Nim support name for anonymous procedures?

2021-10-19 Thread Yardanico
I don't quite understand the reason why you would want to do that - how would it help with debugging?

Nim 1.6 is out!!

2021-10-19 Thread treeform
Thank you to everyone who worked on this! Great stuff!

Does Nim support name for anonymous procedures?

2021-10-19 Thread gcao
Can I give a name to an anonymous procedure for debugging purpose? callbacks.add proc() = ... Run

Does Nim support name for anonymous procedures?

2021-10-19 Thread DavideGalilei
Of course, it can be achieved like this: var procs: seq[proc(a, b: int): int] procs.add(proc(x, y: int): int = x + y) procs.add(proc(a, z: int): int = a - z) echo procs[1](5, 2) # 3 Run You can try it on [Nim Playground](https://play.nim-lang.org/

Does Nim support name for anonymous procedures?

2021-10-19 Thread juancarlospaco
A procedure without a name is an anonymous procedure.

The fate of Nim Editors

2021-10-19 Thread haxscramper
Why not? It is uses nimsuggest anyway, so it does not matter really. Maybe author wanted to try out something new, labeling it as a NIH syndrome is kind of strange

genAst

2021-10-19 Thread shirleyquirk
aha! thanks! i thought i was doing something wrong with the captures or something. so that means you could surround it in a `(block:)` result.add (block:genAst(i, x, y, op): block: var a{.inject.} = x[i] b{.inject.} = y[i] op

genAst

2021-10-19 Thread geekrelief
Actually, I forgot you can use `do:` too. result.add genAst(i, x, y, op) do: Run

genAst

2021-10-19 Thread geekrelief
Assign the result of `genAst` to a variable and add it to `result`. I've used it like this: macro tm_add_or_remove_impl(reg: ptr tm_api_registry_api, load: bool, impls: varargs[typed]): untyped = doAssert(impls.len > 0, "Missing impls") result = newNimNode(nnkStmtList)

The fate of Nim Editors

2021-10-19 Thread haxscramper
https://github.com/nim-lang/RFCs/issues/300

The fate of Nim Editors

2021-10-19 Thread haxscramper
last commit 6 days ago

The fate of Nim Editors

2021-10-19 Thread juancarlospaco
* Last commit 6 days ago * Last commit 6 hours ago

genAst

2021-10-19 Thread geekrelief
This works: import macros import std/genasts macro applyThem(x,y: tuple; op: untyped): untyped = result = nnkTupleConstr.newNimNode for i in 0 ..< x.getTypeImpl.len: let ast = genAst(i, x, y, op): block: var a{.inje

genAst

2021-10-19 Thread shirleyquirk
I'm familiar with the pitfalls of `quote do:` and excited about the new `genAst` which "can be used as a replacement" I thought I'd try it out on the last macro i wrote: import macros macro applyThem(x,y: tuple; op: untyped): untyped = result = nnkTupleConstr.newNimN

Nim 1.6 is out!!

2021-10-19 Thread Yardanico
No -

Nim 1.6 is out!!

2021-10-19 Thread xigoi
Looks like it was changed to 1.7 a short time ago.

Nim 1.6 is out!!

2021-10-19 Thread AMoura
Can you also add links to ARM32 and others binaries version because it's a pain for me to build on my RasPi2 each new version. I don't think I'm the only one interested. Thanks

Nim 1.6 is out!!

2021-10-19 Thread oyster
is it still 1.5.1 on ?

Nim 1.6 is out!!

2021-10-19 Thread dom96
So I see you're saying "error messages" but all I see are warnings. Nim was installed but the DLLs seem to have failed. Does the `C:Usersrtdie.nimble` directory exist when it's trying to copy these? Maybe that's the issue? Workaround could be creating it (definitely a bug that we should fix if t

VarArgs Broke on latest nim.

2021-10-19 Thread Clyybber
Regression of

Nim 1.6 is out!!

2021-10-19 Thread juancarlospaco
Some random feedback based on observations: * People like a lot the line "15 new stdlib modules" by far the one that gets more attention. * Also the cadence of ~1 major release per year looks good. * TIOBE index may not be the best ranking to compare against (?). * Links to different proj

Nim 1.6 is out!!

2021-10-19 Thread xigoi
Who is maintaining the Termux package? When is it going to be updated?

VarArgs Broke on latest nim.

2021-10-19 Thread solo989
This is broken on latest nim. The argument is passed directly into b. import macros macro hi(a : untyped, b : varargs[untyped]) : untyped = echo treeRepr a hi: echo "hmm" Run This would break a lot of my code if I upgraded.

Nim 1.6 is out!!

2021-10-19 Thread Lennart
Thanks for answering. I remember seeing the benchmark in your NimConf presentation. Im assuming the new numbers are slightly better, depending on circumstances. What can we expect from ORC in terms of pause times? afaik, arc adds no noticeable pause times because it simply deallocates memory wh

Nim 1.6 is out!!

2021-10-19 Thread Lennart
Im on windows 10 so i cant say for certain. but im not having issues. and using choosenim am getting the pre-compiled version. I installed choosenim by getting the zip, extracting it, and running the runme.bar file without adming mode. then, open powershell and run $env:Path = [S

Nim 1.6 is out!!

2021-10-19 Thread Clavismax
"I would try again using choosenim without the admin mode and using the runme.bat mentioned in install instructions for choosenim." This makes no difference. Still got the same Errors

Nim 1.6 is out!!

2021-10-19 Thread Araq
> I thought that ORC had some performance issues that made it hard to reason > using. How has that changed since 1.4? The performance improved but the reason why I advice `--gc:orc` now is that it's the complete solution, all your dependencies will work with it (assuming the dep has been ported

strange-like behavior in openArray in multiple types

2021-10-19 Thread ynfle
Try `varargs[bool]` and then you won't need `or`

Nim 1.6 is out!!

2021-10-19 Thread Lennart
I thought that ORC had some performance issues that made it hard to reason using. How has that changed since 1.4? How does orc perform relative to refc, markAndSweep and arc? roughly speaking I watched the youtube video from NimConf but i assume that is outdated

Nim 1.6 is out!!

2021-10-19 Thread pietroppeter
assuming it is still relevant, it might useful to repost here the official `nim.cfg` @Araq's recommendation from [RC1 discussion](https://forum.nim-lang.org/t/8404#54227) (should this be added to the release notes?): --experimental:strictEffects # Turn on the new refined effe

Nim 1.6 is out!!

2021-10-19 Thread pietroppeter
I would try again using choosenim without the admin mode and using the runme.bat mentioned in install instructions for choosenim.

strange-like behavior in openArray in multiple types

2021-10-19 Thread demotomohiro
Related issue:

Nim 1.6 is out!!

2021-10-19 Thread miran
> If i click on and then on "Manual > installation" I get Nim: 1.4.8 Please retry now. It should point to Nim 1.6.0 now. Sorry for the inconvenience.

Nim 1.6 is out!!

2021-10-19 Thread Clavismax
"You should use the official Windows builds." I have no idea what you mean by that. Do you mean the manual installation? If i click on and then on "Manual installation" I get Nim: 1.4.8 Maybe a few more words to explain me that, could help me a lot

Nim 1.6 is out!!

2021-10-19 Thread Araq
> I tried unsuccessfully today to install Nim version 1.6 "cleanly" on Windows > 11. There was a hail of error messages. You should use the official Windows builds.

strange-like behavior in openArray in multiple types

2021-10-19 Thread puruneko
when `openArray` in multiple types is set in function's argument, compile error is occurred. proc f1(b: openArray[bool]) = echo b f1(@[true]) #fine f1([true]) #fine proc f2(b: bool or openArray[bool]) = echo b f2(true) #fine f2(@[tru

Issues trying to use pattern matching

2021-10-19 Thread Araq
Nim is not Ocaml and splitting up a seq into (head, tail) sections is slow and not idiomatic code. Instead use: func sum(arr: openarray[int]): int = result = 0 for a in arr: result += a echo sum([1, 2, 3, 4]) Run For this case. Pattern matching can

Nim 1.6 is out!!

2021-10-19 Thread pietroppeter
🥳💖 nim --verbosity:0 --eval:"let msg = \"hurrah for Nim 1.6 and thanks everyone!!!\"; for i in 0 ..< msg.len: echo msg[0 .. i]" Run

Nim 1.6 is out!!

2021-10-19 Thread Clavismax
Hi buddies, I tried unsuccessfully today to install Nim version 1.6 "cleanly" on Windows 11. There was a hail of error messages. I'm very happy if someone helps me to get over it. I did the following on a virgin Windows 11 system (running under VirtualBox): * Download choosenim-0.8.2_windows

Nim 1.6 is out!!

2021-10-19 Thread miran
We are proud to announce that Nim 1.6 has been released! For more details, check the release article:

Issues trying to use pattern matching

2021-10-19 Thread PMunch
A little something like this works: import fusion/matching {.experimental: "caseStmtMacros".} func sum(arr: seq[int]): int = case arr: of [@head, all @tail]: head + (sum tail) else: 0 echo (sum @[1, 2, 3, 4]) Run