<< 27-08-2023 >>

00:08:57termeretra, I know, it's a shit situation
00:09:00termervery few libraries support both
00:44:50NimEventerNew thread by giaco: Idiomatic way to zero-copy iterface with binary bitmap array, see https://forum.nim-lang.org/t/10444
00:48:23FromDiscord<Chronos [She/Her]> Do you think that someone is gonna register a listener more than 65535 times?
01:20:23FromDiscord<salt.die> sent a code paste, see https://play.nim-lang.org/#ix=4ECZ
01:22:43FromDiscord<Chronos [She/Her]> You'd have to handle this in whatever code the logic is being used in
01:23:03FromDiscord<Chronos [She/Her]> Assuming the values won't change though, it's as easy as just creating a proc for initialisation of it
01:23:58FromDiscord<salt.die> yeah, i figured as much
01:27:27FromDiscord<Chronos [She/Her]> Anyone have a pre-made GitHub Action for releasing Nim docs?
01:43:36*madprops quit (Quit: biourvgrt445)
01:45:53*madprops joined #nim
01:45:54*madprops quit (Changing host)
01:45:54*madprops joined #nim
01:53:45FromDiscord<Elegantbeef> Yea Nim does not have dependant typing
01:54:44FromDiscord<auxym> pretty esoteric feature, only fancy researchy FP languages have that stuff
01:55:09FromDiscord<Elegantbeef> I mean Nim technically has very limited dependant typing in it's `static T`
01:59:24NimEventerNew thread by ITwrx: EZ Bkup: The easiest backup program on earth!, see https://forum.nim-lang.org/t/10445
02:44:39FromDiscord<Chronos [She/Her]> Trying to think what else would make ny event system better
05:05:43*lucasta_ quit (Ping timeout: 244 seconds)
08:22:49*junaid_ joined #nim
11:04:22*nils` joined #nim
11:05:08FromDiscord<ezquerra> Have you guys tried the cody.ai plugin for visual studio? I just tried it by asking it a few questions about one of the example's in the new version of Araq's book and I think it did pretty well... I need to test it more but so far it seems like a good free alternative to copilot... https://media.discordapp.net/attachments/371759389889003532/1145313036668772404/image.png
11:08:51FromDiscord<Phil> I have not
11:10:12FromDiscord<Phil> So far copilot & Co were more better autocompletes than anything, which I appreciate them for definitely
11:15:13FromDiscord<amjadhd> In reply to @jviega "<@629598664452734989> got it?": No, the capacity == 0 so i == 0 which is within the bounds of `data`.
11:56:57*junaid_ quit (Remote host closed the connection)
12:56:12FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4EFy
12:59:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EFz
12:59:49FromDiscord<Phil> Albeit likely a bit slower, but avoids nil
13:00:52FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4EFC
13:01:54FromDiscord<Phil> I can't tell you where that type comes from, but if that's simply a Node, just make it Option[ListNode[netty.Port]]
13:03:56FromDiscord<System64 ~ Flandre Scarlet> Ah alright
13:05:30FromDiscord<naaquelo> Hi everyone, I'm trying to install Nim on Windows 11. I followed the official guide, extracted the Nim compiler and ran the `Finish.exe` file confirming Mingw GCC as my C compiler. However I'm getting this error `"Pointer size mismatch between Nim and C/C++ backend. You probably need to setup the backend compiler for target CPU."` ↵I tried googling the error but couldn't find anything
13:26:39*azimut quit (Ping timeout: 246 seconds)
14:13:14Amun-Ranaaquelo: (I'm not a windows guy) but seems like you're compiling for different cpu arch target (32-bit on 64-bit or vice versa)
14:29:04*krux02 joined #nim
14:40:59FromDiscord<Haze System (they/them)> i was thinking about the brainfuck interpreter/compiler from How I Start (<https://howistart.org/posts/nim/1/>) and was wondering, is it possible to make like a JIT compiling REPL for BF with the AST? or is that compile time only?
14:42:48FromDiscord<Phil> In reply to @hazesystem "i was thinking about": Generally Node operations are compile-time only
14:43:16FromDiscord<Phil> Depending on how you go about doing a "REPL" though you might be able to cheat
14:43:45FromDiscord<Phil> Because inim for example is not a true REPL, yet can easily be used like that.↵It's a hidden nim file that gets compiled and executed every time you write a statement
15:28:58FromDiscord<wannabelokesh> Will join later, as I'm currently into flutter for my college project of the current semester. I don't wanna feel distracted. Thank you for everything community. Love you, see you later.
15:34:00FromDiscord<Haze System (they/them)> In reply to @isofruit "Because inim for example": ah okay, that explains why getting results is relatively pretty slow, compared to a true interpreted or JIT language. is there any way other than dynamic recompiling to assembly?
15:36:20FromDiscord<Phil> sent a long message, see http://ix.io/4EGl
15:36:47FromDiscord<Phil> (edit) "http://ix.io/4EGl" => "http://ix.io/4EGm"
15:38:19FromDiscord<Haze System (they/them)> it seems like you're right. thanks for the input :)
15:40:13FromDiscord<toma400> Is there a possibility to require named tuple instead of anonymous one? For example `proc example (i: namedTuple)`?
15:45:25*junaid_ joined #nim
15:56:41FromDiscord<terrygillis> Hi, I suddenly made some mistakes writing an iterator. Write a working one before but I probably got iterator wrong in some way because this time it's not working for a simple linked list. Can I be told what is my mistake? Code here: https://play.nim-lang.org/#ix=4EGu
15:56:51FromDiscord<terrygillis> (edit) "Write" => "Wrote"
15:57:37FromDiscord<jviega> ` while not (current != nil):`
15:57:43FromDiscord<jviega> What's that not doing there?
15:57:58FromDiscord<odexine> In reply to @toma400 "Is there a possibility": i dont think so
15:57:58FromDiscord<jviega> That translates to "while current == nil"
16:03:46FromDiscord<System64 ~ Flandre Scarlet> On the right : Latest version↵On the left, nimble installed one↵Is it normal the left one is outdated?↵It's a local repo https://media.discordapp.net/attachments/371759389889003532/1145388193110306906/image.png
16:08:52FromDiscord<odexine> in what way did you install the repo if its local
16:08:59FromDiscord<odexine> i know you can, but there are many ways
16:12:15FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4EGy
16:12:24FromDiscord<System64 ~ Flandre Scarlet> Oh wait https://cdn.discordapp.com/emojis/894487647219761152.webp?size=48&name=Facepalm&quality=lossless
16:12:37FromDiscord<System64 ~ Flandre Scarlet> Oh wait
16:12:48FromDiscord<System64 ~ Flandre Scarlet> I just point to the wrong folder
16:25:13*lucasta joined #nim
16:27:15FromDiscord<Phil> I kinda wish nim had some implicit init.nim file or so it looks for implicitly if your import path ends in a directory
16:28:49FromDiscord<Phil> I'd love to have a directory where individual bits and bobs are separated out into separate files and then combine them in some barrel file that you can just import.↵With nicer syntax than `import directory/init` or somesuch
16:29:38*lucasta quit (Client Quit)
16:30:05FromDiscord<Phil> I guess I could write myself a template or macro and put that in a prelude to be able to make `barrelImport some/directory` that resolves to `import some/directory/barrel`
16:35:43FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EGA
16:36:32FromDiscord<Phil> What do you want to optimize for for the most part? Readability?
16:39:28FromDiscord<Phil> Wait, oh wow that is not that easy for me to reason about.↵So basically "If the line is skippable, based on if it starts with KnownSkips, then skip this line "?
16:39:42FromDiscord<heysokam> In reply to @isofruit "Wait, oh wow that": yeah
16:39:54FromDiscord<terrygillis> In reply to @jviega "That translates to "while": ah thanks that’s the problem, an oversight
16:40:26FromDiscord<heysokam> basically, if the line is a `cc something something` or `gcc something something` it should not be skipped↵but it is mixed with a bunch of noise from the shell (the known skips thing)
16:41:04FromDiscord<heysokam> i could filter -in- instead of filtering out, but then the app won't crash when something unknown comes in, it would just be skipped silently
16:41:27FromDiscord<Phil> Outsource stuff into procs and write it more like guard clauses, one sec
16:44:49FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EGD
16:45:52FromDiscord<heysokam> I have all my projects organized like that and they can be kept really clean and neat thanks to that
16:45:53FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EGE
16:46:07FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4EGE" => "https://play.nim-lang.org/#ix=4EGF"
16:46:10FromDiscord<heysokam> (edit) "https://play.nim-lang.org/#ix=4EGD" => "https://play.nim-lang.org/#ix=4EGG"
16:46:48FromDiscord<Phil> In general, if you have if-statements, 99% of the time I prefer to structure them as guard-clauses / early returns
16:47:08FromDiscord<heysokam> yeah same
16:47:18FromDiscord<heysokam> but this innerloop thing I've never encountered before
16:48:50FromDiscord<Phil> This solves it right?↵I mean your goal is less that you have 2 for-loops, it's more that you have to check 2 conditions in order to figure out whether this line is relevant for you.↵And that just so happens to require you to iterate over some other sequences
16:49:21FromDiscord<heysokam> yeah true
16:49:41FromDiscord<heysokam> i like the anyIt thing, never used it
16:50:02FromDiscord<Phil> If we're very precise, your entire "getCommandLines" is filter over input
16:50:29FromDiscord<heysokam> wdym?
16:52:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EGJ
16:53:39FromDiscord<Phil> Basically if you break it down to its fundamentals, you want to check every entry if it fulfills a condition (it is a command or a line with a command or whatever you want to define it as) and anything not passing that check gets thrown out.
16:53:48FromDiscord<Phil> (edit) "Basically if you break it down to its fundamentals, you want to check every entry ... if" added "in an iterable"
16:54:15FromDiscord<Phil> The output is a `filter` of the input
16:54:18FromDiscord<heysokam> each entry is a line, not a word. but yeah i guess
16:54:38FromDiscord<heysokam> my function is called "filternoise" so... yeah 🙂
16:54:53FromDiscord<Phil> And Rika will chime in here as all of that is functional programming
16:55:06FromDiscord<odexine> In reply to @isofruit "I kinda wish nim": ? if you have this structure you'd achieve that tho↵src/somedir↵src/somedir.nim↵naturally if you `import somedir` it will go to somedir.nim
16:55:09FromDiscord<odexine> and you'd get your idea
16:55:32FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EGL
16:56:23FromDiscord<Phil> In reply to @odexine "? if you have": Ah, forgot to reply to that for sOkam! as well:↵I don't particularly like that one because the file defining the barrel is not inside of the folder that is exporting its contents.↵And in my IDE the directory and the file are not shown directly next to one another, so double meh
16:56:23FromDiscord<odexine> In reply to @isofruit "And Rika will chime": pretty much, there is no "early return" or actually usually even the "return" keyword in fp
16:56:50FromDiscord<odexine> In reply to @odexine "pretty much, there is": oh man you will prolly go a bit crazy if ever you try elixir
16:56:56FromDiscord<odexine> "whats return?"
16:57:05FromDiscord<heysokam> @Phil wait a minute, this doesn't sound right https://media.discordapp.net/attachments/371759389889003532/1145401610739142766/image.png
16:57:32FromDiscord<heysokam> "if at least one item"... i mean, its a single string?
16:57:40FromDiscord<odexine> an item in a string is a char
16:57:51FromDiscord<Phil> In reply to @heysokam "can the `hasCommand` function": Yeah, the line just gets long so I'd make a new proc and I was starting to run out of good names for that
16:57:55FromDiscord<Phil> (edit) "In reply to @heysokam "can the `hasCommand` function": Yeah, the line ... just" added "of code"
16:58:02FromDiscord<heysokam> so anyIt is going to fail everytime, or just not compile
16:58:12FromDiscord<odexine> ??
16:58:13FromDiscord<odexine> oh
16:58:16FromDiscord<odexine> i see what you want
16:58:18FromDiscord<Phil> In reply to @heysokam "<@180601887916163073> wait a minute,": Knownskips is a seq is it not?
16:58:27FromDiscord<heysokam> In reply to @isofruit "Knownskips is a seq": could
16:58:34FromDiscord<heysokam> its an array, but its const, so doens't matter
16:58:46FromDiscord<odexine> KnownSkips.anyIt(line.startsWith(it)) # true if the line starts with anything in knownskips
16:58:55FromDiscord<heysokam> oh you mean that we are gettingthe items from the seq
16:58:59FromDiscord<Phil> so it checks if for any of the entries of KnownSkips it can find that the line starts with the KnownSkips entry
16:59:07FromDiscord<heysokam> yeah mb mb
16:59:54FromDiscord<Phil> `mapIt`, `anyIt`, `allIt`, `filterIt` are super useful for one-step transformations you need to apply to an iterable
17:00:17FromDiscord<Phil> They also have their counterparts without the `it`, you'll just have to define a full callback procedure instead of just an expression if you use those
17:00:41FromDiscord<heysokam> can the commands function be made with anyIt?
17:00:54FromDiscord<Phil> Absolutely
17:01:03FromDiscord<Phil> As stated, the line of code just gets longer than I like ^^
17:01:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EGO
17:02:27FromDiscord<Phil> However, I think `it in line`should suffice.↵At a glance I'm not aware of any scenarios where `line.startsWith(it)` is true where `it in line` wouldn't also be true
17:02:28FromDiscord<heysokam> In reply to @isofruit "As stated, the line": you can just break the lines after `and` or `or` if it gets too long
17:03:11FromDiscord<heysokam> In reply to @isofruit "However, I think `it": ` cc arg1 arg2`↵`\ cc arg1 arg2`↵etc etc
17:03:20FromDiscord<heysokam> it really outputs a bunch of shell noise
17:03:39FromDiscord<Phil> yeah but you overall just want to check if `cc` is somewhere in there right?
17:04:04FromDiscord<Phil> So `it in line` should always output what you need, line.startsWith(it) seems superfluous
17:04:17FromDiscord<heysokam> not really, because it should stop early
17:04:24FromDiscord<heysokam> what if the line contains `noiseccnoise`
17:05:21FromDiscord<Phil> Would return true and react same as your first implementation
17:05:25FromDiscord<fwsgonzo> Hey guys, I am having some strange behavior when calling a nim function from a C trampoline. I get the right behavior when the nim callback is .cdecl., however when it isn't I get zeroes from reading from reading a global var.↵↵The nim callback is not called directly from C, instead I have an intermediary Nim function that is cdecl that then calls the non-cdecl Nim callback function. In my head this should work.
17:05:41FromDiscord<fwsgonzo> (edit) removed "from reading"
17:06:00FromDiscord<Phil> CPS and C interaction, I'm out, I have some bare grasps on that but understand none of it
17:06:18FromDiscord<Phil> (edit) "CPS and C interaction, I'm out, I have some bare grasps on that but understand none of it ... " added "on a "good enough" level"
17:06:23FromDiscord<fwsgonzo> (edit) "Hey guys, I am having some strange behavior when calling" => "sent" | "nim function from a C trampoline. I get the right behavior when the nim callback is .cdecl., however when it isn't I get zeroes from reading a global var.↵↵The nim callback is not called directly from C, instead I have an intermediary Nim function that is cdecl that then calls the non-cdecl Nim callback function. In my head this should work." => "code
17:06:40FromDiscord<fwsgonzo> (edit) "https://play.nim-lang.org/#ix=4EGQ" => "https://play.nim-lang.org/#ix=4EGR"
17:07:08FromDiscord<Phil> In reply to @heysokam "not really, because it": I would assume contains returns the second it finds the first hit
17:07:25FromDiscord<Phil> the `contains` proc I mean, which gets triggered by `x in y`
17:07:27FromDiscord<heysokam> the use of the word "trampoline" to describe a "binding" or "wrapper" sounds really foreign to me for some reason, lol
17:07:47FromDiscord<fwsgonzo> unfortunately, this is a very strange environment, and trampoline is probably for better or worse, the right word
17:07:58FromDiscord<heysokam> In reply to @isofruit "I would assume contains": yeah that's the idea
17:08:15FromDiscord<heysokam> In reply to @fwsgonzo "unfortunately, this is a": yeah not judging, just saying it sounds foreign
17:08:50FromDiscord<Phil> If that's the case then `x in y` still does everything that `x.startsWith(y)` does for you 😛↵Though alternatively, if you can assume cc is ALWAYS at the start of the string (barring whitespaces), then you can just trim the starts of the line
17:10:22FromDiscord<heysokam> In reply to @isofruit "If that's the case": that'd be another option, but im so sick of this project. i just want to get it done and move on forever 😔↵so i just want something that works and if it fails it will scream at me in the compiler in the future if its needed (instead of silently omitting info)
17:11:28FromDiscord<Phil> In reply to @heysokam "that'd be another option,": Okay, for the sake of correctness so that this expresses exactly what you want:↵Can you assume that a command should always be the first thing that occurs after all whitespaces from the starts are removed
17:11:33FromDiscord<Phil> (edit) "removed" => "removed?"
17:11:58FromDiscord<heysokam> I'm trying to clean up 20+years of crap piled up in an old makefile, and hopefully never have to touch it again ever↵it's taking me months of my life to get rid of it, lol. that tells you how crusty it is
17:12:07FromDiscord<heysokam> In reply to @isofruit "Okay, for the sake": yeah definitely
17:12:23FromDiscord<heysokam> problem is I don't know how to trim the whitespaces from the start
17:13:20FromDiscord<Phil> strip is strutils
17:13:20FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EGT
17:13:30FromDiscord<Phil> https://nim-lang.org/docs/strbasics.html#strip%2Cstring%2Cset%5Bchar%5D
17:13:54FromDiscord<heysokam> i had no idea that exists, lol
17:14:00FromDiscord<Phil> This way, you won't run into any bugs with weird as lines that have `cc`somewhere in the middle
17:14:03FromDiscord<heysokam> would have saved me a couple of hours
17:14:07FromDiscord<heysokam> (edit) "would have saved me a couple of hours ... " added "of parsing logic"
17:14:16FromDiscord<heysokam> In reply to @isofruit "This way, you won't": yeah exactly
17:14:23FromDiscord<heysokam> oh, but wait
17:14:29FromDiscord<Phil> (edit) "as" => "ass"
17:14:38FromDiscord<heysokam> some of the commands start with `/something/cc` 😔
17:14:54FromDiscord<heysokam> i think that's why i wrote that second switch
17:14:57FromDiscord<Phil> In that case can you guarantee that after the cc is a whitespace?
17:15:05FromDiscord<heysokam> for sure
17:15:11FromDiscord<heysokam> that's definitely a guarantee
17:15:42FromDiscord<heysokam> I guess i could split into words by whitespace if the startswith check fails 🤔
17:16:20FromDiscord<Hamid_Bluri> is there anyway to redefine a specific overload of a function? 😕 ↵https://github.com/treeform/jsony/issues/77
17:17:16FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EGU
17:17:59FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EGV
17:19:09FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EGW
17:19:13FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4EGW" => "https://play.nim-lang.org/#ix=4EGX"
17:21:19FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EGY
17:21:40FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EGZ
17:22:40FromDiscord<Phil> At least do an explicit return false after the for loop 😛
17:23:15FromDiscord<heysokam> i think its evident in this case 🤷‍♂️
17:23:25FromDiscord<heysokam> but i see your point. normally i try to be explicit too
17:24:01FromDiscord<odexine> In reply to @isofruit "If you want this": why have the return? remove the return here
17:24:13FromDiscord<odexine> what , did you forget about expression return
17:24:22FromDiscord<Phil> No, I just am not a fan of it
17:24:26FromDiscord<odexine> what
17:24:42FromDiscord<odexine> you will legitimately die if ever you use an fp
17:24:43FromDiscord<Phil> Unless it's a one-line proc my brain just doesn't immediately recognize expression returns as the return of the proc
17:25:13FromDiscord<Phil> Or rather I find it hard to find when skimming through an if-construct like this
17:25:52FromDiscord<heysokam> 👆 yeah same, although not as strongly
17:25:55FromDiscord<Phil> In reply to @odexine "you will legitimately die": It's not like it kills me, I just prefer explicit returns
17:26:33FromDiscord<Phil> Expression returns can be prefectly fine as well, I'd just write the code different in those cases to make it more obvious where the return is
17:26:34FromDiscord<odexine> In reply to @isofruit "It's not like it": you wont know until you see honestly, it takes a bit of rewiring to read code that never has a "return"
17:26:50FromDiscord<heysokam> as in i don't think its needed to say that this is a discord message when we are writing in discord↵That level of explicit is a bit much for me. but the "im writing a message" level feels fine, even though its obvious it could also not be the case
17:27:08FromDiscord<Phil> Or rather: The fact that I'm okay with expression returns stems from my 3 or so months I spent in rust where I used it a lot.
17:27:30FromDiscord<odexine> rust is relatively heavily fp for a non-fp language
17:27:53FromDiscord<heysokam> short functions always return, and they are clearly there, so if all the checks have true in them, then it feels fine to skip the extra return false
17:27:54FromDiscord<Phil> I have since in nim found myself gravitating more towards return there, so I can deal with both, in nim return just groks with me more
17:28:43FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EH1
17:29:10FromDiscord<odexine> perhaps ive been too far into fp indeed as i never really ever want to write return
17:29:15FromDiscord<Phil> In reply to @heysokam "short functions always return,": Fair, I personally have a hard rule for that one but I agree that it's obvious enough in general
17:29:25FromDiscord<Phil> (edit) "In reply to @heysokam "short functions always return,": Fair, I personally have a hard rule for that one ... but" added "for myself"
17:30:22FromDiscord<Phil> I mean if the expressions that return were to get colored in by the IDE in a specific way I'd be perfectly happy with it 😛
17:30:37FromDiscord<Phil> It's all about that I want returns to catch my eyey
17:30:40FromDiscord<Phil> (edit) "eyey" => "eye"
17:30:44FromDiscord<heysokam> makes sense
17:31:22FromDiscord<Phil> In reply to @hamidb80 "is there anyway to": That sounds like a case for @treeform
17:32:11FromDiscord<odexine> In reply to @isofruit "I mean if the": well if everything returns then the idea is muddied
17:32:47FromDiscord<Phil> Because I am not aware of one.↵If you already have a specific function and given that in jsony it's all static dispatch, the only way you can get in there and do stuff is if the hook that is pre-defined is a generic or something, in that case your specific hook would take precedence
17:33:35FromDiscord<Fabio Nascimento> As an older pascal programmer here, I would start the function with guard "result = false"...
17:34:15FromDiscord<Phil> ... wha?
17:35:02FromDiscord<odexine> what do you mean wha?
17:35:21FromDiscord<Phil> Like, what does that even do?
17:35:36FromDiscord<Phil> Missed the t
17:35:44FromDiscord<odexine> i know
17:35:59FromDiscord<odexine> the implication is that theyd use result instead of expr/return i assume?
17:37:40FromDiscord<Phil> Like does pascal also have the implicit result variable or sth?
17:38:14FromDiscord<odexine> yes i believe nim took it from there
17:38:41FromDiscord<Phil> That answers one of my questions, the second one: Why would that be valid when result is not a bool type?
17:38:48FromDiscord<Toli> Nim is so flexible, that you got result and/or return and an implicit return could make rust,c/cpp user's head spin some times...
17:39:12FromDiscord<Phil> In reply to @Toli "Nim is so flexible,": Entirely fair
17:39:53FromDiscord<Phil> Ironically I've found myself using all 3.↵Return most of the times, Implicit returns of expressions when I have 1-line procs, and result often when I have short procs where I bould up a seq or string
17:40:10FromDiscord<Phil> (edit) "bould" => "build"
17:40:19FromDiscord<odexine> In reply to @isofruit "That answers one of": it wont, the implication is also that you guys were talking about bool types...
17:40:23FromDiscord<odexine> (edit) "types..." => "typed returns..."
17:40:28FromDiscord<Phil> ohhhhhhhhh
17:40:36FromDiscord<odexine> phil can you read today
17:41:28FromDiscord<Phil> I could never read Rika, I use the sounds of the discord notification to figure out what text was sent and then face-roll my keyboard in the hopes that a decent string of letters comes out
17:42:36FromDiscord<Phil> Sometimes solar fluctuations interferer with the electrons in my device and the notification comes out sounding slightly off, leading to communications errors.↵It's definitely that and nothing else
17:42:38FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#ix=4EH2
17:42:40FromDiscord<odexine> no i do not know what that returns
17:42:52FromDiscord<odexine> (edit) "returns" => "compiles to"
17:42:52FromDiscord<odexine> (edit) "https://play.nim-lang.org/#ix=4EH2" => "https://play.nim-lang.org/#ix=4EH3"
17:44:30FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EH4
17:46:52FromDiscord<heysokam> @Phil it broke in a big way, trying to be too smart with the anyIt and such 😔
17:47:02FromDiscord<heysokam> nothing ever was populated lol
17:47:02FromDiscord<Phil> hm?
17:47:10NimEventerNew Nimble package! shopifyextractor - Shopify ecommerces data in a instant, see https://github.com/thisago/shopifyextractor
17:47:14FromDiscord<heysokam> idk why, can't say more, just that the list was empty
17:47:31FromDiscord<Phil> Can you provide an input list for an example?
17:47:47FromDiscord<heysokam> the clean or the dirty version?
17:47:57FromDiscord<Phil> Whatever you iterate over
17:48:03FromDiscord<Phil> The hardest version
17:48:46*gst joined #nim
17:49:39FromDiscord<heysokam> https://media.discordapp.net/attachments/371759389889003532/1145414837422260436/example.sh https://media.discordapp.net/attachments/371759389889003532/1145414837896220732/t.sh
17:49:54FromDiscord<heysokam> the second one is hand-cleaned
17:50:00FromDiscord<System64 ~ Flandre Scarlet> My server crashes ↵Reason? None
17:50:42FromDiscord<heysokam> In reply to @isofruit "The hardest version": i haven't even created the hardest version, because im afraid of filtering the inputs correctly 🙈
17:51:49FromDiscord<Phil> Let me check
17:51:51FromDiscord<odexine> nim 2: filter harder
17:52:47FromDiscord<heysokam> sent a long message, see http://ix.io/4EH9
17:52:50*gst quit (Client Quit)
17:53:08*gst joined #nim
17:54:31gsthello, can anyone help me understand why this code fails to compile; https://play.nim-lang.org/#ix=4EH8
17:54:35FromDiscord<odexine> whats wrong with just startswith again?
17:55:02FromDiscord<heysokam> In reply to @odexine "whats wrong with just": well that I didn't know about `strip()`
17:55:22FromDiscord<heysokam> and that sometimes it starts with `/` not with the command word
17:56:50FromDiscord<odexine> In reply to @heysokam "and that sometimes it": why would it start with /
17:58:16FromDiscord<odexine> In reply to @gst "hello, can anyone help": feels like a compiler bug
17:59:30FromDiscord<heysokam> In reply to @odexine "why would it start": `/usr/bin/osxcross arg1 arg2` is a valid compiler command
18:00:06FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EHa
18:00:28FromDiscord<Phil> Before I get told to use readLines: That returns the entire file as a single string and I can't be arsed to look for splitting things up agin
18:00:39FromDiscord<Phil> (edit) "things up agin" => "line by line"
18:01:14FromDiscord<odexine> In reply to @heysokam "`/usr/bin/osxcross arg1 arg2` is": `line.split(' ', 1)[0].endsWith(#[cmd]#)`
18:01:20FromDiscord<Phil> Anyway, returns 78/301 lines
18:01:33FromDiscord<heysokam> In reply to @odexine "`line.split(' ', 1)[0].endsWith(#[cmd]#)`": i don't even understand what that does
18:01:38FromDiscord<griffith1deadly> In reply to @sys64 "My server crashes ": use gdb to debugging crashes
18:02:01FromDiscord<odexine> In reply to @heysokam "i don't even understand": get contents until first space, see if ends with command
18:02:32FromDiscord<odexine> matches `<anything but space or nothing><command><space>...`
18:02:46FromDiscord<odexine> so `cc ...` or `/c/c/awdjhaqojwrfm/cc ...` will work
18:02:59FromDiscord<odexine> better use parseutils
18:03:05FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EHd
18:03:07FromDiscord<odexine> yes
18:03:09FromDiscord<heysokam> ??
18:03:16FromDiscord<odexine> the command name
18:03:17FromDiscord<heysokam> what is `#[cmd]#` even
18:03:34FromDiscord<odexine> #[]# block commendt↵cmd comment contents
18:03:35FromDiscord<odexine> (edit) "commendt↵cmd" => "comment↵cmd"
18:04:04FromDiscord<heysokam> that syntax inline is giga confusing, thought you were pattern matching in a weird way or something
18:04:11FromDiscord<odexine> lol
18:04:28FromDiscord<odexine> block comments arent used often ig
18:04:38FromDiscord<heysokam> definitely not inline lol
18:04:49FromDiscord<odexine> i use them inline sometimes
18:04:54FromDiscord<heysokam> seen them in C, though, it just didn't cross my mind
18:05:36FromDiscord<heysokam> why the `1` btw?
18:06:14FromDiscord<Phil> You only want to split once
18:06:18FromDiscord<Phil> To get the first segment
18:06:42FromDiscord<heysokam> In reply to @isofruit "Anyway, returns 78/301 lines": honestly, i think i really need to get rid of filtering out explictely, and start filtering in. because this parser is a pain otherwise
18:07:01FromDiscord<heysokam> In reply to @isofruit "To get the first": why doing `[0]` then, if its only split once?
18:07:03FromDiscord<Phil> In reply to @heysokam "honestly, i think i": filter in `.`?
18:07:16FromDiscord<Phil> In reply to @heysokam "why doing `[0]` then,": Because that is the first segment of the line
18:07:18FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#ix=4EHe
18:07:30FromDiscord<Phil> which is the part of the line that is either cc, gcc or /bla/cc
18:07:53FromDiscord<heysokam> In reply to @isofruit "filter in `.`?": i mean getting rid of the noise by targeting the cc commands -only-, instead of trying to sort everything explictely
18:08:32FromDiscord<Phil> But... like the 78/301 worked...
18:08:45FromDiscord<heysokam> yeah, that wasnt' the hard case
18:09:00FromDiscord<heysokam> the hard one I dealt with before... and made it work... but omg
18:09:08FromDiscord<Phil> Well then hand me the hard case becasue t.sh was the easier of the two so I tried example.sh 😛
18:09:30FromDiscord<heysokam> In reply to @isofruit "Well then hand me": yeah problem is I don't even know how to generate it anymore
18:09:35FromDiscord<Phil> Bwahahahahahaa
18:09:50FromDiscord<Phil> I know that problem when you just want to be rid of shit xD
18:10:12FromDiscord<heysokam> basically, you would get a list of like 10-15 separate make commands, so that everything is built, and then parse -that- 😄
18:10:31FromDiscord<heysokam> as one giant sh file
18:10:41FromDiscord<heysokam> (edit) "file" => "file, that builds all targets for all 3 systems"
18:10:52FromDiscord<Phil> I mean the only bug I could possibly think of is if you have super-long single line commands that use `;` to separate multiple commands
18:10:56FromDiscord<Phil> That one would currently not get picked up
18:11:08FromDiscord<heysokam> ah true
18:11:24FromDiscord<heysokam> i don't think `make -n` outputs ocmmands like that though
18:11:29FromDiscord<heysokam> (edit) "ocmmands" => "commands"
18:11:49FromDiscord<Phil> I mean based on the requirements provided, yeah make -n would currently get filtered out 😛
18:11:58FromDiscord<Phil> If you want them to stay, put them in KnownCommands
18:12:08FromDiscord<heysokam> no i mean make -n is the one that generates this lists
18:12:13FromDiscord<heysokam> (edit) "this" => "these"
18:13:31FromDiscord<Phil> Ohhh that way you mean it↵Well in that case you should be safe
18:13:54FromDiscord<heysokam> also, side note, how would you deal with the case of lines being sent with `\` escape sequences, and then the next one being just a part of the same line?
18:14:25FromDiscord<Phil> Within the current task, as in checking for cc/gcc at the start?
18:14:36FromDiscord<heysokam> no, before giving that task the inputs
18:14:56FromDiscord<Phil> Oh multi line commands
18:15:07FromDiscord<odexine> haha, what are you make -n anyway
18:15:09FromDiscord<odexine> sorry
18:15:14FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EHg
18:15:22FromDiscord<Phil> The current code doesn't deal with it essentially, or rather it does not do it well
18:15:55FromDiscord<heysokam> In reply to @odexine "haha, what are you": good o -n e 😄
18:16:27FromDiscord<Phil> As for this, hmmm I'd likely concat lines together that have newlines
18:16:44FromDiscord<heysokam> yeah, but how is the question 🙂
18:22:04FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4EHj
18:25:43FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EHk
18:27:03FromDiscord<Phil> `isPartOfMultiLineCommand` should of course also check that you're not running out of the bounds of `lines` or return false if nextLineIndex is out of bounds
18:27:10FromDiscord<Phil> (edit) "or" => "and"
18:27:35FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4EHk" => "https://play.nim-lang.org/#ix=4EHl"
18:28:02FromDiscord<Phil> Also requires an import of std/strformat and isLastLine should just be a simple index == lines.high
18:29:17FromDiscord<Phil> It's not uber clean, the clean version would be to iterate by index imo, but I am not aware of a way in nim to do loops with iterators whose position you can mutate
18:29:24FromDiscord<Phil> (edit) "position" => "value"
18:29:49FromDiscord<Phil> (edit) removed "with iterators" | "value" => "iteration-index"
18:30:48FromDiscord<Phil> In reply to @heysokam "yeah, but how is": Does the above look doable?
18:31:25FromDiscord<heysokam> In reply to @isofruit "Does the above look": reading
18:32:20FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EHm
18:33:00FromDiscord<heysokam> im generating the hardcase to see if its manageable. even if regex or strtabs is required for it
18:33:53FromDiscord<Phil> How I know I have a couple nimsuggest threads running:↵My CPU in powersave mode starts running near 50°C again
18:34:11FromDiscord<heysokam> yeah true 😔
18:34:35FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "use gdb to debugging": The worst thing that can ever happen https://media.discordapp.net/attachments/371759389889003532/1145426149007179969/image.png
18:34:43FromDiscord<Phil> erroneous nimsuggest threads
18:34:54FromDiscord<Phil> luckuly `killall nimsuggest` exits those quickly
18:35:00FromDiscord<Phil> (edit) "luckuly" => "luckily"
18:35:51FromDiscord<griffith1deadly> In reply to @sys64 "The worst thing that": are u compiling with --debugger:native?
18:37:05FromDiscord<heysokam> In reply to @sys64 "The worst thing that": `bt` inside gdb
18:38:25FromDiscord<heysokam> also `tui enable` will probably make you stop seeing gdb as a monster
18:44:56FromDiscord<.maverk> is ``of`` considered an operator in nim ?
18:46:53arkanoidcould you please help me understand why the following piece of code double free only if echo is called? https://play.nim-lang.org/#ix=4EHq
18:47:05*ntat joined #nim
18:50:41FromDiscord<Phil> 🏃‍♂️ me running away from that particular problem
18:51:55FromDiscord<demotomohiro> @Arkanoid I guess, if you didn't echo `foo2`, `foo2` become a variable initialized but not read. So it is optimized away and double free doesn't happen.
18:59:31FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "are u compiling with": Oh, lemme do that
19:04:16FromDiscord<heysokam> @Phil https://media.discordapp.net/attachments/371759389889003532/1145433616499867668/hardcase.sh
19:06:26*junaid_ quit (Remote host closed the connection)
19:06:39FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "are u compiling with": Same result
19:08:11arkanoiddemotomohiro, it makes sense, thanks. But how can I stop this from happening? I though that `var foo2 = foo` would be a copy, and so an error due to `=copy` being and `{.error.}`
19:09:13FromDiscord<heysokam> In reply to @sys64 "Same result": did you launch with `nim-gdb` or just `gdb`?
19:09:32arkanoidFoo is a stack object, so var foo2 = foo shold be a copy, and then an error
19:13:50FromDiscord<.maverk> nim doesn't have ``union`` ?
19:15:41FromDiscord<heysokam> In reply to @.maverk "nim doesn't have ``union``": https://github.com/alaviss/union
19:20:21FromDiscord<demotomohiro> @Arkanoid It seems `var foo2 = foo` doesn't copy but does sink or rename `foo` with `foo2`.↵Because I got compile error "Error: '=copy' is not available" if `echo foo[0]` is called after `var foo2 = foo`.
19:21:59FromDiscord<demotomohiro> https://nim-lang.org/docs/destructors.html#move-semantics↵> A "move" can be regarded as an optimized copy operation. If the source of the copy operation is not used afterward, the copy can be replaced by a move.
19:24:08FromDiscord<System64 ~ Flandre Scarlet> In reply to @heysokam "did you launch with": just gdb
19:25:20FromDiscord<heysokam> In reply to @sys64 "just gdb": need the nim version, otherwise symbols are not human readable very much
19:25:39FromDiscord<System64 ~ Flandre Scarlet> Oh alright
19:25:57FromDiscord<System64 ~ Flandre Scarlet> Where can I find it?
19:27:27FromDiscord<Elegantbeef> Arkanoid https://nim-lang.org/docs/destructors.html#cursor-inference-slash-copy-elision might explain why that's valid
19:27:30FromDiscord<Elegantbeef> As to the double free....
19:28:33FromDiscord<System64 ~ Flandre Scarlet> The weirdest thing is it doesn't segfault directly, weird!
19:38:46*junaid_ joined #nim
19:39:57FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EHF
19:40:47FromDiscord<odexine> lol
19:43:15*junaid_ quit (Remote host closed the connection)
19:57:48*xet7 quit (Read error: Connection reset by peer)
20:02:26FromDiscord<odexine> does nim have a modern Path-y way to walk directories
20:10:41FromDiscord<Elegantbeef> Do you mean https://nim-lang.org/docs/dirs.html#walkDir.i%2CPath ?
20:14:06FromDiscord<odexine> i did figure it out thanks but the docs never point at it, at least os does not
20:14:11FromDiscord<odexine> only files and paths
20:14:24FromDiscord<odexine> sure naturally one would think a dirs would then also exist but eh
20:15:17FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=4EHS
20:15:51FromDiscord<Elegantbeef> std/os does not use `Path` afaik
20:16:12FromDiscord<that_dude.> In reply to @treeform "I want to use": If it's already in the Std, can't you just import it directly?
20:16:12FromDiscord<Elegantbeef> `{importc, nodecl.}` perhaps
20:16:13FromDiscord<odexine> In reply to @Elegantbeef "std/os does not use": yes but it points at paths and files as a "high level operations for paths and files" thing
20:16:18FromDiscord<odexine> it should as well for dirs
20:16:45FromDiscord<that_dude.> I thought there is a header Pragma you can use with importc
20:16:47FromDiscord<Elegantbeef> `_ _`
20:17:01FromDiscord<Elegantbeef> The header pragma is only for adding a `#include`
20:17:10FromDiscord<Elegantbeef> It does not name space a procedure
20:18:06FromDiscord<Elegantbeef> Rika that's a hangman board in response to your "it should as well for dirs", you can figure out what it means 😄
20:18:11FromDiscord<demotomohiro> In reply to @treeform "I want to use": How about to rename to `proc cqsort` and change importc to `{.importc: "qsort".}`.
20:18:26FromDiscord<Elegantbeef> The issue is the C side
20:18:44FromDiscord<Elegantbeef> `importc` disables mangling so the same result will happen
20:19:03FromDiscord<odexine> In reply to @Elegantbeef "Rika that's a hangman": nah i dont feel like it :baqua:
20:19:09FromDiscord<odexine> i'll pr later
20:21:09FromDiscord<Elegantbeef> Very few times one can guess hangman without any letters
20:21:53FromDiscord<treeform> @that_dude.@ElegantBeouf @demotomohiro I can't use Nim's sort because all I have are pointers, I can't use qsort from c because I can't produce `int ()(const void , const void )` type. I think I have figured it out though. I copy the data from the ptr to a tmp seq, use Nim's sort, then copy it back to ptr. Slow, but it works for now. Thank you!
20:23:31arkanoiddemotomohiro, elegantbeef, thanks! It's clear now that copy manifest only on next ops
20:24:58FromDiscord<that_dude.> Isn't that just function that takes two void pointers as parameters and returns an int? Sorry I haven't worked with c/++ in a long time
20:26:24FromDiscord<treeform> yes it is
20:26:34FromDiscord<treeform> but I can't make a C function in nim that has that seg
20:27:14FromDiscord<djazz> anti const squad
20:27:58FromDiscord<demotomohiro> sent a code paste, see https://paste.rs/EaoKt
20:28:38FromDiscord<treeform> its compatible, but it wants that type specifically
20:28:43FromDiscord<djazz> now how do you convert it to nim pointer inside the sort callback?
20:28:49FromDiscord<djazz> without C++ complaining
20:29:45FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=4EHY
20:30:22FromDiscord<treeform> Eventually I hope to make probindex not be a poitner but be a normal seq. So its on the way to a happy path.
20:30:47FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4EHZ
20:31:55FromDiscord<that_dude.> Can't read the language, but it looks like a permission error. Is it already in use? Or is that even in the valid range of ports?
20:32:05FromDiscord<demotomohiro> @treeform By the way, did you read https://github.com/nim-lang/Nim/issues/22352#issuecomment-1693613557
20:32:10*ntat quit (Quit: leaving)
20:32:18FromDiscord<System64 ~ Flandre Scarlet> In reply to @that_dude. "Can't read the language,": yeah it's in the valid range↵How can I know which program uses this port?
20:33:20FromDiscord<djazz> lsof?
20:34:50FromDiscord<demotomohiro> netstat?
20:35:18FromDiscord<treeform> @demotomohiro sorry I did not see that yet, its probably in my github emails.
20:36:04FromDiscord<that_dude.> Tbh I would just try a different port. It's easier. I generally do my testing in the 20k-30k range
20:36:28FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "netstat?": The port is not even used↵Even weirder, it just happened since I rebooted my computer
20:37:22FromDiscord<treeform> `Pointer size mismatch between Nim and C/C++ backend. You probably need to setup the backend compiler for target CPU.` Is a great error message thank you for adding! Hopefully will help people as they run into it.
20:39:45FromDiscord<demotomohiro> In reply to @sys64 "The port is not": Maybe you dont have the permission to use that ip and port?
20:41:44FromDiscord<demotomohiro> In reply to @treeform "`Pointer size mismatch between": I hope so. But we might need to see if newcomer still get confused from the error message.
20:43:12FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "Maybe you dont have": Alright so I rebooted my computer again and it works↵Windows cringe forever
20:43:12FromDiscord<treeform> Yeah maybe saying some thing about 64bit and 32bit I am not sure if new people know that its related to pointer size... but maybe they do, I just don't know.
20:53:59*oisota5 joined #nim
20:54:11*om3ga_ joined #nim
20:54:55*madprops_ joined #nim
20:56:14*emery joined #nim
21:01:07FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4EI8
21:02:07*madprops quit (*.net *.split)
21:02:07*oisota quit (*.net *.split)
21:02:07*ehmry quit (*.net *.split)
21:02:07*om3ga quit (*.net *.split)
21:02:07*NimEventer quit (*.net *.split)
21:02:07*oisota5 is now known as oisota
21:02:22FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4EIa
21:02:45FromDiscord<System64 ~ Flandre Scarlet> Very nice
21:02:47*NimEventer joined #nim
21:04:41*gst quit (Ping timeout: 246 seconds)
21:06:03FromDiscord<.maverk> how is the ``ptr`` datatype suppose to work ?
21:06:41FromDiscord<System64 ~ Flandre Scarlet> In reply to @.maverk "how is the ``ptr``": It's a pointer↵Do you know what a pointer is?
21:07:11FromDiscord<.maverk> In reply to @sys64 "It's a pointer Do": in c ↵↵int test = &struct or anything
21:07:28FromDiscord<System64 ~ Flandre Scarlet> Yeah so it's just a pointer
21:07:40FromDiscord<.maverk> can you give an example
21:07:41FromDiscord<System64 ~ Flandre Scarlet> ptr int is a pointer to an int
21:07:52FromDiscord<.maverk> In reply to @sys64 "ptr int is a": int only ?
21:09:39FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4EId
21:10:07FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4EIe
21:10:18FromDiscord<System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#ix=4EIe" => "https://play.nim-lang.org/#ix=4EIf"
21:10:27FromDiscord<.maverk> is not the dereference ?
21:11:01FromDiscord<odexine> No
21:11:02FromDiscord<demotomohiro> In Nim, `[]` is dereference.
21:11:16FromDiscord<.maverk> In reply to @demotomohiro "In Nim, `[]` is": that is why
21:11:19FromDiscord<.maverk> i got confused
21:11:40FromDiscord<Phil> is exporting a symbol
21:11:44FromDiscord<Phil> (edit) "" => "\"
21:11:45FromDiscord<demotomohiro> Nim and C are different language.
21:12:01FromDiscord<.maverk> i see
21:12:11FromDiscord<.maverk> In reply to @isofruit "\* is exporting a": what do you mean by exporting bro ?
21:12:12FromDiscord<System64 ~ Flandre Scarlet> in fact, [] makes sense
21:12:24FromDiscord<.maverk> In reply to @sys64 "in fact, [] makes": that's right
21:12:34FromDiscord<System64 ~ Flandre Scarlet> and in C, [] is also dereference
21:12:35FromDiscord<.maverk> in c [] returns the memory by default
21:12:45FromDiscord<.maverk> char name[] ↵↵printf name[]
21:12:58FromDiscord<System64 ~ Flandre Scarlet> arrays are just pointers in C
21:13:08FromDiscord<raynei486> In reply to @sys64 "and in C, []": ?
21:13:09FromDiscord<.maverk> yeah i now
21:13:17FromDiscord<.maverk> (edit) "now" => "know"
21:14:49FromDiscord<System64 ~ Flandre Scarlet> In reply to @raynei486 "?": if you allocate an array in C, it's a pointer↵So myArray[10] is dereferencing an address
21:15:03FromDiscord<raynei486> oh nvm
21:15:16FromDiscord<raynei486> I forgot `[]` was nice way to dereference
21:15:33FromDiscord<raynei486> I love my `2[arr]` to get the third element
21:15:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4EIg
21:16:32FromDiscord<.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4EIh
21:16:51FromDiscord<Phil> You can also just set yourself up with a playground project with 2 files and try to compile it
21:17:18FromDiscord<.maverk> i will try
21:22:52*azimut joined #nim
21:29:02FromDiscord<.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4EIj
21:29:45FromDiscord<heysokam> In reply to @.maverk "is * not the": Dereferencing a pointer means `getting the contents of the box pointed by this call number`↵Nim represents that with `thing[]`which could be read as `the box of thing`
21:30:18FromDiscord<heysokam> so it makes a lot of sense in reality, C might be standard but does things in really weird ways
21:30:49FromDiscord<.maverk> In reply to @heysokam "so it makes a": yeah
21:31:19FromDiscord<heysokam> and ptr is the word associated with the pointer, no weird symbol that has triple and quadruple meanings depending on context
21:31:27FromDiscord<heysokam> (edit) "ptr" => "`ptr`"
21:32:01FromDiscord<Elegantbeef> Range is not a slice
21:32:18FromDiscord<Elegantbeef> `var slic = 1..10`
21:32:19FromDiscord<heysokam> although, you will -very- rarely need actual pointers in nim. references do the same (unless you are interoperating with C, but that's on the C side)
21:32:42FromDiscord<Elegantbeef> Luckily references are interoperable with pointers depending on what the C code is doing
21:32:58FromDiscord<.maverk> In reply to @Elegantbeef "Range is not a": what do you mean ?
21:33:04FromDiscord<heysokam> In reply to @Elegantbeef "Luckily references are interoperable": that's news, didn't know. how does that work?
21:33:06FromDiscord<.maverk> what about the ``range`` datatype ?
21:33:23FromDiscord<Elegantbeef> A range is a subrange type it only allows specific ordinal values
21:33:31FromDiscord<heysokam> In reply to @.maverk "what about the ``range``": slices and ranges are different things. you were trying to assign one to the other
21:33:33FromDiscord<Elegantbeef> A slice is a start/end
21:33:47FromDiscord<Elegantbeef> References just pointers
21:33:59FromDiscord<Elegantbeef> So if you need a `T` in C and have a `ref T` in Nim you can just send it
21:34:03FromDiscord<.maverk> what am i suppose to do now ?
21:34:07FromDiscord<.maverk> to make it work
21:34:16FromDiscord<Elegantbeef> I showed you what to do
21:34:25FromDiscord<.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4EIk
21:34:32FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html
21:34:39FromDiscord<Elegantbeef> RTFM if you arent going to listen to me
21:35:09FromDiscord<Elegantbeef> Really rtfm regardless
21:35:14FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4EIl
21:36:04FromDiscord<.maverk> In reply to @Elegantbeef "RTFM if you arent": am i suppose to insult you very badly ?
21:36:15FromDiscord<.maverk> don't speak tome that way
21:36:23FromDiscord<.maverk> (edit) "tome" => "to me"
21:36:31FromDiscord<heysokam> In reply to @Elegantbeef "So if you need": you mean that, as long as the ref is not dealloc by the GC, they are basically equivalent to ptr when it comes to what C knows about them?
21:37:13FromDiscord<Elegantbeef> Indeed aslong as you are not giving up ownership there is no issue with passing a ref as a ptr
21:37:26FromDiscord<heysokam> oh that's great to know, had no idea
21:37:31FromDiscord<Elegantbeef> > am i suppose to insult you very badly ?↵If you want to
21:37:34FromDiscord<.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4EIo
21:37:48FromDiscord<Elegantbeef> Lol
21:37:59FromDiscord<Elegantbeef> Range types are just ordinals they cannot be iterated
21:38:06FromDiscord<Elegantbeef> Slices can be iterated they have a start/end
21:38:11FromDiscord<Elegantbeef> Please read the tutorial
21:38:13FromDiscord<Elegantbeef> Thanks
21:38:34FromDiscord<heysokam> beef, stop being obnoxious man, he is just new and has my type of obtuse learning. chill
21:39:25FromDiscord<heysokam> he definitely could use the tutorial, but its nicer to just point to where in the tut its explained, for example↵i don't know where, so cant point them
21:39:48FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html#advanced-types-subranges↵https://nim-lang.org/docs/tut1.html#advanced-types-slices
21:40:52FromDiscord<heysokam> @.maverk 👆 should explain it
21:41:09FromDiscord<.maverk> In reply to @heysokam "<@1021771961040375900> 👆 should explain": ok
22:21:29FromDiscord<heysokam> @Phil parsing the hardcase actually wasn't that bad at all after your help and Rika's↵I think I was making it worse with my silly filtering out instead of filtering in↵ty so much for the help earlier 🙏
22:22:18FromDiscord<heysokam> I changed it to first check if the line is a weird case, and echoing a warning↵and then just getting the result assuming its correct
22:22:34FromDiscord<heysokam> (edit) "its correct" => "the input is already corrected"
22:28:53*madprops_ is now known as madprops
22:28:53*madprops quit (Changing host)
22:28:53*madprops joined #nim
22:31:50FromDiscord<System64 ~ Flandre Scarlet> What is the best for a game? Options or Nil?
22:36:06FromDiscord<odexine> i believe a good amount of people would say to never use nil
22:38:29FromDiscord<Elegantbeef> If you want to represent a bad state `nil` is not really that sensible as it introduces a heap allocation
22:40:53FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "If you want to": and performances wise?
22:42:31FromDiscord<Elegantbeef> Heap allocations are slow
22:42:59FromDiscord<System64 ~ Flandre Scarlet> I meant between Nil and Options
22:43:32FromDiscord<Elegantbeef> Options are stack allocated so they do not introduce substantial performance losses
22:44:08FromDiscord<System64 ~ Flandre Scarlet> Oh, pretty interesting!
22:44:19FromDiscord<System64 ~ Flandre Scarlet> Nil, for stack
22:44:38FromDiscord<arathanis> nil is an empty ref type so by its veyr nature you are working with the heap
22:44:44FromDiscord<arathanis> at least that is how i understand it
22:45:16FromDiscord<Elegantbeef> Well if you use `ptr T` you could have a pointer to a stack type
22:45:19FromDiscord<arathanis> (edit) removed "type"
22:45:55FromDiscord<Elegantbeef> But i'm not going to suggest using `ptr T` in a memory safe langauge
22:46:24FromDiscord<System64 ~ Flandre Scarlet> Only use pointers when you know what you're doing
22:46:45FromDiscord<System64 ~ Flandre Scarlet> With great powers comes great responsabilities
22:48:13FromDiscord<odexine> how do i know if i know what im doing
22:48:44FromDiscord<Elegantbeef> Trick question, it's you. You never do
22:51:11FromDiscord<System64 ~ Flandre Scarlet> Avoid Pointers, avoid C language, boycott C++
22:58:47arkanoidmmm I'm back to my previous problem, but now is slightly different. Why I get double free here? https://play.nim-lang.org/#ix=4EIu
23:00:49FromDiscord<Elegantbeef> `--expandArc:test`
23:04:46FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "`--expandArc:test`": What is that?
23:05:16FromDiscord<Elegantbeef> It shows the code that is generated
23:05:27FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4EIy think this is 'proper'
23:05:34FromDiscord<Elegantbeef> I do not really know with the new hooks
23:05:54FromDiscord<System64 ~ Flandre Scarlet> Oh alright
23:06:25FromDiscord<System64 ~ Flandre Scarlet> Yo what? Object suppports Generics?!
23:07:07FromDiscord<Elegantbeef> How else do you think `Table[X, Y]` worked?
23:07:21FromDiscord<System64 ~ Flandre Scarlet> Ah yeah, makes sense now!
23:08:44arkanoidElegantbeef! Ok, now this makes sense again. Thanks. But what is the default implementation of the hooks? Can I read them?
23:08:56arkanoidif any
23:08:58FromDiscord<Elegantbeef> https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks
23:10:46FromDiscord<Elegantbeef> The default implementation is what you would imagine though `sink` is assign left to right, then call `wasMoved` on the right side. `destroy` calls `=destroy` on all fields. `=copy` creates a clone of the data, `=trace` runs `trace` on all possibly GC'd data types
23:12:07arkanoidso what that page calls "The general pattern in X looks like" really means "hooks are automatically generated but overraidable, here the default version"
23:12:19FromDiscord<Elegantbeef> Practically yes
23:13:07arkanoidok, thanks. I was just confused by the wording used in the manual then
23:17:06arkanoidwould be nice to be able to read the genared hooks for a custom type. Just like expandArc, but expandHooks
23:17:17arkanoid*generated
23:17:46FromDiscord<Elegantbeef> You could look at the generated C
23:18:08FromDiscord<Elegantbeef> Hooks for automatically GC'd types arent that complicated though
23:21:12arkanoidwell sure I can, but generated C is quite far from Nim AST. Otherwise also expandArc would be useless, just read C
23:21:32FromDiscord<Elegantbeef> Hey I wasnt being that sincere
23:26:07*xet7 joined #nim
23:36:43arkanoidjust used the wrong words myself. Sure I got your point. I didn't want to sound rude