Replicate python code in nim

2023-05-21 Thread Cnerd
Thanks, I appreciate your response. I'll definitely go with libsodium for the time being. I'll also keep testing libp2p and improve my understanding on cryptography. Thanks again.

Algebraic data types and structural pattern matching RFC

2023-05-21 Thread j-james
The types of the variants are not required to be unique. While I somewhat agree from a type theory perspective (well, actually, I'd prefer this to be called `enum` and objects to be called `struct`), I think `union` is a much more approachable keyword that conveys what the type is doing better.

Replicate python code in nim

2023-05-21 Thread mratsim
Implementing elliptic curve from scratch with no background in cryptography engineering is a tall order. For production (and not as a learning experience), it's probably easier to debug why libp2p implementation gives you a different key everytime. It has been audited and is straight from a ref

Algebraic data types and structural pattern matching RFC

2023-05-21 Thread xigoi
Are the types of the variants required to be unique? If not, it should be called `sum` rather than `union`.

NIM code compile to executable does not run on other systems.

2023-05-21 Thread Yardanico
The first things that come to mind are OpenSSL (because Discord APIs use SSL), and PCRE (I'm not 100% sure, but I think dimscord uses re). Try for example starting your app from the windows cmd, you might actually see the problem then. You can find those DLLs in the same folder with the Nim ins

NIM code compile to executable does not run on other systems.

2023-05-21 Thread sls1005
Every OS has an executable file format of its own. An executable compiled for Windows cannot be used on macOS. Similarly, an executable compiled for macOS cannot be used on Linux. In addition, every executable is compiled for a specific CPU architecture. One cannot run a x86 executable on a mach

Algebraic data types and structural pattern matching RFC

2023-05-21 Thread j-james
It seems "unnatural" because it is complete garbage! Middle-click paste strikes again, that is the same code block accidentally pasted into itself. I can't seem to edit my post any more as it's too old, shame. If you have post edit privileges would you mind removing lines 13 through 24 of the co

Support for Tree-sitter?

2023-05-21 Thread j-james
aMOPel's parser additionally already has queries written for it and merged into a number of editors, currently Helix and wip Neovim. I was going to do the same for alaviss's parser in the future, as it is more correct: but it's also _ridiculously_ large right now.

NIM code compile to executable does not run on other systems.

2023-05-21 Thread matkuki
* check that all assets your app uses are also on the other machine * check executable dependencies with `dumpbin /dependents ` in a `Visual Studio Command Prompt`, and make sure they all are on the other machine

Support for Tree-sitter?

2023-05-21 Thread didlybom
I think this could also get us support for semantic diffs via difftastic:

clarification on nim v2 removal of parallel & spawn

2023-05-21 Thread Araq
I can now recommend Malebolgia for a test drive. Benchmark results are good, the API is a joy to use, it is small and fast and has documentation.

Replicate python code in nim

2023-05-21 Thread Cnerd
I am aware of the Nim libsodium wrapper, the thing is a I am building the library from the ground up to be able to work for all of nim's backends. Including JavaScript. The bare minimum I need to make this work is to at least be able to generate the public and private keys for transaction signin

Replicate python code in nim

2023-05-21 Thread mratsim
> I already tried stealing code from libp2p to achieve this but the public key > and private key generated are different all the time. I assume this is what > you mean by the attacker not being able to get the private key. But any time > I tried with the official aptos python sdk the same seed a

Complexity of nim vs other languages in creating a simple back-of-the-envelope tool.

2023-05-21 Thread mratsim
> I was really happy trying Nim, and as a result the Nim code is a bit more > optimized and engineered: > > It has some optimizations: I don't compute 1M samples for each dist, but > instead pass functions around and compute the 1M samples at the end > > Without 1. and 2., the nim code takes 0m

Replicate python code in nim

2023-05-21 Thread dlesnoff
If the seeds are identical, it should generate the same keys.

Replicate python code in nim

2023-05-21 Thread Cnerd
't use your code in production, the scalar you are processing is a cryptographic private key and issues in your code may expose you to identity theft, losing money (by someone pretending to be you), remote SSH access and what not. Run I am not very experienced in cryptography. But

Support for Tree-sitter?

2023-05-21 Thread sekao
I wrote one a few years ago based on the python parser: I won't claim that it's perfect...it probably needs some love, but I used it to provide nim syntax highlighting in my text editor:

Support for Tree-sitter?

2023-05-21 Thread brainproxy
There are some works in progress:

Support for Tree-sitter?

2023-05-21 Thread Araq
> Maybe someone with more expertise could tackle it? Ask me specific questions on Discord please. > as smart syntax highlighting NOOO... > syntax-aware selection, argument swapping and other IDE-like features. OK. :-)

NIM code compile to executable does not run on other systems.

2023-05-21 Thread nimusertest
Hi guys, Im trying to compile my nim code to a stand-alone executable. However, the executable I get run perfectly on the machine I just to compile the code, but doesn't run on any other computer. I'm also not getting any errors while running the executable. Its just shutting down within an ins

Replicate python code in nim

2023-05-21 Thread dlesnoff
The division in is flawed (the division errors out for certain values) and is tested against the C and C++ backends. only works with the JS backend and is not terrible. You should rather use a wrapper of the C libra

Complexity of nim vs other languages in creating a simple back-of-the-envelope tool.

2023-05-21 Thread alexeypetrushin
The example in Nim could be made shorter, import for example could be oneline.

Support for Tree-sitter?

2023-05-21 Thread xigoi
It would be nice to have a `Tree-sitter ` parser for Nim. I tried to make one, but had severe issues with the ambiguity of Nim's grammar (Tree-sitter doesn't support ordered choice). Maybe someone with more expertise could tackle it? A Tree-sitter im

Complexity of nim vs other languages in creating a simple back-of-the-envelope tool.

2023-05-21 Thread Yardanico
Nim does actually support semicolons if you need to have multiple statements on the same line, or if you're just copy pasting C code. It's not a good style, but it is there.

Nimble for Nim v2

2023-05-21 Thread Araq
* is already done by Nim's "atlas" tool that I'm accepting patches for. In my ideal world Atlas will replace Nimble sooner or later.

Replicate python code in nim

2023-05-21 Thread mratsim
Obligatory disclaimer: Don't use your code in production, the scalar you are processing is a cryptographic private key and issues in your code may expose you to identity theft, losing money (by someone pretending to be you), remote SSH access and what not. It's fine for learning purpose though

Replicate python code in nim

2023-05-21 Thread auxym
Consider also constantine, which was especially designed for crypto applications . BigInt type and shift procs available is this module specifically: Should be availabl

Complexity of nim vs other languages in creating a simple back-of-the-envelope tool.

2023-05-21 Thread Araq
"Lines of code" is rather meaningless given that it could easily be fewer lines of code.

Complexity of nim vs other languages in creating a simple back-of-the-envelope tool.

2023-05-21 Thread dlesnoff
Does this really run ? I see a semicolon in your link to the Nim source:

Complexity of nim vs other languages in creating a simple back-of-the-envelope tool.

2023-05-21 Thread NunoSempere
Here: is a repo that compares the speed and complexity of a back-of-the-envelope estimates written in various programming languages. Nim does really well (code for nim here: )

Replicate python code in nim

2023-05-21 Thread Cnerd
Thanks, this is exactly what I need

Algebraic data types and structural pattern matching RFC

2023-05-21 Thread mratsim
Very interesting, actually when I was using Rust I kind of missed Haskell pattern matching. Regarding this type Term = union Unittype Ident = string Run This seems "unnatural", a bit similar to Rust Phantom data types, I don't see this syntax in the RFC either,

Replicate python code in nim

2023-05-21 Thread juancarlospaco
or other BigInt.

Help with generics and typeclass problem

2023-05-21 Thread mratsim
> Code behaves correctly but for some reason the [] proc is very slow. I get > ~45 second runtime vs ~4ms what it normally should be, for 4 million > operations. 10.000x slower. While the []= proc is as fast as it's supposed to > be. The code compiles to typedef NU8 tyArray__3Ihb9

Replicate python code in nim

2023-05-21 Thread Cnerd
Hello, I have this python code i want to replicate in nim def bytes_to_clamped_scalar(s): # Ed25519 private keys clamp the scalar to ensure two things: # 1: integer value is in L/2 .. L, to avoid small-logarithm # non-wraparaound # 2: low-order

Algebraic data types and structural pattern matching RFC

2023-05-21 Thread alexeypetrushin
+1 for Union, in 80% of cases when I use Variant, Union would be better. And of course, Union is useless without auto-cast, so structural (or some other auto-cast) is a must.

Help with generics and typeclass problem

2023-05-21 Thread void09
You are right mratsim, it's the nim compiler that sigsegv.. which is obviously a bug, no doubt about it :) I will report it. Speaking of bugs and types, I almost forgot this little code snippet when I was trying to figure out concepts: Code behaves correctly

Algebraic data types and structural pattern matching RFC

2023-05-21 Thread j-james
Hello, I have created an RFC for proper algebraic data types and structural pattern matching a la Swift or Rust. It's available here: I go into much more detail on the RFC itself, but here is an example of code it would allow you to write:

Nimble for Nim v2

2023-05-21 Thread mratsim
With Nim v2 just around the corner as a library developer I feel limited by Nimble in my ability to provide excellent libraries. In this RFC: I present 3 areas of improvement I feel are important: 1. Support for monorepo 2. `nimble install foo`

Teach you to write nim code comfortably use vim if you like vim you must try :)

2023-05-21 Thread pp
Nice! Recently I started using VS Code for the only reason that the only good Nim plugin was for it!

C++ backend just got virtual

2023-05-21 Thread elcritch
That's awesome!

C++ backend just got virtual

2023-05-21 Thread jmgomez
For those interested in the C++ backend, there is an experimental version of the `virtual` pragma. Here are the docs: