Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread arnetheduck
See also and \- these prevent writing code that is possible to write efficiently in other languages.

unique refs > `isolate`

2023-05-12 Thread ElegantBeef
Implicit copies on sink really makes life much better in my opinion. You can easily call a `sink` proc and do not need to be concerned whether it's `sink` or not you can just use that variable after(This explicit concern and need to call `clone` exists in Rust due to their view that aligns with

Can't import compiler/* anymore

2023-05-12 Thread ElegantBeef
> a separate library as before In my experience a separate library never worked. You want to use the compiler API of the compiler you are using. I had many issues with Nimscripter and `requires "compiler"` there's just not a good way of requiring the version of the API your compiler is. This wo

Is there a way to tell the compiler to include/export unused functions

2023-05-12 Thread Araq
You can compile "nimrtl.dll" but it's usually not done and the malware author is unlikely to use it. Now, to make matters worse or better if the malware cares about code size it was compiled with `-d:release` or `-d:danger`. If so then Nim optimized out unused functions whether in the standard l

Is there a way to tell the compiler to include/export unused functions

2023-05-12 Thread hunterbr
In short words, I am working on a tool which can generate signatures (which can be used in a Disasm) for all Nim stdlib functions. The goal is to have binary signatures for Nim stdlib funcs/procs so a reverse engineer analysing a Nim malware binary can focus on the procedures written by the malw

Is there a way to see the NIM version in an NIM executable (binary) ?

2023-05-12 Thread hunterbr
@Araq, finding the version helps for several task in reverse engineering the malware. I ll open a new question for that to make this thread not too long, but for example I am trying to profile stdlib functions, so that the analyst can focus on the code written by the malware author instead of ge

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread Yardanico
To have a seq that has already allocated len and cap, but is not zero-allocated, in case you will assign all elements yourself by an index, for example.

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread juancarlospaco
But then whats the reason of `newSeqUninitialized` to exist.

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread juancarlospaco
To not read/write `nil`/garbage.

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread Yardanico
Maybe you have mistaken `newSeqOfCap` for `newSeq`? `newSeqOfCap` doesn't allow you to access the elements, since the capacity is allocated, but length is still 0. You have to add elements to the sequence, so they will never be garbage, so it makes total sense not to zero-allocate data for newSe

unique refs > `isolate`

2023-05-12 Thread Araq
Some progress here:

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread AmjadBHD
Here's a [PR](https://github.com/nim-lang/Nim/pull/21842), but it feels missing.

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread AmjadBHD
Why should `newSeqOfCap` be zeroed ?

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread juancarlospaco
`newSeqOfCap` should be zeroed, `newSeqUninitialized` should not.

Can't import compiler/* anymore

2023-05-12 Thread dPixie
@Araq what is the correct way to handle a Nim project that needs access to the compiler library files going forward? Since including a Nimscript runner in your binary requires it (unless I'm mistaken) it would make sense that it was part of the distribution of Nim std, or a separate library as b

Why `!=` is template and not a func?

2023-05-12 Thread shirleyquirk
> any problem domain that rely on ... NaN NaN gates and Flip FLOPS by tom7, [paper](http://tom7.org/nand/nand.pdf) [video](https://www.youtube.com/watch?v=5TFDG-y-EHs) abuses ieee754 compliance to its limits there's no equality comparisons involved, but many of the operations rely on ieee754-c

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread Araq
I don't know, just patch it cleanly so that it works.

Announce: LimDB 0.3.0 Now with types & block-syntax transactions

2023-05-12 Thread cmc
LimDB 0.3.0 has landed! This is a rather large feature release. LimDB is a key-value store that makes it as convenient as possible to use the LMDB memory-mapped key-value database by providing an interface that is like a table. import limdb let db = initDatabase("myDirectory")

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2023-05-12 Thread AmjadBHD
Should I change it [here](https://github.com/nim-lang/Nim/tree/devel/compiler/ccgexprs.nim#L1497) ? Then `newSeqOfCap` would not initialize the memory, which IMHO is logical.

Why `!=` is template and not a func?

2023-05-12 Thread mratsim
I'm not aware of any problem domain that rely on `not NaN != NaN` and `NaN == NaN` except in symbolic computation (but then they don't use floating points)