Concatenation of seq and array?

2021-04-21 Thread Araq
It's ok, I'm sorry too, it's just me having had a bad day and misunderstanding everybody.

nim-1.4.6_x64.zip/bin/nimble.exe reports as Trojan:Win32/Zpevdo.B

2021-04-21 Thread cheve
My work computer just deleted finish.exe and nimsuggest.exe from version 1.4.6. At this moment I'am using those files from version 1.4.4..

How to set discard or empty statement to a default value of untyped parameter?

2021-04-21 Thread demotomohiro
> the default parameter expects an expression, (at least judging from the error > message), which by definition cannot be void. when used as a statement in the > body of your template, it has to be void. the only things that can both are > {.discardable.} Default value is specified to a paramet

Finally ported the rubberband router from Ruby to Nim

2021-04-21 Thread drifter
Curious to know if you were familiar with www.crystal-lang.org which is very much ruby-like in syntax, but typed and compiled. Recently reached v.1.0

Concatenation of seq and array?

2021-04-21 Thread PMunch
If it came across as if I thought that the traps where designed into Nim I must say I'm sorry, that was never my intent. But it was very much the case that someone ported code from another language to Nim and got poorer performance than they expected (whether that expectation was justified or no

How to set discard or empty statement to a default value of untyped parameter?

2021-04-21 Thread shirleyquirk
i think you've cracked it with the dummy proc, that's really clever. here's my reasoning: the default parameter expects an expression, (at least judging from the error message), which by definition cannot be void. when used as a statement in the body of your template, it has to be void. the onl

How to set discard or empty statement to a default value of untyped parameter?

2021-04-21 Thread ElegantBeef
The discard part of the [manual](https://nim-lang.org/docs/manual.html#statements-and-expressions-discard-statement) has an example you can follow.

How to set discard or empty statement to a default value of untyped parameter?

2021-04-21 Thread dawkot
proc bar(a: int): bool = a == 0 proc cleanup = discard template foo(arg: int; body: untyped, onErr: untyped = void): untyped = if bar(arg): body else: when compiles((onErr)): # :) cleanup() onErr foo(0): echo "Success"

Installation and configuration of the Nim language

2021-04-21 Thread ynfle
Check out which is a guide for programmers coming from other languages

Installation and configuration of the Nim language

2021-04-21 Thread Woland
Thanks - good resources. I am coming from Python/Perl/Java direction. I also have interest in FP - Scala, Clojure and some minimal Haskell. In college I did C++ and recently tried to learn Rust - very interesting challenge.

4th Nim online meetup

2021-04-21 Thread dom96
> please use or some similar service. Here is a link that will work for everyone, no matter their timezone:

Need help implementing bind for C for webview.h

2021-04-21 Thread shirleyquirk
started in embedded C. my C++ is a work in progress; unfortunately I found this other, nicer proglang to use and it's sort of hampered my development.

How to set discard or empty statement to a default value of untyped parameter?

2021-04-21 Thread demotomohiro
Could you show me example code? Just writing `discard` with `{.discardable.}` like `template foo(arg: int; body: untyped, onErr: untyped = discard {.discardable.}): untyped =` is compile error.

Concatenation of seq and array?

2021-04-21 Thread Stefan_Salewski
> You asked for a link to this to be included, No, I did not ask myself directly. I never value my own work that high, and as Miran did most of the Nim webpage work it would be like just "forgetten" if I had asked. But other people asked for inclusion in IRC and mentioned it in a positive way

How to set discard or empty statement to a default value of untyped parameter?

2021-04-21 Thread juancarlospaco
discard + discardable

How to set discard or empty statement to a default value of untyped parameter?

2021-04-21 Thread demotomohiro
I have templates with untyped parameters like this: proc bar(a: int): bool = a == 0 proc cleanup = discard template foo(arg: int; body, onErr: untyped): untyped = if bar(arg): body else: cleanup() onErr foo(0): echo "Succ

4th Nim online meetup

2021-04-21 Thread federico3
/ is also handy

Installation and configuration of the Nim language

2021-04-21 Thread Woland
Thanks - I noticed issues with McAfee before. Do I lose a lot this stage (about to start on "Nim in Action" book) by using 1.4.4?

Installation and configuration of the Nim language

2021-04-21 Thread Gekkonier
I guess not really. Nim in Action was written with a much older version in mind. It's a good idea to follow it, but having these at handy:

Need help implementing bind for C for webview.h

2021-04-21 Thread francisl
Thanks, merged it and its working perfectly. where did you get the skills needed? Did you previously work in C/C++?

Concatenation of seq and array?

2021-04-21 Thread bpr
> refusing listing my kids book on the "Learning Nim" page (someone > explicietely asked in IRC to add it) Off topic: That's a specific and actionable comment that deserves a reply. You asked for a link to this to be included, and it wasn't? Was there a reason given? I googled this doc and it l

Concatenation of seq and array?

2021-04-21 Thread xigoi
Just be careful that `add` will modify the original seq.

Need help implementing bind for C for webview.h

2021-04-21 Thread shirleyquirk
i made another PR to silence the linking issue on osx if that helps but maybe I should just try to work on webview myself if i want it so much lol

Need help implementing bind for C for webview.h

2021-04-21 Thread shirleyquirk
yes! splitting webview.h properly into .cpp and .h is the real solution to avoid all the multiple definitions

Need help implementing bind for C for webview.h

2021-04-21 Thread francisl
Anyway, now I have linker issue, my knowledge of compiled language can't make me far enough. I was able to get going with wails in 10 minutes last night, so I'll use it to my experiment for the moment. So I'll declare forfeit for the time being, and come back to it when I have more time learn.

Need help implementing bind for C for webview.h

2021-04-21 Thread francisl
Maybe that changed, but gtk was never a really good cross platform library. Look and feel, breaking keyboard defaults etc. The original webkit.h already handle the use of the right windowing depending of the platform : You can see

Concatenation of seq and array?

2021-04-21 Thread Stefan_Salewski
Funny fact is that I just discovered that we have to add elements of an array to a seq. So I should be able to just write lcuts = v.vertex.neighbors - (lcuts.add([u.vertex, w.vertex])) Run whi

Installation and configuration of the Nim language

2021-04-21 Thread Gekkonier
Hi! I had the same hesitations to use 1.4.6, but it's false flags:

Concatenation of seq and array?

2021-04-21 Thread bpr
> There can be a tension between performance and readability, yes, and in fact > Nim has an underused feature called "TR macros" to compensate for that. One possible reason TR macros are underused is that they are in the experimental section of the manual. You're right though, I've recently star

Need help implementing bind for C for webview.h

2021-04-21 Thread drkameleon
Coincidentally, I've been working on something similar lately in a PR. Have a look if you want:

Preferred mingw version to build nim on Windows

2021-04-21 Thread m33
ok thanks

Concatenation of seq and array?

2021-04-21 Thread Stefan_Salewski
> but you're going to have to forgive In am really not that sensible. And as for many of us English is a foreign language I can tolerate some unfriendly formulations, I use unfortunately some myself sometimes without real intent. And I really do not expect on each stupid question or remark a ex

Multi-threaded features needed for Server

2021-04-21 Thread filcuc
Injecting in this thread for giving my 2 cents on the threading issues with NimQml. Right now i'm still not haved properly found a way to properly allow a user to give a reference to a QObject in another thread (i would like in some sort of weak_ptr) and allow the execution on a lambda in a diff

Installation and configuration of the Nim language

2021-04-21 Thread Woland
Thanks - I had problem with "download 64bit (finish.exe) installer" way. At least with 1.4.6 version. The The anti-virus program (McAfee) flags several binaries in that zip file as infected and blocks the installation. Tried chocolatey and it fails to install Nim 1.4.6 because the required Mingw

Concatenation of seq and array?

2021-04-21 Thread Araq
> This is just a real-life example of someone porting code from one language to > another and getting poorer performance than they expected, shouldn't that be > something we take seriously if we want more people to consider Nim? This is not what happened as Ruby does none of these optimizations

Preferred mingw version to build nim on Windows

2021-04-21 Thread Araq
The preferred version is

4th Nim online meetup

2021-04-21 Thread miran
Two weeks after the previous meetup, it is time for another one! The meetup will take place this **Friday (April 23rd) at 3pm UTC**. That is 5pm in central Europe, and to get the correct time in your timezone, please use or some similar service. This time Araq plans to talk le

Installation and configuration of the Nim language

2021-04-21 Thread Araq
Thanks, we're fixing the website.

Installation and configuration of the Nim language

2021-04-21 Thread Gekkonier
I thought it might be, because of: "There are a number of other dependencies that you may need to install in order to use Nim." That's why I've done it, just in case.

Concatenation of seq and array?

2021-04-21 Thread Zoom
It's not clear because copying in `x = x ...` doesn't make any sense, as long as we're not redefining a variable! If Nim was move-by-default it would be clear that one _doesn 't_ want a copy, but Nim isn't so it's just a confusing line when the type has any kind of complexity (not just a number)

Concatenation of seq and array?

2021-04-21 Thread Gekkonier
"doesn't make any sense,..." That's the whole point.

Concatenation of seq and array?

2021-04-21 Thread shirleyquirk
at the risk of speaking out of turn-- I'm sure everyone appreciates you and your years of contributions, @Stefan_Salewski, but you're going to have to forgive Miran at some point. holding a grudge is more toxic to you than to the other party. When someone is dismissive or blunt, it can be hard

Concatenation of seq and array?

2021-04-21 Thread Gekkonier
I think in such cases, where you explicitly say x = x + y there should be no auto-magic. It's clear that you want to copy at that position. If you want to use a list and append, you should write it that way. I didn't find the whole thread uncivilized. Everyone has an opinion, that's it.

Concatenation of seq and array?

2021-04-21 Thread Zoom
The problem with that is Hyrum's Law. As soon as you implement this optimization there will be lots of people relying on a feature which is essentially a bit of questionable code. In my opinion, this is why it's good to have an extensive standard library with concise API, which includes such fu

Installation and configuration of the Nim language

2021-04-21 Thread Araq
> Then I downloaded the dll's from the section "Other dependencies" and copied > all dlls into yourhomedir/nim-1.4.6_x64/bin directory. That's not required at all.

Concatenation of seq and array?

2021-04-21 Thread PMunch
I think we read this topic in two completely different ways. I read it more as a "look at this optimisation opportunity I found" and less of a "Rabble rabble, Nim is stupid for not optimising this, rabble rabble". This is just a real-life example of someone porting code from one language to anot

Preferred mingw version to build nim on Windows

2021-04-21 Thread m33
Hi, looking at the nightlies build scripts, I noticed that a particular version of nimgw is selected. * The nim-lang website [gives this mingw64.7z:](https://nim-lang.org/download/mingw64.7z) v9.2.0 it seems it is the latest stable build * The build script [gives this deps.sh#L85 :](https

Need help implementing bind for C for webview.h

2021-04-21 Thread JPLRouge
I removed the option inject css and set_font, this is done directly in the html page. on the other hand i process json in Nim main program. The Json aspect is only useful to me to communicate data, so what Nim does it well ... and not in C as in your example. (Afterwards, it's a matter of taste,

Concatenation of seq and array?

2021-04-21 Thread Araq
@foldl counter example: `for (int i = 0; i < strlen(s); i++)`

Concatenation of seq and array?

2021-04-21 Thread Araq
> With replies like from Miram and Araq sometimes one may be tempted to stop > writing in this forum, ... Alternatively you can always phrase your posts in a more civilized manner. For example, by not turning your individual subjective experiences into objective "performance pitfalls"...

Installation and configuration of the Nim language

2021-04-21 Thread Gekkonier
I installed it this way: here I downloaded first the I extracted that whole zip into a directory (yourhomedir/nim-1.4.6_x64/) Then I downloaded the dll's from the section "Other dependencies" and copied

Concatenation of seq and array?

2021-04-21 Thread foldl
Haha. As far as I know, we can't do such poor things in C.

Concatenation of seq and array?

2021-04-21 Thread cblake
I was literally editing a "what about TR macros" reply.. I feel like sprinkling some TR magic on this particular performance footgun has come up before. Not sure if there are good reasons not to. It is 100% true that no compiler can prevent many (most?) performance mistakes. This is one big rea

Installation and configuration of the Nim language

2021-04-21 Thread ynfle
Choosenim is very straight forward and allows for switching between versions well

Concatenation of seq and array?

2021-04-21 Thread Araq
There can be a tension between performance and readability, yes, and in fact Nim has an underused feature called "TR macros" to compensate for that. However, there is nothing "obvious" about "I demand that the compiler (which I didn't pay any money for btw...) optimizes the big O behavior of my

Concatenation of seq and array?

2021-04-21 Thread Zoom
For readability we need `extend` which would work with iterators and expand `lcuts.extend([u.vertex, w.vertex])` to a loop of for x in [u.vertex, w.vertex]: lcuts.add(x) Run which any decent compiler should unroll and optimize the array away.

Concatenation of seq and array?

2021-04-21 Thread Stefan_Salewski
> but if you look at his original code Thanks for your moral support :-) With replies like from Miram and Araq sometimes one may be tempted to stop writing in this forum, maybe subscribing to stackoverflow instead.

How to access n theJS backend Bootstrap's "modal" method?

2021-04-21 Thread geotre
Try this if you want jQuery to do the selection: proc modal(query: cstring, options: cstring = "") {.importjs: "$(#).modal(#)".} "#exampleModal".modal("show") Run JS output: $("#exampleModal").modal("show"); Run

Concatenation of seq and array?

2021-04-21 Thread Zoom
Perhaps the compiler could track situations like var x x = x & y Run where T of y is T of x[T] or y is a view of a container [T] and replace the second line with appropriate `x.add(y)` or `x.extend(y)`, but do we really want this complex behaviour which encourage

Concatenation of seq and array?

2021-04-21 Thread PMunch
Of course writing `s = s & 'x'` is a silly mistake, but if you look at his original code snippet `lcuts = v.vertex.neighbors - (lcuts & @[u.vertex, w.vertex])` it's not as obvious. And expanding that to more efficient code lcuts.add u.vertex lcuts.add w.vertex lcuts = v.ver

Finally ported the rubberband router from Ruby to Nim

2021-04-21 Thread Stefan_Salewski
Yes, it is all explained in the thesis, and the basic ideas are simple. The implementation not, they had a 14k lines of code C implementation they said, never released to the public, and full of bugs I guess due to C. Around 2010 someone of the gEDA project, I think it was Mr Anthony Blake, trie

Finally ported the rubberband router from Ruby to Nim

2021-04-21 Thread PMunch
I see, very interesting. Still not entirely sure how it decides which side of the terminal to pass (thinking especially of the pink path going outside the 8 terminal to accommodate the blue). It seems like there is some extra weight calculation in the routing algorithm (some of those doesn't see

Concatenation of seq and array?

2021-04-21 Thread Araq
Foundations of math are not "bad design". What is childish is to write code like `s = s & 'x'` (i.e. not knowing about `.add` or `&=`) after years of programming, in Nim and other languages.

Concatenation of seq and array?

2021-04-21 Thread PMunch
I seem to remember you yourself saying that Nim shouldn't copy bad design just because everyone else does it that way. Obviously all languages have some performance traps, but pointing that out as a response to a concrete example just seems a bit childish. This might be hard to fix though, as t

Finally ported the rubberband router from Ruby to Nim

2021-04-21 Thread Stefan_Salewski
> Does he go into N layer PCBs, or is this constricted to just two layer? The thesis describes routing of multi layer boards. Long traces are split into subparts, which than are designed to different layers by a greedy opimizeation algorithm, and the shorter traces are than rubberband routed and

Need help implementing bind for C for webview.h

2021-04-21 Thread JPLRouge
Hello, interesting your return. I had two goals the first was to make a real connection with webview.h and how to work it as well as the communication with Nim. It taught me a lot, on the other hand you must have seen that I only took into account Linux and I took the option of having three sepa

Simple RPC, call remote Nim functions as if its local, experimenting...

2021-04-21 Thread alexeypetrushin
> As a suggestion, you could try using the ZMQ library Yes, like it, but I would like to avoid dependencies, and this case is relatively simple. Added simple TCP based messaging, without the need to handle connection/reconnection (I want to be able to call another hosts, so used TCP instead of

Finally ported the rubberband router from Ruby to Nim

2021-04-21 Thread PMunch
Yeah I'm familiar with the problem of PCB routing, and I've done a fair bit with Delauney triangulation. I just wasn't sure what I was looking at with the different colours and black lines. That thesis looks interesting, might have to give that a read sometime, the vias certainly add to the comp

Finally ported the rubberband router from Ruby to Nim

2021-04-21 Thread Stefan_Salewski
If someone really should be interested in the background of rubberband auto-routing of printed circuits boards, you can find more details in the PhD thesis of Tal Dayan from 1997: [https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.8.6828&rep=rep1&type=pdf](https://citeseerx.ist.psu.edu/v

How to access n theJS backend Bootstrap's "modal" method?

2021-04-21 Thread halloleo
Cool idea! :-) I tried > proc modal(obj: Element, options = "") {.importjs: "$$(#).modal(#)".} but for the Nim code > var modalDialog = document.querySelector("#exampleModal") modal(modalDialog, > "show") the generated JS code is still: > var modalDialog_24645128 = document.querySelector("#ex

nim-1.4.6_x64.zip/bin/nimble.exe reports as Trojan:Win32/Zpevdo.B

2021-04-21 Thread m33
yup, same result on hybrid-analysis.

nim-1.4.6_x64.zip/bin/nimble.exe reports as Trojan:Win32/Zpevdo.B

2021-04-21 Thread m33
Actually it is a good thing to have raised this issue. It would be preferable to avoid false positive at least for well known antivirus vendors. In corporate environment it would at the minimum block the binary, raise an alert on the av management console and so on. For the hobbyist, it could b

Finally ported the rubberband router from Ruby to Nim

2021-04-21 Thread PMunch
This is really cool, both the project and your experience in porting it to Nim. I'm not exactly sure what I'm looking at for those traces though.