<< 01-05-2022 >>

00:00:12FromDiscord<spoon> are there any other language-agnostic solutions to scripting? llvm maybe?
00:00:31FromDiscord<Elegantbeef> System libraries
00:00:44FromDiscord<huantian> though I'm still not very familiar with wasm in geenra
00:00:49FromDiscord<spoon> wouldn't that make it platform-dependent though?
00:00:59FromDiscord<Elegantbeef> So what?
00:01:18FromDiscord<Elegantbeef> Crosscompiling is easiy
00:01:27FromDiscord<Elegantbeef> easier than me spelling easy atleast
00:02:18FromDiscord<spoon> system libraries?
00:02:28FromDiscord<spoon> for scripting?
00:02:32nrds<Prestige99> Can a seq be passed to a function expecting varargs, or do you have to "spead" it somehom?
00:02:34FromDiscord<Elegantbeef> Yes
00:02:35nrds<Prestige99> somehow*
00:02:52nrds<Prestige99> neat ty
00:02:52FromDiscord<Elegantbeef> It works identical to how WASM works, and is basically how GDNative works in 3.x
00:02:58nrds<Prestige99> oh
00:03:07FromDiscord<Elegantbeef> `varargs[T]` should accept `seq`
00:03:18nrds<Prestige99> that's neat
00:03:31FromDiscord<Elegantbeef> If it doesnt you can take an `openArray` instead 😄
00:03:32FromDiscord<huantian> can you only pass ints and floats and other basic datatypes through wasm exposed funcs?
00:04:10FromDiscord<Elegantbeef> It also supports tuples, but yea it's a relatively barebones bridge
00:04:14FromDiscord<spoon> if you want different languages to support it, probably
00:04:18FromDiscord<Elegantbeef> It does have reference support but didnt see how that works
00:05:37FromDiscord<Elegantbeef> reference types in wasm are pointer basicallly that can only come from the host
00:06:49FromDiscord<Elegantbeef> So the way it works is you get a reference from the host and the host defines procedures for that reference type
00:07:09FromDiscord<Elegantbeef> So all the operations happen in the host environment but can be scripted from WASM
00:08:50FromDiscord<Elegantbeef> I really need to look at a wasm runtime a bit more an play with it
00:11:43FromDiscord<Elegantbeef> Who wants to make yet another wasm runtime?
00:13:06FromDiscord<huantian> hm is it possible inspect the exported functions from wasm?
00:13:18FromDiscord<Elegantbeef> Which way?
00:13:29FromDiscord<Elegantbeef> From the host?
00:13:35FromDiscord<huantian> Host program looks at what functions the script implements
00:13:45FromDiscord<Elegantbeef> I'd imagine so
00:16:05FromDiscord<Elegantbeef> Yea it seems you can
00:16:16FromDiscord<Elegantbeef> Atleast with the WASM runtime i'm looking at now
00:19:08FromDiscord<Elegantbeef> @huantian\: might be better to refer to https://wasmedge.org/book/en/embed/c.html
00:19:08FromDiscord<Elegantbeef> It's better documented
00:20:38FromDiscord<Alea> I tried the block highlighter plugin and it changed my current line highlight :BwaahSnap:
00:20:48FromDiscord<Alea> and now I can't undo it
00:21:00FromDiscord<huantian> it's in your settings.json
00:21:31FromDiscord<Elegantbeef> Yea blockman doesnt work for Nim presently iirc
00:21:32FromDiscord<Elegantbeef> I couldnt be arsed to fix it
00:21:32FromDiscord<Elegantbeef> It'd be a nice project if someone wanted to
00:43:44FromDiscord<Elegantbeef> uh oh futhark dun brokey on wasmedge
00:44:30FromDiscord<Rika> I can’t believe you broke it
00:44:45FromDiscord<Elegantbeef> Same
00:46:52FromDiscord<Elegantbeef> Might be me on second thought
00:48:40FromDiscord<Elegantbeef> Eitherway seems clang is having fun with int128
01:05:17FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/UGC
01:05:24FromDiscord<!Patitotective> (edit) "https://play.nim-lang.org/#ix=3WHv" => "https://paste.rs/BnJ"
01:05:38FromDiscord<Elegantbeef> You can make it catchable but it's dumb to and bad practise
01:05:43FromDiscord<Elegantbeef> Nil check your code
01:06:36FromDiscord<!Patitotective> In reply to @Elegantbeef "You *can* make it": its just that when an image fails loading i dont want the app to crash, but instead to load an empty image
01:07:18FromDiscord<huantian> how does the image fail to load?
01:07:27FromDiscord<Elegantbeef> So then do `if image.isNil`
01:07:41FromDiscord<Elegantbeef> You dont catch nil errors you.... check if it's not nil
01:07:53FromDiscord<Elegantbeef> Yay huan i got wasmedge working! 😄
01:08:41FromDiscord<huantian> 👏
01:08:57FromDiscord<huantian> what's the difference between wasmedge and wasmer
01:08:59FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3WHy
01:08:59FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/hkk
01:09:00FromDiscord<!Patitotective> In reply to @Elegantbeef "You dont catch nil": smart
01:10:11*vicfred joined #nim
01:12:54FromDiscord<Elegantbeef> Better docs↵(@huantian)
01:13:00FromDiscord<huantian> mm
01:13:26FromDiscord<Elegantbeef> The CAPI for wasmer was a dead link and -10 docs existed
01:42:43FromDiscord<Elegantbeef> Uh oh the generated futhark bindings are causing a nil reference error
01:42:48FromDiscord<ynfle> In reply to @Knedlik "Sorry that I took": There isn't any code there
01:43:58FromDiscord<Elegantbeef> https://github.com/Periapsis-Studios/Beyond-the-Sphere/tree/nim there is here
01:45:48FromDiscord<ynfle> ok thanks
01:55:40FromDiscord<huantian> In reply to @Elegantbeef "The CAPI for wasmer": Yeahhh I couldn’t find good docs on it
01:57:26FromDiscord<Elegantbeef> think\
02:01:28FromDiscord<ElegantBeef> Lol matrix bridge went kapoot again
02:01:44FromDiscord<ElegantBeef> Well Huan i sent a message for you there go read it!
02:10:03*Zectbumo quit (Remote host closed the connection)
02:12:17FromDiscord<ynfle> @Knedlik it doesn't crash for me on 1.6.4 on macOS. Is there something specific that you did that made it crash?
02:13:02FromDiscord<ynfle> I noticed you are using devel, any reason?
02:23:46*arkurious quit (Quit: Leaving)
02:36:25FromDiscord<Elegantbeef> For storing values it seems
02:36:40FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/970151740894744656/image.png
02:45:48FromDiscord<huantian> Ahh
03:17:30NimEventerNew Nimble package! mealdb - TheMealDB API client, see https://github.com/thechampagne/mealdb-nim
03:18:34FromDiscord<Rika> In reply to @NimEventer "New Nimble package! mealdb": Terrifying object right there
03:19:03FromDiscord<Elegantbeef> Jeesus christ people enum arrays exist
03:33:26*Zectbumo joined #nim
04:16:19pchvery funny development in the awfulness of my situation means things are even worse but also in a way that means my projects are now back to being worked on until i find paid work
04:16:51pchso if you remember me putting all my projects on hold i believe early april? that's reversed but not becasue of things getting better
04:17:17pchoh, no, it was end of march
04:17:50pchgive me a few days to recover mentally though, and if I get paid work in that time then oops lol
04:18:23pch(paid work isn't going to happen, nobody ever pays me for shit)
04:21:47FromDiscord<Elegantbeef> Hey more Nim code the better 😛
04:22:03pchi really wish that were the case
04:22:32pchmy projects being in nim is actually likely to hinder positive progress in this case, due to low hiring desirability
04:23:23pchbasically i need a job that pays a living wage and doesn't care which country i live in by the end of may that also won't care if i immediately take a week away to move
04:23:31FromDiscord<Elegantbeef> Eh my view is it's a system language and complex projects still show off capabillity and intelligence, but i'm also a numpty
04:23:49pchyes, but nobody hiring searches through nim code
04:24:02pchand projects being in nim reduces their visibility to the nim-using community mainly
04:24:54pchand no company that i can submit a resume with a link to my github to will hire me as they will also require arbitrary education-related formalities to be met
04:25:01pchsuch as having finished high school
04:26:37pchin fact finding any job willing to pay me, for this reason only, in the deadline I have to obtain gainful employment, will require an extreme strike of luck that has no reason to happen now, as it has not happened in the 6 years I've been trying to make it happen
04:27:21pchemployers don't care if you've performed and proven highly useful research in your field unless they heard of it 10 years ago
04:28:06pchemployers don't care if they're using software you are the sole developer and licensor of unless you're famous
04:29:30pchemployers don't care if you have more experience in the field than all of their entire current hirebase combined unless you have a degree from a university in their country
04:30:41pchI'm maybe too bitter right now to be chatting
04:31:19pchat this point the only hope for me is if someone sees my bitter rants and tries to make them stop with money
04:31:47pchif I don't have gainful employment in a month all of my equipment will be destroyed and I will be homeless, presumably permanently this time
04:32:08pcheven then I still have to find somewhere to go
04:32:31pchoh crap just counted how many lines I've just sent
04:33:08FromDiscord<Rika> Well I don’t know most of us here don’t use Nim to get employed
04:33:24FromDiscord<Rika> If we wanted employment we’d use whatever popular language most tolerable to us
04:35:49pchI do
04:36:36FromDiscord<Rika> I can’t tell you what to do nor will I say what I think because you’re just gonna snap at me so xd
04:36:36pchI use C, I use java, I use C#, I use AArch64 ASM, so many others, but my biggest undertakings are all in nim
04:36:41FromDiscord<Rika> Good luck or whatever
04:36:58pchno, I'm not going to snap at you, sorry for making that impression
04:37:16pchjust very embittered with employers and in a situation of awfulness that they created
05:27:34FromDiscord<Phil> In reply to @Rika "If we wanted employment": ~~If you want employment in germany you do java, python or search for ages~~
05:31:10*slowButPresent quit (Quit: leaving)
05:46:29FromDiscord<SolitudeSF> @dom96 you forgot to ban me on matrix, asshole. im still posing a huge threat to the community.
05:47:18FromDiscord<Rika> When did you get banned lmao
05:47:38FromDiscord<SolitudeSF> yesterday/today
05:47:58FromDiscord<SolitudeSF> community-wide ban too, im a fucking problem
05:48:10FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/970199934223663124/image.png
05:48:13FromDiscord<Elegantbeef> Ah you're the reason for this
05:48:17FromDiscord<Elegantbeef> I was confused what they did
05:49:04FromDiscord<SolitudeSF> what
05:49:28FromDiscord<Elegantbeef> The icon on the left when hovered says "thread author banned"
05:50:15FromDiscord<SolitudeSF> i havent authored any threads in last year
05:50:59FromDiscord<Elegantbeef> Bug with forum code i wager
05:51:14FromDiscord<SolitudeSF> as expected
05:52:20FromDiscord<xflywind> Why are you banned? Is there some conversations link?
05:52:40FromDiscord<xflywind> (edit) "Is" => "Are" | "conversations link?" => "conversation links?"
05:53:28FromDiscord<Elegantbeef> Seems it's in #discord-only
05:54:05FromDiscord<xflywind> I se
05:54:09FromDiscord<xflywind> (edit) "se" => "see"
05:55:02FromDiscord<Elegantbeef> I dont know why exactly
06:04:30pchi am not in discord and have no access to context but im not sure i want to know tbh
06:04:45FromDiscord<Elegantbeef> Eh was a dick measuring contest for the most part
06:05:00pchprobably just someone acting out to make a security hole noticed or something
06:05:42pchor like just yelling at mods for random programming politics crap like "support riscv better or else"
06:06:01pcheven though nim doesn't use any asm directly afaik
06:06:54FromDiscord<Elegantbeef> Nah it was dick measuring contest about someone getting someone banned from another server or something like that
06:09:14FromDiscord<Elegantbeef> Dumb shit
06:10:29pchoh so like, mind poison, got it
06:28:12FromDiscord<Phil> I mean, the last 48h in discord-only were a mud-bath of the dirty kind, skimming through it.↵I'm personally surprised to see a ban result out of this that wasn't xanax's
06:29:23FromDiscord<Phil> But this is offtopic I guess
07:00:28*neceve joined #nim
07:24:12*jmdaemon quit (Ping timeout: 240 seconds)
07:25:51FromDiscord<ShalokShalom> pch: Reading your comments on employment. I think considering the chances of getting hired, F#, Scala (3), and maybe Clojure might be the sanest modern languages in my point of view, who offer you a job. ↵↵Simply for the reason, that they employ established platforms, and lots of shops are ready to hire people from these "unknown" languages.
07:26:43FromDiscord<ShalokShalom> I prefer Nim being simply a compiler, as in contrast, needing to setup .NET, personally.
07:28:52FromDiscord<ShalokShalom> In reply to @Alea "If you only attract": Nobody said attracting established users only. I said, it won't grow, if attracting new programmers isnt a goal, like Python and Ruby do, success like in those languages will stay out.
07:29:56FromDiscord<ShalokShalom> In reply to @konsumlamm "Rust didn't get popular": Rust is in a very special position, attracting both C++ and Haskell developers, who are tired of their old languages and I would argue, there is not much room left in that space.
07:31:02FromDiscord<ShalokShalom> And Nim seems to try to challenge Rust, more so than Ruby and Python, when I see how newbies are considered potential users and that's the mistake in my book.
07:31:07FromDiscord<ShalokShalom> 🙂
07:39:21FromDiscord<Knedlik> In reply to @ynfle "I noticed you are": Devel doesn’t get flagged by Avast
07:40:20FromDiscord<Knedlik> And what you were responding to already got resolved
08:08:19FromDiscord<ITR> Are there any image manipulation libraries?
08:08:26FromDiscord<Rika> Pixie
08:09:05FromDiscord<ITR> ty
08:39:07*SebastianM joined #nim
08:39:53*Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected])
08:56:04*SebastianM quit (Quit: Bye)
08:58:43FromDiscord<ITR> is there a faster way of flattening a seq of seq than foldl?
08:59:22FromDiscord<Elegantbeef> It's a slow data structure so dont expect muuch 😄
08:59:38FromDiscord<Rika> An iterator then to seq lmao
09:00:02*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
09:00:45*ehmry joined #nim
09:00:50FromDiscord<Elegantbeef> nested seq is one of the slower things you can do 😄
09:07:03FromDiscord<dom96> In reply to @flywind "Why are you banned?": For reacting with the words "HITLER" on a person's message, after I warned them to stop that kind offensive bullshit.
09:07:19FromDiscord<dom96> (edit) "In reply to @flywind "Why are you banned?": For reacting with the words "HITLER" on a person's message, after I warned them to stop that kind ... offensive" added "of"
09:08:28FromDiscord<Phil> So we do have an Andreas and an Araq account on this server.... if a "Rumpf" account joins, we'll have a tri-fecta
09:08:58FromDiscord<Phil> As bill wurtz would say, we can make a religion out of this
09:09:29FromDiscord<Rika> In reply to @Isofruit "So we do have": LMAO
09:09:55FromDiscord<dom96> lol
09:11:43FromDiscord<dom96> wow, so it seems most people want style insensitivity to stay
09:12:02FromDiscord<Elegantbeef> Yea it's not Nim programmers that complain about it
09:13:37FromDiscord<dom96> I guess removing do notation is even less likely, my dreams are crushed :P
09:16:00FromDiscord<Elegantbeef> Eh that's more disliked
09:16:22FromDiscord<Phil> Couldn't come up with a decent pattern where I'd actually want to use the do notation
09:16:43FromDiscord<dom96> In reply to @Elegantbeef "Eh that's more disliked": yeah, that's what I think too
09:17:31FromDiscord<Elegantbeef> Eitherway i'd liked more intelligent inference of procedure definitions
09:17:49FromDiscord<Elegantbeef> There is no reason to need types on a procedure passed to a non ambious procedure call
09:18:36FromDiscord<Andreas> Would it be a big effort to make case-sensivity a option ? maybe a compile-switch ?
09:18:40FromDiscord<Josef> How do I create 32bit dll?↵Is it possible to specify C++ version (for ABI compatibility)?
09:18:43FromDiscord<dom96> In reply to @Elegantbeef "There is no reason": sure, but that shouldn't require breaking changes
09:19:04FromDiscord<Elegantbeef> It doesnt make sense as an option↵(@Andreas)
09:19:37FromDiscord<xflywind> In reply to @Andreas "Would it be a": It is already an option. Uses "--stylecheck:usages"
09:20:11FromDiscord<Andreas> In reply to @Elegantbeef "It doesnt make sense": great, did not knew about this - so done
09:20:59FromDiscord<Elegantbeef> Atleast i think it doesnt make sense as an option 😄
09:21:22FromDiscord<xflywind> The Nim compiler source actually uses "--styleCheck:errors" which enforces nep1 and the stdlib tests uses "--styleCheck:usages".
09:21:45FromDiscord<Elegantbeef> It doesnt take into account your preferred API as such you're forced to use it like the API you want
09:22:07FromDiscord<xflywind> (edit) ""--styleCheck:usages"." => ""--styleCheck:usages" enforces case senitivity."
09:22:14FromDiscord<Elegantbeef> So it's dumb as hell if you use two libraries with different styles
09:22:46FromDiscord<xflywind> yeah it is good if you can control all the libs you have
09:23:17FromDiscord<xflywind> that's what status does, they enfore "styleCheck:usages"
09:23:39FromDiscord<xflywind> (edit) "enfore" => "enforce" | "enforce"styleCheck:usages" ... " added "for the libraries they have."
09:23:50FromDiscord<Elegantbeef> Now we could argue there is merit in saying "There is only one right way to program" but I feel that's demonstrably false
09:25:50FromDiscord<xflywind> If we can have case sensitivity, one bonus is that Nim can support `_` as the start of an identifier which is convenient for C interoperability in some extent.
09:26:03FromDiscord<dom96> true
09:26:17FromDiscord<Elegantbeef> What's the benefit of that?
09:26:20FromDiscord<Elegantbeef> Shitty code?
09:27:04FromDiscord<Elegantbeef> You dont even need case sensitivity to support that you just make it so only `_` after the first is disregarded like the case sensitivity is already done
09:28:03FromDiscord<whisper> Is disruptek here or was he banned also from discord?
09:28:09FromDiscord<Elegantbeef> He was banned
09:28:14FromDiscord<dom96> he was banned from everywhere
09:28:53FromDiscord<dom96> except github that is
09:29:58FromDiscord<dom96> I think the thing that gets me about style insensitivity is how it evolved into this partial thing, where we're not even fully case insensitive anymore. It's just such a complicated rule by now.
09:30:34FromDiscord<dom96> I can really see this being a barrier to entry for a lot of people
09:30:49FromDiscord<Elegantbeef> Is "first character is sensitive" really a complex rule
09:30:50FromDiscord<Elegantbeef> I think my dogs understand it
09:30:51FromDiscord<whisper> Oh I wanted to ask him about the his cloud libs
09:31:16FromDiscord<Elegantbeef> You can head to matrix and go hitup #disruptek or nim-skull's matrix
09:31:26FromDiscord<whisper> It is kinda neat but i dont want to rely on libs from a basically banned user xD
09:31:54FromDiscord<Elegantbeef> He makes good software so you'll be fine
09:32:23FromDiscord<Phil> I think it isn't a complicated rule to avoid
09:32:46FromDiscord<ITR> In reply to @Elegantbeef "nested seq is one": problem is that I'm reading from a json file with lists of lists, lol. I feel like it should be possible with some speedup by anticipating the size by summing the length of the seqs first? As it currently stands it's running even slower than in python, even when compiled with d:release
09:32:54FromDiscord<Phil> But I can see it being hard to actually make use of (case insensitivity that is)
09:33:10FromDiscord<whisper> Maybe I should figure out how that openapi generator works
09:33:15FromDiscord<Elegantbeef> Nim's json is slow use jsony, jason, or packedjson
09:33:47FromDiscord<ITR> In reply to @Elegantbeef "Nim's json is slow": yea, but doesn't really help me when the flattening afterwards takes even longer
09:33:53FromDiscord<Elegantbeef> nested sequences thrash the cache so you're going to lose a lot of performance
09:34:17FromDiscord<Andreas> BTW = why has nobody tried to wrap SIMDJson yet ?
09:34:20FromDiscord<Elegantbeef> I mean you can skip the flattening with your own json hook
09:34:34FromDiscord<Phil> Never heard of it
09:34:36FromDiscord<dom96> In reply to @whisper "It is kinda neat": yeah, I wouldn't recommend it
09:34:46FromDiscord<Elegantbeef> ...?
09:34:54FromDiscord<Phil> (edit) "Never heard of it ... " added "(SIMDJson)"
09:35:11FromDiscord<ITR> double iterator like rika suggested might work better, I guess that's what python does
09:35:28FromDiscord<Andreas> rumor has it - you can't get any faster than SIMDJson 🙂
09:35:31FromDiscord<ITR> json hook sounds more work
09:35:40FromDiscord<Elegantbeef> It's super easier
09:35:48FromDiscord<Elegantbeef> The stdlib even has hooks in `jsonutils`
09:36:00FromDiscord<Phil> Use jsony if you're going to hook stuff
09:36:04FromDiscord<Phil> Make your life not hell
09:36:12FromDiscord<Elegantbeef> Eh the stdlib hooks are ok
09:36:21FromDiscord<Elegantbeef> Yea vindaar i concur
09:36:34FromDiscord<Elegantbeef> I feel like Dom's putting his feelings towards disruptek ahead of rationality
09:36:47FromDiscord<dom96> lol
09:36:50FromDiscord<vindaar> yup
09:37:15FromDiscord<Phil> ...? When did vindaar write anything before his "yup"? Did discord eat it?
09:37:36FromDiscord<Phil> (edit) "...? When did vindaar write anything before his "yup"? Did discord eat it? ... " added "(I assume there was something because you reacted to sth beef)"
09:37:38FromDiscord<dom96> In reply to @Elegantbeef "I feel like Dom's": I feel the same about you
09:37:40FromDiscord<vindaar> beef and me are telepathically linked
09:37:41FromDiscord<Elegantbeef> matrix reaction
09:38:09FromDiscord<dom96> strange that a newcomer with no skin in the game shares the same opinion I do
09:38:21FromDiscord<Phil> ?
09:38:22FromDiscord<Elegantbeef> I have skin in the game?
09:38:27FromDiscord<Elegantbeef> Fuck where'd my skin go!
09:38:54FromDiscord<Phil> Disruptek debate off to offtopic ?
09:39:36FromDiscord<Phil> In reply to @ITR "json hook sounds more": Jsony hooks are decently easy. I can't speak for std/json hooks, these feel funky to me.
09:40:17FromDiscord<ITR> sent a code paste, see https://play.nim-lang.org/#ix=3WID
09:40:20FromDiscord<Elegantbeef> The ones in stdlib are a bit more reasonable as they operate on Jsonnodes not a string
09:40:36FromDiscord<Elegantbeef> Yea so dont do it that way
09:40:47FromDiscord<Elegantbeef> Write a json hook that converts it into a `seq[PixelPlaced]`
09:40:53FromDiscord<ITR> right, i'mma look into that now
09:41:14FromDiscord<Elegantbeef> You can also preallocate like 1000 or w/e
09:41:34FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/std/jsonutils.nim#L390 should show you how it works
09:41:40FromDiscord<ITR> ty
09:41:40FromDiscord<Elegantbeef> If you use stdlib
09:42:17FromDiscord<ITR> I can just install Jsony if that's simpler
09:42:28FromDiscord<Elegantbeef> They're equally complex
09:43:05FromDiscord<Elegantbeef> Despire what Phill said the stdlib's hooks are simple yet under documented
09:43:16FromDiscord<Elegantbeef> you do have to use `jsonTo` instead of `fromJson`
09:45:33FromDiscord<Phil> sent a code paste, see https://paste.rs/Bbc
09:45:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WIE
09:46:34FromDiscord<Elegantbeef> then you use use `MyPixelPlaced` instead of `seq[seq[PixelPlaced]]` and bingo bango bongo bish bash bosh
09:47:29FromDiscord<d4rckh> i have a property of a type with the type of an enum, how can i add a case in a case block, that runs if the value of the enum is anything
09:48:03FromDiscord<d4rckh> sent a code paste, see https://paste.rs/4nQ
09:48:09FromDiscord<Phil> That is on an object type?
09:48:20FromDiscord<d4rckh> (edit) "https://play.nim-lang.org/#ix=3WIH" => "https://play.nim-lang.org/#ix=3WIG"
09:48:25FromDiscord<d4rckh> something is an object, myEnum is an enum
09:49:02FromDiscord<d4rckh> (edit) "https://play.nim-lang.org/#ix=3WIG" => "https://play.nim-lang.org/#ix=3WII"
09:49:23FromDiscord<Elegantbeef> you put a `defer` before or use `try finally`
09:49:24FromDiscord<d4rckh> building a cli so i need some commands to be accessible in all modes
09:49:25FromDiscord<ITR> In reply to @Elegantbeef "but in your case": Hmm, I don't see newSeqWith in sequtils. There's newSeqWith, but that's with a preset size, not capacity
09:49:34FromDiscord<Phil> doesn't something have to be a valid enum value? Or can it be nil?↵Either way, if it can be an enum value I feel like it could be an optional
09:49:45FromDiscord<Phil> (edit) "an enum value" => ""empty""
09:49:52FromDiscord<Elegantbeef> `newSeqOfCap`
09:49:56FromDiscord<Elegantbeef> My bad always forget
09:49:59FromDiscord<Phil> (edit) "something" => "something.myEnum"
09:50:04FromDiscord<ITR> oh, in system, ty
09:50:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WIK
09:51:09FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/e9k
09:51:42FromDiscord<Elegantbeef> Nim does not have a syntax for "always run"
09:53:42FromDiscord<d4rckh> hm, thanks
09:54:12FromDiscord<Phil> sent a code paste, see https://paste.rs/aTB
09:54:44FromDiscord<Elegantbeef> Phill options dont always represent what you're doing well
09:55:09FromDiscord<ITR> if you have control over the enum, couldn't you just make an enum value that's "None"? I feel like adding an option there would just be less efficient and use more memor y
09:55:10FromDiscord<Elegantbeef> Right now in my game i have an enum with `box` and `turret` i'm not going to use an `Option[bool]` since it doesnt make sense to
09:55:11FromDiscord<ITR> (edit) "memor y" => "memory"
09:55:21FromDiscord<Phil> I'm mostly confused by the "no-value"-state of an enum
09:55:32FromDiscord<Elegantbeef> It's not no value they want the code to always run
09:55:35FromDiscord<Phil> (edit) "enum" => "enum-field"
09:55:54FromDiscord<ITR> In reply to @Isofruit "I'm mostly confused by": "runs if myEnum is Value1 or Value2" is what was in their comment
09:56:25FromDiscord<Elegantbeef> They just want a scope in the try that runs
09:56:32FromDiscord<Elegantbeef> Which is redundant when you can just put the statement afterr
09:56:35FromDiscord<Elegantbeef> sorry scope in the case
09:57:36FromDiscord<Phil> sent a code paste, see https://paste.rs/pN2
09:57:49FromDiscord<Phil> So I assumed there was a scenario in which myEnum had no value
09:57:50FromDiscord<ITR> In reply to @Isofruit "I think I got": yea, but i think that's exactly what they want, lol
09:59:47FromDiscord<ambient> is there any prettier way of doing this: var val: int16 = (cast[ptr int16](wavFile.data[i].addr))[] --- I'm converting a stream of bytes into int16
10:00:08FromDiscord<ambient> (edit) "is there any prettier way of doing this: var val: int16 = (cast[ptr int16](wavFile.data[i].addr))[] --- I'm converting" => "sent" | "stream of bytes into int16" => "code paste, see https://paste.rs/u9s"
10:00:48FromDiscord<Phil> In reply to @Elegantbeef "Which is redundant when": This is what I somehow assumed wasn't possible as I thought it wouldn't be a question if that was an option.
10:02:24FromDiscord<Rika> In reply to @ambient "is there any prettier": Cast the data itself into int16?
10:03:03FromDiscord<Rika> Oh
10:03:53FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=
10:04:00FromDiscord<Rika> I don’t know if I copied any new lines
10:06:40FromDiscord<ITR> Bleh, the error messages in std/json are horrible
10:08:03FromDiscord<ITR> I think it's not using the hook, and thus erroring because it's getting an array instead of an object
10:09:26FromDiscord<ambient> sent a code paste, see https://play.nim-lang.org/#ix=
10:10:39FromDiscord<Rika> Oops my bad
10:10:43FromDiscord<Rika> Didn’t see lol
10:28:33*Zectbumo quit (Remote host closed the connection)
10:35:24FromDiscord<SirElephant> sent a code paste, see https://paste.rs/Ds2
10:35:36FromDiscord<SirElephant> i want the output to be like this`.-`
10:36:03FromDiscord<SirElephant> sent a code paste, see https://play.nim-lang.org/#ix=3WIY
10:36:12FromDiscord<SirElephant> (edit) "https://play.nim-lang.org/#ix=3WIY" => "https://paste.rs/e9T"
10:36:23FromDiscord<SirElephant> how do i fix this?
10:38:43FromDiscord<0ffh> Check the type of translations_a, I'd guess it is seq[seq[string]]. If that's the case you probably want translation:a[k][1]
10:39:00FromDiscord<0ffh> (edit) "translation:a[k][1]" => "translation_a[k][1]"
10:39:43FromDiscord<Rika> In reply to @0ffh "Check the type of": No
10:39:50FromDiscord<SirElephant> ummm can you edit the code above and tell me?
10:39:51FromDiscord<Rika> When you read a file it’s a single string
10:39:55FromDiscord<Rika> It doesn’t split at new lines
10:40:12FromDiscord<SirElephant> oh
10:40:16FromDiscord<Rika> You have to split new lines (better yet iterate) then split :
10:40:42FromDiscord<0ffh> Ah, sorry, my bad.
10:41:17FromDiscord<0ffh> Actually I wanted to ask a question myself.
10:41:17FromDiscord<0ffh> I have an application that has a ton of variable churn, as in it creates tons of short-lived variables of a certain type. How would I most efficiently implement a re-use the allocated memory of these variables (think object pool)? Or is there a good library for that?
10:41:22FromDiscord<SirElephant> In reply to @Rika "You have to split": how do i do that?
10:42:41FromDiscord<SirElephant> ??
10:44:36FromDiscord<0ffh> for line in lines "file.txt":↵ echo line
10:44:53FromDiscord<0ffh> Reads the file line by line
10:45:22FromDiscord<0ffh> (edit) "for line in lines "file.txt":↵ echo line" => "sent a code paste, see https://play.nim-lang.org/#ix=3WIZ"
10:45:25FromDiscord<Rika> https://nim-lang.org/docs/io.html#lines.i%2CFile
10:47:48FromDiscord<Phil> In reply to @0ffh "I have an application": I can't really give qualified advice here. ↵But if you want an object pool, you could check out tinypool (which does connection pooling), copy the code and adjust it to your needs.↵If anyone else chimes in, they likely have a better idea of what they're doing and you might want to listen to them more than to me, just wanted to provide some level of help you can fall back to.
10:48:19FromDiscord<Phil> (edit) "In reply to @0ffh "I have an application": I can't really give qualified advice here. ↵But if you want an object pool, you could check out tinypool (which does connection pooling), copy the code and adjust it to your needs.↵If anyone else chimes in, they likely have" => "sent" | "better idea of what they're doing and you might want to listen to them more than to me, just wanted to provide some level of help you can fall b
10:49:01FromDiscord<0ffh> In reply to @Isofruit "I can't really give": Great, that's a good hint! I'll check out that code and see if I can adapt it.
10:51:33FromDiscord<Phil> In reply to @0ffh "Great, that's a good": The core code is like 200 lines of which half is whitespace or comments, so hopefully not a lot of work
10:55:08FromDiscord<d4rckh> does `walkDir` recursively get files?
10:56:40FromDiscord<Rika> In reply to @0ffh "I have an application": Do you know that this is causing you issues
10:58:05FromDiscord<Rika> or is it just “I think it is so it probably is”
10:58:37FromDiscord<Rika> Point being can you actually test before optimising, pre optimisation is a waste of time
10:58:51FromDiscord<Rika> If you really want to, are your variables reference types or regular
11:02:11FromDiscord<d4rckh> i am creating a new macro: `macro importDirectory(a: string): untyped =`, why's `a` of type NimNode when I use it with walkDir, but when I print it, it prints like a normal string? https://media.discordapp.net/attachments/371759389889003532/970278958174208000/unknown.png
11:02:28FromDiscord<d4rckh> this is how i call it btw `importDirectory("src/clientTasks")`
11:03:21FromDiscord<Rika> If you want it to be passed as a regular string use “static string”
11:03:40FromDiscord<d4rckh> wow ty
11:08:34*slowButPresent joined #nim
11:28:00FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WJ6
11:28:06FromDiscord<d4rckh> i got this from dump tree https://media.discordapp.net/attachments/371759389889003532/970285480811847740/unknown.png
11:28:22FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WJ7
11:28:48FromDiscord<d4rckh> but its saying thats not the proper use of newCall()
11:29:30FromDiscord<d4rckh> i think i am supposed to use proc `newCall(theProc: string; args: varargs[NimNode]):`
11:29:46FromDiscord<d4rckh> i assume theProc is gonna be add, what about args?
11:32:12FromDiscord<Rika> You’re putting identifier add inside the identifier command
11:32:20FromDiscord<Rika> Wait no I didn’t see it properly
11:32:32FromDiscord<Rika> What’s the precise error
11:33:22FromDiscord<Rika> Make a new tree of type call instead I guess
11:34:38*firq joined #nim
11:37:28NimEventerNew post on r/nim by owl_000: Is move of a ref object and accessing later to the object supposed to compile?, see https://reddit.com/r/nim/comments/ufy1a7/is_move_of_a_ref_object_and_accessing_later_to/
11:53:15FromDiscord<d4rckh> In reply to @Rika "What’s the precise error": oh sorry for not posting it.
11:53:25FromDiscord<d4rckh> sent a code paste, see https://paste.rs/Uho
11:58:42FromDiscord<Phil> Hoh boy, d-release with lto flag can truly take a bit
12:06:33*PMunch joined #nim
12:07:19FromDiscord<Rika> LTO takes time
12:15:30FromDiscord<d4rckh> ok i figured it out
12:15:34FromDiscord<d4rckh> sent a code paste, see https://paste.rs/hSi
12:46:32*joshbaptiste quit (Ping timeout: 250 seconds)
13:36:12*arkurious joined #nim
13:39:56FromDiscord<Zoom> Hey everyone! I'd like to use `setControlCHook` to send a cleanup message to a channel without making the channel var `{.global.}`. Is it doable?
13:41:00FromDiscord<Rika> No, that hook cannot be a closure
13:41:23FromDiscord<Rika> It’s not gonna be a global (pragma) but it will be a global
13:41:50FromDiscord<Rika> In reply to @Rika "No, that hook cannot": I think
13:41:50FromDiscord<FireLite> I am trying to get a process from dll to manage memory. Is there any libs for this or built in functions?
13:46:22PMunch@FireLite, not quite sure what you mean
13:48:59FromDiscord<FireLite> Nvm, I just realised that writing dll in c++ and nim is quite same. I can use `CreateThread`, `OpenProcess` and other things.
13:50:14FromDiscord<FireLite> Also, another questions, is there `NULL` in nim?
13:50:17FromDiscord<Zoom> The only stupid thing I can do is declare a global pointer to a channel and use that.
13:51:23FromDiscord<Zoom> But this is no better than declaring a channel itself `{.global.}`
13:56:27PMunch@FireLite, yes it's called `nil`
14:00:02FromDiscord<Rika> In reply to @Zoom "But this is no": I’d say it’s worse
14:42:09*joshbaptiste joined #nim
15:26:14FromDiscord<kiell> is there a way to have nim not yell at me about gc unsafe procs even when they're accessing global vars that are constant?
15:26:37FromDiscord<kiell> or do i just have to do the cast thing to ignore it
15:28:09FromDiscord<ynfle> In reply to @Knedlik "Devel doesn’t get flagged": Without devel on the latest stable nothing crashes. Try that. Does it still crash? If not, report a regression.↵How did you instigate the crash? I just ran the app and saw the screen and nothing crashed
15:28:40FromDiscord<Knedlik> Read the line right under that
15:30:38FromDiscord<ynfle> I don't think I said anything about getting resolved
15:30:44FromDiscord<ynfle> If I did, I don't remember
15:51:59*pch quit (Ping timeout: 240 seconds)
15:56:30*vicfred quit (Quit: Leaving)
16:22:19FromDiscord<Phil> In reply to @kiell "is there a way": Feel free to inform me if you figure out a way. I myself put all the gc-safe stuff into its own set of modules and left it there
16:25:52*pch joined #nim
16:32:32*vicfred joined #nim
16:44:01FromDiscord<2F42BBA1> in python there's str() is there something similiar to it in nim?
16:45:17FromDiscord<Phil> I mean, you can make it similar by making sure every module within which you define an object type also has a str() proc for it
16:45:26FromDiscord<haxscramper> In reply to @2F42BBA1 "in python there's str()": `$` on any object/value
16:45:41FromDiscord<haxscramper> `$12`, `$[12, 23]`, `$(field: 12)` etc.
16:45:46FromDiscord<Phil> Oh, right, `$` is the nim sign for string conversion
16:46:55FromDiscord<@singularperturbation-56538b4816> Are there any plans to warnings for accessing a value after being moved? I saw https://www.reddit.com/r/nim/comments/ufy1a7/is_move_of_a_ref_object_and_accessing_later_to/ and that confused me - I'd like to make accessing-after-moved a compile-time error, if possible
16:47:14FromDiscord<2F42BBA1> In reply to @haxscramper "`$12`, `$[12, 23]`, `$(field:": var s = $trolleybus()↵↵↵like that?
16:47:21FromDiscord<haxscramper> yes
16:47:33FromDiscord<haxscramper> (almost) any object can be converted to string using `$`
16:47:43FromDiscord<haxscramper> except for pointers and references, to avoid inifite cycles
16:48:03FromDiscord<haxscramper> for those you either need to dereference object via `[]`, or provide own implementation of `$` procedure
16:48:17FromDiscord<haxscramper> ``proc `$`(a: YourObject): string``
17:04:39nrds<Prestige99> I'm using a github link as a dependency in my nimble file, but am making changes to that dependency locally. Attempting to use `nimble develop` to link to that package, but it's just using the version downloaded from github
17:04:53nrds<Prestige99> How is this supposed to work so I can use my local version?
17:06:41FromDiscord<ynfle> In reply to @Isofruit "Feel free to inform": You have to cast the block
17:07:57FromDiscord<vindaar> check where `nimble` is pointing to using `nimble path <package>`. If it's not to your local directory of the package, I'd just delete the directory of the downloaded package and call `nimble develop` in the local one again
17:08:31FromDiscord<Phil> In reply to @ynfle "You have to cast": Oh I know how to get past the gc-safe limitation with cast, I was under the assumption that kiell was looking for a more beautiful solution than just casting
17:08:51FromDiscord<Phil> Because I have entire modules where almost every proc is annotated with casting to gc-safe
17:09:44FromDiscord<Phil> In reply to @haxscramper "(almost) any object can": I think any object with a DateTime field is pre-destined to blow up in your face if you haven't specified a formatting proc IIRC
17:10:02nrds<Prestige99> vindaar: It's downloading the latest version from the github repo, even though there's already a linked version of the package in ~/.nimble/pkgs - which is weird
17:10:08FromDiscord<Phil> Been a while since the compile yelled at me for stringifying an object without meeting some hoops, not entirely sure what they all were
17:10:20FromDiscord<Phil> (edit) "meeting" => "jumping through"
17:10:23nrds<Prestige99> Keep having to fiddle with nimble's crap every time
17:10:47FromDiscord<vindaar> wait, how do you compile the thing that uses the dependency?
17:11:31nrds<Prestige99> just using nim r myfile.nim, Problem is it will just say it can't find the dependency unless I nimble install -dy
17:11:43nrds<Prestige99> but then it downloads and uses the online version instead of the local version
17:12:25nrds<Prestige99> Maybe I'll just make a min repro and create an issue in nimble
17:12:28FromDiscord<vindaar> huh, that's really weird
17:12:33FromDiscord<vindaar> have you tried manually deleting all versions of the dependency in `~/.nimble/pkgs` and then `nimble develop` -ing the local thing?
17:13:33nrds<Prestige99> Yeah that gets it working, but I have to make sure I have all the other deps already downloaded. Because if I run nimble install -dy afterward, it replaces the local version with the online version
17:13:58FromDiscord<vindaar> I don't understand how it can download from github if you never call nimble directly. Because when doing `nimble develop` locally there's no reason it would download anything after all
17:14:34FromDiscord<vindaar> ah, that's possible yeah
17:18:16FromDiscord<kiell> In reply to @Isofruit "Feel free to inform": for my specific case i figured out a way but not sure yet about general workarounds
17:21:16*vicfred quit (Quit: Leaving)
17:41:29*vicfred joined #nim
17:52:16FromDiscord<Zodey> anybody has idea why the output is only 4 and not 456? https://media.discordapp.net/attachments/371759389889003532/970382157572878346/unknown.png
17:53:53FromDiscord<huantian> Prefixing your variable names with the quite classy
17:54:35FromDiscord<Zodey> In reply to @huantian "Prefixing your variable names": ?
17:54:56FromDiscord<huantian> (edit) "the" => "`the`"
17:55:04FromDiscord<huantian> Nothing I was just poking fun of your variable names
17:55:19FromDiscord<ynfle> In reply to @Isofruit "Because I have entire": I would recommend limiting that functionality to a small layer of the program
17:55:23FromDiscord<huantian> Does it work if you don’t subtract theStaet from theEnd
17:55:27FromDiscord<Zodey> In reply to @huantian "Nothing I was just": nim didnt let me use only start and end xD
17:55:44FromDiscord<huantian> Use startIndex endIndex or something
17:56:24FromDiscord<Zodey> In reply to @huantian "Does it work if": that doesnt makes sense
17:56:40FromDiscord<Zodey> but yeah, i got 4567
17:57:43FromDiscord<huantian> I would personally do [startIndex..<endIndex]
17:58:02FromDiscord<m4ul3r> I have a long sequence that contains a bunch of stuff like `dictionary.txt:word`, how can remove each element that contains `dictionary.txt`. I'm trying to use filterit but can't seem to figure it out
17:58:26FromDiscord<Zodey> In reply to @huantian "I would personally do": what do you mean?
17:58:37FromDiscord<Zodey> sorry, new to this lang
17:58:46FromDiscord<huantian> In reply to @m4ul3r "I have a long": someSeq.filterIt(“dictionary.txt” in it)
17:58:54FromDiscord<Phil> In reply to @ynfle "I would recommend limiting": Generally I agree, database delete procs tend to not go without that though
17:59:33FromDiscord<Phil> Oh an db-connection pooling was something I couldn't figure out without copious amounts of casting gc-safe
17:59:43FromDiscord<Phil> (edit) "Oh an db-connection pooling was something I couldn't figure out without copious amounts of casting gc-safe ... " added "(while using a lock naturally)"
18:00:17FromDiscord<m4ul3r> In reply to @huantian "someSeq.filterIt(“dictionary.txt” in it)": 🙏 thanks, I kept doing it the other way (it in "dictionary.txt")
18:04:26FromDiscord<huantian> In reply to @Zodey "sorry, new to this": No problem, “string”[1..3] is the same as “string”.substr(1, 3) I think
18:05:41FromDiscord<huantian> It’ll return the substring from index 1 to index 3, both inclusive
18:05:47*kayabaNerve quit (Ping timeout: 240 seconds)
18:06:35FromDiscord<huantian> https://nim-lang.org/docs/system.html#substr%2Cstring%2Cint%2Cint
18:07:13FromDiscord<huantian> When you do “string”[1..<3], that makes the second bound non inclusive
18:08:03FromDiscord<Zodey> i see
18:08:28FromDiscord<Zodey> sent a code paste, see https://paste.rs/nvL
18:08:35*Zectbumo joined #nim
18:09:28FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3WKB
18:09:56FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3WKC
18:10:23*kayabaNerve joined #nim
18:10:58FromDiscord<Zoom> You don't handle error cases at all, no bueno 🚓
18:11:13FromDiscord<Zodey> 😂
18:11:44FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3WKD
18:11:49FromDiscord<Zodey> still better then copying a random code from the internet :nim2:
18:12:31FromDiscord<Zodey> (edit) "still better then copying a random code from the internet ... :nim2:" added "(which i doesnt understand)"
18:13:06FromDiscord<Zoom> And damn `find` doesn't work on openArray! (I think I'm becoming [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org) 's lesser copy)
18:13:34FromDiscord<huantian> Or just use strscans!↵Actually not sure if that works for this
18:14:52FromDiscord<huantian> Yeah no it doesn’t
18:14:58FromDiscord<Zoom> If you have questions about my snippet above, shoot↵(@Zodey)
18:15:02FromDiscord<huantian> Idk what I was thinking
18:16:28FromDiscord<Zodey> In reply to @Zoom "If you have questions": well, basically im completely new to nim, so basically i just dont know what block: .high(), some and none means
18:16:38FromDiscord<Zodey> but i think i just need to learn it
18:16:46FromDiscord<Zodey> your code is logical i guess
18:18:34*Zectbumo quit (Remote host closed the connection)
18:19:35FromDiscord<Zoom> Also, docs for "find" suggest this\:@xflywind , you have some explaining to do here 😅
18:24:12FromDiscord<Zoom> `some` and `none` are wrappers of [Option](https://nim-lang.org/docs/options.html), a type which represents optional values. Use them (don't forget to `import std/options`)↵`high` in this case is just `string.len() - 1`, i.e. the [highest index](https://nim-lang.org/docs/system.html#high%2Ccstring)↵(@Zodey)
18:26:22FromDiscord<Zoom> `block:` in this case this is a way to make an expression of a few lines. block creates a scope, so in cases like this it's handy to contain all temporary operations inside it. https://nim-lang.org/docs/manual.html#statements-and-expressions-block-expression
18:30:34*jmdaemon joined #nim
18:32:03FromDiscord<Zoom> @Zodey\: Also, use `func` and `let` by default, going to `proc` and `var` only when necessary, use `echoDebug` for what it says it's for.↵And please, use code blocks to share your short snippets, not screenshots. For longer bits of code use Nim playground's `share to ix.io`.
18:32:35FromDiscord<Phil> I think first things first
18:32:41FromDiscord<Phil> Zodey, have you heard of `null` so far?
18:32:49FromDiscord<Phil> Not in nim, in general
18:34:09FromDiscord<Phil> (edit) "Not in nim, in general ... " added "(imo it makes more sense to give a quick rundown of optionals once you realize what they're trying to solve)"
18:40:40FromDiscord<Zodey> In reply to @Zoom "<@460785667820224512>\: Also, use `func`": okay, thank you↵whats the difference between func and proc? i know what is var
18:41:01FromDiscord<Zodey> In reply to @Isofruit "<@460785667820224512> , have you": yeah, i have some c and c++ experience
18:42:21FromDiscord<Zodey> (edit) "In reply to @Zoom "<@460785667820224512>\: Also, use `func`": okay, thank you↵whats the difference between func and proc? i know what is ... var" added "the diff between let and"
18:43:22FromDiscord<Phil> Ohhh so just new to the language, alrighty, then you know how null is really annoying to deal with. Optional "none" expresses the same concept as null, but by having a variable be an optional-type you express that this may be null or not.
18:44:10FromDiscord<Phil> If it isn't optional, it's guaranteed to have a value. If it is optional, you'll want to check if it has or doesn't have a value with "isNone()" or "isSome()" before unpacking the value out of the optional with "get()".↵As for fun and proc, they're the same, but func has the compiler checking for side-effects
18:44:27FromDiscord<Phil> So e.g. in a func-call, you can't echo because that's a side-effect and in funcs the compiler ensures those do not happen
18:44:43FromDiscord<Zodey> In reply to @Isofruit "Ohhh so just new": yeah, i have some java and rust experience as well, but im still noob, so dont think im good 😄
18:45:14FromDiscord<Phil> In reply to @Zodey "yeah, i have some": That works fine, just need to know how much you're already aware of to know where to start with explanations.↵If you've seen rust, you've likely also seen Result types
18:45:21FromDiscord<Phil> We don't have those here, this follows java-style exception handling
18:45:41FromDiscord<Zodey> well, i really has a little rust
18:45:55FromDiscord<Zodey> just the basics, then i switched to nim
18:46:05FromDiscord<Zodey> so much cleaner
18:46:05FromDiscord<huantian> We have results if you use them 😛
18:46:08FromDiscord<Phil> Check, for me it was similar, though I hadn't been aware of nim before
18:46:14FromDiscord<Phil> In reply to @huantian "We have results if": Wait, we do?
18:46:18*Gustavo6046 joined #nim
18:46:26FromDiscord<huantian> Well as a nimble package
18:46:32FromDiscord<Phil> Hah! I knew it!
18:46:50FromDiscord<Phil> I will contemplate introducing that package into my codebase though, I like result types
18:46:58FromDiscord<huantian> “have” is vague 😉
18:48:15FromDiscord<Phil> In reply to @Zodey "well, i really has": Similarly to rust, you declare variables and depending on how you declare them they're either mutable or immutable.↵Let = Immutable↵var = Mutable↵Const = Immutable, the variable is defined at compile-time and can't be changed at runtime, it can only be read
18:49:30FromDiscord<Phil> And I think anyway, that's it for unasked starting points from my end that you may or may not have already been aware of ^^
18:50:05FromDiscord<huantian> Also do read the tutorials if you haven’t yet
18:50:22FromDiscord<Zodey> In reply to @Isofruit "And I think anyway,": its okay, thanks for everything ❤️
18:50:24FromDiscord<Phil> Nim tutorial 1,2, 3 and nim by example are solid pages to have bookmarks of
18:50:37FromDiscord<Phil> I still reference those regularly
18:52:05FromDiscord<d4rckh> In reply to @Isofruit "Nim tutorial 1,2, 3": i dont have them bookmarked but they always pop up in search results when i need some help in nim
18:52:10FromDiscord<d4rckh> indeed they are super useful
18:52:21FromDiscord<Phil> sent a long message, see http://ix.io/3WKH
19:11:05FromDiscord<Zoom> https://github.com/arnetheduck/nim-result/↵(@Phil)
19:12:45FromDiscord<Phil> ~~What I'm learning for the most part is, if there's a language feature, people have written macros to copy it~~
19:13:11FromDiscord<Zoom> That's a dead plain type
19:17:58FromDiscord<huantian> Yeah you don’t need macros for result
19:20:48FromDiscord<Phil> Ohhhh they solve this with an object variant
19:20:48FromDiscord<Phil> Neat
19:21:11FromDiscord<Phil> Well, they are somewhat limited to only one type of error per result though so that's a shame
19:27:16FromDiscord<huantian> Why would your errors be multiple types
19:28:28FromDiscord<Phil> proc that queries the database for example can error out at runtime because the SQL fails (DbError) or the conversion of row to object fails (... I dunno know one that'll be)
19:28:46FromDiscord<huantian> Then the type is just ref Excpetion
19:28:51FromDiscord<Phil> (edit) removed "know"
19:29:47FromDiscord<Phil> That doesn't change the key issues that you can't react differently to different types of exceptions
19:30:35FromDiscord<Phil> At least not in a beautiful way. I guess you might be able to try and cast that exception to different types of exceptions and behave accordingly?
19:30:37FromDiscord<huantian> If result.err of DbError
19:30:47FromDiscord<Phil> But that would kinda require you to know all error types ahead of time
19:30:57FromDiscord<Phil> Which is sorta not cool in terms of encapsulation
19:31:09FromDiscord<Phil> (edit) "But that would kinda require you to know all error types ahead of time ... " added "by looking them up"
19:31:19FromDiscord<Phil> (edit) "encapsulation" => "encapsulation/effort"
19:31:37FromDiscord<huantian> Then maybe use an anonymous union
19:32:16FromDiscord<Phil> that I could see working... if that does work? The result type is a generic, I'm unsure whether that would explode or not
19:32:48FromDiscord<huantian> How do other langs handle Results? Do you just specify what exceptsiojs in can hold in the type?
19:32:54FromDiscord<huantian> In reply to @Isofruit "*that* I could see": Nah it should be fine
19:33:15FromDiscord<Phil> Man my Rust has been a while, I'd need to look it up how they handle it again
19:34:13FromDiscord<Phil> Apparently they write error-enums?
19:34:16FromDiscord<huantian> It seems they just rise strings
19:34:24FromDiscord<huantian> (edit) "rise" => "use"
19:34:36FromDiscord<Phil> > If you expect to handle the errors (to recover from them in a way that is specific to which error occurred), or if you're writing a library, then define an enum type which can hold any of the errors might occur. Each enum variant might either contain the original error value (so it can be retrieved), or not (if the original error is purely an implementation detail). The thiserror crate can help you implement Error and From for such enums.
19:34:50FromDiscord<Phil> In reply to @huantian "It seems they just": Oh, under the hood? No clue
19:35:13FromDiscord<huantian> Yeah you could use strings and enums in Nim too ig
19:35:29FromDiscord<huantian> But doesn’t using enums mean you have to make a enum for each proc?
19:35:54FromDiscord<huantian> Maybe the solution is just use exception tracking 😛
19:35:57FromDiscord<Phil> Yeah, that could very quickly become very painful if you have a bunch of error types you can actually deal with
19:36:56FromDiscord<Phil> The only good thing I can say about exception tracking is that I can hide it with templates
19:37:44FromDiscord<Phil> I think this might be an aesthetic style-choice or something but exceptions are one of those things that just feel disruptive when reading the flow of code
19:38:06FromDiscord<Phil> (edit) "I think this might be an aesthetic style-choice ... or" added "from me"
19:38:28FromDiscord<Phil> (edit) "are" => "tracking things is"
19:40:13FromDiscord<huantian> I meannnn you’re gonna have the same problem if you specify all the different result errors
19:40:32FromDiscord<Phil> Yeah but those will behave more like a case-statement
19:40:35*xet7 quit (Remote host closed the connection)
19:42:31*xet7 joined #nim
19:42:50FromDiscord<Phil> Try-catch is "start comprehending you're in a new block now, eyes scan lower, recognize what part of the code might be throwing the exception, scan up again at try to double-check whether this was a try-with-resources, scan down again to find the "catch/except/whatever" keyword and maybe it'll cover the exception that is being thrown"
19:45:10FromDiscord<Phil> Result is "Get something back, do a case statement, explicitly handle all the errors or explicitly don't handle them, unpack your value from the happy-path and finished". Or you can explicitly hand those results up to the next proc by returning yet another result type
19:45:44FromDiscord<Phil> To me it feels and reads nicer
19:53:47FromDiscord<arnetheduck> Relevant section from or style guide: https://status-im.github.io/nim-style-guide/errors.html
19:59:03FromDiscord<Phil> Huh, turns out the result library page nets you a 404: https://status-im.github.io/nim-style-guide/libraries.result.html
20:05:01FromDiscord<Phil> In reply to @arnetheduck "Relevant section from or": > ## Use an `enum` to provide in-depth errors where the caller is expected↵> ## to have different logic for different errors↵So that's how multiple errors get returned, neat!
20:05:51FromDiscord<arnetheduck> https://status-im.github.io/nim-style-guide/libraries.results.html
20:06:11FromDiscord<arnetheduck> Link needs updating
20:22:52FromDiscord<!Patitotective> https://github.com/xmonader/nimassets/pull/13 👀
20:48:04FromDiscord<!Patitotective> In reply to @Elegantbeef "`myData[0].addr` or `myData[0].unsafeaddr`": that does return `ptr char` and i need `pointer`↵`cast[pointer](myData[0].addr)`?
20:55:53*PMunch quit (Quit: leaving)
20:56:49FromDiscord<Generic> in Nim any typed pointer (`ptr T`) implicitly casts to an untyped pointer (`pointer`)
20:58:18FromDiscord<!Patitotective> :o
21:08:00*xet7 quit (Remote host closed the connection)
21:15:14FromDiscord<!Patitotective> how can i `strcpy` in nim? :p
21:18:24FromDiscord<ynfle> `let x = y`
21:18:31FromDiscord<Zoom> stringA=stringB↵(@!Patitotective)
21:19:37FromDiscord<!Patitotective> thanks 🤔
21:20:24FromDiscord<Elegantbeef> Hey you cannot be my lesser i'm the bottom of the totem pole
21:20:25FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3WLh
21:21:26FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3WLj
21:21:51FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3WLk
21:22:03FromDiscord<ynfle> `stringA.setLen(stringB.len)`
21:22:22FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3WLl
21:22:43FromDiscord<Elegantbeef> Zoom they cant see our reactions
21:22:49FromDiscord<Zoom> I know \:)
21:23:18FromDiscord<Elegantbeef> Ah it'll be our little secret
21:24:11FromDiscord<Elegantbeef> Also why do you think you're becoming my lesser?
21:24:48FromDiscord<Zoom> I want lots of the same damn things
21:25:04FromDiscord<Elegantbeef> Ah
21:26:14FromDiscord<!Patitotective> hey beeeef :]↵im struggling to make the imgui `addFontFromMemoryTTF` stuff ↵you said that `addFontFromMemoryTTF(data[0].addr)` but when i do `context.igDestroyContext` it fails with `munmap_chunk(): invalid pointer↵`
21:26:45FromDiscord<Bubblie> I should probs get back into doing nim vulkan
21:26:48FromDiscord<Bubblie> I left it on hold
21:27:08FromDiscord<!Patitotective> sent a long message, see http://ix.io/3WLn
21:27:14FromDiscord<!Patitotective> (edit) "http://ix.io/3WLn" => "http://ix.io/3WLo"
21:27:39FromDiscord<!Patitotective> In reply to @Bubblie "I should probs get": 👀
21:27:48FromDiscord<Bubblie> ?
21:28:06FromDiscord<Bubblie> 👁️👁️
21:28:13FromDiscord<Bubblie> Yes? Lol
21:28:17FromDiscord<Elegantbeef> Provide code patito
21:29:47FromDiscord<!Patitotective> In reply to @Bubblie "Yes? Lol": just saying that im 👀 if you do the bindings
21:30:15FromDiscord<!Patitotective> (edit) "im" => "ill be"
21:31:08FromDiscord<Elegantbeef> But yea Zoom i just want things to be more usable 😛
21:31:21FromDiscord<Elegantbeef> Concepts make code reuse much better than hard coded types
21:31:21FromDiscord<Zoom> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: btw, what do you think about https://github.com/nim-lang/Nim/issues/14810 ?
21:31:54FromDiscord<Zoom> It's kind of embarrassing that such issues just stall without any closure.
21:32:12FromDiscord<Elegantbeef> It's pointless accept `openArray[char or byte]`
21:32:29FromDiscord<Elegantbeef> Oh it's for converting to string i see
21:32:30FromDiscord<Elegantbeef> I cannot read
21:33:35FromDiscord<Elegantbeef> I think it's more of an issue with lack of usable view types
21:33:44FromDiscord<!Patitotective> In reply to @Elegantbeef "Provide code patito": https://play.nim-lang.org/#ix=3WLp↵`ProggyVector Regular.ttf`: https://github.com/bluescan/proggyfonts/raw/master/ProggyVector/ProggyVector%20Regular.ttf
21:33:47FromDiscord<Elegantbeef> In a world with view types we dont need this hack
21:34:22FromDiscord<Elegantbeef> we just have a `OpenString[T: char or byte] = distinct openarray[T]` and convert it to that
21:34:48FromDiscord<Bubblie> In reply to @Patitotective "just saying that ill": Im testing vulkan bindings already created for nim, and I used futhark for glfw
21:35:04FromDiscord<Zoom> If we can't push 3 lines of code since june 2020, how long will it take for view types to materialize? \:D
21:36:01FromDiscord<Elegantbeef> I mean Zoom you can do this outside of the stdlib so it's not a overly large concern imo
21:36:29FromDiscord<Elegantbeef> I personally dont get into the swinging of insults around these things
21:37:08FromDiscord<Zoom> I don't think I insulted anyone. I hope I didn't.
21:37:50FromDiscord<Zoom> And you can do almost anything outside of stdlib
21:37:53FromDiscord<Elegantbeef> Eh i might just have misread the way the last message was sent 😄
21:38:13FromDiscord<Elegantbeef> Patitot you silly person
21:38:13FromDiscord<Elegantbeef> `sizeof(fontData)` is 8
21:38:14FromDiscord<Elegantbeef> you want `len`
21:38:23FromDiscord<!Patitotective> In reply to @Bubblie "Im testing vulkan bindings": i-i thought you said nuklear :[
21:38:44FromDiscord<Elegantbeef> You can wrap nuklear with futhark in like a minute probably 😄
21:38:52FromDiscord<Elegantbeef> Speaking of futhark did i miss pmunch?!
21:39:15FromDiscord<Elegantbeef> Fuck i did, damn being 8 hours apart is such a disaster
21:39:40FromDiscord<!Patitotective> In reply to @Elegantbeef "you want `len`": 🤔 you smart beef↵yet `free(): invalid size`
21:39:58FromDiscord<Elegantbeef> Can you guys in EU move norway to the west for a few days?
21:40:15FromDiscord<dom96> In reply to @Elegantbeef "I personally dont get": curious what you found insulting? :)
21:40:27FromDiscord<Elegantbeef> Eh disregard it
21:41:39FromDiscord<Elegantbeef> Also you realize patito you're getting 0 benefit from this `readFile` api right?
21:41:56FromDiscord<Zoom> I might be vitriolic, but I rarely insult. Barefaced 😅
21:42:47FromDiscord<Elegantbeef> Yea i dont know what to say here, there doesnt seem to be anything that stands out to me that'd make sense for a issue
21:43:13FromDiscord<Bubblie> In reply to @Patitotective "i-i thought you said": Nuklear gui?
21:43:14FromDiscord<!Patitotective> In reply to @Elegantbeef "Also you realize patito": in my actual code im getting the data like that because im now using nimassets 👀
21:43:15FromDiscord<Elegantbeef> There isnt any reason for it to attempt to free your cstring
21:43:15FromDiscord<Bubblie> What about it
21:43:32FromDiscord<Bubblie> Vulkan and Nuklear are diff
21:43:33FromDiscord<!Patitotective> In reply to @Elegantbeef "There isnt any reason": https://github.com/ocornut/imgui/issues/220 ?
21:43:36FromDiscord<Elegantbeef> also you can just do `myString.cstring` i think
21:43:41FromDiscord<!Patitotective> In reply to @Bubblie "Vulkan and Nuklear are": yea, i misread sorry
21:44:02FromDiscord<Bubblie> I was thinking about using nuklear tho
21:44:05FromDiscord<Elegantbeef> Jesus that's fucking stupid
21:44:17FromDiscord<Bubblie> ?
21:44:38FromDiscord<Zoom> I have bad news for you. Norway is slowly drifting away. At least from the pov if a position between the Americas' East Cost and Europe.
21:44:53FromDiscord<Elegantbeef> A program should not take ownership of a cstring since it doesnt know how it was allocated
21:45:37FromDiscord<Elegantbeef> Well as the author suggests use `addFont`
21:45:58FromDiscord<Elegantbeef> There is no reason to use this API it's purposely written dumbly
21:46:21FromDiscord<Elegantbeef> When you take a pointer to a value as a library you only free it if it's certainly allocated by you
21:46:50FromDiscord<Elegantbeef> This is why we have things like `MyLibrary_AllocString` or w/e
21:47:19FromDiscord<!Patitotective> In reply to @Elegantbeef "Well as the author": ok let me try 🙃
21:48:24FromDiscord<Elegantbeef> You can of course use `igMemAlloc`
21:48:31FromDiscord<Elegantbeef> But it's dumb as hell since it's a copy
21:49:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WLt
21:50:00FromDiscord<Elegantbeef> Then it should work fine with load from memory
21:50:09FromDiscord<Elegantbeef> It's silly as hell this is required but alas
21:51:00FromDiscord<Elegantbeef> actually it takes length in so you dont need the `+ 1`
21:54:17FromDiscord<!Patitotective> In reply to @Patitotective "ok let me try": its not working https://play.nim-lang.org/#ix=3WLu 😕
21:54:41FromDiscord<Elegantbeef> Well yea you need to make a fontconfig or w/e
21:54:53FromDiscord<Elegantbeef> Well properly i guess
21:55:12FromDiscord<Elegantbeef> Ah god damn i cannot read
21:55:33FromDiscord<Elegantbeef> Someone take my eyes from me
21:55:41FromDiscord<!Patitotective> https://nimgl.dev/docs/imgui.html#newImFontConfig void 💀
21:55:49FromDiscord<Elegantbeef> Same issue with the condif?
21:55:54FromDiscord<!Patitotective> In reply to @Elegantbeef "Someone take my eyes": 👀
22:02:56FromDiscord<!Patitotective> `free(): invalid size` with https://play.nim-lang.org/#ix=3WLw
22:03:22FromDiscord<Elegantbeef> Did you just disregard my easy solution?
22:06:06FromDiscord<!Patitotective> yea, it works (~~yet the beautiful code~~)
22:06:20FromDiscord<!Patitotective> thanks 👍
22:07:12FromDiscord<ambient> coincidentally I've also been looking for a decent OpenGL lib that can handle compute shaders hopefully with some ready-made battle-tested convinience wrappers, but most repos seem to be at least 2 years old. so at this point I'm just considering directly calling the .dll
22:07:38FromDiscord<Elegantbeef> Hey my framework could take some compute shaders 😄
22:08:01FromDiscord<Elegantbeef> It doesnt have support for them but hey i'd like it 😛
22:08:11FromDiscord<ambient> there's a lot of cool stuff, but the problem is fragmentation and maintenance
22:08:34FromDiscord<Elegantbeef> I havent got the point where i've needed compute shaders yet so havent abstracted them yet
22:08:42FromDiscord<ambient> I would have to build my own lib from 4 different sources
22:17:03FromDiscord<!Patitotective> can i run a nimble task from another nimble task? like in nake https://fowlmouth.github.io/nake/gh_docs/master/nakelib.html#runTask,string
22:23:10FromDiscord<dom96> selfExec("task") iirc
22:23:25FromDiscord<Zoom> Yep. Add a `Task()` suffix to a call↵(@!Patitotective)
22:23:45FromDiscord<!Patitotective> :o thanks 👍
22:24:18FromDiscord<dom96> calling it like that is a bit of a hack :)
22:24:33FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3WLB
22:24:55FromDiscord<Zoom> Why is it in the docs then?↵(@dom96)
22:25:29FromDiscord<Zoom> https://nim-lang.org/docs/nimscript.html#task.t%2Cuntyped%2Cstring%2Cuntyped
22:26:57FromDiscord<Zoom> BTW, judging from `selfExec` description in the docs, it should work. So it callin Nim from a Nimble task is a bug
22:27:14FromDiscord<dom96> Good question. I see this as an implementation detail.
22:27:24FromDiscord<dom96> and indeed Nimble has it's implementation of `task`
22:28:08FromDiscord<dom96> hm, the bridge ate your message there
22:28:30FromDiscord<dom96> `selfExec` shouldn't call `nim` in a Nimble file
22:30:06FromDiscord<Zoom> Thanks for the confirmation. Do we need to file an issue on that?
22:37:14FromDiscord<Zoom> selfExe run from a .nimble file returns nim executable, not Nimble
22:37:47*firq quit (Ping timeout: 240 seconds)
22:43:11FromDiscord<Zoom> `getAppFilename` is not available from a nimscript. `paramStr(0)` returns nim too.
22:45:38FromDiscord<Elegantbeef> Zoom did moving to illwill mean my super amazing fix was replaced? 😄
22:46:28FromDiscord<Zoom> Yep, I wouldn't, but illwill's init and deinit are mandatory, even though I didn't need them
22:46:53FromDiscord<Elegantbeef> Eh illwill is nice from what i recall 😄
22:46:58FromDiscord<Zoom> It sets a global bool flag that gets checked on each getKey()
22:47:09FromDiscord<Zoom> that's not super-nice
23:15:18FromDiscord<pruno> sent a code paste, see https://play.nim-lang.org/#ix=3WLJ
23:16:56FromDiscord<Elegantbeef> `modulesPtr = modules[0].addr`
23:17:09FromDiscord<Elegantbeef> or `cast[ptr HModule](&modules)`
23:24:17FromDiscord<pruno> Thanks man, for the enumeration part, modified some other parts and my enum works :)
23:42:25FromDiscord<Elegantbeef> Also depending on the type of `modulesCount` you can just do `int` or equivlent
23:42:41FromDiscord<Elegantbeef> `cast` is generally only needed for low level conversions not type conversions
23:43:46FromDiscord<pruno> I see, thanks for the tip
23:44:20FromDiscord<pruno> Another question, how would you print a WideCString ?↵echo myWideCString results in /usr/lib/nim/system/widestrs.nim(180) $↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)
23:45:07FromDiscord<Elegantbeef> Check if it's `nil` first then call `$`
23:46:11FromDiscord<pruno> mmmh, seems to always be nil then, i've got something wrong
23:49:14FromDiscord<pruno> sent a code paste, see https://play.nim-lang.org/#ix=3WLO
23:51:02FromDiscord<Elegantbeef> Uhh something is off with `GetModuleBaseName` i imagine
23:51:16FromDiscord<Elegantbeef> I dont know what but your args might not be right
23:52:38FromDiscord<pruno> sent a code paste, see https://play.nim-lang.org/#ix=3WLP
23:52:45FromDiscord<pruno> (edit) "https://play.nim-lang.org/#ix=3WLP" => "https://play.nim-lang.org/#ix=3WLQ"
23:53:18FromDiscord<Elegantbeef> The issue is the `sizeof(remoteModuleName)` i think
23:53:23FromDiscord<Elegantbeef> It should be `remoteModuleName.len`
23:53:34FromDiscord<Elegantbeef> Or `wstr.len` rather
23:53:46FromDiscord<Elegantbeef> `sizeOf` on dynamic collections is `sizeof(pointer)`
23:53:51FromDiscord<Elegantbeef> not the amount of allocated bytes
23:53:57FromDiscord<pruno> Oh stupid me
23:53:57FromDiscord<Elegantbeef> Which as you notice it always is giving you 8
23:54:03FromDiscord<pruno> Yeah makes sense lol
23:54:41FromDiscord<Elegantbeef> Patito had the same issue just above 😄
23:55:50FromDiscord<pruno> Well if wstr is empty at first, it'll always be 0 right ?
23:56:19FromDiscord<Elegantbeef> Yea i think you need to do something like `newWideStr("MyBufferLengthIsThis")`
23:56:28FromDiscord<Elegantbeef> There isnt a allocation that stores the length afaict
23:56:48FromDiscord<Elegantbeef> Oh nvm there is `newWideCstring(size: int)`
23:57:04FromDiscord<Elegantbeef> so you can do like `var wStr = newWideCstring(128)`
23:58:09FromDiscord<pruno> `wStr.len` here is still 0
23:59:55FromDiscord<!Patitotective> In reply to @Elegantbeef "Patito had the same": 💀