generic type constraint to size

2024-07-20 Thread Araq
Easy: proc createT[T](x: T): T= static: assert sizeof(T) == 4 result = x Run

generic type constraint to size

2024-07-20 Thread doongjohn
I thought it could be easly done via concept like this: type AnyOfSize[S: static int] = concept type T sizeof(T) == S proc p(a: AnyOfSize[4]) = echo a p(0'i16) # <-- error Run However this code also works... maybe it's a bug?

generic type constraint to size

2024-07-20 Thread dwhall256
Does Nim have the ability to constrain a generic type to be of a certain size? For example, can I create MyObject[T] where T is any type that is 4 Bytes?

TinyCC/tcc vs zig cc compile-times/etc.

2024-07-20 Thread cblake
I should also have mentioned that I have a `d=nimPreviewSlimSystem` in my `nim.cfg` which still breaks many things (self tests, [nimble](https://github.com/nim-lang/nimble/issues/1050), etc.) but which does make the empty file compile time `1.0779 +- 0.0088` times faster (notably, quite a bit s

TinyCC/tcc vs zig cc compile-times/etc.

2024-07-20 Thread cblake
While I see you already figured out your answer, since you revived this ancient thread, I can perhaps say some other things that might be helpful for fast compiles. I do this in my $HOME/.config/nim/nim.cfg: # Ideally, each Nim compiler flag would have an associated defineSymbol, B

Small libraries you'd like to see ported to Nim?

2024-07-20 Thread Araq
Maybe you guys should read more than the headline...

TinyCC/tcc vs zig cc compile-times/etc.

2024-07-20 Thread Arrrrrx2
Could you share the script to compile with tinycc?

Small libraries you'd like to see ported to Nim?

2024-07-20 Thread qqtop
I hope there will be a duckdb component available in Nim .