<< 01-01-2022 >>

00:08:10*hexeme is now known as ldlework
00:42:00*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
00:45:50*GnuYawk quit (Quit: GnuYawk)
00:46:13*GnuYawk joined #nim
01:05:30FromDiscord<Isofruit> Happy new year!
01:06:02FromDiscord<Isofruit> So on the one hand, I finished celebrating with the fam, it's like 2 am, I'm on a mildly fucked up sleep cycle because I overdid it yesterday and I've written up a response on a github issue
01:06:19FromDiscord<Isofruit> On the other, that would be posting a response to a github issue at 2 am on new years
01:06:41FromDiscord<Isofruit> Life choices are difficult
01:07:37FromDiscord<Elegantbeef> It's not 2am everywhere 😜
01:08:50FromDiscord<Isofruit> Ah yes, the good old "It's always 4pm somewhere"-excuse!
01:09:47FromDiscord<Isofruit> Well, to be fair, what might be seen as weird is the fact that this issue did not let my brain go until I wrote up a response, even on new years eve, less the posting of it. So given that, I already did the weird thing, not much saving now other than pretending ... 😐
01:26:18*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
01:41:15*noeontheend joined #nim
01:52:37*noeontheend quit (Ping timeout: 240 seconds)
02:21:49FromDiscord<macintacos> In reply to @leorize "unfortunately testament is one": Following up on this - what’s the tool to use for unit testing in Nim in that case, if it’s not really meant to be used in anything other than the compiler?
02:22:50FromDiscord<Rika> There’s another package that said it’s deprecated but in reality it isn’t
02:22:59FromDiscord<Rika> Think it’s called unit test or so
02:59:39FromDiscord<macintacos> This? https://nim-lang.org/docs/unittest.html
02:59:52FromDiscord<macintacos> The second section says to use testament lol
03:01:08FromDiscord<Rika> Again yes it’s really not the case
03:01:33FromDiscord<Rika> Most people still use it
03:06:13*Gustavo6046 quit (Read error: Connection reset by peer)
03:07:14FromDiscord<leorize> https://github.com/disruptek/balls \<- this is a good one to use
03:07:46*Gustavo6046 joined #nim
03:08:43FromDiscord<macintacos> Oh that’s nice, I’ll give it a try, thanks!
03:09:02FromDiscord<huantian> Balls? Balls are good
03:09:43FromDiscord<macintacos> Lmao
03:10:25FromDiscord<macintacos> Is there any mocks with this, or perhaps some other lib? (Should probably look around before asking this but I mean might as well 🙂 )
03:11:26FromDiscord<macintacos> Rather like, is there a straightforward way to build mocks and all that - coming from pytest I feel like that’s one habit I’ll need to work around 🤔
03:16:38*noeontheend joined #nim
03:24:13*noeontheend quit (Ping timeout: 240 seconds)
03:25:05FromDiscord<Isofruit> Turns out jsony drops part of your string from `<myCustomType>.toJson()` if `myCustomType` contains a field with a distinct custom DateTime type. Github issue is open.↵Well that's slightly annoying...
03:25:14FromDiscord<Isofruit> (edit) "annoying..." => "annoying =/"
03:26:22FromDiscord<Elegantbeef> Did you make a `parseHook` for your custom DateTime?
03:26:53FromDiscord<Elegantbeef> parse and dump hooks rather
03:28:52FromDiscord<Isofruit> sent a code paste, see https://paste.rs/dxk
03:29:22FromDiscord<Elegantbeef> you're doing `s =` not `s.add`
03:29:26FromDiscord<Isofruit> (edit) "https://play.nim-lang.org/#ix=3KhR" => "https://play.nim-lang.org/#ix=3KhQ"
03:30:12FromDiscord<Isofruit> sonofa
03:30:17FromDiscord<Rika> Lol
03:31:04FromDiscord<Elegantbeef> Really that should be a distinct `JsonString` so you have to manually convert unless using `add`
03:31:15FromDiscord<Elegantbeef> Some people just dont use distincts enough
03:33:33FromDiscord<sOkam!> what's the default size for floats in nim?
03:33:40FromDiscord<Elegantbeef> `float` is 64bit
03:34:13FromDiscord<Elegantbeef> That API is very unsafe can nuke or remove values unintentionally
03:35:03FromDiscord<Elegantbeef> Plus using a distinct means all you'd have to do is `s.add yourString` and it could quote it automatically
03:36:32*GnuYawk quit (Excess Flood)
03:37:08*GnuYawk joined #nim
03:38:33FromDiscord<Isofruit> Wouldn't that still run me into issues with the fact I need that distinct DateTime for getting my DateTime data out of my sqlite db with norm?
03:38:57FromDiscord<Elegantbeef> Did you read my comments
03:39:02FromDiscord<Elegantbeef> It's all about the json hook's unsafety
03:39:29FromDiscord<Elegantbeef> I was suggesting a `type JsonString = distinct string` for the jsony hook API
03:40:01FromDiscord<Isofruit> Ohhhh, I read but there's the distinct barrier between "word in" and "word comprehend"
03:40:06FromDiscord<Elegantbeef> Which would've solved this problem before you even faced it since the compiler would've said "you're attempting to assign a string to a JsonString"
03:40:15*noeontheend joined #nim
03:41:26FromDiscord<Elegantbeef> Basically it'd prevent this error from ever happening unless you went `s = JsonString(yourString)` 😛
03:42:28FromDiscord<sOkam!> In reply to @Elegantbeef "`float` is 64bit": do you know if there's fixed point floats implemented?↵or is that an external library required thing?
03:42:39FromDiscord<sOkam!> (edit) "floats" => "arithmetic"
03:42:58FromDiscord<Elegantbeef> https://nimble.directory/search?query=fixed+point there is no fixed point in the stdlib iirc
03:44:47FromDiscord<sOkam!> oh nice, its a libfixmath wrapper
03:45:28FromDiscord<IsaacPaul> There is also https://gist.github.com/planetis-m/c13529cac44b4a9de3f073de502315ee
03:45:57FromDiscord<IsaacPaul> I haven't add any time to compare and contrast them tho
03:46:31FromDiscord<IsaacPaul> (edit) "I haven't add any time to compare and contrast them tho ... " added "(so no recommendations)"
03:50:31FromDiscord<Isofruit> In reply to @Elegantbeef "Basically it'd prevent this": I'll take this as another very clear sign I've been awake too long, sleep once more.↵Thanks for the explanation!
03:50:52FromDiscord<Elegantbeef> No problem
03:51:02FromDiscord<Elegantbeef> I heavily abuse distinct so it's almost always my solution 😛
03:52:29FromDiscord<sOkam!> fastmath is very solid. would only need to be extended with a wrapper for 64 and matrices
03:52:37FromDiscord<sOkam!> (edit) "fastmath is very solid. would only need to be extended with a wrapper for ... 64libs" added "the" | "the64 and matrices ... " added "libs"
03:52:47FromDiscord<sOkam!> (edit) "fastmath" => "libfixmath"
03:53:12FromDiscord<sOkam!> the og is really well made
04:01:53*arkurious quit (Quit: Leaving)
04:56:37*cornfeedhobo_ is now known as cornfeedhobo
05:28:14*noeontheend quit (Ping timeout: 260 seconds)
06:05:37NimEventerNew thread by Oyster: My notes on NPOI+Nim, see https://forum.nim-lang.org/t/8758
08:39:38*Gustavo6046 quit (Quit: Leaving)
09:24:17*bkay joined #nim
09:25:25*beshr quit (Ping timeout: 268 seconds)
10:02:39FromDiscord<Isofruit> Wait a minute, treeform is in this discord?
10:02:48FromDiscord<Isofruit> neat!
10:02:49FromDiscord<Rika> Yes
10:02:53FromDiscord<Rika> Has been for a long time
10:09:49FromDiscord<Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Kjl
10:10:22FromDiscord<Isofruit> (edit) "https://play.nim-lang.org/#ix=3Kjl" => "https://play.nim-lang.org/#ix=3Kjm"
10:12:20FromDiscord<Solitude> perhaps
10:15:36*neurocyte0132889 joined #nim
10:15:36*neurocyte0132889 quit (Changing host)
10:15:36*neurocyte0132889 joined #nim
10:58:29*neurocyte0132889 quit (Ping timeout: 252 seconds)
11:59:40*jjido joined #nim
12:33:37*rp3 quit (Ping timeout: 240 seconds)
12:34:26*rp3 joined #nim
12:39:25*rp3 quit (Ping timeout: 240 seconds)
12:41:35*rp3 joined #nim
12:46:27FromDiscord<WhyDee> Hey everyone Im trying to use the following function:↵https://github.com/juancarlospaco/psutil-nim/blob/master/src/psutil/psutil_windows.nim#L324
12:49:51Amun-Rahttps://github.com/juancarlospaco/psutil-nim/blob/master/src/psutil/psutil_windows.nim#L331-L332
12:49:53Amun-Raheh
12:50:35FromDiscord<WhyDee> Hey everyone Im trying to use the following function:↵https://github.com/juancarlospaco/psutil-nim/blob/master/src/psutil/psutil_windows.nim#L324↵Get user name who own a process, but get error with LookupAccountSidW https://media.discordapp.net/attachments/371759389889003532/926819693174599690/Screenshot_2022-01-01_144921.png
12:52:02FromDiscord<WhyDee> In reply to @Amun-Ra "https://github.com/juancarlospaco/psutil-nim/blob/m": I mistakenly sent an unfinished message before, sorry.
12:53:40Amun-RaWhyDee: I was just referring to those two lines
12:54:55FromDiscord<Yardanico> In reply to @WhyDee "Hey everyone Im trying": well, the code is incorrect as the two types aren't compatible, so you have to cast
12:55:04FromDiscord<Yardanico> i wonder if you need addr here or not though
12:55:13FromDiscord<Yardanico> ah yeah you do
12:55:20FromDiscord<Yardanico> i don't know how it worked before (if it ever did)
12:55:42Amun-RaWhyDee: I'm not a windows user, check whether casting wcUser to LPWSTR works
12:56:16FromDiscord<WhyDee> I tried to cast wcUser and wcDomain it didnt solve the problem😩
12:57:03FromDiscord<WhyDee> https://media.discordapp.net/attachments/371759389889003532/926821321034305537/unknown.png
12:57:11FromDiscord<Yardanico> yes, you need addr too
12:57:22FromDiscord<WhyDee> cast[LPWSTR](wcUser.addr)
12:57:24FromDiscord<WhyDee> ??
12:57:29FromDiscord<Yardanico> yes
12:57:39FromDiscord<Yardanico> also, what's the reason you want to use that module?
12:58:39Amun-Rawell, that's why I always hide raw function implementations and use nim types only for function args
12:58:54FromDiscord<Yardanico> that's exactly that was done there
12:58:57FromDiscord<Yardanico> the error is inside the function itself
12:59:04FromDiscord<Yardanico> that code is incorrect, it should've never worked
12:59:09FromDiscord<Yardanico> idk if it ever did
12:59:45FromDiscord<Yardanico> they were passing wcUser itself (array of characters) to a Windows API function that expects a pointer to a string (array of characters) to write the username to
13:01:23FromDiscord<WhyDee> In reply to @Yardanico "the error is inside": Maybe you right I had a similar code that do the same, but I had problem too with the following function so I searched for more implementations
13:01:34FromDiscord<Yardanico> also why are you trying to use a fork if it doesn't have any new commits?
13:01:38FromDiscord<Yardanico> it's the same as the base repo which is https://github.com/johnscillieri/psutil-nim
13:02:50FromDiscord<WhyDee> I can send you my implementation but it also fail with the following function
13:03:01FromDiscord<Yardanico> so did adding addr fix it or not?
13:03:13FromDiscord<Yardanico> and please reply to "also, what's the reason you want to use that module?", just curious
13:03:28FromDiscord<Yardanico> what specific functionality do you want to use?
13:03:35FromDiscord<WhyDee> In reply to @Yardanico "it's the same as": https://github.com/johnscillieri/psutil-nim/blob/e94c423b78a5fe1806643926a30a7e02d49124d3/doc/windows/functions/try_pid_user.md there is no different, the fork just came first on google haha
13:04:00FromDiscord<Yardanico> yeah that code is wrong
13:04:01FromDiscord<WhyDee> In reply to @Yardanico "and please reply to": I can tell you in private channel
13:04:11FromDiscord<Yardanico> sure, you can DM me then
13:16:05FromDiscord<apahl> Hi, I have a project in which I want to use two different libraries.↵One uses the cpp backend, because it is a binding to a C++ toolkit, the other uses the c backend.↵Using either cpp or c as backend in my project gives me an error in the library that requires the other backend.↵Is there a way to make this work (other than writing a C wrapper for the C++ toolkit)?
13:17:15FromDiscord<Yardanico> In reply to @apahl "Hi, I have a": what's the error when you compile with the C++ backend? and can you share the C lib in question?
13:18:57*kayabaNerve quit (Ping timeout: 240 seconds)
13:22:01FromDiscord<apahl> sent a long message, see http://ix.io/3Kkl
13:23:01FromDiscord<apahl> (edit) "http://ix.io/3Kkl" => "http://ix.io/3Kkm"
13:24:01FromDiscord<apahl> Using either of the two libraries only does work.
13:25:20FromDiscord<apahl> I should maybe mention the platform as well, this is on Ubuntu Linux.
13:29:27FromDiscord<Yardanico> yeah, the error is indeed weird, but can you try some stub code just using webview without using your lib?
13:29:40FromDiscord<Yardanico> i think it will error out with the C backend as well because that error doesn't look C++ specific
13:30:34FromDiscord<apahl> You mean just using Webview with the cpp backend? Good idea, let me try.
13:30:43FromDiscord<Yardanico> even with the C backend, just to see if it works
13:32:08FromDiscord<apahl> Webview with c definitely does work. I tried that before I started.
13:32:51FromDiscord<apahl> But the strange thing is, just Webview with cpp does also work (just checked), so the problem must lie somewhere else.
13:33:49FromDiscord<apahl> Thanks for the pointer, that gives me some hope that it's fixable. I even have an idea. It might be related to the modification of LD_LIBRARY_PATH.
13:34:39FromDiscord<apahl> The modification is needed only for the RDkit part.
13:37:42FromDiscord<apahl> Yepp, the reason is indeed the LD_LIBRARY_PATH bit. ↵Thank you again, I can work on this.
13:37:59FromDiscord<Yardanico> no problem, although I didn't really help much :)
13:43:30FromDiscord<Shiba> new year , new hello world program compiled https://media.discordapp.net/attachments/371759389889003532/926833011373248512/Capture.PNG
13:43:49FromDiscord<Rika> ?
13:44:06FromDiscord<Shiba> does quad core make difference
13:44:12FromDiscord<Yardanico> for the C compilation yes
13:44:14FromDiscord<Rika> Should for C
13:44:24FromDiscord<Rika> Fuck you yardanico dammit
13:44:51FromDiscord<Solitude> no, it wont help
13:45:13FromDiscord<Yardanico> In reply to @Solitude "no, it wont help": :forsenDespair:
13:45:27FromDiscord<Shiba> higher frequency?
13:45:39FromDiscord<Rika> Probably
13:45:47FromDiscord<Yardanico> In reply to @Shiba "higher frequency?": cores will help as rika said
13:45:53FromDiscord<Yardanico> frequency too
13:46:06FromDiscord<Yardanico> but core count won't improve nim speeds while higher freq does
13:46:09FromDiscord<Yardanico> but again, as I said before, use an SSD
13:46:17FromDiscord<Yardanico> i think it'll help you more than a faster CPU really
13:46:22FromDiscord<Solitude> how would it help
13:46:28FromDiscord<Yardanico> In reply to @Solitude "how would it help": he's using an HDD
13:46:32FromDiscord<Solitude> and?
13:46:32FromDiscord<Yardanico> compilation is a lot of small random files
13:46:34FromDiscord<Shiba> In reply to @Yardanico "but again, as I": i made 200mb hardisk from ram
13:46:35FromDiscord<Yardanico> IO time is noticeable
13:46:47FromDiscord<Yardanico> In reply to @Shiba "i made 200mb hardisk": but did you put both nim and the C compiler to it?
13:46:50FromDiscord<Yardanico> with all the stdlib?
13:47:09FromDiscord<Yardanico> even if you have your program's code on the ramdisk all standard code still comes from the HDD
13:47:30FromDiscord<Solitude> In reply to @Yardanico "compilation is a lot": its not a lot of files
13:47:42FromDiscord<Rika> ??
13:47:58FromDiscord<Solitude> compile whatever thing and tell me how many nim files it processed
13:48:38FromDiscord<Rika> And then how many C files does the C compiler then process
13:48:51FromDiscord<Solitude> same amount
13:48:57FromDiscord<Rika> Really
13:50:06FromDiscord<Yardanico> hm
13:50:18FromDiscord<Yardanico> yes, solitude is right about the amount of files that are actually compiled
13:51:21FromDiscord<Yardanico> but nim compiler for example checks all nimble packages directories for imports
13:51:30FromDiscord<Yardanico> but i guess normal FSes have that in metadata which is contiguous
13:52:34FromDiscord<Shiba> In reply to @Yardanico "but did you put": yes didnt't change much , and suddently my laprop turned off
13:52:41FromDiscord<Shiba> (edit) "laprop" => "laptop"
13:55:09FromDiscord<Shiba> the one iam compiling and doing stuff on it right isn't mine , the one i have is broken (screen) , with an i5 2560M quad core base clock 2.5 ghz boost to 3, ram 6gb DDR3
13:55:52FromDiscord<Shiba> and so iam forced to use this pentium until it's fixed
13:56:04FromDiscord<Shiba> (edit) "and so iam forced to use this pentium ... until" added "laptop"
13:56:13FromDiscord<Yardanico> In reply to @Shiba "the one iam compiling": but you can just install linux on it and SSH onto it
13:56:18FromDiscord<Yardanico> or even on windows connect with remote desktop
13:57:22FromDiscord<Shiba> i guess that will work , iam gonna try that
14:00:01*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:01:38*jjido joined #nim
14:02:34FromDiscord<Shiba> i also have a raspberryb pi 3B
14:02:41FromDiscord<Shiba> (edit) "raspberryb" => "raspberry"
14:03:21FromDiscord<Yardanico> i doubt it'll be much faster than your pentium CPU
14:04:00FromDiscord<Shiba> In reply to @Yardanico "i doubt it'll be": dual core 2.13 ghz vs quad core 1.2 ghz ?
14:04:08FromDiscord<Yardanico> In reply to @Shiba "dual core 2.13 ghz": ARM
14:04:11FromDiscord<Shiba> ahhh
14:04:15FromDiscord<Yardanico> frequency doesn't matter by itself
14:38:50FromDiscord<Isofruit> God I love the fact that you can leverage jsony to save yourself the entire hassle of writing serializers for objects
14:46:15*arkurious joined #nim
15:07:20FromDiscord<kaddkaka> sent a long message, see http://ix.io/3Klw
15:09:23*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
15:10:13*jjido joined #nim
15:21:04FromDiscord<deech> Is there an existing flattening template in the standard library? eg. `flatten(1,2,3,@[4,5,6])` => `@[1,2,3,4,5,6]`?
15:25:16FromDiscord<Solitude> In reply to @kaddkaka "I'm getting my feet": no, because its not a regular procedure, its a compiler magic↵https://github.com/nim-lang/Nim/blob/devel/lib/system/comparisons.nim#L141
15:26:09FromDiscord<kaddkaka> In reply to @Solitude "no, because its not": ok 👍
15:29:48FromDiscord<el__maco> hold on, how is `{.global.}` supposed to work. I thought it was supposed to be like `static` is in C, you could make locally defined variables that don't live in the local stack frame
15:30:52FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Km3
15:32:15*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
15:37:36FromDiscord<el__maco> ok, it seems `--gc:arc` does this. If I remove that from the config it probably isn't initialized every time anymore
15:37:44FromDiscord<el__maco> what a magnificent footgun?
15:39:13FromDiscord<el__maco> I only noticed this by chance, because the performance went to crap. Of course it did, because I'm now creating a new frame buffer object every frame instead of reusing 😓
15:46:55FromDiscord<Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3Kmk
15:47:24FromDiscord<kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3Kmm
15:47:50FromDiscord<kaddkaka> (edit)
15:48:47FromDiscord<el__maco> In reply to @Solitude "does this fit the": I think so yes. That's how I figured out to try without --gc:arc
15:50:28FromDiscord<Solitude> In reply to @kaddkaka "This function is not": declare them with `const`
15:51:20FromDiscord<kaddkaka> In reply to @Solitude "declare them with `const`": which one?
15:51:42FromDiscord<Solitude> the ones that count as sideeffect
15:52:02FromDiscord<IsaacPaul> > "risking" side effects↵Also rename the functions↵> which one?↵all_numbers obviously
15:52:09FromDiscord<kaddkaka> In reply to @Solitude "the ones that count": the global state or the local one?
15:52:10FromDiscord<IsaacPaul> (edit) "functions↵>" => "function↵>"
15:52:13FromDiscord<Solitude> global
15:52:18FromDiscord<Solitude> why would local state be a sideeffect
15:52:29FromDiscord<kaddkaka> hmm
15:53:10FromDiscord<kaddkaka> I thought `let` already made certain that it's unmodifiable?
15:54:04FromDiscord<Solitude> yes, its still a sideffect, because result of a function differs because of it at runtime
15:54:13FromDiscord<kaddkaka> In reply to @IsaacPaul "> "risking" side effects": what name do you want? the function has obvious bogus functionality 😛
15:54:45FromDiscord<kaddkaka> In reply to @Solitude "yes, its still a": I don't understand this, what does that mean?
15:54:55FromDiscord<IsaacPaul> filterBy102030↵filterMagic lol
15:55:08FromDiscord<IsaacPaul> (edit) "lol" => "lol↵filterByAllNumbers"
15:56:15FromDiscord<kaddkaka> 🙂
15:56:18FromDiscord<kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3Kmv
15:56:21FromDiscord<IsaacPaul> Perfect
15:57:36FromDiscord<Solitude> In reply to @kaddkaka "I don't understand this,": your function is influenced by global non-static state. so it result between invocations can be different with the same inputs.
15:59:51FromDiscord<IsaacPaul> `let` allows you to modify the contents of the obj? I may be mistaken tho
16:00:18FromDiscord<Solitude> no, it doesnt...
16:01:30FromDiscord<kaddkaka> In reply to @Solitude "your function is influenced": Right, thanks!
16:01:54FromDiscord<kaddkaka> the description `side-effects` confused me, but perhaps that's the terminology
16:02:23FromDiscord<Solitude> https://nim-lang.org/docs/manual.html#effect-system-side-effects
16:02:29FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3KmH
16:03:00FromDiscord<Solitude> yes, let guards that you dont modify the reference, not contents of dereferenced object
16:32:19*kayabaNerve joined #nim
16:49:00FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3KnS
16:57:29FromDiscord<el__maco> I wonder what is this language construct even called in Nim, which looks like a constructor `var foo=Bar(x:10)` is that an actual function call? What happens if you don't specify any parameters (like I did there previously)? If the variable is declared at the top level, then when does that call/operation get executed? I kinda assumed the top level stuff got executed at the beginning, in the order they appear in the code, but now I'm not
17:03:46*jjido joined #nim
17:08:33FromDiscord<Solitude> In reply to @el__maco "I wonder what is": https://nim-lang.org/docs/manual.html#types-object-construction
17:08:48FromDiscord<Solitude> In reply to @el__maco "I wonder what is": it is executed at the "beginning"
17:15:09FromDiscord<el__maco> I see, but that doesn't really answer the question. Based on cursory look at generated code, it seems that maybe the constructor syntax isn't a function call maybe. Its kinda hard to read the intermediate code however
17:16:12FromDiscord<el__maco> its unclear to me what changes if I just declare the object without constructor, or if I invoke a constructor but don't specify any fields to initialize
17:19:03NimEventerNew thread by Arnetheduck: `Result` update, see https://forum.nim-lang.org/t/8759
17:23:02FromDiscord<el__maco> seems its the empty "constructor" which wrecks the program. If I specify any fields to initialize, even with zero values, it starts working again
17:29:31FromDiscord<el__maco> hold on, if I remove the constructor also `{.global.}` seems to start working again
17:34:00FromDiscord<el__maco> both empty and non-empty constructor breaks the `{.global.}` property, but a variable without a constructor seems to behave
17:34:56FromDiscord<el__maco> at a global scope the empty constructor seems to wreak havoc
17:44:17FromDiscord<demotomohiro> Nim initialize everything with zero in default. So object construction without arguments initialize an object with zero.
17:51:51FromDiscord<enthus1ast> does a try except has a performance impact when the code never excepted ?
17:53:17FromDiscord<leorize> the cost is that of an `if`
17:53:30FromDiscord<leorize> at least on `arc`
17:54:05FromDiscord<enthus1ast> so it might make more sense to try except instead of a table.hasKey ?
17:54:13FromDiscord<enthus1ast> will benchmark
17:57:30FromDiscord<enthus1ast> ok no
17:57:36FromDiscord<enthus1ast> table.hasKey is way faster
18:10:17*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
18:14:11FromDiscord<hmmm> you can use table.haskey as a substitute for try except? 🤔
18:14:42FromDiscord<enthus1ast> sent a code paste, see https://paste.rs/Q9c
18:14:44FromDiscord<enthus1ast> stupid example
18:14:58FromDiscord<enthus1ast> but hasKey is orders of magnitude faster
18:16:00FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3KpK
18:16:10*vicecea quit (Remote host closed the connection)
18:16:41*vicecea joined #nim
18:17:06FromDiscord<hmmm> hmm
18:17:17FromDiscord<hmmm> makes sense to me
18:17:33FromDiscord<hmmm> try except is added machinery on top of the cake 🤔
18:19:58FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3KpP
18:21:15FromDiscord<el__maco> In reply to @demotomohiro "Nim initialize everything with": I know. I'm just wondering why `var foo=Bar()` is busted, and `var foo:Bar` is all good. It would seem to me that both should be the same
18:26:00*jjido joined #nim
19:11:17NimEventerNew thread by JPLRouge: Good news for the beginning of 2022, see https://forum.nim-lang.org/t/8760
19:13:25FromDiscord<Solitude> In reply to @el__maco "I know. I'm just": if you have isolated snippet, you should submit the issue.
19:14:12FromDiscord<treeform> like enthus1ast, I also have a table perf question, one can add key to a table with `table[k] = v` but if your `v` is a largish object it will have a big copy. That's slow. Is there a way to kind of says "table make me a slot at k and return it" then I can mess with the `k` slot without doing a copy. Some thing like `v = table.init(k)` where `proc init[K, V](t: Table[K, V] , k: K): var V` ?
19:16:35FromDiscord<el__maco> In reply to @Solitude "if you have isolated": the bug manifests itself in such a random place, isolating a minimal repro case might be very hard sadly
19:17:16FromDiscord<el__maco> might not be even compiler bug, could be mine too, but its really weird
19:22:17*bkay quit (Ping timeout: 252 seconds)
19:24:21*noeontheend joined #nim
19:28:13FromDiscord<Solitude> In reply to @treeform "like enthus1ast, I also": form that you suggest is not possible in current nim, because assigning to `v` will perform a copy, but you could workaround that with `table.init(k).yourMutatingFunction`.
19:30:31FromDiscord<konsumlamm> it won't perform a copy when the return type is `var ...`, no?
19:30:42FromDiscord<Solitude> it will
19:30:46FromDiscord<Solitude> just tested
19:30:51FromDiscord<konsumlamm> rip
19:33:47*beshr joined #nim
19:34:26FromDiscord<Solitude> it will only not copy with `{.experimental: "views".}` and if you declare `v` as `var v: var V`
19:42:13FromDiscord<Shiba> i know that we closed the subject of "compile speed" , but iam curious why does chaning a single char in a nim script makes the compiling slower again
19:42:33FromDiscord<Shiba> (edit) "chaning" => "changing"
19:43:32FromDiscord<Shiba> (edit) "i know that we closed the subject of "compile speed" , but iam ... curiouson" added "still" | "stillcurious ... why" added "on"
19:45:46FromDiscord<konsumlamm> depends on the char
19:46:52*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
20:14:04*Gustavo6046 joined #nim
20:24:39*lumo_e joined #nim
20:44:35FromDiscord<SecureThisShit> Can someone tell me how to echo LPSTR contents? I tried appending it into a string, casting to char, grabbing each char and append them which all failed.
20:59:52*jjido joined #nim
21:06:58FromDiscord<0ffh> Does `$` not work?
21:34:26FromDiscord<kaddkaka> Custom numerical literals are neat 🙂
21:35:07FromDiscord<Solitude> yas
21:37:04FromDiscord<evoalg> In reply to @Shiba "i know that we": large chunks (not all) of the "behind the scenes" stuff will need to be done again
21:38:40*lumo_e quit (Remote host closed the connection)
21:39:13*lumo_e joined #nim
21:40:49*Gustavo6046 quit (Quit: Leaving)
21:53:27*joast joined #nim
21:58:05*vicecea quit (Remote host closed the connection)
21:58:36*vicecea joined #nim
22:17:25*Gustavo6046 joined #nim
22:20:10FromDiscord<gibson> Anyone familiar with tcc? I'm making a shared lib for python to load and not sure what all args nim needs to pass. Works with gcc/default.↵`nim c --cc:tcc -t:"-fPIC" -l:"-fPIC -rdynamic" --app:lib -o:pycache/nimfunc.so nimfunc.nim`
22:20:37*lumo_e quit (Quit: Quit)
22:21:00FromDiscord<gibson> (edit) "nimfunc.nim`" => "nimfunc.nim`↵python loads the .so and segfaults when so is built with tcc."
22:29:17FromDiscord<creikey> how scuffed are nim threads on a scale of 1 to 10?
22:30:55FromDiscord<Elegantbeef> They're abstracted over OS threads and depending on what you're doing super easy to use
22:30:58FromDiscord<Elegantbeef> Channels are nice in my experience
22:31:41nrds<Prestige99> Agreed
22:35:06FromDiscord<Elegantbeef> There is also https://github.com/mratsim/weave
22:37:31FromDiscord<Elegantbeef> @gibson\: i'm feeling like an idiot cause i cannot get it to even load the `.so`
22:37:32FromDiscord<Elegantbeef> dynlib sitting in the same directory as i'm working, and it cannot find it even with ld lib path set 😀
22:39:31FromDiscord<gibson> @ElegantBeef I'm using nimporter/nimpy. Turns out I can't even get tcc to build an executable, but it will make an o or so file just fine. "Invalid Relocation Entry" errors, that look like repeats of prior bugs in tcc. Still trying to figure out if this is my problem (how I built tcc?...) or a tcc inherent bug.
22:39:57FromDiscord<Elegantbeef> I'm using TCC from the ubuntu repository and it works fine for making executables
22:40:31FromDiscord<gibson> I'm jealous! I'm on solus, built it from scratch. Maybe I'll look if the ubuntu package contains build instructions in it..
22:41:25FromDiscord<Elegantbeef> I did manually move my lib to my lib folder and did get it to run but had a `cannot find fabs` issue
22:42:52FromDiscord<Elegantbeef> Oh got it to run now
22:43:07FromDiscord<Elegantbeef> All i had to do was `nim c --app:lib ./myLibFile`
22:43:23FromDiscord<Elegantbeef> Still had to move it to `/lib/` but that's just cause i havent used dynlib before
22:44:12FromDiscord<gibson> Nice! Thanks for the verification that I shouldn't have to add anything crazy. That's a big help.
22:44:48FromDiscord<Elegantbeef> I guess i left out `--cc:tcc` 😛
22:45:03FromDiscord<gibson> Oh, does that work?
22:45:11FromDiscord<Elegantbeef> Oh compiling the main program with tcc causes a shit fit
22:45:25FromDiscord<creikey> is there a nim iterator to count the size of an iterator? I can't find one
22:45:26FromDiscord<Elegantbeef> So the shared lib works with tcc but main lib in my test complains about lack of `fabs`
22:45:34FromDiscord<creikey> trying to count the number of keys in a loaded json
22:45:47FromDiscord<Elegantbeef> You'd need to iterate over it and count steps
22:45:55FromDiscord<creikey> just like that
22:45:59FromDiscord<creikey> sent a code paste, see https://play.nim-lang.org/#ix=3Ksr
22:46:00FromDiscord<Elegantbeef> `std/enumerate` allows you to take an iterator and add `1`
22:46:14FromDiscord<Elegantbeef> "add 1" is my dumb way of saying add an index
22:46:31FromDiscord<Elegantbeef> You could make a `count` template
22:46:56FromDiscord<creikey> I have to put all of the values of the keys into a seq anyways so might as well just let seq dynamically stretch to the size of the keys necessary
22:47:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Kss
22:47:11FromDiscord<creikey> iterate over the keys and using `games.add`
22:48:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Kst
22:48:12FromDiscord<creikey> lol sugar
22:48:16FromDiscord<Elegantbeef> Or even `import std/sequtils` `yourIter.toSeq`
22:48:38*nac4 joined #nim
22:48:42FromDiscord<creikey> std/json can already convert the keys into an OrderedTable I think
22:49:02*noeontheend quit (Ping timeout: 240 seconds)
22:49:08FromDiscord<creikey> yeah https://media.discordapp.net/attachments/371759389889003532/926970325273554944/unknown.png
22:49:21FromDiscord<creikey> not sure if ordered table has a count
22:49:26FromDiscord<creikey> I think just len
22:49:36*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:49:38FromDiscord<Elegantbeef> Same thing
22:50:17*nac quit (Ping timeout: 256 seconds)
22:50:17*nac4 is now known as nac
22:50:28FromDiscord<Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Ksu
22:50:56FromDiscord<Elegantbeef> Templates in Nim are hygenic which means they only emit accessible variables when you tell theem
22:51:35FromDiscord<Isofruit> Ohhh alright, so if I give a template an output type, I can... do result = lalala and that template will return "lalala" as if it were a proc?
22:51:40FromDiscord<Isofruit> (edit) "lalala" => ""lalala""
22:51:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ksw
22:52:00FromDiscord<Isofruit> Ah! Inject pragma I see you once more!
22:52:06FromDiscord<Elegantbeef> No templates do not have a `result` hence why i use create `res` manually
22:52:41FromDiscord<Isofruit> What does the type that you put at the end of the template do, given that it's not a result?
22:52:49FromDiscord<Isofruit> the int in this case
22:53:59*noeontheend joined #nim
22:54:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ksy
22:55:29*thomasross joined #nim
22:58:02*thomasross quit (Remote host closed the connection)
22:58:26*thomasross joined #nim
22:58:27*noeontheend quit (Remote host closed the connection)
23:00:53*noeontheend joined #nim
23:01:51FromDiscord<Isofruit> sent a code paste, see https://paste.rs/Pqu
23:02:04FromDiscord<Isofruit> (edit) "https://play.nim-lang.org/#ix=3KsD" => "https://play.nim-lang.org/#ix=3KsE"
23:02:07FromDiscord<Elegantbeef> Yep you can even do `--expandMacro:count`
23:02:10*noeontheend quit (Remote host closed the connection)
23:02:18FromDiscord<Elegantbeef> actually no
23:02:36FromDiscord<creikey> the word macro shivers my timbers
23:02:36FromDiscord<Isofruit> (edit) "https://play.nim-lang.org/#ix=3KsE" => "https://play.nim-lang.org/#ix=3KsH"
23:02:45FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/rNa
23:02:48FromDiscord<Elegantbeef> Eh i love macros so take it back
23:03:46FromDiscord<Isofruit> I can't really interpret the above unless I assume the part after `let x = ` executes as if it were in a proc, just that the way you return out of it is different
23:04:19FromDiscord<Elegantbeef> In Nim "everything" can be an expression
23:04:33FromDiscord<Isofruit> Ohhhh
23:04:34FromDiscord<Elegantbeef> For instance
23:04:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KsK
23:04:41FromDiscord<Isofruit> So it reads the entire code block as if it were an expression
23:04:58FromDiscord<Elegantbeef> Well it is one
23:05:04FromDiscord<Isofruit> Which means the last value in that code block is what that expression evaluates into
23:05:18FromDiscord<Elegantbeef> Yes
23:06:14FromDiscord<Isofruit> Hmmm and I can't use functions from outside of the template inside of the template if I understood documentation correctly so far
23:06:40FromDiscord<Elegantbeef> You can call functions in the templater
23:06:42FromDiscord<Elegantbeef> template\
23:07:20FromDiscord<Elegantbeef> Templates are just code substitution so you can do a lot with them
23:08:25FromDiscord<creikey> https://docs.python.org/3/library/collections.html#collections.Counter Is there anything like this?
23:08:29FromDiscord<creikey> (edit) "this?" => "this in nim std?"
23:08:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KsO
23:09:30FromDiscord<Isofruit> Assume showcaseMagic is in file a.nim and doThing is in file b.nim and the assert statement is in file c.nim
23:09:31FromDiscord<Elegantbeef> https://nim-lang.org/docs/tables.html#CountTable
23:09:40FromDiscord<creikey> In reply to @Elegantbeef "https://nim-lang.org/docs/tables.html#CountTable": nice
23:09:41FromDiscord<Isofruit> c.nim needs to import a.nim and b.nim and that#s it?
23:10:00FromDiscord<Elegantbeef> The point is that `doThing` is written after the template and resolved at `showcaseMagic()`
23:10:15FromDiscord<Elegantbeef> Which means you can override the logic at callsite unlike generics
23:11:07FromDiscord<Elegantbeef> Generics generate code on first instantiation so if you have a `proc showcaseMagic[T]` instead of the template when i first call `showcaseMagic[string]` any place that calls that procedure will get the same proc call
23:11:13FromDiscord<Elegantbeef> It makes sense but depending what you're doing it's odd
23:13:05FromDiscord<Isofruit> I've been trying to abstract away my interactions with my database through norm into a repository module and wanted to generalize that since I'll have very similar CRUD interactions where the only thing differes is the types I use.↵Generics had some weird behaviour that I didn't expect regarding what I needed to import where, so I'm trying to figure out whether I can make it work with templates, hmmmm
23:14:44FromDiscord<Isofruit> I think I've got enough of a grasp to play around with some code concepts, see them fail and then think about why they failed, so I'll be tackling that for now
23:14:51FromDiscord<Isofruit> (edit) "I think I've got enough of a grasp ... to" added "now"
23:16:35FromDiscord<Elegantbeef> Eh you can use `mixin` and `bind` with generics aswell
23:16:49FromDiscord<Elegantbeef> So you probably just need to plop a `mixin` in your generic
23:17:09FromDiscord<evoalg> In reply to @Elegantbeef "Generics generate code on": I don't understand this bit ... are you saying templates are always substituted into code at compile time, but generics are expanded to different proc's at CT ?
23:17:55FromDiscord<Elegantbeef> Well once the first proc is generated for a generic it's used for all instances of the generic regardless of the scope
23:19:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KsS
23:20:09FromDiscord<Elegantbeef> the call in `modb` is the same as the on in `moda` regardless of the `doThing` since the first instantiation of a generic is the one always used
23:20:50FromDiscord<evoalg> oh gotcha thx!
23:20:53FromDiscord<Elegantbeef> generics are only generate based of scope of the first instantiation
23:20:54FromDiscord<Elegantbeef> But if you replaced that with a template it'd call the `doThing` in scope
23:21:27FromDiscord<evoalg> nice 🙂 🙂
23:25:20FromDiscord<kaddkaka> sent a long message, see https://paste.rs/oTk
23:25:34FromDiscord<Elegantbeef> There is sadly no `all`
23:26:11FromDiscord<kaddkaka> In reply to @Elegantbeef "There is sadly no": Sure, I'm not even sure if `all` would make sense.
23:26:12FromDiscord<Elegantbeef> Distincts i think are exactly what you're after you can make this easier on yourself though
23:27:21FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Kt3
23:27:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Kt4
23:28:06FromDiscord<Isofruit> OH! Man that took a while until I understand between your comment and the docu what mixin is
23:28:36FromDiscord<Elegantbeef> The simple description is "Mixin forces symbols to be resolved at callsite instead of declaration"
23:28:41FromDiscord<Isofruit> So mixin tells it "Ignore the fact that within the file that this generic is in you don't know what this function/variable means, that'll be available from the context of whatever function will call you"
23:29:07FromDiscord<Elegantbeef> It does also consider any symbol accessible in the scope of the generic if it matches, but indeed
23:29:18FromDiscord<Elegantbeef> It's a "forced open symbol" which means it'll figure it out when it needs to
23:30:20FromDiscord<Isofruit> Could it be that this comes at a performance penalty?
23:30:26FromDiscord<Elegantbeef> Nope
23:30:33FromDiscord<Elegantbeef> it's all compile time reasoned
23:30:40FromDiscord<Elegantbeef> Nim's procedure calls are all statically dispatched
23:31:09FromDiscord<Isofruit> Right, right, I'm not doing methods, so no dynamic dispatch
23:31:17FromDiscord<Elegantbeef> Indeed
23:31:17FromDiscord<kaddkaka> sent a code paste, see https://paste.rs/EXc
23:31:19FromDiscord<Elegantbeef> No problem
23:32:31FromDiscord<Isofruit> for my own import reasoning as well:↵NIm only does relative imports of other modules, right?↵I've seen a SO answer that claimed you can also give absolute paths, but I've tried all variations of that that I could think of in one of my files and that did not work whatsoever
23:32:45FromDiscord<Elegantbeef> It does relative yes
23:33:20FromDiscord<Elegantbeef> no problem, templates solve many problems! 😀↵(@kaddkaka)
23:33:48FromDiscord<Elegantbeef> If your code is in a package and it's installed using nimble you can do it relative to the package root↵(@Isofruit)
23:34:13FromDiscord<Elegantbeef> So `import yourPackage/someDir/module`
23:35:47FromDiscord<creikey> hey uh I ctrl cd `nim r` mid running and now I can't delete a file in the nim cache because it's "still open"
23:35:53FromDiscord<creikey> (edit) "hey uh I ctrl cd `nim r` mid running and now I can't delete a file in the nim cache because it's "still open" ... " added "so nothing will compile"
23:36:00FromDiscord<creikey> (edit) "cd" => "c"
23:36:54FromDiscord<Elegantbeef> `killall -9 nim` if you're on \nix
23:37:11FromDiscord<Isofruit> First as a sidenote:↵Mixins solved my initial problem, which means I've resolved my silly import issue in that regard
23:37:20FromDiscord<Elegantbeef> Nice
23:37:46FromDiscord<Isofruit> Regarding imports... I'll need to setup a test project, It's not giving me absolute import paths whatsoever so I'm convinced it's something dumb on my end
23:37:53FromDiscord<creikey> In reply to @Elegantbeef "`killall -9 nim` if": back and fixed it had to restart windwos
23:37:55FromDiscord<creikey> (edit) "windwos" => "windows"
23:38:15FromDiscord<Elegantbeef> Ah
23:38:19FromDiscord<Elegantbeef> Figured it was winblows 😛
23:38:41FromDiscord<Elegantbeef> is your package `nimble develop`'d?↵(@Isofruit)
23:38:52FromDiscord<Elegantbeef> Atleast assuming you want absolute to the root
23:39:17FromDiscord<Isofruit> I... err I executed `nimble init nimstoryfont`
23:39:38FromDiscord<Elegantbeef> Yea that still doesnt throw it in your package list
23:39:39FromDiscord<Isofruit> which gave me a binary-executing project in a folder "nimstoryfont" with a src folder and a `nimstoryfont.nim` file
23:39:59FromDiscord<Elegantbeef> `nimble develop` currently symlinks it to your package registry
23:39:59FromDiscord<Elegantbeef> Which means it's "installed"
23:40:17FromDiscord<Isofruit> I read from the SO answer that "relative to main package" is possible, I just never "got" how it determines the main package
23:40:47FromDiscord<Isofruit> Anyway, I'll try the nimble develop way, I think that'll make my life significantly easier
23:41:30FromDiscord<Elegantbeef> It should indeed
23:41:59FromDiscord<Isofruit> Ah, nimble develop doesn't really do it for you if you want to go for a binary, does it?
23:42:19FromDiscord<Isofruit> > Tip: 1 messages have been suppressed, use --verbose to show them.↵> Error: Cannot develop packages that are binaries only.
23:42:27FromDiscord<Elegantbeef> I guess not
23:43:29FromDiscord<Elegantbeef> So i guess relative paths for you
23:43:40FromDiscord<Isofruit> Living the relative life
23:44:15FromDiscord<Elegantbeef> Actually if you add a `config.nims` with `switch("path", "$projectDir/../src")` it should work
23:44:19FromDiscord<Isofruit> Ohhhh and with `bind` I can go into my generic and bind a function from another package there so I don't have to import that package everywhere I go
23:44:27FromDiscord<Elegantbeef> Indeed
23:44:34FromDiscord<Elegantbeef> Welcome to generic control!
23:44:58FromDiscord<Elegantbeef> I could be wrong about it working
23:45:03FromDiscord<Isofruit> Is there a best practice whether to write mixin at the top of a function or directly before it's being used?
23:45:29FromDiscord<Elegantbeef> No clue really, it's not a common thing to see 😀
23:45:46FromDiscord<Isofruit> I'm busy enough comprehending what's all happening and resolving that in my head, I'm running into a wall trying to contemplate what would be the most "readable"
23:46:14FromDiscord<Elegantbeef> I think at the top, might make the most sense as you can see what's getting mixin'd/bind'd
23:46:25FromDiscord<Isofruit> Yeh, makes sense to me