<< 11-05-2022 >>

00:00:20*andrewrk joined #nim
00:04:33*xet7 joined #nim
00:09:34FromDiscord<!Patitotective> what could be an alternative for `resources`? assets?
00:11:46FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=3XtS
00:12:00FromDiscord<Elegantbeef> Yea they compose extremely well
00:12:38FromDiscord<Elegantbeef> If you're playing around with closure iterators you may want to consider looking at https://github.com/beef331/slicerator/blob/master/src/closures.nim
00:12:42FromDiscord<Elegantbeef> It has a bunch of utillities
00:22:25FromDiscord<huantian> how do I write a stream to a file?
00:22:35FromDiscord<Elegantbeef> Use a filestream
00:23:15FromDiscord<huantian> what proc on the filestream?
00:23:28FromDiscord<Elegantbeef> `close` 😄
00:23:55FromDiscord<Elegantbeef> `let myFs = newFileStream("name", fmWrite); fs.write"Hello world"; fs.close()`
00:24:32FromDiscord<huantian> can I do `fs.write(otherStream)`
00:24:52FromDiscord<Elegantbeef> If you write a `write` overload 😄
00:25:11*jmd_ is now known as jmdaemon
00:26:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XtV
00:27:22FromDiscord<Elegantbeef> You can of course use readall if you arent worried about the memory consumption
00:27:44FromDiscord<huantian> I think resp.bodyStream is already loaded into memory annoyingly
00:28:11FromDiscord<Elegantbeef> Ah yea it's a string stream iirc
00:28:39FromDiscord<huantian> it's probably fine since I don't need to download big files
00:28:42FromDiscord<huantian> but still annoying
00:29:58*jmd_ joined #nim
00:30:06*jmdaemon quit (Ping timeout: 252 seconds)
00:30:14FromDiscord<Elegantbeef> So uhh my wasmedge interfacing has it a big ol' brick wall of interopping structs 😄
00:30:31FromDiscord<huantian> hm maybe just make everyone not use structs
00:30:53FromDiscord<Elegantbeef> Procedures returning structs are RVO'd but there is no way of passing a wasm runtime pointer 😄
00:31:40FromDiscord<Elegantbeef> Yea it's probably best not to use structs, but hey if i could support it it'd be nice
00:31:47FromDiscord<huantian> yeah true
00:32:18FromDiscord<Elegantbeef> Was going to make a macro anyway to expand structs to a tuple of primitives
00:33:23FromDiscord<Elegantbeef> Though i do need the memory context to actually work so i can pass/recieve buffers from the runtime
00:35:05FromDiscord<spoon> trying to install nim-lang/langserver on windows↵`AppData\Local\Temp\nimble_48464\githubcom_nimlanglangserver\pipes.nim(7, 8) Error: undeclared identifier: 'WriteFile'`
00:36:42*noeontheend joined #nim
00:37:40FromDiscord<Elegantbeef> `nim -v`?
00:37:45FromDiscord<spoon> ah, build failing and no releases? alternatively if there's a way to use pmunch's nimlsp on the vscode nimsaem extension that would be good
00:37:59FromDiscord<spoon> 1.6.6
00:38:11FromDiscord<Elegantbeef> Compiled fine here
00:38:17FromDiscord<Elegantbeef> Seems like it's a windows issue
00:38:59FromDiscord<spoon> well it is in the when defined(Windows) section
00:39:14FromDiscord<Elegantbeef> Is it supposed to be `writeFile`?
00:39:28FromDiscord<spoon> probably
00:39:57FromDiscord<spoon> yeah looks like it
00:40:47FromDiscord<spoon> i'll clone it and try
00:43:18FromDiscord<spoon> seems to be working
00:48:53FromDiscord<Elegantbeef> Lol i just tried it in kate and it did nothing but crash 😄
00:49:22*Gustavo6046 is now known as wallabra
00:50:36FromDiscord<spoon> kate crashed?
00:50:47FromDiscord<Elegantbeef> The LSP
00:51:02FromDiscord<Elegantbeef> Guess it's' LS
00:51:26FromDiscord<spoon> guess it needs a couple things
00:52:03FromDiscord<spoon> i was using the nimsaem extension for vscode on nimsuggest mode but it wasnt suggesting anything
00:52:32FromDiscord<spoon> was hoping the lsp would solve it but it also relies on nimsuggest, hmm
00:52:56FromDiscord<Elegantbeef> If it's not suggesting anything it's probably that you dont have your project setup properly
00:53:57FromDiscord<Elegantbeef> `nim.project` should be set in your workspace settings
00:54:23FromDiscord<spoon> it doesnt work for single file projects?
00:54:34FromDiscord<Elegantbeef> It should
00:55:04FromDiscord<Elegantbeef> You do have `nimsuggest` in your path right?
00:55:56FromDiscord<spoon> yeah, should it be suggesting procedures like echo? its working right now for auto filling in if statement syntax and the like
00:56:50FromDiscord<spoon> but if i type `ech` nothing shows up, if i type `writeF`, nothing shows up
00:57:14FromDiscord<Elegantbeef> Probably should be wroking
00:57:15FromDiscord<Elegantbeef> working 😄
00:58:04FromDiscord<spoon> hm? is that working as expected? i think its filling in pre-made broilerplate stuff but not nimsuggest or intellisense
00:58:30FromDiscord<Elegantbeef> I mean it should suggest procedures/templates/macros
00:58:51FromDiscord<spoon> working the same on windows and manjaro
00:59:08FromDiscord<Elegantbeef> Fine i'll install vscode
01:02:12FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/973751848144097340/image.png
01:02:15FromDiscord<spoon> on manjaro could it be that i edit the path variable in my zsh user config instead of having some global file?
01:02:25FromDiscord<spoon> yeah it does not look like that for me
01:02:30FromDiscord<Elegantbeef> Fresh vscodium with saem's extension
01:03:17FromDiscord<spoon> why are both my computers like this, if its this...
01:04:09FromDiscord<Elegantbeef> No clue
01:04:12FromDiscord<spoon> nope i disabled copilot so thats not it
01:04:22FromDiscord<Elegantbeef> Do you have any extensions interfering?
01:05:44FromDiscord<Elegantbeef> Anything in your extension output?
01:06:04FromDiscord<spoon> disabled all my extensions one by one
01:06:08FromDiscord<spoon> still no idea
01:06:17FromDiscord<spoon> code - oss on manjaro
01:06:41FromDiscord<Elegantbeef> Got to your output tab and move to Nim and see what the extension says
01:07:40FromDiscord<spoon> output tab's empty
01:07:50FromDiscord<spoon> move to nim?
01:08:00FromDiscord<Elegantbeef> Yes click the dropdown and click Nim
01:08:23FromDiscord<spoon> yeah its empty
01:09:26FromDiscord<Elegantbeef> Log(Extension Host)?
01:09:39FromDiscord<spoon> could it be that yours is taking from previous parts of the code?
01:09:42FromDiscord<spoon> vscode does that
01:09:47FromDiscord<Elegantbeef> What?
01:09:58FromDiscord<spoon> you're on line 160
01:10:14FromDiscord<Elegantbeef> No goto definition works and it had the proper symbols for types/consts and the like
01:10:26FromDiscord<spoon> ah yeah
01:10:29FromDiscord<Elegantbeef> It had full procedure introspection
01:11:51*omanom quit (Ping timeout: 252 seconds)
01:12:11FromDiscord<spoon> i have no idea
01:15:08FromDiscord<spoon> tried installing nimlangserver on linux and got a different error...
01:17:03FromDiscord<spoon> sent a code paste, see https://play.nim-lang.org/#ix=3Xu2
01:17:24FromDiscord<spoon> it compiled on windows after i changed the w to lowercase though...
01:17:29FromDiscord<Elegantbeef> What the hell is wrong with your computers
01:18:09FromDiscord<spoon> technology hates me but i proceed to use it
01:18:27FromDiscord<spoon> maybe technology hating me is why i had to edit so many config files to get vulkan working...
01:21:07FromDiscord<spoon> even with every other extension disabled, including the purely aesthetic ones... on both platforms...
01:21:45FromDiscord<spoon> the only logical solution is to switch to mac
01:26:26FromDiscord<!Patitotective> @Yardanico now for some reason npeg on windows cant find `libstdc++-6.dll` and `libgg_s_seh-1.dll`↵is this the same mingw thing? i guess i really need to update it lol
01:46:10*ltriant_ quit (Ping timeout: 240 seconds)
01:48:23*ltriant joined #nim
02:00:44rockcaveraPatitotective, you should use "dependency walker" to check the dependencies of your programs and thus ship them with the executable.
02:00:47rockcaverahttps://www.dependencywalker.com/
02:01:11*andrewrk left #nim (Leaving)
02:01:28rockcaveralibstdc++-6.dll is a c++ lib, if I'm not mistaken.
02:02:03rockcaverado you use nim cpp to compile?
02:04:13FromDiscord<!Patitotective> yep
02:04:18FromDiscord<!Patitotective> for imgui
02:05:04FromDiscord<!Patitotective> In reply to @rockcavera "Patitotective, you should use": looks cool 👀 ↵ill test it tomorrow thanks :]
02:05:10rockcaverathen you will have to send the dlls along with your executable
02:06:50FromDiscord<!Patitotective> are they heavy? :[
02:08:16rockcaverasee for yourself in your mingw compiler's bin folder
02:08:53rockcaverahttps://snipboard.io/xpFav2.jpg
02:17:26rockcaveraPatitotective try compiling with --passL:-static
02:19:10rockcaverathis should compile your executable with the static libs
02:21:23*kayabaNerve joined #nim
02:40:30*noeontheend quit (Ping timeout: 276 seconds)
02:47:39*rockcavera quit (Remote host closed the connection)
02:57:33*arkurious quit (Quit: Leaving)
03:41:27FromDiscord<Bubblie> how do you do collective imports in nim?
03:43:00FromDiscord<Elegantbeef> `import std/[strutils, sequtils]`
03:43:01FromDiscord<Elegantbeef> `import mymodulea, mymoduleb`
03:43:14FromDiscord<Bubblie> thanks
04:01:30*bananahead quit (Quit: The Lounge - https://thelounge.chat)
04:02:21*bananahead joined #nim
04:10:58*kenran joined #nim
04:11:39FromDiscord<Bubblie> so how would I go about importing hello.nim into apple.nim, they aren't in the same folder here
04:11:52FromDiscord<Bubblie> gimmie one sec
04:12:12FromDiscord<Bubblie> https://media.discordapp.net/attachments/371759389889003532/973799661993353266/unknown.png
04:12:20FromDiscord<huantian> import test/hello
04:19:38FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=3IV8
04:19:40FromDiscord<Bubblie> so it can be exported
04:19:51FromDiscord<Elegantbeef> always on the name
04:20:14FromDiscord<Bubblie> sent a code paste, see https://paste.rs/oFH
04:20:14FromDiscord<Elegantbeef> yes
04:20:41FromDiscord<Elegantbeef> `proc helloProc =` is generally how you'd write that
04:20:52FromDiscord<Elegantbeef> Though some swear by `()`
04:21:01FromDiscord<Bubblie> thank you beef
04:23:42FromDiscord<Bubblie> In reply to @Bubblie "": oh yeah if I wanted to use apple.nim in hello.nim instead, would I do import apple or something?
04:23:54*dithpri joined #nim
04:23:56FromDiscord<Elegantbeef> `../apple`
04:24:06FromDiscord<Elegantbeef> Nim imports are just paths
04:24:11FromDiscord<Bubblie> ah alright
04:24:15FromDiscord<Elegantbeef> With the exception of `std` and `pkg` prefix
04:35:59*kayabaNerve quit (Remote host closed the connection)
04:36:24*kayabaNerve joined #nim
04:49:17*kenran quit (Quit: WeeChat info:version)
04:50:12*slowButPresent quit (Quit: leaving)
05:09:43*firq quit (Ping timeout: 260 seconds)
05:11:20*firq joined #nim
05:22:39*vicfred joined #nim
05:38:34*dithpri quit (Ping timeout: 240 seconds)
05:42:03*dithpri joined #nim
05:56:14FromDiscord<kaddkaka> I'm really interested in Nim, and I had a fun time with it at advent of code. But I really don't like the case and underscore insensitivity, and it's also the point where my colleagues grunt the most.↵↵Can it be turned off?↵Are there any discussions about it?
05:56:46FromDiscord<Elegantbeef> you can do `--styleCheck:error` which enforces the declaration to match all usages
05:57:02FromDiscord<Elegantbeef> There presently is an active RFC about it
05:57:45FromDiscord<Elegantbeef> I'll never get the dislike of it though 😄
06:00:07piapiacneither me :P case sensitivity on the first letter is useful -- and i cant think of any other situation where case insensitivity would cause me trouble lol
06:01:53FromDiscord<xflywind> I use vscode, so search is conventient for me too. So I don't care.
06:06:10FromDiscord<Rika> Ask yourself why you don’t like it
06:06:19FromDiscord<Rika> And tell us if you don’t mind
06:18:21*jjido joined #nim
06:18:22*jjido quit (Client Quit)
06:21:33*jmd_ quit (Ping timeout: 252 seconds)
06:27:58FromDiscord<fbpyr> I love ❤️ the case insensitivity! 🙂
06:30:14FromDiscord<fbpyr> for me the advantage seems\: I can have (admittedly longer but) more readable variable names in my code, but do not step on other people's toes..
06:30:55FromDiscord<aph> i like it where i can switch cases between snake case and camelcase
06:32:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XuE
06:32:54*jjido joined #nim
06:35:42FromDiscord<fbpyr> yaiks.. 🙄
06:37:24FromDiscord<fbpyr> I assume the inverted question to that would be\:↵which code base has `someVar` and `some_var` and needs to distinguish them and thinks this is a good idea?
06:38:07FromDiscord<Elegantbeef> It generally comes down to "You're right the compiler should stop that but not like this but with a single convention"
06:38:47FromDiscord<Rika> There’s already within code base convention enforcement right
06:39:12FromDiscord<Elegantbeef> Yea there is `stylecheck` and has `usage` and `error`
06:39:18FromDiscord<Elegantbeef> usage enforces the usage and error nep1
07:07:17FromDiscord<Asbjørn F> I like insensitivity to the point where if a lib uses `some_var`, but my stuff uses `someVar`, I want to continue the same style in my current stuff. I also like being able to enforce rules for teams
07:12:30*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
07:12:37FromDiscord<Elegantbeef> Yea i'd say in a single project the first usage of a symbol should be the required version
07:14:14FromDiscord<Elegantbeef> So say you have a library that has `some_proc` and you use it `someProc` you now can no longer do `some_proc` and for something like `GLCLEAR` if you do `GlClear` you no longer can refer to it by anything else
07:14:37FromDiscord<Elegantbeef> This should in theory solve the problem developers have with style insensitivity whilst maintaining it
07:15:55FromDiscord<Asbjørn F> I don't know how hard this would be to maintain. Currently we just do this by convention when I work with people
07:17:31Amun-RaI wish nimsuggest had a switch to suggest snake case naming convention
07:18:18FromDiscord<Elegantbeef> I wish it had a normalizer for your prefer style aswell
07:18:22FromDiscord<Elegantbeef> It's relatively easy to add it to vscode
07:18:31FromDiscord<Elegantbeef> But no clue about nimsuggest
07:26:01Amun-Raone way is writing a proxy and rewrite suggestions
07:26:38FromDiscord<Elegantbeef> Probably easier to just add a config setting to nimsuggest and changing the suggestions it generates 😄
07:26:56Amun-Ra;>
07:27:15FromDiscord<Yardanico> @beef I guess the conversion should basically work on capitalized letters and underscores?
07:27:23FromDiscord<Yardanico> take_this_test becomes takeThisTest and vice-versa
07:28:02FromDiscord<Elegantbeef> Yea you can only really do it for lowercase starting variables
07:28:07FromDiscord<Elegantbeef> i mean starting symbols
07:28:18FromDiscord<Elegantbeef> Attempt to reason those scream cased symbols 😄
07:28:30Amun-Ramhm
07:30:40Amun-Rawhich vscode nim plugin you use? saem's or zaitsev's?
07:36:33FromDiscord<Elegantbeef> I used saem's when used vscode
07:39:43Amun-RaI'll give it a try
07:49:10FromDiscord<Yardanico> In reply to @Amun-Ra "which vscode nim plugin": the kosz one is effectively not maintained anymore
07:49:23FromDiscord<Yardanico> btw @beef i noticed that saem apparently compiled nimsaem with nimskull :)
07:49:26FromDiscord<Yardanico> version header in the js file
07:49:47FromDiscord<Elegantbeef> Kinda expected 😄
08:07:11*PMunch joined #nim
09:19:14FromDiscord<Rika> That’s cool
09:35:42FromDiscord<ambient> So has anyone considered for Nim and Jupyter notebooks to just save the global state to a local server through a message queue and then just manually identify through a macro--parts you want to keep notebook-global? Or did I completely miss it? Or is this something that would not work for that use-case?
09:56:17FromDiscord<dom96> Any useful comparisons between the saem one and the kosz one?
09:56:49FromDiscord<Rika> “One is being worked on”?
09:57:30FromDiscord<dom96> well sure, but what other differences are there, feature wise
09:59:34FromDiscord<Rika> Dunno, probably none yet? Functionality wise I think it improves on how it spawns suggest
09:59:51FromDiscord<Rika> One instance per project if you set the project config file
10:00:38FromDiscord<tandy> kosz is written in typescript↵(@dom96)
10:01:46FromDiscord<tandy> from the readme
10:01:47FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3Xv9
10:02:59FromDiscord<Rika> Nice
10:03:12FromDiscord<Rika> In reply to @tandy "kosz is written in": Does that make a difference?
10:03:41FromDiscord<Rika> Also what is problem detection?
10:08:43FromDiscord<tandy> not sure
10:08:54FromDiscord<tandy> is there something like pickle for nim?
10:09:21FromDiscord<dom96> marshal
10:09:27FromDiscord<dom96> (edit) "marshal ... " added "module"
10:09:43FromDiscord<xflywind> Another difference is that the former one can probably drop Nim support.
10:11:26FromDiscord<ambient> std/marshal doesn't work on objects 😢
10:11:31FromDiscord<jmgomez> so you to be sure, you have to init nim for every thread call that you do right? (those threads arent created on the nim side of things)
10:11:40FromDiscord<jmgomez> (edit) "you" => "just"
10:12:54FromDiscord<ambient> sent a code paste, see https://play.nim-lang.org/#ix=3Xvb
10:16:24FromDiscord<ambient> like what are the other runtime types?
10:16:40FromDiscord<Yardanico> In reply to @ambient "like what are the": this refers to inheritance
10:16:48FromDiscord<Yardanico> (i think)
10:17:02FromDiscord<ambient> well that would be nice, because I never use inheritance
10:17:10FromDiscord<Yardanico> then you don't really need to use std/marshal really
10:17:18FromDiscord<Yardanico> if you want binary serialization, https://github.com/treeform/flatty is really good
10:17:26FromDiscord<Yardanico> for json std/json's `to` is enough
10:17:31FromDiscord<ambient> i don't know how to output stuff to a message queue without marshalling?
10:17:38FromDiscord<ambient> i see
10:17:45FromDiscord<Yardanico> i mean not `to`, but `%`
10:18:52FromDiscord<Yardanico> but yeah flatty is nice, and if you're doing it over the network you might also want to use it together with https://github.com/guzba/supersnappy to compress (since binary serialized data usually compresses really well)
10:22:42FromDiscord<tandy> how can i avoid errors when storing generic procs like this?↵`let activations = @[relu, tanh, sigmoid]`
10:23:23FromDiscord<Yardanico> they're different types, so you either use an object variant with all possible proc types, make it so all of these procs have the same signature, or pass them around as raw pointers
10:23:29FromDiscord<Yardanico> but for 3 you'll also have to remember the types somewhere else
10:23:33FromDiscord<planetis> since you been talking about JSON, what do you think about thishttps://github.com/planetis-m/packedjson2/issues/7
10:23:44FromDiscord<planetis> instantiate them or make a macro
10:24:12FromDiscord<planetis> awesome I pinged myself
10:24:37FromDiscord<Yardanico> are you ok planetis
10:24:45FromDiscord<Yardanico> you seem to be sending random messages in #offtopic and here :P
10:25:01FromDiscord<planetis> just testing discord
10:25:03FromDiscord<Rika> They don’t look so random to me?
10:25:06FromDiscord<planetis> i dont like it
10:25:21FromDiscord<planetis> I mean I like discord better than matrix
10:25:25FromDiscord<planetis> but still
10:25:26FromDiscord<Rika> Compared to what? Though yeah I kinda get not liking discord
10:25:42FromDiscord<Yardanico> In reply to @planetis "I mean I like": yeah makes sense
10:25:45FromDiscord<Rika> “Best amongst bad choices” kind of thing
10:25:50FromDiscord<planetis> yep
10:25:55FromDiscord<tandy> i see, but all proc signatures look like this↵`proc sigmoid[TT](a: Variable[TT]): Variable[TT] =`↵(@Yardanico)
10:26:12FromDiscord<Yardanico> ah, this is a generic proc
10:26:24FromDiscord<tandy> ye i said generic proc
10:26:25FromDiscord<tandy> \:)
10:26:30FromDiscord<planetis> In reply to @tandy "i see, but all": make a macro/template
10:26:42FromDiscord<Yardanico> or a non-generic proc that calls the generic version :P
10:27:16FromDiscord<Yardanico> as another @tandy you can store the instantiated generic procs
10:27:35FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Xve
10:28:01FromDiscord<tandy> hmm
10:28:10FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3Xvf
10:28:18FromDiscord<tandy> i also get this issue when passing the proc \:/
10:28:33FromDiscord<Yardanico> well i'm not sure how arraymancer macros work regards to that
10:28:43FromDiscord<Yardanico> maybe they expect you to instantiate the generic proc right into the body
10:38:37*Zectbumo quit (Remote host closed the connection)
10:41:36PMunch@jmgomez, not if you're using ARC/ORC
10:41:53PMunchBut the default GC needs `setupForeignThreadGC`
10:42:13PMunchThis can also be called multiple times on the same thread without issue
10:45:25FromDiscord<tandy> for now im using an enum with case statement↵(@Yardanico)
10:47:28FromDiscord<jmgomez> In reply to @PMunch "<@726017160115126333>, not if you're": okay, thanks! Maybe I should start looking at these
10:51:30FromDiscord<Yardanico> In reply to @jmgomez "okay, thanks! Maybe I": they're much better for C FFI and managing memory :)
10:52:35*xet7 quit (Remote host closed the connection)
10:53:40FromDiscord<jmgomez> In reply to @Yardanico "they're much better for": Since they werent the default I decided to learn other bits first. But I also wonder if they are stable enough?
10:53:57FromDiscord<Yardanico> for a lot of stuff yes
10:54:11FromDiscord<Yardanico> just try --mm:orc and see if it works for your projects :)
10:55:02FromDiscord<jmgomez> roughly speaking, what's the difference between orc and arc?
10:55:07PMunchI've been using ARC/ORC for lots of things, I even use it in production
10:55:13FromDiscord<Yardanico> In reply to @jmgomez "roughly speaking, what's the": orc collects cycles
10:55:14PMunchORC is ARC with cycle collection
10:55:16FromDiscord<Yardanico> that's the only difference
10:55:25FromDiscord<jmgomez> gotcha!
10:55:29FromDiscord<Yardanico> arc is just refcounting with move semantics, there's no tracing or whatever
10:55:51FromDiscord<jmgomez> so some sort of automatic unique + ref smart pointers?
10:56:02FromDiscord<jmgomez> (edit) "ref" => "shared"
10:59:45FromDiscord<Yardanico> maybe, I don't really know the C++ specifics :)
11:00:26FromDiscord<jmgomez> 👍
11:06:40FromDiscord<demotomohiro> AFAIK, arc is almost same to std::shared_ptr<T> in C++ but reference counter is not atomic.
11:08:00FromDiscord<jmgomez> In reply to @demotomohiro "AFAIK, arc is almost": with atomic you mean that it doesnt happen on each actual reference?
11:09:59FromDiscord<demotomohiro> Ref counter is not atomic and one object cannot be shared by mutiple threads.
11:11:17FromDiscord<demotomohiro> If I remember correctly, std::shared_ptr in C++ use atomic ref counter to make it thread safe.
11:14:17FromDiscord<jmgomez> Okay, thanks!
11:17:57FromDiscord<jmgomez> In reply to @PMunch "<@726017160115126333>, not if you're": so just tested with ORC and it works fine wihout calling initMain. If I use ORC I dont have to call it even on the main thread? Or does it does something else besides the GC bits?
11:18:45FromDiscord<Yardanico> you don't have to, yes
11:18:59FromDiscord<Yardanico> and even with refc you don't have to call it in the main thread (if it's managed by nim)
11:20:14PMunch`initMain`
11:20:19PMunchWhat's that?
11:20:27PMunchDid you mean `NimMain`?
11:20:38FromDiscord<jmgomez> In reply to @Yardanico "and even with refc": I had some issues, maybe I have to in my use case? (dynLibs)
11:20:57PMunchYou have to call NimMain in order to initialize global values, but otherwise you don't have to call it when using ORC
11:21:11FromDiscord<jmgomez> In reply to @PMunch "Did you mean `NimMain`?": ouch yes, sorry
11:21:35FromDiscord<jmgomez> Cool. Thanks for the clarification
11:38:57*jjido joined #nim
12:04:45*pch quit (Remote host closed the connection)
12:05:25FromDiscord<Yardanico> In reply to @jmgomez "Cool. Thanks for the": yeah you have to call NimMain even with ORC because it's not just the GC
12:05:37FromDiscord<Yardanico> it initializes all modules (usually globals)
12:12:17*rockcavera joined #nim
12:12:18*rockcavera quit (Changing host)
12:12:18*rockcavera joined #nim
12:19:41*slowButPresent joined #nim
12:20:52*omanom joined #nim
12:24:16*pch joined #nim
12:30:48*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
12:31:31*jjido joined #nim
12:41:40FromDiscord<ambient> how do I make custom compile time array constructor (like a sine lookup table for 0..255)?
12:44:07FromDiscord<exelotl> sent a code paste, see https://paste.rs/yfX
12:44:22FromDiscord<ambient> ok I'll give it a shot, ty
12:44:57FromDiscord<exelotl> the `static` could also be `block` since the `const` enforces it to be evaluated at compile-time regardless of what kind of block is used
12:45:09FromDiscord<exelotl> but I like to use `static` for clarity x)
12:49:25*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
12:53:45FromDiscord<ambient> sent a code paste, see https://paste.rs/vd5
12:57:40FromDiscord<Rika> you cannot index arrays with non-ordinal types
12:57:45FromDiscord<Rika> complex isnt ordinal i believe
12:58:30FromDiscord<exelotl> oops, I meant array[256, float]
12:58:34FromDiscord<exelotl> sorry 😅
12:59:22FromDiscord<jmgomez> In reply to @Yardanico "it initializes all modules": gotcha, but only in the main thread or everywhere?
13:02:10FromDiscord<Rika> In reply to @ambient "Error: ordinal type expected": if you mean `array[pt, Complex[float]]` it still wont work because `pt` must be compile time
13:06:04FromDiscord<ambient> sent a code paste, see https://paste.rs/tXL
13:06:49FromDiscord<ambient> nvm it was inside a function
13:06:52FromDiscord<ambient> me and my Python ways
13:28:01FromDiscord<tandy> you should use arraymancer @ambient
13:28:59FromDiscord<ambient> why?
13:38:36FromDiscord<tandy> nicer than using arrays \:)↵(@ambient)
13:39:40FromDiscord<tandy> its like numpy for nim
13:51:59FromDiscord<ambient> I've used Numpy quite a lot and know its limits, it's often pretty tough to write complex algorithm with APL style
13:54:57*noeontheend joined #nim
13:55:43FromDiscord<ambient> simple changing from var to ptr increases perf by 3x because (pty, ptx) = (ptx, pty) is a copy :/
13:56:00FromDiscord<ambient> i would assume
13:59:07*noeontheend quit (Ping timeout: 240 seconds)
14:05:34*arkurious joined #nim
14:32:04*vicfred quit (Quit: Leaving)
14:48:16*jjido joined #nim
14:58:33*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
15:01:36*def- quit (Quit: -)
15:03:15*def- joined #nim
15:07:41NimEventerNew post on r/nim by CanMyPro: Is there a DNS library for Nim?, see https://reddit.com/r/nim/comments/unbz98/is_there_a_dns_library_for_nim/
15:10:42*def- quit (Quit: -)
15:11:04*def- joined #nim
15:15:44*def- quit (Client Quit)
15:15:58*def- joined #nim
15:25:06*thadeudepaula joined #nim
15:26:53FromDiscord<Rika> beef how do i test an example out from within picostdlib? do i really have to make a new project
15:35:57*stkrdknmibalz quit (Ping timeout: 276 seconds)
15:37:05*def- quit (Quit: -)
15:38:28*def- joined #nim
15:41:14thadeudepaulaHi folks...
15:41:16thadeudepaulaWrapping a two state function return defined as int, I want to use the Nim boolean type.
15:41:18thadeudepaulaThere is two ways:
15:41:20thadeudepaula- `proc x() : bool {.cdecl.}`
15:41:22thadeudepaula- `proc y() : int {.cdecl.}; template y2() : bool = bool(y())`.
15:41:24thadeudepaulaThe result differs as for `x()` any value != 1 is false.
15:41:26thadeudepaulaAnd for y2() any value != 0 is true.
15:41:28thadeudepaulaSince the C original function shouldn't return anything different from 0 or 1,
15:41:30thadeudepaulais there some gain in the `x()` approach instead of the
15:41:50thadeudepaula`y()` one?
15:42:08FromDiscord<Rika> its shorter?
15:42:45FromDiscord<Rika> i personally think you should do y though; im not sure whether x is undefined behaviour or not
15:43:15FromDiscord<Rika> also probably better if you make y2 a `proc {.inline.}` instead so the compiler inlines to its discretion
15:43:27FromDiscord<Rika> or not, you do you i guess
15:45:36thadeudepaulaYes... want it to be the nearest to C, but using the bool concept (because if's in Nim are just for booleans). If at least I could know if the `x()` way is a well defined behavior in Nim, I could stick with it.
16:07:32*jjido joined #nim
16:38:03Amun-RaI'd make that type distinct cint
16:39:36*stkrdknmibalz joined #nim
16:42:51*gsalazar quit (Ping timeout: 256 seconds)
16:49:12*kenran joined #nim
17:02:59*Zectbumo joined #nim
17:14:39*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
17:14:45*Zectbumo quit (Ping timeout: 260 seconds)
17:15:38*Zectbumo joined #nim
17:29:15*kayabaNerve quit (Ping timeout: 252 seconds)
17:39:32*Zectbumo_ joined #nim
17:42:12*Zectbumo quit (Ping timeout: 240 seconds)
18:12:33om3gaHello! Again me with stupid questions. how to deal with Duration type? I want to measure diff between stop and start, both are MonoTimes. But when I try to assign that diffs to min_time: Duartion and max_time: Duration, I get very strange output like datetime
18:12:52om3ga13 hours, 42 minutes, 24 seconds, 529 milliseconds, 564 microseconds, and 469 nanoseconds
18:13:56om3gawhy for examle - diff_time: Duration = (stop - start) may give that text ^
18:14:40om3gabetter I will write some example in playground
18:15:23FromDiscord<Zoom> Are templates supposed to work in `static` blocks?
18:19:30FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3XwQ
18:24:48*PMunch_ joined #nim
18:24:49FromDiscord<exelotl> @Zoom not sure if it relates to your issue but beware of this: https://github.com/nim-lang/Nim/issues/16620
18:29:40*xet7 joined #nim
18:35:54FromDiscord<Zoom> @exelotl\: Yeah, I noticed it doesn't work \:)
18:36:24om3gastrange : https://play.nim-lang.org/#ix=3XwV
18:36:27om3gahere it works
18:36:49FromDiscord<Zoom> But yeah, it's unrelated
18:40:40FromDiscord<Zoom> Well, since it's silent there, I'm gonna open an issue then
18:45:48*PMunch quit (Killed (NickServ (GHOST command used by PMunch_)))
18:45:54*PMunch_ is now known as PMunch
18:46:13*PMunch_ joined #nim
18:53:10*noeontheend joined #nim
19:00:35FromDiscord<Zoom> #19786
19:03:19*duuuuuude joined #nim
19:04:14FromDiscord<Zoom> Well, since this idea didn't work... Do you have any ideas on how could I parametrize compile-time code besides defines? I need to cross the module barrier and make it as close to no additional input required at the caller site as possible.
19:12:30FromDiscord<Zoom> I can't use compileTime variables, due to the order of evaluation. Everything using them in the main code happens after the code in a module.
19:15:08FromDiscord<Zoom> So, it seems the question boils down to\: how can I take a statement from one place and inject it in another module?
19:19:15NimEventerNew Nimble package! matext - Render LaTeX math as multiline Unicode text, see https://git.sr.ht/~xigoi/matext
19:20:35FromDiscord<Zoom> It's probably the first time I'm really personally interesting in what the macrosystem has to offer \:D
19:25:48FromDiscord<Zoom> Hm, what I want breaks the evaluation order anyway, so it has to be done at macro/template expansion stage, right?
19:26:55*caliente22 joined #nim
19:30:54*caliente22 quit (Quit: Konversation terminated!)
19:31:44*jjido joined #nim
19:31:53*caliente22 joined #nim
19:36:25*Zectbumo_ is now known as Zectbumo
19:56:56*PMunch quit (Quit: leaving)
20:00:30*noeontheend quit (Ping timeout: 252 seconds)
20:05:27*jmdaemon joined #nim
20:13:42*koltrast quit (Quit: ZNC - http://znc.in)
20:16:23FromDiscord<resumin> sent a long message, see http://ix.io/3Xxi
20:24:42FromDiscord<dom96> The compiler already uses .nimble files to generate filenames for C sources (at least this was true a couple of years ago)
20:25:04FromDiscord<dom96> this is to that if two packages have a `utils.nim` file Nim doesn't generate two `utils.c` files
20:25:13FromDiscord<Yardanico> In reply to @dom96 "The compiler already uses": it doesn't really, it just uses paths
20:25:15FromDiscord<dom96> (edit) "to" => "so"
20:27:25FromDiscord<Yardanico> for example if you have flatty.nim that's imported by other.nim and main.nim imports both local flatty and pkg/flatty https://media.discordapp.net/attachments/371759389889003532/974045083185872926/unknown.png
20:27:52FromDiscord<dom96> ahh, so this was changed then I guess
20:29:25FromDiscord<dom96> in that case, yeah, compiler has no concept of a package (in how it's used commonly, i.e. with `--noNimblePath` and with explicit package paths passed to it)
20:29:45FromDiscord<dom96> I guess this was changed to just use absolute paths and avoid looking for the .nimble file altogether
20:30:35FromDiscord<resumin> Thank you for the info. Wouldn't the distinction be needed to aid IDE tooling? I know I get a lot of messages from other packages that I'd like filtered out.
20:30:45FromDiscord<dom96> which is funny, because there is still a stdlib.nimble file in `devel` https://github.com/nim-lang/Nim/blob/devel/lib/stdlib.nimble
20:31:08FromDiscord<Yardanico> there is quite a lot of outdated stuff in the main nim repo
20:31:25FromDiscord<Yardanico> for example <https://github.com/nim-lang/Nim/blob/devel/tools/downloader.nim>
20:32:09FromDiscord<dom96> ahh, those were the days https://github.com/nim-lang/Nim/commit/c55f5b34ee4d3c44c21b17c93e8d38dd867fb9cc
20:33:47FromDiscord<dom96> In reply to @resumin "Thank you for the": True. This could be a good thing to pursue for Nim v2: proper awareness of packages.
20:37:26reversem3[m]Has anyone created a web component using dom api using shadowRoot ?
20:48:33FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=
20:48:41FromDiscord<Bubblie> I find this a bit weird for importing
20:50:50FromDiscord<Elegantbeef> `../` is not parsed as `".."/`↵(@Bubblie)
20:51:00FromDiscord<Elegantbeef> It's an issue but unresolved presently
20:51:24FromDiscord<Bubblie> ah okay, I hope it is resolved cause it is a bit weird ngl 😅
20:54:14*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
21:00:24FromDiscord<Zoom> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: you here? Any thoughts on my questions above?
21:01:05*lumo_e joined #nim
21:01:23FromDiscord<Elegantbeef> The TRM?
21:02:34FromDiscord<Zoom> Term-rewriting macros
21:03:48FromDiscord<Elegantbeef> Yea i was making sure it was the same question 😄
21:04:01FromDiscord<Elegantbeef> Rather right question
21:04:17FromDiscord<Elegantbeef> I think the answer is TRMs dont effect static blocks
21:05:45FromDiscord<Zoom> I meant any ideas on if what I want is possible?
21:07:32FromDiscord<Elegantbeef> Is the point just to have a top level property?
21:10:33FromDiscord<Elegantbeef> Works
21:10:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XxF
21:10:40FromDiscord<Elegantbeef> Anyway it seems you just want a property
21:12:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XxG
21:12:08FromDiscord<Elegantbeef> It gives you the same logic as above but i guess you can use it with more than `=` which may be an issue for you
21:16:13FromDiscord<Zoom> But I want this to work across modules, and the order is reversed if the `var` is in imported module
21:19:40FromDiscord<Elegantbeef> Do you have a more elaborate explanation of what you're after?
21:21:10FromDiscord<Elegantbeef> Like it seems like you want a top level compiletime property which isnt supported so you want touse TRMs to achieve it
21:21:21FromDiscord<Elegantbeef> In that case i'd personally suggest use a keyword instead
21:21:37FromDiscord<Zoom> Mm, not sure how I can elaborate "parametrize compile-time code (besides defines) in a module from a caller site"
21:21:49FromDiscord<Elegantbeef> Hey dont use big words i'm an idiot
21:22:16FromDiscord<Elegantbeef> I say keywords but i mean command syntax +
21:22:24FromDiscord<Zoom> Affect compile time/const expression of a module from a caller
21:22:48FromDiscord<Elegantbeef> Yea it's not possible it seems so you pretty much need a macro afaict
21:23:49FromDiscord<Zoom> This bit I got figured out after applying some brainpower \:D
21:24:08FromDiscord<Elegantbeef> Well i mean like a macro that is named `setA` which expands to whatever your TRM did
21:25:04FromDiscord<Zoom> I'm just not on good terms with macros. The hard bit is to inject the statement from module A into the module B.
21:25:30FromDiscord<Elegantbeef> Ok so B is hidden in the macro module?
21:26:02FromDiscord<Zoom> Eh, preferably it contains the macro which is called from module A (which imports B)
21:26:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XxL
21:27:55FromDiscord<Zoom> But the thing is. with compile time vars, if I access B from module A, it gets modified after it's accessed in module B.
21:28:31FromDiscord<Elegantbeef> oh this is the good ol' order of operations issue with modules
21:28:31FromDiscord<Zoom> This is the was the roadblock
21:29:14FromDiscord<Elegantbeef> So you rely on a symbol B we'll say that you use in your macro, but B is only set after importing the module which means your macro doesnt get the proper information
21:29:34FromDiscord<Zoom> Yeah, exactly. It was implied in the initial question\: affect static stuff more or less as a define does.
21:31:08FromDiscord<Elegantbeef> I had a similar order of operation issue with nimscripter, the way i resolved it was to use a macro call that expands at the callsite and gives me the data i want
21:31:09FromDiscord<Elegantbeef> With my RPC i also had a similar issue which was resolved with a lambda being emitted
21:31:09FromDiscord<Zoom> Well, the stupidest solution is hide a `define` behind a macro or that term-rewriting hook.
21:32:50FromDiscord<Zoom> But this is so meh
21:32:59FromDiscord<Elegantbeef> Yea it's a big issue with macros imo there is no late evaluation
21:33:40FromDiscord<Elegantbeef> You either need to emit templates and call them from the macro/template or do the thing where you just call a emitter at the end
21:34:25FromDiscord<Zoom> 😵‍💫 Emit where?
21:34:57*kenran quit (Quit: WeeChat info:version)
21:36:32FromDiscord<Elegantbeef> It depends what you're actually doing
21:40:28FromDiscord<Zoom> I'm not even sure how to phrase it all as a feature request for Nim v2. Another preliminary expansion pass? Let me break the order of evaluation please? 😅
21:40:59FromDiscord<Elegantbeef> No clue i think it's a complex request
21:41:07FromDiscord<Elegantbeef> "I want arbitrarily evaluated macros"
21:45:36*slowButPresent quit (Quit: leaving)
22:03:22FromDiscord<Elegantbeef> Well hopefully my change to `parseutils` using `openArray[char]` actually passes CI 😄
22:03:23FromDiscord<Elegantbeef> Suddenly makes it much much more usable
22:10:33FromDiscord<Zoom> Anyone's working on rewriting all the string stuff like `strutils` to opanArrays, btw?
22:11:11FromDiscord<leorize> beef have his strviewutils or smt
22:12:02FromDiscord<Elegantbeef> Eh that was just for fun
22:12:13FromDiscord<Elegantbeef> I'll be making a PR if the parseutils one is accepted for strutils
22:13:13*slowButPresent joined #nim
22:14:56FromDiscord<Elegantbeef> That strviewsutils was mostly a rewrite to play with the view types and to see the performance gains to be had
22:16:06*kayabaNerve joined #nim
22:17:46FromDiscord<Zoom> Might as well beef it up and make a drop-in alternative for strutils
22:23:51FromDiscord<Elegantbeef> Eh ideally the stdlib just uses `openArray[char]` so we can actually reuse the code
22:24:21FromDiscord<Elegantbeef> Got cstring and want to use `parseInt` you're SOL, got a `array[T, char]` and want to use `parseHex` you're SOL
22:25:38FromDiscord<Elegantbeef> Ah i've hit the first issue `converter: string` is not invoked for `a -> openArray[char]`
22:48:30*duuuuuude is now known as and
22:49:20*and is now known as duuude
22:53:29FromDiscord<Elegantbeef> Ah there is already an issue for this from 2015
22:53:38FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/issues/2652
23:12:34FromDiscord<ᒪITTᒪE_ᔕᑎᗩKE 🐍> In reply to @deadmeme77 "if anyone is interested,": https://i.imgur.com/327XCJe.png↵↵works 😉 TX
23:16:20*slowButP` joined #nim
23:18:28*slowButPresent quit (Ping timeout: 248 seconds)
23:21:58*slowButP` is now known as slowButPresent
23:25:36om3gaif (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; in stdlib_times.nim.c:2607:6 : runtime error: load of null pointer of type '_Bool'
23:26:13*slowButPresent quit (Changing host)
23:26:14*slowButPresent joined #nim
23:26:36om3gaI did nothing criminal in my code
23:27:08NimEventerNew thread by Nimoid: Which SQLite lib?, see https://forum.nim-lang.org/t/9152
23:28:34FromDiscord<Elegantbeef> Are you using an odd C compiler?
23:30:41om3gaElegantbeef - gcc
23:30:58om3gagcc (GCC) 11.2.0
23:31:13om3ga!!! again, why it appears
23:31:33om3gayes. you're correct, I had issues with gcc11 before
23:31:45om3galet me check with gcc7
23:35:20om3gaElegantbeef: with clang everything is fine. Thanks. I unable to test now with gcc7, I will check that later.
23:48:50*kayabaNerve quit (Ping timeout: 240 seconds)
23:51:01*lumo_e quit (Quit: Quit)