00:00:10 | * | miragearchitect quit (Ping timeout: 268 seconds) |
00:00:20 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/issues/19041#issuecomment-962548645 |
00:00:49 | arkanoid | Elegantbeef: surprisingly, the silly benchmark output shows that GCC is faster than tcc here |
00:09:09 | arkanoid | well, by comparing min/max, seems that tcc is faster in compilation (a lot faster for -d:release) but generates much slower executables, which makes sense in the context of scripting |
00:19:34 | FromDiscord | <takemichihanagaki3129> When should I use `typedesc[T]` instead of `T` properly? |
00:23:08 | arkanoid | Elegantbeef, I've posted the results gcc vs tcc |
00:23:29 | FromDiscord | <Elegantbeef> When you want a type instead of an instance |
00:25:14 | FromDiscord | <Elegantbeef> Uh huh |
00:27:06 | arkanoid | takemichihanagaki3129: with `proc(foo: T)` you pass a foo that is an instance of type T, with `proc(foo: typedesc[T])` you pass a foo that is a T (like float, string, bool, MyObject, ecc) |
00:30:56 | arkanoid | I'm still quite not convinced of the difference between `nim r` and `nimcr` |
00:31:09 | FromDiscord | <takemichihanagaki3129> In reply to @arkanoid "<@890300313729400832>: with `proc(foo: T)`": Strange...↵My LSP is giving me a strange error msg, saying that I should use `typedesc`, but in my case I need a instance of `T`, not `T` itself. |
00:32:35 | arkanoid | takemichihanagaki3129: LSP may be wrong, can you share a small example that replicates the hint? I can look at it with nimlsp |
00:33:31 | FromDiscord | <takemichihanagaki3129> sent a code paste, see https://paste.rs/ct2x6 |
00:34:48 | FromDiscord | <takemichihanagaki3129> sent a code paste, see https://play.nim-lang.org/#ix=4McO |
00:35:58 | FromDiscord | <Elegantbeef> Is the compiler giving you an error? |
00:35:59 | FromDiscord | <Elegantbeef> If not, restart the LSP, if it's still broken, pray for better tooling |
00:36:04 | FromDiscord | <Elegantbeef> is `VErrorKind` the enum field or type? |
00:36:05 | FromDiscord | <Elegantbeef> What does the compiler actually say |
00:48:24 | FromDiscord | <takemichihanagaki3129> In reply to @Elegantbeef "is `VErrorKind` the enum": Type |
00:48:26 | arkanoid | whoa, "nimcr + tcc" is so much faster than "nim r + tcc" |
00:48:36 | FromDiscord | <takemichihanagaki3129> In reply to @Elegantbeef "What does the compiler": Let me have a look |
00:48:53 | FromDiscord | <takemichihanagaki3129> In reply to @Elegantbeef "If not, restart the": Sure! I'll try nimsuggest, so. |
00:49:22 | FromDiscord | <takemichihanagaki3129> (edit) "look" => "look.↵I was trying to fix this right now, so I made some changes since that message." |
01:19:32 | arkanoid | takemichihanagaki3129: could you please rewrite https://play.nim-lang.org/#ix=4McO in a way we can understand the involved types? |
01:21:33 | FromDiscord | <takemichihanagaki3129> In reply to @arkanoid "<@890300313729400832>: could you please": I'm finally starting to understand what I've done wrong here.↵But thanks for your availability. 😉 |
01:21:46 | arkanoid | no problem |
01:23:40 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4McW |
01:41:40 | * | jmdaemon joined #nim |
01:48:44 | * | beholders_eye quit (Ping timeout: 252 seconds) |
03:32:23 | * | edr quit (Quit: Leaving) |
03:56:05 | * | miragearchitect joined #nim |
04:22:05 | * | miragearchitect quit (Quit: Quit) |
04:23:23 | * | miragearchitect joined #nim |
04:24:19 | * | miragearchitect quit (Client Quit) |
04:28:32 | * | rockcavera quit (Remote host closed the connection) |
05:14:15 | FromDiscord | <michaelb.eth> sent a long message, see http://ix.io/4Mdd |
05:33:53 | FromDiscord | <Elegantbeef> Did you inline the formatter? @michaelb.eth |
05:34:24 | FromDiscord | <michaelb.eth> no |
05:34:55 | FromDiscord | <Elegantbeef> Did you compile wiht lto? |
05:34:59 | FromDiscord | <michaelb.eth> yes |
05:36:19 | FromDiscord | <Elegantbeef> I can only imagine that changing the logic caused the optimiser to change how it did it, unless you have a min repro 😄 |
05:41:47 | FromDiscord | <michaelb.eth> yeah, I really should shoot for a min repro, I think there's something buggy going on. |
05:53:02 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4Mdi |
05:59:35 | FromDiscord | <odexine> doesnt seem to make sense |
05:59:44 | FromDiscord | <odexine> that its different, i mean |
06:00:28 | FromDiscord | <michaelb.eth> sure, seems like it shouldn't make a difference |
06:09:10 | FromDiscord | <odexine> what compiler flags |
06:10:08 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4Mdm |
06:10:57 | FromDiscord | <michaelb.eth> Nim devel, commit `39fbd30`, from just a few days ago |
06:14:34 | FromDiscord | <michaelb.eth> oh, forgot to mention and might be relevant, compiler is clang |
06:14:40 | FromDiscord | <Elegantbeef> Does `let t = t1 - t0; fmtMilliseconds(t)` also have the slower runtime |
06:14:51 | FromDiscord | <michaelb.eth> will try |
06:22:45 | * | derpydoo joined #nim |
06:48:35 | FromDiscord | <michaelb.eth> In reply to @Elegantbeef "Does `let t =": made it even worse |
06:49:50 | FromDiscord | <michaelb.eth> rephrasing: times per `fmtMilliseconds` are slower, slightly more so than previous variants |
06:51:34 | FromDiscord | <Elegantbeef> That makes 0 sense |
06:51:43 | FromDiscord | <michaelb.eth> I agree |
06:58:37 | FromDiscord | <michaelb.eth> my current theory, and again because I saw something quite similar before I involved nim-decimal, there's something buggy happening with floats |
07:10:23 | * | PMunch joined #nim |
07:34:15 | * | advesperacit joined #nim |
07:37:35 | FromDiscord | <pmunch> I mean just comparing these two you get the same times http://ix.io/4Mdz |
07:40:06 | FromDiscord | <pmunch> So if anything there's something going on with the above code |
07:40:13 | FromDiscord | <pmunch> Or the code above rather |
07:58:20 | * | antranigv quit (Ping timeout: 252 seconds) |
08:00:47 | * | antranigv joined #nim |
08:09:00 | FromDiscord | <TӨMΛ ☠> sent a code paste, see https://play.nim-lang.org/#ix=4MdJ |
08:09:12 | FromDiscord | <Elegantbeef> `col: var Collection` |
08:09:43 | FromDiscord | <TӨMΛ ☠> Ooh, my goodness, right 😆 |
08:09:55 | FromDiscord | <TӨMΛ ☠> Can't count how many times this missing `var` got me now, haha |
08:10:02 | FromDiscord | <TӨMΛ ☠> Thank you ❤️ |
08:10:44 | NimEventer | New thread by chaemon: [] operator and converter are not compatible. , see https://forum.nim-lang.org/t/10674 |
08:14:02 | FromDiscord | <Elegantbeef> Now go educate that forum post about the importance of `var` |
08:30:17 | PMunch | But wait, shouldn't that work as-is? |
08:30:38 | PMunch | result.data is seq[T], so result.data[0] += 1 should work, right? |
08:31:56 | PMunch | I mean throwing `var` into the `[]` makes the code work, but is result.data now converted to a SEQ[T] before calling the `[]` operator? |
08:33:50 | FromDiscord | <Elegantbeef> The converter should not fire if it's not mutable |
08:47:25 | PMunch | Huh? |
08:49:47 | FromDiscord | <Elegantbeef> This seems to be another converter bug, there's no reason for `result.data[0] += 1` to fire a converter |
08:53:26 | PMunch | Exactly |
08:57:26 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4MdU really funny minimized |
09:04:11 | * | derpydoo quit (Ping timeout: 264 seconds) |
09:12:23 | FromDiscord | <ivorydealership> how can i convert a base64'd image back into an image file with nim? (i could just exec powershell or smt but i want to do it in nim)↵((i might be dumb here but i looked online and struggled to find a working solution.)) |
09:14:35 | Amun-Ra | convert to bytes, write |
09:16:06 | Amun-Ra | https://nim-lang.org/docs/base64.html#decode%2Cstring |
09:24:36 | FromDiscord | <azzkikr> sent a code paste, see https://play.nim-lang.org/#ix=4Me3 |
09:26:47 | FromDiscord | <intellij_gamer> Make the operator return `var MyObject`, or make it not require a `var MyObject` parameter |
09:28:14 | FromDiscord | <intellij_gamer> Issue is that it requires a `var` parameter but what it returns isn't `var` so you can't chain it |
09:28:45 | FromDiscord | <nnsee> https://play.nim-lang.org/#ix=4Me6 |
09:28:51 | FromDiscord | <nnsee> oof, amadan was faster |
09:29:11 | FromDiscord | <odexine> why are you using a var for k and then also returning it? |
09:29:19 | FromDiscord | <odexine> just thought it was weird |
09:29:56 | * | beholders_eye joined #nim |
09:37:47 | FromDiscord | <azzkikr> I've just begun exploring the language \:) The compiler complained when I was not using a `k: var MyObject` (`k.name cannot be assigned to`) so I added the keyword. But thanks people, I will check it all out |
09:39:37 | FromDiscord | <nnsee> do you _want_ the `/` procedure to modify the object itself? That behaviour wouldn't really make sense to me but it is your code lol - if you want that, you need to use a var |
09:41:09 | FromDiscord | <nnsee> in the return type as well, i mean |
09:41:12 | FromDiscord | <nnsee> so https://play.nim-lang.org/#ix=4Meb |
09:41:52 | FromDiscord | <nnsee> otherwise the interim object created when you do `bleh / "again!"` in the last line isn't a var, which is what the procedure expects |
09:42:06 | FromDiscord | <nnsee> does that make sense to you? |
09:45:04 | FromDiscord | <nnsee> In reply to @nnsee "do you _want_ the": and what i mean by that is that the output of this doesn't make sense, for example: https://play.nim-lang.org/#ix=4Med |
09:45:14 | FromDiscord | <nnsee> the fact that `bleh` is modified when you create `other` |
09:46:46 | FromDiscord | <nnsee> the first link i posted doesn't do that, for example |
09:47:33 | * | beholders_eye quit (Ping timeout: 260 seconds) |
09:49:27 | * | beholders_eye joined #nim |
09:51:43 | FromDiscord | <azzkikr> Yeah the idea was to modify the object itself. It's just for exploring purposes, to see what the language can/can't do. The whole bunch makes a lot more sense now, thanks. |
10:32:49 | arkanoid | PMunch: hello! I've tried and benchmarked your nimcr project yesteday, and it works great, and it works much faster than "nim r". Afaik nimcr skips the nim compiler step, while "nim r" skips the C compilation step, but not sure |
10:49:13 | Amun-Ra | nim r is compile + run |
10:55:31 | arkanoid | Amun-Ra: but it skips compilation pass if it's already compiled, just like nimcr. Yet, nimcr is much faster |
10:55:51 | arkanoid | it drills down to how nim compiler detects if the source has changed or not |
11:02:44 | PMunch | Nimcr is very simple in that regard, it just checks if the source file you're compiling has changed |
11:02:53 | PMunch | Doesn't check any imports or anything |
11:10:03 | FromDiscord | <ringabout> Dammit, `-march=native` segfaults my program on Windows: https://play.nim-lang.org/#ix=4MeA When I try to define a function for importc objects |
11:13:28 | FromDiscord | <xtrayambak> Hey, @treeform, sorry for the ping. I just wanted to ask -- is image.fillText an expensive function? I've been working on a 2D renderer for a while now and I've pinpointed the majority of the lag to that function. If yes, are there any alternatives that are real-time friendly? |
11:16:48 | PMunch | Treeform is US based, so it might be a while until you get a reply |
11:18:57 | FromDiscord | <xtrayambak> That's fine with me, lol |
11:38:58 | * | jmdaemon quit (Ping timeout: 276 seconds) |
11:59:15 | Amun-Ra | ringabout: don't use nim types in importc procs |
12:03:58 | PMunch | You mean that float? |
12:04:18 | PMunch | Replace that with cfloat or cdouble perhaps? |
12:14:17 | * | om3ga quit (Read error: Connection reset by peer) |
12:17:49 | * | om3ga joined #nim |
12:34:08 | Amun-Ra | mhm |
13:08:01 | FromDiscord | <redmechanics> what are some modern gui librairies that have a decent documentation ? |
13:10:39 | FromDiscord | <nnsee> owlkettle? |
13:21:37 | FromDiscord | <Phil> Sidenote:↵If owlkettle does not count as having decent documentation please say so as I have a vested interest to make that thing shine until it makes your eyes bleed |
13:21:48 | FromDiscord | <Phil> (edit) "Sidenote:↵If owlkettle does not count as having decent documentation please say so ... as" added "and in which aspects" |
13:22:38 | FromDiscord | <Phil> Give I am literally flooding the repo with PRs for adding support for more widgets and other improvements here and there as well as providing the starting point for the nimibook docs I tend to be somewhat partial there 😛 |
13:23:34 | FromDiscord | <Phil> In reply to @redmechanics "what are some modern": Besides owlkettle, there's in general a couple bindings that are pretty decent. PMunch has his own that he posted to me the other day that I forgot the name of because I'm secretly a goldfish |
13:23:50 | FromDiscord | <Phil> (edit) "In reply to @redmechanics "what are some modern": Besides owlkettle, there's in general a couple ... bindings" added "GTK" |
13:24:04 | FromDiscord | <Phil> There's also QT bindings, either for QT widgets or for QML, not for both |
13:24:05 | Amun-Ra | I work on some wrappers |
13:24:39 | FromDiscord | <Phil> GTK? |
13:24:41 | FromDiscord | <Phil> Or QT? |
13:24:46 | Amun-Ra | GTK |
13:24:58 | Amun-Ra | GTK 2-4 |
13:25:51 | FromDiscord | <Phil> Check.↵Other than GTK and QT... errr elcritch is doing pretty impressive work IIRC, but that's WIP |
13:25:57 | FromDiscord | <Phil> (edit) "Check.↵Other than GTK and QT... errr elcritch is doing pretty impressive work ... IIRC," added "with Figuro" |
13:26:15 | Amun-Ra | Phil: btw, what do I have to do to register my package in nimble? |
13:27:13 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Mfk |
13:27:39 | Amun-Ra | oh, thanks |
13:27:50 | FromDiscord | <Phil> Fundamentally it really is just a PR to the package-repo |
13:28:01 | FromDiscord | <Phil> But nimble has a nice automated process for it so why not |
13:28:22 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Mfl |
13:28:23 | FromDiscord | <Phil> The package repo being this one: https://github.com/nim-lang/packages |
13:28:47 | FromDiscord | <Phil> God damn copy paste sometimes |
13:28:53 | PMunch | Mine is called genui, and for Gtk it's genuigtk3 |
13:29:06 | PMunch | I've also wrapped Gtk with Futhark with great success :) |
13:30:10 | * | rockcavera joined #nim |
13:35:51 | FromDiscord | <Phil> How hard would it be to convince you to implement some DSL magic to make adding event-listeners easier (doesn't have to be owlkettle's style, I just really like can.l's implementation) ? |
13:37:07 | PMunch | can.l? |
13:37:39 | PMunch | You don't like the `-> ("clicked": clickHandler)` syntax? |
13:42:46 | Amun-Ra | hmm, good idea, I thik I'll implement elem->clicked = handler syntax |
13:51:10 | PMunch | I really like the owlkettle syntax though |
13:51:14 | PMunch | Just inline it |
13:51:24 | PMunch | Makes it impossible to share a callback though |
13:59:57 | FromDiscord | <can.l> In reply to @PMunch "Makes it impossible to": You can just use `proc clicked() = myCallback()` if you want to. |
14:01:27 | PMunch | Ah of course, that's fair |
14:03:24 | FromDiscord | <can.l> Parameters would need to be passed manually, though at least in my experience sharing a callback is not that common in owlkettle. |
14:06:43 | PMunch | Yeah it's not the most common thing. But sometimes you can end up in a situation where it's handy |
15:04:53 | FromDiscord | <Phil> Wait, am I mixing things up? |
15:05:28 | FromDiscord | <Phil> If you already had inlined event listeners then I didn't say anything and the fact work is fucking me up is actively harming my already broken memory |
15:06:16 | FromDiscord | <Phil> (edit) "inlined event listeners" => ""define event-listener as part of the Widget declaration"-syntax" |
15:08:54 | PMunch | genui has this, yes |
15:15:42 | * | PMunch quit (Quit: Leaving) |
15:18:58 | FromDiscord | <Phil> Sweet! |
16:09:20 | FromDiscord | <srabb> happy thanksgiving |
16:09:33 | FromDiscord | <srabb> In reply to @PMunch "genui has this, yes": why the hell are you a bot |
16:11:43 | FromDiscord | <srabb> roboyt |
16:11:46 | FromDiscord | <srabb> robot |
16:21:52 | FromDiscord | <demotomohiro> In reply to @srabb "why the hell are": There is bridge between discord and other chat systems like IRC or matrix.↵Messages coming from people using IRC shows here with bot icon. |
16:23:40 | FromDiscord | <srabb> ah okei |
16:23:51 | FromDiscord | <treeform> In reply to @xtrayambak "Hey, <@107140179025735680>, sorry for": Yes it does a lot. |
16:24:32 | FromDiscord | <treeform> What are you using to draw your game? It’s probably best to draw text character by character |
16:24:45 | FromDiscord | <xtrayambak> In reply to @treeform "What are you using": I'm using OpenGL, with boxy and pixie. |
16:26:15 | FromDiscord | <treeform> Boxy has two examples to draw text fast, static and dynamic |
16:26:53 | FromDiscord | <xtrayambak> Ah, I never noticed those. I'll take a look at it. Thanks. |
16:26:54 | FromDiscord | <redmechanics> is there anyone that has a project in nim that i can help with as an intermediate programmer and considering the fact i started using nim not long ago ? |
16:40:58 | * | jmdaemon joined #nim |
16:51:50 | FromDiscord | <Clonkk> What would be your domain of interest ?↵(@redmechanics) |
16:53:46 | FromDiscord | <redmechanics> i don't have any in particular |
16:54:46 | NimEventer | New Nimble package! jacket - A Nim wrapper for the JACK client-side C API aka libjack, see https://github.com/SpotlightKid/jacket |
16:54:46 | NimEventer | New Nimble package! wasmrt - Nim wasm runtime, see https://github.com/yglukhov/wasmrt |
16:54:50 | NimEventer | New Nimble package! yasync - Yet another async/await for Nim, see https://github.com/yglukhov/yasync |
17:07:10 | FromDiscord | <xtrayambak> In reply to @isofruit "Quoting my own Obsidian": Wait, nimble publish does that??? |
17:07:11 | FromDiscord | <xtrayambak> God damn it, I've been manually editing JSON this entire time. |
17:15:40 | * | krux02 joined #nim |
17:43:16 | FromDiscord | <michaelb.eth> In reply to @redmechanics "i don't have any": maybe try working through last year's (or some past year's) Advent of Code using Nim, and then do this year's Advent of Code in Nim when it starts on Dec 3 |
17:43:46 | FromDiscord | <michaelb.eth> (edit) "3" => "1" |
17:48:08 | FromDiscord | <redmechanics> In reply to @michaelb.eth "maybe try working through": how can i see what thee |
17:48:15 | FromDiscord | <redmechanics> (edit) "thee" => "there was to do ?" |
17:48:39 | FromDiscord | <michaelb.eth> https://adventofcode.com/2022 |
17:48:47 | FromDiscord | <michaelb.eth> you can change the year in the URL |
17:55:58 | FromDiscord | <Phil> In reply to @xtrayambak "Wait, nimble publish does": There's so much stuff to know for setting things up that it literally triggered me to write and later publish my obsidian notes 😄 |
18:06:41 | FromDiscord | <tauruuuuuus> Hi! Does anyone know if it is possible to force enums to have a specific underlying type? |
18:11:06 | FromDiscord | <tauruuuuuus> It seems like I cannot force them to be 8 bit with:↵`{.size: sizeof(cchar).}` |
18:11:55 | FromDiscord | <Chronos [She/Her]> In reply to @tauruuuuuus "Hi! Does anyone know": Usually I assign the first value a '0' as a `uint8` for example |
18:12:08 | FromDiscord | <tauruuuuuus> Or at least, calling ord on something with this macro does not yield a 8-bit int.. |
18:12:10 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4MgJ |
18:12:36 | FromDiscord | <tauruuuuuus> In reply to @chronos.vitaqua "Usually I assign the": Tried that too without too much success :s, thanks tho! |
18:13:06 | FromDiscord | <Chronos [She/Her]> Hm, sorry, no idea then |
18:20:06 | FromDiscord | <nnsee> In reply to @tauruuuuuus "Hi! Does anyone know": you mean something like this? https://nim-lang.org/docs/manual.html#set-type-bit-fields the size pragma in particular |
18:21:06 | FromDiscord | <nnsee> or more precisely https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-size-pragma |
18:23:32 | FromDiscord | <tauruuuuuus> I had tried that to begin with, turns out my error was caused by something else and I got confused, I love nim a lot but unfortunately the compiler errors are sometimes a bit messy 😅 |
18:23:42 | FromDiscord | <tauruuuuuus> Thanks tho @nnsee ! |
18:34:48 | arkanoid | how can I test if a compile time piece of code compiles? |
18:39:30 | Amun-Ra | when compiles "let x = 2": discard |
18:41:15 | arkanoid | doesn't seems to work in my case. It returns true when code doesn't compile |
18:46:23 | FromDiscord | <JX M> #天伊娱乐公司【Long-term recruitment of agents】 The entire network is fair, just and open [Green Platform] Play on mobile phones and computers on site [Open an account for free] business for you 24 hours a day Main business [Baccarat, Dragon Tiger, Niu Niu, Fishing, Chess and Cards] Support\: [Support----USDT,TRX,Bank Card,Alipay,WeChat,KBZ, Register http://ty3799.cc Telegran\: @mjtyyl |
18:48:50 | arkanoid | Amun-Ra: check here. The first test should fail, the second doesn't run in VM as expected: https://termbin.com/inh4 |
18:51:53 | arkanoid | there's an old issue on this: https://github.com/nim-lang/Nim/issues/14049 |
18:52:04 | arkanoid | seems that compiles(e) doesn't really catch all the cases |
18:52:34 | Amun-Ra | right |
18:52:58 | Amun-Ra | I used it for simple things only |
18:55:54 | FromDiscord | <bootymonster69> what would raising an exception from within an `except` block do |
18:56:51 | arkanoid | Amun-Ra: here a self contained example https://play.nim-lang.org/#ix=4MgT |
18:59:08 | Amun-Ra | hmm, so re does not work in static context |
19:00:08 | FromDiscord | <bostonboston> In reply to @bootymonster69 "what would raising an": It would raise the exception, the block you're in would not catch it |
19:02:22 | FromDiscord | <bostonboston> https://play.nim-lang.org/#ix=4MgV |
19:04:16 | arkanoid | Amun-Ra: re is not listed in NimScript compatible modules, and that's ok. The issue here is compiles(e) not able to catch it |
19:05:02 | Amun-Ra | arkanoid: I always assumed code passed to compiles must be vm legal |
19:05:09 | Amun-Ra | I see your point now |
19:44:20 | arkanoid | what's the difference between std/re and std/nre? |
19:46:04 | FromDiscord | <Elegantbeef> `nre` is newer iirc |
19:46:05 | FromDiscord | <Elegantbeef> Use nimregex though |
19:46:08 | NimEventer | New thread by bsljth: What would I lose if I turn of garbage collection?, see https://forum.nim-lang.org/t/10676 |
19:46:11 | FromDiscord | <Elegantbeef> Raise an exception↵(@bootymonster69) |
19:46:21 | FromDiscord | <Elegantbeef> But personally I say do not use regex |
19:55:48 | * | PMunch joined #nim |
19:56:00 | arkanoid | Elegantbeef, I've just pushed a PR for a lib a lib that didn't work at compile time due to std/regex, and replace it with https://github.com/nitely/nim-regex |
19:56:11 | arkanoid | sorry for the repetition, wrong paste |
19:57:11 | arkanoid | I think https://nim-lang.org/docs/strutils.html#nimIdentNormalize%2Cstring is not following NEP1 style guide https://nim-lang.org/docs/nep1.html |
19:57:23 | FromDiscord | <Elegantbeef> I see |
19:57:34 | arkanoid | Type identifiers should be in PascalCase. All other identifiers should be in camelCase with the exception of constants which may use PascalCase but are not required to |
19:59:35 | FromDiscord | <Elegantbeef> It's just a string that operates on a string it cannot know what your intended meaning or spelling is |
19:59:35 | FromDiscord | <Elegantbeef> Should it uppercase a character after `_` probably 😄 |
20:00:46 | PMunch | Hmm, what's the easiest live drawing library in Nim? I want to draw some output while my script runs, just simple putting pixels on a canvas |
20:01:34 | FromDiscord | <Elegantbeef> sdl2 is quite easy to do that with |
20:01:39 | FromDiscord | <Elegantbeef> You can also use nico if you want it even simpler |
20:02:13 | PMunch | Yeah I was considering Nico, but I seem to remember it only doing indexed colors |
20:03:01 | FromDiscord | <Elegantbeef> It does only indexed colours |
20:03:01 | FromDiscord | <Elegantbeef> You got 256 of them though 😛 |
20:03:06 | FromDiscord | <Elegantbeef> If you want full rgb values then sdl2 is quite simple to setup and draw to |
20:03:23 | PMunch | Problem is that I load my colors from a file, so I don't know how many I have |
20:03:36 | PMunch | Yeah I guess SDL2 would be the next best option |
20:14:46 | * | notbad joined #nim |
20:15:08 | NimEventer | New Nimble package! avr_io - AVR registers, interrupts, progmem and peripheral support in nim!, see https://github.com/Abathargh/avr_io/wiki |
20:18:35 | arkanoid | PMunch: I'm fiddling with Futhark renaming options, and I'm finding quite big limitations. I've opened an issue to talk about an idea that could end up with better defaults |
20:18:51 | arkanoid | PMunch: https://github.com/PMunch/futhark/issues/87 |
20:19:08 | PMunch | Yes, the renaming system should really get a makeover |
20:19:51 | arkanoid | PMunch: I've just enabled anycase package at compile time. That could make it easy |
20:20:47 | PMunch | Why do you think nimIdentNormalize is a problem? |
20:20:47 | arkanoid | it just a case on kind, and then camel(n) or pascal(n) |
20:21:24 | PMunch | It is there so that I can more easily compare names later on, and if I allowed non-normalized names you could end up with compile-time collisions of names |
20:21:25 | arkanoid | because if you try to make names NEP1 in renameCallback, nimIdentNormalize flats everything to lowercase |
20:21:55 | PMunch | Ah, you've fallen into the common fallacy of thinking that Futhark output should be read by humans :P |
20:22:30 | arkanoid | PMunch: well, then why adding renaming tools then :D |
20:22:44 | PMunch | It's to rename things with clumsy names |
20:23:15 | FromDiscord | <Elegantbeef> Remove C prefix namespaces |
20:23:26 | PMunch | I have this for example in my Gtk wrapper: http://ix.io/4Mhl |
20:23:31 | PMunch | Exactly @Elegantbeef! |
20:23:39 | * | notbad quit (Remote host closed the connection) |
20:24:08 | arkanoid | exactly what I'm trying to do (successfully) with renameCallback. The issue is flat names as output that kills an handy visual hint when using produced wrappers |
20:24:08 | * | lucasta joined #nim |
20:24:42 | PMunch | Yeah I didn't think of editors showing and auto-completing things when I wrote Futhark |
20:25:03 | PMunch | I have a tendency to just type everything myself and don't really use editor tools (despite having written NimLSP) |
20:25:45 | PMunch | I haven't even set up keyboard shortcuts for LSP in Vim, I manually write :LspHover when I want to get hover hints or :LspDefinition when I want to jump to definition |
20:26:11 | arkanoid | sure, it's not a game changer, it's just something that can be done quite easily without messing up the logic: it's just about preserving case in generated code, and Nim is case insensitive so no change down the road |
20:27:25 | arkanoid | btw, it's just a proposal, not really anything super important |
20:28:21 | PMunch | Well the problem lies in how I deal with things internally in Futhark |
20:29:14 | PMunch | Well, rather with avoiding collisions from C |
20:29:45 | PMunch | Say you have my_var and myvar in C, I can't port those over without doing something to one of them |
20:30:16 | PMunch | So I store the names normalised, so when I encounter the second one I know I've already seen a symbol which will collide |
20:30:40 | PMunch | The reason I normalize first is for speed reasons |
20:31:29 | PMunch | But I guess I could do something like `usedNames.incl result.nimIdentNormalize` and then `if usedNames.contains(result.nimIdentNormalize)` and keep the original casing around |
20:37:16 | arkanoid | PMunch: if nimIdentNormalize would do it's job without replacing uppercase with lowercase, I would get what I mean, and futhark would see no change due to case insensitivity, i guess |
20:38:35 | PMunch | Huh? |
20:45:31 | arkanoid | you can see from the generated names that the case follows strictly what nimIdentNormalize does. If instead of lowering the whole string with special exception rule for the first letter, it would leave the case as is, it would be possible to preserve the word separation down the road |
20:47:10 | PMunch | But then it wouldn't serve it's current purpose |
20:47:16 | PMunch | Which is to ensure that C names don't collide |
20:47:16 | arkanoid | even better, I think it should just follow NEP1 and do camelCase or PascalCase according to object type. I don't think this transformation is more aggressive than what nimIdentNormalize is already doing |
20:47:42 | PMunch | If you can write me an auto-caser I'm all for it :) |
20:48:13 | PMunch | And by auto-caser I mean something which can detangle all the various C case styles and make sure you can't have collisions |
20:48:21 | arkanoid | as I said, I just patched anycase package just for that |
20:48:37 | PMunch | So even MYVAR shouldn't collide with MyVar or My_var. |
20:50:27 | PMunch | Do you have a link to anycase? |
20:51:32 | arkanoid | I'm not quite sure why you think this change would need change how you handle collisions. I'm just proposing an alternative step for nimIdentNormalize that would preserve case, or even better something that applies pascal or camel depending on type and NEP1. Down the road, if collision happens, you apply same logic as now. |
20:53:19 | arkanoid | PMunch: https://github.com/epszaw/anycase |
20:55:16 | PMunch | But the entire logic now is based on identifiers being normalized.. |
20:56:44 | PMunch | As I go I collect identifiers in `usedIdentifiers` fully normalized. Then when I encounter an identifier I normalize it and check if it exists in `usedIdentifiers`, then I check if it has a known renaming by looking it up in another table, and in certain cases I also look if the type should be changed from a third table. |
20:57:12 | PMunch | All these tables and hashes use normalized keys to make sure I can't have names which are different in C collide in Nim. |
21:08:21 | arkanoid | I'll study futhark code some more, as you're convincing me I'm underestimating the task |
21:09:38 | PMunch | It will be hard to auto-case things, but it shouldn't be too hard to keep the original casing |
21:09:55 | PMunch | That's just a matter of where normalisation happens |
21:26:12 | FromDiscord | <bootymonster69> anybody know where I went wrong?:↵https://play.nim-lang.org/#ix=4Mhu |
21:27:13 | FromDiscord | <bootymonster69> still playing around with the lanuage. I am aware that "there is a library for that" |
21:31:42 | PMunch | You mean apart from the error message? |
21:32:16 | PMunch | Line 38, that `Dynamic_Result` only has one generic argument while it takes two |
21:33:23 | PMunch | Ah, if you're trying to create default generics this appears to work: https://play.nim-lang.org/#ix=4Mhv |
21:33:46 | PMunch | That being said this code looks like you're heading for a painful mess |
21:37:27 | FromDiscord | <bootymonster69> I'm sure I am |
21:38:35 | FromDiscord | <bootymonster69> I had no idea you could do that in generic params |
21:38:44 | FromDiscord | <bootymonster69> thanks a bunch |
21:39:27 | FromDiscord | <bootymonster69> In reply to @bootymonster69 "I'm sure I am": of course I would appreciate any pointers on how to not shoot myself in the foot |
21:39:51 | PMunch | Don't horribly abuse generics and type classes is a good start :P |
21:40:55 | PMunch | Oh, and look up the difference between except and finally |
21:41:04 | FromDiscord | <bootymonster69> alrighty. i'm sure I will learn a good balance in time |
21:41:12 | PMunch | I'm 95% sure that's not what you want to do |
21:41:46 | PMunch | To be honest I'm not quite sure what you're trying to do here |
21:44:00 | FromDiscord | <bootymonster69> just trying to implement a data structure with an array and a length, and the result type |
21:44:46 | FromDiscord | <bootymonster69> I tried looking at one of the result libraries in nim and i genuinely could not understand it |
21:45:45 | FromDiscord | <Elegantbeef> `U = Error` is invalid |
21:45:51 | FromDiscord | <Elegantbeef> Generic parameters do not have defaults |
21:46:38 | FromDiscord | <Elegantbeef> Atleast they shouldnt 😄 |
21:47:46 | PMunch | Yeah I was wondering about that |
21:47:51 | FromDiscord | <bootymonster69> i'm just trying to pass the buck on what the kind of error in the err variant is going to be. kinda like zig's global error union |
21:47:53 | PMunch | I just changed it until it compiled :P |
21:47:57 | FromDiscord | <Elegantbeef> I guess it does work, but there is no detail on them being intended, and you cannot have a single parameter with a default |
21:48:17 | PMunch | But I guess not using any of the procs hid the error |
21:48:29 | FromDiscord | <Elegantbeef> No I tested it elsewhere and it works |
21:48:33 | FromDiscord | <Elegantbeef> But I would not lean on it |
21:48:51 | PMunch | @bootymonster69, well if you want to learn Nim then maybe try it the Nim way and just throw an exception? |
21:48:52 | FromDiscord | <bootymonster69> In reply to @bootymonster69 "i'm just trying to": does this make sense |
21:49:34 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4MhA like this works, but it does not seem intentional 😄 |
21:49:44 | FromDiscord | <bootymonster69> I personally don't like exceptions because of unpredictable control flow, but again I'm just seeing what I can express in the language more so than trying to work around it |
21:50:14 | FromDiscord | <Elegantbeef> So just make procedures return `Error[T, Y]` and annotate them `{.raises:[].}` |
21:50:25 | FromDiscord | <Elegantbeef> No longer have exceptions and have explicit flow control |
21:50:48 | FromDiscord | <bootymonster69> I was not aware that there was an Error[T, Y] |
21:50:56 | FromDiscord | <Elegantbeef> There isn't one |
21:50:58 | FromDiscord | <Elegantbeef> It takes 10 seconds to make |
21:51:23 | FromDiscord | <bootymonster69> thats a result by a different name, right? |
21:51:44 | FromDiscord | <Elegantbeef> Sure |
21:51:48 | FromDiscord | <bootymonster69> do you mind showing me? |
21:52:24 | FromDiscord | <bootymonster69> I would appreciate it |
22:00:25 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4MhD |
22:00:28 | FromDiscord | <Elegantbeef> There you go |
22:01:19 | FromDiscord | <Elegantbeef> Replace the `success` and `error` with explicit `result = error(...)` if you want |
22:01:25 | FromDiscord | <Elegantbeef> or `return error(...)` |
22:03:19 | FromDiscord | <bootymonster69> thanks. I haven't gotten to templates and macros yet so it may take a bit of time for me to understand this 🙂 |
22:03:38 | FromDiscord | <Elegantbeef> These are fairly tame |
22:03:53 | FromDiscord | <Elegantbeef> We set the variable we pass in the template and if we're in a proc we return |
22:11:58 | FromDiscord | <Elegantbeef> I think technically there should be a `break` aswell |
22:12:31 | FromDiscord | <redmechanics> are there any major softwares that use nim ? |
22:12:40 | PMunch | Define major |
22:13:04 | FromDiscord | <Elegantbeef> Nitter is the most well known Nim software |
22:16:04 | FromDiscord | <redmechanics> In reply to @PMunch "Define major": any software that actually has a real life use and is released to the public |
22:16:29 | PMunch | Then yes |
22:16:40 | FromDiscord | <Elegantbeef> Yea we don't do that here 😛 |
22:16:46 | PMunch | Fairly generous definition of major though |
22:16:47 | FromDiscord | <bostonboston> The Nim compiler 😄 |
22:17:51 | PMunch | I mean my little calculator thing has real life use, I use it every day, and it's open source on GitHub, so released to the public. Still wouldn't call it major though.. |
22:18:37 | FromDiscord | <redmechanics> In reply to @PMunch "I mean my little": yes but apart from you i dont think much people use it right ? |
22:20:00 | PMunch | No idea, it's not like I have analytics in it |
22:20:07 | PMunch | But I haven't heard of anyone using it :P |
22:20:14 | FromDiscord | <Elegantbeef> Should've boot google analytics in it 😛 |
22:20:18 | FromDiscord | <Elegantbeef> put |
22:20:24 | FromDiscord | <Elegantbeef> Wow that's a brain typo and a half |
22:20:37 | FromDiscord | <Elegantbeef> I'm like a toddler writing the alphabet sometimes |
22:21:07 | PMunch | I have written software in Nim though which is handling millions of DNS requests a day and is rolled out to many of the customers where I used to work |
22:21:25 | PMunch | It's not exactly public, but it's released and useful |
22:21:58 | * | lucasta quit (Remote host closed the connection) |
22:22:17 | * | lucasta joined #nim |
22:22:50 | FromDiscord | <redmechanics> ok because i like nim but i can't find a lot of info on softwares that use it and i find it is not very well documented apart from official documentation |
22:23:14 | FromDiscord | <Elegantbeef> That's the trick no software uses it |
22:23:18 | FromDiscord | <Elegantbeef> Relatively speaking |
22:23:33 | FromDiscord | <Elegantbeef> It's a niche programming language, they tend not to proliferate software |
22:37:50 | * | lucerne quit (Ping timeout: 245 seconds) |
22:38:58 | * | fallback quit (Ping timeout: 260 seconds) |
22:44:40 | * | advesperacit quit () |
22:45:08 | * | lucerne joined #nim |
22:53:46 | * | beholders_eye quit (Ping timeout: 255 seconds) |
22:56:06 | * | beholders_eye joined #nim |
23:05:03 | * | PMunch quit (Quit: leaving) |
23:29:01 | arkanoid | Elegantbeef, would you be so patient to explain me compiles(foo) vs compiles(static(foo)) ? |
23:29:16 | arkanoid | aren't both "compile time" tests? |
23:32:55 | * | lucasta quit (Quit: Leaving) |
23:34:02 | FromDiscord | <Elegantbeef> Arkanoid one checks if something compiles the other if it compiles in a static context |
23:35:18 | arkanoid | isn't compilation always "static" ? |
23:35:30 | FromDiscord | <Elegantbeef> Not when checking when something compiles |
23:36:02 | FromDiscord | <Elegantbeef> consider `when compiles(copyMem(pointer nil, pointer nil, 0))` this would return false in your world |
23:36:17 | FromDiscord | <Elegantbeef> Since it does not compile on the VM, but it does compile else where |
23:37:45 | arkanoid | uhm, quite hard to grasp |
23:39:34 | * | beholders_eye quit (Ping timeout: 260 seconds) |