00:26:07 | FromDiscord | <heysokam> @ElegantBeouf damn this snippet is epic https://media.discordapp.net/attachments/371759389889003532/1144065063402094762/image.png |
00:31:32 | FromDiscord | <Elegantbeef> Cannot tell if sarcasm or not 😄 |
00:33:12 | FromDiscord | <.maverk> ?? why is this ? https://media.discordapp.net/attachments/371759389889003532/1144066843431145632/test.PNG |
00:33:32 | FromDiscord | <Elegantbeef> Floating point impercision |
00:34:01 | FromDiscord | <.maverk> In reply to @Elegantbeef "Floating point impercision": why is it happening ? |
00:34:22 | FromDiscord | <steslos> If you look up how floating point numbers are stored, you'll see how they are approximate |
00:34:23 | FromDiscord | <Elegantbeef> Cause floats only have specific amount of bits |
00:34:32 | FromDiscord | <Elegantbeef> There is not a 2.35 inside of a 32bit float |
00:35:28 | FromDiscord | <.maverk> i understand now |
00:35:49 | FromDiscord | <.maverk> 32 is not enough to get the exact precision |
00:36:06 | FromDiscord | <.maverk> 0b . 0000000 |
00:36:26 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "There is not a": Oh wow |
00:36:44 | FromDiscord | <Chronos [She/Her]> That looks kinda painful ngl lol |
00:37:06 | FromDiscord | <Elegantbeef> That's why you format strings to what you want |
00:37:21 | FromDiscord | <.maverk> the nim compiler saved me papers and time |
00:37:29 | FromDiscord | <.maverk> i could calculate it manually |
00:45:34 | FromDiscord | <heysokam> In reply to @Elegantbeef "Cannot tell if sarcasm": ? why would that be sarcastic? |
00:46:02 | FromDiscord | <heysokam> i've wanted a damn todo tool in nim since forever, and you wrote it. thats just epic |
00:47:07 | FromDiscord | <Elegantbeef> Now modify it for `unimplemented` |
00:49:27 | FromDiscord | <heysokam> In reply to @Elegantbeef "Now modify it for": whats the difference? |
00:49:53 | FromDiscord | <Elegantbeef> unimplemented is sugar for `doassert false, msghere` |
00:49:55 | FromDiscord | <heysokam> i always use `{.error: "msg".}` for that |
00:49:59 | FromDiscord | <Elegantbeef> But also should produce a warning |
00:50:17 | FromDiscord | <Elegantbeef> Unimplemented is for marking code that's unimplemented as fatal, but not that you do not want to run |
00:50:25 | FromDiscord | <Elegantbeef> It's only for disabling code paths at runtime, not statically |
00:50:48 | FromDiscord | <heysokam> not following |
00:52:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Em6 |
00:53:32 | FromDiscord | <Elegantbeef> You do not want the compiler to stop compilation, you want the program to stop when it hits code that is unimplemented |
00:55:42 | FromDiscord | <acornes> hello, i am new to nim and recently wanted to find the pid of a process by using its executable name. i did some research and could only find answers pointing to using psutil-nim but that was made in the case that the pid is already known, is there a way of doing it simply in nim or are there no options? |
00:55:59 | FromDiscord | <acornes> In reply to @acornes "hello, i am new": specifically for windows |
00:56:39 | FromDiscord | <Elegantbeef> Did you search "Windows find pid by name" |
00:56:39 | FromDiscord | <Elegantbeef> Without Nim, but with C or C++ |
00:57:48 | FromDiscord | <heysokam> In reply to @Elegantbeef "You do not want": i was thinking about something like this, but for the `unreachable` idea from Zig |
00:58:06 | FromDiscord | <acornes> In reply to @Elegantbeef "Did you search "Windows": i just did but im not used to c or c++ so im not understanding a lot of it |
00:58:26 | FromDiscord | <acornes> it also cuts of the includes so i dont know what theyre using |
00:58:33 | FromDiscord | <acornes> (edit) "of" => "off" |
00:58:51 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Em9 |
01:10:17 | FromDiscord | <.maverk> is ``result`` still supported ? https://media.discordapp.net/attachments/371759389889003532/1144076178836168814/tst.PNG |
01:10:41 | FromDiscord | <heysokam> In reply to @.maverk "is ``result`` still supported": yes, but add is not valid for int |
01:10:53 | FromDiscord | <heysokam> result += i |
01:10:56 | FromDiscord | <heysokam> (edit) "result" => "`result" | "i" => "i`" |
01:11:04 | FromDiscord | <.maverk> i will try |
01:11:49 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1144076566087868507/test42.PNG |
01:11:52 | FromDiscord | <.maverk> not working either |
01:12:09 | FromDiscord | <heysokam> In reply to @.maverk "i will try": you are not using the result |
01:12:26 | FromDiscord | <heysokam> `echo iterate()`↵or `discard iterate()` |
01:12:47 | FromDiscord | <.maverk> should i initialize it or what ? |
01:12:49 | FromDiscord | <heysokam> or `proc iterate() :int {.discardable.}= ....` |
01:13:01 | FromDiscord | <heysokam> In reply to @.maverk "should i initialize it": initialize? |
01:13:35 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Emd |
01:14:14 | FromDiscord | <heysokam> (edit) "https://play.nim-lang.org/#ix=4Emd" => "https://play.nim-lang.org/#ix=4Eme" |
01:14:39 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4Emf |
01:14:42 | FromDiscord | <heysokam> point is that you need to be explicit. things don't just vanish behind your back like in other langs (like C or python) |
01:15:01 | FromDiscord | <heysokam> In reply to @.maverk "what does discard do": like `(void)thing` in C. it marks it explicitely as not being used |
01:15:58 | FromDiscord | <.maverk> In reply to @heysokam "like `(void)thing` in C.": but returns value !!!! |
01:16:44 | FromDiscord | <heysokam> In reply to @.maverk "but returns value !!!!": then use it !!!! |
01:17:07 | FromDiscord | <heysokam> you are not using it, so its crashing because it doesn't know what to do with what you are returning |
01:18:43 | FromDiscord | <acornes> sent a code paste, see https://play.nim-lang.org/#ix=4Emg |
01:18:55 | FromDiscord | <.maverk> but |
01:19:03 | FromDiscord | <.maverk> there is something confused me |
01:19:52 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4Emh |
01:19:58 | FromDiscord | <.maverk> why does it require int ? |
01:20:20 | FromDiscord | <.maverk> i know int is either 32 or 64 depending on the system architecture type |
01:23:41 | * | lucasta_ joined #nim |
01:24:18 | FromDiscord | <.maverk> now i understand |
01:24:29 | FromDiscord | <.maverk> i fixed it |
01:24:30 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4Emi |
01:25:00 | FromDiscord | <.maverk> for loop assigns the values to the architecture type by default |
01:25:50 | FromDiscord | <Elegantbeef> Or just `for i in 1u32..10u32` |
01:26:00 | FromDiscord | <Elegantbeef> Whoops `1i32..10i32` |
01:26:01 | FromDiscord | <.maverk> hhhh no i get the idea |
01:26:10 | FromDiscord | <.maverk> (edit) "no" => "now" |
01:26:35 | FromDiscord | <.maverk> In reply to @Elegantbeef "Or just `for i": what is u ? |
01:26:42 | FromDiscord | <.maverk> i am following a great book |
01:26:49 | FromDiscord | <.maverk> it makes nim amusing |
01:30:06 | FromDiscord | <heysokam> In reply to @.maverk "what is u ?": `u : unsigned int`↵`i : signed int`↵`f : float` |
01:30:43 | FromDiscord | <.maverk> In reply to @heysokam "`u : unsigned int`": prefixes and suffixes like c |
01:31:12 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Eml |
01:31:57 | FromDiscord | <heysokam> In reply to @.maverk "prefixes and suffixes like": more like math, really |
01:32:12 | FromDiscord | <.maverk> In reply to @heysokam "more like math, really": very interesting |
01:33:56 | FromDiscord | <Elegantbeef> You do not need the static block consts are implicitly static |
01:38:47 | FromDiscord | <heysokam> ty worked |
01:45:11 | FromDiscord | <Elegantbeef> My code snippets are already working, this is grand! 😄 |
01:49:58 | FromDiscord | <.maverk> is ``result`` considered a keyword or an identifier in nim ? |
01:50:35 | FromDiscord | <Elegantbeef> It's an implicitly declared identifier |
01:50:51 | FromDiscord | <.maverk> In reply to @Elegantbeef "It's an implicitly declared": thanks bro |
01:58:22 | FromDiscord | <acornes> sent a code paste, see https://play.nim-lang.org/#ix=4Emu |
02:00:04 | FromDiscord | <acornes> this is isNumber: |
02:00:11 | FromDiscord | <Elegantbeef> Hard to say without more code |
02:00:20 | FromDiscord | <acornes> sent a code paste, see https://paste.rs/r4IMw |
02:00:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Emv |
02:01:03 | FromDiscord | <Elegantbeef> Or whatever else you want in `except` |
02:01:16 | FromDiscord | <acornes> alright thank you |
02:01:20 | FromDiscord | <Elegantbeef> using parseutils you could even make a `tryparse` |
02:02:44 | FromDiscord | <acornes> but does this mean ill still have to write it 3 times? |
02:02:49 | FromDiscord | <acornes> for secondary and melee |
02:03:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Emy |
02:03:21 | FromDiscord | <Elegantbeef> I mean yea you're doing 3 things |
02:03:40 | FromDiscord | <Elegantbeef> You could use an array and iterate over it instead |
02:03:55 | FromDiscord | <Elegantbeef> Especially since Nim has enum indexed arrays |
02:04:17 | FromDiscord | <acornes> ill try doing that then, thank you |
02:05:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4EmA |
02:10:19 | FromDiscord | <megaing> sent a code paste, see https://play.nim-lang.org/#ix=4EmB |
02:14:46 | FromDiscord | <Elegantbeef> Yea Nim's static generics are lackluster and generally require hacks to make work in cases |
02:14:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4EmE |
02:15:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4EmF |
02:17:15 | FromDiscord | <megaing> That last one doesn't work for me |
02:17:31 | FromDiscord | <Elegantbeef> Are you on Nim 2.0? |
02:18:07 | FromDiscord | <Elegantbeef> Actually it works all the way back to 1.0.0, so quit your lying, you liar! |
02:20:58 | FromDiscord | <megaing> The first back does work |
02:22:07 | FromDiscord | <megaing> Aha |
02:22:27 | FromDiscord | <megaing> The second one stops working if you use `Natural` instead of `int`, whereas the first works for both |
02:24:14 | FromDiscord | <megaing> My original syntax also works if I use `int` instead of `Natural`. I hadn't considered that mattering, so I didn't try that out |
02:24:16 | FromDiscord | <Elegantbeef> Yea generics are funky, the return type I think is generally checked before instantiation, which causes oddities |
02:25:54 | FromDiscord | <megaing> I guess I am going to use `int` instead of Natural. The fact that I use it as an array size will make it error anyway. |
02:26:18 | FromDiscord | <Elegantbeef> You'd think but `array[-1..-10, float]` is valid 😛 |
02:33:05 | FromDiscord | <that_dude.> In reply to @acornes "i found out how": I know you found a solution, but have you looked at `winim`? I found this https://github.com/khchen/winim/blob/154d6c6ffb1f19fce684381cdba5e3f3a729053e/winim/inc/tlhelp32.nim#L117C13-L117C13 |
02:33:32 | FromDiscord | <Elegantbeef> They have the C code, they should port it to Nim |
02:33:54 | FromDiscord | <Elegantbeef> It's like 25 loc they can surely port it |
02:39:08 | FromDiscord | <acornes> In reply to @that_dude. "I know you found": i did look at winim but couldn't find a straight forward way of solving my problem, ill try looking into it |
02:40:03 | FromDiscord | <Elegantbeef> It's literally the exact same as the C code in the end |
02:40:49 | FromDiscord | <that_dude.> There were a lot of C functions you used that are defined for nim use in the there |
04:04:28 | FromDiscord | <m4ul3r> Does {.inline.} set the attribute always_inline? |
04:07:37 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=4EmT |
04:11:20 | FromDiscord | <Elegantbeef> the inline pragma just emits whatever C does for inlining |
04:27:42 | * | ormiret_ joined #nim |
04:28:00 | * | LyndsySimon_ joined #nim |
04:28:31 | * | termer_ joined #nim |
04:33:11 | FromDiscord | <arathanis> "inline" is just a suggestion |
04:34:19 | FromDiscord | <m4ul3r> `static N_INLINE(void, mainmain_u14)(void)` Is what I see it doing, the N_INLINE is the suggestion then? |
04:35:29 | * | termer quit (*.net *.split) |
04:35:29 | * | ormiret quit (*.net *.split) |
04:35:29 | * | anddam quit (*.net *.split) |
04:35:29 | * | LyndsySimon quit (*.net *.split) |
04:35:30 | * | ormiret_ is now known as ormiret |
04:35:31 | * | LyndsySimon_ is now known as LyndsySimon |
04:42:12 | * | anddam joined #nim |
04:43:01 | * | termer_ is now known as termer |
04:47:32 | FromDiscord | <m4ul3r> I guess i can always inline with a template |
04:47:56 | FromDiscord | <m4ul3r> How do i return a value with template, I'm getting Error: no return type declared |
04:48:10 | FromDiscord | <Elegantbeef> You write an expression |
04:48:44 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=4En3 |
04:48:51 | FromDiscord | <Elegantbeef> remove `return` |
04:49:19 | FromDiscord | <m4ul3r> If there are ints, just remove all returns? |
04:49:23 | FromDiscord | <m4ul3r> (edit) "ints," => "ifs," |
04:49:43 | FromDiscord | <Elegantbeef> templates have to be expressions in that case |
04:49:52 | FromDiscord | <Elegantbeef> Though I still say just use a proc and annotate it inline |
04:50:19 | FromDiscord | <m4ul3r> wdym expressions?↵I've denoted inline and it's not inlining it |
04:50:33 | FromDiscord | <Elegantbeef> Did you make it a release build? |
04:50:38 | FromDiscord | <Elegantbeef> with `lto`? |
04:51:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4En4 |
04:52:24 | FromDiscord | <m4ul3r> using -d:danger, lto optimizes the asm too much and breaks it |
04:53:38 | FromDiscord | <Elegantbeef> Lol |
04:53:48 | FromDiscord | <Elegantbeef> "I want it optimised but I do not want it optimised" |
04:54:17 | termer | just remove functionality |
04:54:23 | FromDiscord | <m4ul3r> a dangerous balancing act i'm trying to do |
04:54:23 | termer | people don't talk about this enough |
04:54:27 | termer | if the loop is too slow, remove it |
04:54:43 | termer | If the string logic is too slow, remove it |
04:54:46 | FromDiscord | <huantian> time to remove my entire program |
04:54:53 | termer | that'll make it faster |
04:54:55 | termer | remove entire modules |
04:54:56 | FromDiscord | <Elegantbeef> Termer is on the good stuff tonight |
04:54:57 | FromDiscord | <Elegantbeef> Sleep |
04:54:58 | FromDiscord | <huantian> 'boutta `rm -rf /` |
04:55:07 | FromDiscord | <m4ul3r> sent a code paste, see https://paste.rs/aqhwk |
04:55:10 | termer | I actually had good sleep last night |
04:55:21 | termer | I'm the lowest stress level I've been in days |
04:55:25 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4En5 |
04:55:28 | FromDiscord | <huantian> oh it didn't work |
04:55:33 | FromDiscord | <Elegantbeef> I just don't get the point of "I want it optimised but not fully optimised" |
04:55:37 | termer | first of all, don't rimraf |
04:55:46 | termer | that's the end of list |
04:55:48 | FromDiscord | <m4ul3r> In reply to @Elegantbeef "I just don't get": PIC |
04:55:48 | FromDiscord | <Elegantbeef> Although I know someone was on some crypto shit of a "proved C compiler" |
04:55:57 | termer | say what |
04:55:58 | FromDiscord | <Elegantbeef> WSA! |
04:56:04 | FromDiscord | <Elegantbeef> I can should abbreviations aswell |
04:56:07 | termer | what's a "proved C compiler" |
04:56:19 | termer | "I can should" |
04:56:27 | FromDiscord | <Elegantbeef> Proofed\ |
04:56:30 | FromDiscord | <Elegantbeef> shout |
04:56:42 | termer | so what's a proofed C compiler |
04:56:52 | termer | optimization-proof? |
04:56:54 | termer | hehehe |
04:56:57 | FromDiscord | <Elegantbeef> Guaranteed to produce specific code |
04:57:07 | termer | Sounds like you want a literal C compiler |
04:57:27 | termer | You can get that with any C compiler by choosing the same options and the same version |
04:57:29 | FromDiscord | <Elegantbeef> I didnt get the point much myself, but it's about using code that is not optimised so there are no cryptographic explouts |
04:57:39 | termer | That does make some sense |
04:57:40 | FromDiscord | <Elegantbeef> exploits |
04:57:44 | termer | I can understand that |
04:57:47 | FromDiscord | <Elegantbeef> Fuck who replaced my fingers with spaghetti |
04:57:55 | termer | But I don't understand why you'd want to use C for that |
04:58:02 | termer | just write the asm at that point |
04:58:08 | termer | No extra steps and no speed penalty |
04:58:20 | termer | the only speed penalty would be your own failure to optimize |
04:58:54 | FromDiscord | <Elegantbeef> https://hal.univ-lorraine.fr/hal-02975012 |
04:59:26 | * | advesperacit joined #nim |
04:59:55 | FromDiscord | <Elegantbeef> Given I do not do anything crypto related, purposely slowing down your code is just asinine 😄 |
04:59:57 | termer | Interesting description |
05:00:21 | termer | but like I said, if you're worried about this, you should implement your algorithms in asm and export C symbols |
05:00:34 | termer | that seems a lot more trivial than modifying a compiler |
05:00:39 | FromDiscord | <Elegantbeef> Just use Nim's inline asm 😄 |
05:01:00 | FromDiscord | <Elegantbeef> Now why did m4uler here want to force inline code and care about the asm |
05:02:31 | FromDiscord | <Elegantbeef> Also of course after I say "I'll publish any code snippet that I write to a wiki" no one asks anything that requires code snippets |
05:04:28 | FromDiscord | <odexine> There is that MISRA compliant C compiler (AKA formally proven) |
05:05:14 | * | lucasta_ quit (Ping timeout: 258 seconds) |
05:18:05 | * | rockcavera quit (Remote host closed the connection) |
05:20:26 | FromDiscord | <m4ul3r> In reply to @Elegantbeef "Just use Nim's inline": ngl, nim's inline asm is just as powerful as c↵i like it- sometimes the compiler does things to it i don't like though |
05:21:00 | FromDiscord | <Elegantbeef> We're not talking about the same thing |
05:21:07 | FromDiscord | <Elegantbeef> inline asm is writing assembly in line |
05:21:25 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#statements-and-expressions-assembler-statement |
05:21:43 | FromDiscord | <m4ul3r> that's what I'm talking about, i have that sprinkled in my code to do my jank |
05:21:51 | FromDiscord | <Elegantbeef> The hell are you doing |
05:22:16 | FromDiscord | <odexine> What |
05:23:18 | FromDiscord | <m4ul3r> https://media.discordapp.net/attachments/371759389889003532/1144139847695601816/7wr5z8.png |
05:23:56 | FromDiscord | <m4ul3r> position independent code for embedded device |
05:35:29 | * | xet7 joined #nim |
05:37:20 | * | xet7 quit (Remote host closed the connection) |
05:37:40 | * | xet7 joined #nim |
05:56:06 | FromDiscord | <terrygillis> Hi, is there anything in Nim resembling interfaces or rust dyn traits? |
05:56:21 | FromDiscord | <terrygillis> I checked concepts but theyre compile time only |
05:56:26 | FromDiscord | <Elegantbeef> iface and traitor |
05:58:45 | FromDiscord | <terrygillis> those libraries look great thanks |
06:27:05 | * | xet7 quit (Remote host closed the connection) |
06:27:38 | * | xet7 joined #nim |
06:27:52 | * | xet7 quit (Read error: Connection reset by peer) |
06:28:01 | * | termer quit (Ping timeout: 244 seconds) |
06:29:14 | * | xet7 joined #nim |
06:29:33 | * | xet7 quit (Remote host closed the connection) |
06:30:28 | FromDiscord | <arnetheduck> unittest2 getting a facelift: https://github.com/status-im/nim-unittest2/pull/31 |
06:31:48 | FromDiscord | <arathanis> i thought they just recommended use testament |
06:32:33 | FromDiscord | <arathanis> this is lookin' pretty sweet tho |
06:32:50 | FromDiscord | <arathanis> using dots reminds me of pytest and I love pytest to death |
06:33:52 | FromDiscord | <Phil> In reply to @arnetheduck "unittest2 getting a facelift:": that is pretty sweet! |
06:34:04 | FromDiscord | <Elegantbeef> That build procedure is... yea 😄 |
06:34:43 | FromDiscord | <arathanis> its building the compiler |
06:35:30 | FromDiscord | <arathanis> rip mac builds |
06:35:41 | FromDiscord | <Elegantbeef> Nah I'm just looking at the config.nims |
06:38:27 | FromDiscord | <Elegantbeef> Arne I do have to ask, how are the dots any better than `X: Passed, Y: Skipped, Z: Failed (time)` |
06:39:30 | FromDiscord | <arnetheduck> dots are printed while the tests are running to indicate progress |
06:39:46 | FromDiscord | <Elegantbeef> Right so just update the tests as they go |
06:39:52 | FromDiscord | <Elegantbeef> It's a bit more work, but more sane |
06:40:22 | FromDiscord | <Phil> But doesn't that spam your terminal with the string `X: Passed, Y: Skipped, Z: Failed (time)` a billion times? |
06:40:42 | FromDiscord | <Phil> In terms of information in the terminal displayed at once, a more compact dot format seems more... "pleasurable" to the eye? |
06:41:19 | FromDiscord | <arathanis> In reply to @isofruit "In terms of information": i agree with you |
06:42:00 | FromDiscord | <arnetheduck> In reply to @Elegantbeef "Right so just update": either requires capturing stdout or doing terminal wizardry far beyond its practical utility, but hey, write the PR and I'm happy to consider it |
06:42:18 | FromDiscord | <Phil> You can't edit a line in a terminal, right? |
06:42:34 | FromDiscord | <arathanis> you can with things like ncurses |
06:42:34 | FromDiscord | <arnetheduck> In reply to @isofruit "You can't edit a": you can, but it's an art, not a science |
06:43:10 | FromDiscord | <Phil> In reply to @arnetheduck "you can, but it's": In that case the "bang/buck" ratio seems to skew heavily in favour of dots, so makes sense |
06:44:10 | * | PMunch joined #nim |
06:45:25 | FromDiscord | <Phil> In reply to @arathanis "you can with things": And what does it do? Actually edit the line or do trickery ala writing a new line but hiding the old one by inserting 100 newline characters in between line-updates? |
06:45:28 | FromDiscord | <Elegantbeef> Yea Phil I was talking about writing over the terminal buffer |
06:45:43 | FromDiscord | <Elegantbeef> It uses control characters like it was an actual terminal |
06:45:51 | FromDiscord | <arathanis> In reply to @isofruit "And what does it": lets you write directly to any cell in the window |
06:46:01 | FromDiscord | <arathanis> disable normal echo and other terminal features |
06:46:05 | FromDiscord | <arathanis> you can use it to make TUIs |
06:46:17 | FromDiscord | <arathanis> (edit) "in" => "on" | "window" => "terminal" |
06:46:18 | FromDiscord | <Elegantbeef> Look at the windows user |
06:47:30 | FromDiscord | <arathanis> @Phil so ncurses lets you look up things like what is the width/height of the terminal in characters |
06:47:38 | FromDiscord | <arathanis> write directly to specific cells on that terminal |
06:48:00 | FromDiscord | <arathanis> it (or equivalent) is the underlying technology for traditional roguelikes |
06:50:09 | FromDiscord | <Elegantbeef> Anywho given it's just a status indicator, yea makes sense |
06:50:29 | FromDiscord | <Phil> I really should find some brainpower to wrap up my reactive lib.↵I want to do GUI, but I found having to set up keeping stuff in sync myself is annoying so I want observables |
06:51:01 | FromDiscord | <Elegantbeef> That's what elcritch is working on for figuro |
06:51:24 | FromDiscord | <Phil> @.elcritch You're working on observables? |
06:51:47 | FromDiscord | <Elegantbeef> I think slots/signals count for that |
06:51:51 | FromDiscord | <Elegantbeef> I might be too daft |
06:53:21 | FromDiscord | <Elegantbeef> https://www.youtube.com/watch?v=NsZyzbzHVMc a video demonstration of his current progress |
06:54:09 | FromDiscord | <arathanis> guh |
06:54:13 | FromDiscord | <arathanis> having to go to bed for work |
06:54:15 | FromDiscord | <arathanis> the curse |
06:54:46 | FromDiscord | <Elegantbeef> Couldn't be me |
06:55:17 | FromDiscord | <.elcritch> In reply to @isofruit "<@703717429230174229> You're working on": Yah, as @ElegantBeouf I'd guess signal / slots count as that |
06:55:46 | FromDiscord | <arathanis> In reply to @Elegantbeef "*Couldn't be me*": i just have to tell myself its ok cause i took friday off |
06:55:49 | FromDiscord | <arathanis> i have to survive one more day |
06:56:47 | FromDiscord | <Phil> In reply to @.elcritch "Yah, as <@145405730571288577> I'd": So basically you can register yourself to receive updates when a certain value gets updated and trigger a callback with the new value when it changes? |
06:57:07 | FromDiscord | <Phil> With the slot I'm assuming being the updateable value and the signal being the callback that gets executed? |
06:58:20 | FromDiscord | <arathanis> sounds like you need to read The Gang of Four |
06:59:14 | FromDiscord | <Phil> My dislike from stumbling over tons of OO mess made me hesitant on picking that one up in particularly since I've only ever heard it highly recommended from that crowd |
06:59:42 | FromDiscord | <arathanis> you can translate all its patterns outside OO |
06:59:47 | FromDiscord | <arathanis> its a great book |
07:00:39 | FromDiscord | <.elcritch> In reply to @isofruit "So basically you can": Yah, it's effectively that. Except it relies on ref object's, not generic types. Doing observables with non-ref types isn't really feasible. Still it'd be easy to do a `Wrapper[T]` and for any type. Here's the basics: https://github.com/elcritch/figuro/blob/main/tests/tslots.nim |
07:01:24 | FromDiscord | <Elegantbeef> Well it's feasible, but you just implicitly box it, so it's pointless |
07:01:49 | FromDiscord | <Elegantbeef> or you go full `pointer` and have 0 type safety |
07:01:53 | FromDiscord | <Elegantbeef> I'm sure Phil would love that |
07:02:04 | FromDiscord | <.elcritch> Yah, better to avoid such dark things 😉 |
07:02:32 | FromDiscord | <.elcritch> Gang of Four is good, but 80% of the time you need to use one of the patterns is to work around OO stuff 🤣 Still it does have useful patterns |
07:03:06 | FromDiscord | <.elcritch> I was thinking of splitting out the slots / signals into their own thing too |
07:03:16 | FromDiscord | <Elegantbeef> My unlearned self just assumed gang of four was some fiction book |
07:03:40 | FromDiscord | <Elegantbeef> Then again no one should do OOP, so it probably is fiction |
07:03:51 | FromDiscord | <arathanis> In reply to @Elegantbeef "My unlearned self just": to be fair, it is not the actual name lol |
07:03:57 | FromDiscord | <arathanis> In reply to @Elegantbeef "Then again no one": OOP is perfectly fine |
07:04:29 | FromDiscord | <arathanis> ive seen people do the most heinous of things using every paradigm under the sun |
07:04:43 | FromDiscord | <Elegantbeef> "OOP is perfectly fine" No thank you |
07:05:07 | FromDiscord | <Elegantbeef> I will fight tooth an nail to avoid runtime dispatch |
07:05:19 | FromDiscord | <arathanis> hey, if you dont want to hear the truth nothin i can do ¯\_(ツ)_/¯ |
07:05:40 | FromDiscord | <Elegantbeef> Oh I understand that OOP has it's places, but acting hyperbolic is like my thing |
07:05:48 | FromDiscord | <arathanis> haha for sure |
07:05:52 | FromDiscord | <arathanis> that is a very programmer thing to do |
07:06:18 | FromDiscord | <arathanis> i often find myself using procedural, OO, and functional in the same project |
07:06:35 | FromDiscord | <arathanis> that are just better suited for different things and I find combining them you get the most expressive maintainable code |
07:06:41 | FromDiscord | <arathanis> (edit) "that are just better suited for different things and I find combining them you get the most expressive maintainable code ... " added "basew" |
07:06:43 | qwr | i've concluded, that OOP is probably perfectly fine for interpreted runtimes, like original OAK later known as java :) |
07:06:43 | FromDiscord | <arathanis> (edit) "basew" => "base" |
07:07:44 | FromDiscord | <.elcritch> In reply to @Elegantbeef "I will fight tooth": To quote you: "this hill I will die upon!" |
07:08:29 | FromDiscord | <arathanis> In reply to @Elegantbeef "I will fight tooth": which patch? |
07:08:35 | qwr | (there its kind of semidynamic compromise between performance and dynamic typing, of course the language frontend was pretty ugly in oak/java) |
07:12:12 | qwr | but at language level, there is pretty few places, where OOP is the "perfect abstraction" |
07:12:54 | qwr | what you generally want is some kind of interfaces |
07:12:58 | FromDiscord | <Phil> In reply to @arathanis "which patch?": static vs. runtime dispatch |
07:12:59 | FromDiscord | <Elegantbeef> Inheritance is nice, but the whole other part of OOP is iffy |
07:13:29 | FromDiscord | <Elegantbeef> Personally i'd like to have some amount of row polymorphism where you can define types by a product of fields |
07:13:32 | FromDiscord | <Phil> Static dispatch is when the compiler knows for sure at compiletime that at this one place in your code you will definitely call this other proc from your code.↵It can hard-glue that together, it's faster. |
07:13:44 | FromDiscord | <arathanis> In reply to @isofruit "static vs. runtime dispatch": I was making a dis/this joke. |
07:13:49 | FromDiscord | <Phil> Ah check |
07:13:55 | FromDiscord | <arathanis> all good |
07:14:03 | FromDiscord | <arathanis> doesnt translate to text as well |
07:15:07 | FromDiscord | <Phil> In reply to @arathanis "OOP is perfectly fine": As for this:↵I find OOP just does not lead to decently readable code.↵Every time I see colleagues of mine wiring OOP concepts together with the goal of having as much "finished" code as possible where you only need to write new code to extend functionality via clever use of polymorphisms, it leads to mini-frameworks where you must grasp the entire thing at once to understand which 10 li |
07:15:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Enp |
07:15:32 | FromDiscord | <Phil> It forces you to understand the entire system at once or have a manual that tells you "To add feature here, add new class there" |
07:15:34 | FromDiscord | <arathanis> In reply to @isofruit "As for this: I": This is misguided just-out-of-university thinking |
07:15:43 | FromDiscord | <arathanis> everyone creates cluster fucks that way |
07:15:45 | qwr | in most practical polymorphic code static dispatch can be achieved with monomorphisation, its tradeoff like most things |
07:15:50 | FromDiscord | <arathanis> and for some reason everyone starts there lol |
07:15:51 | FromDiscord | <Elegantbeef> Lol arath doesnt read the message.... |
07:15:59 | FromDiscord | <Elegantbeef> Just instantly "Out of touched thinking" |
07:16:23 | FromDiscord | <arathanis> whatchu talkin' bout |
07:16:30 | FromDiscord | <arathanis> they are talking about polymorphism hell |
07:16:47 | FromDiscord | <arathanis> and inheritance abuse |
07:17:02 | FromDiscord | <Elegantbeef> Atleast here the message was instantly proceeded by your message |
07:17:06 | FromDiscord | <Phil> That, in fact, is a new word I haven't hear yet (polymorphism hell). |
07:17:13 | FromDiscord | <arathanis> ohhh that makes sense |
07:17:21 | FromDiscord | <Elegantbeef> Right qwr I use a ton of compile time polymorphism |
07:17:22 | FromDiscord | <arathanis> In reply to @isofruit "That, in fact, is": its a real thing lol |
07:17:56 | FromDiscord | <Phil> Inheritance abuse I'm not sure of. It's a single level of inheritance every-time and we make sure to keep it that way, and only really go there when interfaces don't make sense |
07:18:17 | FromDiscord | <arathanis> In reply to @isofruit "Inheritance abuse I'm not": that is at least sane, at most in rare cases you might have 2 levels of inheritance |
07:18:24 | FromDiscord | <arathanis> (edit) "have" => "need" |
07:18:36 | FromDiscord | <arathanis> beyond that is a path to chaos |
07:18:47 | FromDiscord | <Elegantbeef> This is why row polymorphism is cool, procedures are more like concepts so you do need to nest inheritances and call base methods |
07:18:54 | FromDiscord | <Elegantbeef> do not need to\ |
07:19:33 | FromDiscord | <Elegantbeef> Though there is a whole runtime aspect to row polymorphism |
07:19:55 | FromDiscord | <Elegantbeef> Where you have structurally typed 'interfaces' |
07:20:29 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Enr |
07:20:29 | FromDiscord | <Elegantbeef> So like `var a: seq[object[x, y: int]]` could take any object with `x, y: int` but it'd not lose it's type infromation |
07:23:03 | FromDiscord | <arathanis> In reply to @isofruit "But it leads to": see if I make something like this I just have the services noop on messages they dont care about |
07:23:17 | FromDiscord | <arathanis> having the publisher filter over the subscribers sounds... not fun |
07:23:31 | FromDiscord | <Phil> In reply to @arathanis "see if I make": I don't like the construct in general because I just lost the information what notifications get sent out where without doing in-depth research |
07:23:33 | FromDiscord | <arathanis> having the publisher open the firehose and let the subscribers decide if they care makes more sense to me |
07:23:52 | FromDiscord | <Phil> It's now implicit based on the injectable services in the environment |
07:24:05 | FromDiscord | <arathanis> just use kafka |
07:24:12 | FromDiscord | <arathanis> then you can tell everyone its "enterprise" |
07:24:14 | FromDiscord | <arathanis> cause you are using kafka |
07:24:19 | FromDiscord | <arathanis> (edit) ""enterprise"" => ""enterprise ready"" |
07:24:20 | FromDiscord | <Phil> ActiveMQ |
07:25:00 | FromDiscord | <arathanis> In reply to @isofruit "I don't like the": well they got sent everywhere 😉 |
07:25:05 | FromDiscord | <arathanis> everywhere just decided what they cared about |
07:25:32 | FromDiscord | <arathanis> unless you are firing it over a wire or network and not internally to something else that does that |
07:25:46 | FromDiscord | <arathanis> now we are falling into talking about architecture |
07:25:54 | FromDiscord | <arathanis> how do my wednesday nights always end this way???? |
07:26:03 | FromDiscord | <Phil> In reply to @arathanis "well they got sent": That's what the code expresses, what the business need is "send a websocket notification when a message gets sent", and that just got obscured.↵And that shit gets obscured by OO is how I view most of it |
07:26:53 | FromDiscord | <Phil> (edit) "In reply to @arathanis "well they got sent": That's what the code expresses, what the business need ... is" added "is," |
07:28:10 | FromDiscord | <arathanis> In reply to @isofruit "That's what the code": i feel like without actually seeing source code its hard |
07:28:26 | FromDiscord | <Phil> Note that my view is heavily coloured by webdev which I feel like is not a great fit for OO in general |
07:28:27 | FromDiscord | <arathanis> but ive worked with systems like this before and i did appreciate it when it was architected well |
07:29:08 | FromDiscord | <arathanis> In reply to @isofruit "Note that my view": so my personal opinion is that each pardigm shines in certain ways but people decide they have a One True Paradigm ™️ and force themselves to only use it |
07:29:20 | FromDiscord | <arathanis> (edit) "pardigm" => "paradigm" |
07:29:29 | FromDiscord | <arathanis> and then you get terrible bullshit |
07:29:51 | FromDiscord | <arathanis> most of my projects and applications are relatively equal parts procedural/object-oriented/functional |
07:30:47 | FromDiscord | <arathanis> what im trying to say is I feel for you @Phil |
07:30:59 | FromDiscord | <Phil> I think I'd need to see it to believe it |
07:31:02 | FromDiscord | <arathanis> I know the unnecessary complexity of which you speak |
07:31:16 | FromDiscord | <arathanis> I maintain a similar code base right now 🥲 |
07:31:30 | FromDiscord | <Phil> I love learning and finding new ways of thinking, part of the reason why I'm at my current job because it taught me quite a bit in terms of new ways of structuring problems and approaches to problems |
07:33:19 | FromDiscord | <Phil> But at the same time the approaches I see not be nicely readable (which is basically what I value heavier than anything other than business requirements themselves) are almost always the OO ones.↵Maybe that's because I don't jive with them as well, I find that the control flow just becomes obscure and hard to follow (and thus: hard to debug) |
07:33:39 | FromDiscord | <arathanis> could be lack of exposure? |
07:33:49 | FromDiscord | <arathanis> i dont know. I do spend a lot of time ensuring all my code is easy to read and follow |
07:34:27 | FromDiscord | <arathanis> ive reached the point in my career that my approach to writing code is:↵> I want the next person who has to look at this to feel like I cared about them |
07:34:54 | FromDiscord | <Phil> That one I fully agree with |
07:35:54 | FromDiscord | <Phil> Not just agree with, it's pretty much my highest priority after the business requirements (or sometimes even before them, depending on if a small changes to the business requirements that does not sacrifice a lot improves the readability a lot) |
07:36:21 | FromDiscord | <Phil> (edit) removed "a" |
07:39:55 | FromDiscord | <arathanis> In reply to @isofruit "Not just agree with,": exaaaactly |
07:40:02 | FromDiscord | <arathanis> readability and maintainability first |
07:41:04 | * | xet7 joined #nim |
07:41:55 | * | xet7 quit (Remote host closed the connection) |
07:52:56 | * | xet7 joined #nim |
08:24:39 | * | PMunch quit (Quit: Leaving) |
08:27:13 | * | PMunch joined #nim |
08:28:45 | * | termer joined #nim |
09:05:41 | FromDiscord | <that_dude.> sent a code paste, see https://play.nim-lang.org/#ix=4EnO |
09:06:45 | FromDiscord | <Elegantbeef> Helps if you actually give generic parameters to the distinct types |
09:07:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4EnQ |
09:07:50 | FromDiscord | <that_dude.> Damn it's really that easy |
09:08:15 | FromDiscord | <that_dude.> I thought that it shouldn't matter if I'm don't actually care about what the generic parameters are holding |
09:08:35 | FromDiscord | <that_dude.> In the same way `proc delAll(c: var TimerContainer) =` is fine |
09:12:52 | FromDiscord | <that_dude.> Actually though, is there a reason that I can omit the `[T]` sometimes but not in this case? |
09:18:58 | FromDiscord | <Elegantbeef> Cause generic types need generic parameters |
09:19:05 | FromDiscord | <Elegantbeef> Inside a procedure it's a typeclass |
09:19:28 | FromDiscord | <Elegantbeef> `distinct EventContainer` is a generic alias so `MoveContainer` and `TimerContainer` were the same afaik |
09:20:08 | FromDiscord | <Elegantbeef> Well a generic without a parameter is a typeclass everywhere |
09:21:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4EnV |
09:24:55 | FromDiscord | <that_dude.> I'll need to chew on that for a bit. Does this mean that the compiler doesn't really understand the `distinct EventContainer[T]` part? |
09:25:20 | FromDiscord | <that_dude.> Because my train of thought is that, because they are assigned to different type names, there shouldn't be any confusion |
09:25:48 | FromDiscord | <that_dude.> When I use/request one of the two (move or timer) |
09:26:21 | FromDiscord | <that_dude.> Well `distinct EventContainer` |
09:28:23 | FromDiscord | <that_dude.> sent a code paste, see https://play.nim-lang.org/#ix=4EnW |
09:29:21 | FromDiscord | <Elegantbeef> Right `distinct seq` is just wrong |
09:29:27 | FromDiscord | <Elegantbeef> you can never specify the generic parameter |
09:46:15 | * | syl quit (Quit: C-x C-c) |
09:48:03 | * | syl joined #nim |
10:14:27 | * | azimut quit (Ping timeout: 246 seconds) |
10:48:08 | * | PMunch_ joined #nim |
10:50:52 | * | PMunch quit (Ping timeout: 248 seconds) |
11:19:59 | * | PMunch_ is now known as PMunch |
12:43:17 | FromDiscord | <.maverk> what am doing wrong ? https://media.discordapp.net/attachments/371759389889003532/1144250576159391754/tst.PNG |
12:44:49 | FromDiscord | <Phil> In reply to @.maverk "what am doing wrong": addr returns you a pointer.↵There is no stringification proc (`$`) for pointers |
12:45:03 | FromDiscord | <Phil> I take it you want the memory address? |
12:45:09 | FromDiscord | <.maverk> yes |
12:45:13 | FromDiscord | <.maverk> the memory address |
12:47:35 | PMunch | cast it to an integer |
12:47:45 | PMunch | And use `toHex` if you want a hex represantation |
12:48:49 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EoD |
12:48:55 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4EoD" => "https://play.nim-lang.org/#ix=4EoE" |
12:49:04 | FromDiscord | <Andreas> `cast[int]( name.addr )` and to just look at the pointer `addr(name).repr` |
12:49:48 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4EoE" => "https://play.nim-lang.org/#ix=4EoG" |
12:49:55 | FromDiscord | <Phil> Wups had that still for ref types, you just wanted it to work with addr |
12:58:08 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1144254313955348541/tst52.PNG |
12:58:11 | FromDiscord | <.maverk> guys it doesn't work |
12:58:19 | FromDiscord | <.maverk> 🙄 |
12:58:55 | FromDiscord | <Phil> insert blinking gif here |
12:58:56 | FromDiscord | <odexine> ? Why are you casting to that |
12:58:57 | FromDiscord | <Phil> I need you to read your code |
12:59:03 | FromDiscord | <Phil> Very carefully |
12:59:17 | FromDiscord | <.maverk> In reply to @odexine "? Why are you": i want the memory address |
12:59:28 | FromDiscord | <odexine> Yes but what is myptra? |
12:59:32 | FromDiscord | <Andreas> `echo repr(myname.addr)` |
12:59:42 | FromDiscord | <.maverk> In reply to @odexine "Yes but what is": it stands for : my pointer address |
12:59:44 | FromDiscord | <odexine> You're supposed to cast to an integer right? |
12:59:45 | FromDiscord | <.maverk> so myptra |
13:00:01 | FromDiscord | <odexine> In reply to @.maverk "it stands for :": You dont cast into a variable, but a type |
13:00:57 | FromDiscord | <Phil> sent a long message, see http://ix.io/4EoJ |
13:01:12 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1144255084994232380/52.PNG |
13:01:13 | FromDiscord | <Phil> (edit) "http://ix.io/4EoJ" => "http://ix.io/4EoK" |
13:01:37 | FromDiscord | <.maverk> i set the pointer to string |
13:02:49 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1144255488041693184/31.PNG |
13:03:00 | FromDiscord | <Phil> That is, not what was suggested.↵Use `addr` to get the pointer.↵`cast[uint64]` to interpret that pointer as a number so you can print it to the terminal. |
13:03:02 | FromDiscord | <odexine> Don’t cast to a string |
13:03:10 | FromDiscord | <odexine> Cast to an integer |
13:03:34 | FromDiscord | <Phil> (edit) "is," => "is" |
13:04:21 | FromDiscord | <.maverk> aaah |
13:04:23 | FromDiscord | <.maverk> now works |
13:04:28 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EoN |
13:04:48 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1144255991920197722/42.PNG |
13:05:31 | FromDiscord | <odexine> Technically that’s wrong |
13:05:44 | FromDiscord | <Phil> I would highly suggest to use `uint64` unless you're on a 15 year old computer, then you may use `uint32` |
13:06:10 | FromDiscord | <odexine> In reply to @isofruit "I would highly suggest": Just use uint as is because it is pointer size |
13:06:21 | FromDiscord | <Phil> Fair |
13:06:28 | FromDiscord | <Phil> (edit) "Fair" => "Fair, forgot about that" |
13:08:09 | FromDiscord | <Phil> sent a long message, see http://ix.io/4EoQ |
13:08:27 | FromDiscord | <Phil> (edit) "http://ix.io/4EoQ" => "http://ix.io/4EoR" |
13:09:01 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1144257051569168414/tst51.PNG |
13:09:21 | FromDiscord | <.maverk> this is the memory address what is it like this ? |
13:09:28 | FromDiscord | <.maverk> in decimal representation |
13:09:35 | FromDiscord | <odexine> That’s still technically wrong because you’re printing the address of the variable holding the address |
13:10:07 | FromDiscord | <odexine> Remove the second line (with myptr) and replace myptr with name on the third line |
13:10:11 | FromDiscord | <odexine> (edit) "Remove the second line (with ... myptr)" added "var" |
13:11:13 | FromDiscord | <.maverk> In reply to @odexine "Remove the second line": what should i remove ? |
13:12:34 | FromDiscord | <Andreas> try this https://zevv.nl/nim-memory/#_strings_and_seqs |
13:16:40 | * | lucasta joined #nim |
13:16:53 | FromDiscord | <.maverk> is addr a keyword in nim ? |
13:17:50 | FromDiscord | <odexine> Pretty much I think |
13:18:08 | FromDiscord | <odexine> (edit) "much" => "much," |
13:18:35 | FromDiscord | <.maverk> In reply to @odexine "Pretty much, I think": thanks rika |
13:19:25 | PMunch | Not really: https://play.nim-lang.org/#ix=4EoS |
13:19:31 | PMunch | Seems like just another name to me |
13:19:40 | PMunch | But most highlighters will highlight addr for you |
13:25:23 | FromDiscord | <.maverk> what is the library to work with memory addresses and pointers ? |
13:26:15 | FromDiscord | <nnsee> why would you need a library for that |
13:26:26 | FromDiscord | <nnsee> what would you even expect the library to do |
13:26:58 | FromDiscord | <.maverk> In reply to @nnsee "what would you even": i don't know to work with hex and octal numbers maybe |
13:27:32 | FromDiscord | <Andreas> thats only known to senior students - thats what i've heard |
13:27:52 | FromDiscord | <nnsee> hex and octal are just representations |
13:28:01 | FromDiscord | <.maverk> In reply to @nnsee "hex and octal are": yeah i know |
13:28:07 | FromDiscord | <nnsee> and the standard library has tools to represent numbers as hex or octal |
13:28:13 | FromDiscord | <.maverk> i thought maybe there should be a library |
13:28:20 | FromDiscord | <nnsee> you don't need a library for it |
13:28:31 | FromDiscord | <.maverk> what about the tohex function is it built-in in a library or the language itself ? |
13:28:39 | FromDiscord | <odexine> It’s in a library for Nim IIRC |
13:28:50 | FromDiscord | <.maverk> In reply to @odexine "It’s in a library": which library ? |
13:29:00 | FromDiscord | <heysokam> sent a long message, see http://ix.io/4EoU |
13:29:29 | FromDiscord | <heysokam> do it for learning, not stopping you. just making you aware in case you weren't |
13:29:33 | FromDiscord | <nnsee> In reply to @.maverk "which library ?": Google is your friend |
13:29:37 | FromDiscord | <nnsee> https://nim-lang.org/docs/strutils.html#toHex%2CT |
13:29:50 | FromDiscord | <heysokam> I also do stufflike that with --mm:none, but... its not the normal thing to do |
13:30:13 | FromDiscord | <heysokam> (edit) "http://ix.io/4EoU" => "http://ix.io/4EoV" |
13:31:38 | FromDiscord | <.maverk> In reply to @heysokam "In nim you usually": ref is a keyword ? |
13:31:56 | FromDiscord | <heysokam> In reply to @.maverk "ref is a keyword": yes |
13:32:11 | FromDiscord | <Andreas> maybe try this https://ramanlabs.in/static/blog/raw_memory_management_patterns_in_nim_language.html and sooner or later you become a senior-student. |
13:32:42 | FromDiscord | <m4ul3r> In reply to @.maverk "what is the library": The std lib is enough, you don’t really need another lib, but there’s one called ptrmath |
13:33:51 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EoW |
13:34:10 | * | rockcavera joined #nim |
13:34:54 | FromDiscord | <heysokam> `ref Type` is the way to go for 99.99% of the use cases |
13:36:24 | FromDiscord | <.maverk> In reply to @m4ul3r "The std lib is": https://media.discordapp.net/attachments/371759389889003532/1144263944433848380/tst.PNG |
13:36:28 | FromDiscord | <.maverk> stdlib doesn't exist |
13:36:45 | FromDiscord | <heysokam> In reply to @.maverk "stdlib doesn't exist": it exists as `system` and already imported by default |
13:37:01 | FromDiscord | <heysokam> then there are each `std/thename` separete modules |
13:37:10 | FromDiscord | <heysokam> (edit) "separete" => "separate" |
13:38:39 | FromDiscord | <m4ul3r> the standard lib is just everything in nim by default |
13:38:45 | FromDiscord | <.maverk> sent a long message, see http://ix.io/4EoY |
13:40:44 | FromDiscord | <nnsee> In reply to @.maverk "doesn't work ": where are you getting these names from? |
13:40:54 | FromDiscord | <nnsee> nobody ever mentioned `lib` or `stdlib` |
13:41:18 | FromDiscord | <nnsee> the `toHex` procedure can be found in `std/strutils`, just like the link I sent you says |
13:41:49 | FromDiscord | <Andreas> hey, when i was confused about smth, i often consulted https://learnxinyminutes.com/docs/nim/ |
13:42:24 | FromDiscord | <.maverk> In reply to @nnsee "where are you getting": what about the ptrmath library |
13:42:29 | FromDiscord | <.maverk> how to import it ? |
13:42:39 | FromDiscord | <heysokam> In reply to @.maverk "doesn't work ": its either `system`, which exists and you cannot import↵or `std/os`, `std/strutils`, `std/strformat`, etc↵which you could also import like `import os`, `import strutils` and `import strformat` |
13:43:14 | FromDiscord | <.maverk> In reply to @heysokam "its either `system`, which": what about the ptrmath lib ? |
13:43:15 | FromDiscord | <heysokam> In reply to @.maverk "how to import it": you need to install them first with nimble |
13:43:23 | FromDiscord | <nnsee> In reply to @.maverk "what about the ptrmath": I don't know what that is |
13:43:49 | FromDiscord | <.maverk> In reply to @m4ul3r "The std lib is": . |
13:43:53 | FromDiscord | <heysokam> (edit) "In reply to @.maverk "how to import it": you need to install them first with nimble" => "sent a code paste, see https://play.nim-lang.org/#ix=4Ep1" |
13:43:53 | FromDiscord | <.maverk> he said ptrmath |
13:44:18 | FromDiscord | <heysokam> (edit) "https://play.nim-lang.org/#ix=4Ep1" => "https://play.nim-lang.org/#ix=4Ep2" |
13:44:26 | FromDiscord | <Andreas> its `ptr_math` |
13:44:46 | FromDiscord | <heysokam> tru |
13:44:59 | FromDiscord | <heysokam> (edit) "https://play.nim-lang.org/#ix=4Ep2" => "https://play.nim-lang.org/#ix=4Ep3" |
13:45:06 | FromDiscord | <.maverk> In reply to @Andreas "its `ptr_math`": that is true |
13:45:13 | FromDiscord | <.maverk> i am downloading it |
13:45:36 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1144266262550151198/resr.PNG |
13:46:25 | FromDiscord | <nnsee> In reply to @.maverk "what about the ptrmath": please, do the bare minimum of reading the project's README before trying to use it :) https://github.com/kaushalmodi/ptr_math#installation |
13:46:43 | FromDiscord | <.maverk> In reply to @nnsee "please, do the bare": ok bro |
13:48:03 | FromDiscord | <heysokam> `ptr_math` seems to be outdated, btw↵ByteAddress is deprecated, and is no longer stored as an `int` in the background. So all this int math is outdated↵The internal representation of addresses should be `uint` to be correct↵https://github.com/kaushalmodi/ptr_math/blob/1ee3b7fe12f394edd5a1e2841491e8c2e9fd193b/src/ptr_math.nim#L63 |
13:48:32 | FromDiscord | <heysokam> (edit) "is" => "adresses are" | "adresses areno longer ... storedoutdated" added "meant to be" | "outdated↵The" => "outdated (although it will work until its removed)↵The" |
13:49:07 | FromDiscord | <.maverk> wow it is amazing |
13:49:15 | FromDiscord | <.maverk> thanks guys |
13:49:57 | * | jmdaemon quit (Ping timeout: 245 seconds) |
13:50:59 | FromDiscord | <heysokam> this one is really helpful, lol. I wish I knew it existed!↵https://github.com/kaushalmodi/ptr_math/blob/1ee3b7fe12f394edd5a1e2841491e8c2e9fd193b/src/ptr_math.nim#L272 |
13:51:14 | FromDiscord | <heysokam> unchecked arrays are a huge pain for interop with C |
13:51:54 | NimEventer | New thread by Ariyo: New to nim... It looks interesting, but can it ... ?, see https://forum.nim-lang.org/t/10436 |
13:53:39 | * | PMunch quit (Quit: Leaving) |
14:10:14 | FromDiscord | <Phil> In reply to @heysokam "unchecked arrays are a": Is an unchecked array basically "No idea how long, no idea how to check when it ends, good luck"? |
14:13:26 | FromDiscord | <heysokam> In reply to @isofruit "Is an unchecked array": yep. you need the adjacent `itemsCount` like it always happens in C |
14:13:42 | FromDiscord | <heysokam> in nim that field is internal, but in C you need to create it manually |
14:13:44 | FromDiscord | <Phil> adjacent as in you need to pass that in as an extra parameter= |
14:13:47 | FromDiscord | <Phil> (edit) "parameter=" => "parameter?" |
14:13:48 | FromDiscord | <heysokam> yeah |
14:13:57 | FromDiscord | <Phil> Why do C people hate themselves? |
14:14:05 | FromDiscord | <heysokam> i ask myself that everyday |
14:14:10 | FromDiscord | <heysokam> 😄 🙈 |
14:21:54 | FromDiscord | <acornes> sent a code paste, see https://play.nim-lang.org/#ix=4Epa |
14:22:42 | FromDiscord | <Phil> Sounds like the code is on point, but either the path or the permissions to the file have changed |
14:22:58 | FromDiscord | <Phil> You execute the binary from exactly the same directory? |
14:23:07 | FromDiscord | <acornes> yea same directory |
14:23:18 | FromDiscord | <Phil> Have you checked the permissions to config.ini? |
14:23:27 | FromDiscord | <Phil> Like who has read-write permissions? |
14:23:58 | FromDiscord | <acornes> In reply to @isofruit "Have you checked the": well the thing is i originally did have a config.ini thru createConfigFile but i deleted it by accident |
14:24:15 | FromDiscord | <acornes> so i did used to have it and the code is still the same so i dont know why it no longer creates it |
14:25:34 | FromDiscord | <acornes> sent a code paste, see https://play.nim-lang.org/#ix=4Epc |
14:26:45 | FromDiscord | <Phil> How do you know it gets executed later?↵It gets executed on startup time so risky either way |
14:27:25 | FromDiscord | <odexine> What’s the code for write config |
14:27:41 | * | Phytolizer joined #nim |
14:27:47 | FromDiscord | <acornes> sent a long message, see http://ix.io/4Epe |
14:27:55 | FromDiscord | <Phil> That's part of parsecfg. You can in fact just run it if you copy-paste his 2 code-snippets into the same file (and delete the valorant part) |
14:28:09 | FromDiscord | <Phil> (edit) "his" => "their" |
14:29:18 | FromDiscord | <acornes> would it be better if createConfigFile is integrated within where it reads the config file and just hide createConfigFile from the main file |
14:31:19 | FromDiscord | <acornes> like this |
14:31:20 | FromDiscord | <acornes> sent a code paste, see https://play.nim-lang.org/#ix=4Epi |
14:32:12 | FromDiscord | <.maverk> In reply to @isofruit "Why do C people": because it is all about deprecation and old techniques |
14:32:46 | FromDiscord | <odexine> In reply to @.maverk "because it is all": Old behaviour |
14:33:16 | FromDiscord | <odexine> C code from maybe a few decades ago probably still works as is |
14:33:25 | FromDiscord | <odexine> Can’t say the same with many other languages including Nim |
14:33:34 | FromDiscord | <acornes> or to make the code in the main file to seem more consistent i modify createConfigFile to check if config.ini already exists and if it does not create the ini |
14:33:46 | FromDiscord | <acornes> so its still in the main file |
14:39:42 | FromDiscord | <.maverk> In reply to @odexine "Old behaviour": i worked with stdio.h |
14:39:52 | FromDiscord | <.maverk> especialy with tmpfile functions |
14:39:54 | FromDiscord | <.maverk> and setbuf |
14:40:03 | FromDiscord | <.maverk> i really dislike it |
14:40:08 | FromDiscord | <.maverk> old fashion |
14:41:31 | FromDiscord | <.maverk> did you guys check the mem i posted in #prog-memes |
14:41:40 | FromDiscord | <.maverk> 🤣 |
15:06:15 | * | advesperacit quit () |
15:08:19 | NimEventer | New thread by SuaveSteve: Inferring type of zero-sized collection from usage, see https://forum.nim-lang.org/t/10437 |
15:30:37 | * | advesperacit joined #nim |
15:33:59 | * | Phytolizer quit (Quit: Client closed) |
16:03:52 | FromDiscord | <treeform> In reply to @heysokam "me neither, but my": Gennie's goal was to port pixie and my other libs to python, C and C++ (they are different), as well as ruby, js, and even zig. And even back to Nim through DLL interface. |
16:05:10 | FromDiscord | <treeform> In reply to @isofruit "In fact treeform apparently": Yes I love WebSocks, why would any one use REST? |
16:11:26 | * | lucasta quit (Quit: Leaving) |
16:14:22 | * | krux02 joined #nim |
16:20:09 | * | arkanoid joined #nim |
16:21:49 | arkanoid | is there a workaround to get a set[int64]? |
16:22:55 | arkanoid | I have this C flags field which is mapped to an int64_t https://arrow.apache.org/docs/format/CDataInterface.html#c.ArrowSchema.flags |
16:23:01 | qwr | odexine: old C might work, and might not - a lot of undefined behaviour was once kind-of defined |
16:24:09 | FromDiscord | <odexine> In reply to @arkanoid "is there a workaround": A set of size 64 is not the same as a set[type of size 64] |
16:24:37 | FromDiscord | <odexine> use set[0..63] for what you want |
16:25:00 | FromDiscord | <odexine> Or 1..64 if that works better for your mental model |
16:25:35 | arkanoid | odexine, but what will that be mapped to, in C code? |
16:25:43 | arkanoid | I need ABI compatibility |
16:27:21 | FromDiscord | <odexine> The internal representation is not specified so it may change at any time so it is probably better to manually construct a bit field from the set instead of relying on casting it into an int64 |
16:27:39 | FromDiscord | <odexine> But right now you can cast a set like that to an int64 and get the same behaviour |
16:28:08 | FromDiscord | <odexine> The first element of the type will set the first bit of the set’s internal representation |
16:28:13 | arkanoid | odexine, thanks. By "now" you mean is a new feature or something? |
16:28:39 | FromDiscord | <odexine> By now I mean right now, the internal representation could change in the future without warning |
16:28:58 | FromDiscord | <odexine> It’s been like this for a few years IIRC |
16:35:36 | arkanoid | odexine, thanks. I'm a bit confused on this subject as you can see |
16:37:32 | arkanoid | in this example https://nim-lang.org/1.4.0/manual.html#set-type-bit-fields MyFlag has sizeof(cint) which is 4, it means 32bits. If I do "set[cint]" I get Error: set is too large; use `std/sets` for ordinal types with more than 2^16 elements |
16:38:13 | arkanoid | why set[cint] doen't work, where set[MyFlag] does? |
16:39:25 | arkanoid | sizeof(MyFlag) == sizeof(cint) |
17:14:10 | arkanoid | I mean, this https://play.nim-lang.org/#ix=4EpU |
17:20:27 | FromDiscord | <.maverk> what is range[1..10] ????↵↵is it the same as doing 1..10 ??? |
17:39:14 | FromDiscord | <odexine> In reply to @arkanoid "in this example https://nim-lang.org/1.4.0/manual.h": Sets don’t just care about the size of the element but also the amount of values |
17:39:28 | FromDiscord | <odexine> There are however many values in an integer of size 32 bits |
17:39:43 | FromDiscord | <odexine> And a set has to store all of those values, with one bit per value |
17:39:58 | FromDiscord | <odexine> That is a few kilobytes if not a few megabytes for one set |
17:40:17 | FromDiscord | <odexine> If you use the enum you only have a few values |
17:41:00 | arkanoid | odexine, I think I got it now, thanks |
17:41:25 | arkanoid | it's just this line I yet have to grasp "The first element of the type will set the first bit of the set’s internal representation" |
17:42:05 | FromDiscord | <dersnof> what's good resources to understand macros |
17:42:33 | FromDiscord | <odexine> Basically it doesn’t matter what value the first element of the type is, be it 0 (for the type 0..10) or 15 (for 15..25) they will both set the first bit in a set of that type |
17:45:25 | FromDiscord | <Phil> sent a long message, see http://ix.io/4EpZ |
17:45:55 | FromDiscord | <dersnof> hmm i dont understand anything explained in nim tutorial page lol 🤔 weird |
17:56:32 | arkanoid | "const void** buffers" would be "ptr UncheckedArray[pointer]" or just "UncheckedArray[pointer]" ? |
17:57:49 | arkanoid | I'd guess the first |
18:05:17 | FromDiscord | <odexine> First |
18:07:08 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Eq3 |
18:07:40 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Eq3" => "https://play.nim-lang.org/#ix=4Eq4" |
18:08:58 | FromDiscord | <dersnof> hmm |
18:09:09 | arkanoid | thanks |
18:09:44 | * | junaid_ joined #nim |
18:10:23 | FromDiscord | <Phil> It's all just patterns of NimNodes to replicate in the end, where the order of a very specific amalgamation of specific NimNode-kinds determines what something means.↵There are tools to make generating those easier, such as `quote do`, but imo it makes sense to first wrap your head around that it's all just NimNode patterns. |
18:10:32 | FromDiscord | <Phil> (edit) "patterns." => "patterns by dealing with NimNodes directly." |
18:10:58 | FromDiscord | <Phil> Though that's just my perspective, it's how learning macros worked for me |
18:19:00 | FromDiscord | <dersnof> where did you read tutorial btw |
18:19:10 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Eq8 |
18:20:51 | FromDiscord | <Phil> In reply to @dersnof "where did you read": I didn't actually read the macro part of the nim tutorial, I just chatted with beef and during those I understood a couple underlying principles, after which I read The starting paragraphs of https://nim-lang.org/docs/macros.html and it started clicking togehter |
18:21:09 | FromDiscord | <Phil> (edit) "In reply to @dersnof "where did you read": I didn't actually read the macro part of the nim tutorial, I just chatted with beef and during those ... Istarted" added "chats" | "understood" => "started to understand" |
18:26:16 | FromDiscord | <catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4Eqd |
18:28:32 | FromDiscord | <Phil> In reply to @catnowblue "I am getting an": What's your typedef for RevoltClient look like? Are any of the seq's you use here `auto`'d ? |
18:28:38 | FromDiscord | <catnowblue> yes |
18:28:52 | FromDiscord | <catnowblue> if I add generic type like a base class, it will throw like invalid type |
18:29:20 | FromDiscord | <Phil> How do you expect the compiler to figure out whether to fill that seq with `seq[int]` or `seq[string]` or `seq[Potato]` if all it gets is an empty-seq with now type definition 😄 ? |
18:29:28 | FromDiscord | <Phil> (edit) "now" => "no" |
18:30:03 | FromDiscord | <catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4Eqe |
18:30:22 | FromDiscord | <catnowblue> (edit) "https://play.nim-lang.org/#ix=4Eqe" => "https://play.nim-lang.org/#ix=4Eqf" |
18:30:28 | FromDiscord | <Phil> Your problem here is that the compiler never gets told "Well, this seq is a seq[Bla]".↵Just `seq` doesn't tell the compiler enoug, it must be able to figure out the specific type as necessary |
18:31:23 | FromDiscord | <catnowblue> here's an error |
18:31:24 | FromDiscord | <catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4Eqg |
18:31:31 | FromDiscord | <catnowblue> ReadyEvent is a child of a class |
18:32:32 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Eqi |
18:32:52 | FromDiscord | <catnowblue> ooh |
18:32:58 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Eqi" => "https://play.nim-lang.org/#ix=4Eqj" |
18:32:59 | FromDiscord | <Phil> Generics are a lie |
18:33:01 | FromDiscord | <Phil> They are not real |
18:33:10 | FromDiscord | <Phil> They are just templates you hand to the compiler for copy pasting |
18:33:15 | FromDiscord | <catnowblue> damn I think tutorials never told me for this |
18:33:42 | FromDiscord | <Phil> It's one of those more fundamental principles that need to grok with you first but that imo aren't that "easy" to understand |
18:35:21 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Eqm |
18:35:33 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Eqm" => "https://play.nim-lang.org/#ix=4Eqn" |
18:36:01 | FromDiscord | <catnowblue> isn't an union simply a solution for this? like how it goes in typescript? |
18:36:02 | FromDiscord | <Phil> The generic is used to generate new procs as needed.↵`proc x(y: auto): string = "Potato"` is just a shorthand for the `x[T](y: T): string` way of writing it |
18:36:07 | FromDiscord | <catnowblue> (edit) "isn't an union ... simply" added "type" |
18:39:20 | FromDiscord | <catnowblue> so how am I suppose to store array with exact same class except their method is a different type? |
18:39:20 | FromDiscord | <Phil> In reply to @catnowblue "isn't an union type": Nim, unlike typescript, has a limitation here:↵It must always generate fully typed code in the end - Typescript can weasel out of that in the end with any/unknown etc.). Nim can not. Nim may be able to use trickery or smart thinking to infer the type or use copy-paste instructions to generate explicit procs on the fly, but when everything is said and done everything in Nim must be comp |
18:39:37 | FromDiscord | <catnowblue> do I have to write every single event type just for that? |
18:39:48 | FromDiscord | <Phil> There's 2 ways:↵Either use Object variants or dynamic dispatch aka methods |
18:39:55 | FromDiscord | <Phil> (edit) "There's 2 ways:↵Either use Object variants or dynamic dispatch aka methods ... " added "and inheritance" |
18:39:59 | FromDiscord | <catnowblue> oh ok |
18:40:14 | FromDiscord | <catnowblue> I'm not sure what methods actually means |
18:40:17 | FromDiscord | <Phil> Object variants is the procedural way, polymorphism and inheritance the OO way. |
18:41:06 | FromDiscord | <Phil> Err that one goes a bit into a deeper subject of static dispatch vs. dynamic dispatch. |
18:41:49 | FromDiscord | <Phil> Which I'm not great at explaining because I'm only spending a fraction of my time dealing with it and basically only know enough that I know what to expect to happen at various points, but never had to do a deep dive. |
18:41:56 | FromDiscord | <_gumbercules> well, you can use parametric polymorphism in Nim without relying on inheritance |
18:42:10 | FromDiscord | <_gumbercules> parameteric polymorphism + concepts will get you a long way |
18:42:21 | FromDiscord | <catnowblue> what https://media.discordapp.net/attachments/371759389889003532/1144340938664202382/image.png |
18:42:27 | FromDiscord | <Phil> Note that the knowledge base you're working with here seems like typescript ^^ |
18:42:32 | FromDiscord | <Phil> (edit) "^^" => "Gumb^^" |
18:42:38 | FromDiscord | <_gumbercules> mmm |
18:42:44 | FromDiscord | <catnowblue> In reply to @isofruit "Note that the knowledge": yes I am typescript |
18:42:45 | FromDiscord | <Chronos [She/Her]> Revolt? For revolt.chat? Just stuck out to me so I commented on it lol |
18:42:47 | FromDiscord | <_gumbercules> I'd advise against using `method` |
18:42:52 | FromDiscord | <catnowblue> In reply to @chronos.vitaqua "Revolt? For revolt.chat? Just": revolt.chat |
18:42:55 | FromDiscord | <_gumbercules> unless you really need to |
18:43:14 | FromDiscord | <Chronos [She/Her]> In reply to @catnowblue "revolt.chat": Eyyy |
18:43:16 | FromDiscord | <catnowblue> I attempt to write an API wrapper for Revolt.chat |
18:43:20 | FromDiscord | <catnowblue> written in Nim |
18:43:30 | FromDiscord | <catnowblue> currently I am stuck with event handlers, like things you know |
18:43:48 | FromDiscord | <Chronos [She/Her]> In reply to @catnowblue "what": Is there any reason why you can't use a proc here? |
18:43:54 | FromDiscord | <catnowblue> I know I could just do it untype, but the experience for other devs using my wrapper won't be good |
18:44:04 | FromDiscord | <Chronos [She/Her]> Untyped? What? |
18:44:14 | FromDiscord | <_gumbercules> Okay here's the fundamental difference - in object oriented languages you're associating methods with objects |
18:44:22 | FromDiscord | <catnowblue> In reply to @chronos.vitaqua "Untyped? What?": previous event handler I used doesn't use typed arguments |
18:44:28 | FromDiscord | <_gumbercules> and what method to invoke is determined at runtime dynamically - thus the dynamic dispatch |
18:44:42 | FromDiscord | <catnowblue> ooh |
18:44:50 | FromDiscord | <_gumbercules> this is because objects can inherit form one another and override the implementation of a method that's defined in the type they're inheriting from |
18:45:11 | FromDiscord | <_gumbercules> so if I have type A and type B inerhits from type A and they both define the proc `hello` - which `hello` do I invoke? A's or B's? |
18:45:39 | FromDiscord | <Phil> In reply to @catnowblue "what": Yeah the polymorphic way would be to not use generics at all and instead have explicit methods for each set of types you want to support in RevoltChat.↵The procedural way is pretty much object variants where a given object may be a limited set of N things at the same time and you need to deal with all of them everytime you want to use it |
18:45:44 | FromDiscord | <_gumbercules> now, procedural languages like C and Nim tend not to focus on objects or classes and instad focus on value types which are reperesnted as structs |
18:45:54 | FromDiscord | <_gumbercules> in C and just plain `object` in Nim |
18:46:06 | FromDiscord | <catnowblue> very interesing |
18:46:10 | FromDiscord | <_gumbercules> procs aren't like methods in that they're not associated with a givent ype or class |
18:46:15 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Eqr |
18:46:26 | FromDiscord | <_gumbercules> so there is no dynamism in terms of what procedure will be invoked |
18:46:32 | FromDiscord | <_gumbercules> bedcause objects can't inherit from one another |
18:46:41 | FromDiscord | <catnowblue> In reply to @chronos.vitaqua "Okay, so to pass": I'll check out that |
18:46:49 | FromDiscord | <_gumbercules> at least no tin the same way you can with `ref object`s in Nim |
18:47:27 | FromDiscord | <_gumbercules> to solve that lack of ability, people use generics or parametric polymorphism, object variants and concepts all which allow you to overcome certain aspects of this limitation |
18:47:40 | FromDiscord | <_gumbercules> generics or parametric polymorphism lets you define a procedure that can work wtih a number of types |
18:47:42 | FromDiscord | <Chronos [She/Her]> Because `typ` stores the exact type of event it is, you know what event it is exactly, and can use it as the appropriate type by using the enum to tell you which one it is |
18:47:52 | FromDiscord | <Chronos [She/Her]> In reply to @_gumbercules "to solve that lack": Generics also work for this yeah |
18:48:00 | FromDiscord | <_gumbercules> so something like `add[T](x, y: T): T)` |
18:48:06 | FromDiscord | <_gumbercules> (edit) "T)`" => "T`" |
18:48:17 | FromDiscord | <Phil> In reply to @chronos.vitaqua "Okay, so to pass": Minor correction:↵The enum ends in `Types` meanwhile the typ-type ends in `Type` |
18:48:37 | FromDiscord | <_gumbercules> concepts let you define an abstract type with certain constraints that each type which implements that abstract type will be checked for against |
18:49:03 | * | junaid_ quit (Remote host closed the connection) |
18:49:21 | FromDiscord | <Phil> (Honestly I'd leave concepts out of this one for now, the entire reasoning as to why doing dynamic-type-stuff in nim is hard is already throwing the book at them imo and requires some figuring out) |
18:49:36 | FromDiscord | <catnowblue> damn |
18:49:36 | FromDiscord | <_gumbercules> so I could have an abstract type named `Calculator` which could require that any implementation exhibit an `add` function - then I could have a `NumberCalculator` that has an `add` function that adds two numbers |
18:49:43 | FromDiscord | <catnowblue> anyway thanks you guys |
18:49:48 | FromDiscord | <_gumbercules> sure thing |
18:50:37 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "Minor correction: The enum": Ah sorry about that lol |
18:51:51 | FromDiscord | <Chronos [She/Her]> In reply to @catnowblue "anyway thanks you guys": Of course! |
18:52:15 | FromDiscord | <Chronos [She/Her]> In reply to @_gumbercules "concepts let you define": Yk I should really look into using concepts |
18:52:47 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Equ |
18:52:56 | FromDiscord | <Chronos [She/Her]> Unrelated but I wonder if there's a library that makes async and threaded code play nicely together and why it would/wouldn't work great |
18:53:09 | FromDiscord | <Phil> (edit) "http://ix.io/4Equ" => "https://paste.rs/wNFcn" |
18:53:18 | FromDiscord | <catnowblue> I understand the actual typescript's typing |
18:53:31 | FromDiscord | <catnowblue> it exist only in the compiler, not in runtime |
18:53:56 | FromDiscord | <catnowblue> and to make it still enforce, you had to add third-party library like z to detect it |
18:54:25 | FromDiscord | <Phil> Yeh, that was folks adding typing back in to a dynamic language because it got really tiring checking that the input parameters were actually the type you needed ^^ |
18:55:16 | FromDiscord | <Phil> Folks wanted to have the guarantees that static typing provides.↵The harder you are with your rules, the more guarantees you can give, but at the same time some stuff, particularly doing dynamic stuff, becomes harder in return |
18:55:30 | FromDiscord | <catnowblue> damn I see |
18:56:45 | FromDiscord | <Phil> And it is not like javascript doesn't, right before execution, needs to have figured out what type a thing will be.↵It's just that it isn't javascript that has to figure that stuff out, it's the engine that does, you shifted dealing with types basically into the so called "runtime" of javascript |
18:57:13 | FromDiscord | <Phil> (edit) "javascript" => "javascript, so that you never get to see it." |
18:57:14 | FromDiscord | <catnowblue> yeah |
18:57:35 | FromDiscord | <catnowblue> the easiest to discard is to add `any` or `unknown` anywhere |
18:58:45 | FromDiscord | <Phil> Nah I meant even ignoring typescript.↵When javascript instructs your CPU to add 5 and 9 together, somebody must have figured out somewhere that these are both numbers to add together |
18:58:51 | FromDiscord | <Phil> That somebody is the JS runtime. |
18:58:58 | FromDiscord | <Phil> (edit) "runtime." => "runtime (completely unrelated to typescript)." |
18:59:03 | FromDiscord | <Chronos [She/Her]> The JIT |
18:59:22 | FromDiscord | <Chronos [She/Her]> Oh I had someone argue that JS is a JIT language and not an interpreted language |
18:59:27 | FromDiscord | <Phil> Wait is my terminology crap there in calling the JIT a runtime? |
18:59:41 | FromDiscord | <Chronos [She/Her]> 🤷♀️ |
19:00:15 | FromDiscord | <Chronos [She/Her]> Tbf we should be using JIT as an adjective and not as a noun too |
19:00:30 | FromDiscord | <Phil> In reply to @catnowblue "the easiest to discard": Anyway, back on topic:↵The JS has the JS runtime/JIT to deal with figuring out types and stuff for it - nim does not have this luxury as it deals with the CPU directly. |
19:00:57 | FromDiscord | <Phil> (edit) "In reply to @catnowblue "the easiest to discard": Anyway, back on topic:↵The JS has the JS runtime/JIT to deal with figuring out types and stuff for it ... -" added "before things get sent to the CPU for calculations" |
19:01:40 | FromDiscord | <Phil> (edit) "topic:↵The JS" => "topic:↵JS" |
19:01:52 | arkanoid | damn, I'm failing to make sizeof set[MyFlags] == 8 |
19:03:06 | arkanoid | how can I tell nim compiler I want to OR up to 64 values, even if I have just 3 in MyFlags? it's for C interoperability |
19:03:46 | Amun-Ra | set[] for C interop? |
19:04:01 | * | azimut joined #nim |
19:04:42 | FromDiscord | <Phil> In reply to @chronos.vitaqua "Tbf we should be": Shouldn't it be JITC? |
19:04:47 | FromDiscord | <Phil> just in time compiler? |
19:05:04 | FromDiscord | <Chronos [She/Her]> Yeah exactly |
19:06:58 | FromDiscord | <.maverk> In reply to @.maverk "what is range[1..10] ????": guys you didn't answer me |
19:07:28 | FromDiscord | <catnowblue> alright, this is the only viable response, just force typing into it no matter what anyway https://media.discordapp.net/attachments/371759389889003532/1144347257915838696/image.png |
19:08:20 | FromDiscord | <Phil> In reply to @catnowblue "alright, this is the": As stated, maybe object variants will also help you there if you need different types of fields on the object for different types of responses |
19:08:33 | FromDiscord | <Phil> But happy that you're finding your way forward slowly 😄 |
19:08:33 | FromDiscord | <Chronos [She/Her]> In reply to @.maverk "guys you didn't answer": Ah sorry, no idea tbh |
19:08:40 | FromDiscord | <Chronos [She/Her]> Never used `range` |
19:09:11 | FromDiscord | <Chronos [She/Her]> In reply to @catnowblue "alright, this is the": Huh? Why can't your event handler dispatch the correct type? |
19:10:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Eqy |
19:10:38 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Eqy" => "https://play.nim-lang.org/#ix=4Eqz" |
19:10:40 | FromDiscord | <Chronos [She/Her]> Tbh I should work on my own event handler library |
19:11:04 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Eqz" => "https://play.nim-lang.org/#ix=4EqA" |
19:11:04 | FromDiscord | <Chronos [She/Her]> Especially if I'm working on a chat app...but also, I feel like events will be very expensive to handle over time.... |
19:11:09 | FromDiscord | <Chronos [She/Her]> Don't see a way around it though |
19:11:39 | FromDiscord | <catnowblue> In reply to @chronos.vitaqua "Tbh I should work": you could, with typed arguments and whatsoever |
19:11:55 | FromDiscord | <catnowblue> I've found one event handler library and it was directly imported from javascript |
19:11:59 | FromDiscord | <catnowblue> (edit) "javascript" => "nodejs" |
19:12:17 | FromDiscord | <Chronos [She/Her]> I actually have a synchronous event library that works, but the async parts were less great |
19:12:20 | FromDiscord | <Phil> Oh this is for compiling nim to JS? |
19:12:23 | FromDiscord | <Chronos [She/Her]> I can definitely fix that though |
19:12:39 | FromDiscord | <catnowblue> In reply to @isofruit "Oh this is for": I'm not compiling nim to js |
19:12:45 | FromDiscord | <catnowblue> compiling to C machine code |
19:12:47 | FromDiscord | <demotomohiro> @Arkanoid https://github.com/nim-lang/Nim/issues/21789 |
19:12:48 | FromDiscord | <catnowblue> (edit) "compiling to C machine code ... " added "executable" |
19:13:39 | FromDiscord | <Phil> ... you can compile nim to C while importing libs from nodejs? |
19:14:14 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "... you can compile": That sounds painful and not great |
19:14:23 | FromDiscord | <Phil> I mean, if it even works |
19:15:20 | FromDiscord | <Phil> Like I have no concept on if it would work because the nodejs lib-code relies on having a runtime so somebody needs to provide that.↵Where that'd come from I have no clue, so my first assumption si that it doesn't work.↵But maybe some poor soul implemented some way to provide one in these scenarios? No idea |
19:15:48 | FromDiscord | <Chronos [She/Her]> https://github.com/Nimberite-Development/Trigger-Nim here is my event library rn, not super great, but I think I'll actually work on it right now- |
19:16:13 | * | azimut quit (Remote host closed the connection) |
19:16:30 | * | azimut joined #nim |
19:17:55 | FromDiscord | <Chronos [She/Her]> Was originally gonna be used for my MC server impl which I lost the energy for, for now aha |
19:20:36 | FromDiscord | <Chronos [She/Her]> Is it possible to accept a generic proc? That can have any arguments or return type? |
19:32:21 | FromDiscord | <Phil> In reply to @chronos.vitaqua "Is it possible to": Accept in what sense? |
19:33:52 | FromDiscord | <Phil> Note that generic procs aren't real, they're only there to generate "real" procs.↵You can of course accept procs of a specific type and have those be a generic parameter, such as ↵`proc myProc[T](otherProc: proc(x: T))`, but that's less accepting a specific other generic proc and more you having a generic proc yourself that in general accepts procs of the type that your first generic proc can generate. |
19:34:27 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "Accept in what sense?": Using it as a required type, like uhhh `type A[T: proc] = object` so that `T` has to be a proc of some kind |
19:39:11 | FromDiscord | <Phil> In reply to @chronos.vitaqua "Using it as a": Wait, you want to accept literally any proc ? |
19:39:37 | FromDiscord | <Phil> Oh wait, no, you just want to be generic over procs, damn I'm tired |
19:40:09 | FromDiscord | <Phil> Honestly I'm not sure, you can be generic over `object` and `ref object`... what does the compiler say? |
19:40:21 | FromDiscord | <catnowblue> In reply to @catnowblue "alright, this is the": actually since the websocket accepts json, I'm just gonna use JsonNode and it can convert to any type with jsony |
19:40:42 | FromDiscord | <catnowblue> a bit more raw for API wrapper, but at least it works |
19:41:27 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EqG |
19:42:13 | FromDiscord | <Phil> In reply to @catnowblue "actually since the websocket": I highly recommend just using jsony from the jump without going over JsonNode.↵2 reasons:↵1) It's faster to go JSON string => Nim type↵2) I don't like JsonNode and you don't have to deal with an object variant so that's also a plus |
19:42:32 | FromDiscord | <Phil> (edit) "In reply to @catnowblue "actually since the websocket": I highly recommend just using jsony from the jump without going over JsonNode.↵2 reasons:↵1) It's faster to go JSON string => Nim ... type↵2)" added "type rather than JSON string => JsonNode => Nim" |
19:43:15 | FromDiscord | <catnowblue> problem with jsony is that it omitted other values outside of accepted values in a class, as I described below |
19:43:16 | FromDiscord | <Phil> Ohhh wait, I didn't think this through, you want JSONNode to encode all kinds of types |
19:43:19 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4EqH |
19:43:23 | FromDiscord | <catnowblue> yes |
19:43:30 | FromDiscord | <catnowblue> that's what I mean |
19:43:52 | FromDiscord | <catnowblue> (edit) "below" => "above" |
19:43:54 | FromDiscord | <Phil> Fair.↵Note that JsonNode is basically an object variant for all kinds of things.↵You can write your own object variant to only have to deal with the specific things you want to allow |
19:43:59 | FromDiscord | <Phil> Customize it a bit basically |
19:44:07 | FromDiscord | <catnowblue> interesing |
19:44:30 | FromDiscord | <Phil> It's not really hard to write your own Object variant for a list of the basic types and if you e.g. have no use for JObject and JArray you can just leave those out |
19:46:10 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EqI |
19:46:26 | FromDiscord | <Phil> Names for everything are of course freely chooseable, the entire "Kind" thing is more convention than anything |
19:47:01 | FromDiscord | <Phil> The above variant will always be one of the three specified kinds and thus either have the fields (kind, myStr), (kind, myNum) or (kind, myFloat) |
19:48:16 | FromDiscord | <Phil> Note that accessing `myNum`on an object variant where the kind is `str` will result in an error (same for a JsonNode where you try to get its int value when it actually is of kind JStr etc.) |
19:50:13 | FromDiscord | <catnowblue> interesing |
19:53:25 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4EqK |
19:53:51 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4EqL |
19:57:20 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EqN |
19:57:30 | FromDiscord | <heysokam> its `case kind: MyKind of ....` |
19:57:49 | FromDiscord | <Phil> Oh god damn, literally mixed up case and of |
19:57:56 | FromDiscord | <heysokam> yep |
19:58:20 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EqO |
19:58:27 | FromDiscord | <Phil> (For any future reader, not you sOkam!) |
20:08:40 | FromDiscord | <heysokam> why everyone else and not me, what have i done :sadge: |
20:08:49 | FromDiscord | <heysokam> 😄 |
20:14:00 | FromDiscord | <Phil> You corrected me! How dare you! 😛 |
20:34:00 | NimEventer | New thread by iffy1: Circular imports for procs, see https://forum.nim-lang.org/t/10438 |
20:34:26 | * | jmdaemon joined #nim |
20:41:42 | * | xet7_ joined #nim |
20:45:38 | * | xet7 quit (Ping timeout: 246 seconds) |
20:50:43 | FromDiscord | <firasuke> So is updating a project to Nim 2.0.0 just that seemless lol |
21:06:02 | * | xet7__ joined #nim |
21:08:21 | * | anddam left #nim (WeeChat 4.0.1) |
21:09:36 | * | xet7_ quit (Ping timeout: 260 seconds) |
21:10:40 | * | advesperacit quit () |
21:10:44 | FromDiscord | <Phil> Depends:↵If you do webdev chances are you'll get fairly inconvenienced by the entire db_connector move |
21:11:28 | FromDiscord | <Elegantbeef> In most cases it's as simple as just recompiling, but given the features of Orc you likely should rewrite code to optimise or use the new hooks |
21:13:58 | FromDiscord | <Chronos [She/Her]> Question: Is there a way to do something like `unpackVarargs` but with a normal tuple? |
21:14:18 | FromDiscord | <Elegantbeef> Of course, but what are you doing |
21:15:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Er8 |
21:15:27 | FromDiscord | <Chronos [She/Her]> Event system that allows for firing events with any parameters given |
21:16:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Er9 |
21:16:03 | FromDiscord | <Elegantbeef> But go write your macro |
21:16:22 | FromDiscord | <Andreas> In reply to @Elegantbeef "In most cases it's": hiho, regarding `toOpenArray`, i found lots of infos from you on the channel - is it still true that a `var openArray` on the receiving-side is the recommende [ reference from may.23 ] https://discord.com/channels/371759389889003530/371759389889003532/1104910311141675030↵or would you know some doc/writeup on this topic ? or in your code-repos ? |
21:16:26 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Personally I'd just say": That's not exactly nice for users to define their system around imo lol, so yeah I'll probably just use a macro |
21:39:32 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Erc |
21:39:33 | FromDiscord | <Chronos [She/Her]> Gonna try it now |
21:42:58 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Ere |
21:44:24 | * | xet7__ is now known as xet7 |
21:44:55 | * | xet7 quit (Quit: Leaving) |
21:45:18 | * | xet7 joined #nim |
21:50:50 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1144388373474193478/423w.PNG |
21:51:03 | FromDiscord | <.maverk> can you guys give me a link to the ptr math library |
21:51:06 | FromDiscord | <.maverk> i cannot find it |
21:51:18 | FromDiscord | <Elegantbeef> There is no ptr math in the stdlib |
21:51:28 | FromDiscord | <.maverk> where is it then ? |
21:52:28 | FromDiscord | <Elegantbeef> https://nimble.directory/search?query=ptr+math |
21:53:35 | FromDiscord | <.maverk> i found it |
21:54:39 | FromDiscord | <Elegantbeef> I'd hope so |
21:55:13 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1144389475569512448/eew.PNG |
21:57:34 | FromDiscord | <Andreas> good evening beef would you know how to import all nim-files from a directory ? - in all fairness - would'nt that be cool ? i guess i'd ask 'cos it was while since that came up 🙂 and @Mirai did'nt you install it that great `ptr_math` this afternoon ? |
21:57:48 | FromDiscord | <Andreas> (edit) removed "it" |
21:58:08 | FromDiscord | <.maverk> In reply to @Andreas "good evening beef would": yes |
21:58:18 | FromDiscord | <.maverk> and should look at the docs to learn it ? |
21:58:19 | FromDiscord | <Elegantbeef> There is no built in way you need to use a macro |
21:58:52 | FromDiscord | <.maverk> (edit) "and should ... look" added "not" |
21:59:25 | FromDiscord | <firasuke> In reply to @Elegantbeef "In most cases it's": Oh how would I make use of the new features |
22:00:28 | FromDiscord | <Andreas> In reply to @Elegantbeef "There is no built": sry, just kidding - but the `ptr_math`-lib to me is a bit like, giving your kids the key to the closet where you keep the adult-movies and then saying "don't try this with the neigbours' daughter". |
22:02:43 | FromDiscord | <ElegantBeouf> <@&371760044473319454> someone on matrix shared a very suspicously named file |
22:03:13 | FromDiscord | <ElegantBeouf> Comically I think that killed the matrix bridge |
22:03:28 | FromDiscord | <ElegantBeouf> In reply to @firasuke "Oh how would I": You'd implement hooks if you were manually doing RAII before, or annotate parameters as sink where applicable |
22:03:55 | FromDiscord | <Phil> Test |
22:03:58 | FromDiscord | <Phil> We're live |
22:04:54 | FromDiscord | <Elegantbeef> hmmm |
22:04:54 | FromDiscord | <Elegantbeef> The hell |
22:04:54 | FromDiscord | <Phil> It appears the bridge doesn't like you specifically beef |
22:04:55 | FromDiscord | <Phil> wait nevermind I'm locked out as well |
22:04:55 | FromDiscord | <Yepoleb> ☹️ |
22:04:59 | FromDiscord | <Elegantbeef> There we go |
22:05:20 | FromDiscord | <Yepoleb> just bridge things |
22:07:35 | FromDiscord | <Elegantbeef> Anywho andreas `ptrmath` is just a more type unsafe `ptr UncheckedArray[T]` |
22:07:36 | FromDiscord | <Andreas> In reply to @.maverk "and should not look": reading the docs is a really a good idea, go on, but AFAIR that lib might not be nim-version-2-ready - so-to-say maybe u get in trouble. |
22:07:53 | FromDiscord | <Elegantbeef> Meh it just implements operators for `ptr T` |
22:09:45 | FromDiscord | <Andreas> In reply to @Elegantbeef "Meh it just implements": i was thinking maybe consulting the nim-manuals upfront, so to learn a bit about nimble and all the other stuff.. |
22:12:08 | FromDiscord | <Elegantbeef> Hey I'm not going to say no to learning 😄 |
22:15:05 | FromDiscord | <Andreas> In reply to @Elegantbeef "Hey I'm not going": leasrning - i learned from a CppCon-video with the honorable Herb Sutter, that he's from Canada. When he was asked, he responded "I'm from Canada - i am a Canakki" 🙂 do you spell 'canakki' like so ? |
22:19:26 | FromDiscord | <Elegantbeef> I don't even know what canakki is supposed to mean |
22:23:49 | FromDiscord | <Andreas> In reply to @Elegantbeef "I don't even know": well, i guess its a funny notion that somebody is a born canadian-citizen - i'm just asking as i was suprised about the term - we have a very similar word here in germany - here its a strong course-word against foreigners - i'd not recommend to use in public. |
22:24:28 | FromDiscord | <Elegantbeef> Wait what's so funny about being born here |
22:26:03 | FromDiscord | <Andreas> In reply to @Elegantbeef "Wait what's so funny": well, i can't tell - but the CppCon-audience was laughing when he self-described as a 'canaki', maybe ? |
22:27:06 | FromDiscord | <Elegantbeef> Got a timestamped video? 😄 |
22:28:33 | FromDiscord | <Elegantbeef> Wait did he say "canuck"? |
22:28:56 | FromDiscord | <Andreas> In reply to @Elegantbeef "Got a timestamped video?": was one of his more-recent, where descibes his `cppfron`-project - which BTW to me is like - make C++ alike Nim in the 2020's. |
22:29:37 | FromDiscord | <Andreas> In reply to @Elegantbeef "Wait did he say": it was a video - he spoke and ive no idea how to spell it out.. |
22:30:12 | FromDiscord | <Elegantbeef> https://dictionary.cambridge.org/us/pronunciation/english/canuck |
22:30:20 | FromDiscord | <Andreas> (edit) "In reply to @Elegantbeef "Wait did he say": it was a video - he spoke and ive no idea how to spell it out.. ... " added "- so maybe 'canuck' -> so thats along kayaking/boating.." |
22:31:15 | FromDiscord | <Elegantbeef> Canuck quite literally just means Canadian, but it has some comedic associations due to stereotypes |
22:32:42 | FromDiscord | <Andreas> In reply to @Elegantbeef "Canuck quite literally just": is the comocal-part, along the lines : "somebody with or in a canooe/kayak" ? |
22:32:57 | FromDiscord | <Andreas> (edit) "comocal-part," => "comical-part," |
22:33:32 | FromDiscord | <Andreas> (edit) "In reply to @Elegantbeef "Canuck quite literally just": is the comical-part, along the lines : "somebody with or in a canooe/kayak" ? ... " added "or other stereotypes ?" |
22:34:29 | FromDiscord | <Elegantbeef> No |
22:36:35 | FromDiscord | <Elegantbeef> https://youtu.be/04u58ifxmRA is likely what most people think about when they hear "Canuck" |
22:42:36 | FromDiscord | <Elegantbeef> Without seeing the video it very likely is he said "I'm a Canuck, eh" and you merged the `Canuck` and `eh` together |
22:43:06 | FromDiscord | <Elegantbeef> More suspiciously named files @Phil @yepoleb |
22:44:40 | FromDiscord | <Elegantbeef> But there we go @Andreas we solved the riddle of what was funny, of course it takes a german to wring all the comedy out of it |
22:47:18 | FromDiscord | <Andreas> In reply to @Elegantbeef "https://youtu.be/04u58ifxmRA is likely what": thx, super-funny, a bit alike Beavis & Butthead, really like it, these dudes have some serious fun - and beer and its ingredients - 'cmon that a seroius matter around here, too 🙂 |
22:48:36 | FromDiscord | <Elegantbeef> And phil make sure you report the user when you ban them |
22:48:40 | FromDiscord | <Elegantbeef> Even though they're using new users it atleast can get that account banned from the matrix home server |
22:48:45 | FromDiscord | <Andreas> (edit) "In reply to @Elegantbeef "https://youtu.be/04u58ifxmRA is likely what": thx, super-funny, a bit alike Beavis & Butthead, really like it, these dudes have some serious fun - and beer and its ingredients - 'cmon that a seroius matter around here, too 🙂 ... " added "- i need to look th Sutter-vid up in zotero" |
22:49:58 | FromDiscord | <Elegantbeef> I'm betting that in all likely hood he said what I said and falling into the Canadian stereotype is what caused laughter, but your German ear only heard a single word and missed the stereotype, no point searching for it! |
23:01:01 | * | xet7_ joined #nim |
23:04:18 | * | xet7 quit (Ping timeout: 246 seconds) |
23:15:58 | FromDiscord | <heysokam> Is there something I can read to understand nim methods? |
23:15:59 | FromDiscord | <firasuke> In reply to @elegantbeef "You'd implement hooks if": Oh ok thanks |
23:16:25 | FromDiscord | <firasuke> By the way did the nimble packages website receive an update, it looks much better now |
23:16:32 | FromDiscord | <Elegantbeef> It did |
23:16:52 | FromDiscord | <Elegantbeef> https://github.com/georgelemon was the one behind the redesign |
23:18:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Ery |
23:25:48 | FromDiscord | <heysokam> @ElegantBeouf can you think of something that requires method and cannot be done with just procs? 🤔↵Struggling to think of a single use for the concept that cannot be done without them |
23:26:05 | FromDiscord | <Elegantbeef> Runtime polymorphism |
23:26:37 | FromDiscord | <heysokam> k, i will reword↵can you think of something (with an example) that... |
23:26:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ErA |
23:26:57 | FromDiscord | <Elegantbeef> There you go an example and everything |
23:27:20 | FromDiscord | <heysokam> why can you store different types in an array? |
23:27:21 | FromDiscord | <Elegantbeef> Runtime polymorphism requires object variants to replace, but in that case it requires changing the variant every single time |
23:27:33 | FromDiscord | <Elegantbeef> Runtime polymorphism |
23:27:34 | FromDiscord | <Elegantbeef> Inheritance |
23:27:38 | FromDiscord | <Elegantbeef> That's like the entire point of it |
23:27:53 | FromDiscord | <heysokam> yeah but they are different types. i thought that wasn't legal in any case |
23:28:14 | FromDiscord | <Elegantbeef> `B` is implicitly converted to `A` since the array is `array[2, A]` |
23:28:35 | FromDiscord | <etra> nim get's to decided when to build a VT? |
23:28:38 | FromDiscord | <heysokam> ic |
23:28:48 | FromDiscord | <Elegantbeef> In Nim inheritance allows freely upcasting |
23:29:03 | FromDiscord | <Elegantbeef> > nim get's to decided when to build a VT?↵Now try english |
23:29:33 | FromDiscord | <etra> lmao |
23:29:36 | FromDiscord | <etra> can't type shit today |
23:29:43 | FromDiscord | <etra> nim gets to decide when to build a virtual table? |
23:29:54 | FromDiscord | <Elegantbeef> Nim doesnt use a vtable |
23:29:59 | FromDiscord | <Elegantbeef> Nim presently uses case statements |
23:30:03 | FromDiscord | <etra> huh, then how it does rtti |
23:30:30 | FromDiscord | <Elegantbeef> Use a case statement and hope the compiler optimises it into a jump table |
23:30:57 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/pull/21342 ringabout did have this PR to add vtables |
23:31:13 | FromDiscord | <etra> > A↵> A |
23:31:30 | FromDiscord | <Elegantbeef> > B↵> B |
23:31:47 | FromDiscord | <etra> I guess to get B you should use method? |
23:32:03 | FromDiscord | <.maverk> does nim check everything at compile time ? |
23:32:19 | FromDiscord | <Elegantbeef> That is the point of dynamic dispatch and why I wrote that example |
23:32:29 | FromDiscord | <Elegantbeef> How else does a statically compiled language do things |
23:33:01 | FromDiscord | <.maverk> are you replying me ? |
23:33:07 | FromDiscord | <Elegantbeef> Yes |
23:33:17 | FromDiscord | <Elegantbeef> Well the second sentence was |
23:33:21 | FromDiscord | <Elegantbeef> The first sentence was to etra |
23:33:38 | FromDiscord | <etra> I'm fucking dumb |
23:33:43 | FromDiscord | <etra> he was asking of a counterexample of methods |
23:33:45 | FromDiscord | <etra> lmao |
23:33:49 | FromDiscord | <etra> need. more. coffee |
23:33:50 | FromDiscord | <Chronos [She/Her]> Haha I distracted myself from my original goal- |
23:34:08 | FromDiscord | <etra> (edit) "of" => "for" |
23:34:36 | FromDiscord | <.maverk> In reply to @Elegantbeef "Yes": i am just asking |
23:34:46 | FromDiscord | <.maverk> there are some hidden stuff |
23:35:37 | FromDiscord | <heysokam> also, talking about inheritance. is inheritance possible with --mm:none?↵does inheritance depend on the `object of` or on the `ref object` part of the declaration?↵I've always seen both used at the same time, so I assume they both must be there. But wonder if there is only the need for the `of` 🤔 |
23:37:07 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4ErC |
23:37:24 | FromDiscord | <Chronos [She/Her]> All my code actually fits within 2000 chars as well as the error, shocking- |
23:41:34 | FromDiscord | <Elegantbeef> Why make a small repro when you can make two files and keep things that do work in! |
23:42:00 | FromDiscord | <Chronos [She/Her]> It's structured in a Nimble project aha- |
23:42:11 | FromDiscord | <Elegantbeef> And on top of it share code that compiles and runs |
23:42:25 | FromDiscord | <Chronos [She/Her]> Oh I can do that easily |
23:42:28 | FromDiscord | <Chronos [She/Her]> Hold on |
23:42:30 | FromDiscord | <Elegantbeef> Whoops nvm that's on me |
23:44:35 | FromDiscord | <etra> what's the function of the colon when setting the types? |
23:44:47 | FromDiscord | <etra> i.e. in here: `eventSystem.fire[:ListenerProc, (int,)]((2,))` |
23:44:58 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#templates-limitations-of-the-method-call-syntax |
23:45:10 | FromDiscord | <Chronos [She/Her]> https://play.nim-lang.org/#ix=4ErD |
23:46:36 | FromDiscord | <Chronos [She/Her]> In reply to @etra "i.e. in here: `eventSystem.fire[:ListenerProc,": Here it's actually completely redundant lol and I did it just to show that the types line up and stuff |
23:47:10 | FromDiscord | <Elegantbeef> args doesnt have a length it's just a symbol |
23:47:26 | FromDiscord | <Chronos [She/Her]> Ah- |
23:48:04 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4ErE |
23:48:06 | FromDiscord | <Elegantbeef> Works fine |
23:49:09 | FromDiscord | <Chronos [She/Her]> `newlit` meaning a new literal I'd guess |
23:49:31 | FromDiscord | <Elegantbeef> Right, it can be used for any type emitting the nim literal equivlent |
23:49:36 | FromDiscord | <Chronos [She/Her]> Why would I need the bracket expression btw? |
23:49:50 | FromDiscord | <Elegantbeef> Cause that's how you access tuple fields |
23:49:58 | FromDiscord | <Chronos [She/Her]> Aah okay that makes sense |
23:50:08 | FromDiscord | <Chronos [She/Her]> I just yanked this from the code for unpacking varargs lol |
23:50:11 | FromDiscord | <Chronos [She/Her]> Thanks beef! |
23:51:25 | FromDiscord | <Elegantbeef> Well that's what you get for plagarizing |
23:51:29 | FromDiscord | <Elegantbeef> Think with your head not your copy paste |
23:52:12 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4ErF |
23:52:16 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Well that's what you": Imagine using your head :p |
23:52:36 | FromDiscord | <Elegantbeef> What's line 8 |
23:54:12 | FromDiscord | <Chronos [She/Her]> `var eventSystem = EventSystem[ListenerProc].new()` but line 38 on the code sent back from you is literally the same |
23:54:32 | FromDiscord | <Elegantbeef> Termux bug perhaps |
23:54:52 | FromDiscord | <Elegantbeef> Time to minimize to see if you can reproduce |
23:55:03 | FromDiscord | <Elegantbeef> You did change your `new` proc right? |
23:55:08 | FromDiscord | <Elegantbeef> So it actually allocated |
23:55:09 | FromDiscord | <Elegantbeef> Right.... |
23:56:10 | FromDiscord | <Chronos [She/Her]> Wait |
23:56:12 | FromDiscord | <Chronos [She/Her]> Uh |
23:56:22 | FromDiscord | <Chronos [She/Her]> That was a change I read over- |
23:56:25 | FromDiscord | <Chronos [She/Her]> Aha |
23:56:28 | FromDiscord | <Chronos [She/Her]> Damn- |
23:56:51 | FromDiscord | <Elegantbeef> This kids is why you always use expressions when you can |
23:57:36 | FromDiscord | <Chronos [She/Her]> In my defense it is 12\:57 |
23:57:49 | FromDiscord | <Elegantbeef> That's lunchtime |
23:58:18 | FromDiscord | <Chronos [She/Her]> Yeah that works aha |
23:58:23 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "In my defense it": AM |
23:58:35 | FromDiscord | <Chronos [She/Her]> Now time to make it work with async- |
23:59:44 | FromDiscord | <Chronos [She/Her]> `asyncCheck` or `await`... I think using `asyncCheck` would be better because it'd let my code run at the same time as other events while also letting me catch the errors to log them without crashing the entire program |
23:59:53 | FromDiscord | <Chronos [She/Her]> Unless it's a defect which in that case you're fucked- |