how to use Natural type?

2022-09-11 Thread ro2
I see that style guide, though I’m not sure what to use instead. How would you rewrite e.g. the signature of the `setLen` function `proc setLen[T](s: var seq[T]; newlen: Natural)`?

Nim Compiler Issues

2022-09-11 Thread sls1005
What you intend to do is to make `char` convertiable to `byte`, so you need a `converter`. converter toByte(c: char): uint8 = uint8(c) converter toBytes[N](a: array[N, int]): array[N, uint8] = for i, v in a: result[i] = uint8(v) var x: uint8 = 'a

Show Nim: TheArtButton.ai, a new web Stable Diffusion runner

2022-09-11 Thread treeform
Not right now. The seed as random. In the future I will add UI to allow you to use fixed seed. Then you will be able to use the same prompt produce exactly the same image.

Show Nim: TheArtButton.ai, a new web Stable Diffusion runner

2022-09-11 Thread treeform
We have a brain box that does the UI and job queue. Then we have GPU workers grabbing work from a job queue to generate the images. They just use simple HTTP polling for now. We started just by running GPUs we already have at home but now we also rent some cloud GPUs for more capacity.

how to use Natural type?

2022-09-11 Thread arnetheduck
Based on practical experience, we've stopped using `Natural` (and indeed any other `range` types due the large large number of associated bugs - both in implementation and in code trying to use them):

Show Nim: TheArtButton.ai, a new web Stable Diffusion runner

2022-09-11 Thread dom96
Nice, what are you running this on?

Show Nim: TheArtButton.ai, a new web Stable Diffusion runner

2022-09-11 Thread oyster
does the same prompt produce the same image?

Nim compiler options for Z80 C compiler?

2022-09-11 Thread Wys
I'm no expert, but I would imagine that Nim is capable of producing code suitable for modern 8-bit compilers if it is able to do so for the Tiny C Compiler. Following the C89 standard would be best for my use case, but most of C99 is usually supported too. As I intend to create text adventures

QRgen - A QR generation library fully written in nim

2022-09-11 Thread oyster
So is there a QR reader in pure nim?

Slow compilation time in a big project. What branch contains Incremental Compilation?

2022-09-11 Thread bung
then should take IC to work.

include directory

2022-09-11 Thread NameUndefined
> making maintenance and editing complex (my editor sees error everywhere, > because each file is not compilable). I have the same issue, but I still like to be able to include whole dirs even if nimsuggests complains about it. I think we can fix that by making a fakeImport pragma that wraps ar

Slow compilation time in a big project. What branch contains Incremental Compilation?

2022-09-11 Thread Yardanico
Nimcache only affects the C part of the compilation, the Nim compiler still has to re-analyze and compile all Nim files every time.

Slow compilation time in a big project. What branch contains Incremental Compilation?

2022-09-11 Thread bung
sounds like nimcache doesn't work, or you use CI without cache ?

Slow compilation time in a big project. What branch contains Incremental Compilation?

2022-09-11 Thread jmgomez
> You autogenerate 50k lines of code, you do not edit them, and still have to > recompile them each time ? Yes, just like when you try to import a big nim lib i.e. import compiler / [ast, nimeval, llstream, types] > Do your changes forces to autogenerate 50k LoCs each time ? No > Do you have

Slow compilation time in a big project. What branch contains Incremental Compilation?

2022-09-11 Thread dlesnoff
You autogenerate 50k lines of code, you do not edit them, and still have to recompile them each time ? Do your changes forces to autogenerate 50k LoCs each time ? Do you have any idea which part of the Nim symbols takes the most time to compile ? Is the import of all the symbols taking time in

Slow compilation time in a big project. What branch contains Incremental Compilation?

2022-09-11 Thread jmgomez
@hlaaftana We are using ORC. But I guess we could make the plugin work with None, after all the only ref types we use are strings and seq. Unreal has its own GC. However, even with mm:none IC fails for a hello world with this trace: G:\NimSources\Nim\compiler\nim.nim(150) nim

include directory

2022-09-11 Thread Hlaaftana
There is supposed to be a `import foo {.all.}` syntax for importing all private symbols but I don't know if it works with object fields.

Slow compilation time in a big project. What branch contains Incremental Compilation?

2022-09-11 Thread Hlaaftana
Devel also has --gc:orc by default which I think is currently incompatible with incremental compilation (because of its unique transformation pass). If GCs like refc or none work for you than you can try them.

include directory

2022-09-11 Thread dlesnoff
I use this post to tell about a problem I currently have, and a limitation of imports/include/export system and preserving public/private API. In the nim-lang/bigints library, I tried to refactor the library that is currently a file with 1200 lines. All the functions/procedures/templates depend

Slow compilation time in a big project. What branch contains Incremental Compilation?

2022-09-11 Thread jmgomez
It is possible but I dont see how it's going to help. Just to make it clear, the code is just Nim symbols (not importc) and Im importing (not editing) that particular file. So if I split it, I will end up importing the separated pieces individually anyways.

include directory

2022-09-11 Thread NameUndefined
Back after checking jester, I choose the macro route. Here is it (in case someone has the same needs than me) import std/[macros, os] macro includeDir*(arg:static[string]): untyped = let tree = nnkStmtList.newTree() let inclStmt = nnkIncludeStmt.newT

include directory

2022-09-11 Thread NameUndefined
Jester seems really complex for what Im doing ( listening for simple requests ). But Im gonna take a look at it.

Why compiler doesn't check the size of types with the `size` pragma?

2022-09-11 Thread bather
Got it 👍

include directory

2022-09-11 Thread NameUndefined
Thanks for the idea. I just want to outsource my routes in their own files rather having them all in my main file.

include directory

2022-09-11 Thread Yardanico
If you're using Jester, you can do it with imports, no need for include.

how to use Natural type?

2022-09-11 Thread xigoi
Unsigned integers with their wrapping behavior are indeed ℤ/2ⁿℤ, but `Natural` is not.

include directory

2022-09-11 Thread Yardanico
Yes, but you'll need to write a macro that iterates over all files in that directory and generates statements to include all of them. But besides that - can you please tell the reason you need this functionality for? Include itself is quite rarely used, and I don't know why you'd want to includ

include directory

2022-09-11 Thread NameUndefined
I just found out about the `include` statement while reading the [Nim Manual](https://nim-lang.org/docs/manual.html#modules-include-statement). I just wonder if their is any ways to include a whole directory. Something like that is what im looking for # include every single nim fil

Nim compiler options for Z80 C compiler?

2022-09-11 Thread doofenstein
> I wouldn't worry about the output size, any decent optimizing compiler should > produce optimal code from Nim output. problem is that said thing doesn't really exist for those 8-bit micros. For once when compilers started to get become acceptabably near handwritten C code those CPUs where alr

Why compiler doesn't check the size of types with the `size` pragma?

2022-09-11 Thread mratsim
Because when you specify size, you tell the compiler than you know more than it and making sure things are OK becomes your responsibility.

Nim Compiler Issues

2022-09-11 Thread mratsim
`byte` is already a builtin type you shouldn't use that name.

Slow compilation time in a big project. What branch contains Incremental Compilation?

2022-09-11 Thread mratsim
Nim caches per file, if you change one line in a file it recompiles all (which is why include and big single file are not optimal). Would it be possible to split your autogenerated 50k lines file into multiple files?

Nim compiler options for Z80 C compiler?

2022-09-11 Thread mratsim
Probably a good start would be `nim c -d:release --os:standalone --exceptions:gotos --gc:arc` I wouldn't worry about the output size, any decent optimizing compiler should produce optimal code from Nim output.

Why compiler doesn't check the size of types with the `size` pragma?

2022-09-11 Thread bather
type O1 {.size: 1.} = object a: uint64 # too huge for that size assert O1(a: 9'u64).sizeof == 1 type O2 = object a: uint64 assert O2(a: 9'u64).sizeof == 8 Run ?