00:00:04 | FromDiscord | <retkid> heres hoping every iteration it can return to 0 memory usage |
00:00:14 | FromDiscord | <retkid> otherwise this will get very annoying |
00:00:16 | * | tk quit (Quit: Well, this is unexpected.) |
00:00:21 | FromDiscord | <Yardanico> use ORC then |
00:00:30 | FromDiscord | <Yardanico> and be very careful with code that does allocations |
00:00:41 | * | tk joined #nim |
00:00:45 | FromDiscord | <Yardanico> and if you have cyclic types, do GC_fullCollect() each iteration with ORC |
00:00:55 | FromDiscord | <retkid> its not efficiency problem its a scale problem |
00:00:57 | FromDiscord | <Yardanico> granted GC_fullCollect() will also probably work if you use refc |
00:01:03 | FromDiscord | <Yardanico> In reply to @retkid "its not efficiency problem": buy more ram |
00:01:12 | FromDiscord | <retkid> i has no monies |
00:01:42 | FromDiscord | <retkid> actually i compiled with -mm:arc and now it uses like half the ram |
00:01:43 | FromDiscord | <retkid> nice |
00:01:55 | FromDiscord | <Yardanico> just be careful with arc |
00:01:59 | FromDiscord | <Yardanico> if you have any cyclic types they'll leak |
00:02:12 | FromDiscord | <Yardanico> so --mm:orc is a bit better if you're not 100% sure you don't have cycles |
00:02:26 | FromDiscord | <retkid> cylic types? |
00:02:32 | FromDiscord | <retkid> like |
00:02:47 | FromDiscord | <Yardanico> cyclic |
00:02:49 | FromDiscord | <retkid> a type made up of other types which are made up of other types? |
00:02:51 | FromDiscord | <Yardanico> no |
00:03:12 | FromDiscord | <Yardanico> now you have a cycle |
00:03:14 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JCk |
00:03:30 | FromDiscord | <Yardanico> and under ARC it'll leak (granted, in this simple example the compiler will warn you about the cycle) |
00:03:31 | FromDiscord | <retkid> yea i dont have that |
00:03:40 | FromDiscord | <Yardanico> well you should be sure the libs you use don't have that |
00:03:47 | FromDiscord | <Yardanico> also if you use async you must use orc |
00:04:00 | FromDiscord | <retkid> no async here |
00:04:06 | FromDiscord | <retkid> only thtrading |
00:04:23 | FromDiscord | <retkid> also yea damn, i hit max mem and it died :( |
00:04:34 | FromDiscord | <retkid> (edit) "thtrading" => "threading" |
00:04:42 | FromDiscord | <retkid> welp |
00:04:42 | FromDiscord | <Yardanico> as i said, maybe try to optimize memory usage? |
00:04:49 | FromDiscord | <Yardanico> e.g. `{.packed.}` for types, etc |
00:04:53 | FromDiscord | <Yardanico> i can't say anything without the code |
00:05:13 | FromDiscord | <retkid> theres stuff i can do, like pass strings instead of sequences and optimize for that but ugh |
00:05:26 | FromDiscord | <retkid> i'look for obvious problems |
00:06:05 | FromDiscord | <retkid> running 1 is fine, but running 500 at the same time causes problems |
00:06:39 | FromDiscord | <Yardanico> run 480 |
00:06:57 | FromDiscord | <Yardanico> also I surely hope you're not using threads for http requests |
00:07:08 | FromDiscord | <retkid> I did that before! |
00:07:10 | FromDiscord | <retkid> bad idea |
00:07:26 | FromDiscord | <retkid> stuff breaks |
00:07:30 | FromDiscord | <retkid> this is just math |
00:07:33 | FromDiscord | <retkid> (edit) "this is just math ... " added "and generations" |
00:10:07 | FromDiscord | <retkid> wow arc really did completely slash the memory usage |
00:10:31 | FromDiscord | <retkid> i might be able to run 2000 now |
00:12:09 | FromDiscord | <retkid> when i run with danger i keep getting out of memory, from some pointers i have passing around? |
00:24:34 | NimEventer | New thread by Xioren: Proper way to open and close async files?, see https://forum.nim-lang.org/t/8744 |
00:30:33 | FromDiscord | <KatrinaKitten> Curious, is there a simple way to include the source of another proc as a `runnableExamples`? |
01:45:14 | * | noeontheend joined #nim |
01:59:11 | FromDiscord | <Ricky Spanish> is it fine to host custom builds of nim on github using github actions/releases? i want a binary version of nim for mac that i can include in my ci system |
01:59:15 | FromDiscord | <geekrelief> In reply to @KatrinaKitten "Curious, is there a": That sounds like a job for a macro. |
02:04:39 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3JCL |
02:11:30 | FromDiscord | <Elegantbeef> Only issue with that geek is it doesnt emit `echo "foo world"` in the docs 😛 |
02:11:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JCN |
02:13:34 | FromDiscord | <geekrelief> good point 🙂 lol |
02:14:12 | FromDiscord | <geekrelief> I guess you need to wrap the output |
02:14:35 | FromDiscord | <Elegantbeef> Replace all syms that are `nskParam` with `nnkIdent` |
02:18:00 | * | drewr joined #nim |
02:21:57 | FromDiscord | <geekrelief> In reply to @Elegantbeef "Replace all syms that": Can you elaborate on that? |
02:22:08 | FromDiscord | <Elegantbeef> I'll provide an example |
02:22:48 | FromDiscord | <KatrinaKitten> It's nbd in the end, I ended up wanting to make some adjustments to the example anyway, so an automated solution wouldn't do as well as copy paste. |
02:22:59 | FromDiscord | <KatrinaKitten> Would be pretty neat to figure out how tough. |
02:23:05 | FromDiscord | <KatrinaKitten> (edit) "tough." => "though." |
02:24:57 | * | drewr quit (Ping timeout: 240 seconds) |
02:25:04 | FromDiscord | <geekrelief> In reply to @KatrinaKitten "Would be pretty neat": no worries, figuring this out would be useful for me too |
02:25:39 | FromDiscord | <geekrelief> I noticed my tests and runnableExamples are basically the same thing. |
02:29:24 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3JCT |
02:31:20 | FromDiscord | <Elegantbeef> If you want to make it into a runnable example you'd want to emit a `call runnableExample` and put the result as the second parameter |
02:34:27 | FromDiscord | <geekrelief> thx, I need to tease this apart. |
02:37:12 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3JCX |
02:37:14 | FromDiscord | <Elegantbeef> There we go |
02:37:16 | FromDiscord | <geekrelief> are we supposed to run your example with nim doc? |
02:37:18 | FromDiscord | <geekrelief> ok.. |
02:37:19 | FromDiscord | <Elegantbeef> my silly way of dispatching this stuff |
02:37:32 | FromDiscord | <Elegantbeef> I mean if you use nimdoc you'll see the runnable example |
02:37:49 | FromDiscord | <Elegantbeef> The issue is without this new code is you'll get `getBody(foo)` in the runnable example |
02:37:52 | FromDiscord | <Elegantbeef> not `echo a` |
02:37:53 | FromDiscord | <geekrelief> the point of runnableExamples is to have the example in the docs right? |
02:38:00 | FromDiscord | <Elegantbeef> Yes |
02:38:05 | FromDiscord | <geekrelief> right |
02:38:24 | FromDiscord | <Elegantbeef> If you do it the way you did the macro wont be expanded for obvious reason |
02:38:30 | FromDiscord | <geekrelief> yeah 🙂 |
02:39:12 | FromDiscord | <Elegantbeef> And yes i love myself some `distinct void` |
02:39:49 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3JCY |
02:39:53 | FromDiscord | <Elegantbeef> Well y ea |
02:40:02 | FromDiscord | <Elegantbeef> do `foo.getBody(AsRunnableExample)` |
02:41:06 | FromDiscord | <geekrelief> ah ok, I didn't read the code.. I see the if check in getBody now |
02:41:29 | * | neurocyte0132889 quit (Ping timeout: 250 seconds) |
02:44:56 | FromDiscord | <geekrelief> hmm where do I put that `foo.getBody(AsRunnableExample)`? |
02:45:22 | FromDiscord | <Elegantbeef> Does it not work as a main statement? |
02:45:56 | FromDiscord | <geekrelief> nope |
02:46:38 | FromDiscord | <Elegantbeef> Guess we cannot programatically add runnable examples |
02:46:49 | FromDiscord | <geekrelief> I put `foo.getBody(AsRunnableExample)` at the bottom and ran `nim doc getBody.nim` and I don't see the example |
02:47:22 | FromDiscord | <Elegantbeef> I'm guessing nimdoc doesnt expand macros before looking for the examples |
02:49:47 | FromDiscord | <Elegantbeef> Which i guess makes sense given how runnableExamples arent apart of the ast |
02:49:48 | FromDiscord | <geekrelief> weird it seems like this should be possible... |
02:49:54 | FromDiscord | <geekrelief> yeah.. it is magic |
02:50:14 | FromDiscord | <geekrelief> well that kinda sucks.. 🙂 |
02:51:49 | FromDiscord | <Elegantbeef> I dont think it should be too hard to make work, but i need to think about it for a minute |
02:51:49 | FromDiscord | <geekrelief> Can you explain what was the idea behind replace nnkSym and nskParam with ident? |
02:52:00 | FromDiscord | <geekrelief> (edit) "replace" => "replacing" |
02:52:15 | FromDiscord | <Elegantbeef> If you dont replace it the `a` refers to the proc you got it from's `a` |
02:52:32 | FromDiscord | <Elegantbeef> So if you did `echo a` it'd error |
02:52:43 | FromDiscord | <Elegantbeef> Since `a` isnt in this scope and isnt a global varaible |
02:52:46 | FromDiscord | <Elegantbeef> variable\ |
02:53:36 | FromDiscord | <geekrelief> ok gotcha thanks |
02:53:39 | FromDiscord | <Elegantbeef> Eitherway i'd say check if there is an issue for this runnable example thing and if not make one |
02:54:50 | FromDiscord | <Elegantbeef> I'd say all code not inside a `runnableExample` call just needs to be expanded |
03:12:46 | * | rockcavera joined #nim |
03:12:46 | * | rockcavera quit (Changing host) |
03:12:46 | * | rockcavera joined #nim |
03:21:26 | FromDiscord | <geekrelief> @KatrinaKitten I was thinking my test code and `runnableExamples` are similar, but from reading about opinions of `runnableExamples` usage on the forum it's probably not a good a idea to put all your tests in there. So I was wondering where your code is coming from? |
03:23:59 | FromDiscord | <Elegantbeef> Oh this conversation |
03:24:46 | FromDiscord | <Elegantbeef> Tests are not examples, tests should ensure functionality and intentionally attempt to break code. Examples should ensure the information they're attempting to portray is accurate |
03:24:48 | FromDiscord | <Elegantbeef> Atleast that's my view |
03:38:39 | FromDiscord | <Rika> Tests can be examples |
03:40:27 | * | neceve quit (Ping timeout: 256 seconds) |
03:42:44 | * | arkurious quit (Quit: Leaving) |
04:01:17 | * | noeontheend quit (Ping timeout: 240 seconds) |
04:04:35 | FromDiscord | <KatrinaKitten> I would say that examples can be tests, but they shouldn't be your only tests, and tests typically shouldn't be examples. |
04:05:09 | FromDiscord | <KatrinaKitten> In reply to @geekrelief "<@!204718116020682753> I was thinking": In this case I was wanting to use the implementation of one proc in my library's API as the example for another. Nothing really to do with tests specifically 🙂 |
04:05:58 | FromDiscord | <KatrinaKitten> (edit) "examples." => "examples for the reasons Beef mentioned." |
05:37:06 | * | rockcavera quit (Remote host closed the connection) |
07:09:36 | * | anadahz quit (Ping timeout: 276 seconds) |
07:12:04 | * | anadahz joined #nim |
07:18:03 | * | anadahz quit (Ping timeout: 276 seconds) |
07:32:45 | * | Gustavo6046 quit (Quit: Leaving) |
07:33:56 | FromDiscord | <ValorZard> @KatrinaKitten what ARE your characters |
07:34:39 | * | anadahz joined #nim |
07:48:08 | FromDiscord | <KatrinaKitten> Hahaha, tyvm for asking ^^ Specifically D&D characters, if you want I can ramble a bit in #offtopic |
08:31:53 | FromDiscord | <glyh (Lyhokia)> Hello, I'm trying to convert Nim's grammar to a tree-sitter grammar, and I encounter this\: |
08:32:59 | FromDiscord | <glyh (Lyhokia)> sent a code paste, see https://play.nim-lang.org/#ix=3JDK |
08:34:57 | FromDiscord | <Elegantbeef> I dont know grammars but which part are you asking about? |
08:35:25 | FromDiscord | <glyh (Lyhokia)> the last symbol `\`, it means a ordered choice, but it doesn't have a branch following it |
08:35:59 | FromDiscord | <Elegantbeef> It looks like a typo, but i could be wrong |
08:36:01 | FromDiscord | <glyh (Lyhokia)> also, I don't understand the operator `\`, does this mean `-` (i.e. the except operator ) from EBNF? |
08:36:26 | FromDiscord | <glyh (Lyhokia)> @elegantbeef\:matrix.org Do you know who should I ask for these? Thanks a lot \:) |
08:36:44 | FromDiscord | <Elegantbeef> There is the internals chat |
08:37:35 | FromDiscord | <Elegantbeef> I do think the grammar for the cast is wrong with the `/` since like you said no choice after and also semantically there is no more information needed |
08:38:10 | FromDiscord | <glyh (Lyhokia)> Thanks XD |
08:39:20 | FromDiscord | <Elegantbeef> Cant say much about the `\` since i cannot read this well enough |
08:42:05 | FromDiscord | <glyh (Lyhokia)> Maybe I can ask someone else, yet, thanks for answering me. |
08:50:04 | NimEventer | New thread by Lyhokia: Questions on Nim's grammar, see https://forum.nim-lang.org/t/8745 |
08:59:19 | FromDiscord | <sOkam!> @ElegantBeef Do you know how I could find information about whether this object is fine for gdextension, or if I need to modify it? https://media.discordapp.net/attachments/371759389889003532/924949553864650802/unknown.png |
09:01:45 | FromDiscord | <Elegantbeef> I mean you need to look at the json + C code to figure that out |
09:02:13 | FromDiscord | <Elegantbeef> Afaict that just holds information for generation so it doesnt matter that much |
09:03:29 | FromDiscord | <Elegantbeef> Especially since the json node now holds all that information afaik |
09:04:47 | FromDiscord | <sOkam!> whats an "offset"? https://media.discordapp.net/attachments/371759389889003532/924950932301688852/unknown.png |
09:05:01 | FromDiscord | <Elegantbeef> The object's layout |
09:05:14 | FromDiscord | <sOkam!> which means... |
09:05:22 | FromDiscord | <Elegantbeef> offsets are byte offsets from the "Start" of the object |
09:06:08 | FromDiscord | <sOkam!> kk. so `y` is 8bytes ahead of `x` in the Vector2 type, right? |
09:06:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JDS |
09:07:01 | FromDiscord | <Elegantbeef> The offset is important for interop and assurances that your declaration matches theirs |
09:07:11 | FromDiscord | <sOkam!> Is it necessary to do something with that manually, or is that done automatically by the compiler? |
09:07:25 | FromDiscord | <sOkam!> In reply to @Elegantbeef "The offset is important": ah ic |
09:07:42 | FromDiscord | <Elegantbeef> You shouldnt need to assuming the types match |
09:08:37 | FromDiscord | <sOkam!> Good point, they might not. Didn't even cross my mind 🤔 |
09:09:13 | FromDiscord | <sOkam!> How do you define an offset for a type in nim? |
09:09:49 | FromDiscord | <Elegantbeef> I dont think you can |
09:09:55 | FromDiscord | <Elegantbeef> I might be wrong |
09:16:07 | FromDiscord | <Elegantbeef> I figure as long as the types match it should be fine |
09:16:13 | FromDiscord | <Elegantbeef> But i've been wrong before ;D |
09:19:47 | FromDiscord | <sOkam!> Oh, this looks SO much more approachable when nested this way 👀 https://media.discordapp.net/attachments/371759389889003532/924954704352542720/unknown.png |
09:20:38 | FromDiscord | <sOkam!> (edit) "nested" => "folded" |
09:30:22 | FromDiscord | <sOkam!> What's the difference between these?↵I get the 32bit vs 64bit option... but why the double? 🤔 https://media.discordapp.net/attachments/371759389889003532/924957369727868948/unknown.png |
10:58:58 | FromDiscord | <TryAngle> If a project is published on nimble, how would the update process look like? |
11:13:58 | FromDiscord | <Yardanico> just do your changes |
11:14:04 | FromDiscord | <Yardanico> and then tag a new release and bump the version in the nimble file |
11:14:07 | FromDiscord | <Yardanico> that's the proper way |
11:15:41 | * | xet7 joined #nim |
11:59:46 | * | jjido joined #nim |
12:01:57 | FromDiscord | <TryAngle> In reply to @Yardanico "that's the proper way": and then git commit + push it and the library will automatically be updated for existing nimble projects? |
12:02:19 | FromDiscord | <Yardanico> maybe you misunderstood how nimble works? |
12:02:35 | FromDiscord | <Yardanico> yes, you just git commit your changes, then when you're ready to publish a release you bump the nimble ver and tag a new git release |
12:02:43 | FromDiscord | <Yardanico> and then if users reinstall the package again it'll update |
12:02:49 | FromDiscord | <Yardanico> or if they specify a newer version in dependencies |
12:02:53 | FromDiscord | <Yardanico> (edit) "dependencies" => "requires" |
12:02:59 | FromDiscord | <Yardanico> nimble doesn't autoupdate |
12:03:44 | FromDiscord | <TryAngle> I see but I don't need to do like ↵nimble publish again after it's initial publish?↵that's actually pretty cool, full git driven 😳 |
12:03:51 | FromDiscord | <Yardanico> nonono |
12:03:54 | FromDiscord | <Yardanico> you don't need "nimble publish" |
12:04:01 | FromDiscord | <Yardanico> that's for publishing packages, not updating them |
12:04:12 | FromDiscord | <Yardanico> bumping nimble ver is just changing the version number in the .nimble file |
12:04:15 | FromDiscord | <Yardanico> and tags are a git feature |
12:04:41 | FromDiscord | <TryAngle> thanks 👍↵pretty cool |
12:25:06 | * | neceve joined #nim |
12:26:59 | FromDiscord | <auxym> is there a way to break early from an iterator? `return` is not allowed? |
12:33:07 | FromDiscord | <konsumlamm> `break`? |
12:33:21 | FromDiscord | <Yardanico> In reply to @auxym "is there a way": that's because iterators are inline by default |
12:33:24 | FromDiscord | <Yardanico> their code is just inlined |
12:33:39 | FromDiscord | <Yardanico> so you can't exactly "return" from an inline iterator |
12:33:50 | FromDiscord | <Solitude> In reply to @auxym "is there a way": thats hella cringe, but you can workaround by wrapping body of iterator in named block and using named break |
12:38:37 | FromDiscord | <auxym> I was thinking something like this actuallly, but return/break aren't allowed: https://play.nim-lang.org/ |
12:38:44 | FromDiscord | <auxym> oops |
12:39:00 | FromDiscord | <auxym> https://play.nim-lang.org/#ix=3JEB |
12:43:15 | FromDiscord | <Solitude> your iterator has no return type |
12:43:41 | FromDiscord | <Yardanico> @auxym |
12:43:46 | FromDiscord | <Yardanico> as solitude said |
12:43:49 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JEC |
12:44:55 | FromDiscord | <auxym> oh yeah, I get it now. I think I'll do something else 😄 |
12:46:56 | FromDiscord | <aschwarz> sent a long message, see http://ix.io/3JEE |
12:48:22 | FromDiscord | <Yardanico> you're using something from os at compile time |
12:48:31 | FromDiscord | <Yardanico> check your `const`, macros, `compileTime` procs |
12:48:40 | FromDiscord | <Yardanico> maybe you have a call to some OS routine in there left by accident |
12:48:59 | FromDiscord | <Yardanico> in nim `const` means that a variable is decided at compile-time, it doesn't change the scope |
12:49:13 | FromDiscord | <Yardanico> (edit) "in nim `const` means that a variable is decided at compile-time, it doesn't change the scope ... " added "rules in any way" |
12:53:41 | FromDiscord | <aschwarz> thank you, found it |
13:35:57 | * | rockcavera joined #nim |
13:35:57 | * | rockcavera quit (Changing host) |
13:35:57 | * | rockcavera joined #nim |
14:00:09 | FromDiscord | <eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3JEY |
14:00:30 | FromDiscord | <eyecon> But I get `Error: type mismatch: got <Table[aocscratch.Charpair, system.int], typedesc[Charpair], int>` in the body of `[]` |
14:00:34 | FromDiscord | <eyecon> Any ideas? |
14:01:35 | FromDiscord | <eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3JF3 |
14:02:06 | * | drewr joined #nim |
14:04:19 | * | arkurious joined #nim |
14:08:56 | FromDiscord | <eyecon> Got it |
14:09:06 | FromDiscord | <eyecon> Sorry |
14:09:20 | FromDiscord | <eyecon> I put `A` instead of `key` |
14:10:00 | * | sagax quit (Quit: Konversation terminated!) |
14:12:14 | * | sagax joined #nim |
14:14:28 | FromDiscord | <sOkam!> Total noob Q, but don't seem to understand the manual about it.↵What should I use as the input of `random.rand( ... )`?↵The manual also says that I need to call `random.randomize()` once. But do I need to do something with the output of that one? is that the value I need to feed to rand()? |
14:15:33 | FromDiscord | <sOkam!> (edit) ")`?↵The" => ")` if I want to simulate the behavior of python's random()?↵The" |
14:16:16 | * | Gustavo6046 joined #nim |
14:25:17 | * | drewr quit (Ping timeout: 240 seconds) |
14:33:57 | * | drewr joined #nim |
14:42:23 | * | xet7_ joined #nim |
14:42:40 | FromDiscord | <yledu> randomize is what is needed to start a pseudo random sequence, it "seeds" the sequence. Then rand(n) THEN gives you a random value between 0 and n : if you give it a float, it gives you a float, if you give it an int, it gives you an int, etc. (overloading) |
14:44:02 | FromDiscord | <yledu> @sOkam! I'm a noob too there, but it turns out I tried rand early on. |
14:44:57 | * | drewr quit (Ping timeout: 240 seconds) |
14:45:42 | * | xet7 quit (Ping timeout: 260 seconds) |
14:54:42 | * | tinystoat is now known as tinytoast |
15:04:07 | FromDiscord | <yledu> What makes it difficult to remove forward declaration in Nim ? It looks like a dirty workaround, but perhaps is it necessary because of some other feature of Nim ? |
15:13:50 | * | drewr joined #nim |
15:16:41 | * | xet7_ quit (Quit: Leaving) |
15:17:39 | * | neurocyte0132889 joined #nim |
15:17:39 | * | neurocyte0132889 quit (Changing host) |
15:17:39 | * | neurocyte0132889 joined #nim |
15:20:41 | * | anadahz quit (Remote host closed the connection) |
15:26:16 | FromDiscord | <eyecon> Recursive types? |
15:26:44 | FromDiscord | <eyecon> Just guessing |
15:26:51 | * | anadahz joined #nim |
15:28:57 | * | drewr quit (Ping timeout: 240 seconds) |
15:30:21 | FromDiscord | <haxscramper> recursive procs |
15:30:37 | FromDiscord | <haxscramper> also compiler is a single-pass IIRC |
15:31:04 | FromDiscord | <haxscramper> Meaning it processes the file from top to bottom in one go |
15:34:11 | * | drewr joined #nim |
15:39:22 | * | drewr quit (Ping timeout: 260 seconds) |
15:43:13 | * | perro joined #nim |
16:28:46 | FromDiscord | <TryAngle> what is the difference between a proc and a function?↵I've read this impure vs pure thingy with haskell(which I never used so this is new for me still) and as far as I understand impure functions (procs) can have sideeffects / undefined behaviour etc. while pure functions can be assumed to be safe.↵So should I always try to make my proc a function if possible? What is the pragma {. noSideEffects.} is this the same? |
16:34:42 | FromDiscord | <Rika> Functions can still have unsafe behaviour, it just has to be pure unsafe behaviour lol |
16:39:01 | FromDiscord | <TryAngle> lol |
16:52:06 | FromDiscord | <Solitude> In reply to @TryAngle "what is the difference": function cant access non-const variable outside of its scope |
16:57:09 | FromDiscord | <Yardanico> also it can't modify any non-`var` arguments unless they're ref |
16:57:18 | FromDiscord | <Yardanico> and with strictFunc it can't modify ref too |
16:57:26 | FromDiscord | <Yardanico> (unless you pass it as `var`) |
16:57:34 | FromDiscord | <krisppurg> sent a long message, see http://ix.io/3JGd |
17:07:09 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JGj |
17:07:47 | FromDiscord | <TryAngle> and I get the `Error: type expected, but got: T` |
17:09:07 | FromDiscord | <0ffh> If a converter is used on a literal or constant, will it be done at compile time or is it purely a runtime operation? |
17:09:28 | FromDiscord | <TryAngle> (edit) "T`" => "T`↵So this seems to be a bug with module rexports, contained in templates???" |
17:10:48 | FromDiscord | <krisppurg> In reply to @krisppurg "Hey guys, I have": also cc: @treeform (sorry for ping) |
17:12:30 | FromDiscord | <Solitude> In reply to @0ffh "If a *converter* is": its runtime |
17:13:25 | NimEventer | New thread by Samsamros: Error installing nimlsp, and getting the neovim plugin to work, see https://forum.nim-lang.org/t/8747 |
17:13:25 | FromDiscord | <Solitude> would be nice if they supported {.compiletime.} but its easier to just avoid them |
17:13:43 | FromDiscord | <0ffh> In reply to @Solitude "would be nice if": Okay, thanks, I'll do that! |
17:14:38 | FromDiscord | <Solitude> you cant even overload them with `static`... |
17:16:13 | FromDiscord | <TryAngle> In reply to @Solitude "you cant even overload": wait so writing a converter for↵[static[int], T] is not possible 😳 ? |
17:16:29 | FromDiscord | <TryAngle> or do u do just [I, T] then? |
17:20:58 | * | Gustavo6046 quit (Quit: Leaving) |
17:21:09 | FromDiscord | <Solitude> its not possible to write a converter |
17:21:13 | FromDiscord | <Solitude> do not try it |
17:24:13 | * | def- quit (Quit: -) |
17:26:26 | * | def- joined #nim |
17:45:54 | FromDiscord | <MD> Is there a performance decrease when wrapping a C library and using it in Nim? |
17:46:54 | FromDiscord | <Yardanico> if you just use the bindings the "raw" way without any higher-level Nim functions, then generally no |
17:48:49 | FromDiscord | <MD> Nice, thanks! |
17:57:50 | FromDiscord | <frankzig> ? |
17:57:52 | FromDiscord | <frankzig> sent a code paste, see https://play.nim-lang.org/#ix=3JGz |
17:58:05 | FromDiscord | <Shiba> i hope i can get better at nim since i t's my first time using space like language and iam totaly new to the syntax and the whole libaries wrapping process is hard to understand |
17:59:09 | FromDiscord | <Shiba> i also finished nim basics🥳 |
18:02:26 | FromDiscord | <Yardanico> In reply to @frankzig "is it possible to": yes, but not like this |
18:02:42 | FromDiscord | <Yardanico> hmm |
18:02:54 | FromDiscord | <Yardanico> not sure how to do it so that you it looks like `obj.test[]` and you get `obj` in `[]` |
18:03:00 | FromDiscord | <Yardanico> (edit) removed "you" |
18:09:11 | FromDiscord | <Shiba> @Yardanico when you said nim compiler keeps compiled scripts and compiles only modified ones , is that a thing you enable |
18:10:17 | FromDiscord | <Yardanico> no, it's enabled by default |
18:10:25 | FromDiscord | <Yardanico> the compiled C files are cached, so they're not recompiled if they didn't change |
18:29:54 | FromDiscord | <frankzig> In reply to @Yardanico "not sure how to": I have an object with a weird representation, I would like to let users pretend it is a common object made of arrays and stuff |
18:30:05 | FromDiscord | <frankzig> but maybe this kind of stuff cannot be done... |
18:31:05 | FromDiscord | <Yardanico> In reply to @frankzig "but maybe this kind": i think you can do it if you override the . operator |
18:31:07 | FromDiscord | <Yardanico> maybe |
18:31:31 | FromDiscord | <frankzig> ah... didnt know I could do that |
18:32:08 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual_experimental.html#special-operators-dot-operators |
18:33:42 | FromDiscord | <frankzig> that doesnt look like it would compose with [] |
18:34:46 | FromDiscord | <Yardanico> why so? |
18:34:49 | FromDiscord | <Yardanico> lemme try |
18:37:21 | FromDiscord | <frankzig> sent a code paste, see https://play.nim-lang.org/#ix=3JGK |
18:37:38 | FromDiscord | <Yardanico> i mean i know another way that'll work 100%, but it's very very dirty |
18:37:44 | FromDiscord | <Yardanico> so i'll try the cleaner way first :) |
18:38:20 | FromDiscord | <frankzig> In reply to @Yardanico "so i'll try the": Ohhh thank you <3, dirty or clean, I'll be happy anyway |
18:41:34 | FromDiscord | <Yardanico> In reply to @frankzig "Ohhh thank you <3,": yeah this is a bit less dirty and with dotOperators: |
18:41:41 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JGL |
18:41:57 | FromDiscord | <Yardanico> this is using another hidden array, but you probably get the idea |
18:42:08 | FromDiscord | <Yardanico> but with setters it might be a bit complicated |
18:42:15 | FromDiscord | <Yardanico> hmm this is not exactly what you want, yeah |
18:44:29 | FromDiscord | <Yardanico> i'll experiment some more |
18:44:55 | FromDiscord | <Yardanico> ahh right |
18:48:32 | FromDiscord | <Yardanico> @frankzig it's simpler than I thought, but yeah: |
18:48:50 | FromDiscord | <Yardanico> lemme try to fix that |
18:48:52 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JGQ |
18:50:04 | FromDiscord | <Yardanico> @frankzig can you show more examples of how you think it should work? |
18:50:09 | FromDiscord | <Yardanico> usage examples i mean |
18:53:23 | FromDiscord | <frankzig> sent a code paste, see https://play.nim-lang.org/#ix=3JGT |
18:53:55 | FromDiscord | <frankzig> this is what I want to build |
19:01:16 | FromDiscord | <Shiba> what does those values mean https://media.discordapp.net/attachments/371759389889003532/925101037491220511/Capture.PNG |
19:02:04 | FromDiscord | <Yardanico> how many lines the nim compiler compiled, how long it took, and how much memory did the nim compiler use |
19:02:58 | FromDiscord | <Shiba> that aloot for a one line hello world program |
19:03:27 | FromDiscord | <Yardanico> no |
19:03:29 | FromDiscord | <Shiba> i guess if i can get an ssd , i can boost the compile time |
19:03:29 | FromDiscord | <Yardanico> it's fine |
19:03:35 | FromDiscord | <Yardanico> that of course |
19:07:48 | FromDiscord | <Yardanico> @frankzig one big problem is that I don't know how to do it without `ref` - it's used here so the state is saved with []= and the likes |
19:07:58 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JGY |
19:08:03 | FromDiscord | <Yardanico> and yes maybe there's a much better way of doing this |
19:08:52 | FromDiscord | <Yardanico> you can remove the `when` in [] and []= since it's only `hall` with 1 index and `rooms` with 2 indexes, so nim will call different procedures nonetheless |
19:10:03 | FromDiscord | <Yardanico> wait maybe I can simplify it |
19:10:23 | FromDiscord | <Yardanico> or not |
19:10:43 | FromDiscord | <Yardanico> i mean you can probably make a macro that'll allow doing all of this without overhead |
19:16:39 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3JH0 |
19:17:24 | FromDiscord | <treeform> I added this code: https://github.com/treeform/jsony/commit/11df6999829a0fa51af353182d35613c9afbf39f |
19:17:35 | FromDiscord | <treeform> so if you update to most recent jsony you don't even need a parseHook |
19:24:58 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:25:34 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3JH1 |
19:26:42 | FromDiscord | <frankzig> sent a code paste, see https://play.nim-lang.org/#ix=3JH2 |
19:28:47 | FromDiscord | <Yardanico> there might a better way, i just wrote how one of the ways of how to make it work |
19:29:23 | FromDiscord | <haxscramper> @Rika, @Yardanico and other people who asked about nimskull matrix/discord space - we have finally merged code of conduct & related guidelines, so if you are interested we are open at https://matrix.to/#/#nimworks:envs.net |
19:30:07 | FromDiscord | <treeform> In reply to @krisppurg "also cc: <@!107140179025735680> (sorry": This is how I would do it: https://gist.github.com/treeform/2b1a1ba7a35ad3166cdb2dab663236c4 |
19:31:10 | FromDiscord | <haxscramper> I think on matrix side it was [enthus1ast](https://matrix.to/#/@sn0re:matrix.code0.xyz) |
19:51:37 | FromDiscord | <planetis> i think =sink .error is ignored |
19:52:05 | FromDiscord | <Yardanico> maybe it didn't sink? |
19:53:01 | FromDiscord | <planetis> no i also did =copy .error |
19:53:13 | FromDiscord | <planetis> and used move explicitly |
19:58:31 | * | xet7 joined #nim |
19:59:42 | FromDiscord | <planetis> https://play.nim-lang.org/#ix=3JHb |
20:01:30 | FromDiscord | <Yardanico> @planetis as I Said |
20:01:32 | FromDiscord | <Yardanico> (edit) "Said" => "said" |
20:01:36 | FromDiscord | <Yardanico> in this case your sink and copy do not trigger |
20:01:42 | FromDiscord | <Yardanico> i changed error to echo and compiled with arc |
20:01:45 | FromDiscord | <Yardanico> and nothing got printed out |
20:03:59 | FromDiscord | <planetis> why they don't? |
20:04:37 | FromDiscord | <planetis> move the var g1 = g line above the g.tick and it doesn't compile |
20:04:54 | FromDiscord | <planetis> g.update |
20:05:28 | FromDiscord | <Yardanico> yes, and what is the issue here? |
20:08:44 | FromDiscord | <planetis> the compiler should prevent assignments `var g1 = g` code from compiling |
20:09:08 | FromDiscord | <planetis> it used to work that way before if i am not mistaken |
20:10:19 | FromDiscord | <Yardanico> but it prevents them now too |
20:10:31 | FromDiscord | <Yardanico> in your original code snippet g2 was probably just not compiled at all |
20:10:53 | FromDiscord | <Yardanico> if you move ` var g2 = g` above g.update() as you said it doesn't compile |
20:10:57 | FromDiscord | <krisppurg> In reply to @treeform "very strange code, you": Wheres the parsing json twice?↵↵The reason why I did ($data) is because when making a discord api http request I parse string as json as long as the content type is application json and with gateway same principle. So it would be pretty long rewriting from json to jsony. I'd rather finish the jsony rewrite with objects first then either possibly rewrite. |
20:11:17 | FromDiscord | <Yardanico> In reply to @krisppurg "Wheres the parsing json": ($data).fromJson(Activity) |
20:11:29 | FromDiscord | <Yardanico> you take data which is JsonNode, convert it to string, then parse to a json |
20:11:52 | FromDiscord | <krisppurg> In reply to @treeform "Jsony already handles options,": This was temporary btw when there was the tuple bug I updated it |
20:12:55 | NimEventer | New post on r/nim by Halpmeppl: Difference between ref and a var inside proc definition, see https://reddit.com/r/nim/comments/rpw5xf/difference_between_ref_and_a_var_inside_proc/ |
20:13:58 | FromDiscord | <planetis> did I messed up the assert?↵(@Yardanico) |
20:14:12 | FromDiscord | <Yardanico> ??? |
20:14:18 | FromDiscord | <planetis> ...nah it's okay |
20:14:37 | FromDiscord | <Yardanico> in your code you did ` var g2 = g` |
20:14:41 | FromDiscord | <Yardanico> followed by echo hello |
20:14:46 | FromDiscord | <Yardanico> so that probably just didn't get compiled it |
20:14:53 | FromDiscord | <Yardanico> because it doesn't change the program's logic it's fine |
20:15:33 | FromDiscord | <planetis> well expandarc shows its there |
20:16:12 | FromDiscord | <Yardanico> well expandArc is Nim side |
20:16:17 | FromDiscord | <Yardanico> before the backend |
20:16:47 | FromDiscord | <tbrekalo> Is there a way to create distinct type from `uint64` and borrow all of its functionality while not rewriting operators using borrow pragma |
20:17:05 | FromDiscord | <planetis> i messed up the assert message 🤣 |
20:17:12 | FromDiscord | <tbrekalo> I saw the example on manual page but it's not quite clear to me how to make it work |
20:18:15 | FromDiscord | <TryAngle> https://github.com/TriedAngle/trymisc/blob/88dd4d97994c9c81b551615a00221a24461e12d8/src/trymisc/math/utils.nim#L3↵hmmm the moment I move the imports `salgebra` or `algebra` above the `template implProc()` ↵I get the following error when `salgebra` is above the template: `Error: the 'T' modifier can be used only with imported types`↵and this one when both or `algebra` is above: `Error: type expected, but got: T` |
20:18:58 | FromDiscord | <tbrekalo> I really do have to write all those templates by hand?↵↵https://nim-lang.org/docs/manual.html#types-distinct-type ? |
20:19:09 | FromDiscord | <TryAngle> (edit) "https://github.com/TriedAngle/trymisc/blob/88dd4d97994c9c81b551615a00221a24461e12d8/src/trymisc/math/utils.nim#L3↵hmmm the moment I move the imports `salgebra` or `algebra` above the `template implProc()` ↵I get the following error when `salgebra` is above the template: `Error: the 'T' modifier can be used only with imported types`↵and this one when both or `algebra` is above: `Error: type expected, but got: T`" => "sent |
20:19:18 | FromDiscord | <TryAngle> (edit) "http://ix.io/3JHh" => "http://ix.io/3JHi" |
20:20:28 | FromDiscord | <planetis> @Yardanico compiling with v1 shows a compile error, it broke at 1.2.0 |
20:20:55 | FromDiscord | <Yardanico> can you show the code that fails for you? |
20:23:13 | FromDiscord | <planetis> the same one\: https://play.nim-lang.org/#ix=3JHb |
20:28:06 | * | Colt quit (Remote host closed the connection) |
20:28:32 | * | Colt joined #nim |
20:30:04 | * | Colt quit (Read error: Connection reset by peer) |
20:35:05 | FromDiscord | <krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=3JHm |
20:35:17 | * | neurocyte0132889 quit (Ping timeout: 240 seconds) |
20:35:22 | FromDiscord | <krisppurg> (edit) "https://play.nim-lang.org/#ix=3JHm" => "https://play.nim-lang.org/#ix=3JHn" |
20:39:03 | FromDiscord | <tbrekalo> https://play.nim-lang.org/#ix=3JHp so this is a known compiler issue? |
20:42:46 | FromDiscord | <Solitude> In reply to @tbrekalo "https://play.nim-lang.org/#ix=3JHp so this is": you can use borrow only for distinct types |
20:42:56 | FromDiscord | <Solitude> there is no point otherwise |
20:43:13 | FromDiscord | <tbrekalo> sorry; wrong link |
20:44:00 | FromDiscord | <tbrekalo> I have similar snippet in my project and it breaks |
20:45:28 | FromDiscord | <tbrekalo> nvm; solved the issue; it was due to imports |
20:45:46 | FromDiscord | <tbrekalo> btw. are there any success stories of nim in production?↵could someone link an example |
20:46:15 | FromDiscord | <treeform> In reply to @krisppurg "`web` and `mobile` are": your json data is like that? `"client_status": {"desktop": "idle"},` -> `clientStatus: ("", "idle", "")` |
20:46:29 | FromDiscord | <treeform> oh you set them in new hook |
20:46:55 | FromDiscord | <treeform> you should use a `postHook` or `newHook` right on the tuple |
20:48:55 | FromDiscord | <treeform> hmm I don't do `newHook` for tuples |
20:51:21 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3JHs |
20:52:00 | FromDiscord | <krisppurg> I was thinking of that, but for other objects like slash commands (I wont rewrite them yet since it's going to be a lot of work) |
20:52:12 | FromDiscord | <krisppurg> (edit) "I was thinking of that, but for other objects like slash commands (I wont rewrite them yet since it's going to be a lot of work) ... " added "they have fields that should be defaulted to true" |
20:52:28 | FromDiscord | <krisppurg> especially types as well |
20:52:37 | FromDiscord | <krisppurg> (edit) "types" => "`type`/`kind`s" |
20:54:22 | * | xet7 quit (Remote host closed the connection) |
20:58:48 | FromDiscord | <krisppurg> https://play.nim-lang.org/#ix=3JHw |
21:00:36 | FromDiscord | <krisppurg> again same issue@treeform |
21:03:04 | * | xet7 joined #nim |
21:24:16 | NimEventer | New thread by Isofruit: Is the DbTypeKind in db_sqlite always DbTypeKind.dbNull ? If yes, why?, see https://forum.nim-lang.org/t/8748 |
21:37:17 | * | drewr joined #nim |
21:49:57 | * | drewr quit (Ping timeout: 240 seconds) |
22:00:56 | FromDiscord | <Elegantbeef> @TryAngleUhh nothing looks like it should error there, is there a clonable example anyway? |
22:01:21 | * | drewr joined #nim |
22:05:36 | * | drewr quit (Client Quit) |
22:13:46 | FromDiscord | <TryAngle> In reply to @Elegantbeef "<@147447489316913152>Uhh nothing looks like": Idk the best I could find out is either clone the repo and run tutils under test or try copy the module structure with also std/math |
22:15:19 | FromDiscord | <TryAngle> It's weird because if I implement it manually without any templates it works |
22:15:40 | FromDiscord | <Elegantbeef> Ok so where is the repo |
22:16:03 | * | jjido joined #nim |
22:51:14 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3JI3 |
22:52:18 | FromDiscord | <Elegantbeef> Change `proc` to template |
22:52:38 | FromDiscord | <Elegantbeef> The issue with a proc is the code is generated at declaration so it already has `echo msg` |
22:53:32 | FromDiscord | <geekrelief> hmm, yeah I changed the `when` to `if` and it works.. |
22:53:49 | FromDiscord | <Elegantbeef> That also works |
22:53:56 | FromDiscord | <geekrelief> thanks! |
23:04:31 | FromDiscord | <Shiba> Can someome tell me what is his average compile time on first try |
23:05:02 | FromDiscord | <Elegantbeef> Hello world compiled in 2.38s |
23:05:07 | FromDiscord | <Elegantbeef> .238s\ |
23:05:18 | FromDiscord | <Elegantbeef> release build in .279s |
23:05:35 | FromDiscord | <Elegantbeef> danger build + LTO 1.1s |
23:06:27 | FromDiscord | <Elegantbeef> My 3D game on a danger build took 11s |
23:07:37 | FromDiscord | <Elegantbeef> The compiler/tooling takes around 2minutes to compile, so it's relatively quick imo |
23:25:13 | * | xet7 quit (Remote host closed the connection) |
23:26:06 | * | xet7 joined #nim |
23:34:08 | FromDiscord | <sOkam!> In reply to @Elegantbeef "My 3D game on": self-made engine? |
23:35:02 | FromDiscord | <Elegantbeef> "Engine" yes |
23:35:30 | FromDiscord | <sOkam!> was looking for some simple 3D engine/framework to toy with, but didn't find anything too exciting |
23:35:55 | FromDiscord | <sOkam!> any you would recommend? or better to just go with nimgl/sdl? |
23:35:56 | FromDiscord | <Elegantbeef> Mine is super basic, i expand it as i need it for my project |
23:36:20 | FromDiscord | <Elegantbeef> There isnt much in the way of good 3D engines for Nim |
23:36:38 | FromDiscord | <sOkam!> ic |
23:36:48 | FromDiscord | <sOkam!> what libs are you using for yours? |
23:36:53 | FromDiscord | <Elegantbeef> https://github.com/abisxir/alasgar is interesting, though havent used it |
23:37:02 | FromDiscord | <Elegantbeef> I'm using Opengl/Sdl/Assimp |
23:37:28 | FromDiscord | <sOkam!> looked into nimgl? you think its worth it, or just go with sdl? |
23:38:17 | FromDiscord | <Elegantbeef> Nimgl doesnt really offer much that i can tell over the raw bindings |
23:39:08 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d my undoccument non production ready framework 😀 |
23:39:17 | FromDiscord | <Elegantbeef> undocumented\ |
23:41:47 | FromDiscord | <sOkam!> nice! ty, will look into them 🙂 |
23:41:49 | * | Guest2440 quit (Quit: Konversation terminated!) |
23:46:20 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:55:37 | * | kayabaNerve quit (Ping timeout: 240 seconds) |
23:55:39 | FromDiscord | <Shiba> In reply to @Elegantbeef "My 3D game on": 11 s to just test a thing, this is insane |
23:55:48 | FromDiscord | <Elegantbeef> danger |
23:55:54 | FromDiscord | <Elegantbeef> That's an optimized release build |
23:57:46 | FromDiscord | <Elegantbeef> It's around 3s compile time in a debug build |
23:58:06 | FromDiscord | <Shiba> On first time i compile hello world it's take a solid 4 secons and then. It's drops to 400ms. Does that happen fo you too? |
23:58:28 | FromDiscord | <Elegantbeef> Yes that's to be expected since it doesnt recompile if no changes |
23:59:12 | FromDiscord | <Shiba> Mine is a dual core pentium |
23:59:25 | FromDiscord | <Shiba> (edit) "Mine" => "My cpu" |