00:00:02 | * | junland quit (Quit: %ZNC Disconnected%) |
00:00:41 | * | junland joined #nim |
00:03:06 | * | Jesin quit (Quit: Leaving) |
00:07:35 | * | Jesin joined #nim |
00:10:50 | skrylar[m] | i saw this came out recently https://haxe.org/blog/shirogames-stack/ and gave me a few minutes of pause |
00:20:11 | FromDiscord | <KingDarBoja> WHAT |
00:20:13 | FromDiscord | <KingDarBoja> DUDE |
00:20:30 | FromDiscord | <KingDarBoja> I remember I was trying to mod one of Shiro Games |
00:20:50 | FromDiscord | <KingDarBoja> But then devs said it wasn't allowed on some QA I think |
00:20:56 | FromDiscord | <KingDarBoja> I know some dude is still modding that |
00:23:23 | * | FromDiscord <KingDarBoja> For instance our 3D game Northgard requires less than 500 MB of memory to run. |
00:24:14 | FromDiscord | <KingDarBoja> I don't remember how much memory it was, need to check that again |
00:27:02 | * | theelous3 joined #nim |
00:28:23 | FromDiscord | <KingDarBoja> I have to admit, that was a great article to read |
00:38:14 | skrylar[m] | yea it made me reconsider haxe since i saw a youtube about the article, looked around a little bit. i've been doing the low level gles2 stuff in nim and kind of sighed since on the haxe side that's pretty much already done |
00:38:35 | * | NimBot joined #nim |
00:39:53 | skrylar[m] | some of its not super hard. i have a very basic little meshing module that lets me just pop out quads and it builds the vertex tables in the background |
00:40:13 | FromGitter | <zetashift> Yeah Haxe is great |
00:40:22 | FromGitter | <zetashift> but their docs are even worse than Nim lol |
00:40:34 | skrylar[m] | haxe is also not self hosted which is what made me go meh |
00:40:51 | FromGitter | <zetashift> iirc they were/are working on an OCaml -> Haxe part |
00:40:55 | FromGitter | <zetashift> so it becomes self hosted |
00:41:20 | skrylar[m] | i looked around and all i found was a 2014 thread of people asking why it was still ocaml and were told because the devs like it that way |
00:41:25 | skrylar[m] | but |
00:41:42 | skrylar[m] | haxe also has a lot of things i don't miss like capitalization and objects owning their procs |
00:42:37 | FromDiscord | <KingDarBoja> What is self hosted in this case? |
00:42:50 | skrylar[m] | compiler written in itself |
00:42:50 | FromDiscord | <KingDarBoja> Also not sure what you doing skrylar, sorry, newbie here |
00:43:01 | FromDiscord | <KingDarBoja> Oh |
00:43:10 | FromGitter | <zetashift> 'objects owning their procs' ? |
00:43:28 | skrylar[m] | class Bleh { public void Doit() { .. } } |
00:43:48 | FromGitter | <zetashift> ah like that |
00:44:07 | FromGitter | <zetashift> doesn't that boil down to OOP vs procedural? |
00:44:12 | disruptek | CAPITALIZATION IS AMAZING THOUGH |
00:44:20 | skrylar[m] | nim assumes foo.bar is bar(foo) and you're done, haxe does the c# thing where you have to define it with the object or do an extension class which makes you wonder what the point is |
00:44:38 | skrylar[m] | "wow you can make a class that *isn't really a class* but just looks like one for the sole purpose of bolting a method on to another class" |
00:45:23 | skrylar[m] | but yeah they have a couple of really neat things like lime and haxeflixel |
00:46:05 | disruptek | YOU CAN'T SPELL KOOP WITHOUT OOP |
00:46:27 | FromDiscord | <KingDarBoja> KOOP? |
00:46:35 | skrylar[m] | compile speeds in my nim code are still pretty snappy so .. eh. |
00:46:40 | * | lritter joined #nim |
00:46:49 | disruptek | you're probably using it wrong. π |
00:47:06 | skrylar[m] | well yes i only allow macros for syntax sugar |
00:47:49 | skrylar[m] | the people who were here some months ago writing cryptomonies and bignum libs with heavy generator macros had a lot of pain, but honestly the Go philosophy of bake it all to the vcs is the right one if you aren't using lisp |
00:49:13 | skrylar[m] | part of why gtk-rs takes 30 seconds to compile hello world is it sits there deep tracing through piles of macros every single build, whereas in lisp you compile everything as you see it and macros actually get baked down as you go, so you never re-scan old macros unless you are specifically building a proc that uses it |
00:49:32 | skrylar[m] | afaik nim and rust have to suffer through the macro expansion every build, so. |
00:49:43 | disruptek | not after ic. |
00:49:59 | skrylar[m] | is that actually working now |
00:50:10 | disruptek | well, no. |
00:50:26 | * | skrylar[m] throws a paper ball at disruptek |
00:50:51 | disruptek | i'm making progress; i'm just slow. |
00:53:00 | disruptek | peak cognitive ability is reached at age 20 and goes downhill from there. |
00:53:57 | skrylar[m] | was poking around with janet and saw `make-image` was kind of interesting. loading modules just 'runs' it in to its own environment, importing then copies the symbols in to the current environment, but then `make-image` accepts an environment table and spits it out in something you can load later. which .. has the interesting bit where you can have a bunch of self-generating code that deletes itself and the image will just be |
00:53:57 | skrylar[m] | the built module :think: |
00:57:14 | skrylar[m] | i dont think i've often seen systems save the final result of loading a module.. usually they just compile that part to bytecode too |
00:58:11 | * | endragor joined #nim |
00:58:22 | disruptek | that's sorta how our backend cache works at the moment. |
00:58:35 | * | dwdv quit (Ping timeout: 250 seconds) |
00:59:06 | skrylar[m] | well if you want some nice hashing stuff, i have a working blake2{b,s} in skyhash. |
00:59:34 | skrylar[m] | they have a mode that does tree hashing |
01:00:17 | disruptek | what kinda trees? |
01:00:51 | skrylar[m] | spruce |
01:00:59 | disruptek | fair enough. |
01:01:21 | disruptek | we actually record all the mutations to a module and cache each of them individually. |
01:01:57 | skrylar[m] | it probably wouldn't help actually because you can merkle hash with just about anything, and an incremental compiler doesn't really need the height protection |
01:02:13 | skrylar[m] | i juts remember a whitepaper for one of those smart contract systems and they were using them to track memory changes |
01:02:22 | disruptek | all our doorways have been enlarged with clyybber's head. |
01:02:43 | skrylar[m] | were hashing pages and basing runtime costs on pages dirtied after a run completed |
01:02:51 | * | endragor quit (Ping timeout: 260 seconds) |
01:04:16 | disruptek | i guess that's a way to do it. |
01:04:36 | * | skrylar[m] is admittedly not a compilederp. spent most of the day reading the texbook to make the text on gui's pretty ._. |
01:05:00 | disruptek | me neither. |
01:06:20 | FromDiscord | <Elegant Beef> so a glfw function for getting the x11 window returns a pointer, to use with the xlib i need that as a TWindow, so how do I manage this? |
01:06:26 | * | chemist69 quit (Ping timeout: 246 seconds) |
01:08:36 | * | chemist69 joined #nim |
01:09:21 | skrylar[m] | ~~by using SDL~~ check if the binding you are using equates twindow with a pointer or if it does something special with it. if they're both void pointers, just cast it with dot or cast |
01:09:40 | FromDiscord | <Elegant Beef> I mean i suppose i could use sdl |
01:09:53 | FromDiscord | <Elegant Beef> When this doesnt work ill probably hop over to sdl |
01:10:15 | skrylar[m] | in all liklihood they are both pointers in the wrappers |
01:10:22 | skrylar[m] | when this happens you just cast it |
01:11:23 | skrylar[m] | then we judge whoever gave you the raw pointer type harshly |
01:12:02 | FromDiscord | <Elegant Beef> ok |
01:12:07 | skrylar[m] | (if it were instead a named pointer type like it should have been you can write a `converter` to implicitly cast it to the other type, so you can maintain some semblance of type safety) |
01:12:23 | FromDiscord | <Elegant Beef> yea just a rawdog pointer so i was scared to do anything with it π |
01:13:28 | skrylar[m] | eh then make your own getter that does the cast and gives you the right type |
01:18:12 | * | lritter quit (Ping timeout: 256 seconds) |
01:18:59 | * | lritter joined #nim |
01:19:06 | FromDiscord | <Elegant Beef> Well that doesnt seem to crash it, as much as `glinit` is |
01:22:58 | skrylar[m] | does glfw actually return a twindow |
01:23:13 | FromDiscord | <Elegant Beef> I couldnt find a twindow, it returned a pointer |
01:23:28 | FromDiscord | <Elegant Beef> Think i have a bigger issue of attempting to use imgui for my status bars |
01:24:52 | FromDiscord | <Elegant Beef> Since i dont think i can thread the rendering, and XNextEvent blocks until it gets an event |
01:27:30 | skrylar[m] | https://stackoverflow.com/questions/8592292/how-to-quit-the-blocking-of-xlibs-xnextevent :b |
01:27:45 | FromGitter | <s0kil> Could I modify an JavaScript object prototype from Nim? Even though Nim supports UFCS? |
01:28:57 | skrylar[m] | you could always use emit to force it, although nim won't be aware of it type-wise |
01:31:42 | * | endragor joined #nim |
01:38:06 | * | endragor quit (Ping timeout: 256 seconds) |
01:41:53 | * | Jjp137 joined #nim |
01:43:36 | FromGitter | <s0kil> @skrylar Could you show quick example? |
01:46:23 | leorize | ufcs doesn't affect anything? |
01:51:18 | FromDiscord | <Elegant Beef> So yea the pointer works, i have bars being drawn on my screen but the gl part isnt so need to figure out how to draw to multiple windows from 1 thread |
01:56:02 | * | krux02_ quit (Remote host closed the connection) |
01:58:40 | * | theelous3 quit (Ping timeout: 256 seconds) |
02:19:35 | * | muffindrake quit (Ping timeout: 246 seconds) |
02:21:52 | * | muffindrake joined #nim |
02:34:03 | * | endragor joined #nim |
02:35:21 | FromDiscord | <Chiqqum_Ngbata> Is there already a function in std to turn a version string into tuple[major: int, minor: int, patch: int] ? |
02:37:25 | FromDiscord | <Rika> i dont think so, no |
02:45:10 | FromDiscord | <KingDarBoja> This sounds very semver so better split and put that into a tuple |
02:46:36 | disruptek | we used to have this feature but no one used it, so it was removed. |
02:49:31 | * | dddddd quit (Ping timeout: 250 seconds) |
03:00:22 | FromDiscord | <Chiqqum_Ngbata> Just the function you mean? : ( |
03:01:03 | FromDiscord | <KingDarBoja> The good thing is that prob you can search the git history and find the proc that had the functionality |
03:01:05 | disruptek | no; lots of features were removed. |
03:01:18 | FromDiscord | <KingDarBoja> Oh yikes |
03:01:25 | FromDiscord | <Chiqqum_Ngbata> I don't need to know how to do it. I've already done it for another project, just wondering if I'm typing unnecessarily |
03:01:43 | FromDiscord | <KingDarBoja> Ah okie dokie... |
03:01:58 | FromDiscord | <Chiqqum_Ngbata> The `since` stuff wasn't removed right? |
03:05:08 | disruptek | since no one used it? |
03:08:17 | * | chemist69 quit (Ping timeout: 272 seconds) |
03:09:05 | * | chemist69 joined #nim |
03:13:17 | FromGitter | <awr1> is there a way in nim to convert a single UTF-16 character to a `Rune`? The `encodings` module seems a little heavyweight |
03:13:24 | FromGitter | <awr1> since it is string -> string |
03:15:59 | FromGitter | <awr1> i suppose MultiByteToWideChar() should be fine, and then i assume i should be able to cast it to a Rune? |
03:16:57 | FromGitter | <awr1> err |
03:16:58 | FromGitter | <awr1> WideCharToMultiByte() |
03:16:59 | FromGitter | <awr1> i mean |
03:28:53 | FromDiscord | <KingDarBoja> I am interested on what you doing awr1 |
03:29:21 | FromDiscord | <KingDarBoja> Like, trying to get a entire char like `\n` from some string is a bit messy if you ask me |
03:29:39 | disruptek | i like to read them 2-bits at a time. |
03:29:42 | FromDiscord | <KingDarBoja> And yeah, I heard unicode module is pretty heavyweight |
03:29:43 | disruptek | cleaner that way. |
03:29:51 | FromDiscord | <KingDarBoja> π€ |
03:30:17 | skrylar[m] | @ElegantBeef you have to activate the gl contexts, issue the draw calls and flush, move to next context .. |
03:31:14 | leorize | @awr1: encodings module is heavyweight because it gotta verify the formatting too |
03:31:22 | leorize | and unicode spec is nowhere near "small" |
03:31:42 | FromDiscord | <KingDarBoja> Any example ? |
03:32:02 | disruptek | yeah, but i'm not supposed to post dick pics online. |
03:32:08 | FromDiscord | <KingDarBoja> I remember Variount guidance and I ended up reading one cahr and then using a if to check if the next one was something |
03:32:12 | FromDiscord | <KingDarBoja> LOL |
03:32:27 | FromGitter | <awr1> i'm trying to get WM_CHAR messages |
03:39:09 | FromDiscord | <KingDarBoja> Win4Life |
03:47:07 | zacharycarter | job system almost working with fibers :D - https://github.com/zacharycarter/junkers |
03:47:38 | zacharycarter | ala https://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine |
03:56:24 | FromGitter | <awr1> what on earth |
03:56:36 | FromGitter | <awr1> RegisterClassEx() is giving me "The specified system semaphore name was not found." |
04:06:02 | * | supakeen quit (Quit: WeeChat 1.9.1) |
04:06:47 | * | supakeen joined #nim |
04:11:00 | * | Romanson joined #nim |
04:11:47 | skrylar[m] | hmm you can do a big chunk of unicode simply |
04:12:11 | skrylar[m] | when you get to the stuff that needs the character database though. oof. |
04:12:42 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:39:00 | lmariscal0641 | All the nim packages without submodules and as bare weights 1.39gb curious note |
04:39:56 | * | lmariscal0641 is now known as lmariscal |
04:40:09 | * | lmariscal quit (Changing host) |
04:40:09 | * | lmariscal joined #nim |
04:50:28 | FromDiscord | <Rika> ok |
04:55:04 | * | narimiran joined #nim |
04:58:41 | FromDiscord | <KingDarBoja> π§ |
04:59:30 | * | narimiran quit (Client Quit) |
05:28:47 | shashlick | @leorize - you around? |
05:33:29 | FromDiscord | <KingDarBoja> He has joined the dark side |
05:56:05 | * | zacharycarter quit (Ping timeout: 256 seconds) |
06:13:29 | * | bra-ket quit (*.net *.split) |
06:13:30 | * | nerdrat[m] quit (*.net *.split) |
06:13:31 | * | unclechu quit (*.net *.split) |
06:15:21 | * | nerdrat[m] joined #nim |
06:15:21 | * | bra-ket joined #nim |
06:18:56 | * | unclechu joined #nim |
06:21:37 | * | solitudesf joined #nim |
06:25:01 | leorize | shashlick: yea but I'm gonna sleep now |
06:25:38 | leorize | Araq: can you review this? https://github.com/nim-lang/Nim/pull/13201 |
06:25:39 | disbot | β₯ Make file descriptors from stdlib non-inheritable by default |
06:26:07 | Araq | leorize: upcoming week is PR week |
06:26:18 | leorize | sure |
06:26:28 | Araq | will review it, thanks for your patience |
06:26:35 | Araq | it looked good last time though |
06:43:23 | shashlick | Araq: does importc work on static inline functions with {.header.} |
06:45:58 | Prestige | Is there a place where all pragmas are documented? |
06:46:51 | shashlick | The manual |
06:48:11 | FromDiscord | <Gary M> so I have a weird situation with this syntax highlighting right now. Considering how procedures can be used without parentheses, how am I supposed to parse the different between procedures and variables like |
06:48:11 | FromDiscord | <Gary M> |
06:48:11 | FromDiscord | <Gary M> init addr vk |
06:48:12 | FromDiscord | <Gary M> (proc) (proc) (var) |
06:48:25 | FromDiscord | <Gary M> difference* |
06:50:13 | FromDiscord | <Gary M> it's all done with regex matching |
06:51:33 | Prestige | shashlick: they're just spread out between the different sections? I haven't found like, a list |
06:52:57 | shashlick | https://nim-lang.github.io/Nim/manual.html#pragmas |
06:53:46 | Prestige | ah I was trying the search feature on that page and didnt see it come up |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:04:52 | * | gmpreussner joined #nim |
07:27:37 | * | xcm quit (Remote host closed the connection) |
07:29:49 | * | xcm joined #nim |
07:45:42 | Prestige | leorize: What do you think about separating nim.nvim's ftdetect into different filetypes? |
07:46:32 | Prestige | I'm using PMunch's nimlsp for nim files but it throws tons of errors for nimscript, because nim.nvim sets *.nims files as a nim file |
07:46:37 | Prestige | filetype* |
07:52:19 | * | zacharycarter joined #nim |
07:56:45 | * | zacharycarter quit (Ping timeout: 250 seconds) |
08:01:55 | * | gangstacat quit (Quit: Δis!) |
08:07:41 | * | ftsf joined #nim |
08:10:26 | * | gangstacat joined #nim |
08:11:12 | * | xcm quit (Remote host closed the connection) |
08:11:50 | ftsf | hmm anyone have a simple example of how to use async httpclient? |
08:13:22 | ftsf | what does "Error: unhandled exception: No handles or timers registered in dispatcher. [ValueError]" mean? |
08:13:27 | * | xcm joined #nim |
08:13:39 | ftsf | when I call poll() |
08:16:49 | * | jds_dizzy_ joined #nim |
08:18:21 | ftsf | also, does httpclient work in the js backend? |
08:25:07 | * | jds_dizzy_ quit (Remote host closed the connection) |
08:25:36 | * | mrgaturus joined #nim |
08:29:30 | * | Hideki_ joined #nim |
08:30:23 | * | Hideki_ quit (Remote host closed the connection) |
08:30:27 | * | mrgaturus quit (Quit: Quit) |
08:34:36 | FromGitter | <jorjun_twitter> Tech I like keeps getting bought. Is nim safe? |
08:35:09 | * | Hideki_ joined #nim |
08:36:11 | * | Romanson quit (Quit: Connection closed for inactivity) |
08:36:33 | nerdrat[m] | <dom96 "nerdrat, please report this as a"> Here is the issue report on github https://github.com/dom96/choosenim/issues/194 . I'll stick with the buggy one until newer release I fixed the problem by replacing manually corrupted files. |
08:36:35 | disbot | β₯ Choosenim v0.6.0: Toolchain extraction results in corruption of vital `Nim v1.2.0` files after `choosenim update stable` ; snippet at 12https://play.nim-lang.org/#ix=2iDk |
08:41:26 | * | couven92 joined #nim |
08:50:18 | * | dwdv joined #nim |
08:54:30 | * | Hideki_ quit (Remote host closed the connection) |
08:57:07 | Araq | ftsf: pretty sure it doesn't, but see karax and friends for how to do http requests |
08:57:11 | * | Hideki_ joined #nim |
08:57:13 | * | Hideki_ quit (Remote host closed the connection) |
08:57:53 | * | Hideki_ joined #nim |
08:58:00 | * | couven92 quit (Read error: Connection reset by peer) |
08:58:23 | * | couven92 joined #nim |
08:59:57 | * | Hideki_ quit (Remote host closed the connection) |
09:00:12 | * | Hideki_ joined #nim |
09:00:13 | * | Hideki_ quit (Remote host closed the connection) |
09:00:53 | * | Hideki_ joined #nim |
09:02:39 | * | vegai joined #nim |
09:06:05 | * | Hideki_ quit (Ping timeout: 250 seconds) |
09:21:30 | * | couven92 quit (Read error: Connection reset by peer) |
09:21:56 | * | couven92 joined #nim |
09:23:22 | * | Hideki_ joined #nim |
09:35:23 | FromGitter | <alehander92> happy Easter, guys ! |
09:35:31 | Yardanico | orthodox easter you mean :P |
09:35:31 | FromGitter | <alehander92> /going back to holidaaays/ |
09:35:36 | FromGitter | <alehander92> yeah, yeah |
09:35:40 | FromGitter | <alehander92> well, almost |
09:35:43 | Yardanico | well yeah, happy easter to you too |
09:35:57 | FromGitter | <alehander92> orthodox country Easter, e.g. protestants here(like me) also celebrate it today |
09:36:02 | FromGitter | <alehander92> thank you |
09:36:19 | FromGitter | <alehander92> russian brothers :P :) as people love to say |
09:36:24 | * | dddddd joined #nim |
09:39:37 | supakeen | @alehander92: Happy paskha :) |
09:39:57 | Yardanico | supakeen: are you slavic too? :P |
09:40:26 | supakeen | No, but at my church there's a bunch of people from those areas :) |
09:41:00 | Yardanico | oh guess I only got 3 more chapters to finish before my first Lox interpreter implementation (as in the book) will be completed |
09:41:50 | FromGitter | <alehander92> supakeen is it an OCA church? |
09:41:56 | FromGitter | <alehander92> happy paskha to you :) |
09:42:57 | supakeen | @alehander92: It's an English speaking catholic church in the Netherlands so it combines people from a lot of communities who have come here. It's not eastern orthodox :) |
09:43:48 | FromGitter | <alehander92> cool! its interesting that some of our catholics(using the eastern rite) also celebrate today IIRC |
09:44:13 | supakeen | You celebrate with the community! |
09:45:19 | FromGitter | <alehander92> exactly :) |
09:45:52 | supakeen | Not that we really can right now normally there used to be big celebrations for easter a few weeks back but with all the lockdowns it's all on-line. |
09:47:26 | FromGitter | <alehander92> here the orthodox churches are still open iirc but with big restrictions |
09:48:50 | FromGitter | <alehander92> but our lockdown overally is not so severe i think, mostly almost no intercity travel and no going to parks + masks outside, but you can still walk on the streets |
09:51:45 | FromGitter | <jorjun_twitter> Anyone can assist with an enum problem I have? https://pastebin.com/Y8mncarL |
09:52:34 | * | zacharycarter joined #nim |
09:53:33 | Yardanico | https://play.nim-lang.org/#ix=2iDQ ? |
09:54:04 | * | hax-scramper quit (Read error: Connection reset by peer) |
09:54:04 | Yardanico | actually "echo numeral" will work just fine too |
09:54:12 | Yardanico | on line 16 |
09:54:24 | Yardanico | but on line 20 your $ was applied to numeral.repeat, not to numeral |
09:54:54 | Yardanico | echo calls $ for everything that's passed to it by default |
09:54:54 | * | hax-scramper joined #nim |
09:55:58 | FromGitter | <jorjun_twitter> Aha, I tried brackets, like this but no joy: $(numeral).repeat n_repeat |
09:56:07 | Yardanico | that would still apply to numeral.repeat |
09:56:41 | FromDiscord | <Chiqqum_Ngbata> Has anyone seen custom stream implementation? |
09:56:43 | FromGitter | <jorjun_twitter> ($numeral).repeat n_repeat boom. Thanks so much |
09:56:46 | * | zacharycarter quit (Ping timeout: 256 seconds) |
10:14:51 | * | Hideki_ quit (Remote host closed the connection) |
10:18:24 | * | liblq-dev joined #nim |
10:37:16 | * | endragor quit (Remote host closed the connection) |
10:42:39 | * | natrys joined #nim |
10:51:13 | * | Hideki_ joined #nim |
10:51:15 | * | Vladar joined #nim |
10:55:00 | * | couven92 quit (Read error: Connection reset by peer) |
10:55:24 | * | couven92 joined #nim |
11:00:48 | * | theelous3 joined #nim |
11:10:30 | dom96 | nerdrat[m], your issue implies that you've used choosenim 0.4.0 previously and that it worked, is that correct? Can I assume that this issue does not happen with 0.4.0? |
11:11:25 | dom96 | ftsf, can you show us your code? That usually means there is nothing for the async loop to do, i.e. nothing is pending. |
11:12:05 | * | xcm is now known as Guest5856 |
11:12:05 | * | Guest5856 quit (Killed (weber.freenode.net (Nickname regained by services))) |
11:13:55 | * | xcm joined #nim |
11:15:49 | * | Hideki_ quit (Ping timeout: 264 seconds) |
11:16:16 | * | Hideki_ joined #nim |
11:18:37 | FromDiscord | <__ibrahim__> noob question: can i just throw the generated C code into wasm and expect it to work? |
11:20:53 | FromGitter | <sealmove> is there a range limitation for enums? |
11:22:32 | * | dwdv quit (Quit: quit) |
11:23:32 | * | couven92 quit (Read error: Connection reset by peer) |
11:23:58 | * | couven92 joined #nim |
11:25:06 | FromGitter | <sealmove> I get: β fatal.nim(49) sysFatal β Error: unhandled exception: over- or underflow [OverflowError] |
11:25:19 | FromGitter | <sealmove> when trying to use large values for enums |
11:25:54 | FromGitter | <sealmove> example: β β ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e9c3542c7dcfc14e2cefa53] |
11:26:26 | * | zacharycarter joined #nim |
11:26:46 | * | couven92 quit (Read error: Connection reset by peer) |
11:27:13 | * | konvertex joined #nim |
11:27:13 | * | couven92 joined #nim |
11:28:13 | * | Hideki_ quit (Remote host closed the connection) |
11:29:07 | * | Hideki_ joined #nim |
11:33:14 | * | Hideki_ quit (Ping timeout: 240 seconds) |
11:33:22 | * | krux02 joined #nim |
11:46:15 | * | Hideki_ joined #nim |
11:50:56 | FromGitter | <Yardanico> 9223372036854775806 works fine |
11:58:53 | Amun_Ra | hmm, is it me or FileStream's setPosition does not support whence |
12:00:23 | Yardanico | Amun_Ra: wdym "whence"? setPosition for "Stream" in general doesn't support specifying "from" or maybe I misunderstood you |
12:00:33 | Yardanico | with setPosition you set the current positition in the stream |
12:01:21 | Amun_Ra | Yardanico: I wouldn't expect set/cur/end in a Stream but it's FileStream |
12:01:30 | Yardanico | so? |
12:01:38 | Yardanico | FileStream *is* Stream |
12:01:41 | Yardanico | Stream is basically an interface |
12:02:43 | Amun_Ra | hmm, I have to switch to File and implement my own readUints |
12:02:57 | Yardanico | I really can't understand the problem you're having, sorry |
12:03:20 | Yardanico | readUint will work just fine for FileStream |
12:04:11 | Amun_Ra | I need to set position X bytes from the end and read the structure from there |
12:06:01 | * | supakeen quit (Quit: WeeChat 1.9.1) |
12:06:39 | * | supakeen joined #nim |
12:07:40 | * | Guest91062 quit (Ping timeout: 256 seconds) |
12:09:06 | * | dadada joined #nim |
12:09:25 | FromGitter | <zacharycarter> you can do that with a stream |
12:09:29 | * | dadada is now known as Guest8592 |
12:09:40 | FromGitter | <zacharycarter> https://nim-lang.org/docs/streams.html#setPosition%2CStream%2Cint |
12:11:03 | Amun_Ra | I can't operate on absolute values |
12:12:14 | Amun_Ra | perhaps I'll just add file size to function prototypes |
12:22:58 | * | Hideki_ quit (Remote host closed the connection) |
12:23:31 | * | Hideki_ joined #nim |
12:27:16 | FromGitter | <sealmove> @Yardanico any idea why it doesn't work for high(int64) == 9223372036854775807? |
12:28:05 | * | Hideki_ quit (Ping timeout: 258 seconds) |
12:34:03 | * | Hideki_ joined #nim |
12:44:23 | FromGitter | <sealmove> seems like a bug |
12:44:42 | FromGitter | <sealmove> or at least undocumented implementation limitation |
12:44:44 | Yardanico | do you really need an enum value of int64 though? :P |
12:45:29 | FromGitter | <sealmove> yes, I need to make it work in the general case, because I am making parsers and this value could exist in some file |
12:46:03 | Araq | this is not much of an "enumeration" |
12:46:03 | FromGitter | <sealmove> so I have tests in place for testing even these edge cases, and my tests fail right now :3 |
12:46:11 | Araq | it's a distinct int. |
12:46:41 | FromGitter | <sealmove> Araq I know, initially I modeled it as distinct int, but I want these nice Nim enum features like exhausting coverage :3 |
12:46:55 | FromGitter | <sealmove> exhaustive* |
12:50:40 | FromGitter | <sealmove> except enums, does any other construct offer exhaustive coverage? how about sets? |
12:51:35 | Araq | well you can overload the 'case' statement these days but yeah, only enums really offer it |
12:53:21 | FromGitter | <sealmove> Araq, if I overload `case` for my distinct int, this will work? |
12:53:56 | Araq | hopefully |
12:54:25 | FromGitter | <sealmove> And could I have an insight on why int(64) doesn't work with enums? Just curious. |
12:54:49 | FromGitter | <sealmove> `high(int64)` I mean |
12:54:56 | Araq | compiler bug, fix it |
12:55:04 | FromGitter | <sealmove> okay, got it |
12:55:40 | Araq | many of these bugs are actually more conscious than many think. |
12:56:10 | FromGitter | <sealmove> I can imagine it can be an implementation decision |
12:56:31 | Araq | I'm aware of overflows but keep thinking "nobody will ever stumble upon this" |
12:56:59 | Araq | I'm usually wrong :-) |
12:57:06 | FromGitter | <sealmove> haha |
12:58:50 | Araq | https://github.com/nim-lang/Nim/pull/14008#issuecomment-615879473 anyhow vote please |
12:58:52 | disbot | β₯ enummaps: library based generalized typesafe enum with holes ; snippet at 12https://play.nim-lang.org/#ix=2iER |
13:01:34 | * | Hideki_ quit (Remote host closed the connection) |
13:02:10 | * | Hideki_ joined #nim |
13:04:32 | federico3 | Araq: +1 on stability. Perhaps a issue label to track ideas for Nim 2.0? |
13:05:32 | FromGitter | <sealmove> I agree with federico3 |
13:06:02 | Araq | yeah good idea. as I said before, the current plan is to grow/fix Nim and then in a couple of years focus on the cleanups in a 2.0 release |
13:06:48 | * | Hideki_ quit (Ping timeout: 258 seconds) |
13:14:41 | FromGitter | <sealmove> btw is there a pragma to disable exhaustive coverage? |
13:15:03 | Yardanico | else: discard |
13:15:22 | Yardanico | assuming you have a case statement :) |
13:15:52 | FromGitter | <sealmove> yeah I know about this, but when generating code and you don't know whether you have covered all cases or not, you can either get error like "not all case covered" or "all cases covered but found `else: discard`" |
13:16:29 | FromGitter | <sealmove> well, if there isn't, I can use `if` instead of `case` of course. |
13:16:47 | Yardanico | do a macro or a template? |
13:17:06 | Yardanico | also there's compiles() in system |
13:17:18 | * | xcm quit (Read error: Connection reset by peer) |
13:18:25 | FromGitter | <sealmove> Sadly I am not generating code with Nim X_X. Anyway I will use an `if` |
13:19:21 | Yardanico | even if you're not generating it with nim you can still insert a compiles() call |
13:19:54 | * | xcm joined #nim |
13:20:52 | FromGitter | <sealmove> Is this nice though? I prefer to have an if instead of case than inserting a compiles() call |
13:21:30 | FromGitter | <sealmove> but really, we could have a pragma for example called {.dirtyCase.} if it's not hard to add |
13:24:01 | * | Hideki_ joined #nim |
13:25:36 | federico3 | was there an httpserver in Nim at some point? |
13:26:28 | Yardanico | you mean a stdlib module? idk |
13:26:32 | ftsf | nimhttpd ? |
13:27:10 | ftsf | @dom96, yeah there's nothing pending, is there a way for poll to do nothing without error if there's no jobs? |
13:27:15 | federico3 | nimhttpd serves only files from disk (pretty useless!) |
13:27:33 | ftsf | federico3, what do you want it to serve? |
13:27:42 | supakeen | I mean there's the asynchttpserver module which you can use to build one, or did you mean a built in one to server... what exactly? :) |
13:28:00 | dom96 | ftsf, there is a function that tells you this, hasPendingOperations or something, take a look in asyncdispatch |
13:28:08 | federico3 | the same as asynchttpserver from the stdlib but without the async |
13:28:09 | ftsf | federico3, i'm using jester to serve stuff via nim |
13:28:23 | dom96 | federico3, yeah, there was httpserver |
13:28:24 | ftsf | @dom96, thanks |
13:29:36 | * | filcuc joined #nim |
13:30:38 | * | jjido joined #nim |
13:32:15 | * | xcm quit (Remote host closed the connection) |
13:34:26 | * | xcm joined #nim |
13:44:58 | FromGitter | <sealmove> Guys what do you think? https://github.com/nim-lang/Nim/issues/14019 |
13:44:58 | disbot | β₯ Add pragma for disabling enforced exhaustive case coverage |
13:50:10 | * | dddddd_ joined #nim |
13:51:37 | FromDiscord | <Chiqqum_Ngbata> The exhaustive coverage hasn't been an big issue for me so far. I'd lean toward not adding things but maybe this is a bigger pain in your kaitai stuff? |
13:52:09 | FromDiscord | <Chiqqum_Ngbata> Now I forgot what I came here to ask... |
13:53:01 | * | dddddd quit (Ping timeout: 264 seconds) |
13:55:56 | FromGitter | <sealmove> sorry for that :3 |
13:59:44 | FromGitter | <sealmove> Yes, it would help me a with my implementation. Of course this is an edge case so it's not an important feature. I don't know what's the policy regarding pragmas. Maybe we don't introduce pragmas that are subject to abuse? If this is not a concern though, and if it's easy to add, then I don't see any other problems with introducing it. |
14:04:04 | * | Hideki_ quit (Remote host closed the connection) |
14:04:39 | * | Hideki_ joined #nim |
14:15:29 | * | Hideki_ quit (Ping timeout: 265 seconds) |
14:17:30 | * | dddddd_ is now known as dddddd |
14:22:12 | FromDiscord | <Chiqqum_Ngbata> Is it possible to configure nimble post-install task? |
14:25:32 | * | couven92 quit (Read error: Connection reset by peer) |
14:25:58 | * | couven92 joined #nim |
14:30:54 | * | Hideki_ joined #nim |
14:32:00 | * | couven92 quit (Read error: Connection reset by peer) |
14:32:09 | * | Hideki_ quit (Remote host closed the connection) |
14:32:25 | * | couven92 joined #nim |
14:35:00 | * | couven92 quit (Read error: Connection reset by peer) |
14:35:27 | * | couven92 joined #nim |
14:38:30 | * | couven92 quit (Read error: Connection reset by peer) |
14:38:57 | * | couven92 joined #nim |
14:39:51 | * | Hideki_ joined #nim |
14:39:54 | * | Hideki_ quit (Remote host closed the connection) |
14:40:28 | * | Hideki_ joined #nim |
14:41:52 | * | bra-ket quit (Remote host closed the connection) |
14:42:09 | * | bra-ket joined #nim |
14:44:47 | * | Hideki_ quit (Ping timeout: 256 seconds) |
14:51:12 | disruptek | make the pragma, show its use, create an RFC to add it to stdlib. |
14:51:22 | disruptek | simple. |
14:54:50 | * | theelous3 quit (Read error: Connection reset by peer) |
14:55:30 | * | couven92 quit (Read error: Connection reset by peer) |
14:55:58 | * | couven92 joined #nim |
14:59:30 | * | couven92 quit (Read error: Connection reset by peer) |
14:59:53 | * | couven92 joined #nim |
15:00:00 | disruptek | ~stream |
15:00:01 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek |
15:00:08 | disruptek | persistent storage macro. |
15:12:32 | * | couven92 quit (Read error: Connection reset by peer) |
15:12:57 | * | couven92 joined #nim |
15:14:50 | * | lritter quit (Ping timeout: 258 seconds) |
15:15:30 | * | couven92 quit (Read error: Connection reset by peer) |
15:15:53 | * | couven92 joined #nim |
15:23:00 | leorize | Prestige: to be fair we should fix nimsuggest so that it can work with nimscript :P |
15:28:00 | * | couven92 quit (Read error: Connection reset by peer) |
15:28:23 | * | couven92 joined #nim |
15:29:30 | * | couven92 quit (Read error: Connection reset by peer) |
15:29:53 | * | couven92 joined #nim |
15:30:13 | * | ftsf quit (Ping timeout: 264 seconds) |
15:32:58 | * | nsf joined #nim |
15:35:13 | * | axion quit (Quit: WeeChat 2.8) |
15:35:51 | * | Guest8592 is now known as dadada |
15:36:55 | * | liblq-dev quit (Ping timeout: 256 seconds) |
15:40:54 | * | zacharycarter quit (Ping timeout: 258 seconds) |
15:46:09 | * | waleee-cl joined #nim |
15:46:49 | * | Hideki_ joined #nim |
15:56:31 | * | Hexeratops joined #nim |
16:02:24 | * | axion_ joined #nim |
16:03:43 | * | axion_ quit (Client Quit) |
16:11:11 | * | Hideki_ quit (Ping timeout: 250 seconds) |
16:11:49 | * | xcm quit (Remote host closed the connection) |
16:14:05 | * | xcm joined #nim |
16:19:29 | * | liblq-dev joined #nim |
16:23:03 | * | couven92 quit (Read error: Connection reset by peer) |
16:23:28 | * | couven92 joined #nim |
16:23:45 | livcd | i am also watching |
16:28:35 | federico3 | most nim packages age like fish |
16:29:51 | * | natrys quit (Ping timeout: 265 seconds) |
16:30:31 | * | zacharycarter joined #nim |
16:33:28 | * | Vladar quit (Quit: Leaving) |
16:35:28 | * | natrys joined #nim |
16:36:11 | livcd | they rot away? |
16:36:19 | federico3 | yep |
16:36:37 | federico3 | how can expose a variable defined in a template to another template nested inside its body? |
16:37:53 | * | Trustable joined #nim |
16:39:17 | * | inv2004 joined #nim |
16:39:29 | inv2004 | Good Sunday of quarantine! |
16:40:21 | inv2004 | Few days ago I asked about problem with UncheckedArray, I spent some time trying to reproduce and found that for simple structure it works perfect, but for more complicate structure with unions it does not work |
16:41:14 | inv2004 | I created an example (I removed all bycopy because I am not if it is necessary or not here, but it does not change behavior): https://github.com/inv2004/test_nim_c |
16:41:50 | inv2004 | .. I am not sure if the is ... |
16:45:30 | * | couven92 quit (Read error: Connection reset by peer) |
16:45:54 | * | couven92 joined #nim |
16:53:34 | * | sigmapie8 joined #nim |
16:54:09 | leorize | inv2004: you should always add `bycopy` when interfacing with C |
16:54:25 | shashlick | http://ix.io/2iGU/nim is the output from nimterop |
16:55:19 | inv2004 | leorize, I had it - problem was the same. Let me convert it to the link from shashlick |
16:55:55 | leorize | yea, but a tip is that you should always have it when building C wrappers |
16:56:18 | leorize | the pragma is to prevent Nim from doing optimizations (ie. pass by reference) |
16:59:40 | zacharycarter | are custom allocators supported in --gc:arc? |
17:00:22 | livcd | federico3: that's one of the biggest issues i think. That packages break too often as Nim develops further. Winim is broken with every release :D |
17:01:04 | * | abm joined #nim |
17:01:41 | leorize | zacharycarter: IIRC it was removed |
17:02:35 | federico3 | livcd: that and the general quality and debuggability |
17:03:02 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
17:03:47 | zacharycarter | leorize: gotcha |
17:05:30 | * | couven92 quit (Read error: Connection reset by peer) |
17:05:55 | * | couven92 joined #nim |
17:06:02 | * | Lord_Nightmare joined #nim |
17:13:41 | FromDiscord | <EdgyNerd> https://play.nim-lang.org/#ix=2iH5 how can I speed up this Pi program, it's currently taking around double the time of a similar crystal program (5000 digits takes 3.2s |
17:13:49 | FromDiscord | <EdgyNerd> https://play.nim-lang.org/#ix=2iH5 how can I speed up this Pi program, it's currently taking around double the time of a similar crystal program (5000 digits takes 3.2s in Nim, 1.7 in crystal) |
17:14:05 | Araq | zacharycarter, it got removed because the destructors feature is about how you can implement your own seqs and containers |
17:14:16 | Yardanico | @EdgyNerd how are you compiling it and can you show the crystal source? also please don't edit messages on discord |
17:14:17 | Araq | and when you do, you get to choose the allocator |
17:15:16 | Yardanico | I just tested and with -d:danger it took me 300ms on 5000 digits |
17:15:33 | FromDiscord | <EdgyNerd> what does `-d:danger` do? |
17:15:48 | Araq | EdgyNerd: also put the code inside a 'main' proc |
17:16:09 | Yardanico | @EdgyNerd -d:release is the release mode, and -d:danger implies -d:release but disables various runtime checks |
17:16:26 | Yardanico | It's 600ms for me with -d:release |
17:17:05 | FromDiscord | <EdgyNerd> ah ok |
17:17:35 | Yardanico | if you compile like "nim c file.nim" you're compiling in debug mode with every possible check enabled |
17:18:35 | FromDiscord | <EdgyNerd> oh ok |
17:18:55 | Yardanico | also check if you're compilng crystal code in release mode :) |
17:19:11 | FromDiscord | <EdgyNerd> yeah I was, I just didn't find the flag in Nim |
17:19:46 | FromDiscord | <EdgyNerd> it's still taking 2.5 seconds even in danger mode, how long does it take for you to run the 'debug' mode? |
17:19:58 | FromDiscord | <EdgyNerd> it's still taking 2.5 seconds even in danger mode, how long does it take for you to run the debug mode? |
17:20:01 | FromDiscord | <Yardanico> What's your Nim version by the way? |
17:20:18 | FromDiscord | <EdgyNerd> latest I think |
17:20:37 | FromDiscord | <Yardanico> What's the time if you try with -d:release ? |
17:20:48 | leorize | nim --version for the version number |
17:20:51 | FromDiscord | <EdgyNerd> oh my version is 1.2.0 |
17:20:53 | FromDiscord | <EdgyNerd> is that latest? |
17:20:56 | leorize | yep |
17:20:57 | FromDiscord | <Yardanico> Yeah |
17:21:13 | FromDiscord | <Yardanico> "nim c -d:release file.nim" |
17:22:06 | FromDiscord | <EdgyNerd> 2.6 seconds with -d:release |
17:22:09 | leorize | how are you measuring the time? |
17:22:16 | Prestige | leorize: good point, didn't know if it was an appropriate issue to open on your repo. I still think nimlsp would have to know about different filetypes, no? |
17:22:17 | leorize | it ran in less than one second here |
17:22:37 | livcd | TotalMilliseconds : 58.0343 |
17:22:37 | livcd | here |
17:22:54 | FromDiscord | <EdgyNerd> the unix time thing (time ./pi) |
17:22:59 | leorize | Prestige: my repo is not a nimsuggest bug tracker :P |
17:23:05 | * | sigmapie8 quit (Quit: Leaving) |
17:23:11 | leorize | β― bash -c 'time ./test' |
17:23:13 | leorize | 3141592653 |
17:23:15 | leorize | real 0m0.001s |
17:23:17 | leorize | user 0m0.001s |
17:23:19 | leorize | sys 0m0.001s |
17:23:23 | FromDiscord | <EdgyNerd> set the digits to 5000 |
17:23:27 | FromDiscord | <Yardanico> Leorize - change DIGITS to 5000 |
17:23:28 | Prestige | Yeah I meant as setting a different file type for .nims leorize |
17:24:22 | FromDiscord | <EdgyNerd> (also if digits is set to 5000 you might wanna comment out the stdout line since it has a lot of output) |
17:24:57 | Yardanico | well it just takes 600ms with -d:release and 300ms with -d:danger for me |
17:25:07 | Yardanico | I'm checking with fish's "time" built-in command |
17:25:07 | leorize | 2s here :P |
17:25:17 | leorize | oh fish have `time` now |
17:25:31 | Yardanico | well I have 3700X but single-core it's not the best CPU |
17:25:42 | livcd | 2.3s here |
17:26:33 | FromDiscord | <EdgyNerd> actually my time is basically exactly 2s |
17:26:49 | leorize | can we have the crystal version too? |
17:26:54 | Yardanico | in debug mode I get 2.22 seconds |
17:26:58 | FromDiscord | <EdgyNerd> oh yeah |
17:27:00 | FromDiscord | <EdgyNerd> https://pastebin.com/9uLPq1Xu |
17:27:31 | FromDiscord | <EdgyNerd> (ignore the part at the end, it's a special case I was too lazy to implement in Nim, and only affects about 1/30 digits) |
17:28:01 | Yardanico | the code seems different though? |
17:28:02 | leorize | ah int vs int32 |
17:28:45 | Yardanico | leorize: that doesn't make any difference for me really |
17:28:46 | FromDiscord | <EdgyNerd> the code is basically the same except I used until loops instead of for loops |
17:29:19 | FromDiscord | <EdgyNerd> yeah changing the int size doesn't really do anything |
17:29:24 | FromDiscord | <EdgyNerd> (to the time) |
17:30:55 | * | inv2004 quit (Ping timeout: 258 seconds) |
17:31:20 | leorize | the crystal code is a bit better structured |
17:31:25 | Yardanico | @EdgyNerd but really I wouldn't suggest you to compare on microbenchmarks :) |
17:31:27 | Yardanico | I |
17:31:31 | leorize | I'm gonna clean up the nim one and see what can I improve |
17:31:32 | Yardanico | I'll try with crystal 0.34 on my PC |
17:31:39 | Yardanico | that seems to be the latest |
17:32:36 | Yardanico | well Crystal version takes 640ms for me too lol |
17:32:59 | livcd | int32 brings it down to 1.5s for me |
17:33:19 | Yardanico | (nim with -d:release is around the same and nim with -d:danger is ~300ms) |
17:33:38 | leorize | Yardanico: big cpu perks :P |
17:33:55 | leorize | I'm doing this on a weak intel |
17:34:18 | Yardanico | maybe LLVM does a better job at optimizing stuff than GCC? can you try with clang? |
17:34:23 | Yardanico | on your CPUs I mean |
17:35:55 | leorize | lol the nim code is not the same as the crystal one |
17:36:04 | leorize | we miss an iteration for our for loops |
17:36:13 | Yardanico | actually it's the other way :P |
17:36:20 | Yardanico | with crystal I get "741326047" at the end |
17:36:28 | Yardanico | with nim "7413260472" |
17:36:37 | Yardanico | but it's only 1 digit difference |
17:36:43 | * | jjido quit (Quit: Vision[0.10.3]: i've been blurred!) |
17:36:43 | leorize | I'm talking about the code :P |
17:37:53 | FromDiscord | <EdgyNerd> what's different about it? |
17:37:56 | * | someunknownuser joined #nim |
17:38:04 | leorize | you used `..<` |
17:38:27 | zacharycarter | is there any alternative of codegenDecl for types? |
17:38:29 | Yardanico | @EdgyNerd basically can you try compiling the nim program with clang (I hope it's installed on your machine) |
17:38:30 | leorize | which is `..` but stop before the end point |
17:38:39 | zacharycarter | I want to specify the aligned attribute for a type I'm defining in Nim |
17:38:39 | Yardanico | nim c --cc:clang -d:release file.nim |
17:39:52 | FromDiscord | <EdgyNerd> clang doesn't speed it up at all |
17:40:23 | FromDiscord | <EdgyNerd> also: the reason I used `..<` is because I based the crystal and Nim programs off of this python program |
17:40:24 | FromDiscord | <EdgyNerd> https://pastebin.com/NqYE796H |
17:40:36 | FromDiscord | <EdgyNerd> (python ranges work the same as `..<`) |
17:40:40 | Yardanico | well then I don't really know, it might depend on your CPU or something, as I said I get same speeds - 600ms - with crystal ("crystal build tt.cr --release") and "nim c -d:release file.nim" and I get 300ms with -d:danger instead of -d:release |
17:41:12 | Yardanico | @EdgyNerd they don't though |
17:41:27 | Yardanico | ah they do sorry I misunderstood |
17:41:50 | FromDiscord | <EdgyNerd> it's weird that for you Nim is double as fast, whereas for me Nim is 2 seconds and crystal is 1.7s |
17:42:20 | FromDiscord | <EdgyNerd> I guess it could be based on the CPU (my laptop has a pretty awful CPU) |
17:43:25 | * | tane joined #nim |
17:44:52 | FromDiscord | <Yardanico> Also just for fun info the Nim compiled binary (after strip -s) is 80kb, while it's 320kb for Crystal :P |
17:45:34 | FromDiscord | <EdgyNerd> haha |
17:46:28 | FromDiscord | <EdgyNerd> I wasn't really trying to compare them, I was just confused why Crystal was so much faster than Nim (because I didn't realise about -d:release and -d:danger) |
17:46:52 | leorize | hmm, does crystal array start at 1 lol |
17:47:51 | FromDiscord | <EdgyNerd> nope they start at 0 |
17:48:04 | leorize | I read the loop in correctly :P |
17:48:09 | leorize | incorrectly* |
17:49:33 | FromDiscord | <EdgyNerd> I've tried Nim and Crystal and I'm probably gonna stick with Nim (mainly because it's syntax is more similar to python, and it looks like it has a more active community) |
17:50:34 | FromDiscord | <Recruit_main707> yeah, this comunnity is small, but they are very helpful and active |
17:51:35 | FromDiscord | <Yardanico> Also by the way if you want some number crunching (and matrix and more) stuff - https://github.com/mratsim/Arraymancer and https://github.com/mratsim/weave |
17:53:45 | FromDiscord | <EdgyNerd> "Compile with -d:release -d:danger to get the same performance as in 0.19.x" why both? |
17:54:07 | * | inv2004 joined #nim |
17:54:07 | leorize | you don't need both |
17:54:34 | * | dddddd quit (Ping timeout: 240 seconds) |
17:54:55 | leorize | @EdgyNerd: http://ix.io/2iHC/nim |
17:55:00 | leorize | complete port from python |
17:55:03 | leorize | 1.72 secs |
17:55:09 | FromDiscord | <Yardanico> @EdgyNerd that was fixed in 1.2 |
17:55:27 | FromDiscord | <Yardanico> -d:danger is supposed to imply -d:release but it didn't got some time |
17:55:32 | FromDiscord | <Yardanico> *for |
17:58:57 | * | couven92 quit (Read error: Connection reset by peer) |
17:58:58 | leorize | -d:danger on my port and it's 1.57s :P |
17:59:23 | * | couven92 joined #nim |
17:59:35 | leorize | -d:release --gc:arc and it's 1.58s |
17:59:45 | leorize | so as fast as -d:danger without being dangerous |
18:01:28 | * | couven92 quit (Client Quit) |
18:10:24 | FromDiscord | <EdgyNerd> what does --gc:arc do? |
18:10:33 | Yardanico | switched to ARC memory management model |
18:10:42 | skrylar[m] | i have never used crystal and i am more a rubyist than a pythonist, but nim works |
18:10:52 | Yardanico | https://forum.nim-lang.org/t/5734 some info about arc |
18:11:15 | skrylar[m] | now if only the reset password button on the forum worked :headbandage: |
18:11:33 | Yardanico | skrylar[m]: ask dom96 :P |
18:11:45 | leorize | we really need more reliable forum software :P |
18:12:02 | Yardanico | as 4raq would say: go fix nimforum |
18:12:02 | Yardanico | :D |
18:12:53 | FromDiscord | <KingDarBoja> Hi guys |
18:17:25 | FromDiscord | <such father that father not> Hey! |
18:19:46 | FromDiscord | <KingDarBoja> Welcome! |
18:30:49 | * | zacharycarter quit (Ping timeout: 264 seconds) |
18:33:26 | FromGitter | <sealmove> guys, since we have a working Kaitai Struct back-end now, I started work here: https://github.com/sealmove/kaitai_struct_forensics |
18:40:52 | * | hax-scramper quit (Ping timeout: 256 seconds) |
18:43:01 | FromDiscord | <__ibrahim__> hello, can someone explain to me why my silly code gives SIGSEV? |
18:43:01 | FromDiscord | <__ibrahim__> https://pastebin.com/fN25W3wD |
18:43:13 | Yardanico | you forgot to initialize Test in newTest |
18:43:20 | * | uvegbot joined #nim |
18:43:47 | FromDiscord | <__ibrahim__> wow that was fast, thanks Yardanico |
18:44:24 | Yardanico | https://play.nim-lang.org/#ix=2iI3 |
18:44:31 | Yardanico | both newTest and newTest2 will work |
18:45:21 | * | bra-ket quit (Ping timeout: 265 seconds) |
18:45:43 | FromDiscord | <__ibrahim__> i guess this also works |
18:45:43 | FromDiscord | <__ibrahim__> https://play.nim-lang.org/#ix=2iI4 |
18:46:16 | FromDiscord | <__ibrahim__> thanks Yardanico |
18:46:59 | Yardanico | yeah in your case newTest works because Nim assumes that that the last expression (not statement) in a proc is a return value |
18:47:42 | FromDiscord | <__ibrahim__> true, nice feature |
18:48:48 | FromDiscord | <__ibrahim__> how would you implement template specialisation on a type? using enums? |
18:48:55 | Yardanico | wdym? |
18:49:18 | FromDiscord | <__ibrahim__> say i have a component that can be a transform component or a render component or a physics component |
18:52:40 | Araq | maybe via 'typedesc[T]' overloading, not sure tho |
18:59:09 | FromDiscord | <__ibrahim__> Thanks Araq! i will check that out for sure! |
18:59:09 | FromDiscord | <__ibrahim__> Here is a sample C++ code: |
18:59:09 | FromDiscord | <__ibrahim__> https://pastebin.com/x1fWkTCh |
18:59:41 | FromDiscord | <__ibrahim__> kinda lost between programming paradigms, should i go oop? or meta-programming? |
19:00:24 | FromDiscord | <__ibrahim__> kinda lost between programming paradigms, should i go oop? or meta-programming dsl? |
19:00:34 | disruptek | oop is dead. |
19:00:58 | FromDiscord | <Recruit_main707> tell that to python stats :P |
19:01:19 | * | nsf quit (Quit: WeeChat 2.8) |
19:01:39 | FromDiscord | <__ibrahim__> i really like Nim's metaprogramming into declarative dsl |
19:02:47 | FromDiscord | <__ibrahim__> trying to learn how to do things i usually do in cpp |
19:06:28 | FromDiscord | <__ibrahim__> okay i guess this needs macros |
19:07:58 | skrylar[m] | Yardanico: i've been bothering him to fix it about once a month now |
19:08:48 | disruptek | sealmove: how did you make kaitai work? |
19:09:22 | skrylar[m] | i dont have the same resentment to objects and still do object-based stuff in nim, i just think people might have missed what oop was about while they were badly copying it out of clos/st-80 |
19:11:10 | * | NimBot joined #nim |
19:11:45 | FromDiscord | <__ibrahim__> dod seems to be the new rage in game dev |
19:11:47 | FromDiscord | <KingDarBoja> _oop is dead._ wut |
19:12:34 | FromDiscord | <KingDarBoja> I have never heard of DOD to be honest |
19:12:44 | FromDiscord | <__ibrahim__> data oriented design |
19:13:17 | FromDiscord | <__ibrahim__> something about optimising the way data is loaded to the L1 cache of the CPU to minimise cache misses that you would otherwise have in OOP |
19:14:05 | FromDiscord | <__ibrahim__> unity's new data oriented tech stack/ entity component system is based on |
19:14:27 | FromDiscord | <__ibrahim__> structs of arrays vs arrays of structs |
19:14:47 | FromDiscord | <__ibrahim__> that's about as much as i can explain it :p |
19:19:44 | * | Tyresc joined #nim |
19:28:26 | FromDiscord | <KingDarBoja> I see |
19:28:59 | FromDiscord | <KingDarBoja> Not an expert on the topic but must be a good approach as a quick google search shows several applications on game dev |
19:31:43 | FromDiscord | <__ibrahim__> Mike Acton's talk about dod from a c++ perspective is interesting |
19:34:21 | Araq | DoD is nice but in practice cumbersome to work with |
19:34:51 | disruptek | should be easier to make it ergonomic in nim. |
19:35:02 | * | Irregulator joined #nim |
19:35:12 | Araq | indeed, we should have a DSL for it |
19:35:45 | Araq | I designed one once but my employer wasn't willing to pay for it |
19:36:10 | Araq | and I have no need for it since I don't write games :-) |
19:36:16 | * | Irregulator quit (Client Quit) |
19:36:36 | FromDiscord | <__ibrahim__> too bad for him xD |
19:37:07 | disruptek | what bugs me is that so much of these problems feel like things we had solutions for decades ago. we're already too old or too young; doomed to repeat history. |
19:37:20 | * | Intensity quit (Read error: Connection reset by peer) |
19:37:56 | liblq-dev | Eh. new weird patterns that in reality are just unnecessary microoptimizations. at least for (relatively) simple 2D games like the ones I make |
19:38:57 | disruptek | i'm thinking more of optimizations that shouldn't need to exist if the design wasn't perpetrated by a novice in the first place. |
19:38:57 | FromDiscord | <__ibrahim__> If you have alot of 3d rendered entities, they make a great difference. else, no need. |
19:39:23 | disruptek | computers are fast. we made them slow. |
19:40:06 | * | Intensity joined #nim |
19:40:06 | * | kungtotte quit (Read error: Connection reset by peer) |
19:40:19 | FromDiscord | <__ibrahim__> well, dod is the answer to oop's "slowness" i guess |
19:40:32 | FromDiscord | <__ibrahim__> since entity/component is oop style |
19:40:45 | liblq-dev | but oop isn't *that* slow if you know how to use it |
19:40:57 | * | kungtotte joined #nim |
19:40:58 | liblq-dev | ie. not have millions of subclasses each contributing to bloat |
19:41:14 | disruptek | they are designing for the lowest common denominator. |
19:42:31 | FromDiscord | <__ibrahim__> https://www.youtube.com/watch?v=0_Byw9UMn9g |
19:42:31 | FromDiscord | <__ibrahim__> interesting talk about oop vs dod, talks about "millions of subclasses" issue |
19:43:59 | FromDiscord | <__ibrahim__> nim dod dsl would be something amazing :D declarative game programming |
19:44:36 | leorize | liblq-dev: the "mainstream" languages shepherd people into subclassing like hell :P |
19:44:49 | FromDiscord | <KingDarBoja> My brain hurts while trying to differentiate all those paradigms |
19:44:59 | liblq-dev | leorize: true |
19:45:14 | FromDiscord | <KingDarBoja> OOP vs Functional, Composition vs Inheritance, etc |
19:45:21 | leorize | I don't really care about paradigms anymore |
19:45:27 | leorize | I write whatever that fits |
19:45:29 | FromDiscord | <KingDarBoja> leorize is right |
19:45:29 | disruptek | i have a bug in nimph that i'm not how to handle. |
19:45:36 | disruptek | not sure, rather. |
19:45:36 | liblq-dev | leorize: same here |
19:46:04 | FromDiscord | <KingDarBoja> Mainstream languagesare pretty focused into OOP (and few functional examples) |
19:46:12 | nerdrat[m] | dom96: Let me do some tests with 0.4.0 because I didn't install the nim-1.2.0 toolchain with choosenim 0.4.0. I updated choosenim first and then I installed Nim. |
19:46:15 | FromDiscord | <__ibrahim__> i think nim has the most interesting paradigm i have ever seen, making a dsl using metaprogramming to program at a higher level |
19:46:39 | leorize[m] | nim is multi-paradigm |
19:46:42 | leorize[m] | why focus on one when you can do all? |
19:46:58 | FromDiscord | <__ibrahim__> https://www.youtube.com/watch?v=JO0iqGDgFqA |
19:47:11 | FromDiscord | <__ibrahim__> really cool demo by krux02 |
19:47:16 | FromDiscord | <KingDarBoja> That explains why OOP is minimal here |
19:47:37 | FromDiscord | <KingDarBoja> But glad to see how it can be used in multiple paradigms |
19:47:44 | leorize[m] | we take what works, then get rid of the rest |
19:48:07 | leorize[m] | that's how programming should work imo |
19:48:43 | FromDiscord | <__ibrahim__> it's cool that it is multi-paradigm , which led me to some confusion to pick which paradigm to go with, after some research i learned about many paradigms and im still thinking how i should approach building a simple 2d engine in nim. |
19:49:07 | leorize[m] | don't build an engine, build a game |
19:49:15 | leorize[m] | then you will know how to build an engine |
19:49:34 | disruptek | this. |
19:49:37 | FromDiscord | <KingDarBoja> Shouldn't it be the other way? |
19:49:39 | * | abm quit (Read error: Connection reset by peer) |
19:49:39 | FromDiscord | <__ibrahim__> it's cool that it is multi-paradigm , which led me to some confusion to pick which paradigm to go with, after some research i learned about many paradigms and im still thinking how i should approach building a simple 2d engine in nim. |
19:50:00 | FromDiscord | <__ibrahim__> whoops i deleted my comment and repasted it, didn't mean t spam sorry |
19:50:01 | leorize[m] | imo the problem with toy engine is that a lot of people don't even know how a game work and/or what it needs |
19:50:06 | FromDiscord | <KingDarBoja> RIP IRC people |
19:50:47 | Araq | DOD is also mostly a workaround for badly implemented prefetcher that doesn't understand memory strides |
19:50:56 | FromDiscord | <KingDarBoja> https://miro.medium.com/max/3632/1*wS8DsmEejvsswkQjNA-BoQ.png |
19:50:56 | leorize[m] | so if you wanna build something generalized, you gotta know the specifics first |
19:51:02 | FromDiscord | <KingDarBoja> Oh god, why I googled it |
19:51:16 | Araq | not sure why they don't just fix the hardware but apparently it's hard |
19:51:45 | FromDiscord | <__ibrahim__> i dont care to build something generalised at all, i just want to build a simple game. |
19:52:10 | leorize[m] | then build the game |
19:52:24 | leorize[m] | an engine is the game without the game part in it :P |
19:53:29 | FromDiscord | <__ibrahim__> lol epic advice, but i come from an oop background, and i want to write idiomatic nim ( at least as best i can ) |
19:53:53 | FromDiscord | <__ibrahim__> i guess idiomatic nim is procedural metaprogramming |
19:54:30 | leorize[m] | idiomatic nim is "whatever that works" |
19:54:40 | FromDiscord | <KingDarBoja> lol really? |
19:54:46 | disruptek | nah. |
19:54:58 | leorize[m] | I'm outta words :P |
19:55:10 | leorize[m] | well we try to use as little advanced features as possible |
19:55:15 | FromDiscord | <EdgyNerd> how would I manually compile the C source files that Nim produces? (is there just a simple gcc command I can use) |
19:55:23 | leorize[m] | only use them when it's needed |
19:55:34 | disruptek | gcc works. |
19:55:35 | leorize[m] | @EdgyNerd: pass --genScript to the compiler |
19:55:57 | leorize[m] | it'll generate a script with the commands needed to build your project |
19:56:11 | leorize[m] | the script will be in your nimcache though, so you might want to move it elsewhere with `--nimcache` |
19:56:30 | FromDiscord | <__ibrahim__> thank you leorize |
19:59:01 | FromDiscord | <EdgyNerd> "it'll generate a script with the commands needed to build your project" where are the commands? |
19:59:20 | leorize[m] | check your nimcache |
19:59:29 | leorize[m] | there will be a script inside it |
19:59:43 | FromDiscord | <EdgyNerd> oh yeah I missed 'compile_pi.sh' |
20:00:07 | dom96 | nerdrat[m], thank you :) |
20:03:23 | leorize | anyone knows how to use `{.multisync.}`? |
20:04:27 | dom96 | sure |
20:05:03 | leorize | so how do I use it? :P |
20:05:07 | leorize | what should my return type be? |
20:08:32 | * | Hideki_ joined #nim |
20:09:24 | FromDiscord | <KingDarBoja> OMG just finished another test round and now a previous tests is failing lol |
20:09:47 | FromDiscord | <KingDarBoja> I hate when that happens x.x |
20:13:25 | * | Hideki_ quit (Ping timeout: 264 seconds) |
20:18:30 | dom96 | leorize: take a look at the stdlib for examples |
20:25:51 | FromDiscord | <mratsim> What is DOD? |
20:29:25 | inv2004 | shashlick, I just copied all bycopy from your link and commited, but nothing really changed. structure was ~ the same before |
20:29:43 | inv2004 | https://github.com/inv2004/test_nim_c/blob/master/c.nim#L9 |
20:30:00 | inv2004 | and it is the same "Illegal storage access." |
20:30:34 | inv2004 | ah, except that I replaced your array[1, cuchar] with arr*: UncheckedArray[S] |
20:30:51 | inv2004 | UncheckedArray[SS] |
20:31:17 | * | azed joined #nim |
20:31:20 | inv2004 | I did the same for S-struct and it worked fine |
20:39:38 | leorize | inv2004: the sizes of the arrays where different |
20:39:46 | leorize | in the C code they are `unsigned char` |
20:40:01 | leorize | but you use a `pointer` here for nim code |
20:40:36 | inv2004 | leorize, I have the same for S-struct, which works fine. the arr is just offset for allocated array of pointers |
20:41:18 | inv2004 | that is why I suppose it is not important for C is it is char array of something else |
20:44:17 | inv2004 | I compile the code with nim only (not nimble) - where can I find generated .c file? I see it in nimcache for nimble projects only - strange |
20:44:35 | disruptek | set your --nimcache:/some/where |
20:45:33 | * | rockcavera quit (Remote host closed the connection) |
20:45:55 | inv2004 | thx |
20:45:57 | * | rockcavera joined #nim |
20:46:07 | Yardanico | inv2004: ~/.cache/nim |
20:47:55 | leorize | inv2004: yea the char is the problem |
20:48:21 | inv2004 | hm, hm, should I cast it then? why it works for S ? |
20:48:36 | leorize | http://ix.io/2iJ5 |
20:48:46 | leorize | this is probably due to the C compiler attempting to align the struct |
20:50:28 | inv2004 | It works! thank you! |
20:51:44 | inv2004 | another question - how bycopy works? If I have 1000Gb of data in one array - will it copy it every access? or will it make deep copy (not, because it is byte right now I think) |
20:53:27 | leorize | `{.bycopy.}` means pass to parameters like C does |
20:54:42 | leorize | in Nim, if an object has a size > 3 * sizeof(float), it will be passed to functions as reference (ie. proc(o: BigObj) -> void(BigObj* o)) as an optimization |
20:55:05 | leorize | since we're dealing with C, that pragma forces Nim to not do this kind of optimization |
20:55:29 | inv2004 | interesting, thank you |
20:55:59 | * | krux02 quit (Remote host closed the connection) |
20:56:25 | inv2004 | another question: if I have the ptr object - does it mean that GC do not care about it? |
20:56:31 | leorize | yea |
20:56:52 | Prestige | Is there a way to get a string representation of a const's name (at compile time)? I don't think there is but I'm trying to avoid potentially "extra" work |
20:57:06 | leorize | astToStr() |
20:57:28 | leorize | it can convert any ast into a string |
20:57:30 | inv2004 | what can I do with it? in my lib which defines the S and SS structure - I have some kind of reference-counter to clear the structure - can I link it somehow with nim? |
20:57:42 | inv2004 | ... with nim's GC |
20:57:42 | Prestige | leorize: thanks |
20:58:11 | leorize | inv2004: you can't, however we do have a destructors system that you can exploit to link it to Nim |
20:58:25 | leorize | inv2004: https://nim-lang.org/docs/destructors.html |
20:59:24 | leorize | wrap your pointer in an object with one field (there won't be any overhead), then define `=`, `=destroy` and `=sink` for it |
20:59:43 | leorize | `=` should be mappable to `inc_ref()` |
20:59:50 | leorize | `=destroy` to `dec_ref()` |
20:59:58 | leorize | and `=sink` should just copy the pointer over |
21:00:08 | inv2004 | Perfect, thank you! |
21:03:07 | leorize | so from this: https://stackoverflow.com/questions/5435841/memory-alignment-in-c-structs |
21:03:26 | leorize | it appears that you should always wrap structs as-is |
21:04:29 | leorize | as C compilers are allowed to add paddings however they like |
21:06:14 | * | someunknownuser quit (Quit: someunknownuser) |
21:07:13 | inv2004 | ok, so the two structs does not match, got it |
21:08:09 | inv2004 | I have an idea, probably (original idea for the chat) to rewrite everything in nim, and just to pass .addr to C sometimes - I should not cafe about GC or anything else |
21:08:34 | inv2004 | cafe = care . Looks like I need better keyboard :( |
21:08:47 | * | tane quit (Quit: Leaving) |
21:08:55 | leorize | it does work |
21:09:16 | leorize | you can expose Nim's reference tracking to C also |
21:10:57 | leorize | then you should make the struct opaque and use getter/setter procs to access it from C |
21:13:09 | inv2004 | Yep, have to think about it |
21:14:49 | FromDiscord | <exelotl> How do I publish docs for my library? Do I run `nim doc` and then manually copy the result into a gh-pages branch? |
21:15:13 | leorize | yea |
21:15:19 | disruptek | nim doc --project --outdir=docs some.nim |
21:15:21 | leorize | there's `nim doc --project` |
21:15:30 | leorize | oh that works too |
21:16:24 | Prestige | is there a way to have `when defined` statements in a table declaration to selectively initialize it with certain entries? |
21:16:31 | disruptek | sure. |
21:18:38 | FromDiscord | <exelotl> what does --project do? |
21:18:54 | Prestige | this is what I'm trying to do: https://0x0.st/i112.png |
21:18:56 | FromDiscord | <exelotl> I don't see the difference compared to just running nim doc |
21:19:25 | leorize | it recursively generates documentation for all modules in the project iirc |
21:19:55 | FromDiscord | <exelotl> oh wow, so it does! |
21:20:12 | FromDiscord | <exelotl> that's epic, I can delete my script to do that now. π
|
21:28:04 | FromGitter | <lolgab> Hi everyone :) β Do you know a way to attach a pipe to an external process started with `startProcess` to a file descriptor different from `stdin`, `stdout` or `stderr`? I want to read what the process writes to fd `3` |
21:28:28 | leorize | sorry, that's not here yet |
21:28:58 | leorize | for now you gotta do plain old fork()-setup-exec() |
21:29:31 | FromGitter | <lolgab> No workarounds like attaching to the underlying process or something available? |
21:29:41 | FromGitter | <lolgab> I tried but didn't achieve anything |
21:29:42 | FromDiscord | <Recruit_main707> lolgab: that sounds to dll injection ;) |
21:30:22 | leorize | lolgab: setup a pipe then forward it as fd 3 to the target process? |
21:30:24 | * | arecaceae quit (Remote host closed the connection) |
21:30:32 | * | solitudesf quit (Ping timeout: 256 seconds) |
21:30:50 | * | arecaceae joined #nim |
21:31:07 | FromDiscord | <Recruit_main707> the file descriptors in other processes |
21:31:38 | FromGitter | <lolgab> I want to implement a proxy of a protocol similar to this one: https://github.com/apache/openwhisk/blob/master/docs/actions-actionloop.md#implementing-the-actionloop-protocol |
21:32:23 | FromGitter | <lolgab> > setup a pipe then forward it as fd 3 to the target process? β β Yes, something like that.. I have to try deeper |
21:32:54 | leorize | posix_spawn should simplify the process |
21:34:15 | FromGitter | <lolgab> Thank you, I'll try with `posix_spawn` |
21:41:50 | * | natrys quit (Quit: natrys) |
21:43:01 | Prestige | Is there a way I could do this at compile time with an immutable map, or is this the best I'll get? https://play.nim-lang.org/#ix=2iJv |
21:43:34 | disruptek | you can use a ct const table. |
21:44:11 | leorize | Prestige: you can just... import all of them |
21:45:15 | Prestige | you mean just not bothering with `when defined` and having them all exist? |
21:45:21 | leorize | yea |
21:45:32 | Prestige | hm I suppose so |
21:47:05 | disruptek | a .compileTime. var is immutable, fwiw. |
21:47:16 | disruptek | sad but true. |
21:47:30 | Prestige | disruptek: what is a ct const table? |
21:47:40 | disruptek | tables can be consts. |
21:48:06 | Prestige | if I do that here using when defined, I thought I'd get an error for adding more elements |
21:48:45 | disruptek | const someTab = when foo: {...} else: {...} |
21:50:42 | Prestige | ahh perfect, thanks |
21:51:31 | Prestige | actually maybe not if multiple things could be defined and added to the map |
21:51:43 | disruptek | .compileTime. then. |
21:52:27 | disruptek | or just define the contents as consts and then add them all at once. |
21:53:58 | * | azed quit (Quit: WeeChat 2.7.1) |
21:55:18 | FromDiscord | <Elegant Beef> prestige what is that for? |
21:55:48 | Prestige | reading a user config file and getting the keysyms from the names |
21:56:23 | FromDiscord | <Elegant Beef> Xlib can convert string to keysym, which then can convert to keycode |
21:57:03 | Prestige | Yeah, I'm wanting to have some custom names though |
21:57:16 | Prestige | like just using "c" instead of "XK_c" |
21:58:08 | FromDiscord | <Elegant Beef> I mean |
21:58:08 | FromDiscord | <Elegant Beef> https://hatebin.com/jiydsehajg |
21:58:14 | FromDiscord | <Elegant Beef> That's from my config loader |
21:58:16 | FromDiscord | <EdgyNerd> is there a way to get arbituary precision floats in Nim? |
21:58:31 | FromDiscord | <Elegant Beef> It's hardcoded right now, but it will support loading chars |
21:58:40 | leorize | !repo decimal |
21:58:41 | disbot | https://github.com/Sud0nim/Decimal -- 9Decimal: 11A big/arbitrary precision Decimal class in pure Nim 15 23β 0π΄ 7& 1 more... |
21:58:49 | leorize | !repo nim-decimal |
21:58:50 | disbot | https://github.com/Sud0nim/Decimal -- 9Decimal: 11A big/arbitrary precision Decimal class in pure Nim 15 23β 0π΄ 7& 1 more... |
21:58:51 | Prestige | Elegant Beef: You can just pass in "d" and it will auto convert to XK_d? |
21:59:11 | leorize | !repo status-im/nim-decimal |
21:59:11 | disbot | https://github.com/status-im/nim-decimal -- 9nim-decimal: 11A correctly-rounded arbitrary precision decimal floating point arithmetic library 15 12β 3π΄ |
21:59:12 | FromDiscord | <Elegant Beef> I mean that works so when i hit mod4 + d it opens rofi |
21:59:20 | Prestige | interesting |
21:59:23 | Prestige | thanks |
21:59:36 | * | dddddd joined #nim |
21:59:54 | FromDiscord | <Elegant Beef> My WM is actually mostly functional |
21:59:58 | leorize | @EdgyNerd: ^ use nim-decimal |
22:00:12 | FromDiscord | <KingDarBoja> How can I convert a parent type to a child type? |
22:00:21 | FromDiscord | <KingDarBoja> Just curious, seems like I can do the opposite |
22:00:41 | FromDiscord | <Elegant Beef> `Child(parent)` is i think the standard, or `cast[Child](parent)` |
22:00:47 | FromDiscord | <Elegant Beef> But im a numpty in nim so π |
22:00:55 | FromDiscord | <KingDarBoja> The child(parent) didn't worked |
22:00:58 | FromDiscord | <KingDarBoja> Let me try the cast |
22:01:15 | FromDiscord | <KingDarBoja> As the first one yields `Invalid object conversion [ObjectConversionError]` |
22:01:16 | leorize | Child(parent) work if it's a ref object |
22:01:25 | FromDiscord | <KingDarBoja> Both are ref objects π€ |
22:01:32 | leorize | inherited? |
22:01:38 | FromDiscord | <EdgyNerd> actually how do I download/use libraries in Nim? |
22:01:42 | FromDiscord | <KingDarBoja> Ye |
22:01:45 | FromDiscord | <Elegant Beef> Nimble |
22:01:52 | leorize | you either use nimble or nimph |
22:01:53 | FromDiscord | <Elegant Beef> then import module/name |
22:02:26 | leorize | @KingDarBoja: make sure you check it with `if obj of Child` before doing the `cast` then |
22:02:36 | FromDiscord | <Elegant Beef> so currently prestige im stuck at drawing status bars for monitors, and having workspaces |
22:03:10 | FromDiscord | <KingDarBoja> Hold on, sharing a screenshot |
22:03:23 | FromDiscord | <KingDarBoja> I am doing it at the newMyType proc of the child type |
22:03:33 | FromDiscord | <Elegant Beef> I've tried multiple things to unmap and remap but it seems unmapping causes the window to bork |
22:03:57 | leorize | @KingDarBoja: I can see why it didn't work now :P |
22:04:44 | FromDiscord | <KingDarBoja> :'v |
22:05:32 | FromDiscord | <KingDarBoja> https://imgur.com/gE4jB2w |
22:05:38 | FromDiscord | <KingDarBoja> Left child, right parent |
22:06:08 | leorize | yea you can't do that |
22:06:52 | leorize | but... couldn't a variant object work here? |
22:07:34 | leorize | well but I guess exceptions are built on inheritance |
22:07:36 | FromDiscord | <Elegant Beef> Is there an OOP environment where that'd be allowed? Cause im fairly certain C# wouldnt allow that either |
22:07:52 | leorize | python would allow it |
22:08:11 | FromDiscord | <Elegant Beef> Yea but python also allows you to cry while coding |
22:08:13 | FromDiscord | <Elegant Beef> So that's a low bar π |
22:08:30 | FromDiscord | <KingDarBoja> Python |
22:08:35 | shashlick | @leorize - question from last night - does importc work on static inline functions with {.header.} |
22:09:06 | shashlick | I'd think so since the header is being pulled in with the nim code during compile so it should work |
22:09:07 | FromDiscord | <KingDarBoja> https://imgur.com/JXlbRPl |
22:09:13 | FromDiscord | <KingDarBoja> Sauce from Python |
22:09:17 | leorize | KingDarBoja: anyhow, create an `init` proc for GraphQLError |
22:09:33 | FromDiscord | <KingDarBoja> It has one already, it is new |
22:09:45 | shashlick | It won't work with dynlib, depends if compiler stripped it out |
22:09:45 | FromDiscord | <KingDarBoja> Cuz it must be a ref or I will not be allowed to raise it |
22:09:52 | leorize | KingDarBoja: no, an init that take a GraphQLError |
22:10:05 | leorize | shashlick: `static` functions are limited to the file that contains it |
22:10:12 | leorize | you can't link against them |
22:10:33 | leorize | for standalone headers: translate them to Nim |
22:10:43 | leorize | for non-standalone, use `{.header.}` and it should work |
22:10:56 | * | FromDiscord <KingDarBoja> Scratching my head |
22:11:13 | shashlick | But that's why I'm saying if Nim importc has header pragma, the header gets included during compile time |
22:11:16 | FromDiscord | <KingDarBoja> But why a init if I have a new already, (GraphQLError is a ref) |
22:11:26 | FromDiscord | <KingDarBoja> Or maybe I don't get the idea? |
22:11:28 | shashlick | Other cases its no go |
22:12:04 | leorize | yep, that's why I said you gotta translate that function to Nim in non-{.header.} case |
22:12:47 | leorize | @KingDarBoja: well we don't usually use exceptions for this kind of errors |
22:13:02 | FromDiscord | <KingDarBoja> π€ so? |
22:13:03 | * | inv2004 quit (Quit: Leaving) |
22:13:13 | Prestige | Elegant Beef: Thanks for sharing that, going to make my life a lot easier lol |
22:13:49 | leorize | but here's how this can be done: make an `init(g: GraphQLError) = g.field = "foo" <- basically a helper setup proc like this` |
22:14:35 | leorize | then in your inherited object, do this `new result; init(result); <do your child object setup here>` |
22:14:56 | FromDiscord | <Elegant Beef> Check out my loadconfig in config.nim and goodwm.nim's setup procs to see more how im handling |
22:15:40 | FromDiscord | <Elegant Beef> I have a system for hardcoded events and user defined commands |
22:16:18 | Prestige | only thing I need to do it add modifiers and I should be good |
22:18:19 | leorize | @KingDarBoja: ping just in case you didn't see the above |
22:18:30 | FromDiscord | <KingDarBoja> Looking at it |
22:18:46 | shashlick | so that's the thing - why would anyone expect to share static inline procs as an API if the header isn't supposed to be available |
22:19:11 | FromDiscord | <KingDarBoja> So the init "helper" proc should just return the GraphQLError type so I can use it on my inherited obj, rigth? |
22:19:54 | shashlick | as a C lib writer, if I am using static inline and expect my user to use those procs, I will be giving them the header |
22:19:56 | leorize | the helper proc take a GraphQLError, then set the needed fields |
22:20:03 | FromDiscord | <KingDarBoja> Right |
22:20:05 | shashlick | so I don't see the point in converting them into pure Nim |
22:20:41 | leorize | static inline procs are like macros, but with better syntax and semantics |
22:21:25 | Prestige | Elegant Beef - how would you add/load a modifier key from a string (like shift)? |
22:21:40 | FromDiscord | <Elegant Beef> I mean i'd have a map for modifiers |
22:21:47 | FromDiscord | <Elegant Beef> there's only like 8 of them afterall |
22:22:07 | leorize | shashlick: you can try to convert them, but if you can't just bail and tell the user to either enable `{.header.}` or override it with their own hand written version |
22:22:36 | shashlick | so my logic is that nimterop is all about wrapping headers at build time, which means the header is right there |
22:23:05 | leorize | yea but there are users that want to use nimterop to generate standalone headers, no? |
22:23:19 | shashlick | creating wrappers that don't need the header anymore might be a legitimate use case no doubt |
22:23:38 | shashlick | but I don't think it is realistic for large wrappers |
22:24:02 | leorize | worst case, just import the proc verbatim to the wrapper with `{.emit.}` |
22:24:08 | shashlick | cause people do all sorts of platform, compiler and package detection at build time |
22:24:22 | shashlick | I tried to explain my rationale in the latest nimterop readme in the why nimterop section |
22:24:34 | shashlick | I know 4raq doesn't agree with it but that's my experience so far |
22:25:00 | leorize | 4raq wants a tool that can generate platform-agnostic wrapper |
22:25:04 | leorize | your tool is not that :P |
22:25:27 | leorize | so just ignore him, focus on the use case that your tool targets |
22:25:40 | shashlick | I don't believe that's possible without reimplementing everything configure/cmake and preprocessor does in Nim |
22:25:43 | leorize | to be fair I think nimterop is not something anyone should use to generate generic wrappers |
22:26:03 | shashlick | that's not going to be my goal - I've explained that in the readme now |
22:26:19 | shashlick | please take a read and let me know your feedback |
22:26:21 | leorize | for simple stuff, like sdl2 or kmod this can be done |
22:26:27 | leorize | since they're not a maze of configurations |
22:27:06 | leorize | but for more "configurable" ones like openssl, yea it's impossible |
22:27:28 | * | Tyresc quit (Quit: WeeChat 2.9-dev) |
22:28:05 | shashlick | basically stuff like this issue - https://github.com/nim-lang/zip/issues/39 |
22:28:08 | disbot | β₯ ZlibStreamError due to size mismatch of data types (Linux) ; snippet at 12https://play.nim-lang.org/#ix=2iJQ |
22:29:04 | shashlick | call me lazy but I don't want to reimplement all that #ifdef in Nim because then it is my responsibility for the user to pass all the #defines for that specific platform/compiler/package combo to the nim wrapper so that it renders the right thing at compile time |
22:29:44 | shashlick | so I'm willing to toss this `static inline` stuff also into the same bucket, even though we could wrap it into pure Nim |
22:30:01 | shashlick | another - call me lazy - classification |
22:30:12 | shashlick | just want to make sure I'm not missing something, hence the questions and explanations |
22:30:32 | shashlick | I'll consider the {.emit.} thing later for non {.header.} cases |
22:32:26 | FromDiscord | <KingDarBoja> leorize: got it, thanks |
22:32:34 | FromDiscord | <KingDarBoja> It seemed messy but that works lol |
22:36:24 | FromDiscord | <KingDarBoja> https://imgur.com/b8pXb5l |
22:37:19 | leorize | that's not how I meant it to be... |
22:37:25 | * | chemist69 quit (Ping timeout: 272 seconds) |
22:37:49 | * | chemist69 joined #nim |
22:38:53 | FromDiscord | <KingDarBoja> Uhhh? |
22:41:55 | leorize | https://play.nim-lang.org/#ix=2iJT |
22:42:30 | leorize | it's a pattern in Nim for exceptions to be object type and not ref object |
22:42:48 | * | couven92 joined #nim |
22:47:22 | dom96 | it's a historical defect ;) |
22:49:38 | leorize | the lack of documentation for asyncdispatch is annoying... |
22:53:39 | * | inv2004 joined #nim |
22:55:17 | dom96 | leorize: I agree, can you help us improve it? :) |
22:55:30 | FromDiscord | <KingDarBoja> Impressive, never expected such approach |
22:55:43 | leorize | dom96: I'm still trying to make sense of how to do things lol |
22:56:05 | FromDiscord | <KingDarBoja> Darn leo, you are pretty good at this β€οΈ |
22:56:19 | dom96 | leorize: feel free to ask questions |
22:57:24 | leorize | I'm still unsure whether to use FutureVar or FutureStream |
22:57:43 | leorize | the use case is to read data from a pipe |
22:57:50 | inv2004 | leorize, my previous example works, but I moved everything to real lib and found that struct in totally misaligned, but on another fields. Do it mean than my definition of nim-struct is not correct (but looks it is ok) . Or are there any way to align my nim-struct to match C ? |
22:59:01 | leorize | yea your definition might not be correct |
22:59:13 | leorize | if you can share the C and Nim definition I might be able to figure out why |
22:59:15 | inv2004 | ok, let me recheck |
22:59:17 | dom96 | leorize: what's the pipe implemented as? |
22:59:21 | dom96 | is it an async pipe? |
22:59:33 | leorize | both |
22:59:39 | leorize | but yea for this it's an asyncpipe |
23:00:06 | inv2004 | @leorize, How do you check it? I just printed all offsetof in C and nim |
23:00:22 | leorize | inv2004: manual inspection and experience :P |
23:00:22 | dom96 | leorize: not sure why you'd need either then |
23:00:34 | inv2004 | @leorize, ah, I do not have it, ok :) |
23:01:06 | dom96 | You're presumably reading from the pipe and then writing it somewhere else? let data = await pipe.read(1024); await foo.send(data) |
23:02:11 | leorize | that's an use case |
23:02:24 | inv2004 | heh, looks like I have a bit :) probably found a bug in c2nim |
23:03:11 | inv2004 | typedef char*S,C - S is char*, but C is char. looks like how it is in C, but c2nim set cstring for C |
23:03:32 | leorize | dom96: the other one could be that you wanna parse something and you start trickle data in from the pipe |
23:04:03 | leorize | hmm actually I can implement both lol |
23:04:22 | dom96 | You only need FutureStream if you're offering an API for someone else to consume streaming data |
23:04:46 | dom96 | It seems you already have a streaming API with the pipe |
23:04:50 | leorize | I got kinda confused when I saw asyncfile.readToStream :P |
23:08:49 | inv2004 | should I try to send PR to c2nim or it is outdated already? I remember previous struct was generated by something else |
23:09:59 | leorize | sure, make a PR to c2nim |
23:10:06 | shashlick | Please fix it if you can |
23:10:41 | inv2004 | shashlick, but you generated it by something else |
23:10:55 | leorize | the other tool is not a c2nim replacement :) |
23:11:56 | shashlick | Nimterop |
23:12:43 | inv2004 | thx, too late to ask the difference :) |
23:15:51 | FromDiscord | <KingDarBoja> Hey leo, looking at the example |
23:16:02 | * | inv2004 quit (Quit: Leaving) |
23:16:10 | FromDiscord | <KingDarBoja> Does that means that all my setup stuff for the base error shoul be on init call instead of new, right? |
23:16:27 | leorize | yea |
23:16:43 | FromDiscord | <KingDarBoja> Okie Dokie |
23:16:48 | FromDiscord | <KingDarBoja> Makes sense |
23:16:54 | leorize | on another note, EINTR is horrifying in so many levels |
23:18:29 | FromDiscord | <KingDarBoja> Ok moved all setup of base error into init with it's parameters |
23:18:53 | FromDiscord | <KingDarBoja> But now the `newError` proc is asking for those |
23:19:32 | leorize | uhmmm, just forward all the parameters to init? |
23:20:07 | FromDiscord | <KingDarBoja> .-. |
23:20:56 | FromDiscord | <KingDarBoja> wdym |
23:21:07 | leorize | now i'm not sure what you mean |
23:21:45 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2iK7 |
23:21:50 | FromDiscord | <KingDarBoja> Check init of `Error` |
23:22:02 | FromDiscord | <KingDarBoja> -> missing parameter: param1 |
23:22:08 | FromDiscord | <KingDarBoja> this is what I mean |
23:23:56 | leorize | https://play.nim-lang.org/#ix=2iK8 <- like that? |
23:24:56 | FromDiscord | <KingDarBoja> π€ |
23:26:17 | FromDiscord | <KingDarBoja> That looks like a mess with more params IMO |
23:27:56 | leorize | well it's not like you'll need it for every param |
23:28:21 | leorize | your newGraphQLSyntaxError already got less param than newGraphQLError |
23:30:52 | * | Faulander_ joined #nim |
23:32:16 | FromDiscord | <KingDarBoja> π€ |
23:32:30 | * | Faulander quit (Read error: Connection reset by peer) |
23:33:06 | * | liblq-dev quit (Quit: WeeChat 2.7.1) |
23:43:26 | FromDiscord | <KingDarBoja> Ok, now it works |
23:45:48 | FromDiscord | <KingDarBoja> The only thing that bother me is having the same proc arguments for the parent error |
23:45:55 | FromDiscord | <KingDarBoja> On the init and newError call |
23:50:44 | * | Trustable quit (Remote host closed the connection) |
23:52:11 | leorize | then maybe instead of so many arguments you should try to see if it can be derived from some state object? |
23:55:43 | * | konvertex quit (Ping timeout: 250 seconds) |
23:56:12 | FromDiscord | <KingDarBoja> Nah |
23:56:32 | FromDiscord | <KingDarBoja> Or wait, not sure what you mean |
23:57:56 | leorize | it's a parser, right? then you can probably derive most of the data in the parsing error from the parser state? |
23:58:14 | leorize | but then I'm not sure how your parser even work :P |
23:59:06 | FromDiscord | <KingDarBoja> I do prefer it like it is right now, I don't have issue with the duplicated arguments on both init and new call |
23:59:41 | FromDiscord | <KingDarBoja> Still nice idea |
23:59:59 | FromDiscord | <KingDarBoja> Didn't know about the Exception being handled like that |