00:00:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tBf |
00:00:18 | FromDiscord | <Elegantbeef> I'm just a funky chatgpt |
00:01:45 | FromDiscord | <Ayy Lmao> That's what c2nim was saying but I was hoping there was a prettier way. |
00:01:56 | FromDiscord | <Ayy Lmao> `ClapNsView = ClapNsView` 👀 |
00:02:02 | FromDiscord | <Elegantbeef> That was me being dumb |
00:02:10 | FromDiscord | <Elegantbeef> Nim doesnt have anonymous unions(for good reason i'd argue) |
00:02:50 | FromDiscord | <Ayy Lmao> Do you have to do `window.union.win32` to access it? |
00:02:56 | FromDiscord | <Elegantbeef> Yes |
00:03:03 | FromDiscord | <Elegantbeef> If you do not want that write accessors |
00:03:14 | FromDiscord | <Ayy Lmao> I guess that could be done |
00:03:34 | * | pbsds joined #nim |
00:04:25 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> Does the API pass the value with a pointer always or does it pass it by vallue |
00:05:26 | FromDiscord | <Ayy Lmao> Most things are passed by pointer I think |
00:05:38 | FromDiscord | <Elegantbeef> If you're interoping with C you need to disable Nim's optimisation if it's a large object |
00:05:58 | FromDiscord | <Elegantbeef> by default Nim decides on how to pass an object by it's size, you can override this by using `{.bycopy.}` |
00:06:13 | FromDiscord | <Elegantbeef> Adding it mimics the way C does things |
00:06:23 | FromDiscord | <Ayy Lmao> That makes sense |
00:16:15 | * | cm quit (Ping timeout: 255 seconds) |
00:55:05 | FromDiscord | <lauvrens> sent a code paste, see https://play.nim-lang.org/#ix=4tBj |
00:55:26 | FromDiscord | <Elegantbeef> Uhoh you're catching a defect |
00:56:24 | FromDiscord | <lauvrens> Yeah the current error is Index defect just for testing |
00:56:42 | FromDiscord | <Elegantbeef> Well defects are not supposed to be caught is my point |
00:56:54 | FromDiscord | <lauvrens> Oh |
00:56:59 | FromDiscord | <Elegantbeef> But anyway you cannot really do what you want |
00:58:03 | FromDiscord | <Elegantbeef> reading from the stdin is blocking so while doing `readLine` it waits for a `\n` also known as user input |
00:59:27 | FromDiscord | <lauvrens> damn ok this is tough |
01:01:02 | FromDiscord | <lauvrens> sent a code paste, see https://play.nim-lang.org/#ix=4tBl |
01:01:09 | FromDiscord | <lauvrens> (edit) "https://play.nim-lang.org/#ix=4tBl" => "https://play.nim-lang.org/#ix=4tBm" |
01:01:28 | FromDiscord | <Elegantbeef> What's an invalid line? |
01:01:46 | FromDiscord | <lauvrens> some uncaught error that causes the program to terminate |
01:02:37 | FromDiscord | <Elegantbeef> I'm a bit confused how that matters |
01:03:18 | FromDiscord | <Elegantbeef> It's not like shells backread the stdin and use characters that were not read |
01:03:19 | FromDiscord | <that_dude> Is this a parsing issue or an invalid character issue? |
01:03:34 | FromDiscord | <Elegantbeef> Yea like what are you doing that this is a concern |
01:12:50 | FromDiscord | <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:35 | FromDiscord | <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:11 | FromDiscord | <Raynei486> Is there some kind of example for `std/lexbase` |
01:24:51 | FromDiscord | <Raynei486> especially what's `handleCR` and `handleLF` for |
01:25:18 | * | nanxiao joined #nim |
01:29:37 | FromDiscord | <Elegantbeef> Seems it's for skipping lfcr |
01:29:43 | FromDiscord | <Elegantbeef> sorry CRLF 😄 |
01:30:02 | FromDiscord | <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:52 | FromDiscord | <Elegantbeef> Why is the program crashing though |
01:30:52 | FromDiscord | <Elegantbeef> You have an index defect, solve that issue then you will not have a crash |
01:31:10 | FromDiscord | <Elegantbeef> Do not compile a release build to actually get a usable stack trace |
01:35:53 | FromDiscord | <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:55 | FromDiscord | <lauvrens> yeah ur right im just stubborn and wanted to implement it in general. |
01:36:26 | FromDiscord | <Raynei486> okay so CRLF is fancy line breaks |
01:44:13 | FromDiscord | <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:28 | FromDiscord | <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:36 | FromDiscord | <Nilts> How would I get child element by name in karax? |
01:50:55 | FromDiscord | <Nilts> (Ping on reply, and please reply) |
01:59:18 | FromDiscord | <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:22 | FromDiscord | <Elegantbeef> Suppose I should @Raynei486 😄 |
02:01:31 | FromDiscord | <Elegantbeef> Otherwise i'm just inanely talking into the void |
02:02:13 | FromDiscord | <Raynei486> In reply to @Elegantbeef "*In the old times": ah yeah the real terminals |
02:04:08 | FromDiscord | <that_dude> Classic windows backwards compatibility |
02:06:08 | FromDiscord | <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:22 | FromDiscord | <Elegantbeef> Well i'd still fix the index defect |
02:06:37 | FromDiscord | <lauvrens> yeh of course its already fixed :> |
02:06:52 | FromDiscord | <Elegantbeef> Gud |
02:06:53 | FromDiscord | <Nilts> In reply to @not logged in "How would I get": Should i move this to #webdev |
02:08:51 | FromDiscord | <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:56 | FromDiscord | <JeysonFlores> sent a long message, see http://ix.io/4tBu |
02:51:41 | FromDiscord | <JeysonFlores> is there any special consideration I haven't done? |
02:52:08 | FromDiscord | <Elegantbeef> std/terminal has `setCursorXPos` |
03:13:16 | * | arkurious quit (Quit: Leaving) |
03:13:54 | * | nanxiao quit (Quit: Client closed) |
03:18:35 | FromDiscord | <Rika> `fmt""` does not interpret escape codes |
03:20:22 | * | nanxiao joined #nim |
03:23:39 | rockcavera | JeysonFlores, use echo fmt"Loading {i} {'\r'}" |
03:24:19 | FromDiscord | <Elegantbeef> or just \`fmt "Loading {i} \\r" |
03:25:16 | FromDiscord | <Rika> that's with a space if you dont notice |
03:49:15 | * | cm quit (Ping timeout: 250 seconds) |
03:49:21 | FromDiscord | <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:29 | FromDiscord | <Arvin❓> sent a code paste, see https://play.nim-lang.org/#ix=4tBQ |
06:04:14 | FromDiscord | <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:26 | FromDiscord | <Elegantbeef> You're overflowing |
06:04:37 | FromDiscord | <Elegantbeef> It runds til it overflows |
06:04:39 | FromDiscord | <Elegantbeef> runs\ |
06:04:46 | FromDiscord | <Arvin❓> In reply to @Elegantbeef "You're overflowing": where and how? |
06:05:21 | FromDiscord | <Elegantbeef> It tells you where |
06:05:42 | FromDiscord | <lauvrens> the number is increasing, it never reaches 1 |
06:07:20 | FromDiscord | <that_dude> Doesn't it also give this error when the while loop runs for too long? |
06:07:41 | FromDiscord | <that_dude> I thought that happened to me before |
06:07:48 | FromDiscord | <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:54 | FromDiscord | <Elegantbeef> That's stack overflow and it's not while loop |
06:07:55 | FromDiscord | <Arvin❓> (edit) "problem" => "problem?" |
06:08:07 | FromDiscord | <Elegantbeef> Overflow i when you have a number outside of a the range of the integer |
06:08:15 | FromDiscord | <Elegantbeef> Go read the wikipedia about it |
06:08:33 | FromDiscord | <Elegantbeef> you can have a max value of 2^63 - 1 inside an `int` |
06:08:33 | FromDiscord | <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:40 | FromDiscord | <Elegantbeef> An `int` in Nim is a signed platform dependant integer that is commonly 64bit |
06:10:52 | FromDiscord | <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:11 | FromDiscord | <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:30 | FromDiscord | <that_dude> So it will always balloon to infinity |
06:16:15 | FromDiscord | <Arvin❓> sent a code paste, see https://play.nim-lang.org/#ix=4tBU |
06:16:30 | FromDiscord | <Rika> overflows can be detected on compile time but otherwise they can happen on runtime |
06:16:34 | FromDiscord | <Arvin❓> In reply to @that_dude "Btw if you're doing": Yes, i made a mistake of using 2 |
06:17:50 | FromDiscord | <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:46 | FromDiscord | <morgan> has anyone used fidget along with rendering a custom mesh? i'm contemplating writing my own 3d graphing calculator |
06:53:19 | FromDiscord | <morgan> also considering nimx |
06:54:03 | FromDiscord | <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:37 | FromDiscord | <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:30 | FromDiscord | <Elegantbeef> hook method? |
06:55:47 | FromDiscord | <Rika> idk i hear about hooks sometimes when people talk about the newer json libraries |
06:56:07 | FromDiscord | <Elegantbeef> Oh ok so generic interfaces |
06:56:21 | FromDiscord | <Rika> but i'd like these extensions to be per object and not per type |
06:56:23 | FromDiscord | <Rika> well |
06:56:36 | FromDiscord | <Rika> per object and per type would apply ig if i use generics |
06:56:52 | FromDiscord | <Rika> for context i'm working on that progress bar library again |
06:56:56 | FromDiscord | <Elegantbeef> Well you'd just make the per object procedure inside the per type |
06:57:10 | FromDiscord | <Rika> yes but then what about state |
06:57:20 | FromDiscord | <Rika> generics would be annoying |
06:57:39 | FromDiscord | <Elegantbeef> What type of state is required? |
06:58:13 | FromDiscord | <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:22 | FromDiscord | <Elegantbeef> Yea I'd go with generic interfaces that can override default behaviour |
07:00:36 | FromDiscord | <Elegantbeef> I do not know what the blocker really is, I need a code example of the problem |
07:02:14 | FromDiscord | <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:22 | FromDiscord | <Elegantbeef> Ah so you have runtime polymorphism really |
07:03:43 | FromDiscord | <Rika> eugh |
07:04:12 | FromDiscord | <Elegantbeef> You have a top level object that stores sub objects which can have different attributes |
07:04:31 | FromDiscord | <Rika> :nyoron: |
07:04:32 | FromDiscord | <Elegantbeef> That sounds like either using pointer procedures or inheritance |
07:08:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/7Yt |
07:08:32 | FromDiscord | <Elegantbeef> But yea everything isnt going to be pretty |
07:08:45 | FromDiscord | <Rika> the progress needs to store state across its function call |
07:08:54 | FromDiscord | <Elegantbeef> progress is a closure procedure |
07:09:04 | FromDiscord | <Elegantbeef> State is stored inside the closure instead of on the object |
07:09:21 | FromDiscord | <Rika> hmm i guess thats one way but it feels inelegant |
07:09:33 | FromDiscord | <Elegantbeef> Yea inheritance is likely the best |
07:15:23 | FromDiscord | <lauvrens> sent a code paste, see https://play.nim-lang.org/#ix=4tC1 |
07:15:49 | FromDiscord | <Elegantbeef> How do i not insult you for using regex 😄 |
07:15:49 | * | cm joined #nim |
07:16:21 | FromDiscord | <lauvrens> I have to filter out a lot of stuff 😆 |
07:17:03 | FromDiscord | <lauvrens> I tried tokenize but it doesnt separate quotation marks |
07:17:16 | * | nanxiao quit (Quit: Client closed) |
07:17:42 | FromDiscord | <Elegantbeef> What are you filtering out? |
07:17:43 | * | ltriant quit (Ping timeout: 276 seconds) |
07:18:44 | FromDiscord | <lauvrens> everything that's not a word, like commas, quotations, full stops, etc. |
07:19:13 | FromDiscord | <lauvrens> but if theres an apostrophe like `that's` then i keep it |
07:19:41 | FromDiscord | <Elegantbeef> Sounds like you should just write the procedure that does that |
07:20:39 | FromDiscord | <lauvrens> Yeah I copied std/tokenize and just modifying it |
07:21:24 | FromDiscord | <Elegantbeef> So where does regex come in? |
07:21:30 | FromDiscord | <lauvrens> still curious why theres an empty string there though... |
07:21:46 | FromDiscord | <Elegantbeef> No clue i do not use regex let alone the `re` module |
07:22:45 | FromDiscord | <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:18 | FromDiscord | <0ffh> sent a long message, see http://ix.io/4tC4 |
07:52:04 | FromDiscord | <morgan> a whole bunch of str.replace or whatever it is would work |
07:52:19 | FromDiscord | <morgan> there might even be a version that takes a list tho idk |
07:52:32 | FromDiscord | <morgan> about to go to bed |
07:53:43 | FromDiscord | <lauvrens> In reply to @0ffh "That's a common problem": that makes a lot of sense, thank you! |
07:55:43 | FromDiscord | <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:48 | FromDiscord | <Bung> I remenber there's pragma switch make procs take same first param without defined in individual procs, what is it? |
09:11:33 | FromDiscord | <Elegantbeef> Do you mean the using statement? |
09:13:18 | FromDiscord | <Bung> oh, yes |
09:14:03 | NimEventer | New 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:52 | NimEventer | New thread by PMunch: Article on wrapping C libraries in Nim, see https://forum.nim-lang.org/t/10106 |
09:17:50 | Amun-Ra | I can see why strictDefs are experimental, https://play.nim-lang.org/#ix=4tCj |
09:19:29 | FromDiscord | <Elegantbeef> That's working as intended afaik |
09:19:54 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4tCk |
09:20:41 | PMunch | That shouldn't be needed though.. |
09:20:49 | FromDiscord | <Elegantbeef> Strict defs |
09:20:54 | PMunch | Still |
09:21:13 | PMunch | What would it be apart from `default`? |
09:21:41 | FromDiscord | <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:10 | PMunch | Oh wait, that is the point of strictDefs? |
09:22:16 | FromDiscord | <Elegantbeef> Yess |
09:22:26 | PMunch | Why would that be useful? |
09:22:29 | FromDiscord | <Elegantbeef> The point of strictdef is to ensure you intialize a variable explicitly |
09:22:51 | FromDiscord | <Elegantbeef> Araq liked the idea of definite assignment |
09:23:23 | FromDiscord | <Elegantbeef> `out` was also implemented |
09:23:33 | PMunch | But everything is initialized as `default` anyways? I'm confused :P |
09:23:56 | FromDiscord | <Elegantbeef> Do not look at me |
09:24:07 | FromDiscord | <Elegantbeef> I find strictdefs quite questionable when `requiresInit` exists |
09:24:18 | PMunch | `out` is fine though |
09:25:01 | PMunch | That's a pretty cool feature |
09:25:32 | FromDiscord | <Elegantbeef> out or requires? |
09:25:41 | PMunch | Both TBH |
09:27:10 | FromDiscord | <Elegantbeef> The odd thing is that strictdefs was added after object defaults |
09:27:36 | FromDiscord | <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:44 | FromDiscord | <jmgomez> Do this looks like a CI error? https://github.com/nim-lang/Nim/pull/21628/checks?check_run_id=12795877755 |
09:35:46 | NimEventer | New question by AlfredBaudisch: Why debugging Nim with GDB yields "No symbol XXX in current context" 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:48 | Amun-Ra | Elegantbeef: oh, thanks; I've tried result.reset but the warning was still on |
09:55:16 | * | nanxiao quit (Quit: Client closed) |
10:28:54 | FromDiscord | <theSherwood> Any examples of NaN boxing in the community? |
10:31:38 | * | derpydoo quit (Quit: derpydoo) |
10:33:24 | FromDiscord | <theSherwood> sent a code paste, see https://play.nim-lang.org/#ix=4tCt |
10:39:53 | FromDiscord | <wiga> Anyone having compiling error with nim-regex with threading and json? |
10:40:23 | FromDiscord | <wiga> Maybe I haven't looked at it much to say that but it seemed to conflict with json |
10:40:48 | FromDiscord | <wiga> Or my regex array is not able to compile at compiletime |
10:55:03 | FromDiscord | <fabricio> why do I have `pkgs` and `pkgs2` inside `~/.nimble` |
10:55:22 | FromDiscord | <fabricio> like why both, is there any difference between them? |
10:55:32 | FromDiscord | <Yardanico> yes, different format of storage |
10:55:41 | FromDiscord | <Yardanico> because nimble got a new version which stores stuff differently |
10:55:44 | PMunch | Basically Nim 2 changes |
10:56:00 | FromDiscord | <Yardanico> well, technically it's separate from nim 2, but yeah :) |
10:56:16 | PMunch | Unfortunately if you have a pkgs folder then Nim 2.0 won't see the pkgs2 folder.. |
10:56:19 | PMunch | Which is dumb |
10:56:28 | FromDiscord | <ricky> In reply to @theSherwood "Any examples of NaN": cursed |
10:56:37 | FromDiscord | <ricky> pointers were not supposed to be tagged.. |
10:57:03 | FromDiscord | <fabricio> In reply to @PMunch "Unfortunately if you have": well when I install stuff with nimble it saves them in `pkgs2` |
10:57:28 | FromDiscord | <System64 ~ Flandre Scarlet> Hi, is it possible to sort a seq of Point(x, y: int) by their Y value? |
10:57:47 | PMunch | Yes, but if you install something with pre-2.0 Nimble then Nim won't see the post-2.0 packages |
10:58:00 | PMunch | @System64_~_Flandre_Scarlet, yes |
10:58:19 | FromDiscord | <System64 ~ Flandre Scarlet> How can I o that please? I need a lambda? |
10:58:30 | PMunch | Check out the algorithm module |
10:58:39 | FromDiscord | <fabricio> In reply to @PMunch "Yes, but if you": so is it ok if I just delete `pkgs` |
10:58:40 | FromDiscord | <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:49 | PMunch | @fabricio, yes |
10:58:55 | FromDiscord | <fabricio> thanks |
10:59:16 | PMunch | But 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:16 | FromDiscord | <ricky> In reply to @theSherwood "Leaving the advisability of": in theory |
10:59:52 | FromDiscord | <ricky> the thinking man's choice is x86 asm `bswap` tho |
11:00:02 | PMunch | @theSherwood, in general the question "can it be done in Nim" is answered with "yes" |
11:00:09 | FromDiscord | <ricky> and store the flag on the end |
11:00:18 | FromDiscord | <ricky> no need to do real-time bit shifting |
11:00:50 | FromDiscord | <ricky> think there's an even better instruction now as well forget the name |
11:00:55 | FromDiscord | <ricky> a lord like @treeform would prob know |
11:03:55 | FromDiscord | <theSherwood> Am I understanding correctly that bswap swaps endianness? |
11:06:47 | FromDiscord | <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:20 | PMunch | Oh I have no idea what you're trying to do, I was just saying that everything is possible |
11:07:43 | FromDiscord | <theSherwood> Gotcha. I'm just trying to read NaN as a sequence of bytes. |
11:08:31 | FromDiscord | <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:37 | PMunch | I'm not quite sure what the problem is: https://play.nim-lang.org/#ix=4tCz |
11:15:32 | FromDiscord | <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:49 | PMunch | It shouldn't.. |
11:16:14 | PMunch | A seq[byte] is a pair of size/capacity integers and a pointer to the actual data |
11:16:53 | FromDiscord | <theSherwood> So the issue is that you can't point to a literal? |
11:17:10 | PMunch | No |
11:17:32 | PMunch | The issue is that you try to cast a single 8 byte value into a 24 byte complex object |
11:17:59 | PMunch | It's like calling your car a boat and being surprised when it sinks as you drive it into the lake |
11:19:55 | PMunch | It "worked" with other numbers purely by coincidence |
11:20:23 | FromDiscord | <theSherwood> Hmm. I don't follow how it worked by coincidence |
11:20:41 | PMunch | Some cars happen to be slightly waterproof |
11:21:00 | FromDiscord | <theSherwood> haha. Okay. So just based on the value of the float? |
11:21:07 | PMunch | Pretty much |
11:21:18 | FromDiscord | <djazz> pmunch: typo in article "square on" should be "square one" |
11:21:42 | FromDiscord | <theSherwood> In reply to @PMunch "Pretty much": bizarre. That's good to know. thanks for your help |
11:21:55 | PMunch | It 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:21 | FromDiscord | <theSherwood> Ohh. Okay. gotcha. that makes sense |
11:22:24 | PMunch | @djazz, thanks :) |
11:22:42 | FromDiscord | <demotomohiro> @theSherwood Maybe, `cast[array[uint8, 8]](NaN)` is what you want. |
11:23:10 | FromDiscord | <theSherwood> Yep. cheers! |
11:23:20 | PMunch | Well, what he wants is probably to do something more sane than casting floats to ints.. |
11:23:30 | PMunch | floats to int arrays* |
11:24:25 | * | kenran quit (Ping timeout: 240 seconds) |
11:24:36 | FromDiscord | <theSherwood> Yeah, I'm just doing to bit shuffling stuff for my learning. This isn't actually going to be used anywhere. |
11:27:06 | NimEventer | New Nimble package! youtubescraper - Very fast and lightweight YouTube scraper for Nim., see https://github.com/TaxMachine/youtubescraper |
11:27:07 | NimEventer | New Nimble package! nimppt - A simple and elegant presentation generator, see https://github.com/HUSKI3/Nimppt |
11:28:04 | PMunch | @theSherwood, aah I see, well in that case go nuts :) |
11:28:19 | FromDiscord | <theSherwood> ha. will do |
12:32:37 | * | kenran joined #nim |
12:36:51 | * | lucasta joined #nim |
12:40:05 | FromDiscord | <qb> sent a code paste, see https://play.nim-lang.org/#ix=4tD5 |
12:42:50 | NimEventer | New thread by freeflow: += operator with if statement gives errors, see https://forum.nim-lang.org/t/10107 |
12:42:54 | PMunch | No, still not possible |
13:10:03 | FromDiscord | <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:11 | FromDiscord | <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:58 | FromDiscord | <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:06 | FromDiscord | <WabileM> Ssh2 |
14:32:07 | FromDiscord | <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:34 | FromDiscord | <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:45 | FromDiscord | <Yardanico> you just assign the output to the variable instead of echo'ing it like let myvar = <statement> |
14:32:53 | FromDiscord | <Yardanico> (edit) "<statement>" => "<expression>" |
14:32:59 | FromDiscord | <Yardanico> echo is a proc that takes an expression that returns a string and outputs it |
14:34:29 | FromDiscord | <Nilts> how do i do element.name to get a child element with name in karax without digging through children |
14:34:41 | FromDiscord | <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:01 | FromDiscord | <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:04 | FromDiscord | <Yardanico> (edit) "what" => "that" |
14:35:21 | FromDiscord | <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:54 | FromDiscord | <WabileM> the specific error I get is: |
14:38:56 | FromDiscord | <WabileM> Error: type mismatch: got '(string, string, int)' for '↵var internalTmpFuture`gensym20: FutureBase = execCommand(client, command) |
14:39:49 | FromDiscord | <WabileM> I have |
14:39:52 | FromDiscord | <WabileM> var cmdOutput = "" |
14:40:03 | FromDiscord | <WabileM> cmdOutput = await client.execCommand(command) |
14:40:14 | FromDiscord | <Yardanico> yes, because that execCommand returns a tuple of 3 values, not just the string output |
14:40:24 | FromDiscord | <Yardanico> it tells you that with (string, string, int) which is a tuple with string, string and an int |
14:40:47 | FromDiscord | <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:53 | FromDiscord | <Yardanico> <https://github.com/ba0f3/ssh2.nim/blob/master/src/ssh2.nim#L43> |
14:41:56 | FromDiscord | <Nilts> In reply to @not logged in "how do i do": how do i do it while digging through the children? |
14:42:23 | FromDiscord | <⃟⃟> is the last name "Rumpf" derived from "rump" |
14:42:29 | FromDiscord | <Yardanico> In reply to @⃟⃟ "is the last name": go to #offtopic |
14:42:33 | FromDiscord | <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:46 | FromDiscord | <Yardanico> if you continue asking this question every day in this channel, I will consider that as trolling |
14:43:42 | FromDiscord | <guttural666> In reply to @PMunch "<@375727321958580228>, I'm actually writing": that was a long one 😄 very nice |
14:49:32 | NimEventer | New 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:59 | NimEventer | New post on r/nim by h234sd: Mono, Nim Web Framework, see https://reddit.com/r/nim/comments/12pjzgi/mono_nim_web_framework/ |
15:11:07 | FromDiscord | <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:00 | PMunch | Hmm, 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:13 | PMunch | Ah, I had a nim.cfg file with mm: orc in it |
16:22:19 | PMunch | Apparently that was the issue |
17:16:39 | FromDiscord | <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:26 | FromDiscord | <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:25 | FromDiscord | <auxym> In reply to @Oscour "Hi! Very quick question": Exoerimental atm: https://nim-lang.org/docs/manual_experimental.html#view-types |
17:30:17 | FromDiscord | <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:13 | FromDiscord | <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:20 | FromDiscord | <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:27 | FromDiscord | <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:43 | FromDiscord | <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:10 | FromDiscord | <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:29 | FromDiscord | <guttural666> there seemed to be according to outdated chatGPT |
20:02:51 | FromDiscord | <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:49 | FromDiscord | <Dudugz> Currently I don't think it has, although I think it should have. |
20:13:26 | FromDiscord | <Dudugz> Like JS, the filesystem API has both sync and async versions, and it is recommended to use the async version. |
20:13:43 | FromDiscord | <Dudugz> ``node:fs/promises`` |
20:15:04 | * | onetwo joined #nim |
20:20:01 | FromDiscord | <guttural666> In reply to @Dudugz "Like JS, the filesystem": yeah I've seen std/asyncfile |
21:28:43 | FromDiscord | <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:25 | FromDiscord | <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:16 | FromDiscord | <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:03 | FromDiscord | <lauvrens> I finished my first project in nim last night. it is such a joy to use :> |
22:51:07 | FromDiscord | <Nilts> In reply to @lauvrens "I finished my first": yes, except threading, we don't talk about threading |
22:51:18 | FromDiscord | <Nilts> what was your projecT? |
22:52:24 | FromDiscord | <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:04 | FromDiscord | <Nilts> In reply to @lauvrens "mine didnt have threads": ebnf? |
22:53:33 | FromDiscord | <lauvrens> extended backus naur form |
22:55:44 | * | Notxor quit (Remote host closed the connection) |
23:03:21 | FromDiscord | <Takemichi Hanagaki> Is it possible to disable exceptions and handle locally with `Option`, or isn't it a good idea in Nim? |
23:04:40 | FromDiscord | <Takemichi Hanagaki> In reply to @Takemichi Hanagaki "Is it possible to": How would I catch an, let say, `OSError` for instance... |
23:05:29 | FromDiscord | <Elegantbeef> You cannot disable exceptions |
23:05:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tFo |
23:12:05 | FromDiscord | <Raynei486> How can I do object construction in a template? |
23:12:37 | FromDiscord | <Yardanico> it just works, maybe you're just confused about code substitution in templates? |
23:13:02 | FromDiscord | <Raynei486> One of my types is an enum but when I pass it in the compiler complains about `undeclared field` |
23:13:14 | FromDiscord | <Yardanico> can you show the relevant part of the code? |
23:13:19 | FromDiscord | <Raynei486> (edit) "types" => "members" |
23:13:45 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tFp |
23:16:50 | FromDiscord | <Raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4tFq |
23:17:27 | FromDiscord | <Yardanico> this code works though, your actual code is different in some way 🤔 |
23:17:41 | FromDiscord | <Raynei486> Maybe it has to do with my mindset of thinking templates = C preprocessor 😁 |
23:17:48 | FromDiscord | <Raynei486> hmm that's odd |
23:18:14 | FromDiscord | <Yardanico> yeah, they're not a C preprocessor, they do code substitution, they can't directly modify code "text" |
23:18:22 | FromDiscord | <Yardanico> except a few special cases |
23:18:26 | FromDiscord | <Raynei486> oh whoops |
23:18:57 | FromDiscord | <Raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4tFr |
23:19:01 | FromDiscord | <Raynei486> I made that the argument name haha |
23:19:02 | FromDiscord | <Yardanico> yeah, this is just what I described to you above :) |
23:19:13 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tFs |
23:19:14 | FromDiscord | <Raynei486> Not paying attention... |
23:19:24 | FromDiscord | <Yardanico> since templates replace the argument in the body of the template, you'll just have kind1: kind1 |
23:19:39 | FromDiscord | <Takemichi Hanagaki> In reply to @Elegantbeef "You cannot disable exceptions": Thanks! |
23:19:50 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tFt |
23:20:00 | FromDiscord | <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:32 | FromDiscord | <Raynei486> will keep in mind, thanks |
23:47:38 | * | noxp joined #nim |