<< 27-12-2021 >>

00:00:04FromDiscord<retkid> heres hoping every iteration it can return to 0 memory usage
00:00:14FromDiscord<retkid> otherwise this will get very annoying
00:00:16*tk quit (Quit: Well, this is unexpected.)
00:00:21FromDiscord<Yardanico> use ORC then
00:00:30FromDiscord<Yardanico> and be very careful with code that does allocations
00:00:41*tk joined #nim
00:00:45FromDiscord<Yardanico> and if you have cyclic types, do GC_fullCollect() each iteration with ORC
00:00:55FromDiscord<retkid> its not efficiency problem its a scale problem
00:00:57FromDiscord<Yardanico> granted GC_fullCollect() will also probably work if you use refc
00:01:03FromDiscord<Yardanico> In reply to @retkid "its not efficiency problem": buy more ram
00:01:12FromDiscord<retkid> i has no monies
00:01:42FromDiscord<retkid> actually i compiled with -mm:arc and now it uses like half the ram
00:01:43FromDiscord<retkid> nice
00:01:55FromDiscord<Yardanico> just be careful with arc
00:01:59FromDiscord<Yardanico> if you have any cyclic types they'll leak
00:02:12FromDiscord<Yardanico> so --mm:orc is a bit better if you're not 100% sure you don't have cycles
00:02:26FromDiscord<retkid> cylic types?
00:02:32FromDiscord<retkid> like
00:02:47FromDiscord<Yardanico> cyclic
00:02:49FromDiscord<retkid> a type made up of other types which are made up of other types?
00:02:51FromDiscord<Yardanico> no
00:03:12FromDiscord<Yardanico> now you have a cycle
00:03:14FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JCk
00:03:30FromDiscord<Yardanico> and under ARC it'll leak (granted, in this simple example the compiler will warn you about the cycle)
00:03:31FromDiscord<retkid> yea i dont have that
00:03:40FromDiscord<Yardanico> well you should be sure the libs you use don't have that
00:03:47FromDiscord<Yardanico> also if you use async you must use orc
00:04:00FromDiscord<retkid> no async here
00:04:06FromDiscord<retkid> only thtrading
00:04:23FromDiscord<retkid> also yea damn, i hit max mem and it died :(
00:04:34FromDiscord<retkid> (edit) "thtrading" => "threading"
00:04:42FromDiscord<retkid> welp
00:04:42FromDiscord<Yardanico> as i said, maybe try to optimize memory usage?
00:04:49FromDiscord<Yardanico> e.g. `{.packed.}` for types, etc
00:04:53FromDiscord<Yardanico> i can't say anything without the code
00:05:13FromDiscord<retkid> theres stuff i can do, like pass strings instead of sequences and optimize for that but ugh
00:05:26FromDiscord<retkid> i'look for obvious problems
00:06:05FromDiscord<retkid> running 1 is fine, but running 500 at the same time causes problems
00:06:39FromDiscord<Yardanico> run 480
00:06:57FromDiscord<Yardanico> also I surely hope you're not using threads for http requests
00:07:08FromDiscord<retkid> I did that before!
00:07:10FromDiscord<retkid> bad idea
00:07:26FromDiscord<retkid> stuff breaks
00:07:30FromDiscord<retkid> this is just math
00:07:33FromDiscord<retkid> (edit) "this is just math ... " added "and generations"
00:10:07FromDiscord<retkid> wow arc really did completely slash the memory usage
00:10:31FromDiscord<retkid> i might be able to run 2000 now
00:12:09FromDiscord<retkid> when i run with danger i keep getting out of memory, from some pointers i have passing around?
00:24:34NimEventerNew thread by Xioren: Proper way to open and close async files?, see https://forum.nim-lang.org/t/8744
00:30:33FromDiscord<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:11FromDiscord<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:15FromDiscord<geekrelief> In reply to @KatrinaKitten "Curious, is there a": That sounds like a job for a macro.
02:04:39FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3JCL
02:11:30FromDiscord<Elegantbeef> Only issue with that geek is it doesnt emit `echo "foo world"` in the docs 😛
02:11:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JCN
02:13:34FromDiscord<geekrelief> good point 🙂 lol
02:14:12FromDiscord<geekrelief> I guess you need to wrap the output
02:14:35FromDiscord<Elegantbeef> Replace all syms that are `nskParam` with `nnkIdent`
02:18:00*drewr joined #nim
02:21:57FromDiscord<geekrelief> In reply to @Elegantbeef "Replace all syms that": Can you elaborate on that?
02:22:08FromDiscord<Elegantbeef> I'll provide an example
02:22:48FromDiscord<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:59FromDiscord<KatrinaKitten> Would be pretty neat to figure out how tough.
02:23:05FromDiscord<KatrinaKitten> (edit) "tough." => "though."
02:24:57*drewr quit (Ping timeout: 240 seconds)
02:25:04FromDiscord<geekrelief> In reply to @KatrinaKitten "Would be pretty neat": no worries, figuring this out would be useful for me too
02:25:39FromDiscord<geekrelief> I noticed my tests and runnableExamples are basically the same thing.
02:29:24FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3JCT
02:31:20FromDiscord<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:27FromDiscord<geekrelief> thx, I need to tease this apart.
02:37:12FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3JCX
02:37:14FromDiscord<Elegantbeef> There we go
02:37:16FromDiscord<geekrelief> are we supposed to run your example with nim doc?
02:37:18FromDiscord<geekrelief> ok..
02:37:19FromDiscord<Elegantbeef> my silly way of dispatching this stuff
02:37:32FromDiscord<Elegantbeef> I mean if you use nimdoc you'll see the runnable example
02:37:49FromDiscord<Elegantbeef> The issue is without this new code is you'll get `getBody(foo)` in the runnable example
02:37:52FromDiscord<Elegantbeef> not `echo a`
02:37:53FromDiscord<geekrelief> the point of runnableExamples is to have the example in the docs right?
02:38:00FromDiscord<Elegantbeef> Yes
02:38:05FromDiscord<geekrelief> right
02:38:24FromDiscord<Elegantbeef> If you do it the way you did the macro wont be expanded for obvious reason
02:38:30FromDiscord<geekrelief> yeah 🙂
02:39:12FromDiscord<Elegantbeef> And yes i love myself some `distinct void`
02:39:49FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3JCY
02:39:53FromDiscord<Elegantbeef> Well y ea
02:40:02FromDiscord<Elegantbeef> do `foo.getBody(AsRunnableExample)`
02:41:06FromDiscord<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:56FromDiscord<geekrelief> hmm where do I put that `foo.getBody(AsRunnableExample)`?
02:45:22FromDiscord<Elegantbeef> Does it not work as a main statement?
02:45:56FromDiscord<geekrelief> nope
02:46:38FromDiscord<Elegantbeef> Guess we cannot programatically add runnable examples
02:46:49FromDiscord<geekrelief> I put `foo.getBody(AsRunnableExample)` at the bottom and ran `nim doc getBody.nim` and I don't see the example
02:47:22FromDiscord<Elegantbeef> I'm guessing nimdoc doesnt expand macros before looking for the examples
02:49:47FromDiscord<Elegantbeef> Which i guess makes sense given how runnableExamples arent apart of the ast
02:49:48FromDiscord<geekrelief> weird it seems like this should be possible...
02:49:54FromDiscord<geekrelief> yeah.. it is magic
02:50:14FromDiscord<geekrelief> well that kinda sucks.. 🙂
02:51:49FromDiscord<Elegantbeef> I dont think it should be too hard to make work, but i need to think about it for a minute
02:51:49FromDiscord<geekrelief> Can you explain what was the idea behind replace nnkSym and nskParam with ident?
02:52:00FromDiscord<geekrelief> (edit) "replace" => "replacing"
02:52:15FromDiscord<Elegantbeef> If you dont replace it the `a` refers to the proc you got it from's `a`
02:52:32FromDiscord<Elegantbeef> So if you did `echo a` it'd error
02:52:43FromDiscord<Elegantbeef> Since `a` isnt in this scope and isnt a global varaible
02:52:46FromDiscord<Elegantbeef> variable\
02:53:36FromDiscord<geekrelief> ok gotcha thanks
02:53:39FromDiscord<Elegantbeef> Eitherway i'd say check if there is an issue for this runnable example thing and if not make one
02:54:50FromDiscord<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:26FromDiscord<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:59FromDiscord<Elegantbeef> Oh this conversation
03:24:46FromDiscord<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:48FromDiscord<Elegantbeef> Atleast that's my view
03:38:39FromDiscord<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:35FromDiscord<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:09FromDiscord<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:58FromDiscord<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:56FromDiscord<ValorZard> @KatrinaKitten what ARE your characters
07:34:39*anadahz joined #nim
07:48:08FromDiscord<KatrinaKitten> Hahaha, tyvm for asking ^^ Specifically D&D characters, if you want I can ramble a bit in #offtopic
08:31:53FromDiscord<glyh (Lyhokia)> Hello, I'm trying to convert Nim's grammar to a tree-sitter grammar, and I encounter this\:
08:32:59FromDiscord<glyh (Lyhokia)> sent a code paste, see https://play.nim-lang.org/#ix=3JDK
08:34:57FromDiscord<Elegantbeef> I dont know grammars but which part are you asking about?
08:35:25FromDiscord<glyh (Lyhokia)> the last symbol `\`, it means a ordered choice, but it doesn't have a branch following it
08:35:59FromDiscord<Elegantbeef> It looks like a typo, but i could be wrong
08:36:01FromDiscord<glyh (Lyhokia)> also, I don't understand the operator `\`, does this mean `-` (i.e. the except operator ) from EBNF?
08:36:26FromDiscord<glyh (Lyhokia)> @elegantbeef\:matrix.org Do you know who should I ask for these? Thanks a lot \:)
08:36:44FromDiscord<Elegantbeef> There is the internals chat
08:37:35FromDiscord<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:10FromDiscord<glyh (Lyhokia)> Thanks XD
08:39:20FromDiscord<Elegantbeef> Cant say much about the `\` since i cannot read this well enough
08:42:05FromDiscord<glyh (Lyhokia)> Maybe I can ask someone else, yet, thanks for answering me.
08:50:04NimEventerNew thread by Lyhokia: Questions on Nim's grammar, see https://forum.nim-lang.org/t/8745
08:59:19FromDiscord<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:45FromDiscord<Elegantbeef> I mean you need to look at the json + C code to figure that out
09:02:13FromDiscord<Elegantbeef> Afaict that just holds information for generation so it doesnt matter that much
09:03:29FromDiscord<Elegantbeef> Especially since the json node now holds all that information afaik
09:04:47FromDiscord<sOkam!> whats an "offset"? https://media.discordapp.net/attachments/371759389889003532/924950932301688852/unknown.png
09:05:01FromDiscord<Elegantbeef> The object's layout
09:05:14FromDiscord<sOkam!> which means...
09:05:22FromDiscord<Elegantbeef> offsets are byte offsets from the "Start" of the object
09:06:08FromDiscord<sOkam!> kk. so `y` is 8bytes ahead of `x` in the Vector2 type, right?
09:06:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JDS
09:07:01FromDiscord<Elegantbeef> The offset is important for interop and assurances that your declaration matches theirs
09:07:11FromDiscord<sOkam!> Is it necessary to do something with that manually, or is that done automatically by the compiler?
09:07:25FromDiscord<sOkam!> In reply to @Elegantbeef "The offset is important": ah ic
09:07:42FromDiscord<Elegantbeef> You shouldnt need to assuming the types match
09:08:37FromDiscord<sOkam!> Good point, they might not. Didn't even cross my mind 🤔
09:09:13FromDiscord<sOkam!> How do you define an offset for a type in nim?
09:09:49FromDiscord<Elegantbeef> I dont think you can
09:09:55FromDiscord<Elegantbeef> I might be wrong
09:16:07FromDiscord<Elegantbeef> I figure as long as the types match it should be fine
09:16:13FromDiscord<Elegantbeef> But i've been wrong before ;D
09:19:47FromDiscord<sOkam!> Oh, this looks SO much more approachable when nested this way 👀 https://media.discordapp.net/attachments/371759389889003532/924954704352542720/unknown.png
09:20:38FromDiscord<sOkam!> (edit) "nested" => "folded"
09:30:22FromDiscord<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:58FromDiscord<TryAngle> If a project is published on nimble, how would the update process look like?
11:13:58FromDiscord<Yardanico> just do your changes
11:14:04FromDiscord<Yardanico> and then tag a new release and bump the version in the nimble file
11:14:07FromDiscord<Yardanico> that's the proper way
11:15:41*xet7 joined #nim
11:59:46*jjido joined #nim
12:01:57FromDiscord<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:19FromDiscord<Yardanico> maybe you misunderstood how nimble works?
12:02:35FromDiscord<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:43FromDiscord<Yardanico> and then if users reinstall the package again it'll update
12:02:49FromDiscord<Yardanico> or if they specify a newer version in dependencies
12:02:53FromDiscord<Yardanico> (edit) "dependencies" => "requires"
12:02:59FromDiscord<Yardanico> nimble doesn't autoupdate
12:03:44FromDiscord<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:51FromDiscord<Yardanico> nonono
12:03:54FromDiscord<Yardanico> you don't need "nimble publish"
12:04:01FromDiscord<Yardanico> that's for publishing packages, not updating them
12:04:12FromDiscord<Yardanico> bumping nimble ver is just changing the version number in the .nimble file
12:04:15FromDiscord<Yardanico> and tags are a git feature
12:04:41FromDiscord<TryAngle> thanks 👍↵pretty cool
12:25:06*neceve joined #nim
12:26:59FromDiscord<auxym> is there a way to break early from an iterator? `return` is not allowed?
12:33:07FromDiscord<konsumlamm> `break`?
12:33:21FromDiscord<Yardanico> In reply to @auxym "is there a way": that's because iterators are inline by default
12:33:24FromDiscord<Yardanico> their code is just inlined
12:33:39FromDiscord<Yardanico> so you can't exactly "return" from an inline iterator
12:33:50FromDiscord<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:37FromDiscord<auxym> I was thinking something like this actuallly, but return/break aren't allowed: https://play.nim-lang.org/
12:38:44FromDiscord<auxym> oops
12:39:00FromDiscord<auxym> https://play.nim-lang.org/#ix=3JEB
12:43:15FromDiscord<Solitude> your iterator has no return type
12:43:41FromDiscord<Yardanico> @auxym
12:43:46FromDiscord<Yardanico> as solitude said
12:43:49FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JEC
12:44:55FromDiscord<auxym> oh yeah, I get it now. I think I'll do something else 😄
12:46:56FromDiscord<aschwarz> sent a long message, see http://ix.io/3JEE
12:48:22FromDiscord<Yardanico> you're using something from os at compile time
12:48:31FromDiscord<Yardanico> check your `const`, macros, `compileTime` procs
12:48:40FromDiscord<Yardanico> maybe you have a call to some OS routine in there left by accident
12:48:59FromDiscord<Yardanico> in nim `const` means that a variable is decided at compile-time, it doesn't change the scope
12:49:13FromDiscord<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:41FromDiscord<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:09FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3JEY
14:00:30FromDiscord<eyecon> But I get `Error: type mismatch: got <Table[aocscratch.Charpair, system.int], typedesc[Charpair], int>` in the body of `[]`
14:00:34FromDiscord<eyecon> Any ideas?
14:01:35FromDiscord<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:56FromDiscord<eyecon> Got it
14:09:06FromDiscord<eyecon> Sorry
14:09:20FromDiscord<eyecon> I put `A` instead of `key`
14:10:00*sagax quit (Quit: Konversation terminated!)
14:12:14*sagax joined #nim
14:14:28FromDiscord<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:33FromDiscord<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:40FromDiscord<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:02FromDiscord<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:07FromDiscord<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:16FromDiscord<eyecon> Recursive types?
15:26:44FromDiscord<eyecon> Just guessing
15:26:51*anadahz joined #nim
15:28:57*drewr quit (Ping timeout: 240 seconds)
15:30:21FromDiscord<haxscramper> recursive procs
15:30:37FromDiscord<haxscramper> also compiler is a single-pass IIRC
15:31:04FromDiscord<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:46FromDiscord<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:42FromDiscord<Rika> Functions can still have unsafe behaviour, it just has to be pure unsafe behaviour lol
16:39:01FromDiscord<TryAngle> lol
16:52:06FromDiscord<Solitude> In reply to @TryAngle "what is the difference": function cant access non-const variable outside of its scope
16:57:09FromDiscord<Yardanico> also it can't modify any non-`var` arguments unless they're ref
16:57:18FromDiscord<Yardanico> and with strictFunc it can't modify ref too
16:57:26FromDiscord<Yardanico> (unless you pass it as `var`)
16:57:34FromDiscord<krisppurg> sent a long message, see http://ix.io/3JGd
17:07:09FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JGj
17:07:47FromDiscord<TryAngle> and I get the `Error: type expected, but got: T`
17:09:07FromDiscord<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:28FromDiscord<TryAngle> (edit) "T`" => "T`↵So this seems to be a bug with module rexports, contained in templates???"
17:10:48FromDiscord<krisppurg> In reply to @krisppurg "Hey guys, I have": also cc: @treeform (sorry for ping)
17:12:30FromDiscord<Solitude> In reply to @0ffh "If a *converter* is": its runtime
17:13:25NimEventerNew thread by Samsamros: Error installing nimlsp, and getting the neovim plugin to work, see https://forum.nim-lang.org/t/8747
17:13:25FromDiscord<Solitude> would be nice if they supported {.compiletime.} but its easier to just avoid them
17:13:43FromDiscord<0ffh> In reply to @Solitude "would be nice if": Okay, thanks, I'll do that!
17:14:38FromDiscord<Solitude> you cant even overload them with `static`...
17:16:13FromDiscord<TryAngle> In reply to @Solitude "you cant even overload": wait so writing a converter for↵[static[int], T] is not possible 😳 ?
17:16:29FromDiscord<TryAngle> or do u do just [I, T] then?
17:20:58*Gustavo6046 quit (Quit: Leaving)
17:21:09FromDiscord<Solitude> its not possible to write a converter
17:21:13FromDiscord<Solitude> do not try it
17:24:13*def- quit (Quit: -)
17:26:26*def- joined #nim
17:45:54FromDiscord<MD> Is there a performance decrease when wrapping a C library and using it in Nim?
17:46:54FromDiscord<Yardanico> if you just use the bindings the "raw" way without any higher-level Nim functions, then generally no
17:48:49FromDiscord<MD> Nice, thanks!
17:57:50FromDiscord<frankzig> ?
17:57:52FromDiscord<frankzig> sent a code paste, see https://play.nim-lang.org/#ix=3JGz
17:58:05FromDiscord<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:09FromDiscord<Shiba> i also finished nim basics🥳
18:02:26FromDiscord<Yardanico> In reply to @frankzig "is it possible to": yes, but not like this
18:02:42FromDiscord<Yardanico> hmm
18:02:54FromDiscord<Yardanico> not sure how to do it so that you it looks like `obj.test[]` and you get `obj` in `[]`
18:03:00FromDiscord<Yardanico> (edit) removed "you"
18:09:11FromDiscord<Shiba> @Yardanico when you said nim compiler keeps compiled scripts and compiles only modified ones , is that a thing you enable
18:10:17FromDiscord<Yardanico> no, it's enabled by default
18:10:25FromDiscord<Yardanico> the compiled C files are cached, so they're not recompiled if they didn't change
18:29:54FromDiscord<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:05FromDiscord<frankzig> but maybe this kind of stuff cannot be done...
18:31:05FromDiscord<Yardanico> In reply to @frankzig "but maybe this kind": i think you can do it if you override the . operator
18:31:07FromDiscord<Yardanico> maybe
18:31:31FromDiscord<frankzig> ah... didnt know I could do that
18:32:08FromDiscord<Yardanico> https://nim-lang.org/docs/manual_experimental.html#special-operators-dot-operators
18:33:42FromDiscord<frankzig> that doesnt look like it would compose with []
18:34:46FromDiscord<Yardanico> why so?
18:34:49FromDiscord<Yardanico> lemme try
18:37:21FromDiscord<frankzig> sent a code paste, see https://play.nim-lang.org/#ix=3JGK
18:37:38FromDiscord<Yardanico> i mean i know another way that'll work 100%, but it's very very dirty
18:37:44FromDiscord<Yardanico> so i'll try the cleaner way first :)
18:38:20FromDiscord<frankzig> In reply to @Yardanico "so i'll try the": Ohhh thank you <3, dirty or clean, I'll be happy anyway
18:41:34FromDiscord<Yardanico> In reply to @frankzig "Ohhh thank you <3,": yeah this is a bit less dirty and with dotOperators:
18:41:41FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JGL
18:41:57FromDiscord<Yardanico> this is using another hidden array, but you probably get the idea
18:42:08FromDiscord<Yardanico> but with setters it might be a bit complicated
18:42:15FromDiscord<Yardanico> hmm this is not exactly what you want, yeah
18:44:29FromDiscord<Yardanico> i'll experiment some more
18:44:55FromDiscord<Yardanico> ahh right
18:48:32FromDiscord<Yardanico> @frankzig it's simpler than I thought, but yeah:
18:48:50FromDiscord<Yardanico> lemme try to fix that
18:48:52FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JGQ
18:50:04FromDiscord<Yardanico> @frankzig can you show more examples of how you think it should work?
18:50:09FromDiscord<Yardanico> usage examples i mean
18:53:23FromDiscord<frankzig> sent a code paste, see https://play.nim-lang.org/#ix=3JGT
18:53:55FromDiscord<frankzig> this is what I want to build
19:01:16FromDiscord<Shiba> what does those values mean https://media.discordapp.net/attachments/371759389889003532/925101037491220511/Capture.PNG
19:02:04FromDiscord<Yardanico> how many lines the nim compiler compiled, how long it took, and how much memory did the nim compiler use
19:02:58FromDiscord<Shiba> that aloot for a one line hello world program
19:03:27FromDiscord<Yardanico> no
19:03:29FromDiscord<Shiba> i guess if i can get an ssd , i can boost the compile time
19:03:29FromDiscord<Yardanico> it's fine
19:03:35FromDiscord<Yardanico> that of course
19:07:48FromDiscord<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:58FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3JGY
19:08:03FromDiscord<Yardanico> and yes maybe there's a much better way of doing this
19:08:52FromDiscord<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:03FromDiscord<Yardanico> wait maybe I can simplify it
19:10:23FromDiscord<Yardanico> or not
19:10:43FromDiscord<Yardanico> i mean you can probably make a macro that'll allow doing all of this without overhead
19:16:39FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3JH0
19:17:24FromDiscord<treeform> I added this code: https://github.com/treeform/jsony/commit/11df6999829a0fa51af353182d35613c9afbf39f
19:17:35FromDiscord<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:34FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3JH1
19:26:42FromDiscord<frankzig> sent a code paste, see https://play.nim-lang.org/#ix=3JH2
19:28:47FromDiscord<Yardanico> there might a better way, i just wrote how one of the ways of how to make it work
19:29:23FromDiscord<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:07FromDiscord<treeform> In reply to @krisppurg "also cc: <@!107140179025735680> (sorry": This is how I would do it: https://gist.github.com/treeform/2b1a1ba7a35ad3166cdb2dab663236c4
19:31:10FromDiscord<haxscramper> I think on matrix side it was [enthus1ast](https://matrix.to/#/@sn0re:matrix.code0.xyz)
19:51:37FromDiscord<planetis> i think =sink .error is ignored
19:52:05FromDiscord<Yardanico> maybe it didn't sink?
19:53:01FromDiscord<planetis> no i also did =copy .error
19:53:13FromDiscord<planetis> and used move explicitly
19:58:31*xet7 joined #nim
19:59:42FromDiscord<planetis> https://play.nim-lang.org/#ix=3JHb
20:01:30FromDiscord<Yardanico> @planetis as I Said
20:01:32FromDiscord<Yardanico> (edit) "Said" => "said"
20:01:36FromDiscord<Yardanico> in this case your sink and copy do not trigger
20:01:42FromDiscord<Yardanico> i changed error to echo and compiled with arc
20:01:45FromDiscord<Yardanico> and nothing got printed out
20:03:59FromDiscord<planetis> why they don't?
20:04:37FromDiscord<planetis> move the var g1 = g line above the g.tick and it doesn't compile
20:04:54FromDiscord<planetis> g.update
20:05:28FromDiscord<Yardanico> yes, and what is the issue here?
20:08:44FromDiscord<planetis> the compiler should prevent assignments `var g1 = g` code from compiling
20:09:08FromDiscord<planetis> it used to work that way before if i am not mistaken
20:10:19FromDiscord<Yardanico> but it prevents them now too
20:10:31FromDiscord<Yardanico> in your original code snippet g2 was probably just not compiled at all
20:10:53FromDiscord<Yardanico> if you move ` var g2 = g` above g.update() as you said it doesn't compile
20:10:57FromDiscord<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:17FromDiscord<Yardanico> In reply to @krisppurg "Wheres the parsing json": ($data).fromJson(Activity)
20:11:29FromDiscord<Yardanico> you take data which is JsonNode, convert it to string, then parse to a json
20:11:52FromDiscord<krisppurg> In reply to @treeform "Jsony already handles options,": This was temporary btw when there was the tuple bug I updated it
20:12:55NimEventerNew 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:58FromDiscord<planetis> did I messed up the assert?↵(@Yardanico)
20:14:12FromDiscord<Yardanico> ???
20:14:18FromDiscord<planetis> ...nah it's okay
20:14:37FromDiscord<Yardanico> in your code you did ` var g2 = g`
20:14:41FromDiscord<Yardanico> followed by echo hello
20:14:46FromDiscord<Yardanico> so that probably just didn't get compiled it
20:14:53FromDiscord<Yardanico> because it doesn't change the program's logic it's fine
20:15:33FromDiscord<planetis> well expandarc shows its there
20:16:12FromDiscord<Yardanico> well expandArc is Nim side
20:16:17FromDiscord<Yardanico> before the backend
20:16:47FromDiscord<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:05FromDiscord<planetis> i messed up the assert message 🤣
20:17:12FromDiscord<tbrekalo> I saw the example on manual page but it's not quite clear to me how to make it work
20:18:15FromDiscord<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:58FromDiscord<tbrekalo> I really do have to write all those templates by hand?↵↵https://nim-lang.org/docs/manual.html#types-distinct-type ?
20:19:09FromDiscord<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:18FromDiscord<TryAngle> (edit) "http://ix.io/3JHh" => "http://ix.io/3JHi"
20:20:28FromDiscord<planetis> @Yardanico compiling with v1 shows a compile error, it broke at 1.2.0
20:20:55FromDiscord<Yardanico> can you show the code that fails for you?
20:23:13FromDiscord<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:05FromDiscord<krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=3JHm
20:35:17*neurocyte0132889 quit (Ping timeout: 240 seconds)
20:35:22FromDiscord<krisppurg> (edit) "https://play.nim-lang.org/#ix=3JHm" => "https://play.nim-lang.org/#ix=3JHn"
20:39:03FromDiscord<tbrekalo> https://play.nim-lang.org/#ix=3JHp so this is a known compiler issue?
20:42:46FromDiscord<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:56FromDiscord<Solitude> there is no point otherwise
20:43:13FromDiscord<tbrekalo> sorry; wrong link
20:44:00FromDiscord<tbrekalo> I have similar snippet in my project and it breaks
20:45:28FromDiscord<tbrekalo> nvm; solved the issue; it was due to imports
20:45:46FromDiscord<tbrekalo> btw. are there any success stories of nim in production?↵could someone link an example
20:46:15FromDiscord<treeform> In reply to @krisppurg "`web` and `mobile` are": your json data is like that? `"client_status": {"desktop": "idle"},` -> `clientStatus: ("", "idle", "")`
20:46:29FromDiscord<treeform> oh you set them in new hook
20:46:55FromDiscord<treeform> you should use a `postHook` or `newHook` right on the tuple
20:48:55FromDiscord<treeform> hmm I don't do `newHook` for tuples
20:51:21FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3JHs
20:52:00FromDiscord<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:12FromDiscord<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:28FromDiscord<krisppurg> especially types as well
20:52:37FromDiscord<krisppurg> (edit) "types" => "`type`/`kind`s"
20:54:22*xet7 quit (Remote host closed the connection)
20:58:48FromDiscord<krisppurg> https://play.nim-lang.org/#ix=3JHw
21:00:36FromDiscord<krisppurg> again same issue@treeform
21:03:04*xet7 joined #nim
21:24:16NimEventerNew 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:56FromDiscord<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:46FromDiscord<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:19FromDiscord<TryAngle> It's weird because if I implement it manually without any templates it works
22:15:40FromDiscord<Elegantbeef> Ok so where is the repo
22:16:03*jjido joined #nim
22:51:14FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3JI3
22:52:18FromDiscord<Elegantbeef> Change `proc` to template
22:52:38FromDiscord<Elegantbeef> The issue with a proc is the code is generated at declaration so it already has `echo msg`
22:53:32FromDiscord<geekrelief> hmm, yeah I changed the `when` to `if` and it works..
22:53:49FromDiscord<Elegantbeef> That also works
22:53:56FromDiscord<geekrelief> thanks!
23:04:31FromDiscord<Shiba> Can someome tell me what is his average compile time on first try
23:05:02FromDiscord<Elegantbeef> Hello world compiled in 2.38s
23:05:07FromDiscord<Elegantbeef> .238s\
23:05:18FromDiscord<Elegantbeef> release build in .279s
23:05:35FromDiscord<Elegantbeef> danger build + LTO 1.1s
23:06:27FromDiscord<Elegantbeef> My 3D game on a danger build took 11s
23:07:37FromDiscord<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:08FromDiscord<sOkam!> In reply to @Elegantbeef "My 3D game on": self-made engine?
23:35:02FromDiscord<Elegantbeef> "Engine" yes
23:35:30FromDiscord<sOkam!> was looking for some simple 3D engine/framework to toy with, but didn't find anything too exciting
23:35:55FromDiscord<sOkam!> any you would recommend? or better to just go with nimgl/sdl?
23:35:56FromDiscord<Elegantbeef> Mine is super basic, i expand it as i need it for my project
23:36:20FromDiscord<Elegantbeef> There isnt much in the way of good 3D engines for Nim
23:36:38FromDiscord<sOkam!> ic
23:36:48FromDiscord<sOkam!> what libs are you using for yours?
23:36:53FromDiscord<Elegantbeef> https://github.com/abisxir/alasgar is interesting, though havent used it
23:37:02FromDiscord<Elegantbeef> I'm using Opengl/Sdl/Assimp
23:37:28FromDiscord<sOkam!> looked into nimgl? you think its worth it, or just go with sdl?
23:38:17FromDiscord<Elegantbeef> Nimgl doesnt really offer much that i can tell over the raw bindings
23:39:08FromDiscord<Elegantbeef> https://github.com/beef331/truss3d my undoccument non production ready framework 😀
23:39:17FromDiscord<Elegantbeef> undocumented\
23:41:47FromDiscord<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:39FromDiscord<Shiba> In reply to @Elegantbeef "My 3D game on": 11 s to just test a thing, this is insane
23:55:48FromDiscord<Elegantbeef> danger
23:55:54FromDiscord<Elegantbeef> That's an optimized release build
23:57:46FromDiscord<Elegantbeef> It's around 3s compile time in a debug build
23:58:06FromDiscord<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:28FromDiscord<Elegantbeef> Yes that's to be expected since it doesnt recompile if no changes
23:59:12FromDiscord<Shiba> Mine is a dual core pentium
23:59:25FromDiscord<Shiba> (edit) "Mine" => "My cpu"