<< 02-05-2022 >>

00:00:51FromDiscord<Elegantbeef> well then dont pass length and just do `128`
00:02:15FromDiscord<pruno> Yeah passing 128 works, not that elegant if i ever have a dll longer than that (i know it'll never happen haha) but it works :)
00:02:23FromDiscord<pruno> Thanks
00:11:53FromDiscord<icewater200> Is there any admin/mods online? My friend asked me to join to ask why he was banned
00:12:57FromDiscord<icewater200> <@&371760044473319454>
00:15:04FromDiscord<impbox [ftsf]> Who is your friend? Banned from the discord channel? Have they been here before? If so it's probably based on what they said here
00:15:50FromDiscord<icewater200> He said he didn't say anything bad
00:16:28FromDiscord<icewater200> He was in this discord and banned from here yes
00:18:15FromDiscord<icewater200> I am going to sleep now. Would be nice if a mod would DM me
00:22:24*neceve quit (Ping timeout: 246 seconds)
00:39:02FromDiscord<!Patitotective> can i run a nimble task from a nim module? 😳
01:03:28*vicfred quit (Quit: Leaving)
01:13:36*xet7 joined #nim
01:28:54*echelon joined #nim
01:29:28FromDiscord<xflywind> In reply to @Zoom "Also, docs for "find"": No, it pre-exists my PR. I didn't write the docs of find procs. It was introduced by https://github.com/nim-lang/Nim/commit/bde899d4f8f2eee7cd65d4daaacb082a858bcf60
01:29:52*echelon left #nim (#nim)
01:33:32*rockcavera joined #nim
01:33:32*rockcavera quit (Changing host)
01:33:32*rockcavera joined #nim
01:33:35FromDiscord<xflywind> I agree it needs to be corrected/clarified.
01:35:24FromDiscord<xflywind> @Zoom
01:59:09FromDiscord<Jonah> sent a code paste, see https://paste.rs/00N
01:59:41FromDiscord<Jonah> (edit) "https://play.nim-lang.org/#ix=3WM4" => "https://play.nim-lang.org/#ix=3WM3"
01:59:45FromDiscord<Jonah> (edit) "https://play.nim-lang.org/#ix=3WM3" => "https://paste.rs/uG9"
02:00:46FromDiscord<Jonah> ah https://github.com/dom96/choosenim/blob/f609844e742b7dc4560bdf435a0d49c69e1a9bd2/scripts/choosenim-unix-init.sh#L128-L129
02:37:50*arkurious quit (Quit: Leaving)
02:47:35*Zectbumo joined #nim
03:11:49*nsyd joined #nim
03:34:54FromDiscord<kiell> nope 😠
03:35:17FromDiscord<Elegantbeef> Nope what?
03:37:33FromDiscord<!Patitotective> can i strip b here? `let (a, b) = something()`
03:37:52FromDiscord<huantian> like `let (a, _) = something()`?
03:37:53FromDiscord<!Patitotective> somethin glike `let (a, b.strip()) = something()` lol
03:38:04FromDiscord<!Patitotective> (edit) "somethin glike" => "something like"
03:38:11FromDiscord<Rika> No
03:38:31FromDiscord<Elegantbeef> `let (a, b) = (let (c, d) = something; (c, d.strip))`
03:38:51FromDiscord<Elegantbeef> I'm something of a garbage author myself
03:39:35FromDiscord<Rika> That’s technically what he wants but if he wanted the LHS style one then no
03:39:37FromDiscord<!Patitotective> i guess `var (a, b) = something(); b = b.strip()` works fine
03:39:46FromDiscord<!Patitotective> (edit) "i guess `var (a, b) = something(); b = b.strip()` works fine ... " added "lol"
03:39:50FromDiscord<Elegantbeef> Or you just do it in a block like a normal person
03:39:56FromDiscord<Rika> Yes but you’re making a and b unnecessarily mutable now
03:40:05FromDiscord<Rika> Just use the block xd
03:40:13FromDiscord<!Patitotective> :[
03:40:29FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/gvY
03:40:38FromDiscord<Elegantbeef> Cmon people write code that makes your parents proud if they even knew what the fuck you wrote
03:40:47FromDiscord<huantian> semicolon should be unnecesarry tho
03:40:53FromDiscord<huantian> wao typing
03:40:54FromDiscord<Elegantbeef> Yea was me being dumb
03:41:00FromDiscord<Rika> When aren’t you being dumb
03:41:05FromDiscord<ynfle> Don't use tuples, it'll make your parents proud
03:41:15FromDiscord<Elegantbeef> Uh... days that dont end with Y rika
03:41:33FromDiscord<Elegantbeef> Eh tuples are fine for return values but dont build systems on them
03:41:46FromDiscord<Elegantbeef> They're not statically typed so they're dumb as balls
03:41:48FromDiscord<huantian> sent a code paste, see https://paste.rs/B9T
03:42:00FromDiscord<Elegantbeef> Nah huan it has a variable intrroduced that you dont use
03:42:01FromDiscord<Rika> In reply to @Elegantbeef "Eh tuples are fine": Flashbacks to that one decimal library that used a tuple over an object for the main type
03:42:07FromDiscord<huantian> (edit) "https://paste.rs/iu7" => "https://paste.rs/MPv"
03:42:17FromDiscord<Elegantbeef> I personally want my variables to only exist in the shortest life span
03:42:21FromDiscord<Elegantbeef> Yea it's wacky rika
03:42:34FromDiscord<Elegantbeef> Tuples are not distinc types and as such you only use them in a place where ambiguity cannot be mistaken
03:42:38FromDiscord<Elegantbeef> Return types for instance
03:43:00FromDiscord<!Patitotective> someone knows how to make `mailto:[email protected]` work with `openDefaultBrowser`? lol
03:43:05FromDiscord<!Patitotective> or it just doesnt
03:43:18FromDiscord<Elegantbeef> Dont think that protocol works
03:43:29FromDiscord<huantian> I have never seen that protocol before
03:43:37FromDiscord<Rika> It’s technically not one
03:43:40FromDiscord<Elegantbeef> It's a browser API protocol or w/e
03:43:52FromDiscord<Elegantbeef> You have URIs defined that open in specific applications
03:43:55FromDiscord<!Patitotective> firefox :]
03:43:59FromDiscord<Elegantbeef> Well no
03:44:10FromDiscord<Elegantbeef> It should open in the users default mail client
03:44:26FromDiscord<!Patitotective> i meant, firefox has the mailto protocol thing
03:44:38FromDiscord<Elegantbeef> Sure, most browsers do, but that's not how you open it
03:44:47FromDiscord<huantian> huh apparently emacs is my default mail client
03:44:55FromDiscord<Elegantbeef> You get the system to open it with the responding API
03:44:57FromDiscord<!Patitotective> thunderbird 😎
03:45:07FromDiscord<huantian> yeah I have that installed but I don't use it often lol
03:45:10FromDiscord<-|-> Have you tried invoking xdg-open on Linux/Unix and ShellExecute() on Windows?
03:45:19FromDiscord<-|-> I think macOS has `open -a`
03:45:25FromDiscord<Elegantbeef> That's the solution there
03:45:28FromDiscord<Elegantbeef> Thanks
03:45:47FromDiscord<!Patitotective> In reply to @-|- "Have you tried invoking": i thought browsers did that 🙁 lol
03:46:09FromDiscord<Elegantbeef> I mean they can but you're dispatching the work wrongly
03:46:21FromDiscord<Elegantbeef> That api is meant to be used by you not given to a middle man
03:46:29FromDiscord<huantian> why have the browser do it when you can do it directly
03:46:29FromDiscord<Elegantbeef> You now need a browser that supports that API for it to work
03:48:04FromDiscord<!Patitotective> nvm-ing this↵how can i validate an url? so if its not a valid url just copy it to the clipboard instead of messing with wacky things :]
03:48:55FromDiscord<Elegantbeef> What's a valid url anyway
03:49:14FromDiscord<Elegantbeef> A ip address is a valid URL
03:49:14FromDiscord<ynfle> What do you mean by valid? On chrome, `chrome://` is valid
03:49:24FromDiscord<Elegantbeef> A filepath is a valid Url
03:49:45FromDiscord<-|-> a URI contains a scheme and everything else™️
03:49:49FromDiscord<!Patitotective> https://urlregex.com/ ?
03:49:57FromDiscord<Elegantbeef> Dont you fucking use regex
03:50:00FromDiscord<Elegantbeef> I will fucking end you
03:50:16FromDiscord<Elegantbeef> If you must you use `parseURI`
03:50:19FromDiscord<-|-> RFC3986 uses regex: `^(([^:/?#]+):)?(//([^/?#]))?([^?#])(\?([^#]))?(#(.))?`
03:50:24FromDiscord<Elegantbeef> though the question of "validity" is very ambiguous
03:50:35FromDiscord<-|-> a URI contains a scheme and everything else
03:50:37FromDiscord<!Patitotective> In reply to @Elegantbeef "Dont you fucking use": 💀 i wasnt using regex to parse the mail
03:50:57FromDiscord<Elegantbeef> People try to use regex for the best email and it's literally just `str.contains('@')`
03:51:01FromDiscord<-|-> `[a-zA-Z0-9]+:[^ ]+`
03:51:02FromDiscord<Elegantbeef> You cannot validate email with regex
03:51:08FromDiscord<Elegantbeef> The way you validate it is if you can send the message
03:51:10FromDiscord<!Patitotective> In reply to @Elegantbeef "though the question of": i just want it to not open `[email protected]` as an url
03:51:20FromDiscord<Elegantbeef> Well then check if it has `@`
03:51:25FromDiscord<Elegantbeef> That's all you need to do
03:51:33FromDiscord<-|-> but URLs can have username parts like email addresses
03:51:34FromDiscord<-|-> it's valid
03:51:38FromDiscord<!Patitotective> In reply to @Elegantbeef "People try to use": cough (?:[a-z0-9!#$%&'+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'+/=?^_`{|}~-]+)|""(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])"")@(?:(?:[a-z0-9](?:[a-z0-9-][a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-][a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-][a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-
03:52:11FromDiscord<Rika> In reply to @Patitotective "i just want it": It’s a valid URL though
03:52:28FromDiscord<Elegantbeef> Welcome to the world of the internet
03:52:34FromDiscord<Elegantbeef> The way you validate things is by seeing if anyone is home
03:52:52FromDiscord<!Patitotective> :[
03:53:23FromDiscord<!Patitotective> then what do you think is better, copying the url, email, w/e or `openDefaultBrowser`
03:53:24FromDiscord<ynfle> https://www.myrecipes.com/recipe/elegant-beef-blue
03:53:32FromDiscord<!Patitotective> (edit) "then what do you think is better, copying the url, email, w/e ... or" added "to clipboard"
03:53:47FromDiscord<Elegantbeef> I think the best thing to do is using xdgopen
03:54:02FromDiscord<Elegantbeef> `xdg-open www.google.ca`
03:54:11FromDiscord<!Patitotective> In reply to @Elegantbeef "I think the best": thats what `openDefaultBrowser` (?)
03:54:14FromDiscord<huantian> no
03:54:15FromDiscord<!Patitotective> (edit) "In reply to @Elegantbeef "I think the best": thats what `openDefaultBrowser` ... (?)" added "uses"
03:54:16FromDiscord<Rika> In reply to @Patitotective "thats what `openDefaultBrowser` uses": No
03:54:19FromDiscord<Elegantbeef> watch what happens
03:54:19FromDiscord<Rika> It’s a program
03:54:36FromDiscord<Rika> Only on certain systems
03:54:44FromDiscord<Rika> Not sure if Linux only or UNIX likes
03:55:07FromDiscord<ynfle> mac doesn't have it
03:55:15FromDiscord<Rika> This sounds like it could be a package now that I think about it
03:55:27FromDiscord<ynfle> macOS have `open <link>`
03:57:20FromDiscord<Elegantbeef> or `xdg-open mailto:[email protected]`
03:57:20FromDiscord<Elegantbeef> -\|- already gave you the answer to how to do this
03:57:20FromDiscord<Elegantbeef> It very much could be a package
03:57:41FromDiscord<huantian> but openDefaultBrowser is basically just xdg-open with some wrapping
03:57:44FromDiscord<huantian> (edit) "but openDefaultBrowser is basically just xdg-open with some wrapping ... " added "on linux"
03:58:37FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=2UiX
03:58:46FromDiscord<!Patitotective> (edit) "https://play.nim-lang.org/#ix=2UiX" => "https://play.nim-lang.org/#ix=2UBq"
03:58:50FromDiscord<Rika> @-|- how should we call you here xd -|- is really annoying to type hahaha, if you don’t mind of course
03:59:05FromDiscord<Rika> sent a code paste, see https://paste.rs/zAK
03:59:08FromDiscord<Elegantbeef> Yea would be nice for a proper name 😄
03:59:10FromDiscord<!Patitotective> :[
03:59:29FromDiscord<-|-> In reply to @Rika "<@594612808113586182> how should we": undeleted is 👌
03:59:42FromDiscord<Elegantbeef> Damn a name that doesnt shorten well
03:59:44FromDiscord<aph> In reply to @Rika "Windows uses something else": iirc PowerShell probably support both Linux and windows command, not sure though
03:59:47FromDiscord<Elegantbeef> Why do people do this to me
03:59:47FromDiscord<huantian> I don't know what this means https://media.discordapp.net/attachments/371759389889003532/970535045414649896/unknown.png
03:59:50FromDiscord<undel> or does it?
03:59:55FromDiscord<Rika> In reply to @Elegantbeef "Damn a name that": I called him Undel in the other server
03:59:56FromDiscord<huantian> https://media.discordapp.net/attachments/371759389889003532/970535084853710888/unknown.png
04:00:16FromDiscord<Rika> If you do desire you could probably even call him Und xddddd
04:00:26FromDiscord<Rika> So desire
04:00:43FromDiscord<!Patitotective> 🌃
04:00:45FromDiscord<!Patitotective> good night
04:00:49FromDiscord<!Patitotective> (edit) "good night ... " added "🙃"
04:01:03FromDiscord<Rika> Man’s gotten sick of this bullshit and to be fair many of us would
04:01:09*nrds quit (Remote host closed the connection)
04:01:27*nrds joined #nim
04:01:29FromDiscord<Elegantbeef> Yea it's annoying there isnt just a single API for this shit
04:01:41FromDiscord<Elegantbeef> But that means it's time for a library an patito to make it
04:01:46FromDiscord<Elegantbeef> Anyway buh bye patito
04:04:28ehmryesoteric xdg-open in nim https://git.syndicate-lang.org/ehmry/xdg_open_ng
04:04:45*slowButPresent quit (Quit: leaving)
04:05:03FromDiscord<Elegantbeef> Not cross platform though eh?
04:05:09FromDiscord<Elegantbeef> Also ehhh a `do` user
04:05:50FromDiscord<huantian> a little do never hurt nobody
04:06:18ehmryI use do to reliably do macro magic
04:09:52*vicecea quit (Remote host closed the connection)
04:10:22*vicecea joined #nim
04:23:34*nsyd quit (Quit: WeeChat 3.5)
04:28:29*xaltsc quit (*.net *.split)
04:29:13*xaltsc joined #nim
05:26:57*rockcavera quit (Remote host closed the connection)
06:48:54*Gustavo6046 quit (Remote host closed the connection)
06:52:10*Gustavo6046 joined #nim
06:56:18FromDiscord<Rika> That syndicated actors thing is really interesting
06:58:11*Gustavo6046 quit (Remote host closed the connection)
06:58:37*Gustavo6046 joined #nim
07:00:36*FromDiscord quit (Ping timeout: 240 seconds)
07:00:56*FromDiscord joined #nim
07:08:05FromDiscord<Zodey> can somebody help me with <https://github.com/nimgl/imgui>?
07:08:24FromDiscord<Elegantbeef> What about it?
07:08:44FromDiscord<Elegantbeef> If you're using the C backend you need to get `cimgui` otherwise you use C++
07:09:50*gsalazar joined #nim
07:10:48FromDiscord<Zodey> i mean, i wanted to update it
07:11:02FromDiscord<Elegantbeef> Elaborate!
07:11:33*PMunch joined #nim
07:11:53FromDiscord<Zodey> cant it be done with replacing that cimgui with a newer version? https://media.discordapp.net/attachments/371759389889003532/970583391093272587/unknown.png
07:12:36FromDiscord<Zodey> ohh
07:12:43FromDiscord<Zodey> its not the same as the cimgui
07:12:46FromDiscord<Zodey> its a fork of it
07:19:29PMunch@Elegantbeef, are you around?
07:19:43FromDiscord<Elegantbeef> Indeed
07:19:52PMunchI'm looking at your Futhark issue
07:20:06PMunchNot sure really how to deal with __int128
07:20:47FromDiscord<Elegantbeef> Perhaps a block to allow user defined typed definitions?
07:20:55PMunchI guess it could be cast to `array[16, uint8]` in Nim, and then people can use retype if they want it to be something else?
07:21:01PMunchWell you can use `retype`
07:21:19PMunchAs described here: https://github.com/PMunch/futhark#redefining-types
07:21:33PMunchThat's on a field-by-field basis though
07:21:38PMunchWhich could become tedious
07:21:59FromDiscord<Elegantbeef> Yea i need to just have the type emitted take up the 128bits i think
07:22:56FromDiscord<Elegantbeef> Atleast for this api i do not need to interact with the underlying data
07:24:10PMunchCould you try to define a type `compiler_int128 = array[2, uint64]` before the Futhark block?
07:24:33FromDiscord<Elegantbeef> Doesnt the futhark code expand in a different file or is it included?
07:24:44PMunchIt's included
07:25:04PMunchIt creates a cache file, but if that file exists it is included
07:25:32FromDiscord<Elegantbeef> I forgot to mention opir emits `Error: Unknown kind in findAlias: {"kind":"invalid","value":"uint128"}` for it
07:26:12PMunchAh, then it won't get to the Nim stage anyways
07:26:27PMunchRight, so it needs to be fixed in Opir and Futhark
07:27:36FromDiscord<Elegantbeef> I did try to abuse their 32bit support but it didnt work 😄
07:27:47FromDiscord<Elegantbeef> For quite obvious reasons
07:29:12FromDiscord<Elegantbeef> To save you a trip https://play.nim-lang.org/#ix=3JZJ is the aliasing 😄
07:33:59PMunchHmm, this is a bit tricky to fix..
07:34:12PMunchWell, to fix perfectly
07:34:34PMunchEasiest way would be to add int128 support in Nim itself
07:34:48PMunchBut I'll cook up a workaround for you
07:36:03FromDiscord<Elegantbeef> Thanks
07:39:36FromDiscord<Elegantbeef> Did just work around it but less than idea to manually change the C source 😄
07:40:10PMunchYeah I mean the goal of Futhark is to never have to touch the C sources
07:41:17FromDiscord<Elegantbeef> Hey the wasm api is cleaner than the C since there is no manual namespacing now 🙂
07:42:03PMunchCould you try now?
07:42:38PMunchYeah being able to remove the manual namespacing is a pretty nice "feature"
07:42:45FromDiscord<mratsim> In reply to @PMunch "Not sure really how": https://github.com/nim-lang/Nim/issues/7675#issuecomment-383409664
07:43:32FromDiscord<Elegantbeef> Well this is for futhark's importing so it only needs the int128 if the source code has it
07:43:58PMunch@mratsim, yeah the problem lies with how to manage this across different Futhark libraries and such
07:44:29FromDiscord<Elegantbeef> I cant even install futhark without `--passL` so that's always fun 😄
07:44:46PMunchI could add this definition in futhark, but now all of a sudden the `when defined("usefuthark"): import futhark; <futhark code> else: include "manually_checked_in_futhark_cache.nim"` doesn't work any more
07:45:13PMunch@Elegantbeef, that's because you're on a silly distro which doesn't put libclang where it's supposed to go :P
07:45:28FromDiscord<Elegantbeef> I know why
07:45:39PMunchIf you set up a library path properly it should work fine
07:47:07PMunchAnd if I just drop the `int128` code into the file itself now all of a sudden I can have int128 defined in multiple places (if I import a library that uses Futhark and I want to use Futhark myself for example (I actually do this for one of my projects)) and they won't combine properly.
07:47:24FromDiscord<mratsim> int128 is a builtin so you can special case it
07:47:48FromDiscord<Elegantbeef> Yea i'd argue you have a `int128` implementation and if a library uses it you expose the module
07:47:54FromDiscord<Elegantbeef> It'd be ideal being in system
07:48:02FromDiscord<Elegantbeef> or in a module
07:48:07FromDiscord<Elegantbeef> stdlib module i mean
07:48:24FromDiscord<Elegantbeef> Seems to work pmunch thanks
07:48:30PMunchThat would be the best solution I guess
07:49:04PMunchOh wait @Elegantbeef I think I messed up..
07:49:33FromDiscord<Elegantbeef> Ah yea it was using cache 😄
07:50:07FromDiscord<Elegantbeef> Or not nimble didnt fetch head
07:50:10FromDiscord<Elegantbeef> Fuck i ruined the test 😄
07:50:20PMunchI was thinking of using an array[2, uint64] to hold them, then I changed my mind and wanted to go with a `tuple[low: uint64, high: uint64]` for uint128 and `tuple[low: uint64, high: int64]` to be closer to what the wasmedge library does
07:50:21FromDiscord<Elegantbeef> yea it failed
07:50:51PMunchBut I messed up and did `array[2, tuple[low: uint64, high: uint64]]`, so now it's a uint256 instead :P
07:51:15FromDiscord<Elegantbeef> Worse than that `Error: Unknown kind in findAlias: {"kind":"special","value":"uint128"}`
07:51:31PMunchOh, interesting
07:52:04FromDiscord<Elegantbeef> Ah you didnt add functionality to `findAlias`
07:53:16PMunchOkay, try to instal the int128test branch
07:53:31PMunchAnd make sure that you're compiling against that
07:53:44FromDiscord<Elegantbeef> Does nimble support installing branches?
07:53:52PMunchYup
07:54:13FromDiscord<Elegantbeef> I'm going to need that syntax 😄
07:54:25PMunchnimble install futhark\#int128support
07:54:31PMunchI believe it's something like that
07:55:40PMunchHmm, maybe that only works as a dependency
07:56:24PMunchAh it's @#
07:56:31FromDiscord<Elegantbeef> I can use the commit
07:56:34FromDiscord<Elegantbeef> Couldnt get it to use the branch
07:56:49PMunch nimble install futhark@#int128test
07:56:56FromDiscord<Elegantbeef> Yea wouldnt work i tried it
07:57:02FromDiscord<Elegantbeef> `addUsings` now
07:57:17PMunchStrange, that worked for me
07:57:19PMunchThe install
07:57:52FromDiscord<Elegantbeef> Ah i quoted it and apparently fish didnt like that
07:58:05PMunchTry now
07:58:07FromDiscord<Elegantbeef> Or i mistyped it apparently
07:58:21*jmdaemon quit (Ping timeout: 272 seconds)
07:58:38FromDiscord<Elegantbeef> We're alive
07:58:59FromDiscord<Elegantbeef> Yep cleared cache aswell
08:00:33PMunchNice
08:05:43*neceve joined #nim
08:06:33PMunchI forced pushed to master now, so the 0.6.1 version should now contain all the fixes
08:07:05PMunchOh, 0.6.2 apparently
08:09:16PMunchNever mind, it's 0.6.1
08:09:33FromDiscord<Elegantbeef> Well thanks, now i get to play with wasm a bit 😄
08:10:05PMunchOh damn, I seems to have had an uncommited change in my local version..
08:10:12PMunchHopefully that doesn't cause any issues..
08:58:25FromDiscord<jmgomez> Hey guys, not sure what Im missing but the compiler is not outputting the symbols (.lib) file when compiling a dynamic library. Im using the pragmas exportcpp and dynlib (also tried with exportc). cdecl didnt work neither (also in mac it causes to put extern twice). Any idea?
09:01:07FromDiscord<Elegantbeef> you're not compiling with `--app:lib` are you
09:01:23FromDiscord<Recruit_main707> was gonna say that :p
09:01:40FromDiscord<Recruit_main707> no idea about the double extern
09:03:34FromDiscord<jmgomez> yes, I am
09:04:06FromDiscord<jmgomez> it outputs the dynlib what it doesnt ouput is the weak symbols for the linker to work
09:04:31FromDiscord<Elegantbeef> Yea i dont know what you're talking about
09:04:38FromDiscord<Elegantbeef> I dont do library toying around
09:05:55FromDiscord<Recruit_main707> --app:lib is for dynamic libraries
09:06:05FromDiscord<Recruit_main707> --app:staticlib is for static libraries
09:06:53FromDiscord<jmgomez> yeah, the problem is the following, let's say you want to use one of the functions in the dynlib from a c/cpp program. How do you import it if the symbols arent there?
09:07:28FromDiscord<Elegantbeef> The dynlib knows the symbols it has
09:07:38FromDiscord<jmgomez> I know nim can do that because I've seen that before what Im not sure if that's something the c/cpp compiler does for you once it detects it's necessary
09:07:55FromDiscord<Elegantbeef> I'll just shush
09:07:58FromDiscord<jmgomez> In reply to @Elegantbeef "The dynlib knows the": then in windows for example why you have .lib and .dll?
09:08:13FromDiscord<jmgomez> you need to link with .lib and use in runtime dll
09:08:34FromDiscord<Elegantbeef> I mean with linux i know you just use `.so`
09:08:57FromDiscord<Recruit_main707> but if you link with .lib you dont even need the dll do you?
09:09:15FromDiscord<jmgomez> In reply to @Recruit_main707 "but if you link": yes, because that's why they are called "weak symbols"
09:09:30FromDiscord<jmgomez> In reply to @Elegantbeef "I mean with linux": do you happen to know how it works in macos?
09:09:32FromDiscord<Recruit_main707> i dont use c/c++ but would a header file work for this?
09:10:10FromDiscord<jmgomez> In reply to @Recruit_main707 "i dont use c/c++": the header works only to see them while you are coding, but the linker needs it anyways
09:14:13FromDiscord<Elegantbeef> As i know it you just need the dynamic library and point the compiler to the folder that you depend on
09:14:20FromDiscord<Elegantbeef> I really dont know much when it comes to libraries
09:14:24FromDiscord<Elegantbeef> Except roughly how to use them
09:14:53FromDiscord<Elegantbeef> Fuuuun wasmedge does not like my `.wasm` file
09:14:58FromDiscord<Elegantbeef> I guess i fucked something up, yay!
09:14:59*firq joined #nim
09:16:06FromDiscord<jmgomez> on windows it seems vcc is able to output it by default in mac not sure if it needs an additional file or if it picks as you said it works on linux (in this case using the .dylib file and I missing something else)
09:17:20FromDiscord<Elegantbeef> yea i dont know i'm linking with a wasm library that only ships a `.so` and all i did was \`-L/path/to/the/folder/with/so -lwasmedge\_c'
09:17:39FromDiscord<Elegantbeef> Like there isnt anything else for my code to link with
09:23:49FromDiscord<jmgomez> Okay, yeah I think lin works differently probably mac works the same
09:29:38FromDiscord<Recruit_main707> https://youtu.be/4o_tmccinds?t=278↵Here there are no weak symbols other than the header
09:30:15FromDiscord<jmgomez> so yeah, it does work the same. The problem I had was that due to the double extern I was getting rid of the wrong pragma. Have to see know why it's inconsistent with windows
09:30:47FromDiscord<jmgomez> In reply to @Recruit_main707 "https://youtu.be/4o_tmccinds?t=278 Here there are": the weak symbols as an external file seems to be windows specific
09:41:35*fowl5 joined #nim
09:41:36FromDiscord<SirElephant> i am not getting it, how do i output coloured strings using std/terminal?
09:43:20*fowl quit (Ping timeout: 248 seconds)
09:43:20*fowl5 is now known as fowl
09:48:05*xet7 quit (Remote host closed the connection)
09:48:22FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3WMr
09:49:13FromDiscord<SirElephant> got it
09:49:22FromDiscord<ynfle> I don't think mac uses .lib files, like linux
10:02:27FromDiscord<darling <3> doesnt os x use .dynlib?
10:07:00*Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected])
10:12:29FromDiscord<jmgomez> @darling <3 @ynfle https://discord.com/channels/371759389889003530/371759389889003532/970618345151946802
12:03:56*def- quit (Quit: -)
12:05:21*def- joined #nim
12:08:18*def- quit (Client Quit)
12:08:28*def- joined #nim
12:31:17PMunchHmm, is there a way to throw exceptions across a DLL bridge?
12:31:33PMunchIf both sides are written in Nim of course
12:31:57FromDiscord<Yardanico> don't think so, you'll probably have to resort to normal values or enums
12:32:12FromDiscord<Yardanico> refc uses setjmp, and arc/orc uses goto exceptions where the error flag is stored as a global (per thread I think)
12:32:16FromDiscord<Yardanico> so it's not shared between dlls
12:32:23FromDiscord<Yardanico> but I might be wrong of course
12:32:30PMunchWell if it's global it would be shared, no?
12:32:44FromDiscord<Yardanico> well it's a thread-global
12:33:13PMunchSure, but as long as everything is done in the same thread it should be possible, right?
12:33:54FromDiscord<Yardanico> maybe, I don't really know
12:34:01FromDiscord<Yardanico> I just checked, and for a simple program Nim makes "N_LIB_PRIVATE NIM_BOOL nimInErrorModesystem_4243;"
12:34:03FromDiscord<Yardanico> with arc
12:34:12FromDiscord<Yardanico> a global variable, although I compiled without threads
12:34:28FromDiscord<Yardanico> and with threads it's "N_LIB_PRIVATE NIM_THREADVAR NIM_BOOL nimInErrorModesystem_4859;"
12:35:26FromDiscord<Yardanico> and even then, this is just the status that an exception has been thrown, the actual exception is stored elsewhere
12:35:43FromDiscord<Yardanico> "N_LIB_PRIVATE NIM_THREADVAR Exception currExceptionsystem_4529;"
12:36:42FromDiscord<Yardanico> it would be nice if nim somehow had first-class DLL support so it'd be easy to create modular applications without having to resort to C FFI
12:37:14FromDiscord<Yardanico> we already have things like https://github.com/yglukhov/iface which should make extending functionality through DLLs easy
12:37:59*slowButPresent joined #nim
12:38:01FromDiscord<Yardanico> but I don't know how easy is that, especially all the refcounting and cycle related stuff between DLLs
12:42:39PMunchHmm, I can't even get it to pass a GC-ed type across the dynamic library barrier when using ARC
12:42:45PMunchI thought that was supposed to "just work"
12:43:04FromDiscord<Yardanico> you need to GC_ref it at least
12:44:04FromDiscord<d4rckh> okay, might sound like a stupid version, but is there any problem if i cast an int32 to an int?
12:44:09FromDiscord<d4rckh> (edit) "version," => "question,"
12:45:06FromDiscord<Yardanico> there's no problem if you convert it :)
12:45:15FromDiscord<Yardanico> unless someone is compiling your code for a 16-bit platform :D
12:45:21FromDiscord<d4rckh> i figured
12:45:22FromDiscord<d4rckh> haha
12:45:23FromDiscord<Yardanico> `let myintval = int(myint32val)`
12:45:31FromDiscord<demotomohiro> In reply to @d4rckh "okay, might sound like": https://github.com/nim-lang/Nim/issues/19101
12:45:32FromDiscord<d4rckh> i did (int) and it worked fine?
12:45:37FromDiscord<d4rckh> (edit) "(int)" => "(int)myint32"
12:45:56FromDiscord<Yardanico> In reply to @d4rckh "i did (int)myint32 and": yes that works, but it's kind of the wrong syntax for that :P
12:46:02FromDiscord<Yardanico> the preferred way is `int(myint32)`
12:46:12FromDiscord<Yardanico> (int) only works because of how command syntax works
12:46:19FromDiscord<d4rckh> ah
12:46:25FromDiscord<Yardanico> In reply to @demotomohiro "https://github.com/nim-lang/Nim/issues/19101": yes, so a type conversion should be used like d4rckh did
12:46:28*PMunch_ joined #nim
12:47:01FromDiscord<pmunch> Type conversion != type casting in Nim
12:47:10FromDiscord<Yardanico> yeah
12:47:13*Zectbumo quit (Remote host closed the connection)
12:47:17PMunch_Network bugged out for a second
12:47:28PMunch_http://ix.io/3WNi <- that's what I'm trying to do
12:47:29*PMunch quit (Read error: Connection reset by peer)
12:47:43*PMunch_ is now known as PMunch
12:50:59PMunchHmm, with `--d:useMalloc` it seems to not error out
12:52:11FromDiscord<Yardanico> @PMunch I think it errors because it's trying to free the string made on the lib side from the loader side
12:52:23PMunchYeah I believe so to
12:52:23FromDiscord<Yardanico> that's why the gdb shows the error on the allocator code in the loader
12:52:42PMunch--d:useMalloc probably works because it is not placed in the memory region that Nim expects to manage
12:55:30FromDiscord<Yardanico> also @PMunch i think this is essentially the same as https://github.com/nim-lang/Nim/issues/15202
12:56:32FromDiscord<Yardanico> and yes, you can't build nimrtl with arc :)
13:00:59FromDiscord<Yardanico> i wonder if mimalloc works with multi-DLL usecase
13:02:15FromDiscord<Yardanico> looks like it does
13:02:51*DixieFlatline quit (Ping timeout: 245 seconds)
13:02:54FromDiscord<Yardanico> especially good since mimalloc supports dynamic linking as a primary use-case, so you can ship mimalloc DLL along all of your DLLs and .exe's and link them to mimalloc dynamically
13:03:43*DixieFlatline joined #nim
13:04:38PMunchmimalloc?
13:04:47*kayabaNerve quit (Ping timeout: 260 seconds)
13:04:56PMunchBut yeah it's a bit sad that Nim isn't better at loading it's own DLLs..
13:05:06FromDiscord<Yardanico> @PMunch using -d:useMalloc usually makes performance worse
13:05:23FromDiscord<Yardanico> mimalloc is a different allocator that for Nim usually works as fast as Nim's own allocator even with -d:useMalloc
13:05:28FromDiscord<Yardanico> https://github.com/Yardanico/mimalloc_nim
13:06:09FromDiscord<Yardanico> but I initially tested mimalloc because of ARC/ORC being (sometimes) slow in multithreaded programs with a lot of allocations
13:06:56FromDiscord<Yardanico> and compared to normal system-wide malloc you can statically link mimalloc and apply LTO, so your allocations get even faster
13:07:08FromDiscord<Yardanico> the same as with the nim's own allocator essentially
13:07:47PMunchRight, so it should be a drop-in replacement for -d:useMalloc?
13:08:06FromDiscord<Yardanico> well, mimalloc provides a malloc-like interface, so you use it together with -d:useMalloc
13:08:16FromDiscord<Yardanico> its really simple, you can check the .nims file i have in the src folder
13:08:41FromDiscord<Yardanico> although it's a bit hacky since I use nimscript's functionality to patch nim's malloc support file to use mimalloc instead of malloc
13:08:58PMunchRight
13:09:18FromDiscord<Yardanico> i tested it on linux both dynamic and static, and static on windows with both mingw and msvc (haven't tested dynamic with .dll though)
13:09:28*rockcavera joined #nim
13:09:28*rockcavera quit (Changing host)
13:09:28*rockcavera joined #nim
13:09:35FromDiscord<Yardanico> also, for some reason with mingw on Windows it was quite slower for me than nim's default allocator
13:09:48FromDiscord<Yardanico> with msvc it was faster or on par
13:10:11PMunchSo the only piece of the puzzle I'm missing now is somehow make the library I'm loading see the exception flag of the library that loads it..
13:11:01PMunchThat should be pretty easy if I modify the C code, on Linux at least
13:11:51PMunchI guess just not declaring the symbol would mean that it would grab it from the main executable
13:12:30FromDiscord<Yardanico> if it's named the same way, probably
13:19:45NimEventerNew thread by Archnim: Async proves to be a bit tricky, see https://forum.nim-lang.org/t/9134
13:22:07*vicfred joined #nim
13:22:08FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WNp
13:22:29FromDiscord<d4rckh> but it throws this error `Error: undeclared field: 'dwMajorVersion' for type types.OSVersionInfoExW`
13:22:31FromDiscord<d4rckh> sent a code paste, see https://paste.rs/CMf
13:22:46FromDiscord<d4rckh> but i do have `dwMajorVersion` declared 🤔
13:22:56FromDiscord<Yardanico> you didn't export it
13:22:57FromDiscord<d4rckh> its erroring on the return line
13:23:08FromDiscord<d4rckh> rtlGetVersion is defined in the same file
13:23:20FromDiscord<d4rckh> aaah
13:23:23FromDiscord<d4rckh> the fields
13:23:25FromDiscord<Yardanico> yep
13:23:33FromDiscord<d4rckh> :facepalm:
13:23:44FromDiscord<d4rckh> so much spam for nothing
13:23:51FromDiscord<d4rckh> apologies
13:25:17FromDiscord<d4rckh> (also yes i noticed that i used dwMinorVersion instead of osInfo.dwMinorVersion, it errored after i fixed the other issue)
13:25:33FromDiscord<d4rckh> (edit) "errored" => "i was mad at me"
13:25:54FromDiscord<d4rckh> (edit) removed "i"
13:26:24*vicfred quit (Ping timeout: 246 seconds)
13:26:35*analogsalad joined #nim
13:37:25*arkurious joined #nim
14:07:52NimEventerNew thread by Pswilde: Passing "var addr x" into procedure, see https://forum.nim-lang.org/t/9135
14:12:07FromDiscord<Yardanico> not sure why they thought of using `addr` for this in the first place, moreover `var`
14:16:08nrds<Prestige99> I like robb1e's reply
14:31:32*analogsalad quit (Ping timeout: 248 seconds)
14:50:49FromDiscord<5Q> Quick question about threadpool\: why can I spawn 12 threads running simultaneously using spawn even if I do setMaxPoolSize(4) before trying to spawn them? I just don't get it
14:53:18FromDiscord<Yardanico> maybe similar to https://forum.nim-lang.org/t/6091 ?
14:53:32FromDiscord<Yardanico> IMO threadpools in the stdlib is kind of abandoned, try your luck with e.g. https://github.com/status-im/nim-taskpools
14:53:34*analogsalad joined #nim
14:54:25FromDiscord<5Q> yeah, something like that, but not exactly the cpu core count, the amount of threads it let me spawn varies, it just spawned 13↵(@Yardanico)
14:54:31FromDiscord<5Q> Thanks, I will take a look at tit↵(@Yardanico)
15:07:07FromDiscord<5Q> sent a code paste, see https://paste.rs/4J0
15:07:45FromDiscord<Yardanico> what are you compiling with?
15:07:49FromDiscord<Yardanico> i mean C compiler
15:08:16FromDiscord<Yardanico> ah InitializeSynchronizationBarrier maybe you need to link to win libs
15:08:23FromDiscord<5Q> gcc.exe (x86\_64-win32-seh-rev1, Built by MinGW-W64 project) 6↵(@Yardanico)
15:09:03FromDiscord<Yardanico> hmm, but kernel32.lib should be linked by default
15:09:11FromDiscord<Yardanico> try adding --passL:"-lkernel32"
15:12:03FromDiscord<Yardanico> @5Q any progress?
15:12:28FromDiscord<5Q> oh, maybe my message was too big for the discord bridge↵(@Yardanico)
15:12:41FromDiscord<5Q> let me send you the gcc command that errors out
15:13:01FromDiscord<5Q> adding --passL didn't work
15:13:38*rez joined #nim
15:13:44FromDiscord<5Q> https://nekobin.com/rorabomeka here is the gcc command
15:14:12*neceve quit (Ping timeout: 246 seconds)
15:14:27FromDiscord<Yardanico> ok i will test it later maybe when I reboot into windows
15:14:36FromDiscord<Yardanico> in the meanwhile you can compile with msvc instead, seems like taskpolls support it
15:14:41FromDiscord<Yardanico> taskpools
15:14:55FromDiscord<5Q> thank you, how can I change the compiler used?
15:15:32FromDiscord<Yardanico> --cc:vcc, but you need to have Visual Studio compiler tools installed
15:15:38FromDiscord<Yardanico> and compile from visual studio's devtools command prompt
15:15:47FromDiscord<Yardanico> you can find it in your programs from the start menu
15:16:09FromDiscord<5Q> thanks, will try that
15:16:26FromDiscord<mratsim> In reply to @5Q "gcc.exe (x86\_64-win32-seh-rev1, Built by": that's strange, mingw is tested in CI
15:17:20FromDiscord<5Q> is vs2019 supported?
15:18:22FromDiscord<mratsim> https://github.com/status-im/nim-taskpools/blob/stable/.github/workflows/ci.yml#L95=
15:19:26FromDiscord<mratsim> In reply to @5Q "is vs2019 supported?": I didn't try, but I see no reason why it wouldn't work. I checked Weave on VS code, and the low-level stuff is using the same calls as Weave
15:20:42FromDiscord<mratsim> ah I remember something about mingw
15:22:02FromDiscord<5Q> sent a code paste, see https://paste.rs/9GT
15:24:25*kayabaNerve joined #nim
15:24:27FromDiscord<5Q> sent a code paste, see https://play.nim-lang.org/#ix=3WOj
15:24:59FromDiscord<mratsim> https://sourceforge.net/p/mingw-w64/bugs/562/
15:25:40FromDiscord<mratsim> you need a mingw64 version with that fix: https://github.com/Alexpux/mingw-w64/pull/2
15:26:35FromDiscord<mratsim> > What is known those is that mingw-64 for 32 bit indeed does not support EnterSynchronizationBarrier↵↵https://github.com/status-im/nimbus-eth2/pull/2718#issuecomment-891080885=
15:28:31FromDiscord<mratsim> In reply to @5Q "using --cc\:vcc with vs2019,": What Nim version are you compiling? https://nim-lang.org/docs/atomics.html#fence%2CMemoryOrder
15:32:29FromDiscord<5Q> 1.6.4↵(@mratsim)
15:44:05*eron joined #nim
15:48:52*eron quit (Client Quit)
15:57:08FromDiscord<5Q> thanks a lot, replacing my gcc version with the one from https://nim-lang.org/download/mingw64.7z solved the problem, now it compiles fine↵(@mratsim)
16:03:35*PMunch_ joined #nim
16:04:03FromDiscord<jmgomez> can Nim hot reloading feature be used in dynlibs?
16:07:09FromDiscord<Recruit_main707> hot reloading works natively in nim by unloading and reloading a dll iirc, since its all nim it can handle it properly (its also implicit so you are not working with dlls yourself), but if you tried to use hot code reloading from a c program that loads a nim dll, the dll itself cant unload itself and then load again, it would need to be handled by the actual executable
16:08:16FromDiscord<jmgomez> gotcha
16:09:25PMunch_Oh I totally forgot about hot-code reloading when I was talking to Yardanico about throwing exceptions across dynamic library boundaries earlier today.
16:09:31PMunch_That means it has to at least be possible
16:09:44*PMunch quit (Killed (NickServ (GHOST command used by PMunch_)))
16:09:47*PMunch_ is now known as PMunch
16:10:10*PMunch_ joined #nim
16:38:45*neceve joined #nim
16:39:55FromDiscord<d4rckh> how can i handle truncated lines from sockets?
16:40:08FromDiscord<d4rckh> how do i know when they finished?
16:40:57FromDiscord<d4rckh> (edit) "they finished?" => "i got to the end?"
16:51:59*rez quit (Quit: much snoozes...)
16:57:53*Guest82 joined #nim
16:58:30*Guest82 quit (Client Quit)
16:58:41*rez joined #nim
17:28:08FromDiscord<Ayy Lmao> Is gc:orc suitable for webassembly?
17:28:39FromDiscord<Ayy Lmao> Haven't done much testing, just curious if anyone has any experience.
17:29:11FromDiscord<Yardanico> In reply to @Ayy Lmao "Is gc:orc suitable for": it'll compile and run, but I didn't check any complex programs with it
17:30:46FromDiscord<Ayy Lmao> In reply to @mothumix "it'll compile and run,": So gc:arc is recommended?
17:31:13FromDiscord<Yardanico> no, I meant arc/orc in general
17:31:17FromDiscord<Yardanico> not orc specifically
17:31:59FromDiscord<enthus1ast> Tcp?↵(@d4rckh)
17:32:24FromDiscord<d4rckh> yeah, i figured out a way
17:32:32FromDiscord<d4rckh> i am sending base64 encoded json objects
17:33:43FromDiscord<d4rckh> every time i receive 'data' i check if its a valid json object, if it isnt i add the 'data' to the buffer and wait for the next 'data' until 'data' is a valid json object, and then i just wipe the buffer
17:33:52FromDiscord<d4rckh> (edit) "'data'" => "buffer"
17:34:19*FromDiscord quit (Remote host closed the connection)
17:34:32*FromDiscord joined #nim
17:34:48FromDiscord<enthus1ast> The only reliable way to know if the socket is closed is reading from the socket, the sending socket does not immediately know if the socket is gone
17:35:30FromDiscord<enthus1ast> When reading you can also check for ""
17:35:30FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WOL
17:35:36FromDiscord<enthus1ast> Yes
17:35:41FromDiscord<enthus1ast> On the server
17:36:01FromDiscord<enthus1ast> But the client does not immediately know
17:36:02*rez quit (Quit: l8r)
17:36:24FromDiscord<enthus1ast> So you should at least do some ping pong
17:36:40FromDiscord<enthus1ast> And or acknowledge the packet
17:36:56FromDiscord<d4rckh> well in the client i just send the entire thing
17:37:01FromDiscord<d4rckh> no chunking
17:38:15FromDiscord<Recruit_main707> In reply to @d4rckh "every time i receive": if you are also sending the data, then you should probably add a header int32 or whatever indicating the size of the buffer and then read said number of bytes at once
17:40:11FromDiscord<Recruit_main707> then:↵`socket.read(4) # read 4 bytes`↵`n = [convert the string of bytes to an int32]`↵`socket.read(n)`
17:44:09*vicecea quit (Remote host closed the connection)
17:44:46FromDiscord<d4rckh> yes, i am also coding the client. i will add this
17:45:01*vicecea joined #nim
17:56:26FromDiscord<m4ul3r> Is it possible to view the uri in an httpclient response object?
17:56:52*PMunch quit (Ping timeout: 248 seconds)
18:03:15FromDiscord<hmmm> broskis wtf I think I found a bug 👀
18:03:35FromDiscord<hmmm> if it's a bug I want a bughunt prize and my name written somewhere 🤔
18:03:48FromDiscord<Yardanico> ??
18:04:35FromDiscord<hmmm> basically if you call copyfile and in the filename you put something like foo:bar it will not error but it will create an empty miserable thingy
18:04:44FromDiscord<hmmm> I think it's a bug it must be 🧐
18:05:12*PMunch joined #nim
18:05:33FromDiscord<Yardanico> In reply to @hmmm "basically if you call": can you show the code?
18:06:06FromDiscord<Yardanico> ah i see
18:06:14FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3WOR
18:06:23FromDiscord<hmmm> basically if line is xx:yy it will not run the except
18:06:34FromDiscord<Yardanico> and why would it?
18:06:35FromDiscord<hmmm> but it will create a 0kb file
18:06:59FromDiscord<hmmm> it will not perform the copy
18:07:06FromDiscord<Yardanico> can you show the bug without the runtime values?
18:07:14FromDiscord<Yardanico> just make up some strings that show the same behaviour
18:07:22FromDiscord<hmmm> hmm ok I'll try
18:08:07FromDiscord<Yardanico> also, nim's copyFile function does nothing weird, it just calls the native APIs
18:08:14FromDiscord<Yardanico> so it's rather a question why the OS doesn't raise an error
18:09:12FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3WOV
18:09:17FromDiscord<hmmm> this will create a 0kb file called hello
18:09:23FromDiscord<Yardanico> why still have & though :P
18:09:24FromDiscord<hmmm> but will not copy
18:09:31FromDiscord<hmmm> lol 😃
18:09:45FromDiscord<Yardanico> In reply to @hmmm "but will not copy": works for me
18:09:50FromDiscord<Yardanico> must be a windows specific bug
18:09:53FromDiscord<hmmm> hmm
18:09:53FromDiscord<Yardanico> on windows
18:09:58FromDiscord<hmmm> yea I'm on win
18:10:03FromDiscord<Yardanico> i know
18:10:10FromDiscord<hmmm> 😄
18:12:45FromDiscord<Yardanico> @hmmm https://stackoverflow.com/questions/34097936/shutil-move-deletes-the-file-on-windows-when-new-name-contains-a-colon-and-an-e
18:12:53FromDiscord<Yardanico> similar, basically its windows' weirdness, nothing unusual
18:13:16FromDiscord<hmmm> oh
18:13:21FromDiscord<5Q> there is something called alternate streams in NTFS, look it up. The colon is a special symbol that is used to access those alternate streams↵(@hmmm)
18:13:35FromDiscord<Yardanico> https://blog.foldersecurityviewer.com/ntfs-alternate-data-streams-the-good-and-the-bad/
18:13:37FromDiscord<m4ul3r> I was about to say, does windows like : in filenames
18:13:39FromDiscord<hmmm> and how do I sanitize my strings to avoid characters that windows hate 🤔
18:13:57FromDiscord<m4ul3r> using - or _
18:13:58FromDiscord<Yardanico> In reply to @m4ul3r "I was about to": nope, but as you can see they have a different feature here
18:14:33FromDiscord<Yardanico> In reply to @hmmm "and how do I": https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
18:15:39FromDiscord<hmmm> hmm maybe I need to make a proc that takes a string and kinda deletes illegal chars until we get a wellformed string 🤔
18:16:44FromDiscord<Yardanico> that might work the wrong way
18:16:47FromDiscord<hmmm> or something like a isWindowsIllegal():bool readymade proc would be very appreciated 😄
18:17:08FromDiscord<Yardanico> imagine if you first save the file testFile.txt, and then also want to save `test:File.txt`, you remove the colon, save it, and now you've overwritten the old testFile.txt
18:17:36FromDiscord<hmmm> hmm I see, not safe at all, but if I had an isWindowsIllegal() I could name it something default
18:17:54FromDiscord<Yardanico> i just don't know your specific usecase
18:18:02FromDiscord<Yardanico> is it user input? or just from some parsing or something?
18:18:03FromDiscord<Yardanico> it's unclear
18:18:23FromDiscord<hmmm> it takes it from the first line of test file
18:18:51FromDiscord<Yardanico> so why not just make sure the input the valid if you control it
18:18:59FromDiscord<Yardanico> (edit) "the" => "is"
18:19:05FromDiscord<m4ul3r> just replace the : with a _ or - for the file names then
18:19:16FromDiscord<hmmm> hehe test file is kinda out of my control 😅
18:19:26FromDiscord<hmmm> yea I'll try to make a proc, thx broskis
18:20:42FromDiscord<demotomohiro> How about to check filename with this: https://nim-lang.org/docs/os.html#isValidFilename%2Cstring
18:20:57FromDiscord<hmmm> HA!
18:21:03FromDiscord<hmmm> demo ❤️ ❤️
18:21:13FromDiscord<demotomohiro> And if it is invalid, print error
18:22:22Amun-RaisValidFilename is very windows oriented
18:22:37FromDiscord<Yardanico> well, hmmm wants that specifically
18:22:58Amun-Raall those test should pass on posix
18:23:20FromDiscord<Yardanico> @Amun-ra I don't understand your argument
18:23:27FromDiscord<Yardanico> the docs clearly say "valid for crossplatform use."
18:23:42FromDiscord<Yardanico> not for checking only for linux or mac or windows
18:23:45FromDiscord<Yardanico> it checks for all of them at once
18:23:53Amun-RaI missed that
18:26:10FromDiscord<m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=3WP1
18:27:19FromDiscord<demotomohiro> It seems `os.isValidFilename` can be deleted: https://github.com/nim-lang/Nim/pull/19643
18:27:48FromDiscord<hmmm> wot
18:27:56FromDiscord<hmmm> over my dead body 🧐
18:28:26FromDiscord<Yardanico> In reply to @hmmm "over my dead body": just copy the impl
18:28:28FromDiscord<Yardanico> its just a few liens
18:28:29FromDiscord<Yardanico> (edit) "liens" => "lines"
18:28:50FromDiscord<hmmm> hmm why take out useful stuff, it's not like we run out of memory 🤨
18:29:01FromDiscord<Yardanico> In reply to @m4ul3r "sorry to bump this": It's possible the manual way, you just have to manually follow the redirects (which I assume your url does so the parameter appears in the url) and just check the Location header
18:29:54FromDiscord<Yardanico> actually httpclient has a private field currentURL: Uri , you can access that if you don't want to do redirects manually
18:32:22FromDiscord<m4ul3r> In reply to @mothumix "It's possible the manual": Just gave this a quick spin and it's what I'm looking for 👍 ↵↵I'll look into your second suggest. Not sure how to access currentURL exactly
18:33:33FromDiscord<m4ul3r> When I had attempted that earlier I ran into undeclared field (which makes sense since it's private)
18:34:51FromDiscord<Yardanico> In reply to @m4ul3r "Just gave this a": ah, yeah, it should work with privateAccess but apparently it's broken for generic ref object types :(
18:34:55FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/19278
18:38:47FromDiscord<m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=3WP5
18:42:33FromDiscord<Yardanico> In reply to @m4ul3r "How would I go": just do the request again?
18:42:43FromDiscord<Yardanico> and if it's more than 1 redirect, put it in a loop to follow redirects while Location is found
18:44:45FromDiscord<m4ul3r> Makes sense, I guess it would also work to have 2 clients, one for getting the location and one for following the redirects↵Thanks for the help!
18:44:54FromDiscord<Yardanico> In reply to @m4ul3r "Makes sense, I guess": nonono
18:44:59FromDiscord<Yardanico> you just follow the redirects with the same client
18:45:07FromDiscord<Yardanico> you don't need a client for location, it's just a response header
18:45:32FromDiscord<m4ul3r> oh, just another request with the location?
18:45:38FromDiscord<Yardanico> yes
18:45:41FromDiscord<m4ul3r> 👍
18:45:53FromDiscord<Yardanico> https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
18:45:54FromDiscord<m4ul3r> I completely get what you're saying now
19:00:17*neceve quit (Remote host closed the connection)
19:26:59*Zectbumo joined #nim
19:39:29*LuxuryMode joined #nim
19:53:23FromDiscord<archnim> Hello world, is there a naming convention, to create a value and a ref version of the same proc ? What is this most correct or nim-like way to name such procs.
19:54:53PMunchYes
19:55:08PMunchThe object you're going to use the most has a nice descriptive name
19:55:29PMunchThen the other has either Obj or Ref as a postfix depending on it's type
19:56:26PMunchSo if you have an object you primarily pass around as a reference you call the base object MyThingObj and the reference object MyThing. And if you most often pass it around as an object but sometimes as a reference you call the object MyThing and the reference object MyThingRef
19:56:39PMunchWait, procs?
19:57:04nrds<Prestige99> like one proc takes Foo, another takes FooRef
19:57:16nrds<Prestige99> but do the same thing?
19:57:35FromDiscord<treeform> you could do `proc bar(foo: Foo|FooRef) =`
19:57:47FromDiscord<treeform> so it takes both
19:58:02FromDiscord<leorize> you should only have one for value then use auto deref \:p
19:58:35FromDiscord<treeform> I always make one either obj or ref, I never do the MyThingObj/MyThingRef personally.
19:59:11FromDiscord<treeform> I know @ElegantBeef really wants me to stop using my `ref` objects but I like them.
20:04:53*analogsalad quit (Quit: bye)
20:17:29FromDiscord<archnim> In reply to @treeform "you could do `proc": Me too, I prefer writing only one version of my procs. But some times, I need have a proc that returns a value, and a proc that modifies it param.
20:20:40*jmdaemon joined #nim
20:29:31FromDiscord<Phil> In reply to @PMunch "Then the other has": Wait, why do our value types get the longer and more jarring to read suffix?
20:30:00FromDiscord<Phil> Is this a holdover from other languages?
20:30:33FromDiscord<Elegantbeef> Depends on what you're doing if you're mainly using the ref version you make the value `obj` if you're mainly using the value type you make the ref version `ref`
20:31:16FromDiscord<Phil> For my own purposes I'd likely give ref types the suffix instead of value types.↵Then again, my objects tend to be rather small
20:31:43FromDiscord<Elegantbeef> You ideally give it to whichever you use the least so the API is nice to use
20:33:49FromDiscord<Recruit_main707> or dont use implicit refs and write them whenever you use them :P
20:34:14FromDiscord<Elegantbeef> Yea that works aswell 😄
20:34:36*jjido joined #nim
20:34:38FromDiscord<dom96> In reply to @treeform "I always make one": Same
20:35:09FromDiscord<Elegantbeef> There arent many cases where you need both
20:36:19FromDiscord<archnim> In reply to @Elegantbeef "There arent many cases": True.
20:40:04PMunch@Phil, as @Elegantbeef said you name the type you use the most in your API with the nice name, and then choose the postfix for the other one
20:51:30*noeontheend joined #nim
20:54:08*PMunch quit (Quit: leaving)
21:02:05FromDiscord<JSONBash> I name all `ref` types Beef (different types have different number of e's) and all object types Boof (same but with o's)
21:02:20FromDiscord<JSONBash> sent a code paste, see https://play.nim-lang.org/#ix=3WPu
21:02:23FromDiscord<JSONBash> it is idiomatic Nim
21:02:55FromDiscord<JSONBash> also the more o's in the name, the more inheritance and dynamic dispatch I use
21:18:16*vicfred joined #nim
21:24:47FromDiscord<eyecon> I wanted to find out if I can write a Matrix (communication protocol) bot with Nim but it's so hard to search for
21:25:18FromDiscord<eyecon> The search results are understandably about matrices, the data structure ones
21:26:12FromDiscord<eyecon> Does anyone know of a library with an east to use Matrix API?
21:26:18FromDiscord<eyecon> (edit) "east" => "easy"
21:26:24FromDiscord<dom96> try to search nimble using the cli or nimble.directory
21:26:37FromDiscord<dom96> (edit) "try to search nimble ... using" added "packages"
21:27:14FromDiscord<eyecon> In reply to @dom96 "try to search nimble": Good idea, thanks
21:27:25FromDiscord<eyecon> That gives me... a grand total of 1 library
21:27:41FromDiscord<eyecon> Which is still good
21:28:03FromDiscord<eyecon> Let's see how `matrixsdk` works
21:28:03FromDiscord<dom96> perfect excuse to write a new one :D
21:28:19FromDiscord<eyecon> In reply to @dom96 "perfect excuse to write": Who knows, maybe I will
21:29:21*noeontheend quit (Ping timeout: 256 seconds)
21:35:22*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
21:37:28FromDiscord<!Patitotective> actually this does work `xdg-open mailto:[email protected]` 👀
21:57:56*jjido joined #nim
21:57:58*jjido quit (Client Quit)
22:03:14FromDiscord<Elegantbeef> Yes it d oes work
22:36:20*firq quit (Ping timeout: 248 seconds)
22:45:23FromDiscord<Elegantbeef> Well pmunch we have an issue, the type from futhark is 8 bytes smaller than the type in native C which means it's not usable ☹️
22:55:04FromDiscord<Elegantbeef> Dont know how to fix this one
23:34:01NimEventerNew thread by R3c: C FFI using only types?, see https://forum.nim-lang.org/t/9136
23:49:53*ltriant joined #nim