<< 04-12-2022 >>

00:13:59*xet7 quit (Ping timeout: 264 seconds)
00:24:01FromDiscord<voidwalker> UHm having a bit of trouble figuring out binarylang. I basically have to put into a stream a struct with values I already assigned. All the examples show loading the struct again from a source, and then writing that variable again to a stream.
00:24:13FromDiscord<voidwalker> (edit) "again" => ""
00:25:07FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hDC
00:30:42FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hDD
00:38:46*ltriant joined #nim
00:41:18FromDiscord<Just Jasmine, Please> Hey, I have a steam deck, and wanted to get to coding on it as a little laptop. I begged my boyfriend for the mastering nim book, but now whenever I try to launch nim it gets cleared from the path. Not that big of an issue because I know where the binary is. What's the bigger issue is that every time I try to run said binary, I get this error https://media.discordapp.net/attachments/371759389889003532/1048760864712429568/mess
00:41:28*jmdaemon joined #nim
00:48:04FromDiscord<tandy> looks like ur missing some dev libs↵(@Just Jasmine, Please)
00:49:56FromDiscord<yrashk> sent a long message, see http://ix.io/4hDH
00:50:24*ltriant quit (Ping timeout: 260 seconds)
00:50:26FromDiscord<Elegantbeef> A copy is required in orc/arc when a move cannot be done
00:50:34FromDiscord<Just Jasmine, Please> In reply to @tandy "looks like ur missing": Thanks! How do I go about getting them?
00:51:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hDI
00:52:28FromDiscord<Just Jasmine, Please> In reply to @tandy "looks like ur missing": I know that I to remove the read only filesystem, but what libraries do I need
01:07:12FromDiscord<EOF> Hello, I wonder is there an array chunking/batch function in NIM ?
01:08:18FromDiscord<Elegantbeef> What's array chunking
01:11:32FromDiscord<EOF> chunks of 2: [1, 2, 3, 4, 5, 6, 7] => [[1, 2], [3, 4], [5, 6], [7]]
01:13:30FromDiscord<EOF> something like in python https://docs.python.org/3.12/library/itertools.html?highlight=batched#itertools.batched
01:18:29*xet7 joined #nim
01:28:43*ltriant joined #nim
01:31:22FromDiscord<Elegantbeef> https://github.com/narimiran/itertools has chunked
01:33:52*ltriant quit (Ping timeout: 268 seconds)
01:34:52FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hDQ
01:35:08FromDiscord<voidwalker> quite the elegant fix to my binary crap de/serialization problem
01:36:58FromDiscord<voidwalker> Only thing that bugs me, is it possible to instantiate an object `UdpTrackerPing` with its default values, without needing to mention them again ?
01:37:36FromDiscord<Elegantbeef> `UdpTrackerPing()`
01:37:50FromDiscord<Elegantbeef> Well that defaults them to 0
01:37:56FromDiscord<Elegantbeef> the way you'd do it for your case is make a constructor
01:41:04FromDiscord<voidwalker> sounds complicated. and something that the lib should have. but it's more than a year since sealmove commited on it..
01:41:26FromDiscord<Elegantbeef> I mean it's a proc
01:41:32FromDiscord<voidwalker> it seems that all the nim libs are v 0 dot something, kind of not makes sense for nim to be v2 soon
01:41:53FromDiscord<Elegantbeef> `proc init(_: typedesc UdpTrackerPing, ...): UdpTrackerPing = UdpTrackerPing(...)`
01:42:23FromDiscord<Elegantbeef> "Project doesnt automatically make my code shorter 0/10"
01:42:41FromDiscord<Elegantbeef> It makes sense for Nim to be v2 soon given it's doing changes that are not backwards compatible
01:42:48FromDiscord<Elegantbeef> The very definition of semver states that's a major version
01:42:51FromDiscord<voidwalker> should have been v0.2 : P
01:43:02FromDiscord<Elegantbeef> No cause that's not how semver works
01:43:11FromDiscord<Elegantbeef> 0.0.2 is a patch version
01:43:16FromDiscord<albassort> alright beef
01:43:21FromDiscord<albassort> this is a question for you
01:43:29FromDiscord<Elegantbeef> Jeez
01:44:12FromDiscord<voidwalker> wish discord had a tip jar, didn't you beef ? : D
01:44:15FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hDT
01:44:21FromDiscord<voidwalker> (edit) "didn't" => "don't"
01:44:28FromDiscord<albassort> but, in my own bindings, I have the same thing, as a cstring (because im not fancy)
01:44:32FromDiscord<Elegantbeef> Meh i could setup a github sponsor or something
01:44:49FromDiscord<albassort> Is there anyway I can cast my cstring to their object
01:44:52FromDiscord<voidwalker> "if I had a pennty for every nim answer.."
01:44:55FromDiscord<Elegantbeef> Seems like a lot of work to siphon money from people and to complicate taxes
01:44:57FromDiscord<voidwalker> (edit) "pennty" => "penny"
01:45:11FromDiscord<albassort> in practicality, they are the same thing, pointers to memoryt
01:45:12FromDiscord<albassort> (edit) "memoryt" => "memory"
01:45:13FromDiscord<Elegantbeef> `cast[TheirType](myCstring)`
01:45:21FromDiscord<Elegantbeef> Why you're using cstring is confounding
01:45:51FromDiscord<albassort> ye
01:45:52FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hDU
01:45:52FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/GV4
01:46:14FromDiscord<Elegantbeef> Then again i still dont get why you're making your own bindings
01:46:19FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4hDU" => "https://play.nim-lang.org/#ix=4hDV"
01:46:26FromDiscord<albassort> its specific binding to code i wrote in C
01:46:35FromDiscord<albassort> and idk if i want to port it to C
01:46:42FromDiscord<albassort> (edit) "C" => "Nim"
01:46:51FromDiscord<Elegantbeef> Fairly certain they're just opaque pointers
01:46:59FromDiscord<Elegantbeef> So it should be fine mostly
01:47:01FromDiscord<albassort> well lets see!
01:47:04FromDiscord<Elegantbeef> Unless strict aliasing steps in
01:47:26FromDiscord<Elegantbeef> Though given this is across ABI it's probably fine
01:49:12FromDiscord<albassort> yep
01:49:14FromDiscord<albassort> works ifne
01:49:16FromDiscord<albassort> (edit) "ifne" => "fine"
01:49:19FromDiscord<albassort> the day is good
01:49:52FromDiscord<albassort> may just port this code
01:53:20*ltriant joined #nim
01:53:21FromDiscord<voidwalker> hm your mention of taxes got me thinking beef. I for one am determined to never pay taxes ever again, not a dime. Of course, the ones that you voluntarily submit, the others are harder to avoid. But what if you could have a service to buy someone beer or pizza, without having their personal details Surely those are not subject to tax
01:53:37FromDiscord<albassort> oh god
01:53:40FromDiscord<albassort> i gotta pay taxes this year
01:53:44FromDiscord<Elegantbeef> I'm not a libertarian so....
01:53:49FromDiscord<Elegantbeef> Yes they're subject to taxes
01:54:01FromDiscord<voidwalker> but who would know how many beers you had lol
01:54:16FromDiscord<Elegantbeef> You do realise taxes are supposed to be self reporting in that case?
01:54:21FromDiscord<albassort> In reply to @voidwalker "hm your mention of": unless you're rich taxes are unavoidable im sorry
01:54:37FromDiscord<Elegantbeef> I dont know why you're sorry, i rather like healthcare and roads
01:54:57FromDiscord<voidwalker> I already pay for roads, and healthcare is out of my own pocket..
01:54:58FromDiscord<albassort> I'm sorry for the classifier "unless"
01:55:15FromDiscord<albassort> actually
01:55:25FromDiscord<Elegantbeef> Well move to a country that resides in the 21st century
01:55:26FromDiscord<albassort> taxes are not unavoidable, just make less then the minimum amount
01:55:30FromDiscord<amadan> In reply to @Just Jasmine, Please "I know that I": From this post https://www.reddit.com/r/SteamDeck/comments/t92ozw/for_compiling_c_code/↵It seems reinstalling `glibc` and `linux-api-headers` fixes the missing files
01:55:43FromDiscord<Elegantbeef> Not all countries have minimal amounts
01:55:49FromDiscord<albassort> in the us
01:55:50FromDiscord<albassort> The minimum income amount depends on your filing status and age. In 2021, for example, the minimum for single filing status if under age 65 is $12,550.
01:55:54FromDiscord<Elegantbeef> All income is taxable in Canada
01:56:01FromDiscord<albassort> I haven't payed taxes yet
01:56:07FromDiscord<albassort> because I've never made more than 12k
02:09:01*ltriant quit (Ping timeout: 268 seconds)
02:14:36FromDiscord<Gumbercules> something something taxes and death
02:23:07FromDiscord<voidwalker> @ElegantBeef not sure what use the constructor proc you mentioned.. I still can't access the internal data of those object fields. They are used to match values, not set values
02:23:26FromDiscord<Elegantbeef> Yea i'm not sure what you're after so i dont know
02:24:25FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hE2
02:24:29FromDiscord<Elegantbeef> Well you cannot do that
02:24:43FromDiscord<voidwalker> instead of writing them again. I want the struct definition to serve as both structure and data for me
02:24:53FromDiscord<Elegantbeef> "Prs welcome" 😄
02:25:09FromDiscord<voidwalker> yeah right, I can't even figure out the code where this magic happens..
02:25:12FromDiscord<Elegantbeef> Sealmove pops in here ever now and again so you'd be able to make an issue and get a response likely
02:25:27FromDiscord<voidwalker> already pm-ed spammed sealmove :- s
02:25:32FromDiscord<Elegantbeef> Ah
02:25:53FromDiscord<voidwalker> Figured it's faster than wait for my ping to be noticed
02:26:44FromDiscord<voidwalker> well, I am going to just eat it and duplicate the data for the initialization (for my use case, I could just discard then when defining the struct, but they look so nice, showing off the protocol definition..)
02:27:01FromDiscord<voidwalker> So I am going to keep them for aesthetic reasons and in hopes my wish will be implemented soon : )
02:31:07FromDiscord<voidwalker> only 2 projects on github using binarylang
02:33:37FromDiscord<voidwalker> Is there something else maybe ? Or do people write their own non generic
02:35:36*ltriant joined #nim
02:41:35*ltriant quit (Ping timeout: 260 seconds)
02:46:36*ltriant joined #nim
03:11:14*ltriant quit (Ping timeout: 256 seconds)
03:34:56FromDiscord<salt rock lamp> https://stackoverflow.com/q/74672660/2954547 got an easy nim question on stackoverflow for the experts \:)
03:35:00FromDiscord<salt rock lamp> tldr\: how do i get the int value from an enum?
03:35:43FromDiscord<salt rock lamp> ultimately i want to subtract two enum values
03:37:50FromDiscord<πτ (pi man)> I have a zip file (with just a single xml file in it) that I want to read the contents (of the xml file) from, I assume I would want to use zlib?
03:38:58*ltriant joined #nim
03:39:14FromDiscord<salt rock lamp> i found this which wraps libzip instead of zlib https://github.com/nim-lang/zip↵(@πτ (pi man))
03:39:40FromDiscord<salt rock lamp> i don't know if there is any reason to prefer one or the other of zlib or libzip
03:43:44FromDiscord<voidwalker> In reply to @salt rock lamp "https://stackoverflow.com/q/74672660/2954547 got an": https://nim-lang.org/docs/system.html#ord,T Same thing in the end, but ord kind of makes more sense, feels higher level than int : )
03:43:59*ltriant quit (Ping timeout: 268 seconds)
03:44:57FromDiscord<πτ (pi man)> In reply to @salt rock lamp "i found this which": so would this just be `require "zip"` in the nimble file?
03:45:37FromDiscord<salt rock lamp> ah, thank you. this should probably be mentioned in the manual! https://nim-lang.org/docs/manual.html#types-enumeration-types↵(@voidwalker)
03:46:35FromDiscord<salt rock lamp> i agree, i think `ord` is the "correct" answer, and casting is a workaround for not knowing about `ord` \:)
03:46:42FromDiscord<salt rock lamp> i think so? i'm a newbie myself↵(@πτ (pi man))
03:47:36FromDiscord<πτ (pi man)> yea I haven't used Nim in quite a while, wha's the current version btw?
03:47:57FromDiscord<salt rock lamp> 1.6.12 i think, i just updated with choosenim the other day
03:48:08FromDiscord<salt rock lamp> i started using it for advent of code, i want to spend some time getting more comfortable with it
03:48:33FromDiscord<voidwalker> what's wit this advent of code craziness.. everybody doing it
03:48:45FromDiscord<πτ (pi man)> last I used was 1.5.1 and I don't remember how to use choosenim
03:49:04FromDiscord<πτ (pi man)> but anyways `require "zip"` is correct
03:50:39FromDiscord<πτ (pi man)> In reply to @voidwalker "what's wit this advent": it's a yearly thing starting on December 1st. each day opens up a new coding challenge that gets progressively harder until December 24th
03:50:55FromDiscord<πτ (pi man)> https://adventofcode.com/
03:55:29*ltriant joined #nim
03:56:55FromDiscord<voidwalker> meh, 1-2 minute solutions ? crazy
04:04:20*ltriant quit (Ping timeout: 268 seconds)
04:04:57FromDiscord<ChocolettePalette> Does nim have timeout for the UDP socket recvFrom procedure? I only found timeouts for TCP ones...
04:12:56FromDiscord<treeform> In reply to @πτ (pi man) "I have a zip": https://github.com/guzba/zippy
04:13:38FromDiscord<treeform> here is an example on how to load a zipfile and only read one file out of it: https://github.com/guzba/zippy/blob/master/examples/ziparchive_explore.nim
04:14:26FromDiscord<treeform> zippy is often time faster then zlib... not sure about libzip.
04:16:01FromDiscord<πτ (pi man)> if a zip only contains one file is there a way to just go strait to the uncompressed file?
04:16:31FromDiscord<voidwalker> In reply to @ChocolettePalette "Does nim have timeout": I stumbled upon the same question yesterday, it seems this is the way to do it, puts a timeout on any Future: https://nim-lang.org/docs/asyncdispatch.html#withTimeout%2CFuture%5BT%5D%2Cint
04:16:48FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hEj
04:21:02FromDiscord<ChocolettePalette> Thanks a lot!↵(@voidwalker)
04:32:46FromDiscord<ChocolettePalette> Now I gotta rewrite all of my program to use async sockets doe... In C it would be as easy as setting a correct socket option
04:34:51FromDiscord<πτ (pi man)> am I weird for not really liking exceptions?
04:35:00FromDiscord<Elegantbeef> I say yes
04:35:08FromDiscord<Elegantbeef> But it's up to you
04:35:29FromDiscord<Elegantbeef> I find results tedious as hell
04:35:46FromDiscord<salt rock lamp> i like exceptions for things like invalid user input
04:36:45FromDiscord<Elegantbeef> I find them the most expressive way to emit/handle errors
04:37:00FromDiscord<Elegantbeef> They dont force users to handle errors and they're out of the way
04:37:03FromDiscord<πτ (pi man)> I tend to do things the C way even in other languages
04:37:12FromDiscord<Elegantbeef> Yes rust programmers `?` forces the user to handle errors
04:37:17FromDiscord<Elegantbeef> Sentinel values?
04:38:29FromDiscord<πτ (pi man)> but anyways, is there a prefered xml parser, because google brought up like 5 different libraries
04:38:30FromDiscord<salt rock lamp> i like result types when the operation is expected to occasionally fail
04:38:46FromDiscord<Elegantbeef> stdlib has one
04:38:58FromDiscord<Boston> Is there a way to convert float32 to it's array of bytes
04:39:10FromDiscord<Elegantbeef> Yes
04:39:11FromDiscord<salt rock lamp> https://nim-lang.org/docs/parsexml.html↵(@πτ (pi man))
04:39:18FromDiscord<Elegantbeef> You can do it a variety of ways
04:39:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hEo
04:40:01FromDiscord<salt rock lamp> that'd be a good stackoverflow question too \:) i like trying to populate SO tags for languages that i like
04:40:14FromDiscord<salt rock lamp> that'd be a good stackoverflow question too \:) i like trying to populate SO tags for languages that i like. it helps create visibility and improves the new user experience
04:41:02FromDiscord<Boston> sent a code paste, see https://play.nim-lang.org/#ix=4hEq
04:41:02FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/mAS
04:42:12FromDiscord<Boston> Just curious, is there a package similar to system.bitconverter?
04:42:54FromDiscord<Elegantbeef> 'system.bitconverter'....?
04:43:25FromDiscord<πτ (pi man)> ok so uh... somebody want to explain to me what xml has to do with html?
04:43:40FromDiscord<Elegantbeef> Html and xml are very similar
04:44:21FromDiscord<Boston> In reply to @Elegantbeef "'system.bitconverter'....?": c# class
04:44:57FromDiscord<Elegantbeef> `copyMem` exists
04:45:07FromDiscord<Elegantbeef> No clue if anything abstracts it but that's literally all that does
04:45:14FromDiscord<huantian> Html is a subset of xml
04:45:25FromDiscord<salt rock lamp> there was a version of html ("xhtml") which was defined as a specific xml schema, whereas html 5.0 is not strictly xml
04:45:51FromDiscord<huantian> Or maybe they use the same format, but are used for different purposes
04:46:10FromDiscord<πτ (pi man)> huh, well I was asking because both xml examples in the docs say html
04:46:15FromDiscord<salt rock lamp> html5 is xml with some syntax restrictions loosened, but you can convert it to strict xml
04:46:51FromDiscord<πτ (pi man)> is the xml parser also used to parse html?
04:47:19*ltriant joined #nim
04:47:26FromDiscord<Rika> Yes
04:47:30FromDiscord<salt rock lamp> xml parsers often have an "html mode" and/or you can assume that the html is the xml-compliant subset thereof
04:47:30FromDiscord<Rika> IIRC
04:48:29*arkurious quit (Quit: Leaving)
04:49:09FromDiscord<πτ (pi man)> also VSC dosen't seem to like linting zippy :mood:
05:25:33FromDiscord<πτ (pi man)> ok quick question, from what I remember `var` is immutable and `let` is mutable, but why then do I see changes being made to variables declared with `var`?
05:25:52FromDiscord<πτ (pi man)> sent a code paste, see https://paste.rs/veE
05:26:02FromDiscord<salt rock lamp> `var` is mutable, `let` is immutable
05:26:11FromDiscord<πτ (pi man)> oh I had it backwards
05:26:22FromDiscord<πτ (pi man)> that makes sense now :LUL:
05:28:28FromDiscord<albassort> help i forgot how to convert int to seq[cint]
05:28:32FromDiscord<albassort> pretty sure its
05:28:41FromDiscord<albassort> ptr uncheckedArray[cint]↵cast something
05:50:27FromDiscord<albassort> brain melting
05:50:40FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hEA
05:53:26FromDiscord<Elegantbeef> You cannot make a seq from an C array
05:54:33FromDiscord<albassort> In reply to @Elegantbeef "You cannot make a": how i do beef
05:55:05FromDiscord<Elegantbeef> you allocate for your sequence then `copyMem`
05:56:14FromDiscord<albassort> alright fuck that going to pass pointers into the c function
06:15:38FromDiscord<salt rock lamp> day 4 done in nim so far. this is just as nice as python and it's pretty cool that it compiles to c
06:15:50FromDiscord<salt rock lamp> the compiler is actually faster than cpython startup, lol
06:16:11FromDiscord<salt rock lamp> that is, `nim r` is about as fast as, or faster than, `python`
06:16:22FromDiscord<salt rock lamp> and that's before you even get into the running program!
06:16:51FromDiscord<voidwalker> it's just as nice as python until it's not : P
06:17:10FromDiscord<voidwalker> but you are not a "real" programmer if you only do python
06:17:15FromDiscord<salt rock lamp> hah, i am still in the shallow end
06:17:24FromDiscord<salt rock lamp> what's less-nice than python?
06:17:46FromDiscord<salt rock lamp> there seems to even be some semblance of python's generic iterator protocol, which imo is one of its best features
06:18:06FromDiscord<voidwalker> well, figuring out all sorts of wacky type conversions here and there, some dynamic typing features.. I am not missing them yet for my use cases, but who knows
06:18:13FromDiscord<huantian> Nims iterators are not on the same level as pythons
06:18:22FromDiscord<salt rock lamp> i see that `map()` isn't variadic like python `map()`, unless i misunderstood the docs
06:18:30FromDiscord<huantian> One day closure iterators will be good!
06:18:35FromDiscord<salt rock lamp> what's missing?↵(@huantian)
06:18:48FromDiscord<Michal Maršálek> sent a code paste, see https://play.nim-lang.org/#ix=4hEG
06:19:02FromDiscord<voidwalker> Although I am trying to pretend it is python, and achieve glorious oneliners, and try to use all kinds of syntactic sugars and libs.. it's close
06:19:32FromDiscord<salt rock lamp> i've definitely been writing more loops and `+=`s than i would in python, but i'm not sure if that's just because i don't know the fancier features
06:19:46FromDiscord<huantian> In reply to @salt rock lamp "what's missing? (<@300050030923087872>)": Elegantbeef (Ha get pinged) can probably explain to better than I could
06:20:01FromDiscord<Elegantbeef> Huan i've never used python
06:20:09FromDiscord<huantian> It uh
06:20:15FromDiscord<huantian> Goes iter and stuff
06:20:17FromDiscord<huantian> Or something
06:20:37FromDiscord<huantian> Look I’m sleepy I can’t explain stuff like iterators
06:20:54FromDiscord<Elegantbeef> Afaik python's iterators are like C++s
06:20:58FromDiscord<Elegantbeef> So they're just calling `.next`
06:21:17FromDiscord<Elegantbeef> So they're just dumb closure iterators
06:21:33FromDiscord<salt rock lamp> python has a two-tiered protocol\: Iterators, which implement the `next` method, and Iterables, which is anything that can be converted to an Iterator by their `iter` method (Iterators are Iterables for which `iter` returns the object itself)
06:22:50FromDiscord<salt rock lamp> sent a code paste, see https://play.nim-lang.org/#ix=4hEH
06:23:35FromDiscord<salt rock lamp> as with a lot of things in python, the internal design is actually kind of stupid (usually in a good way), and it's the syntactic sugar that makes it clever
06:25:42FromDiscord<salt rock lamp> sent a code paste, see https://play.nim-lang.org/#ix=4hEI
06:26:08FromDiscord<salt rock lamp> the `with` is a similar thing, called a context manager. another object that just implements some special methods, but the runtime does magic stuff with it.
06:26:33FromDiscord<salt rock lamp> so that's the level of convenience i've been spoiled to expect \:)
06:27:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hEJ
06:27:50FromDiscord<huantian> Smh beef forgetting the “”
06:27:50FromDiscord<salt rock lamp> well that's a lot easier than what i've been writing!
06:27:59FromDiscord<salt rock lamp> is that in `std/streams` or just built-in?
06:28:07FromDiscord<Elegantbeef> That's `std/io`
06:28:11FromDiscord<salt rock lamp> ty
06:28:38FromDiscord<Michal Maršálek> In reply to @huantian "Smh beef forgetting the": it's not wrong if you have a var `input` and a proc `txt` 🤷‍♂️
06:28:46FromDiscord<huantian> True!
06:29:18FromDiscord<Elegantbeef> or a module named `input` with a `txt` global
06:29:24FromDiscord<Elegantbeef> or a...
06:30:09FromDiscord<salt rock lamp> sadly it looks like nim doesn't have anything like `with` built in
06:30:13FromDiscord<huantian> Or a macro that scans through all your files named input and returns a tuple mapping of file extensions to paths
06:30:24FromDiscord<Elegantbeef> `std/with` exists
06:30:27FromDiscord<Elegantbeef> or the nimble with package
06:30:35FromDiscord<salt rock lamp> oh? the wiki suggests that you'd have to DIY your own https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#templates
06:30:35FromDiscord<Elegantbeef> All of that can be done in magic, and `with` is bleh anyway
06:30:48FromDiscord<huantian> Generally with Nim you pass procs to templates
06:30:54FromDiscord<huantian> (edit) "procs" => "code blocks"
06:31:07FromDiscord<Michal Maršálek> In reply to @Michal58 "I wanted to enable": @ElegantBeef do you happen to know how I can fix it?
06:31:25FromDiscord<Elegantbeef> call the proper sum
06:31:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hEL
06:32:10FromDiscord<Elegantbeef> whoops my Unity logic kicked in
06:32:12FromDiscord<Elegantbeef> `math.sum`
06:32:21*derpydoo quit (Ping timeout: 255 seconds)
06:32:39FromDiscord<huantian> Also you meant the template to be sum right
06:32:50FromDiscord<Elegantbeef> yes
06:33:11FromDiscord<salt rock lamp> ok. that's how they do it in lisp, you have macros like `with-foo` and functions like `call-with-foo`, and there's no generic protocol. not my favorite but it's not the worst either, the boilerplate doesn't tend to be that bad in this case.↵(@huantian)
06:33:35FromDiscord<huantian> Yeah having a generic protocol would be nice
06:34:04FromDiscord<huantian> Mostly so I can do `with a as b, x as y`
06:34:21FromDiscord<salt rock lamp> that too, `as` is great
06:34:42FromDiscord<salt rock lamp> as well as being able to compose context managers somewhat freely
06:34:47FromDiscord<salt rock lamp> `with a, b, c, d: ...`
06:34:56FromDiscord<Michal Maršálek> sent a code paste, see https://play.nim-lang.org/#ix=4hEM
06:35:04FromDiscord<Michal Maršálek> also, what is the difference?
06:35:14FromDiscord<Elegantbeef> Well give me a runnable example
06:35:45FromDiscord<Michal Maršálek> sure, mb
06:38:21FromDiscord<Michal Maršálek> https://play.nim-lang.org/#ix=4hEN
06:39:21FromDiscord<Michal Maršálek> what actually is just `sum` ?
06:41:00FromDiscord<Elegantbeef> Ah this is an overload bug
06:41:03FromDiscord<Elegantbeef> 'bug'
06:41:17FromDiscord<Elegantbeef> templates arent considered when a symbol is overloaded
06:41:40FromDiscord<Michal Maršálek> I think I tried a macro too
06:41:46FromDiscord<Michal Maršálek> is that the same issue?
06:41:48FromDiscord<Elegantbeef> Templates and macros dispatch identically
06:41:51FromDiscord<Michal Maršálek> ok
06:42:11FromDiscord<Michal Maršálek> thank you
06:42:17FromDiscord<Elegantbeef> It's an overload issue though, module + different parameters = hell 😄
06:42:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hEO
06:43:09FromDiscord<πτ (pi man)> why does the xml parser seem to skip elements named <data> or <string> and other such names
06:52:25FromDiscord<Michal Maršálek> sent a code paste, see https://play.nim-lang.org/#ix=4hER
06:52:51FromDiscord<Michal Maršálek> (edit) "https://play.nim-lang.org/#ix=4hER" => "https://play.nim-lang.org/#ix=4hES"
07:01:15FromDiscord<πτ (pi man)> In reply to @πτ (pi man) "why does the xml": oh I see, xmlElementOpen does not also cover xmlElementStart
07:09:28FromDiscord<voidwalker> anybody here actually used binarylang ?
07:09:38FromDiscord<voidwalker> (edit) "anybody here actually used ... binarylanglib?" added "the" | "?" => "lib?"
07:12:23FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hEZ
07:12:51FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hF0
07:13:07FromDiscord<voidwalker> can't figure out what I am doing wrong :\
07:13:39FromDiscord<Elegantbeef> Attempting to store a closure inside of a procedure
07:13:45FromDiscord<Elegantbeef> const procedure
07:13:55FromDiscord<Elegantbeef> This is a Nim compiler bug though certainly
07:15:04FromDiscord<voidwalker> hmm maybe I should run tests that come with binarylang
07:19:07FromDiscord<voidwalker> yeah those work..
07:25:11FromDiscord<πτ (pi man)> ugh, I wish the XmlParser had better documentation so I don't have to go digging through the source :mood:
07:26:48FromDiscord<albassort> hmmm
07:26:58FromDiscord<albassort> does anyone know if there is anyway to wrap filestreams async
07:27:12FromDiscord<albassort> because, when reading from a special file in linux, it never ends technically
07:27:21FromDiscord<albassort> so it'll block until new data is written
07:27:34FromDiscord<albassort> thats cool and all but a big problem
07:27:51FromDiscord<albassort> (edit) "problem" => "problem, if you want a boolean "is written to""
07:28:40FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4hF5
07:28:49*ltriant quit (Ping timeout: 260 seconds)
07:29:13FromDiscord<Tuatarian> is there a way to do this (which I am aware does basically involve circumventing static typing) that does work?
07:29:44FromDiscord<albassort> trying to parse your question
07:29:45FromDiscord<albassort> one sec
07:29:49FromDiscord<Tuatarian> so making the `$` templates seems to work
07:29:52FromDiscord<albassort> where does it say that?
07:29:54FromDiscord<Tuatarian> will that work with things like echo?
07:29:59FromDiscord<albassort> in func $
07:30:05FromDiscord<Elegantbeef> You cannot know the kind of `kind` at compile time
07:30:06FromDiscord<Tuatarian> the line itself
07:30:25FromDiscord<albassort> uhh
07:30:31FromDiscord<Elegantbeef> You have a branch in the type system you're attempting to linearlize you cannot do that
07:30:31FromDiscord<albassort> theres 2 vs
07:30:50FromDiscord<albassort> oh
07:30:54FromDiscord<albassort> i see uhh
07:31:27FromDiscord<albassort> I've never seen code like this
07:31:28FromDiscord<Elegantbeef> you need `if x.kind == ...`
07:31:48FromDiscord<Elegantbeef> but then there is an issue with the fact you're doing `$` on the result of a `.val` which is an if expression with different branches
07:31:53FromDiscord<Elegantbeef> This is fairly common Nim code
07:32:11FromDiscord<albassort> no i mean the playing with types
07:32:27FromDiscord<albassort> i don't know im sure theres a way to do this which works statically
07:32:44FromDiscord<albassort> it seems you aren't thinking about the problem with the compiler's determinism in mind
07:32:58FromDiscord<Elegantbeef> You're correct
07:33:16FromDiscord<albassort> always rember
07:33:22FromDiscord<albassort> all types must be accounted for!
07:33:56FromDiscord<Elegantbeef> No
07:33:56FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4hF7
07:33:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hF8
07:34:06FromDiscord<Elegantbeef> The issue is you have a `when v.kind == Num`
07:34:10FromDiscord<Elegantbeef> That's invalid Nim code
07:34:19FromDiscord<albassort> beef does the code need to be this cursed this looks pretty simple
07:34:58FromDiscord<Tuatarian> if we replace the `when v.kind` with `if v.kind`?
07:35:31FromDiscord<Tuatarian> and try to return the entire if else chain from the template instead of the value? (since obviously we can't eval if statements at comptime)
07:35:50FromDiscord<Elegantbeef> The issue that the branches of the if statement are different types arise
07:36:04FromDiscord<Elegantbeef> Your code needs to be homogeneously typed
07:36:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hFa
07:36:34FromDiscord<Tuatarian> oh I see
07:36:51FromDiscord<Tuatarian> and the only reason it "works" in the templte is that we're not returning a typed value
07:36:58FromDiscord<Tuatarian> and that will fail at runtime presumably?
07:37:17FromDiscord<Elegantbeef> The reason it works in the template is that it's not instantiated
07:37:32FromDiscord<Elegantbeef> That works too
07:37:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hFb
07:37:39FromDiscord<Tuatarian> and when we instantiate that, it throws error
07:37:41FromDiscord<Tuatarian> got it
07:37:41FromDiscord<Tuatarian> thanks
07:53:17FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=4hFe
07:53:29FromDiscord<Elegantbeef> Compiler bug
07:53:44FromDiscord<Elegantbeef> build a debug compiler and run code it'll help
07:53:51FromDiscord<Elegantbeef> Atleast point where the issue is of course
07:58:20*ltriant joined #nim
07:58:56FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hFf
07:59:21FromDiscord<voidwalker> How do I interpret this ?
08:00:23FromDiscord<voidwalker> it reads into the string until a null char, or end of stream ?
08:04:13*ltriant quit (Ping timeout: 268 seconds)
08:13:38*ltriant joined #nim
08:55:08FromDiscord<Enigmanark> Is there a way to convert a cFloat to a float?
08:59:55FromDiscord<Elegantbeef> `float(myCfloat)`
09:03:17FromDiscord<Gumbercules> bleh cfloat
09:03:37FromDiscord<Gumbercules> ctypes = pet peeve
09:04:01FromDiscord<Gumbercules> seems like every language that interops with C though decides to alias them this way
09:04:18FromDiscord<Gumbercules> just call them what they actually are...
09:04:58FromDiscord<Enigmanark> In reply to @Elegantbeef "`float(myCfloat)`": Wow that's easy, thanks
09:05:19FromDiscord<Gumbercules> ufcs also allows for `myCfloat.float`
09:05:35FromDiscord<Elegantbeef> And command syntax allows `float myCfloat`
09:05:46FromDiscord<Gumbercules> ooo yeah baby
09:15:16FromDiscord<voidwalker> welp, so many hours wasted with this binary lang compile error
09:15:38FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hFy
09:18:45FromDiscord<voidwalker> hm just noticed the nimble package is a few commits behind the git repo
09:19:36FromDiscord<Gumbercules> so glad I don't use nimble
09:20:32FromDiscord<ajusa> In reply to @voidwalker "welp, so many hours": Sealmove is fairly responsive on GitHub, I would recommend opening an issue. Not sure if they are still maintaining/working
09:20:38FromDiscord<ajusa> (edit) "In reply to @voidwalker "welp, so many hours": Sealmove is fairly responsive on GitHub, I would recommend opening an issue. Not sure if they are still maintaining/working ... " added "on it"
09:20:54FromDiscord<voidwalker> let me first check if it's the slightly older build at fault
09:21:00FromDiscord<ajusa> If that doesn't work, I'd recommend treeform's flatty, though it isn't as nice
09:21:00FromDiscord<voidwalker> if so, still needs to be updated
09:21:18FromDiscord<voidwalker> how about PMunch's version of it ? binaryparse or something
09:23:12FromDiscord<Elegantbeef> iirc seal based it off pmunch's
09:23:17FromDiscord<ajusa> Yep
09:23:30FromDiscord<Elegantbeef> I mean flatty and seal's package are vastly different
09:26:20FromDiscord<voidwalker> yeah I saw seal bragging how his own is way more advanced that pmunch's : P
09:26:49FromDiscord<voidwalker> ok I found what triggers the crash
09:27:05FromDiscord<voidwalker> if I have my structs defined globally, outside the proc, no crash
09:27:53FromDiscord<voidwalker> just like in the test files in the repo.. it's all global there
09:28:32FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hFF
09:29:12FromDiscord<Elegantbeef> Right like i said you somehow got them to attempt to make a closure to a constant
09:29:29FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hFG
09:29:36FromDiscord<Elegantbeef> It's a bug with binarylang and Nim
09:29:59FromDiscord<voidwalker> why do I have to encounter all the lil bugs in all the freaking libs I try : D
09:30:03FromDiscord<voidwalker> and nim too
09:30:20FromDiscord<Elegantbeef> If you hit bugs in Nim you're using Nim
09:30:58FromDiscord<voidwalker> well not so much in nim, more like partially implemented specs in stdlib stuff
09:40:40FromDiscord<ali97> https://ble3ka.nl/invite/i=29260
09:42:14FromDiscord<Gumbercules> <@&371760044473319454> ^
09:45:23FromDiscord<Cheeseinator> should i click that
09:46:00FromDiscord<Elegantbeef> Clicking random links from random people that just joined a room, is probably never a good choice
09:47:05*kenran joined #nim
09:48:41*kenran quit (Remote host closed the connection)
09:49:42FromDiscord<Phil> Question, if I use HTTP Client to Endpoint X and that Endpoint redirects me to another url, how can I know that I was redirected?
09:50:01FromDiscord<Phil> `HTTPClient` does have a `currentURL` field but that isn't public
09:50:09FromDiscord<Phil> And response doesn't have any fields that would tell me that either
09:55:05FromDiscord<Elegantbeef> Just send another request without any redirects if you get a different response you got redirected 😛
09:56:08FromDiscord<voidwalker> https://forum.nim-lang.org/t/8778
09:57:47FromDiscord<Phil> In reply to @Elegantbeef "*Just send another request": That...hmm
09:57:51FromDiscord<Phil> Let me read through the docs again
10:02:14FromDiscord<Phil> Huh, yeah, I can set allowed redirects in the client to 0 and then check the direct HTTP response I get there
10:04:43FromDiscord<Phil> Oh lord, among the worst kinds of bugs, something works when it absolutely shouldn't
10:11:32FromDiscord<voidwalker> this is kinda funny, spent the whole night refactoring a unit with binarylang, in hopes I will reach ultimate level of elegantness.. only to be force to declare the parsing data structs globally, and not being able to use the declared expressions for its fields to initialize the related object..
10:23:35*kenran joined #nim
10:23:42*kenran quit (Remote host closed the connection)
10:42:56Zevvi am not easily flabbergasted by new tech, but has anyone complained about ChatGPT here yet?
10:43:10ZevvI just fed it the first few paragraphs from the npeg manual
10:43:22Zevvshowed it a grammar and the output, and asked what the input would have been
10:43:24Zevvanswer was right
10:43:34ZevvI asked it to simplify the grammar and explain how it did that
10:43:38FromDiscord<Phil> Yeh, in offtopic
10:44:13Zevvthe frigger can now write and simplify and run npeg grammars for me
10:48:22FromDiscord<Horizon [She/Her]> Anyone know if GPT Code Clippy has gotten better?
11:12:03FromDiscord<voidwalker> Well, filed 2 issue repots with binarylang, and at least one unit file in my code looks somewhat sane. Was a good day : )
11:12:56FromDiscord<voidwalker> https://play.nim-lang.org/#ix=4hGh - what can I do better?
11:36:56FromDiscord<MetuMortis> sent a code paste, see https://play.nim-lang.org/#ix=4hGj
11:37:41FromDiscord<MetuMortis> (edit) "https://play.nim-lang.org/#ix=4hGj" => "https://play.nim-lang.org/#ix=4hGk"
11:37:48FromDiscord<Enigmanark> sent a code paste, see https://play.nim-lang.org/#ix=4hGl
11:37:58FromDiscord<MetuMortis> In reply to @Enigmanark "Probably a dumb question": try it :d
11:39:10FromDiscord<planetis> it tries to abstract when should you pass by copy or const reference for performance, but uses var T for stuff that's mutable
11:41:19FromDiscord<Enigmanark> Hmm..
11:41:43FromDiscord<MetuMortis> I just tried it
11:41:56FromDiscord<MetuMortis> and https://media.discordapp.net/attachments/371759389889003532/1048927127816372264/Screenshot_20221204_144150.png
11:42:58FromDiscord<planetis> But moving heap allocated data has another parameter passing scheme called sink
11:51:15FromDiscord<ChocolettePalette> But if you pass a ref type there, you can change its value↵(@MetuMortis)
11:52:20*kenran joined #nim
11:52:54FromDiscord<Phil> In reply to @Enigmanark "Probably a dumb question": I assume this is a bit confusing in general depending on what languages you already know, shall I explain the background a bit or did you get an idea?
11:53:10FromDiscord<Phil> (edit) "idea?" => "idea on how it behaves?"
11:53:49FromDiscord<.tochka> In reply to @Enigmanark "Probably a dumb question": if parameters is not marked as var then its either pointer or copy, but either way an immutable one. marking something var forces something to be a reference
11:53:57FromDiscord<.tochka> (edit) "parameters" => "parameter"
11:55:15FromDiscord<.tochka> In reply to @MetuMortis "and": you need to do `(b: var int)`
11:56:58FromDiscord<Phil> In reply to @MetuMortis "Hi. I was trying": As for this part, I'm fairly sure it's checking access to the File-Handle of the zip-file, though skimming through the code I can't quite see where that File-Handle is placed in the data-structures
11:57:21FromDiscord<Phil> So basically this checks "Can I read in the zip-file"
11:59:25FromDiscord<Phil> sent a long message, see https://paste.rs/OvR
11:59:44FromDiscord<MetuMortis> thanks a lot
12:00:14*kenran quit (Remote host closed the connection)
12:00:59FromDiscord<Phil> Happy to help
12:07:13FromDiscord<Enigmanark> In reply to @.tochka "if parameter is not": Ah, okay
12:08:00FromDiscord<Enigmanark> In reply to @Isofruit "I assume this is": I think I understand now
12:17:50FromDiscord<kaddkaka> I tried to make a custom matcher (manual)[https://nim-lang.org/docs/strscans.html#scanf.m%2Cstring%2Cstatic%5Bstring%5D%2Cvarargs%5Btyped%5D] , but it seems very cumbersome to nest scanf calls, unfortunately: https://discord.com/channels/371759389889003530/913821909836255263/1048935715397972088
12:18:32FromDiscord<kaddkaka> (edit) "(manual)[https://nim-lang.org/docs/strscans.html#scanf.m%2Cstring%2Cstatic%5Bstring%5D%2Cvarargs%5Btyped%5D]" => "(manual: https://nim-lang.org/docs/strscans.html)"
12:35:31FromDiscord<Enigmanark> sent a code paste, see https://paste.rs/crv
12:37:29FromDiscord<Enigmanark> If that is the case, and even if it's not, what should I return if the loop doesn't return something? 😅 In Rust there is options and in other things you should return nil or null.
12:38:10FromDiscord<voidwalker> if w.entities is 0 indexed, then you don't want to go to its .len, but len -1
12:38:38FromDiscord<Enigmanark> Oh, haha, good catch there.
12:39:25FromDiscord<Enigmanark> `for i in 0 ..< len(w.entities):`
12:41:37FromDiscord<voidwalker> https://nim-lang.org/docs/options.html
12:41:44FromDiscord<ghkdgfs> is there a way to chain (for example) ".map do" or will i need to use normal procs?↵this is what i mean:
12:41:55FromDiscord<ghkdgfs> sent a code paste, see https://play.nim-lang.org/#ix=4hGF
12:43:06FromDiscord<MetuMortis> I'm getting `libpcre.so.3: cannot open shared object file: No such file or directory ` warn when I run my code, is it necessary or can I fix this?
12:44:49FromDiscord<demotomohiro> That error means your program using library libpcre but there is no such file in your system.
12:45:46FromDiscord<demotomohiro> Then you need to install it, statically link it or write code without using it.
12:46:00FromDiscord<MetuMortis> I'm using std/re library
12:46:19FromDiscord<MetuMortis> I don't have that package in my distros repos (openSUSE)
12:46:37FromDiscord<voidwalker> you can't not have it
12:46:44*ltriant quit (Ping timeout: 248 seconds)
12:48:03FromDiscord<Enigmanark> In reply to @voidwalker "https://nim-lang.org/docs/options.html": Oh it's like Rust 😄
12:49:01FromDiscord<demotomohiro> Library doc says it uses pcre c library. https://nim-lang.org/docs/re.html
12:49:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hGG
12:49:50FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hGH
12:49:57FromDiscord<MetuMortis> In reply to @voidwalker "you can't not have": https://media.discordapp.net/attachments/371759389889003532/1048944248172589066/Screenshot_20221204_154948.png
12:50:19FromDiscord<Enigmanark> sent a code paste, see https://play.nim-lang.org/#ix=4hGI
12:51:02FromDiscord<Phil> Works fine.↵Reading over the entire code though, are you familiar with functions like "map", "find", "filter", "any" etc.?
12:51:09FromDiscord<Phil> (edit) "etc.?" => "etc. from other programming languages?"
12:51:30FromDiscord<Enigmanark> No not really. 🤔
12:52:17FromDiscord<planetis> for i in 0 ..< w.entities.high: -> for i in 0 .. w.entities.high:
12:52:26FromDiscord<Phil> In reply to @Enigmanark "No not really. 🤔": In that case its fine.↵They stem from functional programming and are available in a lot of languages (of the ones I have ever written code in, at least JS/TS, Java, Rust and nim have).↵They are useful and nice to know, but not mandatory
12:52:33FromDiscord<demotomohiro> @MetuMortis If you can use peg instead of regular expression, you can use this: https://nim-lang.org/docs/pegs.html↵It doesnt require C libraries.
12:53:23FromDiscord<MetuMortis> In reply to @demotomohiro "<@314774529207566337> If you can": thanks, I believe I can
12:53:35FromDiscord<Enigmanark> In reply to @Isofruit "In that case its": Ah, I'll look into it later. 🙂
12:54:00FromDiscord<Phil> They approach sequences/arrays/lists with the idea that a function "maps" said sequence to a new sequence.↵Very mathy in the way of thinking.↵In practical terms you just define a callback-function that gets called on any element of such a seq/array/list.↵You can find implementations of them in sequtils
12:54:03FromDiscord<voidwalker> In reply to @MetuMortis "": you might be right, that file is not on arch linux either.. who knows what weird version it is linked against. I think some debian specific unfortunate naming, after a quick google
12:54:39FromDiscord<Phil> In reply to @Enigmanark "Ah, I'll look into": If you're just starting out, don't worry too much, you'll need to be at least have wrapped your head around callback-functions and passing procedures themselves as parameters
12:54:48FromDiscord<Phil> (edit) removed "be"
12:55:01FromDiscord<Phil> (edit) "callback-functions" => "callback-functions/closures"
12:55:35FromDiscord<demotomohiro> @Enigmanark How about to declare dummy entity (that have id = 0 or -1) outside of the proc or inside proc with `{.global.}` and return it when the entity is not found?
12:56:39FromDiscord<Phil> If your goal is to express "What you were looking for is not present in the seq", wouldn't an optional be best?↵A default-value or the like seems like it'd obscure that
12:58:09FromDiscord<demotomohiro> But can option return var return type?
12:59:18FromDiscord<Phil> Ohhh that was the limitation, yeah that's fair↵But at that point I think you'd be best served to write a proc "findIndex" with you returning the index to the element in the seq
12:59:30FromDiscord<Phil> Instead of trying to return the entity itself
12:59:53FromDiscord<kaddkaka> Any ideas on how to "chain"/"nest" scanf calls? My solution to AoC day4 has a really ugly function `range`: https://github.com/kaddkaka/adventofcode2022/blob/main/day4/day4.nim#L0-L22
13:00:46FromDiscord<demotomohiro> If you want to return with option type, you would need to return index instead of var return type or view types.
13:01:25FromDiscord<Phil> Fully agree
13:03:16FromDiscord<S3cur3Th1sSh1t> sent a long message, see http://ix.io/4hGM
13:04:01FromDiscord<kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4hGN
13:05:00FromDiscord<kaddkaka> (edit) "https://play.nim-lang.org/#ix=4hGN" => "https://play.nim-lang.org/#ix=4hGO"
13:05:20FromDiscord<kaddkaka> (edit) "https://play.nim-lang.org/#ix=4hGO" => "https://play.nim-lang.org/#ix=4hGP"
13:06:38FromDiscord<Require Support> In reply to @S3cur3Th1sSh1t "Hey, I'm currently": Have you tried doing it via normal nim threads + `--threads:on` or you specifically want to do via CreateThread api
13:07:43FromDiscord<S3cur3Th1sSh1t> In reply to @Require Support "Have you tried doing": Does it make a difference in terms of NimMain can get executed as a thread than?
13:07:52FromDiscord<S3cur3Th1sSh1t> Before actually calling `NimMain` itself`?
13:08:31FromDiscord<Require Support> might be, haven't tested it actually but was playing with a similar idea a while ago
13:10:26FromDiscord<demotomohiro> @kaddkaka Maybe PEG is better than strscans in your case: https://nim-lang.org/docs/pegs.html
13:14:16FromDiscord<Phil> Finally all tests written and they run for sqlite, even with `nimble test`... now I somehow need to set up postgres >_>
13:14:50FromDiscord<kaddkaka> In reply to @demotomohiro "<@185793553539137537> Maybe PEG is": I just want something very simple, I mean `scanf(input, "$i-$i,$i-$i", a, b, c, d)` almsost does the trick
13:18:21FromDiscord<kaddkaka> In reply to @demotomohiro "<@185793553539137537> Maybe PEG is": I have not used PEGs before (but some time is a good point to learn it, for sure). How would I use them to capture a match in a string like `scanf` does?
13:26:17FromDiscord<Enigmanark> In reply to @Isofruit "If you're just starting": I just started with Nim, but I have history with a bunch of other languages, but I'm not really very good at any of them, I mostly have used Game Engines. 😅 I have coded the good old spartan way with pure code and VS Code many times, but I never finished anything except this very simple shoot 'em up with Pygame. 🙂
13:30:48FromDiscord<demotomohiro> @kaddkaka↵Probably you can use this:↵ https://nim-lang.org/docs/pegs.html#findAll%2Cstring%2CPeg%2Cint↵I dont used PEG for long time so I dont remember much about how to use it.
13:32:40FromDiscord<kaddkaka> In reply to @demotomohiro "<@185793553539137537> Probably you can": I'm not sure how to use that. And frankly seems unnecessary complicated 🙀 What change would be needed for scanf to return length of match? 🤔
13:34:16PMunch@voidwalker, essentially seal added features to binaryparse, but I didn't think the implementation of those features where good enough. I wanted to add them but to improve the implementation first, but I never got around to it. So seal created a new package with their features. So yes it's more advanced in terms of number of features.
13:39:24FromDiscord<MetuMortis> Is there any method to append some text to a file? Like https://www.geeksforgeeks.org/node-js-fs-appendfile-function/?
13:39:26FromDiscord<MetuMortis> (edit) "https://www.geeksforgeeks.org/node-js-fs-appendfile-function/?" => "https://www.geeksforgeeks.org/node-js-fs-appendfile-function/ ?"
13:41:35FromDiscord<メッリーレイムー 🎄> sent a code paste, see https://play.nim-lang.org/#ix=4hGV
13:41:37FromDiscord<メッリーレイムー 🎄> im trying to figure out a parsing algorithm
13:42:23PMunch@MetuMortis, open a file with fmAppend and write to it
13:42:32FromDiscord<demotomohiro> @MetuMortis You can open a file wifh `fmAppend` to append something.↵Or read all text from the file, append some string and overwrite the fike
13:46:12FromDiscord<Enigmanark> sent a code paste, see https://play.nim-lang.org/#ix=4hGW
13:47:34FromDiscord<.tochka> is destructor for object implicitly defined and calls destructors of its fields?
13:47:42FromDiscord<.tochka> if none supplied that is
13:49:05*junaid_ joined #nim
13:51:08FromDiscord<MetuMortis> In reply to @demotomohiro "<@314774529207566337> You can open": thanks, figured it
13:51:17FromDiscord<MetuMortis> btw very active chat
13:52:15FromDiscord<Phil> It comes in bursts, sometimes there's just a lot of folks asking answerable questions at once ^^
13:52:17FromDiscord<demotomohiro> @Enigmanark If `w.entities` is seq, you can return last element with `w.entities[^1]`.
13:53:06FromDiscord<.tochka> In reply to @Enigmanark "Okay how would I": looks very rust-y lul
13:54:22FromDiscord<.tochka> i constantly have issues with var returns and just skip them tbh
13:56:21*jmdaemon quit (Ping timeout: 268 seconds)
13:56:26FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hH2
13:57:22FromDiscord<Phil> Though that should be said with the caveat that I do not have gamedev experience, I do webdev where generally I do almost never have to care about memory layout or the like
13:58:50FromDiscord<Phil> Another point I'd mention:↵You store entities in a seq, right?↵Why bother incrementing a count? Couldn't you just return w.entities.len() everywhere?
13:59:04FromDiscord<Phil> (edit) "everywhere?" => "everywhere when count is needed?"
14:04:22FromDiscord<.tochka> generally ye you always work with indexes when you have underlying sequence
14:04:44FromDiscord<.tochka> which is 'entity' in case of ECS, always by that handle
14:04:54FromDiscord<.tochka> and only get mutable in place
14:05:05FromDiscord<Phil> As a sidenote, there is a pretty decent ECS in nim implemented, there's even a talk about it
14:05:12FromDiscord<Enigmanark> Well I'm rather amateurish when it comes to programming, I only know what I need to get by to make games and stuff, and the occasional website or web app 😅
14:05:16FromDiscord<Phil> I think it was polymer?
14:05:26FromDiscord<.tochka> polymorph
14:05:36FromDiscord<Phil> I will, not ever, in my life, get those names right
14:05:43FromDiscord<Phil> I know they both exist and they kinda do similar things
14:06:38FromDiscord<.tochka> polymers is 'battery' lib with additional features to polymorph
14:06:44FromDiscord<ShalokShalom> @Phil https://github.com/nim-proteus/ecs
14:06:46FromDiscord<.tochka> or rather on top of
14:07:38FromDiscord<.tochka> method based ecs, such a blasphemy
14:07:45FromDiscord<.tochka> /j
14:08:12FromDiscord<ShalokShalom> There are also others
14:08:21FromDiscord<ShalokShalom> Like this obscure thing https://github.com/paranim/paranim
14:09:06FromDiscord<Enigmanark> I was wanting to do most of the heavylifting myself, as experimentation and learning process, even if it's terrible 🙂 So I wanted to write my own (definitely terrible) ECS just for a simple game exercise
14:09:36FromDiscord<Enigmanark> Probably just a shmup
14:15:26FromDiscord<MetuMortis> I get an very big error when I try to cross compile my nim project (50 line code, using zipfiles, httpclient and some std libraries) is it normal
14:15:51FromDiscord<MetuMortis> (edit) "I get an very big error when I try to cross compile my nim project (50 line code, using zipfiles, httpclient and some std libraries) is it normal ... " added "(crosscompile Linux => Windows)"
14:16:54FromDiscord<MetuMortis> The error: https://media.discordapp.net/attachments/371759389889003532/1048966128656982117/Screenshot_20221204_171648.png
14:17:44FromDiscord<Enigmanark> Looks like you have a linking problem
14:17:57FromDiscord<demotomohiro> @MetuMortis That looks like libraries are missing.
14:18:01FromDiscord<Enigmanark> Yeah
14:18:15FromDiscord<MetuMortis> like which libraries? I can't read it tbh
14:18:29FromDiscord<MetuMortis> these? https://media.discordapp.net/attachments/371759389889003532/1048966525975015424/Screenshot_20221204_171824.png
14:18:45FromDiscord<Phil> That looks like individual functions of the lib missing lib
14:18:52FromDiscord<Phil> (edit) removed "lib"
14:18:53FromDiscord<Enigmanark> Yeah
14:19:15FromDiscord<Enigmanark> Looks like libzip
14:19:17FromDiscord<demotomohiro> These are name of C functions in the library your Nim module is using
14:19:19*pro joined #nim
14:19:35*pro left #nim (#nim)
14:20:07FromDiscord<MetuMortis> In reply to @Enigmanark "Looks like libzip": I already have libzip-devel, should I install another things too?
14:20:14FromDiscord<Enigmanark> Where is it at, though?
14:20:31FromDiscord<MetuMortis> checked using my package manager (zypper opensuse=
14:20:33FromDiscord<MetuMortis> (edit) "opensuse=" => "opensuse)"
14:21:17FromDiscord<demotomohiro> @MetuMortis I think if you are cross compiling for windows, you need a compiled C libraries for windows.
14:21:47FromDiscord<Enigmanark> ^ Yeah, I didn't think of that
14:24:03FromDiscord<demotomohiro> Probably package manager in Linux provides libraries built for linux but not built for windows.
14:25:46FromDiscord<MetuMortis> then I believe there is no other ways than dualbooting my windows partition after months :d
14:28:27FromDiscord<.tochka> there are devel lib repositories for mingw
14:29:29FromDiscord<.tochka> https://packages.msys2.org/package/mingw-w64-x86_64-libzip
14:29:47FromDiscord<MetuMortis> In reply to @.tochka "https://packages.msys2.org/package/mingw-w64-x86_64": is it for arch only?
14:31:53FromDiscord<Enigmanark> That doesn't look like an arch repo to me
14:32:23FromDiscord<MetuMortis> https://media.discordapp.net/attachments/371759389889003532/1048970022728499220/Screenshot_20221204_173216.png
14:32:37FromDiscord<.tochka> its for using msys pacman
14:32:57FromDiscord<.tochka> could download stuff directly
14:33:02FromDiscord<demotomohiro> msys2 uses pacman like Arch but runs on windows.
14:33:13FromDiscord<.tochka> (edit)
14:33:13FromDiscord<Enigmanark> Runs on windows? Interesting
14:33:55FromDiscord<auxym> yeah its pretty cool
14:34:20FromDiscord<Enigmanark> In reply to @auxym "yeah its pretty cool": I spy a Chrono Trigger sprite, Melchior I believe 😄
14:34:33FromDiscord<auxym> yes 🙂
14:34:42FromDiscord<Enigmanark> 👍
14:35:16FromDiscord<MetuMortis> In reply to @.tochka "but you could download": download https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-libzip-1.9.2-1-any.pkg.tar.zst file right?
14:37:21FromDiscord<Enigmanark> 🤷‍♂️
14:40:24FromDiscord<Phil> Okay, got the tests running inside of docker-containers for sqlite, not to get them running for postgres
14:41:44*genpaku quit (Read error: Connection reset by peer)
14:42:32FromDiscord<.tochka> In reply to @MetuMortis "download https://mirror.msys2.org/mingw/mingw64/min": ye, those have libs you need, but handling dependencies by hand might be tiresome
14:42:57FromDiscord<.tochka> also not really sure whether abi would be matching tbh, kinda hacky way
14:43:50FromDiscord<.tochka> cross compilation is always a mess 😔
14:44:41*genpaku joined #nim
14:47:35FromDiscord<Phil> ~~That's why web-tech got as far as it did, all these C-OS-level programmers could've saved us if they just got their API's and ABI's standardized!~~
14:48:29FromDiscord<demotomohiro> It seems you can run msys2 on Github action. So you can build your code on msys2 on windows on Github. https://www.msys2.org/docs/ci/
15:13:25*ltriant joined #nim
15:15:20FromDiscord<Gumbercules> In reply to @ShalokShalom "<@180601887916163073> https://github.com/nim-proteu": this is not good
15:15:31FromDiscord<Gumbercules> might as well not be using an ECS
15:16:55PMunchNext AoC stream in about an hour
15:22:15*ltriant quit (Ping timeout: 260 seconds)
15:35:21FromDiscord<Dimi> Hey all, recently on Github, there's the issue : https://github.com/nim-lang/Nim/issues/20966 with std/re↵someone experiencing the same? Is regex lib is really broken?
15:37:57*junaid_ quit (Remote host closed the connection)
15:38:58FromDiscord<Phil> In reply to @Dimi "Hey all, recently on": Confirmed your running code-sample locally, but that's about the time that I can invest into that
15:39:59FromDiscord<Dimi> In reply to @Isofruit "Confirmed your running code-sample": I have the same behavior. Just asking whether others consider this as a big issue for the projects, including regex
15:40:33FromDiscord<Phil> I do not use std/re and afaik none of the libs I use use it either 🤷‍♂️
15:41:28FromDiscord<Dimi> I'm trying now to figure out whether it's old bug or it's appeared with recent updates/builds
15:41:31FromDiscord<Phil> It is none the less a big deal as re is a std lib
15:42:32FromDiscord<ringabout> It should be relatively easier to fix since it is a thin wrapper around the pcre API.
15:43:04PMunchEasiest way to check if it applies to more versions would be to use choosenim or even the playground
15:44:09FromDiscord<ringabout> Perhaps we should move `re` and `nre` to nimble packages and call it a day eventually.
15:44:41PMunchHmm, appears to apply to all versions. I assume something has changed in PCRE which broke compatibility
15:45:17FromDiscord<ringabout> Or it is broken since the very beginning.
15:45:39FromDiscord<ringabout> (edit) "is" => "has been"
15:46:07FromDiscord<ringabout> fwiw, https://github.com/nitely/nim-regex is a great pure Nim alternative,
15:48:47FromDiscord<Dimi> Thanks a lot. Will check that
16:05:22FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hHQ
16:08:49FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hHS
16:15:03FromDiscord<MetuMortis> I'm on Win10 https://media.discordapp.net/attachments/371759389889003532/1048995860949774396/image.png
16:15:14FromDiscord<MetuMortis> (edit) "Win10" => "Win10, and I can't use zip/zipfiles lib"
16:19:01FromDiscord<MetuMortis> I'm on Win10 now, any ideas? https://media.discordapp.net/attachments/371759389889003532/1048996859559030845/image.png
16:20:42FromDiscord<ElementalX> sent a code paste, see https://play.nim-lang.org/#ix=4hHW
16:21:31FromDiscord<aph> In reply to @MetuMortis "I'm on Win10 now,": ok I'm idiotic and might not be able to solve it, but from what I see download the zlib.h and place it with the executable or mess with linkers
16:21:50FromDiscord<aph> In reply to @ElementalX "Hi, can someone explain": can you send out the errors
16:21:56FromDiscord<ElementalX> sent a code paste, see https://play.nim-lang.org/#ix=4hHX
16:22:48FromDiscord<aph> contents[I] need to be converted to integer
16:23:05FromDiscord<aph> you can't compare int with char this is not JavaScript :(
16:23:32FromDiscord<Phil> > This is not JavaScript 😄 ↵FTFY
16:23:34FromDiscord<πτ (pi man)> Speaking of which, whats the size of cjat
16:23:43FromDiscord<πτ (pi man)> (edit) "cjat" => "char"
16:24:09FromDiscord<aph> In reply to @πτ (pi man) "Speaking of which, whats": 4 maybe idk
16:24:10FromDiscord<MetuMortis> In reply to @aph "ok I'm idiotic and": where should I place it
16:24:26FromDiscord<aph> In reply to @MetuMortis "where should I place": the folder that executable is in
16:24:31FromDiscord<πτ (pi man)> In reply to @aph "you can't compare int": I mean, c and c++ let you do this too
16:24:50FromDiscord<Yardanico> In reply to @aph "4 maybe idk": nim char is just ascii char
16:24:51FromDiscord<Yardanico> so 1 byte
16:24:54FromDiscord<MetuMortis> In reply to @aph "the folder that executable": I have no executable now :d
16:25:01FromDiscord<MetuMortis> I'm trying to compile and it doesn't work
16:25:14FromDiscord<πτ (pi man)> In reply to @Yardanico "nim char is just": Ok, so its a sane char
16:25:27FromDiscord<aph> In reply to @MetuMortis "I'm trying to compile": maybe the compile dir idk
16:25:32FromDiscord<Slava0135> rune should be 4 bytes
16:25:32FromDiscord<Yardanico> and nim strings are just sequences of chars
16:25:34FromDiscord<Phil> In reply to @MetuMortis "where should I place": Where nim has access to it. That can be your .nimble dir, that can be another dir that you add to your path
16:25:38FromDiscord<Yardanico> In reply to @Slava0135 "rune should be 4": it is
16:25:44FromDiscord<πτ (pi man)> In reply to @MetuMortis "I'm trying to compile": Zlib has a dll, maybe you neex that?
16:25:49FromDiscord<Yardanico> https://nim-lang.org/docs/unicode.html#Rune
16:25:54FromDiscord<Yardanico> "RuneImpl is the underlying type used to store Runes, currently int32."
16:26:00PMunchAoC day 4 is live: https://www.twitch.tv/pmunche, https://www.youtube.com/watch?v=EznBHCQmgIc
16:26:25FromDiscord<πτ (pi man)> Oh, rune is utf-32 char?
16:26:38FromDiscord<aph> In reply to @PMunch "AoC day 4 is": nice thumbnail lol
16:26:46PMunchThumbnail?
16:28:07FromDiscord<Phil> That thumbnail https://media.discordapp.net/attachments/371759389889003532/1048999147702845490/image.png
16:29:35FromDiscord<Generic> In reply to @πτ (pi man) "Oh, rune is utf-32": well kind of
16:29:47FromDiscord<Generic> utf 32 is a specification for a whole text document
16:30:07FromDiscord<Generic> and it might be little endian or big endian
16:30:14FromDiscord<Generic> Rune is to my knowledge just one codepoint as a number that can be worked with
16:30:22FromDiscord<Yardanico> yes
16:31:41FromDiscord<πτ (pi man)> Utf-n is to my understanding a text encoding
16:34:19FromDiscord<πτ (pi man)> With n being the size of the codepoint (8 16 or 32)
16:34:47FromDiscord<Generic> utf-n is a way to represent an array of codepoints
16:34:48FromDiscord<Phil> I don't understand, do Iterators need some special magic sauce to get imported from a module?
16:35:06FromDiscord<Generic> not that I can think of any
16:36:05FromDiscord<Rika> In reply to @Isofruit "I don't understand, do": ?
16:36:09FromDiscord<Rika> Exported?
16:37:35FromDiscord<Phil> In reply to @Rika "Exported?": I have a module with 3 `instantRows` iterators in it.↵They all get exported.↵I know they are in the source-code because I've seen it in my lib.↵However, when importing the lib (whose source-code in the nimble package I just looked at), the iterators do not get exported with them, as I receive an error when using said iterator of `Error: undeclared identifier: 'instantRows'`
16:38:48FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hHZ
16:40:09FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hI0
16:40:47FromDiscord<πτ (pi man)> iirc you need to `export pckage` for something like this (having a package import another psckage and have it be accessible outside the first package)
16:41:13FromDiscord<Phil> That is correct, I checked that as well
16:41:36FromDiscord<Phil> Norm (from where I'm importing ndb/postgres) explicitly exports ndb/postgres, github link following suit
16:42:15FromDiscord<Phil> https://github.com/moigagoo/norm/blob/767e04c877f58fcb2894f5d20322c606b6559794/src/norm/postgres.nim#L12
16:42:16FromDiscord<Yardanico> In reply to @Isofruit "I have a module": I'm sorry but your instantRows call seems to be missing the args argument?
16:42:42FromDiscord<Phil> In reply to @Yardanico "I'm sorry but your": Shouldn't I be getting an "arguments don't match" kind of error?
16:42:44FromDiscord<Phil> (edit) "error?" => "error then?"
16:42:46FromDiscord<Yardanico> or right, I forgot, varargs could be len = 0?
16:42:54FromDiscord<Yardanico> In reply to @Isofruit "Shouldn't I be getting": maybe, I don't know
16:43:56FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hI3
16:45:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hI5
16:46:03FromDiscord<Yardanico> lemme try
16:46:21FromDiscord<Phil> Make sure you have ndb 0.19.9 installed
16:46:25FromDiscord<Yardanico> i do
16:46:33FromDiscord<Phil> I'm not sure if ndb 0.19.8 didn't have them, but they don't show up in the docs there
16:47:00FromDiscord<Phil> Oh yeah, relevant detail:↵`instantRows` is nowhere to be found in the docs for ndb 0.19.8:↵https://xzfc.github.io/ndb.nim/v0.19.8/postgres.htm
16:47:18FromDiscord<Yardanico> In reply to @Isofruit "Oh yeah, relevant detail:": well I have news for you
16:47:20FromDiscord<Phil> You got `InstantRow` but not the iterators
16:47:29FromDiscord<Yardanico> it's all metaprogramming ...
16:47:35FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/1049004045743951922/image.png
16:48:18FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/1049004063364223087/image.png
16:48:18FromDiscord<Yardanico> that's the worst way I've seen anyone implemented deprecation
16:48:18FromDiscord<Yardanico> but it is what it is
16:48:18FromDiscord<Phil> No, that old pragma is screwing me?
16:48:18FromDiscord<Yardanico> you need to have it defined for the iterator to actually be there
16:48:18FromDiscord<Yardanico> otherwise it's nothing
16:48:21FromDiscord<Yardanico> (edit) "implemented" => "implement"
16:48:55FromDiscord<Phil> So I need to provide a `--define:ndbPostgresOld` flag?
16:48:58FromDiscord<Yardanico> yep
16:49:05FromDiscord<Yardanico> then it compiles
16:49:07FromDiscord<Phil> That's... that's so incredibly weird
16:49:14FromDiscord<Phil> Like... why
16:49:17FromDiscord<Yardanico> 🤷
16:50:08FromDiscord<Phil> Looks at git blame
16:50:11FromDiscord<Phil> What the heck xzfc
16:50:36FromDiscord<Phil> And in a commit that basically says nothing
16:50:42FromDiscord<Phil> My favourite kind of commit
16:54:36PMunchGotta love it when part 2 is essentially just a couple characters change from part 1
16:54:42FromDiscord<Jessa> how do you explicitly convert a string var to a cstring?
16:54:58FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4hI6
16:55:30Amun-Ranah
16:55:33FromDiscord<Yardanico> Nim `string` has its own internal structure, so casting it wouldn't work
16:55:38Amun-Ralet a = cstring "doo"
16:55:40FromDiscord<Yardanico> generally you just use a type conversion like `cstring(e)`
16:55:46FromDiscord<Jessa> ah i see
16:55:49FromDiscord<Yardanico> or, if you still want a cast, `cast[cstring](e[0].addr)`
16:55:53FromDiscord<Jessa> i over-complicated things, i see
16:56:06FromDiscord<Yardanico> just remember that this cstring will be a weak reference, so when the original nim string is destroyed, the cstring will become invalid
16:56:13Amun-Rathe less cast you do the better
16:56:13FromDiscord<Yardanico> but most C APIs copy strings you pass to them anyway
16:56:19FromDiscord<Jessa> thank youu
16:56:46FromDiscord<Jessa> In reply to @Yardanico "just remember that this": That's fine, i don't need the string for long anyway
16:56:50FromDiscord<Jessa> good to know for the future, though
16:57:52Amun-RaI prefer explicit type conversions
16:58:30Amun-Raa good rule of thumb is not to cast (intermix) nim and C types
17:00:42FromDiscord<Jessa> explicit ftw↵↵i just still need to learn some functions lol
17:10:26FromDiscord<Phil> Okay, we're getting somewhere with postgres, no longer having instantRows issues
17:12:54FromDiscord<MetuMortis> Is there any better ways than using https://github.com/nim-lang/zip ? I can't compile it on Windows
17:14:26FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hIb
17:15:01FromDiscord<Phil> In reply to @MetuMortis "Is there any better": Personally I use zippy, though mostly for compressing HTML responses
17:15:03FromDiscord<Phil> https://github.com/status-im/nim-zippy
17:15:30FromDiscord<prestosilver> lol was just about to post zippy
17:21:55FromDiscord<πτ (pi man)> so am I not understanding XmlParser properly or is there no way to distinguish between↵<foo key="val">↵and <foo/>
17:22:27FromDiscord<πτ (pi man)> (edit) "key="val">↵and" => "key="val"> (which is then flowed by internal stuff and <foo/>)↵and"
17:22:32FromDiscord<πτ (pi man)> (edit) "<foo/>" => "</foo>"
17:22:38FromDiscord<πτ (pi man)> (edit) "<foo/>)↵and </foo>" => "</foo>)↵and <foo/>"
17:24:06FromDiscord<πτ (pi man)> they both start with xmlElementStart and end with xmlElementEnd
17:36:41pbotfullertonSo fun fact, the new OpenAI ChatGPT thing can write Nim code
17:37:21pbotfullertonAnd gives instructions on how to compile and run at least a "hello world" program
17:39:10pbotfullertonI asked it to write a program that listens on port 8080 and not only did it do so, it used async: https://pastebin.com/yuAHLr2T
17:41:43FromDiscord<Gumbercules> this isn't a fun fact
17:41:46FromDiscord<Yardanico> yes, this isn't new stuff though:) Copilot could do Nim code for some months now, and it uses the Codex OpenAI model
17:42:04FromDiscord<Yardanico> ChatGPT was made based on GPT-3, maybe they also mixed Codex in
17:42:10FromDiscord<Gumbercules> because everyone on the internet has been talking about this thing for a week now
17:43:03FromDiscord<Gumbercules> also your example doesn't compile
17:43:09FromDiscord<Yardanico> https://discord.com/channels/371759389889003530/371759389889003532/1015824985497026590
17:43:16FromDiscord<Require Support> oh man I forgot about copilot
17:43:27FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hIj
17:44:43FromDiscord<πτ (pi man)> I can't use the word `type` for a variable name can I? :mood:
17:44:53FromDiscord<Gumbercules> you can use `type`
17:44:57FromDiscord<Gumbercules> errr
17:45:02FromDiscord<Gumbercules> ``type``
17:45:04FromDiscord<Gumbercules> god damnit
17:45:06FromDiscord<Yardanico> xd
17:45:13FromDiscord<Yardanico> `\`type\``
17:45:14FromDiscord<Yardanico> lol
17:45:15FromDiscord<Gumbercules> I feel like this is a setup
17:45:28FromDiscord<Gumbercules> trick question
17:45:38FromDiscord<Gumbercules> @πτ (pi man) bravo
17:45:50FromDiscord<πτ (pi man)> I have no idea what you guys are tyring to type :LUL:
17:45:58FromDiscord<Gumbercules> ` `type` `
17:46:01FromDiscord<Gumbercules> so type surrounded by backticks
17:46:03FromDiscord<Gumbercules> omg
17:46:05FromDiscord<Gumbercules> discord
17:46:06FromDiscord<Gumbercules> fu
17:46:10FromDiscord<πτ (pi man)> aoh ok
17:46:13FromDiscord<πτ (pi man)> (edit) "aoh" => "ah"
17:46:31FromDiscord<Gumbercules> if you're trying to use a reserved word as a variable / field name
17:46:39FromDiscord<Gumbercules> and the compiler is complaining, backticks are the answer
17:47:09FromDiscord<πτ (pi man)> oh also there was a way to use bitfields wasnt there?
17:47:29FromDiscord<Gumbercules> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-bitsize-pragma
17:47:30FromDiscord<πτ (pi man)> so like the first 10 bits of an int32 as one field and the rest for another field?
17:48:02FromDiscord<πτ (pi man)> and unions use `{.union.}`?
17:48:28FromDiscord<Gumbercules> if you want the fields of the type to be overlaid in memory, yes
17:49:07FromDiscord<Gumbercules> like C's `union`
17:49:10FromDiscord<πτ (pi man)> yes
17:49:13FromDiscord<Yardanico> In reply to @πτ (pi man) "and unions use `{.union.}`?": in most cases you'd just use object variants, but for interfacing with C unions or if you specifically want the same as in C, you use this
17:49:23FromDiscord<πτ (pi man)> In reply to @Yardanico "in most cases you'd": object variants?
17:49:25FromDiscord<Yardanico> Just beware that union won't work for GC'd types
17:49:34FromDiscord<Gumbercules> In reply to @πτ (pi man) "object variants?": algebraic types
17:49:36FromDiscord<Gumbercules> soooo
17:50:01FromDiscord<πτ (pi man)> well I need string, int, customType at least
17:50:11FromDiscord<Gumbercules> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
17:50:40FromDiscord<Yardanico> In reply to @πτ (pi man) "well I need string,": what's `customType`?
17:50:53FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hIp
17:50:55FromDiscord<Yardanico> object variants
17:50:57FromDiscord<Gumbercules> `kind` is a discriminator
17:51:09FromDiscord<Gumbercules> based on its value the field type changes
17:51:13FromDiscord<Gumbercules> it's a sum type or algebraic type
17:51:38FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hIr
17:51:58FromDiscord<Gumbercules> object variants are not going to achieve the same thing as C's `union` or `{.union.}`
17:52:14FromDiscord<Gumbercules> if you're concerned about memory layout in your struct, don't worry about object variants
17:52:18FromDiscord<Gumbercules> they're not going to help you
17:52:26FromDiscord<πτ (pi man)> In reply to @Gumbercules "object variants are not": it looks like a compile time union?
17:53:11FromDiscord<Require Support> In reply to @Yardanico "yes, this isn't new": you tried copilot on nim? is it good?
17:53:21FromDiscord<Yardanico> In reply to @Require Support "you tried copilot on": it's not perfect, but yes, it works
17:53:25FromDiscord<Yardanico> it knows some of nim stdlib
17:53:27FromDiscord<Gumbercules> they're mapped to a union but do not function as C unions
17:53:29FromDiscord<Yardanico> even macros a bit
17:53:51FromDiscord<Require Support> not bad
17:54:00FromDiscord<Gumbercules> it's a tagged union essentially
17:54:04FromDiscord<πτ (pi man)> sent a long message, see https://paste.rs/ua5
17:54:22FromDiscord<Gumbercules> not sure how many other names I can remember for this language feature xD
17:54:33FromDiscord<Gumbercules> if you don't require them to be overlaid in memory
17:54:36FromDiscord<πτ (pi man)> so how does a variant work
17:54:43FromDiscord<Gumbercules> then an object variant should work
17:54:58FromDiscord<Gumbercules> https://en.wikipedia.org/wiki/Tagged_union
17:55:24FromDiscord<Yardanico> In reply to @πτ (pi man) "so how *does* a": but why do you need to know? do you have specific abi requirements?
17:55:39FromDiscord<Yardanico> I mean for the C backend Nim uses C unions for object variants, yes
17:55:42FromDiscord<πτ (pi man)> In reply to @Yardanico "but why do you": I want to know so I can use it correctly
17:55:42FromDiscord<Yardanico> but that's an implementation detail
17:55:50FromDiscord<Yardanico> In reply to @πτ (pi man) "I want to know": you don't need to know to use it correctly
17:56:03FromDiscord<Yardanico> nim object variants are quite high level, you don't have to worry about pointers or casting or whatnot when using them
17:56:11FromDiscord<Phil> Narrowed my error search down.↵So `Error: unhandled exception: Cannot assign requested address [OSError]` appears to be a C error. that occurs when an address (? port?) is busy
17:56:28FromDiscord<Phil> What that has to do with `std/httpclient` I have no idae
17:56:30FromDiscord<Phil> (edit) "idae" => "idea"
17:56:37FromDiscord<πτ (pi man)> In reply to @Yardanico "you don't need to": well I'm not really understanding what they do right now
17:57:23FromDiscord<Yardanico> In reply to @πτ (pi man) "well I'm not really": they allow you to create a type that can hold fields of different types depending on runtime conditions
17:57:32FromDiscord<Yardanico> you can't just say that a function can return type A or B because Nim is compiled
17:57:39FromDiscord<Yardanico> so if types can't be determined at compile time it won't work
17:57:55FromDiscord<Yardanico> and object variants allow you to determine what _case_ (branch) of an object variant you want to use at runtime
17:58:12FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#types-object-variants explains it kind of okay I think
18:00:54FromDiscord<Gumbercules> they're not unique to Nim
18:01:11FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hIt
18:01:27FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4hIt" => "https://play.nim-lang.org/#ix=4hIu"
18:01:42FromDiscord<Require Support> https://forum.nim-lang.org/t/9683↵↵This makes me wanna switch to using threads now 😄
18:02:00FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4hIu" => "https://play.nim-lang.org/#ix=4hIv"
18:02:12FromDiscord<Gumbercules> one doesn't really "switch to using threads"
18:02:25FromDiscord<Gumbercules> and I don't understand the whole "ancient ways of threads" thing
18:04:50FromDiscord<Require Support> most of the time I've been using async just because it's easier and I didn't wanna deal with threads but that project seems interesting
18:05:10FromDiscord<Gumbercules> you generally don't use async and threads for the same workloads
18:05:22FromDiscord<Gumbercules> threads are generally for cpu bound tasks and async is generally for I/O bound tasks
18:05:44FromDiscord<Gumbercules> async requires an event loop which is inherently single threaded
18:06:49*ltriant joined #nim
18:07:40FromDiscord<Phil> I guess the good news is that strictly speaking I don't really need that client get and with it commented out I get further than before
18:07:43FromDiscord<Phil> But still kinda meh
18:07:46FromDiscord<Gumbercules> you can certainly have multiple threads each running an event loop, which is what httpbeast and probably mummy do
18:07:58FromDiscord<Gumbercules> (edit) "do" => "does"
18:08:08FromDiscord<Gumbercules> (edit) "you can certainly have multiple threads each running an event loop, which is what httpbeast ... andas" added "does," | "does" => "as well"
18:08:37FromDiscord<Gumbercules> I haven't looked into mummy's code yet
18:09:01FromDiscord<treeform> httpbeast runs an async event loop per thread
18:09:28FromDiscord<treeform> while mummy runs a single thread as a reactor and then queues up work for handlers
18:10:32FromDiscord<Gumbercules> so it's a thread pool
18:10:38FromDiscord<treeform> In reply to @Gumbercules "threads are generally for": thats the general wisdom yes, but the more we looked into threaded solution the more it looks like threads are just good at IO as well.
18:11:32*ltriant quit (Ping timeout: 248 seconds)
18:11:39FromDiscord<treeform> Async makes you put await, {.async.} and Future[] everywhere - which is annoying. While with threaded code you don't need to do that.
18:11:57FromDiscord<treeform> You still need locks with Async code... so it does not really save you from that.
18:11:57FromDiscord<πτ (pi man)> does nim have a 128 byte integer type?
18:12:04FromDiscord<Yardanico> not in stdlib
18:12:14FromDiscord<Yardanico> There's https://github.com/status-im/nim-stint
18:12:25FromDiscord<Yardanico> also https://github.com/nim-lang/bigints but it's not particularly performant
18:12:29FromDiscord<Require Support> What does `{.raises: [].}` mean
18:12:36FromDiscord<Yardanico> In reply to @Require Support "What does `{.raises: [].}`": that the function can't raise any exceptions at all
18:12:37FromDiscord<Gumbercules> yeah well there's a reason green threads exist
18:12:47FromDiscord<πτ (pi man)> I don't need computation, only storage, so I'll just use two int64s
18:13:03FromDiscord<Gumbercules> OS scheduler does all sorts of fun things when context switching between threads
18:13:26FromDiscord<Gumbercules> one shouldn't pick between threads and async because one requires some extra boilerplate
18:13:41FromDiscord<treeform> In reply to @Gumbercules "yeah well there's a": It also looks like for most workloads, on modern machines, green threads are not needed... regular threads are better supported by the OS and just easier to use.
18:13:41FromDiscord<Gumbercules> that's not really a technically strong reason in my estimation but 🤷
18:13:47FromDiscord<Gumbercules> if you say so
18:14:13Zevvgumbercules
18:14:24FromDiscord<πτ (pi man)> green threads?
18:14:46Zevvi happen to have been working on something recently
18:14:52FromDiscord<treeform> By common wisdom, using async or green threads you should get a benefit... but we just don't see that in real web apps.
18:15:02Zevvif you are interested, i can eloborate
18:15:40FromDiscord<Gumbercules> Zevv: sure - I'm about to be holding a baby but I will try to keep up 🙂
18:15:42FromDiscord<πτ (pi man)> what are green threads?
18:15:45FromDiscord<Gumbercules> software threads
18:15:52FromDiscord<Gumbercules> (edit) "software ... threads" added "/ userland"
18:15:52FromDiscord<πτ (pi man)> software threads?
18:15:56FromDiscord<treeform> In reply to @πτ (pi man) "green threads?": green threads usually refers to user level threads where the user program simulates the real threads to be faster then OS threads.
18:15:58FromDiscord<Gumbercules> just google it
18:15:58FromDiscord<jmgomez> Is it expected that anything that works for Refc does work fine in ORC?
18:15:59Zevvits early work that got started a few weeks after i asked araq about claifications about arc and safe moves
18:16:02FromDiscord<Require Support> is there documentation on threads usage for nim devel / 2.0 ? iirc there was gonna be some changes
18:17:05FromDiscord<treeform> In reply to @Require Support "is there documentation on": I don't know about docs, but Nim 2.0's ORC/ARC and threads on by default is a very good for threaded model.
18:17:12FromDiscord<Gumbercules> green threads / fibers / continuations all refer to basically the same concurrency primitve
18:17:13FromDiscord<treeform> I expect more nim things to use threads in Nim 2.0
18:17:23Zevvwhat i have working now is an early proto, i can basically run millions of "processes" on N threads, scheduling both CPU and IO heavy work
18:17:53Zevvcommunication is done using an actor model that is rather tightly modelled after elixir/erlang OTP processes
18:18:35Zevvi was not sure if i could pull it through the initial huge pains i had, but it seems to go the right way
18:19:00Zevvits share-nothing multithreading, so no locks, waitconds, and other pita
18:19:16Zevvbut we rely on nim to "safely" move data along
18:19:18FromDiscord<Require Support> oh now I remember, it wasn't threads it was `std/tasks` that was gonna be new for Nim 2
18:19:31FromDiscord<Gumbercules> like channels?
18:19:48Zevva channel is nothing but a waitcond and a dequque, so yes
18:20:09FromDiscord<Gumbercules> sounds like ni m's original memory model
18:20:11FromDiscord<πτ (pi man)> so what's the difference between green threads and async?
18:20:14FromDiscord<Gumbercules> with thread local heaps
18:20:22Zevvthe problem is that nim has a hard time keeping promises about isolation
18:21:38Zevvmy conclusion was that nim misses some essential mechanics to do this propery, but when careful, things *can* be done
18:21:51FromDiscord<Gumbercules> In reply to @πτ (pi man) "so what's the difference": async uses green threads
18:22:28FromDiscord<πτ (pi man)> oh, so async is just a type of green thread then? that makes sense
18:22:32FromDiscord<Gumbercules> hno
18:22:34FromDiscord<Gumbercules> no
18:22:50FromDiscord<Gumbercules> 1 sec holdin babby
18:24:47FromDiscord<Gumbercules> this requires an understanding of the difference between concurrency and parallelism
18:24:55Zevvalso, event loops are not inheritely single threaded. I can dedicate N actors to watching fd/socket events, and have these run on N threads sharing the work
18:25:35FromDiscord<Gumbercules> sure but then it's parallelizing work and not scheduling it concurrently
18:26:03FromDiscord<Gumbercules> concurrency is splitting work across a single CPU core - so sharing the CPU core and doing work when the CPU has cycles to do it
18:26:13FromDiscord<Gumbercules> once you enter the territory of threads you're talking about parallelizing work
18:26:19FromDiscord<Gumbercules> and spreading it across multiple CPU cores
18:26:34FromDiscord<Gumbercules> I mean I know you know all of this Zevv I'm just trying to provide context for @πτ (pi man)
18:26:50FromDiscord<Gumbercules> async is just a pattern where you have an event loop and a scheduler
18:27:04Zevvsure. in 2022 i dont undestand how people even are considering concurrency without parallelism
18:27:13FromDiscord<Gumbercules> the scheduler is responsible for scheduling work typically on a single core
18:27:21FromDiscord<Gumbercules> or historically
18:27:22Zevveven my 5yo phone has 20 cores
18:27:41FromDiscord<Gumbercules> NodeJS for instance uses a single thread in its event loop
18:27:48FromDiscord<Gumbercules> unless things have changed recently
18:29:54Zevvthere is a very important difference between 'async/concurrent' and paralellism
18:30:15Zevvin the first, you basically don't have to think about your world being mutable by others while your program is running
18:30:25Zevvyou are scheduling/yielding at discrete points in your code
18:30:30Zevvin between, all invariants hold
18:30:35FromDiscord<Gumbercules> this is why Nim's original memory model was able to be so fast and garbage collected
18:30:36Zevvwhich make programmers happpy
18:30:46Zevvwhen you go full threading, you suffer.
18:31:12Zevvyou need to sit on your locks, thing a thousand times harder about your data models
18:31:22Zevvand the pain only begins when things do *not* work as expected
18:31:28Zevvthreading is *hard*
18:31:34FromDiscord<treeform> AMD just announced a 96 core 192 thread server CPU, you can get like two fo them in a motherboard
18:31:36Zevvasync/concurrency is almost life as you know it
18:31:53FromDiscord<Gumbercules> @πτ (pi man) here is my fiber based job system for my game engine
18:31:53FromDiscord<treeform> Soon we will have 384 cores...
18:31:55FromDiscord<treeform> we need to use them
18:32:00FromDiscord<Gumbercules> if you want to see fun with threads and fibers (green threads)
18:32:05ZevvIMHO the only sane way to do multithreading is by not sharing data, or have something do it for you
18:32:08Zevvunder the hood
18:32:22FromDiscord<Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/src/job.nim
18:32:46ZevvI think golang, pony, elixir/erlang have seen the light. These languages know how to do it
18:33:03FromDiscord<Gumbercules> for non realtime stuff sure
18:33:18FromDiscord<Gumbercules> for realtime / soft realtime systems you generally don't have a choice
18:33:25Zevvif you want hard real time, you don't
18:33:35Zevvbut then again, with nim there is this far away promise
18:33:40Zevvthat without a GC we could do things better
18:33:44Zevvwe have arc these days.
18:33:53Zevva shared heap
18:34:05Zevvand movable data, that will currently kill you if you move it wrong
18:34:40Zevvbut the thing i'm currently working on is waht i've been looking for for a few years
18:34:53ZevvI kind of left nim, but returned recently, because I missed the fun of the language itself
18:35:00Zevvbut it has such a /baaahd/ multithreading story
18:35:18Zevvyou can't have a proper language at this time and not have a proper story about how to efficently use your cores
18:38:20Zevvanyhow, got a social call. If anyome might be interested in chatting about these subjects, let me know, I'm game
18:38:35ZevvI could do with some rightful critique and eyes on my first implementation
18:41:11FromDiscord<πτ (pi man)> In reply to @Zevv "but it has such": as long as it has threads and has semaphors/mutexs/synchronization that's all I really ask for
18:41:53Zevvtoo bad, it has threads, but it has no semaphores,mutexes or other synchronization
18:42:17FromDiscord<πτ (pi man)> so there's no way to prevent concurrent execution?
18:42:37Zevvjust do not share data between processes. Ever.
18:42:45Zevvyou pass it around so it is owned by one process at a time
18:42:46FromDiscord<πτ (pi man)> between processes or threads
18:42:52Zevvthese are abstracted away
18:43:03ZevvI run millions of processes on a handful of threads
18:43:30Zevvdata is moved, but there is always only one reference to this data at any time, which is always in one process at a time
18:43:30FromDiscord<πτ (pi man)> what? processes run threads though, not threads running processes
18:43:51Zevvit's not a process or a thread or a fiber, it needs a different name
18:43:58Zevvi've called it an Actor for now
18:44:06Zevvwhich is the somewhat scienitfic name for this kind of thing
18:44:16FromDiscord<πτ (pi man)> also what do you mean passing around?
18:44:37ZevvIf you have data on the heap, you typically have a pointer somewhere to access this data
18:44:40Zevvthat lives in your ref
18:44:43FromDiscord<πτ (pi man)> afaik the only thing a thread owns is it's stack
18:44:52Zevvright. And we have done away with the stack
18:45:20Zevvthe stack gets abstracted away and goes into a thing called an 'environment', which is a little bag of memory that lives on the heap
18:45:31Zevvwith real threads, one of the problems is that you need large stacks
18:45:45Zevvbecause your local flow control and local variasbles will grow and shrink your stacks.
18:46:05Zevvyou can't tell in advance how big is 'big enough', if you choose your stacks too small you run out and go down
18:46:14Zevvor you leave it to the OS, an that is when you call it a thread
18:46:33Zevvbut real threads are expensive. You would not choose to run single thread for every connection on a busy server, for example
18:46:45Zevvbut you can spawn actors like mad, they cost a few hundred bytes each
18:47:13Zevvthey get scheduled on a low number of threads, which would typicallly be somewhere twice your number of cores or so
18:47:35Zevvthat is how go and erlang do it
18:48:04FromDiscord<Gumbercules> back - had some chores to do and needed to start a bottle for that baby
18:48:15Zevverlang can do it because programs are basically ran on a VM, on which it is easy to 'schedule away'
18:48:24Zevvon erlang they do not have the shared memory problem because it is fully FP
18:48:28FromDiscord<guttural666> can I loop over the fields of a typedesc(object) and get the field names?
18:48:31Zevveveryting is readonly / unmutable by default
18:49:15FromDiscord<Bung> can I casting type without check ?
18:49:55FromDiscord<Gumbercules> well you can implement your own semaphores, spinlocks, mutexes, etc... it's not difficult
18:50:09FromDiscord<Gumbercules> but I mean, you also need to know and understand what you are doing
18:50:36Zevvbut in practice, do you /choose/ to use multithreading using semaphores mutexes etc?
18:50:49Zevvis that a model that scales and makes your code better and you happier as a programmer?
18:51:04FromDiscord<Gumbercules> if you're writing a game engine in C/C++ or Nim, I'd say yes
18:51:15Zevvbecause, I am past emberassement, I have decades ago decided that I am not smart enough to properly write multithreaded code like that
18:51:17FromDiscord<Gumbercules> if you're writing a web application server, probably not
18:51:33FromDiscord<πτ (pi man)> honestly java's `synchronize` is the best thread protection imo that i've come across
18:51:47FromDiscord<Gumbercules> I mean there is reading material out there on the subject matter
18:51:57FromDiscord<Gumbercules> and plenty of example code from people that know what they are doing
18:52:07Zevvπτ (pi man): I invite you to have a look on the other side of the play field, take a few days to dive into golang if you have not done taht yet
18:52:10Zevvor even better, elixri
18:52:19FromDiscord<Gumbercules> I use Elixir at work but I'd never write a game in Elixir
18:52:25FromDiscord<Gumbercules> the backend for a multiplayer game - sure
18:52:28FromDiscord<Gumbercules> but never a gamem client
18:52:31FromDiscord<Gumbercules> (edit) "gamem" => "game"
18:52:35FromDiscord<πτ (pi man)> I think I looked at golang once and decieded I probably wouldn't like it
18:52:49ZevvI hate the language
18:52:53Zevvbut boy do I *love* the runtime
18:53:03Zevvyou just do 'recv()'
18:53:08Zevvtadaaa
18:53:16Zevvit just does what you ask it
18:53:26FromDiscord<πτ (pi man)> `recv()`?
18:53:26Zevv*that is how I want to do my multithreading
18:53:33Zevvreceive on a socket, for example
18:53:41ZevvIt's typically a blocking call on your OS
18:53:52Zevvblocking calls are bad, right.
18:54:03Zevvso either you go threaded, and get all the pain of managing your shared memory
18:54:11Zevvor you go async, and suffer burning 1 of yor 96 cores
18:56:34Zevvanyway, that's just my $0.02, sorry for my rambling and ranting.
18:57:21NimEventerNew post on r/nim by Akronae: Is anybody using snake case?, see https://reddit.com/r/nim/comments/zci3nd/is_anybody_using_snake_case/
18:59:16FromDiscord<πτ (pi man)> sent a long message, see http://ix.io/4hIQ
19:00:50FromDiscord<Require Support> hey it was a good rant, as a newcomer I've learned from it 😄
19:01:08FromDiscord<guttural666> how can I loop over the fields of a typedesc(object) and get the field names?
19:01:11FromDiscord<πτ (pi man)> rants like this are almost always welcome imo
19:01:19FromDiscord<Gumbercules> these memory and concurrency models are great but they just aren't useful in certain contexts
19:02:24FromDiscord<Gumbercules> generally thick client performance sensitive applications are going to avoid message passing and the overhead they'd incur
19:04:14FromDiscord<Gumbercules> https://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine is a good talk
19:04:34FromDiscord<QuiteQuietQ> is there a builtin way to check if a range is a subrange of other range? ↵e.g. `2..3 in 1..4` would return `true` ?
19:06:05arkanoiddo you know how to select interpolation method in pixie?
19:06:19arkanoidI'm getting bilinear or something, I want pixel
19:07:08FromDiscord<Gumbercules> In reply to @guttural666 "how can I loop": this is better done via macros
19:07:22FromDiscord<Gumbercules> see the note at the top of this module's docs: https://nim-lang.org/docs/typeinfo.html#fields.i%2CAny
19:08:01FromDiscord<guttural666> In reply to @Gumbercules "this is better done": I remember there was a way with an object instead of a typedesc, but I can't remember how that works
19:08:10FromDiscord<Gumbercules> In reply to @QuiteQuietQ "is there a builtin": you could use sets
19:08:37FromDiscord<Gumbercules> In reply to @guttural666 "I remember there was": Not sure - I think macros are the best approach here regardless
19:09:17FromDiscord<Gumbercules> Nim doesn't really focus on RTTI because of its metaprogramming capabilities and ability to inspect and modify the program's AST at compile time
19:10:54FromDiscord<Gumbercules> https://nim-lang.org/docs/system.html#contains%2Cset%5BT%5D%2CT
19:11:01FromDiscord<Gumbercules> @QuiteQuietQ ^
19:12:50FromDiscord<demotomohiro> @guttural666 You can use: https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT
19:13:22FromDiscord<QuiteQuietQ> In reply to @Gumbercules "https://nim-lang.org/docs/system.html#contains%2Cse": this checks if a single element is in a set, not set in set↵is there something else than sets? like an operator? if no, i will create my own
19:13:40FromDiscord<huantian> In reply to @QuiteQuietQ "is there a builtin": No, you have to write one yourself
19:13:45FromDiscord<Gumbercules> not to my knowledge
19:13:45FromDiscord<huantian> Quite easy though
19:14:06FromDiscord<πτ (pi man)> huh?↵how does an enum named `BACOID` redefine an object type named `BACoid`?
19:14:07FromDiscord<guttural666> In reply to @demotomohiro "<@375727321958580228> You can use:": yes, that was it, thanks for reminding me
19:14:19FromDiscord<huantian> Just make a contains proc for HSlice[int, int] and you can use int
19:14:22FromDiscord<huantian> (edit) "int" => "in"
19:15:38FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hIX
19:16:41FromDiscord<demotomohiro> @πτ (pi man) Nim is style insensitive: https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality
19:17:08FromDiscord<πτ (pi man)> wtf
19:17:15FromDiscord<Gumbercules> lol, new that was coming
19:17:24FromDiscord<πτ (pi man)> that makes no sense
19:17:45FromDiscord<demotomohiro> So `BACoid` and `BACOID` are same identifier
19:18:24FromDiscord<πτ (pi man)> great, so I need to append `_TYPE` to all my enums? that's annoying
19:18:52FromDiscord<Gumbercules> no
19:18:55FromDiscord<Gumbercules> get creative
19:19:26FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hIY
19:19:37FromDiscord<demotomohiro> This is why Nim is style insensitive: https://github.com/nim-lang/Nim/wiki/Unofficial-FAQ#why-is-it-caseunderscore-insensitive
19:19:49FromDiscord<Gumbercules> I rarely use enums though since I do so much C interop - mostly `distinct unit32` to represent enums
19:19:56FromDiscord<Gumbercules> (edit) "unit32`" => "uint32`"
19:21:57FromDiscord<Gumbercules> and unless you make your enum `{.pure.}` if that's still a thing, you can just use the member names without any qualification
19:22:20FromDiscord<Gumbercules> you don't need to do like - `DataType.dtString` you can just use `dtString`
19:22:44FromDiscord<Gumbercules> but adding a prefix before the enum member name allows the reader to easily disambigiuate which member the enum belongs to
19:22:51FromDiscord<Gumbercules> (edit) "disambigiuate" => "disambiguate"
19:23:18FromDiscord<πτ (pi man)> sent a long message, see http://ix.io/4hJ0
19:23:44FromDiscord<Gumbercules> I've been coding in Nim since 2015 - you get over it quickly, trus tme
19:23:47FromDiscord<Gumbercules> (edit) "trus tme" => "trust me"
19:23:56FromDiscord<Phil> In reply to @πτ (pi man) "that makes no sense": Imagine you're a python dev and use my lib. You want to do snake-case, while I insist on CamelCase.↵Do you want to use my 500 procs allgoing camel case?
19:24:05FromDiscord<Phil> (edit) "allgoing" => "all going"
19:24:24FromDiscord<Phil> I've been told it's also pretty nice for C-interop but so far I'm staying far away from that
19:24:35FromDiscord<πτ (pi man)> In reply to @Isofruit "Imagine you're a python": I already said this condition "makes sense"
19:24:52FromDiscord<Gumbercules> I don't know if Id say it's nice for C interop
19:25:03FromDiscord<Gumbercules> I mean if you have a function in C named `hello_world`
19:25:05FromDiscord<πτ (pi man)> C is case sensitive, how would this help?
19:25:34FromDiscord<Gumbercules> and you `{.importc: "helloWorld".}`
19:25:40FromDiscord<Yardanico> In reply to @Gumbercules "and you `{.importc: "helloWorld".}`": ?
19:25:42FromDiscord<Yardanico> that won't work
19:25:48FromDiscord<Gumbercules> sorry
19:26:01FromDiscord<Gumbercules> `proc helloWorld() {.importc.}`
19:26:06FromDiscord<Gumbercules> it's going to import `hello_world`
19:26:13FromDiscord<Gumbercules> well - at least allow you to call into it
19:26:37FromDiscord<Gumbercules> so, I mean yes it's nice in that you don't have to name your functions like their C alternatives
19:26:50FromDiscord<Gumbercules> but this is why `proc helloWorld() {.importc: "hello_world".}` exists
19:26:53FromDiscord<Gumbercules> so you can be explicit about the import
19:27:28FromDiscord<Gumbercules> lack of sleep killing my brain
19:27:34FromDiscord<Gumbercules> damn babby
19:27:49FromDiscord<Yardanico> In reply to @Gumbercules "it's going to import": again, no, you need sleep :P
19:28:00FromDiscord<Yardanico> importc uses the Nim function name if you didn't provide the name
19:28:14FromDiscord<Yardanico> what you mean is that you can do `proc hello_world() {.importc.}` and use it as `helloWorld()`
19:28:17FromDiscord<Gumbercules> yes
19:28:21FromDiscord<Gumbercules> this
19:28:21FromDiscord<Gumbercules> thank you
19:28:26arkanoidI am reading jsons with jsony. Each json has a "type" field that I can use to wrap my type system. Problem is that I have not yet found a procedural solution, but just a OOP solution with dynamic dispatch. The limitation seems rooted on this https://github.com/nim-lang/RFCs/issues/368 that doesnt let me use object variants
19:28:38FromDiscord<Gumbercules> and yes I do - I can't though 😭
19:28:57FromDiscord<Gumbercules> have a baby they said, it'd be fun they said! - actually I don't think anyone said this
19:29:07arkanoiddo I have better alternatives to avoid dynamic dispatch?
19:29:22FromDiscord<Yardanico> In reply to @arkanoid "I am reading jsons": That RFC won't help you because as I assume you would want to assign the same field name to different types
19:29:27FromDiscord<Yardanico> in different branches
19:29:34FromDiscord<Yardanico> this RFC only covers same field name with same type in different branches
19:30:08FromDiscord<Yardanico> and well, there's no "alternative" since object variants are also dynamic dispatch, but you can abstract stuff away with macros/templates to make your code nicer to work with
19:30:18FromDiscord<πτ (pi man)> In reply to @Gumbercules "have a baby they": my mom keeps saying she wants grandchildren↵~~but I don't even have a gf and my sister is trans~~
19:30:39FromDiscord<Gumbercules> well we were blursed with one at the ripe ages of 37 and 38
19:30:40arkanoidYardanico, exactly, I would need an object variant that reflects the json structure I receive, but shared names among only some "types" and not others and the inflexibility of object variants makes them not usable in this context
19:30:53FromDiscord<Gumbercules> we wanted one, but my goodness they are work!
19:31:07FromDiscord<Gumbercules> and they don't like programming for whatever weird reason
19:31:42FromDiscord<Gumbercules> then again, neither do I really so I can't blame them
19:33:06FromDiscord<πτ (pi man)> ugh, I swear this xml parser is causing more issues than writing my own would
19:34:11FromDiscord<Gumbercules> which one?
19:34:59FromDiscord<πτ (pi man)> XmlParser
19:36:45FromDiscord<Gumbercules> isn't https://nim-lang.org/docs/parsexml.html the one most folks use?
19:37:47FromDiscord<Gumbercules> the module I mean - I realize the former utilizes the latter
19:38:02FromDiscord<πτ (pi man)> that's the one I'm using
19:38:17FromDiscord<πτ (pi man)> XmlParser is the object
19:38:42FromDiscord<Gumbercules> gotcha
19:38:57FromDiscord<Gumbercules> I don't do much XML parsing thankfully so I haven't had to dive into those modules anytime recently
19:39:14FromDiscord<πτ (pi man)> I can't tell the difference between `>` and `/>`
19:39:28FromDiscord<πτ (pi man)> they both parse as `xmlElementEnd`
19:39:35FromDiscord<πτ (pi man)> but mean different things
19:39:45FromDiscord<Gumbercules> `xmlElementClose`
19:40:02FromDiscord<πτ (pi man)> `xmlElementCose` parses `</name>`
19:40:05FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hJ6
19:40:06FromDiscord<Gumbercules> heh
19:40:13FromDiscord<Yardanico> In reply to @πτ (pi man) "I can't tell the": do you want to parse xml into tokens or ready-to-use tree?
19:40:35FromDiscord<πτ (pi man)> In reply to @Yardanico "do you want to": either, though ready to use tree would be more useful
19:40:43FromDiscord<Yardanico> are you using the parsexml module?
19:40:46FromDiscord<πτ (pi man)> yes
19:40:52FromDiscord<Yardanico> then you need to use a different one
19:40:56FromDiscord<Yardanico> https://nim-lang.org/docs/xmltree.html
19:40:59FromDiscord<Yardanico> see https://nim-lang.org/docs/xmlparser.html
19:41:01FromDiscord<πτ (pi man)> or write my own parser
19:42:57FromDiscord<πτ (pi man)> I just need to get the data out of the xml file
19:43:58FromDiscord<Yardanico> just use xmlparser
19:44:28FromDiscord<Gumbercules> https://github.com/OpenSystemsLab/q.nim ooo
19:44:36FromDiscord<Gumbercules> not suggesting you use this, but this looks nice
19:45:01FromDiscord<Horizon [She/Her]> I despise webdev so much
19:45:15FromDiscord<Gumbercules> I'm a card carrying member of that club as well
19:45:38FromDiscord<Gumbercules> https://forum.nim-lang.org/t/9687
19:45:46FromDiscord<Horizon [She/Her]> Using Nim for my project because it's so much more familiar than JS and it's allowing me to structure it exactly how i want
19:46:23FromDiscord<πτ (pi man)> I don't want to query the xml, I need to extract all the data out of it
19:46:32FromDiscord<Gumbercules> @exelotl I think it's fine for NimForum to exist I'd just rather it not be the software behind forum.nim-lang.org
19:46:39FromDiscord<Gumbercules> but I've beaten this horse to death, and then some
19:47:04FromDiscord<Gumbercules> In reply to @πτ (pi man) "I don't want to": I understand
19:47:37FromDiscord<Gumbercules> In reply to @Event Horizon "Using Nim for my": I plan on using elixir for my project's backend - no idea what I will use for JS. I'm hoping I have to write very little to none
19:47:46FromDiscord<Phil> In reply to @Event Horizon "I despise webdev so": Yeah but you got to be specific my guy
19:47:55FromDiscord<Phil> why do you hate webdev?↵There's so many valid reasons!
19:48:47FromDiscord<Gumbercules> I should correct myself - I loathe modern web development
19:48:49*ofelas joined #nim
19:49:00FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "I plan on using": Fair haha
19:49:11FromDiscord<Gumbercules> when people weren't obsessively overengineering everything
19:49:17FromDiscord<Gumbercules> because they had nothing better to do / didn't know any better
19:50:11FromDiscord<Horizon [She/Her]> In reply to @Isofruit "*why* do you hate": I hate webdev because JS is bloated, it's not suitable for sites nowadays because it has little to no structure, and then you also have to worry about supporting an eons old browser for Sharon on Windows 95 lmao
19:50:16FromDiscord<Gumbercules> and people weren't making horrible engineering decisions left and right so they could write some shitty blog post about how they made some todo react app
19:50:41FromDiscord<Horizon [She/Her]> Also, HTML and CSS feels like it needs to be revamped, but none of it is as bad as JS, imo
19:50:59FromDiscord<Gumbercules> I mean JS is the assembly language of the web
19:51:03FromDiscord<Phil> In reply to @Event Horizon "I hate webdev because": Oh yeah, the entire no-typing is just pure hell
19:51:08FromDiscord<Gumbercules> JS has types
19:51:12FromDiscord<Gumbercules> just weak types
19:51:30FromDiscord<Phil> In reply to @Gumbercules "JS has types": If you don't have a compiler that complains to me that my type is wrong, you have no types to me
19:51:41FromDiscord<Gumbercules> well that's static type checking
19:51:42FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "I mean JS is": It's horrid xD
19:51:54FromDiscord<Gumbercules> Python has types too - and it is a strongly typed language
19:51:57FromDiscord<πτ (pi man)> wasm
19:51:59FromDiscord<Horizon [She/Her]> Was created in 10 days iirc, and then now so much stuff is being put onto it
19:52:05FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "Python has types too": Typehinting
19:52:20FromDiscord<Gumbercules> well no it has actual types
19:52:25FromDiscord<Horizon [She/Her]> In reply to @πτ (pi man) "*wasm*": Sad thing about WASM is that file sizes get big and support isn't all the way there yet
19:52:42FromDiscord<Gumbercules> it's just the interpreter won't care if you mess them up
19:52:57FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "well no it has": Ah yeah i know that, but not really enforced unless you do an operation requiring a specific method
19:53:00FromDiscord<Gumbercules> there's some python addon that adds compile time type checking kind of
19:53:02FromDiscord<Horizon [She/Her]> Ducktyping is what it has
19:53:05FromDiscord<Phil> And the interpreter caring is what makes JS/Python painful to deal with
19:53:07FromDiscord<Gumbercules> yes
19:53:32FromDiscord<Gumbercules> I don't find JS all that awful - then again I've been coding in it for a long time
19:53:34FromDiscord<Phil> (edit) "interpreter" => "interpreter/JIT compiler or whatnot not"
19:53:44FromDiscord<Gumbercules> I just don't enjoy coding in it more because of the environment and ecosystem
19:53:51FromDiscord<Gumbercules> and well, I'm not making browser games
19:54:34FromDiscord<Phil> I've been coding in it for the last 3 years and its just... not for me.↵I enjoy aspects of it.↵The functional aspects of it are nice, tooling in it has made me appreciate Dependency Injection all the more
19:54:44FromDiscord<Gumbercules> would be nice to see more jQuery out in the wild and less react / vue / svelte / karax / whatever
19:54:56FromDiscord<Phil> But generally working with JS is a whole lot of bleh.
19:55:03FromDiscord<Horizon [She/Her]> In reply to @πτ (pi man) "*wasm*": Though, I believe it could be a solution to supporting (future) legacy browsers, because if all you needed was a minimal API for direct-access to the browser internals, that WASM could be shipped with, you could update the browser's JS runtime like a package (of course, WASM ran by websites wouldn't be able to access said APIs)
19:55:14FromDiscord<Gumbercules> wasm still has a long way to go
19:55:17FromDiscord<Phil> I'll take any react/vue/svelte whatever over any jquery any day of the week any time
19:55:23FromDiscord<Gumbercules> why?
19:55:26FromDiscord<Gumbercules> jquery is stupid simple
19:55:35FromDiscord<Phil> Because the testing to be done with them is going to be so much better
19:55:38FromDiscord<Gumbercules> and it does the job in almost every situation
19:55:44FromDiscord<πτ (pi man)> idk any of this cause I don't do web dev
19:55:55FromDiscord<Gumbercules> why? you can easily write unit tests for jquery if you're so inclined
19:56:27FromDiscord<Gumbercules> you can probably even use Jest or some other bs to do it
19:56:34FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "wasm still has a": Definitely, but I believe it has a place in the web in some places
19:56:39FromDiscord<Phil> After having done testing in Angular, the fact that you have a chance to completely set up your entire test environment so you can get rid of any interference from non-test-code made my life significantly easier when dealing with brownfield projects
19:56:43FromDiscord<Horizon [She/Her]> Even outside of the web
19:56:46FromDiscord<Gumbercules> I'd rather have a slim <100kb JS file to serve my app than an entire framework
19:57:28FromDiscord<Gumbercules> In reply to @Event Horizon "Definitely, but I believe": well it will once they get the safety issues worked out and support multiple threads
19:57:40FromDiscord<Gumbercules> until then it's basically flash
19:57:47FromDiscord<Horizon [She/Her]> What safety issues does it have right now? I wasn't aware of that
19:58:08FromDiscord<Gumbercules> Oh I guess they added threads
19:58:12FromDiscord<Horizon [She/Her]> Threading has a proposal already, not sure if it's anywhere near close to being included tho
19:58:16FromDiscord<Horizon [She/Her]> Yeah
19:58:26FromDiscord<Gumbercules> yeah vendor implementation is another horrible thing about the web / wasm
19:58:31FromDiscord<Gumbercules> webgpu too
19:58:44FromDiscord<Horizon [She/Her]> You mean the WASM runtime in the browser?
19:59:17FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hJa
19:59:19FromDiscord<Gumbercules> just what browsers will support what features of the runtime at any point in time
19:59:23FromDiscord<Horizon [She/Her]> Probably because they do AOT compilation for whatever runtime they use, ik wasm3 is just a WASM interpreter without any fancy speed boosts
19:59:25FromDiscord<Gumbercules> https://www.usenix.org/system/files/sec20-lehmann.pdf
19:59:35FromDiscord<Gumbercules> this is from 2020
19:59:39FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "just what browsers will": Ah fair
19:59:41FromDiscord<Gumbercules> not sure how much still applies but I'm pretty sure a fair bit
19:59:57FromDiscord<πτ (pi man)> now I just have to figure out how to move through the Xml tree cause there is no documentation on that
20:01:33FromDiscord<Gumbercules> running external code in the browser is just a nightmare
20:01:55FromDiscord<Gumbercules> flash, silverlight, activeX all these technologies did it at one point and they all ended up dying for the same reasons
20:02:29FromDiscord<Gumbercules> and https://wasmer.io/ is the same idea again
20:02:48FromDiscord<Horizon [She/Her]> Fair
20:03:16FromDiscord<πτ (pi man)> In reply to @Gumbercules "running external code in": sounds like a security nightmare
20:03:17FromDiscord<Gumbercules> but I mean - I think it's cool as hell still
20:03:40FromDiscord<Gumbercules> https://github.com/zacharycarter/zengine ran in the browser via emscripten + wasm
20:03:54FromDiscord<Gumbercules> and that's precisely when I stopped working on it xD
20:04:04FromDiscord<Horizon [She/Her]> Even if it's not used to run untrusted code from websites, could defintiely be used for what i said earlier (WASM implementations of JS runtimes, or other browser internals, so even if it stops getting maintained, as long as an API is followed, it could be updated/reimplemented in the future)
20:04:16FromDiscord<Gumbercules> sure
20:08:52FromDiscord<demotomohiro> I hope no one recreate ActiveX
20:09:02FromDiscord<spaceLobster> sent a long message, see http://ix.io/4hJf
20:09:49FromDiscord<Gumbercules> because the value you're passing to the subscript operator must be static
20:09:59FromDiscord<Gumbercules> in other words, known at compile time
20:10:19FromDiscord<Gumbercules> although
20:10:19FromDiscord<spaceLobster> .. <- subscript operator?
20:10:27FromDiscord<Gumbercules> I'm not really sure what you're trying to do here
20:10:41FromDiscord<spaceLobster> Im trying to fil an array with a range from say 1 to 5
20:11:04FromDiscord<spaceLobster> and then make it into a hashset
20:12:33FromDiscord<πτ (pi man)> arrays have compile time lengths
20:12:38FromDiscord<πτ (pi man)> (afaik)
20:13:49FromDiscord<spaceLobster> I thought they had to have alength only when instantiated
20:14:11FromDiscord<Gumbercules> what does your input data look like
20:14:16FromDiscord<Gumbercules> "1-2-3,4-5-6"?
20:14:34FromDiscord<spaceLobster> almost ... 1-2,3-4
20:14:35FromDiscord<Gumbercules> no wait...
20:14:37FromDiscord<Gumbercules> thanks
20:14:45FromDiscord<πτ (pi man)> if you want length determined at runtime use a seq I think
20:19:59FromDiscord<demotomohiro> !eval import std/[sets, sequtils]; echo toSeq(1..4).toHashSet
20:20:04NimBotCompile failed: {3, 4, 2, 1}
20:21:49FromDiscord<Gumbercules> sorry I had to go attend to something
20:22:01FromDiscord<Gumbercules> but uh, yeah what @demotomohiro said - `split` is already going to return a sequence anyway
20:22:13FromDiscord<Gumbercules> of strings - so you could do something like
20:23:37FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hJj
20:23:51FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4hJk
20:24:15FromDiscord<πτ (pi man)> how do I get a ref of an object?
20:24:21FromDiscord<Gumbercules> you dont
20:24:22FromDiscord<πτ (pi man)> or do I need to use ptr?
20:24:30FromDiscord<Gumbercules> you can either use pointer or you can box the object
20:24:34FromDiscord<Gumbercules> so something like
20:24:49FromDiscord<πτ (pi man)> actually wait, nvm I can do something else
20:25:15FromDiscord<demotomohiro> `parseInt("3")..parseInt("7")` is iterator and `toSeq`create a seq from it.
20:26:52FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hJl
20:26:55FromDiscord<Gumbercules> my advice - don't fear pointer
20:27:02FromDiscord<Gumbercules> or `ptr T`
20:27:15FromDiscord<Gumbercules> ymmv
20:27:36FromDiscord<πτ (pi man)> how do I insert a default element to a table?
20:27:44FromDiscord<demotomohiro> @πτ (pi man) Or copy content of an object to ref object like `myRefObj[] = myObj`. `myRefObj` must not be nil.
20:28:17FromDiscord<Gumbercules> In reply to @πτ (pi man) "how do I insert": what do you mean?
20:28:41FromDiscord<Gumbercules> like - try to retrieve a value from it and if it doesn't exist, return a default instead?
20:28:57FromDiscord<πτ (pi man)> I have this↵`objects[currObject].metasysRef = val`↵but objects[currObject] doesn't exist yet so it gives an error
20:29:14FromDiscord<Gumbercules> `getOrDefault`
20:29:39FromDiscord<Gumbercules> `getOrDefault(objects, currObject, "default goes here")
20:29:41FromDiscord<Gumbercules> (edit) "here")" => "here")`"
20:29:50FromDiscord<demotomohiro> https://nim-lang.org/docs/tables.html#getOrDefault%2CTable%5BA%2CB%5D%2CA%2CB
20:30:04FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hJn
20:30:18FromDiscord<Gumbercules> well Nim ain't C++
20:30:20FromDiscord<Gumbercules> for better or worse
20:30:21FromDiscord<πτ (pi man)> (edit) "https://play.nim-lang.org/#ix=4hJn" => "https://play.nim-lang.org/#ix=4hJo"
20:30:32FromDiscord<Gumbercules> probably better
20:30:32FromDiscord<πτ (pi man)> right, that's why i'm asking how to do it
20:30:34FromDiscord<Gumbercules> but 🤷
20:30:42FromDiscord<Gumbercules> yeah - Nim doesn't really have any shorthand syntax like that
20:30:49FromDiscord<Gumbercules> but it would be easy enough to do with a macro
20:30:58FromDiscord<Gumbercules> maybe even a template
20:31:03FromDiscord<πτ (pi man)> getOrDefault should work if it adds it to the table
20:31:24FromDiscord<Generic> nah you can use hasKeyOrPut
20:31:33FromDiscord<Generic> (edit) "hasKeyOrPut" => "mgetOrPut"
20:31:44FromDiscord<πτ (pi man)> or I make a proc to return a default instance of BACnetObject I guess
20:32:16FromDiscord<Generic> `objects.mgetOrPut(currObject, default(whatevertype)).field = 42
20:32:20FromDiscord<Generic> (edit) "42" => "42`"
20:32:39FromDiscord<πτ (pi man)> In reply to @πτ (pi man) "normally I would do": oh, there's a default keyword?
20:32:52FromDiscord<πτ (pi man)> (edit) "In reply to @πτ (pi man) "normally I would do": oh, there's a default keyword? ... " added "(woops that was not supposed to still be reply lol)"
20:33:00FromDiscord<Generic> also that should work
20:33:07FromDiscord<Generic> `[]=` != `[]` in Nim
20:33:27FromDiscord<Generic> `[]=` does create new fields in Nim
20:33:36FromDiscord<πτ (pi man)> so I can do `objects[currentObject] = default(BACnetObject)`?
20:33:40FromDiscord<Generic> yes, that works
20:33:49FromDiscord<πτ (pi man)> that's what I was looking for then, thanks
20:33:56FromDiscord<Generic> `objects[currentObject].field = uiae`
20:34:05FromDiscord<Generic> doesn't though, if currentObject doesn't exist yet in the table
20:34:21FromDiscord<Generic> then you have to use mgetOrPut
20:34:29FromDiscord<πτ (pi man)> yes, I wasn't really expecting it to work, but I didn't know how else to try and put the object into the table
20:34:50FromDiscord<πτ (pi man)> (because I know for a fact that it doesn't yet exist)
20:34:53FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hJq
20:35:38FromDiscord<πτ (pi man)> and Nim not having constructors I wasn't sure how to get a default object inline
20:36:17FromDiscord<Gumbercules> taking things a step further
20:36:22FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hJt
20:37:00FromDiscord<Horizon [She/Her]> What exceptions does `document.getElementById` raise? Doesn't say it raises any, but i thought an error would be raised if an ID doesn't exist
20:37:19FromDiscord<Gumbercules> look at what that does in JS
20:37:32FromDiscord<Gumbercules> Nim is just going to do whatever JS does
20:37:34FromDiscord<Generic> https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById
20:37:36FromDiscord<Generic> apparently it returns null
20:37:43*ofelas quit (Quit: Leaving)
20:37:45FromDiscord<Gumbercules> so it will return `nil`
20:37:53FromDiscord<πτ (pi man)> welp........ I get the key for the object after I get other data for the object so this was all pointless anyways :mood:
20:38:06FromDiscord<Horizon [She/Her]> In reply to @Gumbercules "Nim is just going": Ah, would be nice if these behaviours were explained in the Nim docs at least
20:39:09FromDiscord<Horizon [She/Her]> I hope the `Element` is mutable, should be, if we're going by JS' logic
20:39:31FromDiscord<Gumbercules> isn't every JS object mutable?
20:39:53FromDiscord<Horizon [She/Her]> Yup
20:40:10FromDiscord<Gumbercules> Nim should follow JS semantics
20:40:16FromDiscord<Gumbercules> like Nim's implementation of that function
20:40:19FromDiscord<Horizon [She/Her]> Alright, thanks!
20:40:47FromDiscord<Gumbercules> I'm guessing is - `proc getElementById(d: Document): HTMLElement {.importcpp: "getElementById(#)".}` or something similar to that
20:41:23FromDiscord<Gumbercules> so Nim is just binding to the JS function
20:41:56FromDiscord<Gumbercules> oh well I forgot the `cstring` arg but yeah
20:42:09FromDiscord<Horizon [She/Her]> Yup that's right (similar)
20:42:30FromDiscord<Gumbercules> https://github.com/nim-lang/Nim/blob/version-1-6/lib/js/dom.nim#L1438
20:45:05Zevvi want to add a few words to my earlier rant: I do not think there are any feasible alternatives to sane threading in nim exactly *because* of arc: if you share nim-managed memory (ie refs) between threads, arc will set you world on fire becuase the reference counters are not atomic. If you share a ref, two threads will go pulling the RCs, unsynchronized, leading to UB/disaster. The only alternative left then
20:45:11Zevvis to use raw ptrs (like mratsims weave, for example), but then we might as well go back to C or C++. ARC is ment to make life easier on the developers, but it makes practical sharing of memory over threads basically impossible.
20:45:15FromDiscord<Gumbercules> lol at one point I ported https://viperhtml.js.org/hyper.html tto Nim
20:45:15FromDiscord<Gumbercules> that was fun
20:45:36Zevvfwiw.
20:45:39FromDiscord<Gumbercules> In reply to @Zevv "is to use raw": I don't get this - it's not impossible
20:45:54FromDiscord<Gumbercules> is it easy? no - but multithreading and sharing memory has never been
20:46:05FromDiscord<Gumbercules> and outside of a higher level abstraction like message passing, there is no real answer
20:46:11Zevvtell me how to share a ref over threads
20:46:13FromDiscord<Gumbercules> besides "don't share memory between threads"
20:46:29FromDiscord<Gumbercules> okay well now we're introducing the requirement that we need to share refs
20:46:51Zevvwell, you want to share data, likely?
20:46:52FromDiscord<Gumbercules> you can do it with `gc_ref` `gc_unref` probably but it's not going to be pretty or fun
20:46:58FromDiscord<πτ (pi man)> are objects in nim default stack or heap?
20:47:06FromDiscord<Gumbercules> sure - but there's no reason I need to manage that memory with Nim's GC
20:47:15FromDiscord<Gumbercules> I can manually allocate and free memory
20:47:21FromDiscord<Gumbercules> and with destructors this gets easier
20:47:33Zevvok, so maybe i'm funny for wanting the language to support me instead of having to do things manually
20:47:33FromDiscord<Gumbercules> In reply to @πτ (pi man) "are objects in nim": stack - refs are allocated on the heap
20:47:40FromDiscord<Gumbercules> no
20:47:51FromDiscord<Gumbercules> but I think whether you're using Rust or Zig or Nim or D or whatever you're going to run into this issue
20:47:54FromDiscord<πτ (pi man)> I like doing things manually tbh
20:48:17FromDiscord<Gumbercules> and then your answers are the same
20:48:20Zevvwell, sure, then you are good to go
20:48:33FromDiscord<Gumbercules> resort to message passing or get your hands really dirty
20:49:11FromDiscord<Gumbercules> I think Nim is in a pretty good spot honestly - being able to introduce RAII like semantics is swell
20:49:32Zevvthe inbetween way is passing refs. it does not have the cost of copying, you can pass arbitrary large data structures around at virtually no cost
20:50:01FromDiscord<Gumbercules> if your program is written entirely in Nim then sure
20:50:16Zevvi like my nim programs to be written in nim, generally
20:50:22FromDiscord<Gumbercules> I'm not sure how you're going to do this with C/C++ interop
20:50:28FromDiscord<Gumbercules> this isn't feasible for me
20:50:52FromDiscord<Gumbercules> then again, I think we want different things from our usage of Nim
20:50:57FromDiscord<Gumbercules> you want sane and safe concurrency / parallelism
20:51:12*xet7 quit (Quit: Leaving)
20:51:25FromDiscord<Gumbercules> I don't really care if what I'm doing is safe in my game client code for the most part
20:51:38Zevvfair enough.
20:51:45*xet7 joined #nim
20:52:19FromDiscord<Gumbercules> I agree with you 100% though - Elixir, Golang, Pony - these languages have very rosy concurrency pictures
20:52:57FromDiscord<Gumbercules> I haven't used Pony - just stared at a bunch of Pony code, but I have used both Golang and Elixir and well, I code in Elixir for my job so I guess I like it a bit
20:53:20Zevvpony i hell, 9 different pointer types and all their relations dont fit in my mind
20:53:43FromDiscord<Gumbercules> even though they told me I'd get to code in Nim 😒
20:54:04FromDiscord<Gumbercules> Pony is one of those languages relegated to academia I think
20:54:41Zevvi think nim can be made to get close to go or elixir, we "fiberize" the code the same was as go does, allowing us to schedule it similary to how go does. I like the process model of elixir a lot, allowing to build supervisor trees and gensever-like models, and this is also proven to be doable.
20:55:17FromDiscord<Gumbercules> https://www.ponylang.io/media/papers/a_string_of_ponies.pdf
20:55:30*arkurious joined #nim
20:55:31FromDiscord<Gumbercules> as long as we don't give up what we ahave now
20:55:41FromDiscord<Gumbercules> and the runtime is opt-in
20:55:52*ltriant joined #nim
20:56:08FromDiscord<Gumbercules> I'd be cool with that - would give me a reason to use Nim for my game server instead of Elixir as well
20:56:41FromDiscord<Gumbercules> lot of engineering effort went into BEAM though, like decades
20:56:58FromDiscord<Gumbercules> but I mean, I agree I'm sure it could be done if someone was willing to invest the time and had the know how
21:00:39Zevvwell, no one builds stuff like this on their own, right
21:00:49*ltriant quit (Ping timeout: 260 seconds)
21:05:35FromDiscord<πτ (pi man)> what's the best way to get the last item in a sequence?
21:05:58*kenran joined #nim
21:08:18FromDiscord<Kermithos> I think [^1]
21:09:12FromDiscord<Kermithos> https://play.nim-lang.org/#ix=4hJE
21:09:51*jmdaemon joined #nim
21:10:06FromDiscord<πτ (pi man)> yep, never did get used to index operators
21:11:10FromDiscord<πτ (pi man)> In reply to @Gumbercules "I haven't used Pony": I get to use visual scripting for my job :LUL:
21:17:23*ltriant joined #nim
21:18:28*xet7 quit (Read error: Connection reset by peer)
21:26:22FromDiscord<πτ (pi man)> ok, how do I return a taggedUnion?
21:26:40FromDiscord<πτ (pi man)> (edit) "taggedUnion?" => "taggedUnion using result?"
21:26:45FromDiscord<πτ (pi man)> or do I just not use result
21:26:56FromDiscord<πτ (pi man)> actually probably better to just use return I guess
21:27:18FromDiscord<Gumbercules> In reply to @Zevv "well, no one builds": truth, took Ericsson to build ERlang
21:27:20FromDiscord<Gumbercules> (edit) "ERlang" => "Erlang"
21:27:51FromDiscord<Gumbercules> In reply to @πτ (pi man) "I get to use": heh, my second "programming" job was using TIBCO
21:27:56FromDiscord<Gumbercules> absolute horror show
21:28:05FromDiscord<πτ (pi man)> idk what TIBCO is
21:28:15FromDiscord<Gumbercules> also have had to touch informatica and other ETL / integration solutions before, yuck
21:28:33FromDiscord<Gumbercules> https://www.tibco.com/products/tibco-businessworks
21:35:40*TakinOver quit (Ping timeout: 256 seconds)
21:37:18FromDiscord<πτ (pi man)> does Nim have "struct initialization" (like C does)
21:38:20*TakinOver joined #nim
21:45:27FromDiscord<Elegantbeef> No you have to do `MyObject(field: arg, field2: arg2)`
21:46:22FromDiscord<kaddkaka> So, how can I get som discussion/traction for my scanf change suggestion (returning length:int instead of result:bool)?
21:46:33FromDiscord<πτ (pi man)> In reply to @Elegantbeef "No you have to": well thats kind of what I meant
21:46:42FromDiscord<πτ (pi man)> you don't have to define that as a proc right?
21:46:56FromDiscord<kaddkaka> (Or make a sibling for scanf)
21:47:12FromDiscord<Elegantbeef> No you do not
21:47:41FromDiscord<Elegantbeef> A well written RFC, but even then it's not overly likely to happen, but who knows↵(@kaddkaka)
21:48:03FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hJO
21:48:11FromDiscord<Elegantbeef> That works fine
21:48:24*PMunch quit (Quit: leaving)
21:48:42FromDiscord<kaddkaka> In reply to @Elegantbeef "A well written RFC,": Why isn't it likely to happen you mean? Because breaking changes to std library are un-nice?
21:49:58FromDiscord<Elegantbeef> Indeed
21:50:46FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hJP
21:52:03FromDiscord<Elegantbeef> Yes
21:52:09FromDiscord<Elegantbeef> though using `type` is a dumb idea
21:52:15FromDiscord<Elegantbeef> use `kind` or `typ`
21:55:41*kenran quit (Remote host closed the connection)
21:57:54FromDiscord<kaddkaka> In reply to @Elegantbeef "Indeed": Was that an answer to me?
21:57:58FromDiscord<Gumbercules> re: the conversation around threads vs green threads earlier, this is why it's often at your disadvantage to leverage a thread pool for I/O bound work - https://en.wikipedia.org/wiki/Preemption_(computing)#Preemptive_multitasking
21:58:10FromDiscord<Elegantbeef> Yes that was an answer to you
21:58:23*pro joined #nim
21:58:43*pro left #nim (#nim)
21:59:11FromDiscord<kaddkaka> 👍 I will propose another version of scanf in that case. Any name suggestions? `scanfl` 🤔
21:59:38FromDiscord<kaddkaka> I will write something up during the week ☺️
22:05:04*xet7 joined #nim
22:08:02NimEventerNew thread by elcritch: ROS2 Library port (Robotics), see https://forum.nim-lang.org/t/9693
22:08:23FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hJX
22:10:13FromDiscord<Gumbercules> https://berb.github.io/diploma-thesis/original/042_serverarch.html good read if you're authoring a web sever
22:10:22FromDiscord<Require Support> what does NimMain do, other than GC initialization?
22:10:41FromDiscord<Gumbercules> look at the generated C code 🙂
22:10:43FromDiscord<Elegantbeef> Call all top level code
22:11:12FromDiscord<Require Support> so it always has to be called 🤔
22:11:26FromDiscord<Elegantbeef> Yes it should always be called
22:11:26FromDiscord<Gumbercules> there's a {.nomain.} pragma
22:11:48FromDiscord<Require Support> ye but then you'd have to call it yourself
22:11:58FromDiscord<Require Support> I think
22:12:05FromDiscord<Gumbercules> err sorry
22:12:12FromDiscord<Gumbercules> not pragma but compiler option
22:12:12FromDiscord<Elegantbeef> there is also `--noMain` 😄
22:12:12FromDiscord<Gumbercules> yes
22:12:40FromDiscord<Elegantbeef> That doesnt generate a main equivalent to C it still has `NimMain`
22:12:45FromDiscord<Gumbercules> mmhmm
22:12:55FromDiscord<Gumbercules> useful if you plan on having a C program host your Nim code
22:13:23FromDiscord<Gumbercules> or whatever language you're hosting your Nim code with that is going to have its own `main` entrypoint
22:13:37FromDiscord<Gumbercules> what are you trying to do @Require Support ?
22:14:37FromDiscord<Require Support> I saw a comment by Araq on the forums that said when using `--mm:orc` you dont need to call NimMain
22:15:24FromDiscord<Require Support> trying to create a dll with --nomain that doesnt require me to call NimMain
22:15:27FromDiscord<Elegantbeef> You dont need to but you certainly should
22:17:05FromDiscord<πτ (pi man)> In reply to @Elegantbeef "Yes": hmm, I'm getting just `0` when I shouldn't be
22:17:10FromDiscord<πτ (pi man)> (edit) "In reply to @Elegantbeef "Yes": hmm, I'm getting just `0` when I shouldn't be ... " added "though"
22:20:06FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hJZ
22:20:23FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hK0
22:21:21FromDiscord<πτ (pi man)> (btw I renamed type to objectID)
22:21:51FromDiscord<πτ (pi man)> an echo of the BACoid gives `(type: 0, instanceID: 0)`
22:22:38FromDiscord<Require Support> In reply to @Elegantbeef "You dont *need* to": yeah but was just curious if I could get it running without crashing
22:23:00FromDiscord<Elegantbeef> Yes you can
22:25:48FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hK2
22:26:08FromDiscord<Elegantbeef> Object variant is the name
22:26:50*pro joined #nim
22:27:00*pro left #nim (#nim)
22:27:24FromDiscord<Elegantbeef> Getting 0s means you are not always getting to your `result. =` branches
22:28:03*dtomato4 quit (Quit: The Lounge - https://thelounge.chat)
22:29:25FromDiscord<πτ (pi man)> In reply to @Elegantbeef "Getting 0s means you": but I can see that I am because of the echos
22:30:59FromDiscord<Elegantbeef> Are you parsing a single xml node?
22:32:53FromDiscord<πτ (pi man)> I'm parsing a singl xml document of which there are lots of BACoid nodes
22:34:21FromDiscord<Elegantbeef> So are you certain that the nodes that have 0 are the ones that get to the assignment branches?
22:36:03FromDiscord<πτ (pi man)> as far as I can tell from the echos, yes
22:36:28FromDiscord<πτ (pi man)> so in otherwords i'm 99% certain
22:41:13FromDiscord<Elegantbeef> Well without runnable code i can only say "Yep"
22:41:20FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hK8
22:43:01FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hK9
22:44:04FromDiscord<πτ (pi man)> every single print is this way
22:44:52FromDiscord<Elegantbeef> What memory management are you using?
22:45:31FromDiscord<πτ (pi man)> default?
22:45:54FromDiscord<πτ (pi man)> the issue seems to be the assignment though
22:46:04FromDiscord<Elegantbeef> What version of Nim 1.6 or 1.7?
22:46:09FromDiscord<πτ (pi man)> 1.5.1
22:46:13FromDiscord<Gumbercules> In reply to @Require Support "trying to create a": try `--app:lib`
22:46:19FromDiscord<Elegantbeef> Why 1.5.1....
22:46:24FromDiscord<Gumbercules> here is how I compile the plugins for my game server
22:46:25FromDiscord<πτ (pi man)> because I don't remember how to update
22:46:28FromDiscord<Gumbercules> err sorry game engine
22:46:29FromDiscord<Elegantbeef> That's a devel of a devel
22:47:10FromDiscord<Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/src/config.nims
22:47:38FromDiscord<Gumbercules> oh wait
22:47:41FromDiscord<Gumbercules> no... that's not right
22:47:56FromDiscord<πτ (pi man)> I have choosenim, but I don't remember how to use it
22:48:00FromDiscord<Gumbercules> there
22:48:01FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hKb
22:48:05FromDiscord<Elegantbeef> `choosenim stable`
22:48:10FromDiscord<Elegantbeef> `choosenim update stable`
22:48:35FromDiscord<Gumbercules> plus ` nim c --app:lib --out:shell-shocked.dll .\main.nim`
22:48:39FromDiscord<πτ (pi man)> updating
22:48:41FromDiscord<Elegantbeef> `--app:lib --mm:orc` is all you really should need
22:49:05FromDiscord<πτ (pi man)> updating to 1.6.10
22:49:19FromDiscord<Elegantbeef> I guess maybe you'd need `--app:lib --mm:orc --noMain:on` but `lib` should imply the latter
22:49:22FromDiscord<Gumbercules> you don't even need `--mm:orc` if you want to use the original memory model
22:49:23FromDiscord<Gumbercules> yeah it does
22:49:51FromDiscord<Elegantbeef> Well they dont want to have to init the GC so they dont want to use refc
22:50:17FromDiscord<Gumbercules> but then you probably will need `nim c -d:useNimRtl myprog.nim`
22:50:21FromDiscord<Gumbercules> ah okay gotcha
22:50:47FromDiscord<πτ (pi man)> updated nim and still same issue, the issue seems to be assignment of the object variant btw
22:51:11FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hKc
22:51:37FromDiscord<Elegantbeef> Try `--mm:orc` pi
22:51:59FromDiscord<Elegantbeef> I'm curious if something with Nim's old memory management is accidentally incorrectly zeroing memory
22:52:18FromDiscord<Cheeseinator> If I'm on 1.6.10 should I use `--mm:orc` or `--gc:orc`?
22:52:19FromDiscord<Elegantbeef> You dont have a custom copy hook do you?
22:52:27FromDiscord<πτ (pi man)> same thing, (ran `nimble run --mm:orc`)
22:52:28FromDiscord<Elegantbeef> it's the same thing
22:52:32FromDiscord<Elegantbeef> `--mm` is an alias
22:52:37FromDiscord<πτ (pi man)> In reply to @Elegantbeef "You dont have a": nope
22:52:46FromDiscord<Elegantbeef> `--gc` is deprecated now
22:52:56FromDiscord<Elegantbeef> Well if you can get me a runnable example i'll take a look
22:53:05FromDiscord<πτ (pi man)> just executable?
22:53:12FromDiscord<πτ (pi man)> or source code
22:53:17FromDiscord<Elegantbeef> Source
22:53:47FromDiscord<πτ (pi man)> https://paste.myst.rs/tmxxrmn3
22:54:26*clemens3 left #nim (WeeChat 2.7)
22:54:58FromDiscord<Elegantbeef> god so many stropped fields 😄
22:55:30*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
22:58:25FromDiscord<Gumbercules> `result.properties[^1].data.bacoid.objectID.int`😬
22:58:32FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4hKd this works fine
22:59:27FromDiscord<Elegantbeef> can i get the .caf file or is this locked behind doors
23:00:14FromDiscord<Elegantbeef> Honestly the stropping and the screaming undescore cased enums is worse to me gumber 😄
23:01:05FromDiscord<πτ (pi man)> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=4hKd this works fine": right, but this doesn't have a second data object
23:01:36FromDiscord<πτ (pi man)> if I do `d = a` and print `d` it shows `0, 0`
23:01:39FromDiscord<Gumbercules> In reply to @Elegantbeef "Honestly the stropping and": yeah it's a close contest
23:01:53FromDiscord<πτ (pi man)> https://media.discordapp.net/attachments/371759389889003532/1049098241410605087/Test_NCE.caf
23:02:30FromDiscord<Elegantbeef> The issue is the bitsize pragma
23:02:32FromDiscord<Elegantbeef> So this is a compiler bug
23:02:47FromDiscord<πτ (pi man)> yay :mood:
23:03:05FromDiscord<πτ (pi man)> I guess I just won't use bitsize then
23:04:07FromDiscord<πτ (pi man)> yep, now it works
23:10:01FromDiscord<Elegantbeef> Odd the string branch seems to cause it
23:10:01FromDiscord<Elegantbeef> Reproduction
23:10:03FromDiscord<Elegantbeef> change `string` to `int` and it still errors
23:10:06FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Chb
23:10:07FromDiscord<Elegantbeef> I mean it doesnt error
23:10:27*wallabra_ joined #nim
23:10:37*dtomato4 joined #nim
23:10:50FromDiscord<Elegantbeef> `ref`/`string`/`seq` cause this it seems
23:13:08*wallabra quit (Ping timeout: 256 seconds)
23:13:08*wallabra_ is now known as wallabra
23:14:25FromDiscord<πτ (pi man)> but also removing the bitsize also fixes it
23:14:34FromDiscord<メッリーレイムー 🎄> sent a code paste, see https://play.nim-lang.org/#ix=4hKq
23:15:37FromDiscord<メッリーレイムー 🎄> (edit) "https://play.nim-lang.org/#ix=4hKq" => "https://play.nim-lang.org/#ix=4hKr"
23:15:48FromDiscord<メッリーレイムー 🎄> (edit) "https://play.nim-lang.org/#ix=4hKr" => "https://play.nim-lang.org/#ix=4hKs"
23:16:25FromDiscord<Gumbercules> https://play.nim-lang.org/#ix=4hKt works
23:16:36FromDiscord<Gumbercules> @πτ (pi man)
23:16:37FromDiscord<メッリーレイムー 🎄> how do i make it a ref
23:19:42FromDiscord<Elegantbeef> `raise (ref LexerError)(src: "...", line: ...., msg: ...)`
23:20:29FromDiscord<メッリーレイムー 🎄> i mean doing this worked too
23:20:36FromDiscord<メッリーレイムー 🎄> sent a code paste, see https://play.nim-lang.org/#ix=4hKv
23:20:57FromDiscord<Just Jasmine, Please> In reply to @amadan "From this post https://www.reddit.com/r/SteamDeck/c": Thank you so much! I figured this out through trial and error, but I appreciate you putting in the effort!
23:21:02FromDiscord<メッリーレイムー 🎄> is ref like a pointer/reference type?
23:21:25FromDiscord<Elegantbeef> ref is a heap allocated traced pointer
23:23:12FromDiscord<treeform> In reply to @ajusa "If that doesn't work,": re: "flatty isn't as nice" How can I make flatty nicer?
23:23:25FromDiscord<メッリーレイムー 🎄> In reply to @Elegantbeef "ref is a heap": gotcha
23:24:56*wallabra_ joined #nim
23:26:10*wallabra quit (Ping timeout: 256 seconds)
23:26:21*wallabra_ is now known as wallabra
23:37:01FromDiscord<メッリーレイムー 🎄> when to use {.raises: e.}
23:39:56FromDiscord<Elegantbeef> When you want ensure a procedure only raises specific things
23:40:07FromDiscord<Elegantbeef> Most people do `{.raises: [].}` on procedures they want to never error
23:41:04FromDiscord<メッリーレイムー 🎄> gotchu
23:41:32FromDiscord<メッリーレイムー 🎄> so its not like java throws
23:41:51FromDiscord<Elegantbeef> It's the opposite of it
23:42:00FromDiscord<Elegantbeef> In Nim procedures implicitly are tracked
23:42:23FromDiscord<Elegantbeef> So `{.raises:[...].}` is an explicit annotation to say 'I want the compiler to tell me when an error that isnt in this list is raised
23:43:46FromDiscord<πτ (pi man)> In reply to @Elegantbeef "So `{.raises:[...].}` is an": but that's the same with Java is it not?
23:43:53FromDiscord<Elegantbeef> Nope
23:44:01FromDiscord<Elegantbeef> Java forces the developer to annotate procedures that raise
23:46:11FromDiscord<Elegantbeef> Nim infers it and the developer states when they want to limit or constrain what can be raised
23:47:59FromDiscord<albassort> alright heres a question
23:48:37FromDiscord<albassort> should I spawn a thread for my "async" timeouts one time and have a system where you feed sleep to it or should i spawn it every time i need it
23:49:07FromDiscord<albassort> and also is there an interruptible sleep so i can cancel it via a while look
23:50:39FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hKC
23:51:05FromDiscord<albassort> im starting to realize i sound insane
23:55:29FromDiscord<ChocolettePalette> The former. Spawning threads is huge overhead↵(@albassort)
23:56:11FromDiscord<albassort> i smell the need for a closure
23:56:24FromDiscord<albassort> cursed code day, it is