00:00:51 | FromDiscord | <Elegantbeef> well then dont pass length and just do `128` |
00:02:15 | FromDiscord | <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:23 | FromDiscord | <pruno> Thanks |
00:11:53 | FromDiscord | <icewater200> Is there any admin/mods online? My friend asked me to join to ask why he was banned |
00:12:57 | FromDiscord | <icewater200> <@&371760044473319454> |
00:15:04 | FromDiscord | <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:50 | FromDiscord | <icewater200> He said he didn't say anything bad |
00:16:28 | FromDiscord | <icewater200> He was in this discord and banned from here yes |
00:18:15 | FromDiscord | <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:02 | FromDiscord | <!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:28 | FromDiscord | <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:35 | FromDiscord | <xflywind> I agree it needs to be corrected/clarified. |
01:35:24 | FromDiscord | <xflywind> @Zoom |
01:59:09 | FromDiscord | <Jonah> sent a code paste, see https://paste.rs/00N |
01:59:41 | FromDiscord | <Jonah> (edit) "https://play.nim-lang.org/#ix=3WM4" => "https://play.nim-lang.org/#ix=3WM3" |
01:59:45 | FromDiscord | <Jonah> (edit) "https://play.nim-lang.org/#ix=3WM3" => "https://paste.rs/uG9" |
02:00:46 | FromDiscord | <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:54 | FromDiscord | <kiell> nope 😠 |
03:35:17 | FromDiscord | <Elegantbeef> Nope what? |
03:37:33 | FromDiscord | <!Patitotective> can i strip b here? `let (a, b) = something()` |
03:37:52 | FromDiscord | <huantian> like `let (a, _) = something()`? |
03:37:53 | FromDiscord | <!Patitotective> somethin glike `let (a, b.strip()) = something()` lol |
03:38:04 | FromDiscord | <!Patitotective> (edit) "somethin glike" => "something like" |
03:38:11 | FromDiscord | <Rika> No |
03:38:31 | FromDiscord | <Elegantbeef> `let (a, b) = (let (c, d) = something; (c, d.strip))` |
03:38:51 | FromDiscord | <Elegantbeef> I'm something of a garbage author myself |
03:39:35 | FromDiscord | <Rika> That’s technically what he wants but if he wanted the LHS style one then no |
03:39:37 | FromDiscord | <!Patitotective> i guess `var (a, b) = something(); b = b.strip()` works fine |
03:39:46 | FromDiscord | <!Patitotective> (edit) "i guess `var (a, b) = something(); b = b.strip()` works fine ... " added "lol" |
03:39:50 | FromDiscord | <Elegantbeef> Or you just do it in a block like a normal person |
03:39:56 | FromDiscord | <Rika> Yes but you’re making a and b unnecessarily mutable now |
03:40:05 | FromDiscord | <Rika> Just use the block xd |
03:40:13 | FromDiscord | <!Patitotective> :[ |
03:40:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/gvY |
03:40:38 | FromDiscord | <Elegantbeef> Cmon people write code that makes your parents proud if they even knew what the fuck you wrote |
03:40:47 | FromDiscord | <huantian> semicolon should be unnecesarry tho |
03:40:53 | FromDiscord | <huantian> wao typing |
03:40:54 | FromDiscord | <Elegantbeef> Yea was me being dumb |
03:41:00 | FromDiscord | <Rika> When aren’t you being dumb |
03:41:05 | FromDiscord | <ynfle> Don't use tuples, it'll make your parents proud |
03:41:15 | FromDiscord | <Elegantbeef> Uh... days that dont end with Y rika |
03:41:33 | FromDiscord | <Elegantbeef> Eh tuples are fine for return values but dont build systems on them |
03:41:46 | FromDiscord | <Elegantbeef> They're not statically typed so they're dumb as balls |
03:41:48 | FromDiscord | <huantian> sent a code paste, see https://paste.rs/B9T |
03:42:00 | FromDiscord | <Elegantbeef> Nah huan it has a variable intrroduced that you dont use |
03:42:01 | FromDiscord | <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:07 | FromDiscord | <huantian> (edit) "https://paste.rs/iu7" => "https://paste.rs/MPv" |
03:42:17 | FromDiscord | <Elegantbeef> I personally want my variables to only exist in the shortest life span |
03:42:21 | FromDiscord | <Elegantbeef> Yea it's wacky rika |
03:42:34 | FromDiscord | <Elegantbeef> Tuples are not distinc types and as such you only use them in a place where ambiguity cannot be mistaken |
03:42:38 | FromDiscord | <Elegantbeef> Return types for instance |
03:43:00 | FromDiscord | <!Patitotective> someone knows how to make `mailto:[email protected]` work with `openDefaultBrowser`? lol |
03:43:05 | FromDiscord | <!Patitotective> or it just doesnt |
03:43:18 | FromDiscord | <Elegantbeef> Dont think that protocol works |
03:43:29 | FromDiscord | <huantian> I have never seen that protocol before |
03:43:37 | FromDiscord | <Rika> It’s technically not one |
03:43:40 | FromDiscord | <Elegantbeef> It's a browser API protocol or w/e |
03:43:52 | FromDiscord | <Elegantbeef> You have URIs defined that open in specific applications |
03:43:55 | FromDiscord | <!Patitotective> firefox :] |
03:43:59 | FromDiscord | <Elegantbeef> Well no |
03:44:10 | FromDiscord | <Elegantbeef> It should open in the users default mail client |
03:44:26 | FromDiscord | <!Patitotective> i meant, firefox has the mailto protocol thing |
03:44:38 | FromDiscord | <Elegantbeef> Sure, most browsers do, but that's not how you open it |
03:44:47 | FromDiscord | <huantian> huh apparently emacs is my default mail client |
03:44:55 | FromDiscord | <Elegantbeef> You get the system to open it with the responding API |
03:44:57 | FromDiscord | <!Patitotective> thunderbird 😎 |
03:45:07 | FromDiscord | <huantian> yeah I have that installed but I don't use it often lol |
03:45:10 | FromDiscord | <-|-> Have you tried invoking xdg-open on Linux/Unix and ShellExecute() on Windows? |
03:45:19 | FromDiscord | <-|-> I think macOS has `open -a` |
03:45:25 | FromDiscord | <Elegantbeef> That's the solution there |
03:45:28 | FromDiscord | <Elegantbeef> Thanks |
03:45:47 | FromDiscord | <!Patitotective> In reply to @-|- "Have you tried invoking": i thought browsers did that 🙁 lol |
03:46:09 | FromDiscord | <Elegantbeef> I mean they can but you're dispatching the work wrongly |
03:46:21 | FromDiscord | <Elegantbeef> That api is meant to be used by you not given to a middle man |
03:46:29 | FromDiscord | <huantian> why have the browser do it when you can do it directly |
03:46:29 | FromDiscord | <Elegantbeef> You now need a browser that supports that API for it to work |
03:48:04 | FromDiscord | <!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:55 | FromDiscord | <Elegantbeef> What's a valid url anyway |
03:49:14 | FromDiscord | <Elegantbeef> A ip address is a valid URL |
03:49:14 | FromDiscord | <ynfle> What do you mean by valid? On chrome, `chrome://` is valid |
03:49:24 | FromDiscord | <Elegantbeef> A filepath is a valid Url |
03:49:45 | FromDiscord | <-|-> a URI contains a scheme and everything else™️ |
03:49:49 | FromDiscord | <!Patitotective> https://urlregex.com/ ? |
03:49:57 | FromDiscord | <Elegantbeef> Dont you fucking use regex |
03:50:00 | FromDiscord | <Elegantbeef> I will fucking end you |
03:50:16 | FromDiscord | <Elegantbeef> If you must you use `parseURI` |
03:50:19 | FromDiscord | <-|-> RFC3986 uses regex: `^(([^:/?#]+):)?(//([^/?#]))?([^?#])(\?([^#]))?(#(.))?` |
03:50:24 | FromDiscord | <Elegantbeef> though the question of "validity" is very ambiguous |
03:50:35 | FromDiscord | <-|-> a URI contains a scheme and everything else |
03:50:37 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Dont you fucking use": 💀 i wasnt using regex to parse the mail |
03:50:57 | FromDiscord | <Elegantbeef> People try to use regex for the best email and it's literally just `str.contains('@')` |
03:51:01 | FromDiscord | <-|-> `[a-zA-Z0-9]+:[^ ]+` |
03:51:02 | FromDiscord | <Elegantbeef> You cannot validate email with regex |
03:51:08 | FromDiscord | <Elegantbeef> The way you validate it is if you can send the message |
03:51:10 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "though the question of": i just want it to not open `[email protected]` as an url |
03:51:20 | FromDiscord | <Elegantbeef> Well then check if it has `@` |
03:51:25 | FromDiscord | <Elegantbeef> That's all you need to do |
03:51:33 | FromDiscord | <-|-> but URLs can have username parts like email addresses |
03:51:34 | FromDiscord | <-|-> it's valid |
03:51:38 | FromDiscord | <!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:11 | FromDiscord | <Rika> In reply to @Patitotective "i just want it": It’s a valid URL though |
03:52:28 | FromDiscord | <Elegantbeef> Welcome to the world of the internet |
03:52:34 | FromDiscord | <Elegantbeef> The way you validate things is by seeing if anyone is home |
03:52:52 | FromDiscord | <!Patitotective> :[ |
03:53:23 | FromDiscord | <!Patitotective> then what do you think is better, copying the url, email, w/e or `openDefaultBrowser` |
03:53:24 | FromDiscord | <ynfle> https://www.myrecipes.com/recipe/elegant-beef-blue |
03:53:32 | FromDiscord | <!Patitotective> (edit) "then what do you think is better, copying the url, email, w/e ... or" added "to clipboard" |
03:53:47 | FromDiscord | <Elegantbeef> I think the best thing to do is using xdgopen |
03:54:02 | FromDiscord | <Elegantbeef> `xdg-open www.google.ca` |
03:54:11 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "I think the best": thats what `openDefaultBrowser` (?) |
03:54:14 | FromDiscord | <huantian> no |
03:54:15 | FromDiscord | <!Patitotective> (edit) "In reply to @Elegantbeef "I think the best": thats what `openDefaultBrowser` ... (?)" added "uses" |
03:54:16 | FromDiscord | <Rika> In reply to @Patitotective "thats what `openDefaultBrowser` uses": No |
03:54:19 | FromDiscord | <Elegantbeef> watch what happens |
03:54:19 | FromDiscord | <Rika> It’s a program |
03:54:36 | FromDiscord | <Rika> Only on certain systems |
03:54:44 | FromDiscord | <Rika> Not sure if Linux only or UNIX likes |
03:55:07 | FromDiscord | <ynfle> mac doesn't have it |
03:55:15 | FromDiscord | <Rika> This sounds like it could be a package now that I think about it |
03:55:27 | FromDiscord | <ynfle> macOS have `open <link>` |
03:57:20 | FromDiscord | <Elegantbeef> or `xdg-open mailto:[email protected]` |
03:57:20 | FromDiscord | <Elegantbeef> -\|- already gave you the answer to how to do this |
03:57:20 | FromDiscord | <Elegantbeef> It very much could be a package |
03:57:41 | FromDiscord | <huantian> but openDefaultBrowser is basically just xdg-open with some wrapping |
03:57:44 | FromDiscord | <huantian> (edit) "but openDefaultBrowser is basically just xdg-open with some wrapping ... " added "on linux" |
03:58:37 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=2UiX |
03:58:46 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=2UiX" => "https://play.nim-lang.org/#ix=2UBq" |
03:58:50 | FromDiscord | <Rika> @-|- how should we call you here xd -|- is really annoying to type hahaha, if you don’t mind of course |
03:59:05 | FromDiscord | <Rika> sent a code paste, see https://paste.rs/zAK |
03:59:08 | FromDiscord | <Elegantbeef> Yea would be nice for a proper name 😄 |
03:59:10 | FromDiscord | <!Patitotective> :[ |
03:59:29 | FromDiscord | <-|-> In reply to @Rika "<@594612808113586182> how should we": undeleted is 👌 |
03:59:42 | FromDiscord | <Elegantbeef> Damn a name that doesnt shorten well |
03:59:44 | FromDiscord | <aph> In reply to @Rika "Windows uses something else": iirc PowerShell probably support both Linux and windows command, not sure though |
03:59:47 | FromDiscord | <Elegantbeef> Why do people do this to me |
03:59:47 | FromDiscord | <huantian> I don't know what this means https://media.discordapp.net/attachments/371759389889003532/970535045414649896/unknown.png |
03:59:50 | FromDiscord | <undel> or does it? |
03:59:55 | FromDiscord | <Rika> In reply to @Elegantbeef "Damn a name that": I called him Undel in the other server |
03:59:56 | FromDiscord | <huantian> https://media.discordapp.net/attachments/371759389889003532/970535084853710888/unknown.png |
04:00:16 | FromDiscord | <Rika> If you do desire you could probably even call him Und xddddd |
04:00:26 | FromDiscord | <Rika> So desire |
04:00:43 | FromDiscord | <!Patitotective> 🌃 |
04:00:45 | FromDiscord | <!Patitotective> good night |
04:00:49 | FromDiscord | <!Patitotective> (edit) "good night ... " added "🙃" |
04:01:03 | FromDiscord | <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:29 | FromDiscord | <Elegantbeef> Yea it's annoying there isnt just a single API for this shit |
04:01:41 | FromDiscord | <Elegantbeef> But that means it's time for a library an patito to make it |
04:01:46 | FromDiscord | <Elegantbeef> Anyway buh bye patito |
04:04:28 | ehmry | esoteric xdg-open in nim https://git.syndicate-lang.org/ehmry/xdg_open_ng |
04:04:45 | * | slowButPresent quit (Quit: leaving) |
04:05:03 | FromDiscord | <Elegantbeef> Not cross platform though eh? |
04:05:09 | FromDiscord | <Elegantbeef> Also ehhh a `do` user |
04:05:50 | FromDiscord | <huantian> a little do never hurt nobody |
04:06:18 | ehmry | I 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:18 | FromDiscord | <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:05 | FromDiscord | <Zodey> can somebody help me with <https://github.com/nimgl/imgui>? |
07:08:24 | FromDiscord | <Elegantbeef> What about it? |
07:08:44 | FromDiscord | <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:48 | FromDiscord | <Zodey> i mean, i wanted to update it |
07:11:02 | FromDiscord | <Elegantbeef> Elaborate! |
07:11:33 | * | PMunch joined #nim |
07:11:53 | FromDiscord | <Zodey> cant it be done with replacing that cimgui with a newer version? https://media.discordapp.net/attachments/371759389889003532/970583391093272587/unknown.png |
07:12:36 | FromDiscord | <Zodey> ohh |
07:12:43 | FromDiscord | <Zodey> its not the same as the cimgui |
07:12:46 | FromDiscord | <Zodey> its a fork of it |
07:19:29 | PMunch | @Elegantbeef, are you around? |
07:19:43 | FromDiscord | <Elegantbeef> Indeed |
07:19:52 | PMunch | I'm looking at your Futhark issue |
07:20:06 | PMunch | Not sure really how to deal with __int128 |
07:20:47 | FromDiscord | <Elegantbeef> Perhaps a block to allow user defined typed definitions? |
07:20:55 | PMunch | I 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:01 | PMunch | Well you can use `retype` |
07:21:19 | PMunch | As described here: https://github.com/PMunch/futhark#redefining-types |
07:21:33 | PMunch | That's on a field-by-field basis though |
07:21:38 | PMunch | Which could become tedious |
07:21:59 | FromDiscord | <Elegantbeef> Yea i need to just have the type emitted take up the 128bits i think |
07:22:56 | FromDiscord | <Elegantbeef> Atleast for this api i do not need to interact with the underlying data |
07:24:10 | PMunch | Could you try to define a type `compiler_int128 = array[2, uint64]` before the Futhark block? |
07:24:33 | FromDiscord | <Elegantbeef> Doesnt the futhark code expand in a different file or is it included? |
07:24:44 | PMunch | It's included |
07:25:04 | PMunch | It creates a cache file, but if that file exists it is included |
07:25:32 | FromDiscord | <Elegantbeef> I forgot to mention opir emits `Error: Unknown kind in findAlias: {"kind":"invalid","value":"uint128"}` for it |
07:26:12 | PMunch | Ah, then it won't get to the Nim stage anyways |
07:26:27 | PMunch | Right, so it needs to be fixed in Opir and Futhark |
07:27:36 | FromDiscord | <Elegantbeef> I did try to abuse their 32bit support but it didnt work 😄 |
07:27:47 | FromDiscord | <Elegantbeef> For quite obvious reasons |
07:29:12 | FromDiscord | <Elegantbeef> To save you a trip https://play.nim-lang.org/#ix=3JZJ is the aliasing 😄 |
07:33:59 | PMunch | Hmm, this is a bit tricky to fix.. |
07:34:12 | PMunch | Well, to fix perfectly |
07:34:34 | PMunch | Easiest way would be to add int128 support in Nim itself |
07:34:48 | PMunch | But I'll cook up a workaround for you |
07:36:03 | FromDiscord | <Elegantbeef> Thanks |
07:39:36 | FromDiscord | <Elegantbeef> Did just work around it but less than idea to manually change the C source 😄 |
07:40:10 | PMunch | Yeah I mean the goal of Futhark is to never have to touch the C sources |
07:41:17 | FromDiscord | <Elegantbeef> Hey the wasm api is cleaner than the C since there is no manual namespacing now 🙂 |
07:42:03 | PMunch | Could you try now? |
07:42:38 | PMunch | Yeah being able to remove the manual namespacing is a pretty nice "feature" |
07:42:45 | FromDiscord | <mratsim> In reply to @PMunch "Not sure really how": https://github.com/nim-lang/Nim/issues/7675#issuecomment-383409664 |
07:43:32 | FromDiscord | <Elegantbeef> Well this is for futhark's importing so it only needs the int128 if the source code has it |
07:43:58 | PMunch | @mratsim, yeah the problem lies with how to manage this across different Futhark libraries and such |
07:44:29 | FromDiscord | <Elegantbeef> I cant even install futhark without `--passL` so that's always fun 😄 |
07:44:46 | PMunch | I 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:13 | PMunch | @Elegantbeef, that's because you're on a silly distro which doesn't put libclang where it's supposed to go :P |
07:45:28 | FromDiscord | <Elegantbeef> I know why |
07:45:39 | PMunch | If you set up a library path properly it should work fine |
07:47:07 | PMunch | And 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:24 | FromDiscord | <mratsim> int128 is a builtin so you can special case it |
07:47:48 | FromDiscord | <Elegantbeef> Yea i'd argue you have a `int128` implementation and if a library uses it you expose the module |
07:47:54 | FromDiscord | <Elegantbeef> It'd be ideal being in system |
07:48:02 | FromDiscord | <Elegantbeef> or in a module |
07:48:07 | FromDiscord | <Elegantbeef> stdlib module i mean |
07:48:24 | FromDiscord | <Elegantbeef> Seems to work pmunch thanks |
07:48:30 | PMunch | That would be the best solution I guess |
07:49:04 | PMunch | Oh wait @Elegantbeef I think I messed up.. |
07:49:33 | FromDiscord | <Elegantbeef> Ah yea it was using cache 😄 |
07:50:07 | FromDiscord | <Elegantbeef> Or not nimble didnt fetch head |
07:50:10 | FromDiscord | <Elegantbeef> Fuck i ruined the test 😄 |
07:50:20 | PMunch | I 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:21 | FromDiscord | <Elegantbeef> yea it failed |
07:50:51 | PMunch | But I messed up and did `array[2, tuple[low: uint64, high: uint64]]`, so now it's a uint256 instead :P |
07:51:15 | FromDiscord | <Elegantbeef> Worse than that `Error: Unknown kind in findAlias: {"kind":"special","value":"uint128"}` |
07:51:31 | PMunch | Oh, interesting |
07:52:04 | FromDiscord | <Elegantbeef> Ah you didnt add functionality to `findAlias` |
07:53:16 | PMunch | Okay, try to instal the int128test branch |
07:53:31 | PMunch | And make sure that you're compiling against that |
07:53:44 | FromDiscord | <Elegantbeef> Does nimble support installing branches? |
07:53:52 | PMunch | Yup |
07:54:13 | FromDiscord | <Elegantbeef> I'm going to need that syntax 😄 |
07:54:25 | PMunch | nimble install futhark\#int128support |
07:54:31 | PMunch | I believe it's something like that |
07:55:40 | PMunch | Hmm, maybe that only works as a dependency |
07:56:24 | PMunch | Ah it's @# |
07:56:31 | FromDiscord | <Elegantbeef> I can use the commit |
07:56:34 | FromDiscord | <Elegantbeef> Couldnt get it to use the branch |
07:56:49 | PMunch | nimble install futhark@#int128test |
07:56:56 | FromDiscord | <Elegantbeef> Yea wouldnt work i tried it |
07:57:02 | FromDiscord | <Elegantbeef> `addUsings` now |
07:57:17 | PMunch | Strange, that worked for me |
07:57:19 | PMunch | The install |
07:57:52 | FromDiscord | <Elegantbeef> Ah i quoted it and apparently fish didnt like that |
07:58:05 | PMunch | Try now |
07:58:07 | FromDiscord | <Elegantbeef> Or i mistyped it apparently |
07:58:21 | * | jmdaemon quit (Ping timeout: 272 seconds) |
07:58:38 | FromDiscord | <Elegantbeef> We're alive |
07:58:59 | FromDiscord | <Elegantbeef> Yep cleared cache aswell |
08:00:33 | PMunch | Nice |
08:05:43 | * | neceve joined #nim |
08:06:33 | PMunch | I forced pushed to master now, so the 0.6.1 version should now contain all the fixes |
08:07:05 | PMunch | Oh, 0.6.2 apparently |
08:09:16 | PMunch | Never mind, it's 0.6.1 |
08:09:33 | FromDiscord | <Elegantbeef> Well thanks, now i get to play with wasm a bit 😄 |
08:10:05 | PMunch | Oh damn, I seems to have had an uncommited change in my local version.. |
08:10:12 | PMunch | Hopefully that doesn't cause any issues.. |
08:58:25 | FromDiscord | <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:07 | FromDiscord | <Elegantbeef> you're not compiling with `--app:lib` are you |
09:01:23 | FromDiscord | <Recruit_main707> was gonna say that :p |
09:01:40 | FromDiscord | <Recruit_main707> no idea about the double extern |
09:03:34 | FromDiscord | <jmgomez> yes, I am |
09:04:06 | FromDiscord | <jmgomez> it outputs the dynlib what it doesnt ouput is the weak symbols for the linker to work |
09:04:31 | FromDiscord | <Elegantbeef> Yea i dont know what you're talking about |
09:04:38 | FromDiscord | <Elegantbeef> I dont do library toying around |
09:05:55 | FromDiscord | <Recruit_main707> --app:lib is for dynamic libraries |
09:06:05 | FromDiscord | <Recruit_main707> --app:staticlib is for static libraries |
09:06:53 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> The dynlib knows the symbols it has |
09:07:38 | FromDiscord | <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:55 | FromDiscord | <Elegantbeef> I'll just shush |
09:07:58 | FromDiscord | <jmgomez> In reply to @Elegantbeef "The dynlib knows the": then in windows for example why you have .lib and .dll? |
09:08:13 | FromDiscord | <jmgomez> you need to link with .lib and use in runtime dll |
09:08:34 | FromDiscord | <Elegantbeef> I mean with linux i know you just use `.so` |
09:08:57 | FromDiscord | <Recruit_main707> but if you link with .lib you dont even need the dll do you? |
09:09:15 | FromDiscord | <jmgomez> In reply to @Recruit_main707 "but if you link": yes, because that's why they are called "weak symbols" |
09:09:30 | FromDiscord | <jmgomez> In reply to @Elegantbeef "I mean with linux": do you happen to know how it works in macos? |
09:09:32 | FromDiscord | <Recruit_main707> i dont use c/c++ but would a header file work for this? |
09:10:10 | FromDiscord | <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:13 | FromDiscord | <Elegantbeef> As i know it you just need the dynamic library and point the compiler to the folder that you depend on |
09:14:20 | FromDiscord | <Elegantbeef> I really dont know much when it comes to libraries |
09:14:24 | FromDiscord | <Elegantbeef> Except roughly how to use them |
09:14:53 | FromDiscord | <Elegantbeef> Fuuuun wasmedge does not like my `.wasm` file |
09:14:58 | FromDiscord | <Elegantbeef> I guess i fucked something up, yay! |
09:14:59 | * | firq joined #nim |
09:16:06 | FromDiscord | <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:20 | FromDiscord | <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:39 | FromDiscord | <Elegantbeef> Like there isnt anything else for my code to link with |
09:23:49 | FromDiscord | <jmgomez> Okay, yeah I think lin works differently probably mac works the same |
09:29:38 | FromDiscord | <Recruit_main707> https://youtu.be/4o_tmccinds?t=278↵Here there are no weak symbols other than the header |
09:30:15 | FromDiscord | <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:47 | FromDiscord | <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:36 | FromDiscord | <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:22 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3WMr |
09:49:13 | FromDiscord | <SirElephant> got it |
09:49:22 | FromDiscord | <ynfle> I don't think mac uses .lib files, like linux |
10:02:27 | FromDiscord | <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:29 | FromDiscord | <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:17 | PMunch | Hmm, is there a way to throw exceptions across a DLL bridge? |
12:31:33 | PMunch | If both sides are written in Nim of course |
12:31:57 | FromDiscord | <Yardanico> don't think so, you'll probably have to resort to normal values or enums |
12:32:12 | FromDiscord | <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:16 | FromDiscord | <Yardanico> so it's not shared between dlls |
12:32:23 | FromDiscord | <Yardanico> but I might be wrong of course |
12:32:30 | PMunch | Well if it's global it would be shared, no? |
12:32:44 | FromDiscord | <Yardanico> well it's a thread-global |
12:33:13 | PMunch | Sure, but as long as everything is done in the same thread it should be possible, right? |
12:33:54 | FromDiscord | <Yardanico> maybe, I don't really know |
12:34:01 | FromDiscord | <Yardanico> I just checked, and for a simple program Nim makes "N_LIB_PRIVATE NIM_BOOL nimInErrorModesystem_4243;" |
12:34:03 | FromDiscord | <Yardanico> with arc |
12:34:12 | FromDiscord | <Yardanico> a global variable, although I compiled without threads |
12:34:28 | FromDiscord | <Yardanico> and with threads it's "N_LIB_PRIVATE NIM_THREADVAR NIM_BOOL nimInErrorModesystem_4859;" |
12:35:26 | FromDiscord | <Yardanico> and even then, this is just the status that an exception has been thrown, the actual exception is stored elsewhere |
12:35:43 | FromDiscord | <Yardanico> "N_LIB_PRIVATE NIM_THREADVAR Exception currExceptionsystem_4529;" |
12:36:42 | FromDiscord | <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:14 | FromDiscord | <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:01 | FromDiscord | <Yardanico> but I don't know how easy is that, especially all the refcounting and cycle related stuff between DLLs |
12:42:39 | PMunch | Hmm, I can't even get it to pass a GC-ed type across the dynamic library barrier when using ARC |
12:42:45 | PMunch | I thought that was supposed to "just work" |
12:43:04 | FromDiscord | <Yardanico> you need to GC_ref it at least |
12:44:04 | FromDiscord | <d4rckh> okay, might sound like a stupid version, but is there any problem if i cast an int32 to an int? |
12:44:09 | FromDiscord | <d4rckh> (edit) "version," => "question," |
12:45:06 | FromDiscord | <Yardanico> there's no problem if you convert it :) |
12:45:15 | FromDiscord | <Yardanico> unless someone is compiling your code for a 16-bit platform :D |
12:45:21 | FromDiscord | <d4rckh> i figured |
12:45:22 | FromDiscord | <d4rckh> haha |
12:45:23 | FromDiscord | <Yardanico> `let myintval = int(myint32val)` |
12:45:31 | FromDiscord | <demotomohiro> In reply to @d4rckh "okay, might sound like": https://github.com/nim-lang/Nim/issues/19101 |
12:45:32 | FromDiscord | <d4rckh> i did (int) and it worked fine? |
12:45:37 | FromDiscord | <d4rckh> (edit) "(int)" => "(int)myint32" |
12:45:56 | FromDiscord | <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:02 | FromDiscord | <Yardanico> the preferred way is `int(myint32)` |
12:46:12 | FromDiscord | <Yardanico> (int) only works because of how command syntax works |
12:46:19 | FromDiscord | <d4rckh> ah |
12:46:25 | FromDiscord | <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:01 | FromDiscord | <pmunch> Type conversion != type casting in Nim |
12:47:10 | FromDiscord | <Yardanico> yeah |
12:47:13 | * | Zectbumo quit (Remote host closed the connection) |
12:47:17 | PMunch_ | Network bugged out for a second |
12:47:28 | PMunch_ | 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:59 | PMunch | Hmm, with `--d:useMalloc` it seems to not error out |
12:52:11 | FromDiscord | <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:23 | PMunch | Yeah I believe so to |
12:52:23 | FromDiscord | <Yardanico> that's why the gdb shows the error on the allocator code in the loader |
12:52:42 | PMunch | --d:useMalloc probably works because it is not placed in the memory region that Nim expects to manage |
12:55:30 | FromDiscord | <Yardanico> also @PMunch i think this is essentially the same as https://github.com/nim-lang/Nim/issues/15202 |
12:56:32 | FromDiscord | <Yardanico> and yes, you can't build nimrtl with arc :) |
13:00:59 | FromDiscord | <Yardanico> i wonder if mimalloc works with multi-DLL usecase |
13:02:15 | FromDiscord | <Yardanico> looks like it does |
13:02:51 | * | DixieFlatline quit (Ping timeout: 245 seconds) |
13:02:54 | FromDiscord | <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:38 | PMunch | mimalloc? |
13:04:47 | * | kayabaNerve quit (Ping timeout: 260 seconds) |
13:04:56 | PMunch | But yeah it's a bit sad that Nim isn't better at loading it's own DLLs.. |
13:05:06 | FromDiscord | <Yardanico> @PMunch using -d:useMalloc usually makes performance worse |
13:05:23 | FromDiscord | <Yardanico> mimalloc is a different allocator that for Nim usually works as fast as Nim's own allocator even with -d:useMalloc |
13:05:28 | FromDiscord | <Yardanico> https://github.com/Yardanico/mimalloc_nim |
13:06:09 | FromDiscord | <Yardanico> but I initially tested mimalloc because of ARC/ORC being (sometimes) slow in multithreaded programs with a lot of allocations |
13:06:56 | FromDiscord | <Yardanico> and compared to normal system-wide malloc you can statically link mimalloc and apply LTO, so your allocations get even faster |
13:07:08 | FromDiscord | <Yardanico> the same as with the nim's own allocator essentially |
13:07:47 | PMunch | Right, so it should be a drop-in replacement for -d:useMalloc? |
13:08:06 | FromDiscord | <Yardanico> well, mimalloc provides a malloc-like interface, so you use it together with -d:useMalloc |
13:08:16 | FromDiscord | <Yardanico> its really simple, you can check the .nims file i have in the src folder |
13:08:41 | FromDiscord | <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:58 | PMunch | Right |
13:09:18 | FromDiscord | <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:35 | FromDiscord | <Yardanico> also, for some reason with mingw on Windows it was quite slower for me than nim's default allocator |
13:09:48 | FromDiscord | <Yardanico> with msvc it was faster or on par |
13:10:11 | PMunch | So 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:01 | PMunch | That should be pretty easy if I modify the C code, on Linux at least |
13:11:51 | PMunch | I guess just not declaring the symbol would mean that it would grab it from the main executable |
13:12:30 | FromDiscord | <Yardanico> if it's named the same way, probably |
13:19:45 | NimEventer | New 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:08 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WNp |
13:22:29 | FromDiscord | <d4rckh> but it throws this error `Error: undeclared field: 'dwMajorVersion' for type types.OSVersionInfoExW` |
13:22:31 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/CMf |
13:22:46 | FromDiscord | <d4rckh> but i do have `dwMajorVersion` declared 🤔 |
13:22:56 | FromDiscord | <Yardanico> you didn't export it |
13:22:57 | FromDiscord | <d4rckh> its erroring on the return line |
13:23:08 | FromDiscord | <d4rckh> rtlGetVersion is defined in the same file |
13:23:20 | FromDiscord | <d4rckh> aaah |
13:23:23 | FromDiscord | <d4rckh> the fields |
13:23:25 | FromDiscord | <Yardanico> yep |
13:23:33 | FromDiscord | <d4rckh> :facepalm: |
13:23:44 | FromDiscord | <d4rckh> so much spam for nothing |
13:23:51 | FromDiscord | <d4rckh> apologies |
13:25:17 | FromDiscord | <d4rckh> (also yes i noticed that i used dwMinorVersion instead of osInfo.dwMinorVersion, it errored after i fixed the other issue) |
13:25:33 | FromDiscord | <d4rckh> (edit) "errored" => "i was mad at me" |
13:25:54 | FromDiscord | <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:52 | NimEventer | New thread by Pswilde: Passing "var addr x" into procedure, see https://forum.nim-lang.org/t/9135 |
14:12:07 | FromDiscord | <Yardanico> not sure why they thought of using `addr` for this in the first place, moreover `var` |
14:16:08 | nrds | <Prestige99> I like robb1e's reply |
14:31:32 | * | analogsalad quit (Ping timeout: 248 seconds) |
14:50:49 | FromDiscord | <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:18 | FromDiscord | <Yardanico> maybe similar to https://forum.nim-lang.org/t/6091 ? |
14:53:32 | FromDiscord | <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:25 | FromDiscord | <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:31 | FromDiscord | <5Q> Thanks, I will take a look at tit↵(@Yardanico) |
15:07:07 | FromDiscord | <5Q> sent a code paste, see https://paste.rs/4J0 |
15:07:45 | FromDiscord | <Yardanico> what are you compiling with? |
15:07:49 | FromDiscord | <Yardanico> i mean C compiler |
15:08:16 | FromDiscord | <Yardanico> ah InitializeSynchronizationBarrier maybe you need to link to win libs |
15:08:23 | FromDiscord | <5Q> gcc.exe (x86\_64-win32-seh-rev1, Built by MinGW-W64 project) 6↵(@Yardanico) |
15:09:03 | FromDiscord | <Yardanico> hmm, but kernel32.lib should be linked by default |
15:09:11 | FromDiscord | <Yardanico> try adding --passL:"-lkernel32" |
15:12:03 | FromDiscord | <Yardanico> @5Q any progress? |
15:12:28 | FromDiscord | <5Q> oh, maybe my message was too big for the discord bridge↵(@Yardanico) |
15:12:41 | FromDiscord | <5Q> let me send you the gcc command that errors out |
15:13:01 | FromDiscord | <5Q> adding --passL didn't work |
15:13:38 | * | rez joined #nim |
15:13:44 | FromDiscord | <5Q> https://nekobin.com/rorabomeka here is the gcc command |
15:14:12 | * | neceve quit (Ping timeout: 246 seconds) |
15:14:27 | FromDiscord | <Yardanico> ok i will test it later maybe when I reboot into windows |
15:14:36 | FromDiscord | <Yardanico> in the meanwhile you can compile with msvc instead, seems like taskpolls support it |
15:14:41 | FromDiscord | <Yardanico> taskpools |
15:14:55 | FromDiscord | <5Q> thank you, how can I change the compiler used? |
15:15:32 | FromDiscord | <Yardanico> --cc:vcc, but you need to have Visual Studio compiler tools installed |
15:15:38 | FromDiscord | <Yardanico> and compile from visual studio's devtools command prompt |
15:15:47 | FromDiscord | <Yardanico> you can find it in your programs from the start menu |
15:16:09 | FromDiscord | <5Q> thanks, will try that |
15:16:26 | FromDiscord | <mratsim> In reply to @5Q "gcc.exe (x86\_64-win32-seh-rev1, Built by": that's strange, mingw is tested in CI |
15:17:20 | FromDiscord | <5Q> is vs2019 supported? |
15:18:22 | FromDiscord | <mratsim> https://github.com/status-im/nim-taskpools/blob/stable/.github/workflows/ci.yml#L95= |
15:19:26 | FromDiscord | <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:42 | FromDiscord | <mratsim> ah I remember something about mingw |
15:22:02 | FromDiscord | <5Q> sent a code paste, see https://paste.rs/9GT |
15:24:25 | * | kayabaNerve joined #nim |
15:24:27 | FromDiscord | <5Q> sent a code paste, see https://play.nim-lang.org/#ix=3WOj |
15:24:59 | FromDiscord | <mratsim> https://sourceforge.net/p/mingw-w64/bugs/562/ |
15:25:40 | FromDiscord | <mratsim> you need a mingw64 version with that fix: https://github.com/Alexpux/mingw-w64/pull/2 |
15:26:35 | FromDiscord | <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:31 | FromDiscord | <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:29 | FromDiscord | <5Q> 1.6.4↵(@mratsim) |
15:44:05 | * | eron joined #nim |
15:48:52 | * | eron quit (Client Quit) |
15:57:08 | FromDiscord | <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:03 | FromDiscord | <jmgomez> can Nim hot reloading feature be used in dynlibs? |
16:07:09 | FromDiscord | <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:16 | FromDiscord | <jmgomez> gotcha |
16:09:25 | PMunch_ | 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:31 | PMunch_ | 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:55 | FromDiscord | <d4rckh> how can i handle truncated lines from sockets? |
16:40:08 | FromDiscord | <d4rckh> how do i know when they finished? |
16:40:57 | FromDiscord | <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:08 | FromDiscord | <Ayy Lmao> Is gc:orc suitable for webassembly? |
17:28:39 | FromDiscord | <Ayy Lmao> Haven't done much testing, just curious if anyone has any experience. |
17:29:11 | FromDiscord | <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:46 | FromDiscord | <Ayy Lmao> In reply to @mothumix "it'll compile and run,": So gc:arc is recommended? |
17:31:13 | FromDiscord | <Yardanico> no, I meant arc/orc in general |
17:31:17 | FromDiscord | <Yardanico> not orc specifically |
17:31:59 | FromDiscord | <enthus1ast> Tcp?↵(@d4rckh) |
17:32:24 | FromDiscord | <d4rckh> yeah, i figured out a way |
17:32:32 | FromDiscord | <d4rckh> i am sending base64 encoded json objects |
17:33:43 | FromDiscord | <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:52 | FromDiscord | <d4rckh> (edit) "'data'" => "buffer" |
17:34:19 | * | FromDiscord quit (Remote host closed the connection) |
17:34:32 | * | FromDiscord joined #nim |
17:34:48 | FromDiscord | <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:30 | FromDiscord | <enthus1ast> When reading you can also check for "" |
17:35:30 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WOL |
17:35:36 | FromDiscord | <enthus1ast> Yes |
17:35:41 | FromDiscord | <enthus1ast> On the server |
17:36:01 | FromDiscord | <enthus1ast> But the client does not immediately know |
17:36:02 | * | rez quit (Quit: l8r) |
17:36:24 | FromDiscord | <enthus1ast> So you should at least do some ping pong |
17:36:40 | FromDiscord | <enthus1ast> And or acknowledge the packet |
17:36:56 | FromDiscord | <d4rckh> well in the client i just send the entire thing |
17:37:01 | FromDiscord | <d4rckh> no chunking |
17:38:15 | FromDiscord | <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:11 | FromDiscord | <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:46 | FromDiscord | <d4rckh> yes, i am also coding the client. i will add this |
17:45:01 | * | vicecea joined #nim |
17:56:26 | FromDiscord | <m4ul3r> Is it possible to view the uri in an httpclient response object? |
17:56:52 | * | PMunch quit (Ping timeout: 248 seconds) |
18:03:15 | FromDiscord | <hmmm> broskis wtf I think I found a bug 👀 |
18:03:35 | FromDiscord | <hmmm> if it's a bug I want a bughunt prize and my name written somewhere 🤔 |
18:03:48 | FromDiscord | <Yardanico> ?? |
18:04:35 | FromDiscord | <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:44 | FromDiscord | <hmmm> I think it's a bug it must be 🧐 |
18:05:12 | * | PMunch joined #nim |
18:05:33 | FromDiscord | <Yardanico> In reply to @hmmm "basically if you call": can you show the code? |
18:06:06 | FromDiscord | <Yardanico> ah i see |
18:06:14 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3WOR |
18:06:23 | FromDiscord | <hmmm> basically if line is xx:yy it will not run the except |
18:06:34 | FromDiscord | <Yardanico> and why would it? |
18:06:35 | FromDiscord | <hmmm> but it will create a 0kb file |
18:06:59 | FromDiscord | <hmmm> it will not perform the copy |
18:07:06 | FromDiscord | <Yardanico> can you show the bug without the runtime values? |
18:07:14 | FromDiscord | <Yardanico> just make up some strings that show the same behaviour |
18:07:22 | FromDiscord | <hmmm> hmm ok I'll try |
18:08:07 | FromDiscord | <Yardanico> also, nim's copyFile function does nothing weird, it just calls the native APIs |
18:08:14 | FromDiscord | <Yardanico> so it's rather a question why the OS doesn't raise an error |
18:09:12 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3WOV |
18:09:17 | FromDiscord | <hmmm> this will create a 0kb file called hello |
18:09:23 | FromDiscord | <Yardanico> why still have & though :P |
18:09:24 | FromDiscord | <hmmm> but will not copy |
18:09:31 | FromDiscord | <hmmm> lol 😃 |
18:09:45 | FromDiscord | <Yardanico> In reply to @hmmm "but will not copy": works for me |
18:09:50 | FromDiscord | <Yardanico> must be a windows specific bug |
18:09:53 | FromDiscord | <hmmm> hmm |
18:09:53 | FromDiscord | <Yardanico> on windows |
18:09:58 | FromDiscord | <hmmm> yea I'm on win |
18:10:03 | FromDiscord | <Yardanico> i know |
18:10:10 | FromDiscord | <hmmm> 😄 |
18:12:45 | FromDiscord | <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:53 | FromDiscord | <Yardanico> similar, basically its windows' weirdness, nothing unusual |
18:13:16 | FromDiscord | <hmmm> oh |
18:13:21 | FromDiscord | <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:35 | FromDiscord | <Yardanico> https://blog.foldersecurityviewer.com/ntfs-alternate-data-streams-the-good-and-the-bad/ |
18:13:37 | FromDiscord | <m4ul3r> I was about to say, does windows like : in filenames |
18:13:39 | FromDiscord | <hmmm> and how do I sanitize my strings to avoid characters that windows hate 🤔 |
18:13:57 | FromDiscord | <m4ul3r> using - or _ |
18:13:58 | FromDiscord | <Yardanico> In reply to @m4ul3r "I was about to": nope, but as you can see they have a different feature here |
18:14:33 | FromDiscord | <Yardanico> In reply to @hmmm "and how do I": https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file |
18:15:39 | FromDiscord | <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:44 | FromDiscord | <Yardanico> that might work the wrong way |
18:16:47 | FromDiscord | <hmmm> or something like a isWindowsIllegal():bool readymade proc would be very appreciated 😄 |
18:17:08 | FromDiscord | <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:36 | FromDiscord | <hmmm> hmm I see, not safe at all, but if I had an isWindowsIllegal() I could name it something default |
18:17:54 | FromDiscord | <Yardanico> i just don't know your specific usecase |
18:18:02 | FromDiscord | <Yardanico> is it user input? or just from some parsing or something? |
18:18:03 | FromDiscord | <Yardanico> it's unclear |
18:18:23 | FromDiscord | <hmmm> it takes it from the first line of test file |
18:18:51 | FromDiscord | <Yardanico> so why not just make sure the input the valid if you control it |
18:18:59 | FromDiscord | <Yardanico> (edit) "the" => "is" |
18:19:05 | FromDiscord | <m4ul3r> just replace the : with a _ or - for the file names then |
18:19:16 | FromDiscord | <hmmm> hehe test file is kinda out of my control 😅 |
18:19:26 | FromDiscord | <hmmm> yea I'll try to make a proc, thx broskis |
18:20:42 | FromDiscord | <demotomohiro> How about to check filename with this: https://nim-lang.org/docs/os.html#isValidFilename%2Cstring |
18:20:57 | FromDiscord | <hmmm> HA! |
18:21:03 | FromDiscord | <hmmm> demo ❤️ ❤️ |
18:21:13 | FromDiscord | <demotomohiro> And if it is invalid, print error |
18:22:22 | Amun-Ra | isValidFilename is very windows oriented |
18:22:37 | FromDiscord | <Yardanico> well, hmmm wants that specifically |
18:22:58 | Amun-Ra | all those test should pass on posix |
18:23:20 | FromDiscord | <Yardanico> @Amun-ra I don't understand your argument |
18:23:27 | FromDiscord | <Yardanico> the docs clearly say "valid for crossplatform use." |
18:23:42 | FromDiscord | <Yardanico> not for checking only for linux or mac or windows |
18:23:45 | FromDiscord | <Yardanico> it checks for all of them at once |
18:23:53 | Amun-Ra | I missed that |
18:26:10 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=3WP1 |
18:27:19 | FromDiscord | <demotomohiro> It seems `os.isValidFilename` can be deleted: https://github.com/nim-lang/Nim/pull/19643 |
18:27:48 | FromDiscord | <hmmm> wot |
18:27:56 | FromDiscord | <hmmm> over my dead body 🧐 |
18:28:26 | FromDiscord | <Yardanico> In reply to @hmmm "over my dead body": just copy the impl |
18:28:28 | FromDiscord | <Yardanico> its just a few liens |
18:28:29 | FromDiscord | <Yardanico> (edit) "liens" => "lines" |
18:28:50 | FromDiscord | <hmmm> hmm why take out useful stuff, it's not like we run out of memory 🤨 |
18:29:01 | FromDiscord | <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:54 | FromDiscord | <Yardanico> actually httpclient has a private field currentURL: Uri , you can access that if you don't want to do redirects manually |
18:32:22 | FromDiscord | <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:33 | FromDiscord | <m4ul3r> When I had attempted that earlier I ran into undeclared field (which makes sense since it's private) |
18:34:51 | FromDiscord | <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:55 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/19278 |
18:38:47 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=3WP5 |
18:42:33 | FromDiscord | <Yardanico> In reply to @m4ul3r "How would I go": just do the request again? |
18:42:43 | FromDiscord | <Yardanico> and if it's more than 1 redirect, put it in a loop to follow redirects while Location is found |
18:44:45 | FromDiscord | <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:54 | FromDiscord | <Yardanico> In reply to @m4ul3r "Makes sense, I guess": nonono |
18:44:59 | FromDiscord | <Yardanico> you just follow the redirects with the same client |
18:45:07 | FromDiscord | <Yardanico> you don't need a client for location, it's just a response header |
18:45:32 | FromDiscord | <m4ul3r> oh, just another request with the location? |
18:45:38 | FromDiscord | <Yardanico> yes |
18:45:41 | FromDiscord | <m4ul3r> 👍 |
18:45:53 | FromDiscord | <Yardanico> https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections |
18:45:54 | FromDiscord | <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:23 | FromDiscord | <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:53 | PMunch | Yes |
19:55:08 | PMunch | The object you're going to use the most has a nice descriptive name |
19:55:29 | PMunch | Then the other has either Obj or Ref as a postfix depending on it's type |
19:56:26 | PMunch | So 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:39 | PMunch | Wait, procs? |
19:57:04 | nrds | <Prestige99> like one proc takes Foo, another takes FooRef |
19:57:16 | nrds | <Prestige99> but do the same thing? |
19:57:35 | FromDiscord | <treeform> you could do `proc bar(foo: Foo|FooRef) =` |
19:57:47 | FromDiscord | <treeform> so it takes both |
19:58:02 | FromDiscord | <leorize> you should only have one for value then use auto deref \:p |
19:58:35 | FromDiscord | <treeform> I always make one either obj or ref, I never do the MyThingObj/MyThingRef personally. |
19:59:11 | FromDiscord | <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:29 | FromDiscord | <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:31 | FromDiscord | <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:00 | FromDiscord | <Phil> Is this a holdover from other languages? |
20:30:33 | FromDiscord | <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:16 | FromDiscord | <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:43 | FromDiscord | <Elegantbeef> You ideally give it to whichever you use the least so the API is nice to use |
20:33:49 | FromDiscord | <Recruit_main707> or dont use implicit refs and write them whenever you use them :P |
20:34:14 | FromDiscord | <Elegantbeef> Yea that works aswell 😄 |
20:34:36 | * | jjido joined #nim |
20:34:38 | FromDiscord | <dom96> In reply to @treeform "I always make one": Same |
20:35:09 | FromDiscord | <Elegantbeef> There arent many cases where you need both |
20:36:19 | FromDiscord | <archnim> In reply to @Elegantbeef "There arent many cases": True. |
20:40:04 | PMunch | @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:05 | FromDiscord | <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:20 | FromDiscord | <JSONBash> sent a code paste, see https://play.nim-lang.org/#ix=3WPu |
21:02:23 | FromDiscord | <JSONBash> it is idiomatic Nim |
21:02:55 | FromDiscord | <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:47 | FromDiscord | <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:18 | FromDiscord | <eyecon> The search results are understandably about matrices, the data structure ones |
21:26:12 | FromDiscord | <eyecon> Does anyone know of a library with an east to use Matrix API? |
21:26:18 | FromDiscord | <eyecon> (edit) "east" => "easy" |
21:26:24 | FromDiscord | <dom96> try to search nimble using the cli or nimble.directory |
21:26:37 | FromDiscord | <dom96> (edit) "try to search nimble ... using" added "packages" |
21:27:14 | FromDiscord | <eyecon> In reply to @dom96 "try to search nimble": Good idea, thanks |
21:27:25 | FromDiscord | <eyecon> That gives me... a grand total of 1 library |
21:27:41 | FromDiscord | <eyecon> Which is still good |
21:28:03 | FromDiscord | <eyecon> Let's see how `matrixsdk` works |
21:28:03 | FromDiscord | <dom96> perfect excuse to write a new one :D |
21:28:19 | FromDiscord | <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:28 | FromDiscord | <!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:14 | FromDiscord | <Elegantbeef> Yes it d oes work |
22:36:20 | * | firq quit (Ping timeout: 248 seconds) |
22:45:23 | FromDiscord | <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:04 | FromDiscord | <Elegantbeef> Dont know how to fix this one |
23:34:01 | NimEventer | New thread by R3c: C FFI using only types?, see https://forum.nim-lang.org/t/9136 |
23:49:53 | * | ltriant joined #nim |