Convert Python codes to Nim codes

2022-08-19 Thread ggibson
For the slicing syntax, try the simpler option of the previously suggested `collect` together with `countUp`, which supports strided for, like python's `range`.

Need some direction on macros.

2022-08-19 Thread ggibson
I once had to overcome the same thing for scraping a site that used a rotating cipher of obfuscating links through various js schemes. My solution was overkill, but future proof - embed the entire v8 js engine, evaluate the code, then extract what was necessary. It's an option. This was before d

Need some direction on macros.

2022-08-19 Thread mratsim
Have you checked yt-dlp source code in case they already solved that?

Convert Python codes to Nim codes

2022-08-19 Thread whospal
Thanks all for the great responses! But I'm still not sure how to use the slice function. #--- # Name:WordSearch.nim # Purpose: Find word in a grid of letters in any directions. #---

Nimble and two different C files with the same name

2022-08-19 Thread treeform
I don't know how to solve your main problem, it feels like a c compiler bug? But implement gzip decompression in native nim and is very fast, beating or matching zlib. It also uses different SIMD for x86 and arm. Maybe no need to wrap libdeflate?

Nim v2: what would you change?

2022-08-19 Thread rb3
Ah, I didn't know that the Nim VM was equivalent to the entire Nim compiler. I was under the impression that there were improvements to be made in using Nim as a library that would help reduce executable size, and make it work with arc/orc etc. I should take another look at it then, thanks!

Alternative to gravatar for the forums?

2022-08-19 Thread ElegantBeef
> I would reconsider your choices for your own health Considering I do not drink or do drugs I think "Helping people too rapidly from the perspective of a forum or mailing list lover" is not the worst habit I could have(perhaps giving snide responses to people online is a worse habit). > I hate

Need some direction on macros.

2022-08-19 Thread jyapayne
It sounds like you're in for a world of pain and/or fun :) Writing an interpreter is no joke, and it looks like you may need to account for complex behavior that has already been done by someone else. Might I suggest using an already made Javascript interpreter and see if that works for you? [D

Anti-virus at work prevents the use of Nim binaries

2022-08-19 Thread dom96
Yeah, I also think a blog post calling the antivirus companies out is our best bet. In the meantime I noticed replit has the same problems and I tweeted at a Microsoft PM who has helped them:

Nimble and two different C files with the same name

2022-08-19 Thread radekm
Hi, I'm trying to wrap libdeflate in Nim. I would like to create a package which doesn't depend on any external library so I embedded C sources of libdeflate inside my Nimble package. Now I use following `compile` directives in my source code: {.compile: "libdeflate_gzip/private/l

Need some direction on macros.

2022-08-19 Thread xioren
Yeah I guess and interpreter is my next focus.

Need some direction on macros.

2022-08-19 Thread xioren
Yeah makes sense. Good explanation.

Need some direction on macros.

2022-08-19 Thread xioren
Unfortunately it's more complex than that. Here is the rube goldberg code I need to convert to Nim. These are steps operating on an array. (youtubes anti-piracy measure) try{try{4=c[62-Math.pow(3,3)%497]&&(c[33]>30*Math.pow(2,1)-53||((0,c[44])(c[0]),void 0))&&(0,c[56])(c[0]),1=c[1

Anti-virus at work prevents the use of Nim binaries

2022-08-19 Thread Hlaaftana
Don't know why no one's made a "Nim vs antiviruses" blog post yet and posted it around.

Need some direction on macros.

2022-08-19 Thread Hlaaftana
Since you want to convert the javascript to nim I assume you want to use symbols defined in javascript in nim. This is impractical unless you use nimscript somehow, but if you just want to run javascript, you can bind to [QuickJS](https://bellard.org/quickjs/), there is a [wrapper for it alread

Nim v2: what would you change?

2022-08-19 Thread mildred
there is no way you can load NimScript at runtime without embedding the nimscript interpreter at run-time, and increasing your executable size. The nimscript interpreter being the same as the nim compiler.

Nim v2: what would you change?

2022-08-19 Thread Hlaaftana
I don't see a way of doing this officially that wouldn't have the problems you describe. Maybe something like `nimscripter` could be made into a static library.

Any way to compile with `-O2` or `-Ofast`?

2022-08-19 Thread Hlaaftana
"Transpiling" implies translation. Nim is meant to produce C code, not translate to it. The key difference is that you generally can't translate from the C output back to Nim. Sorry this conversation is unrelated to the original post.

Need some direction on macros.

2022-08-19 Thread PMunch
The power of macros is exactly what you seem to perceive as a weakness. Most languages doesn't allow you to modify your own code on compile-time, some offer limited support. Nim is really one of the few languages which offers this level of compile-time modification of code, which is a really pow

Alternative to gravatar for the forums?

2022-08-19 Thread Polarian
Personally, I do not believe instant messaging is what is for asking for help. A lot of people solely use instant messaging these days, companies like discord, whatsapp etc have all tried to make instant messaging the messing to end all others, but there is nothing "instant" about it anymore. I

Alternative to gravatar for the forums?

2022-08-19 Thread Polarian
Sourcehut is cool, especially their stance on open source collaboration. But the problem with them is that they have a high learning curve, you need to understand the git VCS in depth in order to be able to use sourcehut to the fullest, the reason platforms like github are used is because they t

Alternative to gravatar for the forums?

2022-08-19 Thread Polarian
This is not "harmless", for example a lot of dependency repositories contain analytics to track how often and who downloads the dependencies, if I am pulling dependencies I do not want to be tracked. Yes they can be useful, to understand what is no longer needed, or which is not being used at a

Alternative to gravatar for the forums?

2022-08-19 Thread Polarian
How about no analytics, that would be ideal!

Nim v2: what would you change?

2022-08-19 Thread rb3
Ah shame, looks like I'm a few months late. But I wanted to suggest adding official support for loading Nimscript at runtime. Something like: import std/nimscripts let scriptObj = loadScript "script.nims" scriptObj.someFn() Run I know the third party libra

Anti-virus at work prevents the use of Nim binaries

2022-08-19 Thread tcheran
Did we miss the egg of Columbus? Indeed for MS Security I found: and probably we have to go for Report a false positive/negative to Microsoft, consid

Any way to compile with `-O2` or `-Ofast`?

2022-08-19 Thread Polarian
I would disagree with this, typescript is transpiled to javascript because they have similar levels of abstraction, and also they have pretty much the same syntax, one implements a type system, the other doesn't, that is the major difference between the two languages. Furthermore I disagree with

why Hints comes yet even {.push hint[Name]: off.} is added?

2022-08-19 Thread mratsim
You need to solve the warning below. When you get a warning or an error, Nim details the generic calls as part of the trace.

How to allocate a channel and return a ptr?

2022-08-19 Thread jasonfi
Thanks, I'll give it a try.

Any way to compile with `-O2` or `-Ofast`?

2022-08-19 Thread Omnomnim
Whether or not Nim transpiles is up for debate:

Anti-virus at work prevents the use of Nim binaries

2022-08-19 Thread Omnomnim
Many antiviruses offer a way to report false positives, so they can (and will, in my own experience) update their signatures. Obviously not ideal, but ideal may not exist.

why Hints comes yet even {.push hint[Name]: off.} is added?

2022-08-19 Thread oyster
Thanks, mratsim. Then, what does C:\Users\USER\.nimble\pkgs\winim-3.9.0\winim\clr.nim(218, 37) template/generic instantiation of `fmt` from here (1, 3) template/generic instantiation of `toHex` from here Run mean? And what is the solution to kill such information?

How to allocate a channel and return a ptr?

2022-08-19 Thread mratsim
But why, `Chan[T]` already has reference semantics so you can pass it as is through over Chan[T] Otherwise what you asked to do is the following (but i see no point in actually doing it) let chanPtr = createShared(Chan[int]) chanPtr[] = newChan[int]() Run

Need some direction on macros.

2022-08-19 Thread Vindaar
Well, at least if it's only math expressions you need to evaluate, you may be in luck, as there's already a small expression evaluator by Yardanico:

How to draw images on collectionView elements (rects), with nimx ?

2022-08-19 Thread void09
I need help, issue described here: The documentation is too slim and I have no experience with guis at all. Please assist.

Need some direction on macros.

2022-08-19 Thread pp
If you know the js code only at runtime seems like you need to have/write an interpreter...

Anti-virus at work prevents the use of Nim binaries

2022-08-19 Thread tcheran
Ah, OK, I thought it was intentional. I tested choosenim latest version, 0.8.4 both on my home windows laptop (Microsoft Defender), and VirusTotal online checker, so it seems choosenim causes no alarms.