<< 08-07-2022 >>

00:01:49FromDiscord<enthus1ast> @voidwalker\: https://www.sqlite.org/c3ref/stmt.html#:~:text=A%20prepared%20statement%20object%20is,statement%20object%20using%20sqlite3_prepare_v2().
00:03:44FromDiscord<ElegantBeef> If the backtrace is to believed it's an issue with the `cmp` function
00:03:54FromDiscord<mattrb> Yeah it crashes even with no gc
00:05:03FromDiscord<mattrb> In reply to @ElegantBeef "If the backtrace is": Hmm I haven't seem that one before, but it doesn't seem to always be the same place
00:05:25FromDiscord<ElegantBeef> Mine is a consistent backtrace
00:05:42FromDiscord<mattrb> sent a long message, see http://ix.io/41TV
00:06:30FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=41TW
00:07:04FromDiscord<mattrb> Mine is almost always in lib/system/excpt.nim, but the line frequently changes
00:09:02*CyberTailor quit (Remote host closed the connection)
00:10:04*CyberTailor joined #nim
00:10:24FromDiscord<ElegantBeef> Yea seems quite jumpy now that i tried it more
00:12:47FromDiscord<ElegantBeef> Might be a bug with sdl2, cant really tell
00:13:21FromDiscord<mattrb> I know it works in isolation with sdl2 at least https://github.com/mattrberry/web_audio_testing
00:13:54FromDiscord<mattrb> Excuse the code quality, I just translated that directly from some c source last year as a proof of concept :p
00:14:05FromDiscord<ElegantBeef> It's a private repo
00:16:21FromDiscord<mattrb> Oh
00:18:46FromDiscord<mattrb> Basically just showing that this works as expected https://gist.github.com/mattrberry/c645606be8f1ee836e05869cbdaa6585
00:18:53FromDiscord<mattrb> Both natively and in emscripten
00:45:02*CyberTailor quit (Remote host closed the connection)
00:46:12*CyberTailor joined #nim
00:53:40FromDiscord<Elegantbeef> @mattrb\: looking at this code further you'll certainly want to compiler with \`--passC\:"-fno-strict-aliasing"
00:53:45*LuxuryMode joined #nim
00:54:24FromDiscord<Elegantbeef> It wont fix the issue but you have alot of breaking strict aliasing going on
00:56:26FromDiscord<ripluke> I have a library that requires httpclient
00:56:49FromDiscord<ripluke> How can I make it use -d:SSL without specifying it every build
00:56:57FromDiscord<ripluke> (edit) "-d:SSL" => "-d:ssl"
00:57:05FromDiscord<Elegantbeef> `config.nims` with `--define:ssl`
00:57:33FromDiscord<ripluke> In reply to @Elegantbeef "`config.nims` with `--define:ssl`": Do I put this in the directory with my nimble file?
00:57:35FromDiscord<mattrb> I'm trying to read up briefly on what the no-strict-aliasing flag does. What does that accomplish here?
00:57:40FromDiscord<ElegantBeef> Yes rip
00:57:50FromDiscord<Elegantbeef> Wait bridge is working now
00:57:51FromDiscord<ripluke> Ok thx
00:57:57FromDiscord<Elegantbeef> What am i doing 😄
00:58:05FromDiscord<ripluke> Wait are discord
00:58:09FromDiscord<ripluke> (edit) "Wait are ... discord" added "u"
00:58:35FromDiscord<Elegantbeef> Strict aliasing allows an optimisation to be made but it means you cannot alias a pointer to a different type then it's intial form
00:59:26FromDiscord<Elegantbeef> So it can cause bugs with code that converts a type through a pointer
00:59:53FromDiscord<Elegantbeef> It doesnt resolve your present bug but it may stop you from running into them in the future
01:00:14FromDiscord<Elegantbeef> Funnily enough Wine is actually built with it disabled
01:00:42FromDiscord<ripluke> How can I get an optional argument in a function
01:00:53FromDiscord<mattrb> Got it, I think.. Trying to come up with an example where this would fail now to try to understand it better haha
01:00:56FromDiscord<Elegantbeef> `proc doThing(a = 10)`?
01:01:24FromDiscord<ripluke> In reply to @Elegantbeef "`proc doThing(a = 10)`?": Ah, so when someone specifies it 10 is overwritten
01:01:35FromDiscord<Elegantbeef> Yes
01:01:49FromDiscord<Elegantbeef> It's a very weird rule mattrb most people find it annoying
01:02:19FromDiscord<Elegantbeef> https://news.ycombinator.com/item?id=11289995
01:03:18FromDiscord<Elegantbeef> The fun part with your code matt is even disabling your main update and leaving your key polling logic causes the segfault
01:03:41FromDiscord<mattrb> Heh, maybe that helps narrow it down then!
01:03:46FromDiscord<mattrb> Which part did you disable?
01:04:07FromDiscord<Elegantbeef> Wait one second
01:04:35FromDiscord<Elegantbeef> It just segfaulted with both `runCycles` and `checkKeyInput` commented out
01:04:57FromDiscord<Elegantbeef> Yea with `loop` commented out it still segfaults
01:05:44FromDiscord<mattrb> Hmm not for me..
01:05:57FromDiscord<Elegantbeef> It can take some time
01:06:08FromDiscord<mattrb> I'll try it a few more times
01:08:27FromDiscord<mattrb> Hmm yeah đŸ€”
01:09:19FromDiscord<Elegantbeef> Does that mean you can reproduce that?
01:10:13FromDiscord<mattrb> I can reproduce it segfaulting even when commenting out `loop`
01:11:13FromDiscord<mattrb> But replacing the main loop with a sleep I don't see segfaults..
01:11:28FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=41U1
01:14:28FromDiscord<Elegantbeef> Do you have any top level variables?
01:14:39*derpydoo joined #nim
01:16:28FromDiscord<mattrb> Just variables defined freely in nim files?
01:16:32FromDiscord<mattrb> All over the place
01:16:43FromDiscord<Elegantbeef> Ok are any of them heap allocated types?
01:17:06FromDiscord<mattrb> Hmm I think they're all stack-allocated, but I'll look
01:17:24FromDiscord<mattrb> The majority are definitely just plain objects
01:17:35FromDiscord<Elegantbeef> Also i despise you somewhat 😛
01:17:52FromDiscord<Elegantbeef> Things like your `Keyinput` type existing is a travesty
01:18:30FromDiscord<mattrb> I'm always open to pull requests to make this more canonical nim :)
01:18:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41U5
01:18:50FromDiscord<Elegantbeef> I mean i might put the time in after we fix this issue
01:19:54FromDiscord<mattrb> I haven't seen that enum syntax before. Not sure how it'd play with holes in the values, but I'll definitely take a look
01:20:24FromDiscord<Elegantbeef> You can have holey enums, just it's not the greatest with it
01:20:41FromDiscord<Elegantbeef> We have highlevel wirth bitsets so you dont need to make things like that object `KeyInpu`
01:20:56FromDiscord<Elegantbeef> A `KeyInputs = set[KeyInput]` is cleaner and nicer
01:21:36FromDiscord<Elegantbeef> Regardless i'm still at a loss at this segfault
01:21:40FromDiscord<Rika> “Wirth bitsets” lmao
01:21:48FromDiscord<Elegantbeef> Your code doesnt seem to be causing it, so it could honestly be a sdl2 bug
01:21:56FromDiscord<Elegantbeef> I mean whatelse do you call them?
01:22:08FromDiscord<Elegantbeef> They're common amongst all of Wirth's languages
01:22:12FromDiscord<mattrb> I have a top-level var on the heap in apu.nim
01:22:14FromDiscord<Rika> I don’t know, bit sets
01:22:16FromDiscord<mattrb> The buffer
01:22:39FromDiscord<Elegantbeef> Yea but you arent using it right now
01:22:43FromDiscord<mattrb> I haven't looked everywhere yet, but there certainly aren't many. Is that a problem?
01:22:44FromDiscord<Elegantbeef> So i dont imagine that's causing an issuue
01:22:53FromDiscord<Rika> Can’t you Valgrind this out?
01:22:58FromDiscord<Rika> It’s a segmentation fault right
01:23:43FromDiscord<Elegantbeef> Yea it is
01:24:16FromDiscord<Rika> Tried ASan?
01:24:45FromDiscord<mattrb> Gotta take the dog out, but definitely happy to continue this conversation in 20 mins
01:25:27FromDiscord<Elegantbeef> Damn that's a big dog
01:28:07FromDiscord<mattrb> https://media.discordapp.net/attachments/371759389889003532/994776865183109221/C2E96DFF-0382-4E72-AA5E-B5C2B07A0B2F.jpg
01:28:13FromDiscord<mattrb> Ah I forgot discord doesn't strip location data from photos. Dox dox
01:28:23FromDiscord<Elegantbeef> No dog dog
01:28:38FromDiscord<Elegantbeef> That's not that big of a dog shouldnt take 20 minutes to get it outside
01:29:23FromDiscord<Rika> In reply to @mattrb "Ah I forgot discord": It doesn’t? Damn guess I’ve been doxxing myself
01:29:44FromDiscord<Rika> Well I downloaded it and it doesn’t seem to have location info
01:30:02FromDiscord<mattrb> Maybe they changed it recently
01:30:09FromDiscord<ripluke> 🎉 I just made my first nimble package, now I need to wait till it gets merged
01:30:35FromDiscord<Elegantbeef> The best part about element is i got confetti from that message ripluke 😄
01:31:17FromDiscord<ripluke> In reply to @Elegantbeef "The best part about": Lol that's cool
01:31:18FromDiscord<!Patitotective> In reply to @ripluke "🎉 I just made": may i ask what is it about or do i need to wait until it gets merged? 🧐
01:31:51FromDiscord<ripluke> In reply to @Patitotective "may i ask what": It gets weather info using wttr.in so it doesn't need an owm api key
01:32:12FromDiscord<ripluke> It very smartly named wttrin
01:33:25FromDiscord<Rika> Why? Can’t you just curl the website and get the info that where are you
01:33:27FromDiscord<Rika> Way
01:33:40FromDiscord<Rika> Lol I have a smart replacement for “wya”
01:33:42FromDiscord<!Patitotective> you should at least provide a readme in the repo and a description
01:34:30FromDiscord<ripluke> In reply to @Rika "Why? Can’t you just": Nah my implementation uses httpclient (making it cross platform) and it's not as janky as using execCmd
01:34:45FromDiscord<Rika> I mean outside of Nim
01:34:55FromDiscord<Rika> So you can just use the equivalent in windows manually

01:35:42FromDiscord<ripluke> In reply to @Rika "So you can just": You could, but what if you want the values in a Nim file
01:35:52FromDiscord<ripluke> Like you want to implement it in your code
01:35:55FromDiscord<Rika> Oh so it’s a library for it?
01:36:00FromDiscord<ripluke> Yea
01:36:01FromDiscord<Rika> Okay so I misread
01:36:05FromDiscord<!Patitotective> also ripluke, it seems like you pushed `src/wttrin.out` and `src/wttrin/submodule.nim` accidentally :p
01:36:20FromDiscord<ripluke> In reply to @Patitotective "also ripluke, it seems": Ah so should I delete them?
01:36:53FromDiscord<!Patitotective> well, you didn't use a submodule at all↔nimble creates just in case you want to use it
01:37:00FromDiscord<ripluke> Oh
01:37:09FromDiscord<ripluke> Well it's gone now 🙂
01:37:32FromDiscord<ripluke> I love writing docs
01:37:39FromDiscord<ripluke> Sarcasm
01:37:45FromDiscord<!Patitotective> also if you have a single-module library you might want to put it at the root and remove `srcDir` from the nimble file
01:38:00FromDiscord<ripluke> In reply to @Patitotective "also if you have": Oh I'll do that aswell
01:38:03FromDiscord<!Patitotective> In reply to @ripluke "I love writing docs": i love writing tests too
01:38:15FromDiscord<ripluke> Tests aren't that bad ig
01:38:40FromDiscord<ripluke> I would write tests for my package but the data changes so it's kinda impossible :/
01:39:33FromDiscord<!Patitotective> In reply to @ripluke "I would write tests": you could check if a value is in a range `":cloud_snow:"..":fire:"` lol
01:40:17FromDiscord<ripluke> In reply to @Patitotective "you could check if": True, but that range would be huge
01:40:28FromDiscord<ripluke> Probably -100..100
01:40:47FromDiscord<ripluke> Well I doubt itd ever get to -100
01:40:57FromDiscord<ripluke> But 100+ is definitely possible
01:44:55FromDiscord<!Patitotective> also ripluke↔in your nimble file you say the license is `GPL-3.0-or-later`↔but in the repo there is no license file :/
01:45:32FromDiscord<Elegantbeef> GPL3 for this type of code, interesting
01:45:53FromDiscord<ripluke> In reply to @Patitotective "also ripluke in your": Yea
01:45:58FromDiscord<ripluke> Should probably add that
01:46:09FromDiscord<ripluke> In reply to @Elegantbeef "GPL3 for this type": I license everything gpl lol
01:46:19FromDiscord<ripluke> It's free software
01:46:49FromDiscord<ripluke> I realized why everyone thought that it was a binary and not a library
01:47:21FromDiscord<ripluke> So I kinda let copilot autocomplete my whole packages.json
01:47:36FromDiscord<ripluke> I double checked it but I missed the description
01:47:50FromDiscord<ripluke> Soo unfortunately it says a CLI program
01:48:01FromDiscord<ripluke> Better fix that aswell
01:49:11FromDiscord<voidwalker> what was that unit that had the % operator for serializing to json?
01:49:32FromDiscord<Elegantbeef> `std/json`
01:49:41FromDiscord<Elegantbeef> Also in nim land it's a module
01:50:06FromDiscord<voidwalker> still with one foot in pascal land I guess
01:50:51FromDiscord<!Patitotective> nimland sounds so cool↔like nimlang
01:51:21FromDiscord<voidwalker> Do you think we'll get more focus on performance after nim 2.0 ?
01:51:52FromDiscord<Elegantbeef> Nim is fast as is?
01:52:01FromDiscord<voidwalker> yes, but rust is way faster
01:52:06FromDiscord<Elegantbeef> No it'
01:52:09FromDiscord<Elegantbeef> it's not
01:52:15FromDiscord<Elegantbeef> Nim and Rust are the same speed
01:52:20FromDiscord<Rika> In reply to @voidwalker "yes, but rust is": Is it? Can you prove it
01:52:25FromDiscord<voidwalker> well, have not tried it myself, but all benchmarks i've seen rust is like 2-3x faster
01:52:25FromDiscord<Elegantbeef> The bottleneck is the programmer
01:52:35FromDiscord<Rika> Benchmark games don’t work
01:52:36FromDiscord<Elegantbeef> Programming benchmarks a joke
01:52:48FromDiscord<Rika> They’re heavily implementation dependent
01:52:52FromDiscord<Elegantbeef> It benchmarks the intelligence of the programmer and less the language
01:53:10FromDiscord<voidwalker> well, bubblesort, how can you get that wrong
01:53:10FromDiscord<Rika> Yeah have you seen some of the Nim code the #science guys make
01:53:12FromDiscord<Rika> It’s fucking crazy
01:53:13FromDiscord<voidwalker> it was way slower in nim
01:53:28FromDiscord<Rika> Look at the implementation and see if they’re doing things “the same way”?
01:53:32FromDiscord<Rika> Most likely they aren’t
01:53:35FromDiscord<Elegantbeef> Were they faithful implementations?
01:53:47FromDiscord<Elegantbeef> Were they using the equivalent compiler flags?
01:53:57FromDiscord<Prestige> In reply to @voidwalker "well, have not tried": I've never seen anything like that lol
01:54:04FromDiscord<Rika> Even if it was faithful, what would the point be in benchmarking then
01:54:05FromDiscord<mattrb> In reply to @Elegantbeef "That's not that big": Dog has peed, pooped, and played
01:54:18FromDiscord<Elegantbeef> Exactly↔(@Rika)
01:54:20FromDiscord<Rika> In reply to @mattrb "Dog has peed, pooped,": The joke was you only said “get it outside”
01:54:28FromDiscord<mattrb> Yes
01:54:41FromDiscord<ripluke> Does Nim have a documentation generator
01:54:48FromDiscord<!Patitotective> `nim doc`
01:55:01FromDiscord<!Patitotective> (edit) "doc`" => "doc module.nim`"
01:55:18FromDiscord<!Patitotective> for libraries you may want `nim doc --project wttrin.nim`
01:55:43FromDiscord<!Patitotective> (edit) "for libraries you may want `nim doc --project wttrin.nim` ... " added "(which includes all the modules imported in the main module but in your case its the same)"
01:55:48FromDiscord<ripluke> Yea also can I get it in markdown or rust format?
01:55:52FromDiscord<mattrb> In reply to @Elegantbeef "Do you have any": Are top-level variables problematic for some reason?
01:55:53FromDiscord<ripluke> (edit) "rust" => "rst"
01:56:04FromDiscord<!Patitotective> In reply to @ripluke "Yea also can I": https://nim-lang.org/docs/docgen.html
01:56:12FromDiscord<Elegantbeef> Only heap allocated ones if you're using threads
01:56:24FromDiscord<Elegantbeef> The SDL code you're using isnt accessing them so it's fine
01:56:30FromDiscord<xflywind> More markdown supporting is coming => https://github.com/nim-lang/Nim/pull/19954
01:56:48FromDiscord<!Patitotective> In reply to @flywind "More markdown supporting is": 👀
01:57:10FromDiscord<Elegantbeef> https://plummerssoftwarellc.github.io/PrimeView/report?id=davepl-1641120327.json&hi=False&hf=False&hp=False&fi=&fp=mt&fa=wh~ot&ff=uf&fb=uk~ot&tp=False&sc=pp&sd=True is a good showcase of how silly benchmarks can be
01:58:06FromDiscord<mattrb> Could it be problematic because `AudioSpec` contains a reference to `AudioCallback` which is a proc?
01:58:31FromDiscord<Elegantbeef> Doubtful
01:58:48FromDiscord<Elegantbeef> Using asan is probably your best bet, but no clue how to set it up
01:59:24FromDiscord<mattrb> Hmm yeah still segfaults when I remove all references to the obtained audio spec in the callback
02:01:28FromDiscord<Rika> In reply to @Elegantbeef "https://plummerssoftwarellc.github.io/PrimeView/rep": God bless Mr Good or whatever his name is if I got that wrong
02:02:08FromDiscord<Elegantbeef> Yea no clue what their name is
02:02:14FromDiscord<Elegantbeef> All i know is they're vastly smarter than I 😄
02:02:31FromDiscord<voidwalker> what's wrong with this ?
02:02:32FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=41Ud
02:02:45FromDiscord<Elegantbeef> The compiler should tell you
02:02:59FromDiscord<voidwalker> Error: type mismatch: got <tuple[filename: string, filesize: int]>↔but expected one of:↔func `%`(formatstr, a: string): string
02:04:09FromDiscord<Elegantbeef> There isnt a variant of `%` that works on a tuple
02:04:13FromDiscord<voidwalker> late and batteries run out.. would appreciate a codefeed for this.. just want to write/read that seq of tuples from file
02:04:19FromDiscord<voidwalker> Oh
02:04:51FromDiscord<Rika> Shouldn’t the object % also accept a tuple?
02:04:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41Ue
02:04:53FromDiscord<voidwalker> yeah elegantbeef, you could rename to CodeBeefFeed
02:04:58FromDiscord<Rika> Also be made to accept
02:05:26FromDiscord<voidwalker> sigh, so i haveto make it an object :\
02:05:34FromDiscord<Elegantbeef> I think it could rika, could've sworn i made a PR for this
02:05:48FromDiscord<Elegantbeef> I mean you should generally use an object over tuple unless it's a one off thing imo
02:06:13FromDiscord<Rika> Might be merged and he’s just on an old version
02:06:25FromDiscord<Elegantbeef> nah doesnt look that way
02:06:31FromDiscord<Elegantbeef> I might've made a PR for something else
02:06:36FromDiscord<ripluke> How can I get codeblocks in documentation comments?
02:07:37FromDiscord<Elegantbeef> Also works void
02:07:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41Uf
02:07:49FromDiscord<xflywind> In reply to @Rika "Shouldn’t the object %": https://github.com/nim-lang/Nim/pull/14638
02:08:17FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=41Ug
02:08:27FromDiscord<!Patitotective> (edit) "https://play.nim-lang.org/#ix=41Ug" => "https://play.nim-lang.org/#ix=41Uh"
02:08:31FromDiscord<!Patitotective> (edit) "https://play.nim-lang.org/#ix=41Uh" => "https://paste.rs/Nzx"
02:08:33FromDiscord<xflywind> In reply to @flywind "https://github.com/nim-lang/Nim/pull/14638": The issue => https://github.com/nim-lang/Nim/issues/12290
02:08:39FromDiscord<ripluke> sent a code paste, see https://play.nim-lang.org/#ix=41Ui
02:08:46FromDiscord<!Patitotective> i meant the slashes
02:08:49FromDiscord<!Patitotective> without the back slashes
02:08:53FromDiscord<!Patitotective> just like in discord
02:08:56FromDiscord<ripluke> Oh
02:08:57FromDiscord<ripluke> K
02:09:12FromDiscord<xflywind> (edit) "https://github.com/nim-lang/Nim/issues/12290" => "https://github.com/nim-lang/Nim/commit/f8e720fda90fcd3cabedc1adf055d14d69df82ba"
02:10:48FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=41Uj
02:11:00FromDiscord<exelotl> (edit) "https://play.nim-lang.org/#ix=41Uj" => "https://play.nim-lang.org/#ix=41Uk"
02:11:04FromDiscord<!Patitotective> markdown forever
02:11:06FromDiscord<Elegantbeef> You also can use toplevel runnable examples if you want the code to run
02:11:12FromDiscord<ripluke> In reply to @Patitotective "markdown forever": Yes
02:12:19FromDiscord<exelotl> I also feel it was a bad idea to shoehorn markdown into RST
02:12:58FromDiscord<xflywind> Rst code block is fragile in Nim. If you miss blank lines, it can probably act up.
02:13:24FromDiscord<xflywind> With no errors
02:14:33FromDiscord<exelotl> iirc it permits no blank line where python's RST requires a blank line and would error without it?
02:15:56FromDiscord<exelotl> But yeah, right now we have an absolute mess of a markup language, if you use the full range of syntax it won't look correct _anywhere_ except Nim's renderer
02:18:16FromDiscord<exelotl> I wonder if there's a subset of AsciiDoc markup that doesn't conflict with MD or RST
02:18:34FromDiscord<exelotl> We could add a 3rd language to the mix :P
02:19:55FromDiscord<!Patitotective> https://github.com/nim-lang/Nim/pull/19954 ?
02:23:42FromDiscord<exelotl> Yeah I just don't get this
02:25:38FromDiscord<!Patitotective> ? the idea is to separate rst from md making two separate commands
02:25:44FromDiscord<!Patitotective> (edit) "? the idea is to separate rst from md making two separate commands ... " added "(and other fixes)"
02:33:36FromDiscord<exelotl> But it doesn't really separate them, it's still using the weird hybrid format either way, it just alters the balance in ambiguous situations. So now you can choose between md-ish RST or rst-ish MS
02:34:06FromDiscord<exelotl> (edit) "MS" => "MD"
02:36:09FromDiscord<exelotl> And the new MD syntax (being able to set parameters on the code blocks) isn't based on any standard I know of
02:40:48FromDiscord<exelotl> IMO Nim should just have 1 markup language and offer a rock solid implementation of it, not this weird cobbled together hybrid
02:41:19FromDiscord<!Patitotective> hmm đŸ€” agree
02:42:49FromDiscord<mattrb> In reply to @Elegantbeef "Using asan is probably": Haven't set up asan, but valgrind has a _lot_ to say.. https://gist.github.com/mattrberry/c3722c682b8b1f0e2f9b1650575857ff
02:43:43FromDiscord<Rika> Compile with arc, -d:useMalloc, and --debugger:native
02:46:20FromDiscord<mattrb> https://gist.github.com/mattrberry/2d63eac54cccde4bbfca76e516010a58
02:48:49FromDiscord<Yardanico> yeah, as Rika said, you need to use ARC or ORC if you want to see meaningful valgrind output
02:49:06FromDiscord<Yardanico> the default GC is refc and it doesn't really work well on embedded or "weird" targets
02:49:13FromDiscord<Yardanico> arc is much much more "friendly" in that regard
02:49:45FromDiscord<Rika> I’m still not sure what’s wrong here tbh, I’m still reading the output
02:50:11FromDiscord<Yardanico> a lot of the things are from stack frame (for exceptions)
02:50:15FromDiscord<Rika> This one stands out to me
02:50:24FromDiscord<Yardanico> @mattrb can you try also compiling with -d:danger ? so that it's pure program "logic" without any Nim checks
02:50:35FromDiscord<Yardanico> together with options Rika suggested
02:50:43FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=41Uo
02:50:51FromDiscord<Rika> Kinda stood out, this one
02:50:53FromDiscord<Yardanico> popFrame is related to exceptions
02:50:58FromDiscord<Rika> It is I know
02:51:40FromDiscord<Rika> How about this one
02:51:48FromDiscord<Rika> sent a long message, see http://ix.io/41Up
02:52:11FromDiscord<Yardanico> still exceptions :P as I said it's a good idea to try -d:danger
02:52:34FromDiscord<Yardanico> to see if it's really something bad in the program itself or it's parts of nim stdlib/exception tracking failing
02:52:41FromDiscord<Rika> Why would the exception system have invalid reads
02:53:32FromDiscord<Yardanico> đŸ€·
02:54:09FromDiscord<mattrb> So far unable to reproduce the error with -d:danger
02:54:16FromDiscord<mattrb> (edit) "error" => "segfault"
02:54:24FromDiscord<Yardanico> interesting, can you try with `-d:release` ?
02:55:09FromDiscord<mattrb> `-d:release` has been working for the most part iirc. Can't reproduce with release either right now
02:55:27FromDiscord<mattrb> I think at some point it was having trouble with release, but most of the time it has been fine
02:55:39FromDiscord<Rika> Are you making exceptions yourself
02:55:44FromDiscord<Rika> As in constructing them
02:56:09FromDiscord<mattrb> Nope, nowhere
02:59:29FromDiscord<mattrb> Uncommenting this line (and the two above it) make it segfault in release as well https://github.com/mattrberry/gba/blob/beef/src/gba/apu.nim#L43
03:00:07FromDiscord<Yardanico> oh, so the code is open
03:00:34*derpydoo quit (Quit: derpydoo)
03:00:41FromDiscord<Yardanico> can you tell what's the way to run it the same as you do to get the same segfault?
03:00:44FromDiscord<Yardanico> i mean the GBA rom and stuff
03:01:25NimEventerNew Nimble package! wttrin - A library with functions to fetch weather data from wttr.in, see https://github.com/Infinitybeond1/wttrin
03:01:54FromDiscord<mattrb> If you clone the branch I linked, you can build with `nimble build` and run with `./gba bios.bin /path/to/rom`, where the rom can be https://github.com/destoer/armwrestler-gba-fixed/blob/master/armwrestler-gba-fixed.gba Really every rom breaks, but this is one I know my emulator runs fine otherwise :p
03:05:14FromDiscord<Yardanico> ok lemme try
03:05:37FromDiscord<Elegantbeef> How many nim programmers does it take to stifle a seg fault
03:06:15FromDiscord<mattrb> Really appreciate the help from all of you, btw :)
03:09:42FromDiscord<mattrb> My fear is that it comes down to something incredibly stupid on my end and that I'll have wasted all of your time..
03:11:59FromDiscord<Elegantbeef> well it likely is on you 😄
03:15:13FromDiscord<mattrb> As long as that's your assumption going in, then great :)
03:15:19FromDiscord<Yardanico> doesn't sdl run audio on a separate thread?
03:15:30FromDiscord<ripluke> In reply to @NimEventer "New Nimble package! wttrin": Nice
03:15:44FromDiscord<Yardanico> In reply to @ripluke "Nice": idk, I don't like those 20-line packages :(
03:15:50FromDiscord<mattrb> Yeah I believe it puts the callback function on another thread
03:16:28FromDiscord<ripluke> In reply to @Yardanico "idk, I don't like": Lol it's my package 💀, but yea it's just a couple of bits of code I use alot which I thought might be helpful for some other people
03:16:43FromDiscord<Yardanico> at least make it more nim-ish :(
03:16:54FromDiscord<ripluke> In reply to @Yardanico "at least make it": What does that mean 💀
03:16:54FromDiscord<Yardanico> you're leaking httpclient instances, `return`, etc
03:17:07FromDiscord<mattrb> In emscripten it'll run on the main thread, but natively I think it runs on the another thread that sdl creates
03:17:27FromDiscord<ripluke> In reply to @Yardanico "you're leaking httpclient instances,": ?
03:17:40FromDiscord<Yardanico> you must close httpclient instances after you use them
03:17:43FromDiscord<Yardanico> otherwise the FD will leak
03:17:46FromDiscord<ripluke> Oh
03:17:59FromDiscord<Yardanico> also you can just omit `return` in your procs
03:18:16FromDiscord<Yardanico> the last proc return can just be `if 'F' in weather: 'F' else: 'C'`
03:18:27FromDiscord<ripluke> In reply to @Yardanico "also you can just": Lol yea
03:18:37FromDiscord<ripluke> I know Nim has tgat
03:18:40FromDiscord<ripluke> (edit) "tgat" => "that"
03:18:47FromDiscord<ripluke> But I'm so used to js💀
03:18:51FromDiscord<Yardanico> `client ,`
03:19:06FromDiscord<Yardanico> also you used the doc comments the wrong way
03:19:08FromDiscord<ripluke> Probably should also have my vars in a block
03:19:11FromDiscord<Yardanico> they must be _inside_ the proc body, not outside of it
03:19:16FromDiscord<ripluke> In reply to @Yardanico "also you used the": Yea I need to delete those
03:19:38FromDiscord<huantian> you might wanna look at wttr.in's json API, it'll make it so you don't have to do weird string parsing
03:19:43FromDiscord<ripluke> I made a readme which explains pretty much all of it
03:19:54FromDiscord<ripluke> In reply to @huantian "you might wanna look": Oh they have one?
03:19:55FromDiscord<Yardanico> @mattrb well it doesn't crash without stack traces, but that's probably not the root cause
03:20:05FromDiscord<huantian> indeed <https://github.com/chubin/wttr.in#different-output-formats=>
03:20:14FromDiscord<ripluke> Ah gtk
03:20:21FromDiscord<ripluke> Probably will implement that
03:21:16FromDiscord<Yardanico> also @ripluke `string` is not required in `city: string = ""`
03:21:21FromDiscord<Yardanico> because nim already knows that `""` is a string
03:21:42FromDiscord<Elegantbeef> Yardanico hasnt yet pointed out the worst part
03:21:51FromDiscord<Yardanico> `std` imports?
03:21:52FromDiscord<Elegantbeef> `weather.split"+"[0].strip`
03:22:01FromDiscord<Yardanico> i mean it's more or less fine in this case
03:22:03FromDiscord<Yardanico> it's just a small string
03:22:05FromDiscord<ripluke> In reply to @Yardanico "also <@704106773660827690> `string` is": Ok
03:22:12FromDiscord<Elegantbeef> I dont care! 😄
03:22:23FromDiscord<ripluke> In reply to @Elegantbeef "`weather.split"+"[0].strip`": Well yea I did do a lot of splitting
03:22:33FromDiscord<Yardanico> also @ripluke instead you can just make one proc that'll return a tuple/object with all 3 fields
03:22:39FromDiscord<Yardanico> since you're doing the same request anyway
03:22:44FromDiscord<Elegantbeef> use strscans!
03:22:54FromDiscord<ripluke> In reply to @Yardanico "also <@704106773660827690> instead you": K
03:23:08FromDiscord<Yardanico> and for unit - not sure what that means
03:23:10FromDiscord<ripluke> I'll probably rewrite the whole thing with the json api
03:23:16FromDiscord<Yardanico> does wttr.in return different units based on the location or wat?
03:23:19FromDiscord<ripluke> In reply to @Yardanico "and for unit -": Farenheit or Celsius
03:23:22FromDiscord<ripluke> In reply to @Yardanico "does wttr.in return different": Yea
03:23:27FromDiscord<Yardanico> if so, you maybe need to convert it yourself
03:23:33FromDiscord<Elegantbeef> Remember yardanico fuckos use F
03:23:35FromDiscord<mattrb> In reply to @Yardanico "<@221832495367323648> well it doesn't": Wonder how user code is messing up the stack traces.. đŸ€”
03:23:41FromDiscord<huantian> the json api seems to return both C and F so that'll be fien
03:23:58FromDiscord<ripluke> In reply to @Elegantbeef "Remember yardanico fuckos use": Said like a true European
03:24:18FromDiscord<Elegantbeef> Mattrb probably some of your ptr code
03:24:19FromDiscord<Elegantbeef> Accidently overwriting the stack
03:24:20FromDiscord<huantian> beef is canadian tho he's fighting off bears as he eats his maple syrup rn
03:24:27FromDiscord<!Patitotective> hahah
03:24:36FromDiscord<Elegantbeef> I'm not european
03:24:37FromDiscord<Elegantbeef> I'm in NA
03:24:44FromDiscord<Elegantbeef> Thanks huan for the canonical truth
03:24:44FromDiscord<ripluke> In reply to @huantian "beef is canadian tho": 💀 anywhere not in the US is European
03:24:56FromDiscord<Elegantbeef> Said like a true person without healthcare
03:25:03FromDiscord<mattrb> Back to my process of reviewing all uses of pointers again...
03:25:25FromDiscord<Elegantbeef> Use the safer variants where possible matt
03:25:31FromDiscord<mattrb> Yup
03:25:35FromDiscord<ripluke> In reply to @Elegantbeef "Said like a true": 💀 atleast our youtube doesn't have to have a level of Canadianism
03:25:41FromDiscord<Elegantbeef> `ref` exists
03:25:42FromDiscord<ripluke> Whatever the fuck that means
03:26:07FromDiscord<ripluke> In reply to @ripluke "💀 atleast our youtube": Isn't that just called not free speech
03:26:11FromDiscord<Elegantbeef> Attacking C-11 is like the lowest insult possible
03:26:23FromDiscord<Elegantbeef> It's actually not our radio and TV already have the same requirements
03:26:37FromDiscord<ripluke> 💀
03:26:53FromDiscord<Elegantbeef> Imagine wanting to ensure domestic productions stay alive
03:27:17FromDiscord<ripluke> So basically you can't publicly talk bad about your country
03:27:25FromDiscord<Elegantbeef> That's not what it says
03:27:33FromDiscord<ripluke> In reply to @Elegantbeef "That's not what it": Ik
03:27:33FromDiscord<Yardanico> #offtopic đŸ€”
03:27:47FromDiscord<Elegantbeef> It requires a amount of content to be Canadian content on telecommunications and we'll go back to Nim talking now
03:27:47FromDiscord<ripluke> But basically it's whats going to happen
03:28:39FromDiscord<Yardanico> also @mattrb i'm not sure if it applies in your case, but maybe it's the case of strict aliasing
03:29:14FromDiscord<Elegantbeef> Nah i already tried yard
03:29:22FromDiscord<Yardanico> all the cast ptr T ?
03:29:23FromDiscord<Elegantbeef> `-fno-strict-aliasing` doesnt change anything
03:30:04FromDiscord<Yardanico> nim always passes that option by itself
03:30:11FromDiscord<Yardanico> so it doesn't matter if you pass it explicitly
03:30:45FromDiscord<Yardanico> but e.g. in case of zippy the issue was similar, and the fix was to use `copyMem` instead of casting with pointers to read stuff
03:30:45FromDiscord<Yardanico> https://github.com/guzba/zippy/issues/45
03:31:43FromDiscord<Yardanico> also I'm not exactly sure, but why are a lot of casts are even needed in bus.nim ?
03:31:58FromDiscord<Yardanico> `cast[ptr T](addr bus.iwram[aligned and 0x3FFFF])[] = value` isn't this just `bus.iwram[aligned and 0x3FFFF] = value`
03:32:59FromDiscord<Yardanico> oh so it's treating the array as an array to another type to e.g. write a uint64 to a uint8 array
03:34:11FromDiscord<Elegantbeef> Sure but yardanico there was no difference with strict aliasing off
03:34:13FromDiscord<mattrb> Yup, the point there is to be able to write a value of uint8/uint16/uint32 into the array at that index
03:34:23FromDiscord<Yardanico> In reply to @Elegantbeef "Sure but yardanico there": but as I said nim always passes that anyway
03:34:33FromDiscord<Yardanico> try `--listcmd` for the default compile and see the C compiler args
03:34:51FromDiscord<Yardanico> In reply to @mattrb "Yup, the point there": lemme try to remake some of those with `copyMem` just like in zippy
03:35:44FromDiscord<Elegantbeef> Oh i thought passing it removed the issue al together
03:36:16FromDiscord<mattrb> Thank you again for all the help :)
03:37:01FromDiscord<mattrb> Gotta eat dinner now, back in a bit!
03:58:19FromDiscord<Yardanico> yeah @mattrb i fixed it
03:58:26FromDiscord<Yardanico> was just toying with different things and remembered a similar case
03:58:42FromDiscord<Yardanico> see, because SDL calls audioCallback from a different thread, you also need to compile your program with `--threads:on`
03:58:52FromDiscord<Yardanico> because otherwise Nim won't know that it needs to create different stack frames per thread and stuff like that
03:59:03FromDiscord<Yardanico> of course you can just disable stack frames for that specific callback proc, but it's not a proper fix
03:59:25FromDiscord<Yardanico> and if most of your program is single-threaded (and it is) and you don't want to fix all the gcsafe errors, you can pass `--threadAnalysis:off`
03:59:49FromDiscord<Yardanico> and yeah, if you compile with the `refc` GC (the default) you must call `setupForeignThreadGC()` at the top of audio callback
03:59:56FromDiscord<Yardanico> or just always use arc/orc, they're better (as long as they work) :P
04:00:14FromDiscord<Yardanico> https://forum.nim-lang.org/t/9013
04:00:26FromDiscord<Yardanico> similar issue
04:01:29*kenran joined #nim
04:02:41FromDiscord<Yardanico> I mean, `--threads:on` is about to become the default on devel anyway, so that'll be less of a problem in nim v2 :P
04:03:02FromDiscord<Yardanico> ah it was already merged
04:03:38FromDiscord<Yardanico> time to get the latest devel and see more than half of all nim projects fail to compile unless you pass `--threads:off` (especially those that use nim's stdlib async) :D
04:08:34FromDiscord<Yardanico> finally I'll feel the joy of Nim devel being too different from stable again
04:10:49FromDiscord<xflywind> That's less of a problem than defaults to Orc.
04:10:56FromDiscord<xflywind> (edit) "defaults" => "defaulting"
04:11:15FromDiscord<xflywind> (edit) "Orc." => "Orc 😜"
04:11:30FromDiscord<Yardanico> In reply to @flywind "That's less of a": eh, actually threads:on is a bigger problem than orc
04:11:44FromDiscord<Yardanico> most programs nowadays just work with orc, at most you need to add `--deepcopy:on`
04:11:52FromDiscord<Yardanico> but with threads:on most async programgs become unusable because of all gcsafe stuff
04:12:09FromDiscord<Yardanico> (edit) "programgs" => "programs"
04:12:13FromDiscord<Yardanico> unless you explicitly disable threads
04:12:21FromDiscord<Elegantbeef> Isnt gcsafe also gone though?
04:12:29FromDiscord<Yardanico> no?
04:12:41FromDiscord<Yardanico> as funny as it is
04:12:42FromDiscord<Elegantbeef> I'm thinking of locks arent i
04:13:34FromDiscord<Yardanico> and yes, gcsafe is also very outdated, it doesn't know that arc/orc have shared heap
04:16:37FromDiscord<xflywind> In reply to @Yardanico "most programs nowadays just": There are lots of errors like
04:16:47FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=41UA
04:16:55FromDiscord<Yardanico> only the minority of Nim projects have finalizers
04:17:03FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=41UB
04:17:05FromDiscord<Yardanico> yes, those are usually the bigger ones, but again, that's the minority
04:17:20FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=41UC
04:17:23FromDiscord<Yardanico> but still, `--threads:on` will IMO affect more programs at compilation stage
04:20:47FromDiscord<xflywind> Yeah, I will make PRs to support enable deepcopy for some packages. It seems like months work to enable Arc/Orc for important packages.
04:21:21FromDiscord<Yardanico> not really, most important packages work with arc/orc just fine as I've tested them with arc/orc over a year ago
04:23:29*CyberTailor quit (Ping timeout: 268 seconds)
04:25:58*arkurious quit (Quit: Leaving)
04:29:13*kenran quit (Quit: WeeChat info:version)
04:29:37*toluene quit (Read error: Connection reset by peer)
04:31:19*toluene joined #nim
04:42:47FromDiscord<mattrb> In reply to @Yardanico "see, because SDL calls": Sweet, thank you!! I'll try it when I'm back at my computer (:
04:43:22FromDiscord<mattrb> In reply to @Yardanico "or just always use": Why are they better? I remember reading something briefly but forget the precise reasoning
04:44:26FromDiscord<Elegantbeef> They're partially deterministic and are not conventional GCs so do not require annoying steps to work
04:46:09FromDiscord<Yardanico> In reply to @mattrb "Why are they better?": well, for one, arc/orc don't do stack scanning like refc
04:46:22FromDiscord<Yardanico> so you don't have to set up arc/orc for each "foreign" thread like you need with refc
04:46:37FromDiscord<Yardanico> then arc/orc use destructors in a lot of cases instead of conventional GC, so it's more deterministic
04:49:52FromDiscord<j-james> wait, what did refc have to scan the stack for?
04:49:58FromDiscord<j-james> was that for cycles?
04:51:18FromDiscord<Yardanico> In reply to @j-james "wait, what did refc": I'm not that good at refc knowledge, but stack scanning is one of the main parts of it
04:51:34FromDiscord<Yardanico> In reply to @j-james "was that for cycles?": iirc that's done with a m&s phase?
04:52:41FromDiscord<j-james> oh, i see
04:53:03FromDiscord<j-james> so that probably was for counting references then
04:53:23FromDiscord<Yardanico> yeah
04:53:46FromDiscord<Yardanico> and arc is destructors with pure refcounting (not deferred like refc)
04:53:54FromDiscord<Yardanico> a destructor gets called on a ref, and if the refcount is 0 it's destroyed, simple
04:55:54FromDiscord<Yardanico> by "simple" I mean in the compiled program, not in the compiler :)
04:57:13bigbytI just want prolog in nim
05:23:29*LuxuryMode quit (Quit: Connection closed for inactivity)
05:23:38*rockcavera quit (Remote host closed the connection)
05:34:06FromDiscord<Elegantbeef> Always weird to see notable people join matrix rooms
05:37:09FromDiscord<Yardanico> you mean discord
05:37:09*CyberTailor joined #nim
05:37:30FromDiscord<Yardanico> the matrix bot translates discord server joins to matrix room joins
05:37:31FromDiscord<Elegantbeef> Didnt show the typical bot info
05:37:38FromDiscord<Yardanico> image.png https://media.discordapp.net/attachments/371759389889003532/994839659345612820/image.png
05:37:42FromDiscord<Elegantbeef> Yea i see now
05:49:19FromDiscord<ajusa> can I cast a string to a fixed size array?
05:49:33FromDiscord<Elegantbeef> No
05:49:59FromDiscord<Elegantbeef> I mean you can do like `cast[ptr array[size, char]](myString[0].addr)`
05:50:22FromDiscord<Yardanico> In reply to @ajusa "can I cast a": what would you need this for?
05:50:35FromDiscord<Elegantbeef> `openArray[char]` exists
05:50:40FromDiscord<ajusa> I have a string, which I want to write to a file but make sure it is 200 bytes
05:50:50FromDiscord<Yardanico> just check the length?
05:50:59FromDiscord<ajusa> so pad it with nulls if it is too short, and truncate if it is too long
05:51:08FromDiscord<Elegantbeef> `if myStr.len != 200: raise newException(ValueError, "it's not 200 bytes ya chump")`
05:51:24FromDiscord<ajusa> considering an alignLeft followed by a slice potentially, not sure if there are better ways
05:51:35FromDiscord<Yardanico> In reply to @ajusa "so pad it with": `setLen` to truncate or expand, and then if you're expanding assign the added stuff manually
05:51:43FromDiscord<Yardanico> that way you don't need to copy it around with slices
05:51:56FromDiscord<ajusa> setLen would zero it out as well I believe, thanks!
05:52:05FromDiscord<ajusa> I always forget the methods in the system module
05:52:17FromDiscord<ajusa> (edit) "methods" => "procs"
05:53:09*CyberTailor quit (Remote host closed the connection)
05:53:21FromDiscord<Yardanico> In reply to @ajusa "setLen would zero it": ah yeah, i was just reminded that setLen currently has weird behaviour with shrinking
05:53:27FromDiscord<Yardanico> but for your usecase it's ideal
05:53:37FromDiscord<Yardanico> In reply to @Yardanico "ah yeah, i was": and then expanding
05:53:39FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/19763
05:53:59*CyberTailor joined #nim
05:59:20FromDiscord<Elegantbeef> trying to use futhark on wlroots and oh boy is that API awful for futhark
06:02:33FromDiscord<Elegantbeef> Actually futhark is missing a field completely
06:02:40FromDiscord<Prestige> How can I essentially `tail -f` a file?
06:03:26FromDiscord<Elegantbeef> Atleast i think it missed this union https://play.nim-lang.org/#ix=41US
06:03:40FromDiscord<Elegantbeef> what does that do prestige?
06:03:47FromDiscord<Yardanico> In reply to @Avahe "How can I essentially": one simple way is to use std/enumerate (or just have your own manual index variable) with the "lines" iterator
06:04:08FromDiscord<Yardanico> although that'll still read the whole file, just line by line
06:04:16FromDiscord<Yardanico> try streams or memfiles
06:04:31FromDiscord<huantian> do streams reload on file change tho?
06:05:37FromDiscord<Yardanico> huh?
06:06:02FromDiscord<huantian> am I thinking of `tail -f` correctly? i always just used it to show new lines as they were added to say a log file
06:06:10FromDiscord<Yardanico> yes
06:06:47FromDiscord<Prestige> Not sure how I'd do that with streams, looking through the docs atm
06:09:28FromDiscord<Prestige> Unless I just call `proc readLine(s: Stream; line: var string): bool` infinitely waiting for new data to be added to the file, but that sounds unreasonable
06:12:16FromDiscord<Prestige> oh maybe I could just use a selector here somehow
06:59:14FromDiscord<ripluke> sent a code paste, see https://play.nim-lang.org/#ix=41V6
06:59:59FromDiscord<ripluke> idk how to do it
07:00:15FromDiscord<ripluke> i couldnt find an example like this in the std/json docs
07:01:53FromDiscord<huantian> Wat the why are all the numbers strings in the json lmao
07:04:27FromDiscord<ripluke> idk
07:04:32FromDiscord<ripluke> its the wttr.in api
07:05:00FromDiscord<huantian> I personally just use jsony for all my json stuff
07:05:17FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41V9
07:05:36FromDiscord<ripluke> In reply to @Isofruit "Do you want a": every single one??
07:05:44FromDiscord<ripluke> what about the ones in the array
07:05:52FromDiscord<Phil> Only the ones you care about
07:06:02FromDiscord<huantian> In reply to @ripluke "what about the ones": Yeah
07:06:06FromDiscord<huantian> If you wanna use the array
07:06:15FromDiscord<Phil> That's a second type you'll have to write and that's a field of seq second type
07:06:25FromDiscord<ripluke> In reply to @huantian "If you wanna use": well all of them are in the array
07:06:35FromDiscord<huantian> But all the types in the array should be homogenous so you only need to write a type for the thing in the array
07:07:41NimEventerNew Nimble package! nexus - Nexus provides a high-level web framework for Nim, with batteries included., see https://github.com/jfilby/nexus
07:17:30*cornfeedhobo quit (Remote host closed the connection)
07:20:05FromDiscord<ripluke> how can i define types lol never done it b4
07:20:53FromDiscord<huantian> You just define it like any other object
07:21:07FromDiscord<huantian> I don’t believe that you’ve never defined an object before in Nim
07:21:26FromDiscord<Elegantbeef> "Is it like a tuple?!"
07:21:40FromDiscord<ripluke> In reply to @huantian "I don’t believe that": nevver donr that iether :)
07:21:47FromDiscord<huantian> How
07:21:54FromDiscord<Elegantbeef> It scares me
07:22:27FromDiscord<huantian> I mean ig you don’t need objects if you just use anonymous tuples everywhere right 😛
07:22:36FromDiscord<ripluke> In reply to @huantian "How": well it just never came up b4
07:22:38FromDiscord<Elegantbeef> Fucking end me
07:22:56FromDiscord<Elegantbeef> that's to huan not you rip
07:23:37FromDiscord<ripluke> oh
07:23:46FromDiscord<ripluke> huh
07:26:03FromDiscord<huantian> I’d probably read the bit in the tutorial on objects rq
07:26:07FromDiscord<huantian> That’ll be helpful in general
07:27:37FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41Ve
07:27:42FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=41Ve" => "https://paste.rs/Qaj"
07:27:44FromDiscord<Phil> Or something like it?
07:28:04FromDiscord<ripluke> never touched either the type or the object keyword
07:28:15FromDiscord<Rika> How have you been using Nim then huh?
07:28:22FromDiscord<Rika> (edit) "then huh?" => "then, what?"
07:28:27FromDiscord<ripluke> although i have seen them before in the nimdow code
07:28:28FromDiscord<Phil> I am fascinated ripluke, tell me more!
07:28:43FromDiscord<Phil> I genuinely have no idea how you managed to go without them so far, so now I'm curious
07:28:44FromDiscord<ripluke> In reply to @Rika "How have you been": idek
07:29:01FromDiscord<Rika> What have you made so far
07:29:05FromDiscord<ripluke> ive also never done anything asynchronous either
07:29:10FromDiscord<Rika> That’s normal
07:29:15FromDiscord<Phil> That's perfectly sane
07:29:17FromDiscord<Rika> Beef hasn’t and he’s been here for a while
07:29:26FromDiscord<Phil> I didn#t touch async until I had like 1.5-2 years of programming under my belt
07:29:30FromDiscord<ripluke> In reply to @Rika "What have you made": lots of things, but nothing compared to how much ive used js
07:29:43FromDiscord<Rika> In reply to @ripluke "lots of things, but": I asked what things not how many
07:29:43FromDiscord<ripluke> lol i learned about nim from its js backend
07:30:16FromDiscord<ripluke> In reply to @Rika "I asked what things": well i did quite a bit of scripting for my linux setup
07:30:40FromDiscord<ripluke> like i have a theme switcher written in nim
07:30:57FromDiscord<ripluke> also most of the info in my bar is given from a nim script
07:30:57*cornfeedhobo joined #nim
07:31:28FromDiscord<ripluke> ive also never used pointers (in nim)
07:31:32FromDiscord<Rika> And you’ve never made a type
07:31:37FromDiscord<ripluke> i have used them b4 in zig
07:31:48FromDiscord<Elegantbeef> Not using pointers is fine most shouldnt use them
07:32:04FromDiscord<ripluke> In reply to @Rika "And you’ve never made": nope, it was just a lot easier to just not use them
07:32:15FromDiscord<Elegantbeef> It's' really not
07:32:53FromDiscord<ripluke> sent a code paste, see https://play.nim-lang.org/#ix=
07:33:53FromDiscord<ripluke> my theme script used to be horrible and also very hard to change
07:34:00FromDiscord<ripluke> but it works a lot better now
07:34:11FromDiscord<ripluke> still without types/objects
07:34:40FromDiscord<ripluke> this is it in all of its glory https://media.discordapp.net/attachments/371759389889003532/994869110771036201/themer.nim
07:35:08FromDiscord<ripluke> we dont talk about the fact that copilot wrote like 75% of it
07:35:09FromDiscord<Phil> In reply to @ripluke "also most of the": You fascinate me
07:35:25FromDiscord<ripluke> In reply to @Isofruit "You fascinate me": its alot faster than a shell script tho\
07:35:31FromDiscord<ripluke> as its not interprated
07:35:45FromDiscord<Elegantbeef> Lol
07:35:50FromDiscord<ripluke> i might also write my river init file in nim
07:36:01FromDiscord<ripluke> that would be cool
07:36:42FromDiscord<huantian> Beef you can teach ripluke how to use std/json / jsony I’m going to sleep
07:37:11FromDiscord<ripluke> lol first im gonna go hate on the tutorial i used to learn nim :)
07:37:22*hexeme quit (Quit: co'o ro do)
07:37:55FromDiscord<ripluke> ah found what i used https://narimiran.github.io/nim-basics/
07:39:37FromDiscord<Phil> I can highly recommend the tut linked on the initial nim doc page
07:40:24FromDiscord<Elegantbeef> I cannot help myself so here you go ripluke
07:40:25FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=41Vk
07:40:33FromDiscord<Elegantbeef> Actually extensible
07:41:15*hexeme joined #nim
07:46:09NimEventerNew thread by Wreedb: Help with sorting a sequence of objects, see https://forum.nim-lang.org/t/9292
07:56:15NimEventerNew thread by Jasonfi: Nimble CI failing due to Nim v1.6.0 not found, see https://forum.nim-lang.org/t/9293
07:58:00*hexeme quit (Quit: co'o ro do)
08:00:00*hexeme joined #nim
08:04:32FromDiscord<ripluke> In reply to @Elegantbeef "Actually extensible": What?
08:17:04FromDiscord<ripluke> sent a code paste, see https://play.nim-lang.org/#ix=41Vv
08:22:42FromDiscord<ripluke> now how can i convert it
08:24:17FromDiscord<Josef> Is it possible to implement indexing for arbitrary pointer?
08:25:22FromDiscord<Josef> Something like `proc getitem(x: pointer, ix: int) = ...`
08:26:40FromDiscord<dain> is there a way to do generic anonymous functions?
08:26:47FromDiscord<Rika> No
08:26:51FromDiscord<dain> oh :(
08:26:58FromDiscord<Rika> It doesn’t really make sense to me
08:27:18FromDiscord<dain> well im trying to make a template that converts a key function to a cmp function
08:27:34FromDiscord<Rika> Anonymous functions can be runtime values, generic functions cannot without a type being specified
08:27:59FromDiscord<dain> like, lots of sorting procs take a `cmp` parameter which i think has to be a function that takes two values to be compared and returns -1, 0, or 1
08:28:21FromDiscord<dain> but i prefer the python style of providing a `key` function that takes a single value and gives a number
08:28:36FromDiscord<dain> there's a way to convert between them but im not sure how to express it with nim's type system
08:28:38FromDiscord<ripluke> why is json so difficult in nim, in javascript its super simple, and in bash its also quit simple with something like jq
08:29:36FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=41Vy
08:29:44FromDiscord<dain> is this kind of thing possible?
08:30:35FromDiscord<Yardanico> In reply to @Josef "Is it possible to": cast it to ptr UncheckedArray
08:30:44FromDiscord<Yardanico> of the type that you want to get out of it
08:31:59FromDiscord<Rika> In reply to @dain "so i want something": Values must be concrete so not that I know of no
08:32:15FromDiscord<Rika> Without hacky stuff
08:33:35FromDiscord<huantian> sent a code paste, see https://paste.rs/cgE
08:34:00FromDiscord<ripluke> idek wth im doing
08:34:07FromDiscord<huantian> In reply to @ripluke "now how can i": Idk for std, jsony is jsonString.fromJson(YourType)
08:34:16FromDiscord<ripluke> i used something called nimjsonn to convert it
08:34:37FromDiscord<ripluke> In reply to @huantian "Idk for std, jsony": how do i get the json object tho
08:34:45FromDiscord<ripluke> (edit) "object" => "string"
08:34:52FromDiscord<ripluke> i already have an object
08:35:02FromDiscord<ripluke> but how can i get a string from it'
08:35:04FromDiscord<ripluke> (edit) "it'" => "it"
08:35:07FromDiscord<huantian> Huh? The json string is the json you got from your web request
08:35:23FromDiscord<ripluke> oh so you mean the whole object
08:36:29FromDiscord<Phil> I'm on the to and can help in 7 or so hours
08:38:42FromDiscord<ripluke> ?
08:40:08FromDiscord<Phil> sent a long message, see http://ix.io/41VB
08:40:23FromDiscord<Phil> Look at the docs as to how they work
08:40:56FromDiscord<Phil> (edit) "http://ix.io/41VB" => "http://ix.io/41VC"
08:41:27FromDiscord<ripluke> In reply to @Isofruit "If you want to": im scraping data from the web, so would it be in a inline string or a multiline string
08:41:45FromDiscord<huantian> You just pass the string to the function
08:41:49FromDiscord<huantian> You don’t need a literal
08:41:58FromDiscord<Phil> Both are just strings
08:42:08FromDiscord<Phil> You don't really have to care
08:42:15FromDiscord<huantian> Man I wish I was on PC so I could just show you
08:42:50FromDiscord<Phil> Just look at the std JSON docs it has multiple minimal examples
08:43:14FromDiscord<ripluke> In reply to @huantian "You just pass the": K
08:43:27FromDiscord<ripluke> I'm using jsony
08:43:43FromDiscord<ripluke> I think I get the idea tho
08:43:53FromDiscord<ripluke> I'll ask here if I run into any trouble
08:44:08FromDiscord<huantian> I’ll respond in 8-10 hours to your trouble
08:44:56FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=41VD
08:45:37FromDiscord<Rika> thats because the inner you're returning is `inner(a, b: as_cmp.T)`
08:45:45FromDiscord<Rika> the T is not a "real generic"
08:45:52FromDiscord<Rika> so its concrete/specified
08:47:07FromDiscord<dain> ?
08:48:01FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=41VE
08:48:30FromDiscord<dain> ahh i see
08:48:35FromDiscord<dain> yeah that's what i thought the template would do somehow
08:51:19FromDiscord<dain> is there a way to specify "orderable" or "sortable" or "comparable" or something
08:51:23FromDiscord<dain> for the `U` parameter
08:51:37FromDiscord<Elegantbeef> Concepts
08:51:52FromDiscord<dain> like `f: proc(x: T): Orderable` rather than any old U
08:52:33FromDiscord<Phil> Dain allow me to introduce you to traitor
08:52:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41VF
08:52:48FromDiscord<Elegantbeef> Traitor isnt needed here
08:53:24FromDiscord<Elegantbeef> that should be `c == c` of course
08:53:32FromDiscord<Phil> The way he's going with this I feel tempted to practice it pre emptively
08:53:44FromDiscord<dain> what is traitor ;o
08:53:48FromDiscord<Elegantbeef> He hasnt asked for runtime dispatch
08:53:51FromDiscord<Phil> (edit) "practice" => "prescribe"
08:54:06FromDiscord<Elegantbeef> A trait-like system for Nim that really needs rewritten and is mostly just for fun
08:54:44FromDiscord<Elegantbeef> https://github.com/beef331/traitor if interested
08:55:19FromDiscord<Elegantbeef> I do have a possible rewrite started but still dont know if I like it
08:56:00FromDiscord<Prestige> Elegantbeef: How do you feel about writing a wayland compositor?
08:58:16FromDiscord<Josef> How doc comments look like in Nim. Are there doctests?
08:58:53FromDiscord<Prestige> https://nim-lang.org/docs/tut1.html#lexical-elements-comments
09:00:25FromDiscord<Josef> Btw, why are multiline comments not indentation based?
09:02:48FromDiscord<Elegantbeef> Non doc comments arent apart of the ast
09:03:36FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41VQ
09:19:57*CyberTailor quit (Remote host closed the connection)
09:21:01*CyberTailor joined #nim
09:24:43*aru-hackZ joined #nim
09:31:30*aru-hackZ quit (Ping timeout: 240 seconds)
09:33:15FromDiscord<byteface> Hi, I notice there's a varargs but is there a varkwargs for keyword args?
09:41:48FromDiscord<bariali07> hi
09:42:21FromDiscord<vestel> `cstring` is a `char` or `char[]`
09:42:26FromDiscord<vestel> (edit) "`char[]`" => "`char[]`?"
09:43:25FromDiscord<vestel> I know that arrays implemented via pointers indexing, what I mean is cstring a pointer to char array or just a char array
09:44:35*def- quit (Quit: -)
09:44:40FromDiscord<vestel> oh nevermind
09:44:48*def- joined #nim
09:45:32FromDiscord<Rika> In reply to @byteface "Hi, I notice": No
09:46:04FromDiscord<vestel> In reply to @byteface "Hi, I notice": just do dict?
09:51:59Amun-Ravestel: cstring is like ptr UncheckedArray[char]
09:56:57Amun-Rain C terms is char* as you can't pass an array to a function in C and retain original type
09:58:27*aru-hackZ joined #nim
10:46:06FromDiscord<TryAngle> is there a minus that defaults to the bounds in case of overflow?
10:47:06FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=41W7
10:51:35FromDiscord<d4rckh> is there any easy way of converting a status (string) from requesting using <HttpClient>.request to a value of HttpCode (enum)
10:52:16FromDiscord<enthus1ast> does parseEnum work?
10:52:17FromDiscord<Rika> In reply to @TryAngle "is there a minus": The technical term is “saturating arithmetic” and it’s harder to implement
10:52:46FromDiscord<Rika> There’s an implementation in the compiler so you could prolly use it if you copied the file or whatever
10:53:09FromDiscord<Rika> In reply to @d4rckh "is there any easy": There already is a proc for that no?
10:53:15FromDiscord<d4rckh> In reply to @enthus1ast "does parseEnum work?": actually, HttpCode is not an enum, http code is defined as `HttpCode = distinct range[0 .. 599]`
10:53:22FromDiscord<Rika> “code” or something
10:53:59FromDiscord<d4rckh> `proc code(response: Response | AsyncResponse): HttpCode`?
10:54:05FromDiscord<Rika> Yes? Is that not what you need
10:54:07FromDiscord<d4rckh> seems to be it
10:54:08FromDiscord<d4rckh> thanks
10:54:37FromDiscord<TryAngle> In reply to @Rika "The technical term is": I see thanks
10:55:30FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=41W8
10:55:39FromDiscord<TryAngle> (edit) "https://play.nim-lang.org/#ix=41W8" => "https://play.nim-lang.org/#ix=41W9"
10:55:47FromDiscord<Rika> You can’t do that
10:56:01FromDiscord<Rika> Because overflows make > not work lol
10:56:56FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=41Wa
10:57:03FromDiscord<Rika> Ah for minus
10:57:12FromDiscord<Rika> I don’t know
10:57:20FromDiscord<TryAngle> ah wait for int this doesn't work
10:57:31FromDiscord<Rika> That’s unsigned
10:57:39FromDiscord<Rika> For integer it’s not gonna work but as of your writing it does
10:57:54FromDiscord<TryAngle> ye unsigned is special case
10:58:07FromDiscord<TryAngle> so for unsigned using what I wrote is better anyways?
10:58:37FromDiscord<TryAngle> idk tbh, I was thinking myabe there are intrisics or something liek that address registers on the pc or something like that hahha
10:58:52FromDiscord<Rika> What
10:59:02FromDiscord<Rika> I don’t recall of any saturated integer intrinsically
10:59:06FromDiscord<Rika> Intrinsics
10:59:08FromDiscord<d4rckh> is there an async http client?
10:59:12FromDiscord<Rika> Yes
10:59:14FromDiscord<TryAngle> yes
10:59:19FromDiscord<Rika> It’s in the same module “http client”
10:59:21FromDiscord<d4rckh> oh there is in the same library haha
10:59:38FromDiscord<TryAngle> In reply to @d4rckh "oh there is in": ye u can just swap out the generic If I remember correctly
10:59:56FromDiscord<d4rckh> yup
11:00:45FromDiscord<d4rckh> i am trying to make some sort of http proxy
11:01:12FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=41Wf
11:01:19FromDiscord<TryAngle> how do u open the secret nim repl again?
11:01:23FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=41Wg
11:01:37FromDiscord<TryAngle> I remember seeing it in pmunch stream
11:02:28FromDiscord<TryAngle> oh nim secret and it's dying 💀
11:04:58FromDiscord<fbpyr> @TryAngle\: there is also a secret nim repl?↔I usually use inim\: `nimble install inim` 🙂
11:05:11FromDiscord<enthus1ast> @d4rckh\: what listens on "http://localhost:8000" ?
11:05:21FromDiscord<d4rckh> python http server
11:05:32FromDiscord<d4rckh> it works with smaller files
11:05:49FromDiscord<d4rckh> but if i try to access a bigger file it throws that exception
11:06:03FromDiscord<enthus1ast> what is a bigger file?
11:06:09FromDiscord<enthus1ast> how large i mean \:)
11:06:12FromDiscord<d4rckh> um
11:06:13FromDiscord<d4rckh> its an audio file
11:06:19FromDiscord<d4rckh> 2.51mb
11:06:28FromDiscord<d4rckh> the python http server handles the request properly and returns 200 (according to the logs)
11:07:41FromDiscord<enthus1ast> do you request this with a browser?
11:08:34FromDiscord<d4rckh> yes
11:08:40FromDiscord<enthus1ast> I'm asking, because a browser also requests favicon.ico
11:09:06FromDiscord<enthus1ast> and the python http server is quite limited and cannot do multiple request at once
11:09:22FromDiscord<enthus1ast> i would try the node http-server
11:09:22FromDiscord<d4rckh> it already requested a favicon.ico few minutes ago but the http proxy correctly forwarded 404
11:09:34FromDiscord<enthus1ast> ok ic
11:09:35FromDiscord<d4rckh> so its not because of the favicon
11:16:59FromDiscord<d4rckh> it works if i go to `/` for the first time
11:17:06FromDiscord<d4rckh> but if i go again to `/` it crashes for the same reason
11:17:17FromDiscord<d4rckh> if i go to `/mp3file.mp3` the first time it crashes
11:17:31FromDiscord<d4rckh> first time meaning first time after i start the http 'proxy'
11:17:58FromDiscord<enthus1ast> i bet that it stuck in the request
11:18:14FromDiscord<d4rckh> yes, the request to the py http server
11:18:24FromDiscord<d4rckh> but the py http server returns 200 every time
11:18:32FromDiscord<enthus1ast> maybe it does not close the connection?
11:18:47FromDiscord<d4rckh> well the error says it does close it
11:18:51FromDiscord<d4rckh> but before the request was completed?
11:19:17FromDiscord<enthus1ast> ahh
11:19:29FromDiscord<enthus1ast> can you try to create a new httpclient in the request?
11:19:32FromDiscord<enthus1ast> every time
11:19:40FromDiscord<enthus1ast> you reuse the http client
11:19:50FromDiscord<d4rckh> i changed it to a real website located on the internet and i am getting this https://media.discordapp.net/attachments/371759389889003532/994925774572367922/unknown.png
11:19:57FromDiscord<d4rckh> (the real world website uses http)
11:20:05FromDiscord<d4rckh> hmm
11:20:06FromDiscord<d4rckh> i will try
11:20:33FromDiscord<d4rckh> that worked
11:20:36FromDiscord<d4rckh> and it works with the mp3 files as well
11:20:37FromDiscord<d4rckh> damn
11:20:46*summer joined #nim
11:21:47FromDiscord<enthus1ast> the invalid header could be a second issue
11:21:51FromDiscord<d4rckh> myeah
11:21:59FromDiscord<enthus1ast> good
11:23:02FromDiscord<d4rckh> could i plug this in chrome http proxy settings?
11:23:10FromDiscord<enthus1ast> nope
11:23:30FromDiscord<enthus1ast> http proxy is a special protocol
11:23:56FromDiscord<enthus1ast> i think it sets a few special headers, and closes the connection each time etc
11:23:56FromDiscord<d4rckh> ah I see
11:24:24FromDiscord<enthus1ast> but you could make it work
11:25:15FromDiscord<TryAngle> what is the nim equivalent to rusts `mem::swap`
11:25:41FromDiscord<Yardanico> `swap`
11:25:42FromDiscord<TryAngle> it switches the values of two locations in the memory
11:25:49FromDiscord<TryAngle> In reply to @Yardanico "`swap`": lol builtin?
11:25:50FromDiscord<Yardanico> https://nim-lang.org/docs/system.html#swap%2CT%2CT
11:25:50FromDiscord<TryAngle> thx
11:33:34FromDiscord<Prestige> Anyone here know python? Trying to convert a bit of code, unsure what this generator is doing: https://github.com/python-kasa/python-kasa/blob/57fac9a156eb34f01f236e620be3449b5f04d927/kasa/protocol.py#L200↔it is essentially an iterator, but we're only using the first byte xor'd with `key` ?
11:34:14FromDiscord<enthus1ast> "ciphertext "
11:34:24FromDiscord<enthus1ast> lol
11:35:20FromDiscord<enthus1ast> seems like\:↔↔integer + bytes
11:35:33FromDiscord<enthus1ast> net line encoding
11:35:47*aru-hackZ quit (Ping timeout: 244 seconds)
11:37:12FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=41Wn
11:37:32FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=41Wo
11:37:34FromDiscord<d4rckh> enthus1ast, these are my headers
11:37:35Amun-RaPrestige: no, all the bytes
11:37:56FromDiscord<d4rckh> should i perhaps replace the host?
11:38:22FromDiscord<Prestige> Interesting, so it's xor'ing all bytes with `key` and returning the result to be used on line 200?
11:39:41FromDiscord<Prestige> Python is weird
11:40:37FromDiscord<d4rckh> this does not seem to work?
11:40:38FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=41Wp
11:41:07Amun-Rait's not python that's weird, it's this kind of code bloviation
11:43:14FromDiscord<AsbjĂžrn F> Hello lovelies. Not sure if I should ask here, but what would the process be to compile Nim to WASM? Get the intermediate C and run Emscripten on that?
11:43:35FromDiscord<Prestige> it's not obvious what it's doing imo
11:43:42FromDiscord<Prestige> I still don't know what it's doing lol
11:44:15Amun-RaI agree :>
11:44:20FromDiscord<enthus1ast> @d4rckh it seems that one main difference is that the when connecting to a proxy, the client sends the full url in its get
11:44:58FromDiscord<Prestige> I'll have to research python generators I suppose
11:45:01FromDiscord<d4rckh> ah
11:45:09FromDiscord<soundmodel> Is there a framework for Nim which is somewhat like React or Java SDK?
11:45:11FromDiscord<d4rckh> what about the bad header from the (IIS) web site?
11:45:21FromDiscord<soundmodel> (edit) "Is there a framework for Nim which is somewhat like React or Java SDK? ... " added "I.e. that it allows developing the complete app?"
11:45:27Amun-RaPrestige: they are no different than nim ones
11:45:31FromDiscord<d4rckh> could it be the host header pointing to localhost:1234 instead to the website name?
11:45:42FromDiscord<d4rckh> and if yes how can i edit the header before sending?
11:45:44FromDiscord<enthus1ast> could be
11:45:51FromDiscord<enthus1ast> maybe you do not need to
11:46:06FromDiscord<d4rckh> i wanna try it
11:46:09FromDiscord<enthus1ast> could be that the header is correct when you configure this as a proxy
11:46:18FromDiscord<d4rckh> i am not using this as a proxy
11:46:22FromDiscord<soundmodel> Karax is the React, but what's for native?
11:46:28FromDiscord<Prestige> In reply to @Amun-Ra "<@778498877464117248>: they are no": So that code is just using the first byte
11:46:30FromDiscord<soundmodel> (edit) "React," => ""React","
11:46:39FromDiscord<d4rckh> its more of a redirector
11:46:40FromDiscord<AsbjĂžrn F> In reply to @soundmodel "Is there a framework": I've been suggested to work on this stack for web, Prologue, Norm / Ormin, HTMX↔For native I've been doing SDL2. There's imGUI bindings as well
11:47:10FromDiscord<enthus1ast> yeah, then the host must match the virtual host configured on the server↔(@d4rckh)
11:47:13FromDiscord<TryAngle> is there something like return for iterators to stop them immediatly?
11:47:19FromDiscord<d4rckh> ah yes
11:47:21FromDiscord<soundmodel> In reply to @AsbjĂžrn F "I've been suggested to": So are the SDL2 bindings good?
11:47:28FromDiscord<d4rckh> how do i edit it then?
11:47:32FromDiscord<soundmodel> (edit) "In reply to @AsbjĂžrn F "I've been suggested to": So are the SDL2 bindings good? ... " added "Often I've found that language bindings are worse than writing in the original language"
11:47:38FromDiscord<enthus1ast> no you must break out of them↔(@TryAngle)
11:47:50FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=41Wt
11:48:00FromDiscord<AsbjĂžrn F> In reply to @soundmodel "So are the SDL2": I haven't had issues. Been doing my own OpenGL renderer and shaders in GLSL. All seems fine
11:48:20FromDiscord<AsbjĂžrn F> There's an example in imGUI one sec
11:48:37FromDiscord<soundmodel> Might try that then, but I was also thinking that an "enterprise" framework is a possible target for Nim anyways
11:48:39FromDiscord<enthus1ast> copy the header from the original request, then modify it and sent it with the request↔(@d4rckh)
11:48:58FromDiscord<soundmodel> (edit) "anyways" => "anyways. Just not sure if it already existed."
11:49:06FromDiscord<AsbjĂžrn F> https://user-images.githubusercontent.com/7249728/60570947-e6787f80-9d72-11e9-8b26-d189f44b1256.gif
11:49:17Amun-RaPrestige: no, there's iterator in that generator, like: for x in y: yield x
11:49:32FromDiscord<d4rckh> In reply to @enthus1ast "copy the header from": how do i copy it?
11:49:43FromDiscord<enthus1ast> is this nim?↔(@AsbjĂžrn F)
11:49:45FromDiscord<enthus1ast> ncie
11:49:48FromDiscord<enthus1ast> nice
11:49:58FromDiscord<AsbjĂžrn F> si, imGUI bindings. NimGL
11:50:06FromDiscord<AsbjĂžrn F> I didn't make it btw
11:54:02FromDiscord<d4rckh> this should work right?
11:54:03FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=41Wv
11:54:37FromDiscord<enthus1ast> responseß
11:54:38FromDiscord<enthus1ast> ?
11:54:43FromDiscord<enthus1ast> should it not be req?
11:55:26FromDiscord<d4rckh> wait
11:55:38FromDiscord<soundmodel> In reply to @AsbjĂžrn F "si, imGUI bindings. NimGL": So how do SDL2 and imgui relate?
11:56:37FromDiscord<enthus1ast> sdl2 draws and imgui is the gui
11:57:17FromDiscord<enthus1ast> imgui has a lot of backend options
11:57:52FromDiscord<Prestige> In reply to @Amun-Ra "<@778498877464117248>: no, there's iterator": yeah but the generator is only called once
11:57:53FromDiscord<soundmodel> Okay so then we could also consider: https://github.com/zacharycarter/nuklear-nim
11:57:54FromDiscord<d4rckh> okay, i successfully edited that header 😅
11:58:09FromDiscord<d4rckh> but the website is still crying about a header
11:58:09FromDiscord<enthus1ast> @d4rckh\: ;)
11:58:23FromDiscord<d4rckh> it actually says invalid name header
11:59:27FromDiscord<enthus1ast> @d4rckh\: to code something like this, i would point the browser and your proxy to a listening ncat (or netcat) then compare the requests
11:59:53FromDiscord<enthus1ast> your code will fail of course since it will not get a response, but you can see the data
12:00:31FromDiscord<enthus1ast> then you make it so, that the request your forwarding proxy sends, looks like the one of the browser
12:03:04FromDiscord<enthus1ast> ncat btw is part of nmap
12:03:13FromDiscord<enthus1ast> or socat
12:03:16FromDiscord<d4rckh> i will do that
12:03:32FromDiscord<enthus1ast> then it will be easy going fixing these issues
12:04:35FromDiscord<enthus1ast> i actually was in the middle of adding http proxy support to nimSocks, but yeah live happend
12:05:20FromDiscord<enthus1ast> and its quite a bummer that our http clients cannot (yet) speak to socks
12:06:29FromDiscord<d4rckh> oof
12:06:39FromDiscord<d4rckh> well now i am facing another weird problem
12:06:56FromDiscord<d4rckh> sent a code paste, see https://paste.rs/QZ3
12:07:03FromDiscord<d4rckh> i am trying to edit the links on the website
12:07:08FromDiscord<d4rckh> (edit) "i am trying to edit the links on the website ... " added "to point to my 'redirector'"
12:07:15FromDiscord<d4rckh> but each echo in that snippet prints nothing
12:07:38FromDiscord<enthus1ast> why do you do this? \:)
12:07:44FromDiscord<enthus1ast> you're a proxy
12:08:13FromDiscord<enthus1ast> or wait you aren't yet right?
12:08:36FromDiscord<d4rckh> right now its just a web server that forwards requests to other web servers
12:09:12FromDiscord<d4rckh> but why i cant access the body there?
12:09:25FromDiscord<d4rckh> the full body is sent when i respond to the original request
12:23:19FromDiscord<Prestige> Is there another way to convert a string to a byte array without using a string stream and reading uint8s?
12:23:48FromDiscord<Rika> Casting?
12:24:07FromDiscord<Yardanico> In reply to @Avahe "Is there another way": casting, `copyMem`, etc
12:24:16FromDiscord<Yardanico> i wouldn't have even thought of using a stream for this, lol :P
12:24:21FromDiscord<Yardanico> would be too much overhead
12:25:08FromDiscord<enthus1ast> does the js backend supports casting or copyMem?
12:25:35FromDiscord<enthus1ast> would be at least more portable i guee
12:25:40FromDiscord<enthus1ast> guess
12:26:26FromDiscord<Yardanico> it supports casting, yes, not copyMem
12:26:35FromDiscord<Yardanico> casting a string to a seq works with the JS backend
12:26:44FromDiscord<Prestige> cool didnt know I could just cast it
12:26:59FromDiscord<Prestige> makes sense
12:42:35*xet7 joined #nim
12:48:40FromDiscord<untoreh> can I get the path of a loaded library from a `LibHandle` ?
12:49:05FromDiscord<untoreh> prob not
12:50:21FromDiscord<enthus1ast> You can with native api
12:51:50FromDiscord<enthus1ast> Eg windows\: https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamea
13:04:15FromDiscord<d4rckh> why is it 0 😭
13:04:16FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=41WP
13:04:24FromDiscord<d4rckh> (edit) "it" => "it's len"
13:09:04FromDiscord<enthus1ast> Maybe its a redirect?
13:09:20FromDiscord<enthus1ast> Print the status code as well
13:09:54FromDiscord<d4rckh> oh good idea
13:10:18FromDiscord<enthus1ast> And when its a redirect, it Skips your proxy all together \:D
13:10:29FromDiscord<d4rckh> its a.... 304 not modified
13:11:25FromDiscord<d4rckh> https://media.discordapp.net/attachments/371759389889003532/994953854548451368/unknown.png
13:11:44FromDiscord<d4rckh> how can i use the bodyStream FutureStream?
13:11:47FromDiscord<d4rckh> (edit) "FutureStream?" => "FutureStream[string]?"
13:12:26FromDiscord<enthus1ast> Then you must filter the browsers caching headers↔(@d4rckh)
13:12:51FromDiscord<d4rckh> ohh
13:12:52FromDiscord<d4rckh> i see
13:20:53*xet7 quit (Remote host closed the connection)
13:23:58*hc0re joined #nim
13:26:26*xet7 joined #nim
13:32:24*xet7_ joined #nim
13:32:46*xet7_ quit (Client Quit)
13:33:17*xet7_ joined #nim
13:35:55*xet7 quit (Ping timeout: 260 seconds)
13:36:02*xet7_ quit (Remote host closed the connection)
13:37:00*xet7 joined #nim
13:44:08*xet7 quit (Remote host closed the connection)
13:55:14FromDiscord<byteface> sent a code paste, see https://play.nim-lang.org/#ix=41X3
14:03:14FromDiscord<enthus1ast> @byteface\: go into your repo and execute nimble check
14:03:48FromDiscord<enthus1ast> It might be that your project has an incorrect structure
14:04:25FromDiscord<enthus1ast> Btw for local development you can do a\: nimble develop
14:05:48FromDiscord<d4rckh> how can i get the IP of the http client?
14:05:52FromDiscord<d4rckh> (edit) "client?" => "client that connected?"
14:05:56FromDiscord<d4rckh> (edit) "connected?" => "connected and is making the request?"
14:06:14FromDiscord<d4rckh> the request type has a client: AsynSocket property
14:08:13FromDiscord<sOkam!> I want to translate some cpp code (not interface with it, manually translate)↔First thing I noticed are the types are different (obviously)↔Where can I read about the differences between compatible types (cfloat, cint, etc) and native nim types?↔Or how can I figure out if a conversion is safe from a compatible type to a native one?
14:08:30FromDiscord<enthus1ast> @d4rckh hostname https://nim-lang.org/docs/asynchttpserver.html#Request
14:09:14FromDiscord<d4rckh> i should put that in a header right?
14:09:18FromDiscord<d4rckh> X-Forwarded or something
14:09:32FromDiscord<byteface> test is valid. im thinking it might be my setup?
14:09:36FromDiscord<enthus1ast> @sOkam!\: one option is to put parts into c2nim and translate it
14:09:49FromDiscord<byteface> if i do nimble isntall somepackage
14:09:58FromDiscord<byteface> am i supposed to be able to just import it?
14:10:02FromDiscord<enthus1ast> If you like you can, but it's not required↔(@d4rckh)
14:10:03FromDiscord<sOkam!> In reply to @enthus1ast "<@186489007247589376>\: one option is": ye, tried. but it breaks due to expecting `;` in every file
14:10:24FromDiscord<sOkam!> i think its not understanding the namespaces
14:10:43FromDiscord<enthus1ast> Yes↔(@byteface)
14:11:09FromDiscord<enthus1ast> Ahh cpp might not be supported, but don't know for sure↔(@sOkam!)
14:11:24FromDiscord<sOkam!> its partially supported, but some things break it seems
14:11:38FromDiscord<sOkam!> haven't figured out what exactly is breaking it yet
14:12:00FromDiscord<enthus1ast> Have a look at its options. I can also recommend to just put parts not the whole
14:12:19FromDiscord<sOkam!> im fine manually porting it. its for learning anyway, so slow will make it sink in better↔the issue is I don't know how to find information about the types differences
14:13:10FromDiscord<enthus1ast> @sOkam!\: google for "nim for c developers" I'm on mobile currently
14:14:29FromDiscord<sOkam!> This? https://github.com/nim-lang/Nim/wiki/Nim-for-C-programmers
14:16:45*hc0re quit (Ping timeout: 260 seconds)
14:17:00*rockcavera joined #nim
14:17:00*rockcavera quit (Changing host)
14:17:00*rockcavera joined #nim
14:25:30FromDiscord<enthus1ast> Yes
14:26:28*derpydoo joined #nim
14:31:37*pro joined #nim
14:33:16FromDiscord<byteface> seems like installing choosenim its not working?
14:34:53*pro quit (Client Quit)
14:37:00FromDiscord<sOkam!> @enthus1ast very good read, thanks↔doesn't answer my question, sadly. but definitely improved my understanding of other aspects
14:37:55FromDiscord<sOkam!> Still looking for compatible type conversion to native types.↔As in, why are they different, and when could the use of a native type go wrong, compared to using a compatible one instead
14:39:09FromDiscord<sOkam!> Cheap solution could be to use compatible types everywhere, but would prefer to avoid that if I can
14:45:51FromDiscord<byteface> got it working. i had bin in the nimble file.
14:51:57*arkurious joined #nim
15:02:56FromDiscord<vestel> How to fully disable aligment? `packed` program doesn't work correctly
15:03:07FromDiscord<vestel> (edit) "program" => "pragma"
15:03:14FromDiscord<ezquerra> In reply to @sOkam! "Still looking for compatible": Not an expert so take this with a (big) grain of salt but AFAIK the biggest difference is string vs cstring. For numeric types the differences are probably very minor or irrelevant
15:03:56FromDiscord<enthus1ast> and a string actually contains a cstring
15:04:08FromDiscord<ezquerra> I think the biggest differences are on automatic casting which in C and C++ is somewhat crazy (in the sense that there are a lot of footguns)
15:04:08FromDiscord<enthus1ast> since it is null terminated
15:04:38FromDiscord<ezquerra> (edit) "I think the biggest differences are on automatic casting ... which" added "of numeric values"
15:12:01*kenran joined #nim
15:13:29FromDiscord<sOkam!> makes sense. will use natives normally, except for strings, and hope for the best đŸ€ž
15:20:54FromDiscord<d4rckh> how can i use ssl with asynchttpserver?
15:21:20FromDiscord<enthus1ast> you can't
15:21:53FromDiscord<d4rckh> hm, why
15:22:01FromDiscord<enthus1ast> its not implemented yet
15:22:46FromDiscord<d4rckh> ..will it be implemented?
15:23:29FromDiscord<enthus1ast> i know of some discussions lately, but afaik there where for prologue, but since prologue also can use asynchttpserver one might implement it
15:24:05FromDiscord<enthus1ast> maybe its not too hard to do, maybe you could have a look at it \:)
15:24:51FromDiscord<enthus1ast> i can imagine its a matter of, upgrading the socket with ssl, listening on https port and a few tweaks here and there
15:28:38FromDiscord<d4rckh> is there any http server alternative with ssl?
15:29:24FromDiscord<enthus1ast> not that i know of
15:37:03FromDiscord<enthus1ast> @d4rckh\: https://datatracker.ietf.org/doc/html/rfc2818
15:37:12FromDiscord<enthus1ast> its seems very simple to implement
15:39:01FromDiscord<enthus1ast> and here i've done some ssl server stuff (warning ooold code) https://github.com/enthus1ast/libch4t/blob/f511e1b371b1d5ced9e42ee9469c3b8a9c1965bf/libch4t_irc.nim#L119
15:39:27FromDiscord<enthus1ast> but the devil is in the detail as always
15:40:45FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=41XE
15:41:01FromDiscord<fwsgonzo> (edit) "https://play.nim-lang.org/#ix=41XE" => "https://play.nim-lang.org/#ix=41XF"
15:41:15FromDiscord<fwsgonzo> (edit) "https://play.nim-lang.org/#ix=41XF" => "https://paste.rs/D9S"
15:49:32FromDiscord<kevin> I am once again asking if it is possible to redirect `stdout` to a variable 😩
15:49:45FromDiscord<kevin> still can't figure this out.
15:50:06FromDiscord<kevin> the `reopen()` trick works to send `stdout` to a file, but not a variable.
15:50:47FromDiscord<kevin> Does Nim support "Virtual Files" you can use to write to? sorta like a memoryStream
15:52:02FromDiscord<enthus1ast> why do you want to do this btw?
15:52:53FromDiscord<kevin> I'm trying to use winim/clr to run .net code
15:53:24FromDiscord<kevin> I got that all to work and I can use winim/clr's `load()` to load and execute dotnet assemblies
15:53:34FromDiscord<kevin> but all of the `Console.WriteLine()` code goes to the terminal
15:53:46FromDiscord<kevin> instead, I want to capture the output and save it into a variable
15:55:18FromDiscord<enthus1ast> can you access clr variables via nim?
15:55:28FromDiscord<enthus1ast> then you could redirect it with .net and access this var
15:55:40FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=41XL
15:56:39FromDiscord<kevin> Hmm... I am not sure. I don't really have control of when `Console.WriteLine()` is called in the invoke'd dotnet assembly
15:59:05FromDiscord<vestel> So `sizeof` basically ignores `{.packed.}`
15:59:11FromDiscord<vestel> (edit) "`{.packed.}`" => "`{.packed.}`?"
16:01:48FromDiscord<kevin> or just preload each execution of a dotnet assembly with .net code that does the redirection for me 😂
16:02:00FromDiscord<kevin> terrible solution lol
16:02:13FromDiscord<kevin> there must be a way to do this in Nim
16:08:48FromDiscord<enthus1ast> a few hacky options\: have a wrapper application that starts the .net loader and captures its output; hook into the c procs and capture the output like this; write into a file, then later read it
16:14:48*hexeme is now known as ldlework
16:19:19FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=41XR
16:19:20FromDiscord<kevin> here is as close as I have so far
16:19:27FromDiscord<kevin> this redirects to a file and then restores it
16:19:43FromDiscord<kevin> I'd like to get to a point where I don't have a temp file I need to read from
16:21:56FromDiscord<kevin> https://nim-lang.org/docs/memfiles.html # might be useful but Nim doesn't like using `File` and `Memfile` interchangeably
16:26:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41XS
16:29:08*kenran quit (Quit: WeeChat info:version)
16:33:59FromDiscord<sOkam!> Is a C struct just an object in Nim?↔Is that true also for C++ classes?
16:34:12FromDiscord<enthus1ast> thats quite annoying...
16:34:13FromDiscord<enthus1ast> image.png https://media.discordapp.net/attachments/371759389889003532/995004896988373002/image.png
16:35:02FromDiscord<enthus1ast> the bridge i mean
16:35:05FromDiscord<enthus1ast> not you \:)
16:35:24FromDiscord<Phil> In reply to @enthus1ast "image.png": What you can't see is the post I replied to, possibly because it was either edited or contains \`\`\`↔Is the bridge commonly torpedoing on these types of posts?
16:35:58FromDiscord<enthus1ast> noticed this quite often lately
16:36:28FromDiscord<enthus1ast> argh wife bugs me to leave bbq
16:36:34FromDiscord<enthus1ast> for
16:36:39FromDiscord<enthus1ast> cee ya
16:36:51FromDiscord<Phil> bb
16:56:13NimEventerNew thread by EnteryName: When should i use JsonNode instead of tables, see https://forum.nim-lang.org/t/9294
17:09:21FromDiscord<Space Ghost> sent a long message, see http://ix.io/41Y8
17:09:24FromDiscord<Space Ghost> sent a long message, see https://paste.rs/G5x
17:12:14FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=41Y9
17:13:32FromDiscord<Space Ghost> sent a code paste, see https://play.nim-lang.org/#ix=41Ya
17:15:26*Goodbye_Vincent quit (Quit: Ping timeout (120 seconds))
17:18:18FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=41Yb
17:18:30FromDiscord<huantian> It might be helpful if you post the original problem statement as well↔One easy thing to optimize is that you can remove that final new line write outside of the loop, but not sure if that’s optimized already by the compiler
17:19:20FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=41Yb" => "https://play.nim-lang.org/#ix=41Yc"
17:22:20FromDiscord<huantian> You might wanna look at std/bitops for a xor that work on bytes
17:23:02*Goodbye_Vincent joined #nim
17:25:28FromDiscord<huantian> In reply to @sOkam! "Is this the correct": I think it’s because Vec3 is a generic
17:25:42FromDiscord<sOkam!> whats a generic?
17:29:28FromDiscord<sOkam!> oh, as in it needs to be a `Vec3f` or a `Vec3i`?
17:29:38FromDiscord<Space Ghost> sent a code paste, see https://play.nim-lang.org/#ix=41Yd
17:29:58FromDiscord<Space Ghost> Error: undeclared identifier: 'bitxor'
17:31:29FromDiscord<Space Ghost> But I still run into the problem of the bulk read and write of an array to file. I have to either insert commas by element or line breaks \n by element to store the xor data and then retrieve. Is there a Nim function that allows one to write and then read an array or sequence in bulk?
17:34:57FromDiscord<Space Ghost> In reply to @huantian "It might be helpful": I need to add the new line with each element (i) of the sequence build up so I can readLine back later into an array. Otherwise it just jams all the ints together into a huge single line in the text file with no delimitator.
17:37:24FromDiscord<Space Ghost> PS - macro bitxor[T: SomeInteger](x, y: T; z: varargs[T]): T↔This requires and integer and will not except chars
17:39:32FromDiscord<Space Ghost> PS - Sorry my blunder on the first error, forgot to add import std/bitops. It works now and provides the exact same result as xor. There is a long stackflow article on how bitxor and xor are different, but not germane to my topic.
17:44:00FromDiscord<huantian> I think if you want to read lines from a file the lines interator might be better <https://nim-lang.org/docs/io.html#lines.i%2CFile>↔for writing I'm not too sure, you could concatinate all the strings in memory but that might be slow too↔File streams might give you better performance but I don't know much in this area tbh
17:44:35FromDiscord<Generic> you're likely using a 64-bit processor, so you can xor 8 times the amount of data for free
17:45:59FromDiscord<Generic> though it likely doesn't make much of a difference when you're then converting them afterwards to decimal??
17:47:04FromDiscord<juba> Hi, I am trying to register for Nim forum, but I am not receiving confirmation email. I tried with two different .gmail emails. Also not in spam folder.
17:47:41FromDiscord<Generic> honestly these kinds of benchmarks are stupid, because what ends up making the big difference will be some tiny difference in how the standard library flushes data to files or something like this which in turn changes the result in some other stupid benchmark
17:48:16FromDiscord<juba> The reason I tried to register is to ask this question: does nim have something like Python's `next`? Specifically I want to get the next value from an iterator. How to do it without counters and if-statements?
17:48:53FromDiscord<Generic> In reply to @juba "The reason I tried": you need to use closure iterators for this
17:49:57FromDiscord<fwsgonzo> In reply to @Isofruit "Out of curiosity, which": JWT from https://github.com/yglukhov/nim-jwt↔I kinda figured it out though - I'm guessing that it's faster to use 256 because of hardware acceleration support
17:50:20FromDiscord<fwsgonzo> The ES256 verification takes 0.58ms while ES384 takes over 3ms
17:50:38FromDiscord<juba> In reply to @Generic "you need to use": OK, you've reached the limits of my knowledge, but I'll start studying, thanks!
17:51:43FromDiscord<Space Ghost> sent a long message, see http://ix.io/41Ye
17:53:48FromDiscord<Generic> In reply to @juba "OK, you've reached the": they don't work in all backends and tended to be buggy (which is now mostly solved), so they're not used that much. They might be what you're looking for, but there might also be some better way to do whatever you currently want to archieve
17:54:26FromDiscord<konsumlamm> In reply to @Space Ghost "Hi Generic, it is": in that case i'd recommend Nim, V simply isn't production readyyet (if it ever will be)
17:54:27FromDiscord<juba> well I want to skip the first line when using the `"my-file.txt".lines` iterator
17:54:52FromDiscord<juba> i dont want to put an if statement which will be evaluated million times because i have million lines
17:54:58FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=41Yf
17:57:02FromDiscord<Generic> In reply to @Space Ghost "Hi Generic, it is": well your code might not be intended to be a benchmark, but atleast your example code looks and behaves exactly like one of those and the same games can be played with it
17:58:05FromDiscord<Space Ghost> sent a long message, see http://ix.io/41Yh
17:59:22FromDiscord<dom96> In reply to @juba "Hi, I am trying": what's your profile nickname?
17:59:30*hc0re joined #nim
18:00:24FromDiscord<dom96> @Space Ghost you're compiling with -d:release right?
18:00:30FromDiscord<Space Ghost> In reply to @Generic "well your code might": I do not get it. I came here to ask for help about a function in Nim to optimize io of my arrays or sequences. I could care less which language I use. I program in assembler, Basic, Fortran, C, C++, Lazarus/FP, Ruby, Python, etc. I like Nim and V for many reasons related to native exe's on Windows x64 and their syntax and speed, plus they use C compilers at the end and I can use gdb+
18:02:57FromDiscord<juba> In reply to @dom96 "what's your profile nickname?": Burt_Harbinson
18:03:19FromDiscord<dom96> In reply to @juba "Burt_Harbinson": activated it for you
18:03:29FromDiscord<Space Ghost> In reply to @dom96 "<@867520740273029160> you're compiling with": Yes, -d:release. I can tell you that in 600 lines of code the only difference between the Nim and V source code is the extra for loop reads and writes in the two xor functions. I am able to use Nim's readAll and fmWrite everywere except when I need to save a sequence or array and then retrieve it. This is a CPU time consuming issue and If I write the V code that wa
18:03:46*dv^_^ joined #nim
18:06:29FromDiscord<Generic> can you show us your V code?
18:09:06FromDiscord<Generic> Nim's `write` seem to rely on fprintf which is a bit of a black box
18:09:48FromDiscord<Generic> though string formatting in C is usually not that fast
18:11:56FromDiscord<Generic> using Nim's stdlib functions to convert the number to a string and then writing that to file is probably faster
18:14:23FromDiscord<Generic> though I do have to ask, why you're converting to decimal in the first place?
18:16:36FromDiscord<Space Ghost> In reply to @Generic "using Nim's stdlib functions": In Nim I cannot xor bytes. I have a string of numbers and string of letters(text). I am using the one time pad vernam xor to encrypt. The numbers are quantum grade random. In V I can xor (using ^ symbol) with both as u8 bytes. I am going to upload both Nim and V code as you asked. Just cleaning it up to paste into Discord.
18:17:52FromDiscord<Space Ghost> The key is I must save the coded text as an array and then call it up later....somewhere else. So it saved as a formatted file with some type of delimiter.
18:17:54FromDiscord<Generic> byte = uint8 in Nim
18:17:58FromDiscord<Generic> and you can xor uint8
18:18:27FromDiscord<juba> In this example, wouldn't it be better to have `f: File` instead of `filename: File`? https://nim-lang.org/docs/io.html#lines.i%2CFile
18:19:49FromDiscord<Generic> yeah looks like it
18:22:38FromDiscord<Space Ghost> sent a long message, see http://ix.io/41Yo
18:23:05FromDiscord<Generic> well that explains everything
18:23:22FromDiscord<Generic> so in V, you're loading the entire data into memory first, then do the operation on it and then save it again to file?
18:27:11FromDiscord<Space Ghost> sent a long message, see http://ix.io/41Yp
18:29:17*derpydoo quit (Quit: derpydoo)
18:30:11FromDiscord<IDF> have you tried `writeBuffer`?
18:30:18FromDiscord<Generic> that's for binary data though
18:30:41FromDiscord<Generic> assuming you want it de-/serialized to text
18:31:09FromDiscord<Space Ghost> In reply to @Generic "that's for binary data": Thank you! Someone who is answering my question, :). I have not tried this. Can you briefly explain a little. I am about to upload both Nim and V code.
18:31:40FromDiscord<IDF> https://nim-lang.org/docs/io.html#writeBuffer%2CFile%2Cpointer%2CNatural
18:31:52FromDiscord<IDF> it should do what V's function does, dump data into a file
18:31:53FromDiscord<Space Ghost> In reply to @Generic "that's for binary data": That part is all good. I just need to save the coded text and read it in later.
18:32:27FromDiscord<Generic> if you're only dealing with chars the whole time, you can also just use the read/write overload which works on strings
18:32:31FromDiscord<Space Ghost> In reply to @IDF "it should do what": Can you point me how to declare a buffer.
18:32:34FromDiscord<Generic> https://nim-lang.org/docs/io.html#write%2CFile%2Cstring
18:36:48FromDiscord<IDF> In reply to @Space Ghost "Can you point me": https://nim-lang.org/docs/system.html#new%2Ctypedesc↔↔but in your case i think you can just do `addr data` or if it's a string `cstring(data)`
18:37:15FromDiscord<Generic> c strings are termined by a null byte though
18:37:36FromDiscord<IDF> yeah the compiler makes sure the string is transformated correctly
18:38:04FromDiscord<Generic> it cannot correct though if you put in a 0 byte earlier than the length
18:38:32FromDiscord<Generic> which in this application can happen when the key and the one of the bytes to be encrypted match up at some point
18:39:08FromDiscord<Space Ghost> sent a long message, see http://ix.io/41Ys
18:39:14FromDiscord<IDF> In reply to @Generic "which in this application": fair
18:39:39FromDiscord<Space Ghost> (edit) "long message," => "code paste," | "http://ix.io/41Ys" => "https://play.nim-lang.org/#ix=41Yt"
18:40:05FromDiscord<Space Ghost> (edit) "https://play.nim-lang.org/#ix=41Yt" => "https://play.nim-lang.org/#ix=41Yu"
18:40:26FromDiscord<Space Ghost> (edit) "https://play.nim-lang.org/#ix=41Yu" => "https://play.nim-lang.org/#ix=41Yv"
18:40:54FromDiscord<IDF> https://github.com/vlang/v/blob/819b6f475a270e29da752199b236d91d6c5d0db7/vlib/os/os.c.v#L1018↔looked the function up and it seems to be equivalent to io.writeBuffer
18:41:21FromDiscord<Generic> yeah so you're indeed writing binary and not text data in the V version
18:41:44FromDiscord<Generic> so the Nim code does significantly more work, because it converts the integers to text first
18:42:13FromDiscord<Generic> (edit) removed "first"
18:42:37FromDiscord<Space Ghost> In reply to @Generic "yeah so you're indeed": Not sure I understand how to get it in binary in Nim...
18:43:28FromDiscord<Generic> just convert the char to uint8
18:43:40FromDiscord<Generic> do the xoring and then convert it back
18:44:25FromDiscord<Generic> or better, while possible always extract 8 bytes as a uint64 and do the xoring with that
18:45:00FromDiscord<Generic> though with code like this, chances are high that even auto vectorisation can take care of this
18:45:50FromDiscord<IDF> yeah I forgot `write` has generics for other stuff than string
18:45:58FromDiscord<IDF> so converting to uint8 might just do it
18:47:19FromDiscord<Space Ghost> Can I just enclose the xor output in char() and save to a string and then write the string. When I read it back into a string then just index each element in the string and xor back?
18:48:14FromDiscord<Generic> yes
18:48:29FromDiscord<IDF> yea should work
18:48:43FromDiscord<Space Ghost> trying now
18:51:12*pro joined #nim
18:51:19FromDiscord<Space Ghost> sent a long message, see http://ix.io/41Yx
18:51:54FromDiscord<Space Ghost> sent a code paste, see https://play.nim-lang.org/#ix=41Yy
18:52:17FromDiscord<Generic> codedInts2.setLen length
18:52:25FromDiscord<Generic> before the for loop
18:53:09FromDiscord<Space Ghost> sent a code paste, see https://play.nim-lang.org/#ix=41Yz
18:53:26FromDiscord<Space Ghost> The length is set as a constant up top
18:53:45FromDiscord<IDF> yea but the string needs to have memory allocated
18:54:22FromDiscord<Space Ghost> sent a code paste, see https://play.nim-lang.org/#ix=41YB
18:54:39FromDiscord<IDF> sent a code paste, see https://play.nim-lang.org/#ix=41YC
18:54:42FromDiscord<Space Ghost> I set codedInts2 as a mutable var up top and intialized with " "
18:54:59FromDiscord<IDF> In reply to @Space Ghost "I set codedInts2 as": yes that results in a string with only one character allocated
18:55:01FromDiscord<IDF> therefore your error
18:55:48FromDiscord<Generic> if you know the size in before hand it's still smarter to not use add
18:55:58FromDiscord<IDF> right
18:56:03FromDiscord<IDF> then just `newString(length)`
18:56:08FromDiscord<IDF> and keep the rest
18:56:16FromDiscord<Generic> yeah
18:58:19FromDiscord<Space Ghost> good God it worked. Now I need to reverse the code going backward. I am going to try it but might need a hand if I get errors. Thanks so much to you both.
19:04:38FromDiscord<Space Ghost> In reply to @IDF "then just `newString(length)`": should I read or readAll back into a string?
19:05:32FromDiscord<IDF> readAll if you want a string
19:10:26FromDiscord<Mike> Okay, sorry to be begging for help again, but I have an asynchttpserver that's leaking memory and eventually crashing, and I can't figure out why
19:10:44FromDiscord<Mike> sent a code paste, see https://play.nim-lang.org/#ix=41YI
19:11:35FromDiscord<Mike> Basically just a client sending a request, and the server responding with a big, memory-eating string.
19:12:03FromDiscord<Mike> sent a code paste, see https://play.nim-lang.org/#ix=41YJ
19:12:06*pro quit (Quit: pro)
19:12:30FromDiscord<Mike> sent a code paste, see https://play.nim-lang.org/#ix=41YK
19:13:30FromDiscord<Mike> Am I missing something dumb here? Why does the memory inflate, and why does it sometimes inflate with refc, but not always??
19:18:11FromDiscord<IDF> try with `-d:release`
19:20:10FromDiscord<IDF> also try closing the clients after you get the content
19:20:36FromDiscord<Mike> `-d:release` didn't change anything. I'll try closing clients
19:21:51FromDiscord<Mike> Nope, no change there either. Still grows every time
19:33:05FromDiscord<HuskyHacks> sent a code paste, see https://play.nim-lang.org/#ix=41YO
19:33:10FromDiscord<soundmodel> the more I've read the less any other language than Nim interests me
19:33:11FromDiscord<soundmodel> odd?
19:33:20FromDiscord<!Patitotective> In reply to @soundmodel "the more I've read": yes
19:33:50FromDiscord<soundmodel> no I'm serious, it seems like nothing else seems as versatile
19:35:13FromDiscord<!Patitotective> yes I'm serious, nim is really cool
19:35:28FromDiscord<soundmodel> I think objective-C comes closest, but not in platforms
19:36:28FromDiscord<soundmodel> (edit) "objective-C" => "objective-C/Swift"
19:42:11FromDiscord<Space Ghost> sent a long message, see http://ix.io/41YQ
19:46:10FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=41YS
19:48:35FromDiscord<Generic> if you define a type alias like this, it'll implicitly convert and you can just use it like the aliased type
19:49:17FromDiscord<Generic> https://play.nim-lang.org/#ix=41YU
19:51:37FromDiscord<sOkam!> nice, tysm!
20:10:40NimEventerNew thread by Cnerd: Compile time imports, see https://forum.nim-lang.org/t/9295
20:11:50*hc0re quit (Ping timeout: 240 seconds)
20:13:51*hc0re joined #nim
20:21:46*jmdaemon quit (Ping timeout: 244 seconds)
20:28:39FromDiscord<dom96> In reply to @Mike "Am I missing something": Good question. I'm curious too, it seems like a GC bug. Probably best to ask Araq (in #internals, forum or Github issues)
20:29:57FromDiscord<dom96> sent a code paste, see https://play.nim-lang.org/#ix=41YZ
20:31:10FromDiscord<geekrelief> In reply to @HuskyHacks "I'd appreciate a sanity": You might want to check your dll with Dependencies https://github.com/lucasg/Dependencies to see what it's actually loading.
20:32:00FromDiscord<dom96> sent a code paste, see https://play.nim-lang.org/#ix=41Z1
20:32:37FromDiscord<dom96> so maybe this is an edge case that no GC can prevent mem leaks on
20:38:43FromDiscord<Mike> Thanks for the `-d:nimTypeNames` trick; that's actually really useful for debugging. Although as you said it's really just `string` in this case.↔(@dom96)
20:39:36FromDiscord<Mike> I've been playing around with it, and if I switch to `refc` rather than `orc` the heap grows, but eventually stabilizes. Whereas with `orc` it just keeps growing indefinitely and eventually my little $4 droplet server dies
20:40:36*noeontheend joined #nim
20:42:57FromDiscord<Mike> I've also been playing around with `--expandArc:cb`, but understanding what's actually happening is a bit beyond me
21:08:30*noeontheend quit (Ping timeout: 240 seconds)
21:27:05FromDiscord<Elegantbeef> mattrb#0001 so threads is all it was and i can now make nit picky PRs? \:D
21:27:19FromDiscord<Elegantbeef> Uh oh this client doesnt like pinging
21:31:40FromDiscord<byteface> sent a code paste, see https://play.nim-lang.org/#ix=41Zf
21:31:54FromDiscord<Elegantbeef> varargs are already an array or sequence
21:32:17*arkanoid quit (Ping timeout: 256 seconds)
21:32:27FromDiscord<Elegantbeef> Or... not
21:32:49*arkanoid joined #nim
21:32:50FromDiscord<Elegantbeef> There you go
21:32:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41Zg
21:33:05FromDiscord<byteface> toSeq? there's a util?
21:33:31FromDiscord<Elegantbeef> Yes it takes anything iterable and makes a sequence
21:33:48FromDiscord<byteface> so what is system.@ ?
21:34:02FromDiscord<Elegantbeef> `@` works on arrays
21:34:09FromDiscord<byteface> ah
21:34:21FromDiscord<byteface> i think i can't use that as its fixed length
21:35:05FromDiscord<Elegantbeef> What?
21:35:20FromDiscord<byteface> the array. i think i need seq
21:35:26FromDiscord<Elegantbeef> `@` is for converting arrays to sequences, `toSeq` works on anything iterable
21:35:37FromDiscord<Elegantbeef> did you not read my code?
21:35:44FromDiscord<byteface> ah ok
21:36:34FromDiscord<byteface> weird. toSeq makes a sequence of varargs?. is that right?
21:36:47FromDiscord<Elegantbeef> No
21:36:56FromDiscord<Elegantbeef> `toSeq` takes anything iterable and makes a sequence of it
21:37:01FromDiscord<Elegantbeef> Run the code i gave you
21:37:13FromDiscord<byteface> type mismatch: got <seq[type varargs]>
21:37:17FromDiscord<byteface> ?
21:37:45FromDiscord<Elegantbeef> No
21:37:45FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=41Zh
21:38:42FromDiscord<byteface> maybe i'll start fro teh top as my varargs are wrong
21:39:16FromDiscord<byteface> lets say i have 10 fruits. all classes. and i want to pass any number of them to a proc#
21:39:48FromDiscord<byteface> now i had done something like this
21:39:58FromDiscord<byteface> sent a code paste, see https://play.nim-lang.org/#ix=
21:40:12FromDiscord<byteface> which worked but i didn't like as it converts the fruits into strings
21:40:26FromDiscord<byteface> but untyped and any wasn't working as the vararg
21:40:39FromDiscord<Elegantbeef> Can you just provide code?
21:40:46FromDiscord<Elegantbeef> I dont feel like playing a guessing game
21:41:10FromDiscord<byteface> well that is it . im trying to reduce the problem
21:41:51FromDiscord<byteface> like is that the correct way to pass a list of mixed classes to a proc?
21:42:00FromDiscord<byteface> in the first place?
21:42:32FromDiscord<Elegantbeef> What's a class
21:42:48FromDiscord<Elegantbeef> Nim doesnt have classes so the answer lies in what are you trying to do
21:42:50FromDiscord<byteface> i guess a 'type'
21:43:14FromDiscord<Elegantbeef> Are we talking about ints and floats or subclasses
21:43:34FromDiscord<byteface> custom types called Apple , Banana, Pear, Orange
21:43:56FromDiscord<Elegantbeef> Ok so we can use object variants or oop
21:44:07FromDiscord<byteface> i wanna go basket( Apple(), Banana(), Pear() )
21:44:12FromDiscord<byteface> and have teh basket tell me what i got
21:44:51FromDiscord<byteface> so i read about varargs but that wants a certain type
21:45:06FromDiscord<byteface> when i try any or untyped it don't work. unless i do that trick that makes them a string.
21:45:27FromDiscord<byteface> then they do come through but are strings. and as you saw calling toSeq doesn't unpack it
21:46:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41Zi
21:47:08FromDiscord<Elegantbeef> Like i said you need to use either oop or object variants
21:47:14FromDiscord<Elegantbeef> The above is the variant type
21:50:35FromDiscord<byteface> urg. so you stick references implementations in bases?
21:51:04FromDiscord<byteface> i hate seeing baseclasses that reference children in oop. like if my child is type x. shudders
21:51:20FromDiscord<byteface> how would a fruit know a banana existed?
21:53:43FromDiscord<Elegantbeef> That's the oop method
21:53:47FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41Zk
21:54:05FromDiscord<Elegantbeef> It doesnt
21:54:15FromDiscord<Elegantbeef> It doesnt need to
21:54:25FromDiscord<Elegantbeef> Nim has dynamic dispatch if you really need it
21:54:41FromDiscord<byteface> ye i don't really understand what that means
21:54:50FromDiscord<Elegantbeef> methods
21:54:51FromDiscord<byteface> its like telling me its got a dangle berry
21:56:20FromDiscord<Elegantbeef> You can use methods and override them like in OOP languages
21:56:57FromDiscord<byteface> well your 2nd example is closer to what i have
21:57:03FromDiscord<byteface> but im not getting the results you are
21:57:52FromDiscord<huantian> what's a dangle berry
21:58:02FromDiscord<byteface> ah i just realised 1 thing.
21:58:03FromDiscord<huantian> is it like a dangling pointer but for fruits?
21:58:41FromDiscord<byteface> your varargs says varargs[Fruits]
21:58:43FromDiscord<huantian> so when you have a dangling pointer to a berry is it a dangle berry
21:58:51FromDiscord<byteface> but what if sometimes its just a string saying 'No'
21:59:05FromDiscord<byteface> so basket(Apple(), 'No' , Pear())
21:59:09FromDiscord<Elegantbeef> Nim isnt dynamically typed so dont write code like that
21:59:10FromDiscord<huantian> then static typing doesn't exist and we go use javascript
21:59:17FromDiscord<byteface> so i need varargs[untyped] but that's not working
21:59:58FromDiscord<byteface> so varargs can only have things of a given type ?
22:01:27FromDiscord<Elegantbeef> Nim is static typed yes
22:02:36FromDiscord<byteface> can i add string to my Fruits
22:13:50FromDiscord<byteface> maybe a vararg for strings and one for fruits. for me varargs is not converting its wrapping also. just strange
22:14:23*xet7 joined #nim
22:14:32FromDiscord<Elegantbeef> Nim is statically typed so varargs are just a fancy wrapping over `openArray[T]` and a automatic conversion call
22:14:43FromDiscord<Elegantbeef> This is not python so dont expect it to be like python
22:36:39FromDiscord<vindaar> just to clarify this for people who may be unaware\: `varargs[untyped]` in principle is not a direct wrapper of a specific `openArray[T]`. As long as you're able & willing to deal with an arbitrary `nnkBracket` of heterogeneous types at compile time, it can accept any combination of types. This doesn't really have any applications for things like heterogeneous containers though!
22:37:07FromDiscord<Elegantbeef> I mean untyped is only valid in templates/macros so if you're using it you best know what it does \:D
22:37:46FromDiscord<Elegantbeef> If you think `untyped` makes typeless parameters you really need to read the manual
22:38:12FromDiscord<vindaar> indeed, but maybe someone could be confused by your wording! 😅
22:38:19FromDiscord<Elegantbeef> Perhaps
22:38:34FromDiscord<Elegantbeef> I'm not known for having the best words, i'm not orange enough for that
22:46:18FromDiscord<huantian> @ripluke this is a jank thing that I wrote that might help a bit idk https://play.nim-lang.org/#ix=41ZE
22:47:59FromDiscord<byteface> sent a code paste, see https://play.nim-lang.org/#ix=41ZF
22:49:40FromDiscord<byteface> ye i only been doing it a day. so obviosly will have questions.
22:51:48FromDiscord<vindaar> the syntax for this is\:↔you want a variable number of arguments of type `string`. In order to turn these different typed arguments into `string`, use the `$` proc that should be defined for all input types you will hand↔(@byteface)
22:53:23FromDiscord<byteface> no its the opposite. i have a variable number of args. some are fruit. one might be a string. that one needs to be converted to a Fruit type called NoFruit i think is where we are getting to
22:53:40FromDiscord<huantian> I still would recommend against string typing your stuff, is there a reason it can't just take a NoFruit to begin with?
22:53:44FromDiscord<byteface> varargs[Fruit, myProc]
22:54:04FromDiscord<byteface> ye i considered that
22:54:10FromDiscord<byteface> but its just extra
22:54:10FromDiscord<huantian> ie `doStuff(Apple(), Pear(), NoFruit(), Orange())`
22:54:30FromDiscord<huantian> well I'd say using your conversion proc is more extra
22:54:40FromDiscord<huantian> and introuduces extra runtime points of failure
22:54:47FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=41ZI
22:56:19FromDiscord<bariali07> Tomorrow is Eid al-Adha for Muslims
22:57:45FromDiscord<vindaar> I don't understand what you really want to do. From what you write, just define `fruiter` for `string` and define how the string -\@byteface)
22:57:58FromDiscord<Space Ghost> When compiling nim how can you specify the c compiler to use, for example what if you want to compile with clang vs. gcc
22:58:58FromDiscord<byteface> In reply to @vindaar "I don't understand what": how would your example handle this?... foo(Apple(), Apple(), Banana(), Fruit(), 'NoFruit')
22:59:19FromDiscord<byteface> i tried it and get Error: type mismatch: got <string>
23:00:04FromDiscord<Elegantbeef> `--cc:clang`↔(@Space Ghost)
23:01:59FromDiscord<Elegantbeef> Byteface it'd really help if you provided what you were doing
23:02:11FromDiscord<Elegantbeef> "Taking in a string" isnt really pointful
23:02:25FromDiscord<Elegantbeef> Casuse you can just have `NotFruit` like huan said
23:02:52FromDiscord<Space Ghost> In reply to @Elegantbeef "`--cc:clang` (<@867520740273029160>)": Thank you Elegantbeef worked beautifully. What is the default C backend, is it gcc or clang?
23:03:01FromDiscord<Space Ghost> PS on windows 11 x64 OS
23:03:16FromDiscord<Elegantbeef> Mingw should be default on windows
23:03:20FromDiscord<vindaar> the question isn't much what to do with a string (you'd just add a `proc fruiter(x: string): Fruit = discard # whatever you want to do` proc), but this is probably not what you really want↔(@byteface)
23:04:35FromDiscord<byteface> sent a code paste, see https://play.nim-lang.org/#ix=41ZN
23:04:55FromDiscord<Elegantbeef> `when x is string`
23:05:16FromDiscord<Elegantbeef> Those are compile time checks and need to use `when`
23:05:41FromDiscord<byteface> so somehow i can then wrap it in teh NoFruit type im hoping
23:07:10FromDiscord<Space Ghost> In reply to @Elegantbeef "Mingw should be default": Yes, I see that my c:\nim folder has mingw64 subfolder and in the sub-sub bin folder it has g++.exe and gcc.exe and x86_64-w64-mingw32-gcc.exe; but I do not see clang installed. Is it somewhere in the nim folder
23:08:21FromDiscord<Space Ghost> PS without the -cc:clang switch my exe is 214KB and with it is 194KB so the clang is slightly smaller than the default. I have tested the algorithm with a different platform using tcc, gcc, and clang and clang was fastest.
23:08:32FromDiscord<vindaar> also this `fruiter` here only accepts a `Node`. So the type name can never be anything aside from `Node`↔(@byteface)
23:10:00FromDiscord<Elegantbeef> You have to install other compilers yourself
23:13:14FromDiscord<byteface> In reply to @vindaar "also this `fruiter` here": it doesn't matter anyways as it doesn't get that far if its a string
23:14:54FromDiscord<huantian> In reply to @Elegantbeef "`when x is string`": No beef you can’t just help someone string type their code!
23:15:00FromDiscord<byteface> but then i don't get why it suggests it can or that it works for $
23:15:21FromDiscord<Elegantbeef> You really need to give a proper example of what you're trying to do
23:15:28FromDiscord<Elegantbeef> Why do you need to be able to provide a string
23:15:51*bigbyt quit (Read error: Connection reset by peer)
23:17:35*bigbyt joined #nim
23:18:09FromDiscord<Space Ghost> In reply to @Elegantbeef "`--cc:clang` (<@867520740273029160>)": Here is a nice post with exactly what you stated and some additionally nice information on compiling and debuging nim. thanks again.↔https://hookrace.net/blog/what-makes-nim-practical/
23:18:20FromDiscord<byteface> it just looks like nim doesn't support passing mixed lists around. and there's no way to add string to the fruit types
23:22:45FromDiscord<huantian> You can get the same mixed list functionality with OOP or object variants
23:25:23FromDiscord<Elegantbeef> There is also the `union` library which makes object variants easier
23:25:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41ZV
23:25:59FromDiscord<Elegantbeef> But like why would you want to
23:26:09FromDiscord<byteface> sent a code paste, see https://play.nim-lang.org/#ix=41ZW
23:26:30FromDiscord<byteface> like this didn't work. which is wierd. as then why does it exist?. only for subtypes?
23:26:41FromDiscord<Elegantbeef> Againt `[T: Fruit]` is forcing it be `Fruit`
23:26:58FromDiscord<byteface> im fine with that
23:27:05FromDiscord<Elegantbeef> `x: auto` or `[T](x: T)` will work
23:27:06FromDiscord<byteface> but it string errors
23:27:21FromDiscord<byteface> i thought the point of myProc was i could catch the string and return it wrapped
23:27:24FromDiscord<byteface> but that's not the case
23:27:34FromDiscord<Elegantbeef> If you write the code properly it is
23:28:05FromDiscord<aru-hackZ> So you want to, from a string, return a Fruit holding it
23:28:11FromDiscord<byteface> ye
23:28:16FromDiscord<byteface> a fruit called NotFruit
23:29:18FromDiscord<aru-hackZ> sent a code paste, see https://play.nim-lang.org/#ix=41ZX
23:29:44FromDiscord<aru-hackZ> (edit) "https://play.nim-lang.org/#ix=41ZX" => "https://play.nim-lang.org/#ix=41ZY"
23:29:49FromDiscord<byteface> an overload?
23:29:52FromDiscord<byteface> does that work
23:29:56FromDiscord<aru-hackZ> Yh
23:30:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41ZZ
23:30:58FromDiscord<Elegantbeef> The question is still why would you want this
23:31:02FromDiscord<aru-hackZ> With that overload you can just `let myFruit = fruiter("orange")`
23:31:30FromDiscord<byteface> gimme 5 ill check this. sounds promising. thanks for examples all
23:31:35FromDiscord<aru-hackZ> In reply to @Elegantbeef "The question is still": For the time i've been reading, what he wants to do keeps changing lol
23:31:41FromDiscord<Elegantbeef> Why do you need a string with your fruit and why can you not just represent that with a `nonFruit("hello")`
23:32:03FromDiscord<Elegantbeef> Exactly they havent explicitly stated their goal once and it makes it harder to help them↔(@aru-hackZ)
23:33:14FromDiscord<aru-hackZ> Tho I still dont know why and what he wants to do
23:33:19FromDiscord<Elegantbeef> We're talking about fruits and string, instead of the actual idea
23:34:17FromDiscord<byteface> sorry. lol. i've learned a lot. from what discard means to various other things. i did say it was my first day learning nim and i'd have lots of qs
23:34:56FromDiscord<enthus1ast> i often feel the same when beef talks to me↔(@byteface)
23:35:14FromDiscord<Elegantbeef> Well shit i guess i need to use smaller words
23:35:17FromDiscord<aru-hackZ> `discard` is like a "i dont care what this code returns, just execute it"
23:35:37FromDiscord<Elegantbeef> Well acktually
23:35:41FromDiscord<aru-hackZ> (edit) "it"" => "it", or smth like that iirc"
23:35:59FromDiscord<aru-hackZ> (edit) "`discard` is like a "i dont care what this code returns, just execute it", or smth like that iirc ... " added "(im a newbie too)"
23:36:11FromDiscord<Elegantbeef> `discard` is just a statement that is a no op or can discard a value you dont care about
23:36:24FromDiscord<Elegantbeef> In nim you cannot have unhandled values
23:36:28FromDiscord<aru-hackZ> I wanst that woeng thrn
23:36:42FromDiscord<Elegantbeef> you have to do `discard `10\`
23:36:43FromDiscord<aru-hackZ> Thats what I meant, but im.bad expressing myself
23:36:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4205
23:36:56FromDiscord<Elegantbeef> Hey i'm just saying!
23:37:21FromDiscord<Elegantbeef> In the case you dont have a right hand of discard it's just a no op that gives the parser something to chew on
23:37:37FromDiscord<aru-hackZ> Got it
23:38:00FromDiscord<Elegantbeef> You can actually use doc comments or anything else that is valid AST
23:38:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4206
23:38:34FromDiscord<aru-hackZ> hmm
23:38:47FromDiscord<tylerlinuxdev> Probably handy for WIP stuff where you want to partially test your implementation that you've made so far and so you don't want to delete the values you are handling, so you just discard it from this one particular instance of compilation.
23:39:11FromDiscord<Elegantbeef> Well `discard` still runs the right hand
23:39:21FromDiscord<Elegantbeef> it just throws away the value inside it
23:39:29FromDiscord<Elegantbeef> Cause nim requires you to handle all values
23:40:18FromDiscord<aru-hackZ> Like when you use a proc which retruns a bool, but you just care for the side effects and not the return value, so you use discard
23:40:31FromDiscord<Elegantbeef> correct
23:40:39FromDiscord<Elegantbeef> Dont know if you were asking or telling but i'll say correct
23:41:03FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4207
23:41:15FromDiscord<Elegantbeef> I fucking knew someone would mention it
23:41:31FromDiscord<enthus1ast> let me be that
23:41:32FromDiscord<Elegantbeef> I'm going to get my axe i'll be at your house in a couple days enthus
23:41:34FromDiscord<huantian> Time to mark all my `func`s discardable 😈
23:42:03FromDiscord<aru-hackZ> In reply to @Elegantbeef "Dont know if you": Asking if i was right
23:42:56FromDiscord<enthus1ast> but an explicit `discard` is good, since it avoids bugs
23:43:49FromDiscord<aru-hackZ> And you explicitly know what's going on, instead of having to know if the proc has the discardable pragma, right?
23:43:58FromDiscord<Elegantbeef> I hope you lose your ssh keys and can never commit again↔(@huantian)
23:44:06FromDiscord<Elegantbeef> Correct again↔(@aru-hackZ)
23:44:16FromDiscord<tylerlinuxdev> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: That a bit extreme, lol
23:44:33FromDiscord<Elegantbeef> `discard` is a great feature in a language that has "all statements as expressions"
23:44:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4208
23:46:23FromDiscord<Elegantbeef> It does discard the value, but it's likely one of the two calls is the mistake
23:49:32FromDiscord<Elegantbeef> is a mistake\
23:50:25FromDiscord<Elegantbeef> enthus1ast (@sn0re\:matrix.code0.xyz)so turns out if you shit talk someone enough they follow you?
23:50:27FromDiscord<Elegantbeef> Ok so fuck cinny's mentioning
23:50:34FromDiscord<Elegantbeef> good client otherwise
23:50:43FromDiscord<enthus1ast> want to see if you still work on nimscripter
23:50:56FromDiscord<Elegantbeef> Havent touched it in forefer
23:50:58FromDiscord<Elegantbeef> forever
23:51:07FromDiscord<Elegantbeef> If people make issues i fix them or address them
23:52:15FromDiscord<enthus1ast> still want to do the nimja dynamic thing, but the type conversion hinders me a bit (and the rest, eg working, wife, etc)
23:52:38FromDiscord<enthus1ast> ah forgot drinking
23:53:09FromDiscord<Elegantbeef> Yea i'm very much on board with WASM now, it offers nicer ideas for user facing programs
23:53:30FromDiscord<Elegantbeef> If it's not userfacing then i think nimscript is fine, but like why force people to use nim when they can use any language they want
23:58:21FromDiscord<ripluke> In reply to @huantian "<@704106773660827690> this is a": Ok thanks