Heya mratsim! When I first got into Nim, you're the person that kept coming up 
time and time again for the stuff I was searching--including feature 
requests--so I think we have a lot of overlapping interests (even go, judging 
by your github picture).

> But it is doable, for example for size suitable for cryptography

Of course, I totally agree. I didn't say it outright in my note, but I was 
implicitly thinking of (and being frustrated with) the general use cases, such 
as Python's homemade bigints, etc. Having statically known sizes is a huge 
benefit when working with 𝔽_q or elliptic curves for specific applications, 
naturally, tho then again one could also argue the low level `mpn_*` API is 
part of GMP, and that could probably be used in the statically sized case for 
big speed-ups. Though getting the things to inline properly might be tricky, so 
that's a potential barrier. (Also, worth a note: in the general case, one 
potentially big thing I don't think have been taken to its full potential is 
something like what C++ does with short-string optimization. I was thinking of 
trying something like that myself at some point.)

> But then you might want your library to work at compile-time as well

This is a specific topic I'm very interested in personally. A big frustration I 
have with extant languages is how most of the techniques for manipulating the 
boundary between comptime and runtime -- generics, static[], specialization of 
such, etc -- is invariably pretty limiting/buggy to work with compared to what 
I think it could/should be. I've been toying with some proof-of-concepts 
(compiling to Zig instead of C) to explore the design space here. I want to be 
able to write code for `Matrix(T: type): type` which has run-time rows/cols 
fields in its representation, and then be able to _specialize the type 
[itself](https://forum.nim-lang.org/postActivity.xml#itself) by assigning 
static comptime values to some fields -- also trying to figure out how to 
promote slices into static arrays etc when possible. The idea is for fields to 
be automatically lifted out of the runtime representation into the comptime 
representation like we currently would write `Matrix[n: static[..], m: 
static[..], T]`. I absolutely hate having to write code for the same algorithm 
twice -- one using runtime parameters, possibly branching on those to more 
specialized cases, and then again in order to use const generics etc. 

Reply via email to