<< 17-04-2023 >>

00:00:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tBf
00:00:18FromDiscord<Elegantbeef> I'm just a funky chatgpt
00:01:45FromDiscord<Ayy Lmao> That's what c2nim was saying but I was hoping there was a prettier way.
00:01:56FromDiscord<Ayy Lmao> `ClapNsView = ClapNsView` 👀
00:02:02FromDiscord<Elegantbeef> That was me being dumb
00:02:10FromDiscord<Elegantbeef> Nim doesnt have anonymous unions(for good reason i'd argue)
00:02:50FromDiscord<Ayy Lmao> Do you have to do `window.union.win32` to access it?
00:02:56FromDiscord<Elegantbeef> Yes
00:03:03FromDiscord<Elegantbeef> If you do not want that write accessors
00:03:14FromDiscord<Ayy Lmao> I guess that could be done
00:03:34*pbsds joined #nim
00:04:25FromDiscord<Ayy Lmao> I noticed you didn't put `bycopy` on anything but c2nim puts it on everything. When is it important to put it?
00:04:51FromDiscord<Elegantbeef> Does the API pass the value with a pointer always or does it pass it by vallue
00:05:26FromDiscord<Ayy Lmao> Most things are passed by pointer I think
00:05:38FromDiscord<Elegantbeef> If you're interoping with C you need to disable Nim's optimisation if it's a large object
00:05:58FromDiscord<Elegantbeef> by default Nim decides on how to pass an object by it's size, you can override this by using `{.bycopy.}`
00:06:13FromDiscord<Elegantbeef> Adding it mimics the way C does things
00:06:23FromDiscord<Ayy Lmao> That makes sense
00:16:15*cm quit (Ping timeout: 255 seconds)
00:55:05FromDiscord<lauvrens> sent a code paste, see https://play.nim-lang.org/#ix=4tBj
00:55:26FromDiscord<Elegantbeef> Uhoh you're catching a defect
00:56:24FromDiscord<lauvrens> Yeah the current error is Index defect just for testing
00:56:42FromDiscord<Elegantbeef> Well defects are not supposed to be caught is my point
00:56:54FromDiscord<lauvrens> Oh
00:56:59FromDiscord<Elegantbeef> But anyway you cannot really do what you want
00:58:03FromDiscord<Elegantbeef> reading from the stdin is blocking so while doing `readLine` it waits for a `\n` also known as user input
00:59:27FromDiscord<lauvrens> damn ok this is tough
01:01:02FromDiscord<lauvrens> sent a code paste, see https://play.nim-lang.org/#ix=4tBl
01:01:09FromDiscord<lauvrens> (edit) "https://play.nim-lang.org/#ix=4tBl" => "https://play.nim-lang.org/#ix=4tBm"
01:01:28FromDiscord<Elegantbeef> What's an invalid line?
01:01:46FromDiscord<lauvrens> some uncaught error that causes the program to terminate
01:02:37FromDiscord<Elegantbeef> I'm a bit confused how that matters
01:03:18FromDiscord<Elegantbeef> It's not like shells backread the stdin and use characters that were not read
01:03:19FromDiscord<that_dude> Is this a parsing issue or an invalid character issue?
01:03:34FromDiscord<Elegantbeef> Yea like what are you doing that this is a concern
01:12:50FromDiscord<lauvrens> its just some weird behaviour i wanted to prevent, its not important. just wanted to see if there was a way to exit it 'cleanly' if that makes sense
01:16:35FromDiscord<that_dude> There's many types of weird behavior ya know? Can't you give an example instead of being so round about what an issue looks like? If your input can be delimited by newlines you can just do that and stop parsing and exit on something that fails to parse
01:24:05*derpydoo joined #nim
01:24:11FromDiscord<Raynei486> Is there some kind of example for `std/lexbase`
01:24:51FromDiscord<Raynei486> especially what's `handleCR` and `handleLF` for
01:25:18*nanxiao joined #nim
01:29:37FromDiscord<Elegantbeef> Seems it's for skipping lfcr
01:29:43FromDiscord<Elegantbeef> sorry CRLF 😄
01:30:02FromDiscord<lauvrens> i wanted to handle the exception so that it reads all the input before leaving the program.↵↵the input being read into the terminal after the program ends _is_ the wierd behaviour to me. again its not important i just wanted to see if it was possible https://media.discordapp.net/attachments/371759389889003532/1097333111903223918/X4kHZ4c.png
01:30:52FromDiscord<Elegantbeef> Why is the program crashing though
01:30:52FromDiscord<Elegantbeef> You have an index defect, solve that issue then you will not have a crash
01:31:10FromDiscord<Elegantbeef> Do not compile a release build to actually get a usable stack trace
01:35:53FromDiscord<Raynei486> In reply to @Elegantbeef "Seems it's for skipping": What did lifecore biomedical do?? https://media.discordapp.net/attachments/371759389889003532/1097334587736215552/image.png
01:35:55FromDiscord<lauvrens> yeah ur right im just stubborn and wanted to implement it in general.
01:36:26FromDiscord<Raynei486> okay so CRLF is fancy line breaks
01:44:13FromDiscord<that_dude> Yeah iirc linux just uses \n and knows what you want while windows uses \cr to return the cursor to the left and \lf to go down
01:44:28FromDiscord<that_dude> (edit) "Yeah iirc linux just uses \n and knows what you want while windows uses \cr to return the cursor ... to" added "all the way"
01:50:36FromDiscord<Nilts> How would I get child element by name in karax?
01:50:55FromDiscord<Nilts> (Ping on reply, and please reply)
01:59:18FromDiscord<Elegantbeef> In the old times of teletypes you'd actually need a carriage return and line feed, but in the modern age you do not
02:01:22FromDiscord<Elegantbeef> Suppose I should @Raynei486 😄
02:01:31FromDiscord<Elegantbeef> Otherwise i'm just inanely talking into the void
02:02:13FromDiscord<Raynei486> In reply to @Elegantbeef "*In the old times": ah yeah the real terminals
02:04:08FromDiscord<that_dude> Classic windows backwards compatibility
02:06:08FromDiscord<lauvrens> In reply to @Elegantbeef "It's not like shells": this flew over my head so i glossed over it but i get it now.↵↵my issue was that i did not understand how shells actually↵process input. sry for wasting your time 😆 ✍️
02:06:22FromDiscord<Elegantbeef> Well i'd still fix the index defect
02:06:37FromDiscord<lauvrens> yeh of course its already fixed :>
02:06:52FromDiscord<Elegantbeef> Gud
02:06:53FromDiscord<Nilts> In reply to @not logged in "How would I get": Should i move this to #webdev
02:08:51FromDiscord<Elegantbeef> I imagine one has to manually iterate over the VNode searching for the name
02:14:35*cm joined #nim
02:36:25*ltriant quit (Ping timeout: 240 seconds)
02:41:03*ltriant joined #nim
02:50:56FromDiscord<JeysonFlores> sent a long message, see http://ix.io/4tBu
02:51:41FromDiscord<JeysonFlores> is there any special consideration I haven't done?
02:52:08FromDiscord<Elegantbeef> std/terminal has `setCursorXPos`
03:13:16*arkurious quit (Quit: Leaving)
03:13:54*nanxiao quit (Quit: Client closed)
03:18:35FromDiscord<Rika> `fmt""` does not interpret escape codes
03:20:22*nanxiao joined #nim
03:23:39rockcaveraJeysonFlores, use echo fmt"Loading {i} {'\r'}"
03:24:19FromDiscord<Elegantbeef> or just \`fmt "Loading {i} \\r"
03:25:16FromDiscord<Rika> that's with a space if you dont notice
03:49:15*cm quit (Ping timeout: 250 seconds)
03:49:21FromDiscord<JeysonFlores> thanks dudes but it seems the documentation on the std/terminal module provides a full example of a progress bar
03:50:48*cm joined #nim
04:23:18*nanxiao quit (Quit: Client closed)
05:05:44*nanxiao joined #nim
05:38:22*advesperacit joined #nim
06:03:29FromDiscord<Arvin❓> sent a code paste, see https://play.nim-lang.org/#ix=4tBQ
06:04:14FromDiscord<Arvin❓> In reply to @Arvin❓ "curious to why this": ``Error: unhandled exception: over- or underflow [OverflowDefect]``↵``Error: execution of an external program failed:`
06:04:26FromDiscord<Elegantbeef> You're overflowing
06:04:37FromDiscord<Elegantbeef> It runds til it overflows
06:04:39FromDiscord<Elegantbeef> runs\
06:04:46FromDiscord<Arvin❓> In reply to @Elegantbeef "You're overflowing": where and how?
06:05:21FromDiscord<Elegantbeef> It tells you where
06:05:42FromDiscord<lauvrens> the number is increasing, it never reaches 1
06:07:20FromDiscord<that_dude> Doesn't it also give this error when the while loop runs for too long?
06:07:41FromDiscord<that_dude> I thought that happened to me before
06:07:48FromDiscord<Arvin❓> In reply to @lauvrens "the number is increasing,": so a number that is steadily increasing will lead to overflow? or does it have something to do with the loop or something? What topic should i learn to understand this problem
06:07:54FromDiscord<Elegantbeef> That's stack overflow and it's not while loop
06:07:55FromDiscord<Arvin❓> (edit) "problem" => "problem?"
06:08:07FromDiscord<Elegantbeef> Overflow i when you have a number outside of a the range of the integer
06:08:15FromDiscord<Elegantbeef> Go read the wikipedia about it
06:08:33FromDiscord<Elegantbeef> you can have a max value of 2^63 - 1 inside an `int`
06:08:33FromDiscord<lauvrens> In reply to @Arvin❓ "so a number that": im pretty sure it has to do with the number being larger than what the variable can handle
06:10:16*nanxiao quit (Quit: Client closed)
06:10:40FromDiscord<Elegantbeef> An `int` in Nim is a signed platform dependant integer that is commonly 64bit
06:10:52FromDiscord<Elegantbeef> Which means you have a limited range
06:10:57*Notxor joined #nim
06:11:39*ltriant quit (Read error: Connection reset by peer)
06:12:09*ltriant joined #nim
06:13:53*fallback_ joined #nim
06:14:11FromDiscord<that_dude> Btw if you're doing the collatz conjecture, your issue is that you're doing `2n + 1` which will always return odd instead of `3n + 1` which will return even
06:14:30FromDiscord<that_dude> So it will always balloon to infinity
06:16:15FromDiscord<Arvin❓> sent a code paste, see https://play.nim-lang.org/#ix=4tBU
06:16:30FromDiscord<Rika> overflows can be detected on compile time but otherwise they can happen on runtime
06:16:34FromDiscord<Arvin❓> In reply to @that_dude "Btw if you're doing": Yes, i made a mistake of using 2
06:17:50FromDiscord<Elegantbeef> If a value is known at compile time it will overflow there otherwise it overflows at runtime
06:20:48*nanxiao joined #nim
06:28:27*cm_ joined #nim
06:28:45*cm quit (Ping timeout: 240 seconds)
06:28:48*cm_ is now known as cm
06:47:33*fredrikhr92 is now known as fredrikhr
06:50:46FromDiscord<morgan> has anyone used fidget along with rendering a custom mesh? i'm contemplating writing my own 3d graphing calculator
06:53:19FromDiscord<morgan> also considering nimx
06:54:03FromDiscord<morgan> but having recently gotten familiar with figma for something else, i feel more confident i could make it look nice with figma/fidget
06:54:37FromDiscord<Rika> beef can you explain to me what the hook method is for making externally extensible modules because i also need my data types to store state and i dont know how i'd do that without going through generics or variants
06:55:30FromDiscord<Elegantbeef> hook method?
06:55:47FromDiscord<Rika> idk i hear about hooks sometimes when people talk about the newer json libraries
06:56:07FromDiscord<Elegantbeef> Oh ok so generic interfaces
06:56:21FromDiscord<Rika> but i'd like these extensions to be per object and not per type
06:56:23FromDiscord<Rika> well
06:56:36FromDiscord<Rika> per object and per type would apply ig if i use generics
06:56:52FromDiscord<Rika> for context i'm working on that progress bar library again
06:56:56FromDiscord<Elegantbeef> Well you'd just make the per object procedure inside the per type
06:57:10FromDiscord<Rika> yes but then what about state
06:57:20FromDiscord<Rika> generics would be annoying
06:57:39FromDiscord<Elegantbeef> What type of state is required?
06:58:13FromDiscord<Rika> lets say like statistics on the progress bar OR messages displayed or whatever else
06:58:45*cm quit (Ping timeout: 240 seconds)
07:00:22FromDiscord<Elegantbeef> Yea I'd go with generic interfaces that can override default behaviour
07:00:36FromDiscord<Elegantbeef> I do not know what the blocker really is, I need a code example of the problem
07:02:14FromDiscord<Rika> well, i have a data type that manages multiple progress bars (another data type) and i would like to be able to store different styles of these progress bars (lets say one that doesnt use statistics data and one that does) in that manager data type, and lets say i cannot say what these bars' inner generic types are beforehand
07:03:22FromDiscord<Elegantbeef> Ah so you have runtime polymorphism really
07:03:43FromDiscord<Rika> eugh
07:04:12FromDiscord<Elegantbeef> You have a top level object that stores sub objects which can have different attributes
07:04:31FromDiscord<Rika> :nyoron:
07:04:32FromDiscord<Elegantbeef> That sounds like either using pointer procedures or inheritance
07:08:20FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/7Yt
07:08:32FromDiscord<Elegantbeef> But yea everything isnt going to be pretty
07:08:45FromDiscord<Rika> the progress needs to store state across its function call
07:08:54FromDiscord<Elegantbeef> progress is a closure procedure
07:09:04FromDiscord<Elegantbeef> State is stored inside the closure instead of on the object
07:09:21FromDiscord<Rika> hmm i guess thats one way but it feels inelegant
07:09:33FromDiscord<Elegantbeef> Yea inheritance is likely the best
07:15:23FromDiscord<lauvrens> sent a code paste, see https://play.nim-lang.org/#ix=4tC1
07:15:49FromDiscord<Elegantbeef> How do i not insult you for using regex 😄
07:15:49*cm joined #nim
07:16:21FromDiscord<lauvrens> I have to filter out a lot of stuff 😆
07:17:03FromDiscord<lauvrens> I tried tokenize but it doesnt separate quotation marks
07:17:16*nanxiao quit (Quit: Client closed)
07:17:42FromDiscord<Elegantbeef> What are you filtering out?
07:17:43*ltriant quit (Ping timeout: 276 seconds)
07:18:44FromDiscord<lauvrens> everything that's not a word, like commas, quotations, full stops, etc.
07:19:13FromDiscord<lauvrens> but if theres an apostrophe like `that's` then i keep it
07:19:41FromDiscord<Elegantbeef> Sounds like you should just write the procedure that does that
07:20:39FromDiscord<lauvrens> Yeah I copied std/tokenize and just modifying it
07:21:24FromDiscord<Elegantbeef> So where does regex come in?
07:21:30FromDiscord<lauvrens> still curious why theres an empty string there though...
07:21:46FromDiscord<Elegantbeef> No clue i do not use regex let alone the `re` module
07:22:45FromDiscord<lauvrens> I just pasted a sentence in regex101 and just played around until everything i didnt want was matched
07:28:41*nanxiao joined #nim
07:41:57*kenran joined #nim
07:45:20*azimut quit (Ping timeout: 255 seconds)
07:51:18FromDiscord<0ffh> sent a long message, see http://ix.io/4tC4
07:52:04FromDiscord<morgan> a whole bunch of str.replace or whatever it is would work
07:52:19FromDiscord<morgan> there might even be a version that takes a list tho idk
07:52:32FromDiscord<morgan> about to go to bed
07:53:43FromDiscord<lauvrens> In reply to @0ffh "That's a common problem": that makes a lot of sense, thank you!
07:55:43FromDiscord<Elegantbeef> multireplace does work
08:04:16*rockcavera quit (Remote host closed the connection)
08:25:18*nanxiao quit (Quit: Client closed)
08:37:24*PMunch joined #nim
08:51:16*nanxiao joined #nim
09:10:48FromDiscord<Bung> I remenber there's pragma switch make procs take same first param without defined in individual procs, what is it?
09:11:33FromDiscord<Elegantbeef> Do you mean the using statement?
09:13:18FromDiscord<Bung> oh, yes
09:14:03NimEventerNew post on r/nim by PMunch: Article on wrapping C libraries in Nim, see https://reddit.com/r/nim/comments/12p967y/article_on_wrapping_c_libraries_in_nim/
09:15:52NimEventerNew thread by PMunch: Article on wrapping C libraries in Nim, see https://forum.nim-lang.org/t/10106
09:17:50Amun-RaI can see why strictDefs are experimental, https://play.nim-lang.org/#ix=4tCj
09:19:29FromDiscord<Elegantbeef> That's working as intended afaik
09:19:54FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4tCk
09:20:41PMunchThat shouldn't be needed though..
09:20:49FromDiscord<Elegantbeef> Strict defs
09:20:54PMunchStill
09:21:13PMunchWhat would it be apart from `default`?
09:21:41FromDiscord<Elegantbeef> It would require quite a bit of compiler logic to see that you iterate the entire range of the array and intialize every index
09:22:10PMunchOh wait, that is the point of strictDefs?
09:22:16FromDiscord<Elegantbeef> Yess
09:22:26PMunchWhy would that be useful?
09:22:29FromDiscord<Elegantbeef> The point of strictdef is to ensure you intialize a variable explicitly
09:22:51FromDiscord<Elegantbeef> Araq liked the idea of definite assignment
09:23:23FromDiscord<Elegantbeef> `out` was also implemented
09:23:33PMunchBut everything is initialized as `default` anyways? I'm confused :P
09:23:56FromDiscord<Elegantbeef> Do not look at me
09:24:07FromDiscord<Elegantbeef> I find strictdefs quite questionable when `requiresInit` exists
09:24:18PMunch`out` is fine though
09:25:01PMunchThat's a pretty cool feature
09:25:32FromDiscord<Elegantbeef> out or requires?
09:25:41PMunchBoth TBH
09:27:10FromDiscord<Elegantbeef> The odd thing is that strictdefs was added after object defaults
09:27:36FromDiscord<Elegantbeef> so like with strict defs you have to do `var a = default MyType` instead of `var a: MyType` even if you explicitly defined a default state
09:33:44FromDiscord<jmgomez> Do this looks like a CI error? https://github.com/nim-lang/Nim/pull/21628/checks?check_run_id=12795877755
09:35:46NimEventerNew question by AlfredBaudisch: Why debugging Nim with GDB yields &quot;No symbol XXX in current context&quot; when trying to introspect variables?, see https://stackoverflow.com/questions/76033676/why-debugging-nim-with-gdb-yields-no-symbol-xxx-in-current-context-when-trying
09:38:48Amun-RaElegantbeef: oh, thanks; I've tried result.reset but the warning was still on
09:55:16*nanxiao quit (Quit: Client closed)
10:28:54FromDiscord<theSherwood> Any examples of NaN boxing in the community?
10:31:38*derpydoo quit (Quit: derpydoo)
10:33:24FromDiscord<theSherwood> sent a code paste, see https://play.nim-lang.org/#ix=4tCt
10:39:53FromDiscord<wiga> Anyone having compiling error with nim-regex with threading and json?
10:40:23FromDiscord<wiga> Maybe I haven't looked at it much to say that but it seemed to conflict with json
10:40:48FromDiscord<wiga> Or my regex array is not able to compile at compiletime
10:55:03FromDiscord<fabricio> why do I have `pkgs` and `pkgs2` inside `~/.nimble`
10:55:22FromDiscord<fabricio> like why both, is there any difference between them?
10:55:32FromDiscord<Yardanico> yes, different format of storage
10:55:41FromDiscord<Yardanico> because nimble got a new version which stores stuff differently
10:55:44PMunchBasically Nim 2 changes
10:56:00FromDiscord<Yardanico> well, technically it's separate from nim 2, but yeah :)
10:56:16PMunchUnfortunately if you have a pkgs folder then Nim 2.0 won't see the pkgs2 folder..
10:56:19PMunchWhich is dumb
10:56:28FromDiscord<ricky> In reply to @theSherwood "Any examples of NaN": cursed
10:56:37FromDiscord<ricky> pointers were not supposed to be tagged..
10:57:03FromDiscord<fabricio> In reply to @PMunch "Unfortunately if you have": well when I install stuff with nimble it saves them in `pkgs2`
10:57:28FromDiscord<System64 ~ Flandre Scarlet> Hi, is it possible to sort a seq of Point(x, y: int) by their Y value?
10:57:47PMunchYes, but if you install something with pre-2.0 Nimble then Nim won't see the post-2.0 packages
10:58:00PMunch@System64_~_Flandre_Scarlet, yes
10:58:19FromDiscord<System64 ~ Flandre Scarlet> How can I o that please? I need a lambda?
10:58:30PMunchCheck out the algorithm module
10:58:39FromDiscord<fabricio> In reply to @PMunch "Yes, but if you": so is it ok if I just delete `pkgs`
10:58:40FromDiscord<theSherwood> In reply to @Rictus "pointers were not supposed": Leaving the advisability of it to one side, can it be done in Nim?
10:58:49PMunch@fabricio, yes
10:58:55FromDiscord<fabricio> thanks
10:59:16PMunchBut if you switch back to pre-2.0 then it won't see any of the packages you installed with 2.0 Nimble
10:59:16FromDiscord<ricky> In reply to @theSherwood "Leaving the advisability of": in theory
10:59:52FromDiscord<ricky> the thinking man's choice is x86 asm `bswap` tho
11:00:02PMunch@theSherwood, in general the question "can it be done in Nim" is answered with "yes"
11:00:09FromDiscord<ricky> and store the flag on the end
11:00:18FromDiscord<ricky> no need to do real-time bit shifting
11:00:50FromDiscord<ricky> think there's an even better instruction now as well forget the name
11:00:55FromDiscord<ricky> a lord like @treeform would prob know
11:03:55FromDiscord<theSherwood> Am I understanding correctly that bswap swaps endianness?
11:06:47FromDiscord<theSherwood> In reply to @PMunch "<@570542675745308672>, in general the": So then the byte sequence would no longer be NaN and it would be possible to read it as bytes? Is that the idea?
11:07:20PMunchOh I have no idea what you're trying to do, I was just saying that everything is possible
11:07:43FromDiscord<theSherwood> Gotcha. I'm just trying to read NaN as a sequence of bytes.
11:08:31FromDiscord<theSherwood> But I get `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` which sort of suggests to me that NaN isn't just a float?
11:10:57*ltriant joined #nim
11:12:37PMunchI'm not quite sure what the problem is: https://play.nim-lang.org/#ix=4tCz
11:15:32FromDiscord<theSherwood> Interesting. I was using `echo cast[seq[byte]](NaN)` which does not work for NaN but seems to work for other floats.
11:15:49PMunchIt shouldn't..
11:16:14PMunchA seq[byte] is a pair of size/capacity integers and a pointer to the actual data
11:16:53FromDiscord<theSherwood> So the issue is that you can't point to a literal?
11:17:10PMunchNo
11:17:32PMunchThe issue is that you try to cast a single 8 byte value into a 24 byte complex object
11:17:59PMunchIt's like calling your car a boat and being surprised when it sinks as you drive it into the lake
11:19:55PMunchIt "worked" with other numbers purely by coincidence
11:20:23FromDiscord<theSherwood> Hmm. I don't follow how it worked by coincidence
11:20:41PMunchSome cars happen to be slightly waterproof
11:21:00FromDiscord<theSherwood> haha. Okay. So just based on the value of the float?
11:21:07PMunchPretty much
11:21:18FromDiscord<djazz> pmunch: typo in article "square on" should be "square one"
11:21:42FromDiscord<theSherwood> In reply to @PMunch "Pretty much": bizarre. That's good to know. thanks for your help
11:21:55PMunchIt would read the value of the float as the size (i.e. amount of elements stored) and then grab the capacity (i.e. memory allocated) and pointer to the data from the next two numbers on the stack
11:22:21FromDiscord<theSherwood> Ohh. Okay. gotcha. that makes sense
11:22:24PMunch@djazz, thanks :)
11:22:42FromDiscord<demotomohiro> @theSherwood Maybe, `cast[array[uint8, 8]](NaN)` is what you want.
11:23:10FromDiscord<theSherwood> Yep. cheers!
11:23:20PMunchWell, what he wants is probably to do something more sane than casting floats to ints..
11:23:30PMunchfloats to int arrays*
11:24:25*kenran quit (Ping timeout: 240 seconds)
11:24:36FromDiscord<theSherwood> Yeah, I'm just doing to bit shuffling stuff for my learning. This isn't actually going to be used anywhere.
11:27:06NimEventerNew Nimble package! youtubescraper - Very fast and lightweight YouTube scraper for Nim., see https://github.com/TaxMachine/youtubescraper
11:27:07NimEventerNew Nimble package! nimppt - A simple and elegant presentation generator, see https://github.com/HUSKI3/Nimppt
11:28:04PMunch@theSherwood, aah I see, well in that case go nuts :)
11:28:19FromDiscord<theSherwood> ha. will do
12:32:37*kenran joined #nim
12:36:51*lucasta joined #nim
12:40:05FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=4tD5
12:42:50NimEventerNew thread by freeflow: += operator with if statement gives errors, see https://forum.nim-lang.org/t/10107
12:42:54PMunchNo, still not possible
13:10:03FromDiscord<Yardanico> In reply to @qb "I saw a big": yeah, as PMunch said, so you either use different field names or use libs like https://github.com/beef331/fungus and https://github.com/alaviss/unionand
13:10:11FromDiscord<Yardanico> (edit) "https://github.com/alaviss/unionand" => "https://github.com/alaviss/union"
13:15:43*jmdaemon quit (Ping timeout: 252 seconds)
13:24:52*Notxor quit (Remote host closed the connection)
13:28:33*Notxor joined #nim
13:33:53*Notxor quit (Remote host closed the connection)
13:35:57*Notxor joined #nim
13:53:58*progranner joined #nim
13:56:13*progranner quit (Client Quit)
13:59:10*PMunch quit (Quit: Leaving)
14:04:35*progranner joined #nim
14:05:04*arkurious joined #nim
14:10:59*arkurious quit (Quit: Leaving)
14:12:58FromDiscord<Nilts> In reply to @Elegantbeef "I imagine one has": In js you just do element.name, and I was wondering if you could do that in karax
14:23:42*fredrikhr quit (Quit: Disconnecting...)
14:26:09*hochata joined #nim
14:28:06FromDiscord<WabileM> Ssh2
14:32:07FromDiscord<WabileM> Using the ssh2 library, the command "echo await client.execCommand(command_on_remote_server)" return the output of the command. How do I capture this output into a string variable to allow me to parse it?
14:32:34FromDiscord<Yardanico> In reply to @WabileM "Using the ssh2 library,": uhh, I'm sorry, but have you actually read the basics of the language?
14:32:45FromDiscord<Yardanico> you just assign the output to the variable instead of echo'ing it like let myvar = <statement>
14:32:53FromDiscord<Yardanico> (edit) "<statement>" => "<expression>"
14:32:59FromDiscord<Yardanico> echo is a proc that takes an expression that returns a string and outputs it
14:34:29FromDiscord<Nilts> how do i do element.name to get a child element with name in karax without digging through children
14:34:41FromDiscord<WabileM> I use Nim for quite a number of scripts. I have tried assign the ssh output to a string variable and the compiler complains. Echo works well to display the output on the screen.
14:35:01FromDiscord<Yardanico> In reply to @WabileM "I use Nim for": can you show the error what happens when you do `let myvar = await client.execCommand(command_on_remote_server)`
14:35:04FromDiscord<Yardanico> (edit) "what" => "that"
14:35:21FromDiscord<Yardanico> if you have a specific issue, it's best to mention it instead of asking for workarounds in the chat right away without mentioning the original issue
14:38:54FromDiscord<WabileM> the specific error I get is:
14:38:56FromDiscord<WabileM> Error: type mismatch: got '(string, string, int)' for '↵var internalTmpFuture`gensym20: FutureBase = execCommand(client, command)
14:39:49FromDiscord<WabileM> I have
14:39:52FromDiscord<WabileM> var cmdOutput = ""
14:40:03FromDiscord<WabileM> cmdOutput = await client.execCommand(command)
14:40:14FromDiscord<Yardanico> yes, because that execCommand returns a tuple of 3 values, not just the string output
14:40:24FromDiscord<Yardanico> it tells you that with (string, string, int) which is a tuple with string, string and an int
14:40:47FromDiscord<Yardanico> you can see it returns 2 strings: stdout and stderr, and exitcode as the third int https://media.discordapp.net/attachments/371759389889003532/1097532112464257114/image.png
14:40:53FromDiscord<Yardanico> <https://github.com/ba0f3/ssh2.nim/blob/master/src/ssh2.nim#L43>
14:41:56FromDiscord<Nilts> In reply to @not logged in "how do i do": how do i do it while digging through the children?
14:42:23FromDiscord<⃟⃟> is the last name "Rumpf" derived from "rump"
14:42:29FromDiscord<Yardanico> In reply to @⃟⃟ "is the last name": go to #offtopic
14:42:33FromDiscord<WabileM> thank you Yardanico. I did have a look at the definition of that procdure, but I did not interpret the return value as a tuple. I was probabbly not paying attention.
14:42:44*rockcavera joined #nim
14:42:46FromDiscord<Yardanico> if you continue asking this question every day in this channel, I will consider that as trolling
14:43:42FromDiscord<guttural666> In reply to @PMunch "<@375727321958580228>, I'm actually writing": that was a long one 😄 very nice
14:49:32NimEventerNew thread by ringabout: My Nim Development Weekly Report (4/16), see https://forum.nim-lang.org/t/10108
14:51:25*cm_ joined #nim
14:52:16*cm quit (Ping timeout: 248 seconds)
14:52:16*cm_ is now known as cm
14:55:35*Notxor quit (Remote host closed the connection)
14:57:59*Notxor joined #nim
14:59:59NimEventerNew post on r/nim by h234sd: Mono, Nim Web Framework, see https://reddit.com/r/nim/comments/12pjzgi/mono_nim_web_framework/
15:11:07FromDiscord<Nilts> window.location.replace in nim?
15:32:50*rockcavera quit (Read error: Connection reset by peer)
15:33:09*rockcavera joined #nim
15:33:09*rockcavera quit (Changing host)
15:33:09*rockcavera joined #nim
15:58:18*kenran quit (Remote host closed the connection)
16:18:18*PMunch joined #nim
16:21:00PMunchHmm, I'm getting this error from a project which used to work.. Error: undeclared field: 'tryRecv' for type channels.Chan [type declared in /home/peter/.nimble/pkgs/threading-0.1.0/threading/channels.nim(320, 3)]
16:22:13PMunchAh, I had a nim.cfg file with mm: orc in it
16:22:19PMunchApparently that was the issue
17:16:39FromDiscord<Oscour> Hi! Very quick question to which I'm not sure I found an answer online. I created an array of 16 bytes and would like to divide in 2 slices: one that references the 2 first elements and the second one the remaining 14 bytes. I want that if I change value in one of the slice, the change also happens in the reference array (so no data copy). Is there a simple way to do that? otherwise, I will just store the Slice objects in variables and us
17:17:26FromDiscord<Oscour> I am looking for a similar behavior to micropython's memoryviews: https://docs.micropython.org/en/v1.9.3/pyboard/reference/speed_python.html#arrays
17:29:25FromDiscord<auxym> In reply to @Oscour "Hi! Very quick question": Exoerimental atm: https://nim-lang.org/docs/manual_experimental.html#view-types
17:30:17FromDiscord<auxym> otherwise you could implement a pointer (or ref) / indices wrapper object as you suggest. note that using ptrs is unsafe and could result in use after free bugs if you are not careful.
17:40:13FromDiscord<Oscour> Thanks! I tried the views and it didn't work. Frankly I am just gonna use the indices as using a view in this case seems unecessary. I'm just trying to port a micropython library to Nim so I would have mean easier copy and pasting haha 😄
17:50:20*rockcavera quit (Remote host closed the connection)
17:51:40*rockcavera joined #nim
17:55:20FromDiscord<guttural666> is it smart to keep futures around for a long time, if I only need them way later in the life time of the program? I think procedure state has to be kept around for that long to be resumable, right?
18:01:34*PMunch quit (Quit: leaving)
18:18:40*lucasta quit (Remote host closed the connection)
18:49:16*rockcavera quit (Read error: Connection reset by peer)
18:50:57*rockcavera joined #nim
18:50:57*rockcavera quit (Changing host)
18:50:57*rockcavera joined #nim
18:52:18*rockcavera quit (Read error: Connection reset by peer)
18:52:37*rockcavera joined #nim
18:52:37*rockcavera quit (Changing host)
18:52:37*rockcavera joined #nim
18:57:06*hochata quit (Remote host closed the connection)
19:01:27FromDiscord<aIbert> what are some most important drawbacks of karax vs svelte?
19:16:27*tjaden quit (Quit: leaving)
19:49:44*rockcavera quit (Read error: Connection reset by peer)
19:50:14*rockcavera joined #nim
19:50:43FromDiscord<guttural666> what is the async verson of let string = readLine(stdin)?
19:50:53*rockcavera quit (Read error: Connection reset by peer)
19:51:12*rockcavera joined #nim
19:54:58*onetwo quit (Quit: The Lounge - https://thelounge.chat)
20:00:10FromDiscord<Phil> Do we even have an async way to deal with Io like that?
20:00:14*rockcavera quit (Read error: Connection reset by peer)
20:00:33*rockcavera joined #nim
20:00:33*rockcavera quit (Changing host)
20:00:33*rockcavera joined #nim
20:01:29FromDiscord<guttural666> there seemed to be according to outdated chatGPT
20:02:51FromDiscord<guttural666> I want to be able to pause or cancel a bunch of async API requests that may run for a long time
20:12:49FromDiscord<Dudugz> Currently I don't think it has, although I think it should have.
20:13:26FromDiscord<Dudugz> Like JS, the filesystem API has both sync and async versions, and it is recommended to use the async version.
20:13:43FromDiscord<Dudugz> ``node:fs/promises``
20:15:04*onetwo joined #nim
20:20:01FromDiscord<guttural666> In reply to @Dudugz "Like JS, the filesystem": yeah I've seen std/asyncfile
21:28:43FromDiscord<demotomohiro> Long time ago, I researched about reading stdin asynchronously.↵And it seems linux can do it but windows cannot even if you directly use windows APIs.
21:42:37*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
21:51:13*advesperacit quit ()
21:54:25FromDiscord<Nilts> i call karax `.getInputText` twice. The first time it returns as normal, the second time it returns null, even though the text is still in the box. How do i fix
21:59:16FromDiscord<Yardanico> In reply to @demotomohiro "Long time ago, I": you can make anything asynchronous if you just do it in another thread :DD
22:01:18*lucasta joined #nim
22:15:56*jmdaemon joined #nim
22:50:03FromDiscord<lauvrens> I finished my first project in nim last night. it is such a joy to use :>
22:51:07FromDiscord<Nilts> In reply to @lauvrens "I finished my first": yes, except threading, we don't talk about threading
22:51:18FromDiscord<Nilts> what was your projecT?
22:52:24FromDiscord<lauvrens> In reply to @not logged in "yes, except threading, we": mine didnt have threads :>. it was an interpreter for a simple ebnf grammar (an assignment)
22:53:04FromDiscord<Nilts> In reply to @lauvrens "mine didnt have threads": ebnf?
22:53:33FromDiscord<lauvrens> extended backus naur form
22:55:44*Notxor quit (Remote host closed the connection)
23:03:21FromDiscord<Takemichi Hanagaki> Is it possible to disable exceptions and handle locally with `Option`, or isn't it a good idea in Nim?
23:04:40FromDiscord<Takemichi Hanagaki> In reply to @Takemichi Hanagaki "Is it possible to": How would I catch an, let say, `OSError` for instance...
23:05:29FromDiscord<Elegantbeef> You cannot disable exceptions
23:05:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tFo
23:12:05FromDiscord<Raynei486> How can I do object construction in a template?
23:12:37FromDiscord<Yardanico> it just works, maybe you're just confused about code substitution in templates?
23:13:02FromDiscord<Raynei486> One of my types is an enum but when I pass it in the compiler complains about `undeclared field`
23:13:14FromDiscord<Yardanico> can you show the relevant part of the code?
23:13:19FromDiscord<Raynei486> (edit) "types" => "members"
23:13:45FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tFp
23:16:50FromDiscord<Raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4tFq
23:17:27FromDiscord<Yardanico> this code works though, your actual code is different in some way 🤔
23:17:41FromDiscord<Raynei486> Maybe it has to do with my mindset of thinking templates = C preprocessor 😁
23:17:48FromDiscord<Raynei486> hmm that's odd
23:18:14FromDiscord<Yardanico> yeah, they're not a C preprocessor, they do code substitution, they can't directly modify code "text"
23:18:22FromDiscord<Yardanico> except a few special cases
23:18:26FromDiscord<Raynei486> oh whoops
23:18:57FromDiscord<Raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4tFr
23:19:01FromDiscord<Raynei486> I made that the argument name haha
23:19:02FromDiscord<Yardanico> yeah, this is just what I described to you above :)
23:19:13FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tFs
23:19:14FromDiscord<Raynei486> Not paying attention...
23:19:24FromDiscord<Yardanico> since templates replace the argument in the body of the template, you'll just have kind1: kind1
23:19:39FromDiscord<Takemichi Hanagaki> In reply to @Elegantbeef "You cannot disable exceptions": Thanks!
23:19:50FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tFt
23:20:00FromDiscord<Yardanico> generally if you don't want something to be evaluated multiple times in a template, you assign it to a variable that has a different name
23:20:32FromDiscord<Raynei486> will keep in mind, thanks
23:47:38*noxp joined #nim