Would macros work to parse js and create equivalent nim code?

2021-04-29 Thread xioren
function(a,b){var c=a[0];a[0]=a[b%a.length];a[b%a.length]=c} Run vvv proc someProc[T](a: var seq[T], b: Natural) = var c = a[0] a[0] = a[b mod a.len] a[b mod a.len] = c Run Is that possible?

Let's Make Async Great Again!

2021-04-29 Thread hugosenario
@alexeypetrushin did you researched for effect handlers? Good: remove de async pollution of procedural codes parts Bad: now you have not only blue/red function you all color spectrum Not sure how much far from [continuations](https://github.com/weavers-guild/weave-io/tree/master/research#contin

Why learn NIM

2021-04-29 Thread Araq
> Nor if we compare multimethods, which are fundamental to Julia, facing > deprecation in Nim. Why is that a downside? In my mind Julia's multimethods are an inferior mechanism than overloading.

In Nimpy how to call methods on Python objects? (Example sys.path.insert)

2021-04-29 Thread chrisheller
Try discard sys.path.insert(0, ".") Run

In Nimpy how to call methods on Python objects? (Example sys.path.insert)

2021-04-29 Thread z_____________
It works when you add `discard`: import nimpy let sys = pyImport("sys") discard sys.path.insert(0, ".") Run The problem with the original code is that Nim does not allow return values to be implicitly discarded.

Nim Standard Library - How expansive should it be?

2021-04-29 Thread GamzWithJamz
I don't think that Nimble packages absolve the Nim community of maintaining more complicated packages, if they are seen as fundamental (i.e. json).

Nim Standard Library - How expansive should it be?

2021-04-29 Thread GamzWithJamz
I actually like the idea of a strong and simple stdlib, with community packages supporting it. Defining strong and simple is the hard part though... I don't think Nim needs to go to the [is-odd](https://www.npmjs.com/package/is-odd) level like JavaScript, but I think Nimble is moving in the rig

In Nimpy how to call methods on Python objects? (Example sys.path.insert)

2021-04-29 Thread halloleo
I stumbled over nimpy and I think it is a fantastic project! I'm now trying to use nimpy to call a locally given python module in Nim. The first thing I want to do is more basic: Modifying Python's `sys.path`. I though of doing this via the Python object in Nim. I have: import nim

Why learn NIM

2021-04-29 Thread halloleo
Learn Nim when you look for a modern, future-oriented, growing language **which uses indentation as block delimiter**. - There are not many such languages. Macros are a great bonus for DSLs! (You can try the also indented [Converge](https://convergepl.org/) for DSLs as well, but that community i

Nim Standard Library - How expansive should it be?

2021-04-29 Thread Zoom
I'm not a contributor to Nim's std so I can't properly estimate the maintenance burden of expanding, but from the user point of view, more tools readily available is better. What I'm _especially_ for, is the uniformity of the API. I think in the long run this is far more important than a sheer

Why learn NIM

2021-04-29 Thread bpr
Yeah, I'm aware ;-) Unfortunately, if you're going to do an honest comparison of nim secret to Julia REPL Nim doesn't come out looking good. Nor if we compare [multimethods](https://github.com/nim-lang/rfcs/issues/65), which are fundamental to Julia, facing deprecation in Nim. Anyways @gemath,

Nim Standard Library - How expansive should it be?

2021-04-29 Thread cblake
For what it's worth, Nim's stdlib has several uncommon things in it, e.g. `critbits`, `rationals`, `pegs`, and probably about 5 other things I'm neglecting since this is off the top of my head. I'm sure Go/other stdlibs also have things Nim does not have, but I rarely see a "full accounting" of

Nim Standard Library - How expansive should it be?

2021-04-29 Thread zulu
I think one of Go's main selling points is its strong stdlib. Libraries and frameworks sort of work when you have a larger ecosystem but picking a webserver that will be abandoned when one has to move from Nim to a language that is in more demand is not nice. Well I understand that the manpower

Why learn NIM

2021-04-29 Thread gemath
> Any benefits of learning nim over langs like Rust, C, Cpp, Typescript? In case you are still reading this monster-thread: here are some things that set the language apart from others. Wether they look beneficial to you is a different question. 1) Nim tries to solve as many problems as pos

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

2021-04-29 Thread zulu
I fully agree with this sentiment.It actually really surprises me these AV vendors are as large as they are while selling what is basically homeopathy. Nonetheless this is a serious issue on Windows platform and as much as I would like to just use OSX or Linux I can't.

Nim Standard Library - How expansive should it be?

2021-04-29 Thread Araq
I still like the "batteries included" idea. However, we have been burnt by that quite a bit, old libraries must be kept but are outdated, better solutions are available as Nimble packages... The jury is still out on how to evolve the stdlib, see also

Why learn NIM

2021-04-29 Thread linwaytin
Wow I didn't know `nim secret`. What is this? I cannot find doc on this function. It is really a secret lol.

Variables alignment

2021-04-29 Thread b3liever
Similarly it would be nice if `alognedAlloc`, `alignedDealloc` where exported...

Variables alignment

2021-04-29 Thread shirleyquirk
> I am curious as to why you need aligned variables * sse variables need to be aligned to 16 bytes * on the esp32 you can store data in IRAM but only if its 32-bit aligned * you might want to make a struct cache-line aligned for performance * ...

Why learn NIM

2021-04-29 Thread gemath
> 1\. Julia has a very good REPL. Nim doesn't have one, unless it's a secret. Not sure if the pun is intentional. Did you try the command `nim secret`? :o)

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

2021-04-29 Thread gemath
> I think you need to get in touch with some of the AV vendors Yes, but only to tell them that their signatures are plain garbage. If they sold a Co*id test with this kind of selectivity ("let's just say everybody from Venice is positive.."), they would probably be sued. In any half-way sane ju

Variables alignment

2021-04-29 Thread GamzWithJamz
I am curious as to why you need aligned variables. There are multiple design patterns you can use to get away with lockfree solutions. Even just moving to a pipelined concurrent model can do it, like how you would design your program in Go. If you don't know what I mean, [this talk](https://blo

Nim Standard Library - How expansive should it be?

2021-04-29 Thread GamzWithJamz
In looking at some recent blog posts, I started to wonder about the Nim community's attitude towards stdlib expansion in general. Do we take a python approach and pack Nim's stdlib with as many functions as possible, asking for PRs whenever a request is generated? Or do we want to push for "If s

echo isAlphaAscii("ą") - expecting false (instead of error)

2021-04-29 Thread GamzWithJamz
I see that we have allCharsInSet, nice. As an aside, I feel we should follow python's example in adding any and every small utility function to Nim's stdlib that we can. Since frankly, a lot of comparison happens between Nim and Python, whether we like it or not, it'd be great to try and match

echo isAlphaAscii("ą") - expecting false (instead of error)

2021-04-29 Thread GamzWithJamz
> Python is weakly typed language - so it is not a fair comparison - but it > obviously due to its weak types it is much more forgiving: You're right, it isn't a fair comparison for some other reasons too. Python doesn't have a char type or a byte type for that matter, so the ONLY implementatio

Is there any PWA (Progressive Web Apps) framework or package written in nim?

2021-04-29 Thread reversem3
and py4web both can create installable packages. I played around with web2py for a while and its pretty easy to get into. .

Is there any PWA (Progressive Web Apps) framework or package written in nim?

2021-04-29 Thread GamzWithJamz
Since PWAs can be made in JS, they can be made in Nim. Even better, you could use an existing framework and simply write an API wrapper for it in Nim. Then you can use the PWA API directly from Nim and use Nim for the rest of your logic. No need to generate your own framework if you would prefer

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

2021-04-29 Thread Araq
> What changed? We updated the GCC to version 9.2.

setControlCHook

2021-04-29 Thread Araq
IIRC you cannot do anything like that in a signal handler. All you can really do is to set some atomic flag that the threads need to poll.

setControlCHook

2021-04-29 Thread ggibson
It's either your code, or your nim version. I'm using 1.5x and a MWE test passed for me. import asynchttpserver, asyncdispatch var server = newAsyncHttpServer() proc cb(req: Request) {.async.} = await req.respond(Http200, "Hello World") var t:Thread[int32]

Getting varargs parameter from JS

2021-04-29 Thread jyapayne
@drkameleon, I believe this is a bug. Please report it on the Nim issue tracker. If you call the function from Nim, you get the expected result, but when calling from js, there is an error in the browser console and `params` is not defined.

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

2021-04-29 Thread dom96
The question we should be asking is: why does Nim 1.4.6 trigger this and not older Nim releases? What changed? (or are older Nim releases also now triggering av software?)

Question about package level object

2021-04-29 Thread Dabod
`import mypkg / [outter, inner]` works, thank you!

Why learn NIM

2021-04-29 Thread fengkehh
Hmm this is interesting. I guess to do this you will need to allow a closed interval on both ends as your loop condition. It will get strange if the language defined SIZE_MAX using the the numerical type being iterated and the guy dumped all the possible numbers into an array for iteration thoug

setControlCHook

2021-04-29 Thread FabienPRI
Hi, I use setControlCHook to handle the close of a sqlite db, after doing some logs about running time. I moved to Nim 1.4, and in the same time I add a thread to my code, in fact this is a web sever, but there is a background task that handle CPU demanding work (zip of thousands of file and s

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

2021-04-29 Thread Araq
Wouldn't they instead flag them at runtime after UPX did the unpacking?

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

2021-04-29 Thread m33
Right, let's try this in sandboxes...

Question about package level object

2021-04-29 Thread Araq
I don't know... tried `import mypkg / [outter, inner]` ?

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

2021-04-29 Thread m33
Just my 2 euro cents on the matter: using [UPX](https://upx.github.io/) to compress win64 .exe avoid all major antivirus vendors false positives on nim.exe, nimble.exe, nimsuggest, nimpretty etc... Only a few obscure AV still flags them, and as I said, that doesn't matter much.

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

2021-04-29 Thread m33
Compiled exe on Windows using nim-1.5.1 (nightly) already are flagged as malware. See my last screenshot.

We should make it simpler for authors to have their blog featured on the Nim front page.

2021-04-29 Thread ThirdImpact
I totally agree. It's a shame to not have some great bloggers shine here.

Trojan:Win32/Wacatac.B!ml

2021-04-29 Thread dbl007
I just downloaded . Windows defender detected virus. Trojan:Win32/Wacatac.B!ml (See ) Please investigate whether your files

Trojan:Win32/Wacatac.B!ml

2021-04-29 Thread shirleyquirk
much discussion here: please be assured this is a false positive.

Question about re split

2021-04-29 Thread xflywind
You can use `regex` of pure Nim version which is maintained well

Question about re split

2021-04-29 Thread zengxs
Thank you @xflywind, this library looks great.

Trojan:Win32/Wacatac.B!ml

2021-04-29 Thread GengisKaizer
look at Windows Defender Is not new to false positives

Question about re split

2021-04-29 Thread zengxs
Thank you, @HJarausch And I found there are another regex engine in stdlib: `nre` `split` function from `nre` module can work as expected from nre import split, re echo "fooBarTest".split(re"\B(?=[A-Z])") Run

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

2021-04-29 Thread zulu
I think you need to get in touch with some of the AV vendors (or even Microsoft). It's simply not possible to work around corporate policies where you have GPO's that disable all the actions that you can do to circumvent the situation :/ Nim has grown beyond that niche market and is now being t

Question about package level object

2021-04-29 Thread Dabod
I am using package level object to break module dependencies within package, here is working example $ cd ~ $ mkdir -p pkgdir/mypkg $ touch pkgdir/mypkg.nimble Run # pkgdir/mypkg.nim type mypkg.Inner = object Outter* = object

Question about re split

2021-04-29 Thread HJarausch
and if you like to use regex, a probably clumsy solution is import re proc mySplit(s:string,rx:Regex) : seq[string] = var start= -1 let sl = len(s) while true : let pos= s.find(rx,start+1) if pos >= 0 : if start >= 0

Question about re split

2021-04-29 Thread zengxs
Thank you, Araq Your code help me a lot.

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

2021-04-29 Thread Araq
Well we can tweak the compiler's output. Instead of a `NimMain` it can be `hashof(NimVersion)Main`. Then every new Nim release produces different binaries and the malware detection logic must detect the malware and not Nim artifacts. Of course, that's much easier said than done... :-/

Question about re split

2021-04-29 Thread Araq
Use something like this: import strutils proc toSnakeCase(s: string): string = result = newStringOfCap(s.len + 3) for i in 0.. 0 and s[i-1] in {'a'..'z'}: result.add '_' result.add toLowerAscii(s[i]) else: result.add s[i]

Why learn NIM

2021-04-29 Thread Araq
Dijkstra did get this completely and utterly wrong. For `a ..< b` to work you must have a sentinel value `b` that is not part of the range to begin with. And that's simply false for computers and every finite state machine. You cannot simply conjure up `byte(255) + 1` just so that you can iterat

Why learn NIM

2021-04-29 Thread tcheran
You are right. Maybe is not totally off-topic because DontForceMe said of being interested to data Science... and Julia came out as a good language for that. But the argument is mostly off-topic I agree. I apologize, my mistake. Anyway to me it was a useful discussion. It changed my initial poin

Nim on Android error regarding size of a pointer

2021-04-29 Thread 19
Okay so Im trying to make nim generate the correct sizes again but for another project. I'm trying to figure it out and I hit a wall. This is the compiler build command in Android Studio (shortened for brevity): C:/NVPACK/android-sdk-windows/ndk/21.0.6113669/toolchains/llvm/prebui

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

2021-04-29 Thread lscrd
It seems this will become a serious problem for Nim, not only because the compiler and the tools will be declared as suspicious, but also because all programs produced compiled by the Nim compiler may become suspicious at term. The AV software vendors seems to have chosen the lazy way to fight t

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

2021-04-29 Thread Araq
I use Nim on Windows 10 all the time myself, it's simply not true that we don't care about Windows users. However, it's also not clear if a timely 1.4.8 release would be faster than AnitVir vendors to update their detection logic.

Secure Nim Sandbox, with IO, CPU, Memory, Time restrictions. Possible?

2021-04-29 Thread PMunch
You can also have a look at how the Nim playground achieves this with Docker.

Is it possible to have an embedded Nimscript interpreter when compiling with --app:lib ?

2021-04-29 Thread PMunch
Or ElegantBeefs fantastic project based on the idea: . But I don't think either would solve this, unless the procedure is hidden behind a compile-switch.

echo isAlphaAscii("ą") - expecting false (instead of error)

2021-04-29 Thread PMunch
To answer the other questions in your post: > What is the risk of taking both types: the string AND the char type and > gracefully respond with false if the string is not ASCII? There isn't any risk, this is just down to API design. The Nim `isAlphaAscii` is simply meant to work on single chara

echo isAlphaAscii("ą") - expecting false (instead of error)

2021-04-29 Thread Hlaaftana
`strutils` used to have these procs, they were deprecated because of redundancy over `allCharsInSet`, and for lower and upper, there is the ambiguity of how to decide if neither lowercase or uppercase characters return `true` or `false` if every other character would give true. I might be wrong

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

2021-04-29 Thread moigagoo
I've noticed Windows built-in virus protection started marking nimsuggest.exe suspicious and putting it to quarantine,

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

2021-04-29 Thread zulu
I believe we are facing the exact same situation like D

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

2021-04-29 Thread zulu
Same here.As long as it does not catch the compiler you can rebuild it though. Although this is a real PITA and does not look like something that can be easily fixed. They could just as well target stripped binaries in their next iteration of heuristics.