<< 25-01-2023 >>

00:06:48*jmdaemon joined #nim
00:35:23FromDiscord<auxym> can closure procs be exportc'd and called from C? Or is the calling convention incompatible?
00:36:29FromDiscord<Elegantbeef> They can be called from C if you pass the environment
00:38:37FromDiscord<auxym> hm. I'd have to have a look at the codegen. but I'll try to use something else I think
00:39:10FromDiscord<Elegantbeef> Yea it's not really designed for it but it can 😄
00:39:33FromDiscord<Elegantbeef> Remember that closure generation turns the procedure into a `(env, proc)` internally
00:54:51*jmdaemon quit (Ping timeout: 252 seconds)
00:58:25*jmdaemon joined #nim
01:20:07*jmdaemon quit (Ping timeout: 252 seconds)
01:39:15*jmdaemon joined #nim
01:44:48*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
02:40:15FromDiscord<0xʎ> anyone know if there are updated llvm bindings for nim?
02:40:19FromDiscord<nqeron> if I have a generic type like `Bitmap[N: static uint] = distinct uint64` - how do I create a function that can modify that type, e.g. ` proc set[N](bitmap: var Bitmap[N], x: uint, y: uint) =↵ assert(x < N)↵ assert(y < N)↵ bitmap = bitmap bitor(1'u64 shl ((N - 1 - x) + y N)) `
02:42:33*argonica joined #nim
02:43:59*argonica quit (Remote host closed the connection)
02:47:37*argonica joined #nim
02:51:12*argonica quit (Remote host closed the connection)
02:51:51*argonica joined #nim
02:59:45FromDiscord<ringabout> In reply to @Isofruit "On that sidenote, anyone": The warning is supposed to be removed from recent Nim devel version.
03:00:41FromDiscord<0xʎ> how can I use LLVM with nim? I wass looking online but can't find any updated bindings
03:01:02FromDiscord<0xʎ> if not, is there any binding generator I can use ?
03:02:01FromDiscord<Elegantbeef> https://github.com/arnetheduck/nlvm/tree/master/llvm
03:02:31FromDiscord<0xʎ> oh I see
03:02:45FromDiscord<0xʎ> I was looking at that repo but dismissed it thinking it was just an LLVM-based compiler impl for nim
03:02:56FromDiscord<0xʎ> but it turns out they obviously need to use LLVM bindings themselves, genius
03:03:13FromDiscord<0xʎ> I can see they're generated via `c2nim`. Thanks, that's all I needed to know
03:56:17*azimut quit (Ping timeout: 255 seconds)
03:57:18*azimut joined #nim
04:11:05*argonica quit (Quit: Leaving)
04:24:15*krux02 quit (Remote host closed the connection)
04:35:10*arkurious quit (Quit: Leaving)
05:01:31*jmdaemon joined #nim
05:05:11FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4m8C
05:10:55*argonica joined #nim
05:45:55FromDiscord<kots> passing `handles = @[]` to `dump` removes the "%TAG..." line, and `tagStyle = tsNone` removes the "!n!system:seq..." stuff
06:09:49FromDiscord<sOkam!> tysm! i found the handles one, but i didn't see the tagstyle. tyty 🙏
06:53:10FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=4m8N
07:11:50FromDiscord<Elegantbeef> `result = newSeqOfCap[float](amount)`
07:11:54FromDiscord<Elegantbeef> We did it we're faster now!
07:14:49FromDiscord<Elegantbeef> @that_dude guess i should do this given it was 20 minutes old 😄
07:16:54FromDiscord<that_dude> That didn't actually change the speed
07:17:12FromDiscord<Elegantbeef> Are you not running -d\:release?
07:17:16FromDiscord<that_dude> I am
07:17:35FromDiscord<that_dude> What can I give you that would help?
07:17:50FromDiscord<Elegantbeef> The full benchmark code
07:18:10FromDiscord<Elegantbeef> Or are we really just calling `random` procs and adding to a seq
07:18:34FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=4m8Q
07:18:39FromDiscord<that_dude> sorry for the dumps
07:18:52FromDiscord<Elegantbeef> bleh useless output
07:18:53FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=4m8R
07:19:40FromDiscord<that_dude> Now that I look at it, nimprof seems to only log calls, not time spent
07:21:07FromDiscord<Rika> Yes
07:21:10FromDiscord<Rika> That is correct
07:21:13FromDiscord<that_dude> I just wanted to compare this to their python and julia counterparts that I was given in class
07:21:33FromDiscord<Elegantbeef> 1.53s vs 1.55s by changing that to `newSeqOfCap`
07:21:39FromDiscord<Elegantbeef> So that's not the expensive overhead
07:21:57FromDiscord<Elegantbeef> `sum(mapIt())`
07:23:11FromDiscord<that_dude> Upon seeing my mistake with nimprof, that's kinda what I thought next, but I'm not sure what I could do other than make it more verbose
07:23:23FromDiscord<ShalokShalom> You know how it will perform on his device?
07:23:25FromDiscord<Elegantbeef> "more verbose"
07:23:28FromDiscord<Elegantbeef> You mean faster
07:23:45FromDiscord<that_dude> Well doesn't manually mapping it in a loop make it faster?
07:23:52FromDiscord<Elegantbeef> Yes
07:24:02FromDiscord<that_dude> My first goal was to try to keep it as close as possible to the original source
07:24:03FromDiscord<Elegantbeef> You arent allocating a second sequence
07:24:39FromDiscord<that_dude> I guess that makes sense
07:24:49FromDiscord<Elegantbeef> you should be using `applyIt(copySign(1.0, it))`
07:24:53FromDiscord<Elegantbeef> then just `sum` on that
07:26:10FromDiscord<Elegantbeef> That drops around 50ms on my machine
07:26:17FromDiscord<Elegantbeef> So now whatelse can we fix
07:26:37FromDiscord<Elegantbeef> Dont really see anything
07:26:39FromDiscord<Elegantbeef> Damn
07:26:45*argonica quit (Remote host closed the connection)
07:26:50FromDiscord<Rika> Or combine them by using fold
07:27:06*argonica joined #nim
07:27:30FromDiscord<Elegantbeef> Dont see how fold helps, though i dont use sequtils
07:27:46FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=4m8T
07:27:47*byanka joined #nim
07:27:47FromDiscord<that_dude> it actually became slower
07:27:59FromDiscord<Elegantbeef> It certainly did not
07:28:28FromDiscord<that_dude> nevermind that was just some randomness
07:28:32FromDiscord<that_dude> but it's not faster
07:28:51FromDiscord<Elegantbeef> Are you using `-d:lto --mm:orc`?
07:28:54FromDiscord<Elegantbeef> If not you should
07:29:15*byanka__ quit (Ping timeout: 248 seconds)
07:29:16FromDiscord<that_dude> I'm using nim v1.9.1 I thought that already has orc by default
07:29:19FromDiscord<that_dude> I'll try lto tho
07:29:25FromDiscord<Elegantbeef> It does use orc by default
07:30:11FromDiscord<Rika> In reply to @Elegantbeef "Dont see how fold": Can combine the apply and the sum into one
07:30:35FromDiscord<that_dude> Lto worked and made it as fast as python/numpy now. 1.8s -> 1.5s
07:30:47FromDiscord<Rika> Can you show the command you use to compile
07:30:55FromDiscord<Elegantbeef> Can even do `-d:danger` if you want it faster
07:30:59FromDiscord<that_dude> I haven't used fold yet, looking into it
07:31:13FromDiscord<Rika> foldl specifically
07:31:19FromDiscord<Elegantbeef> Now aside from changing how this program operates we're near the limit of what i can say
07:31:29FromDiscord<that_dude> `nim c -d:release -d:lto test_random_walk.nim`
07:31:55FromDiscord<that_dude> Danger actually didn't actually change the speed back when I tested it
07:34:02FromDiscord<Elegantbeef> Without any funky tricks this is basically the best you can do
07:34:03FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4m8U
07:34:12FromDiscord<Elegantbeef> But this changes how the code was written to something that makes sense
07:39:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4m8V
07:40:01FromDiscord<that_dude> Just queued into game, I'll mess with golfing later
07:40:06FromDiscord<that_dude> thanks for the help guys
08:36:11*azimut quit (Ping timeout: 255 seconds)
08:46:25*argonica quit (Quit: Leaving)
09:50:16*kenran joined #nim
09:51:02FromDiscord<New> Hiho! Is here some way for catching console input from program and do smthg like "echo" with our variable to it?
10:01:58FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m9v
10:03:40FromDiscord<Phil> (this is for the choosenim image of nim, trying to slim it down, already got rid of manually compiling openssl that was there before and removed like 3 packages, as well as removed unnecessary tmp files)
10:05:09FromDiscord<leetnewb> Is it possible that minideb is missing an expected dep that gets pulled in?
10:06:43FromDiscord<Phil> I mean, a lot of dependencies get pulled in for gcc, but that's unavoidable
10:06:53FromDiscord<Phil> The image is pointless without gcc so eh
10:09:00FromDiscord<leetnewb> 200MB for gcc alone. ca-certificates is probably another 80-100. I dunno, 500 seems not out of the ballpark.
10:09:25FromDiscord<Phil> May have underestimated gcc then, because dang
10:10:12FromDiscord<Phil> the only way ca-certificates is in there so that curl with https works, I wonder if I can slim that down somehow
10:11:37FromDiscord<leetnewb> +200MB from a fresh debian bullseye adding those packages
10:12:09FromDiscord<Phil> bullseye? Wut?
10:12:52FromDiscord<leetnewb> I spun up an lxc container to check the size of adding openssl curl xz-utils ca-certificates gcc
10:16:18FromDiscord<Phil> Yeah I don't think I can dump ca-certificates =/
10:17:40FromDiscord<leetnewb> fwiw, the entire container is 420M before, so figure 620M after adding gcc openssl etc. I don't think there's much/anything to shave from the 500MB you had originally.
10:18:44FromDiscord<Phil> Wait, 420M?↵I'm seeing 78MB and 500MB respectively https://media.discordapp.net/attachments/371759389889003532/1067750362745937940/image.png
10:19:33FromDiscord<leetnewb> I built an lxd container from canonical's image repo. It isn't 1:1.
10:19:39FromDiscord<leetnewb> Used it as a proxy
10:20:01FromDiscord<Phil> Alrighty, the vast discrepancy for starting points just confused me
10:20:17FromDiscord<Phil> I guess the GCC install pulls in so much extra shit that the endpoints lead up not differing too much
10:20:30FromDiscord<Phil> (edit) "lead" => "end" | "endup not differing too much ... " added "in size"
10:21:59FromDiscord<Phil> In reply to @New "Hiho! Is here some": Best I can do you is getting the return-code.↵Though I think one of the execCmd thingies also grabs all strings, though no guarantees for that.↵But then again, if you're executing stuff from the shell, you can just pipe the output into a file as normal
10:25:11FromDiscord<Phil> In reply to @New "Hiho! Is here some": https://nim-lang.org/docs/osproc.html#execProcess%2Cstring%2Cstring%2CopenArray%5Bstring%5D%2CStringTableRef%2Cset%5BProcessOption%5D↵There that might work
10:42:01FromDiscord<Phil> So I wanted to try out compiling in the container
10:42:29FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m9D
10:43:02FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m9E
11:14:58*xet7 quit (Quit: Leaving)
11:24:33Zevvyou seem to be missing your libc header files
11:31:04*jmdaemon quit (Ping timeout: 260 seconds)
11:42:35FromDiscord<Require Support> noob question, im trying to create a DLL that will be loaded by me exe. The function that is defined in the DLL takes in a parameter of an `object`. Do I define this `object` in both the exe and the DLL ? 🤔
11:49:03FromDiscord<demotomohiro> You can do `type FooObj = object ..` in foo.nim and `import foo` in both dll and exe.
11:51:34FromDiscord<Require Support> nice, was just making sure before I actually tried it
11:59:44*argonica joined #nim
12:37:23*kenran quit (Remote host closed the connection)
12:42:14PMunchHmm, anyone know what would be the best way to compare an object between two runs of my code? I'm trying to figure out why nimlsp and nimsuggest are giving different results for the same file.
12:45:54FromDiscord<Phil> Write it to a json file and compare the json
12:46:12FromDiscord<Phil> Assuming you care for the data content mostly
12:51:04PMunchHmm, I guess I might be able to convert to json
12:52:42FromDiscord<Phil> I wonder how you'd async stuff with sqlite
12:57:24FromDiscord<Phil> sent a long message, see http://ix.io/4ma7
12:57:32FromDiscord<jmgomez> Can the compiler API be used to generate a string (at comp time) with the fields that a type may have?
12:57:51FromDiscord<Phil> a type may have?
12:58:00FromDiscord<Phil> Like, that's every character combination possible
12:58:19FromDiscord<jmgomez> the C/C++ that it would generate
12:58:59FromDiscord<Phil> Ah, so the scenario is basically you do have an explicit type, you just want all the fields on it and that should also separate all permutations of an object variant?
12:59:05PMunch@Phil, it seems basically like you just tell SQLite to load the async stuff, then run their event loop in a background thread and go about using SQLite as normal
12:59:33FromDiscord<Phil> In reply to @PMunch "<@180601887916163073>, it seems basically": So using sqlite normally with extra steps!:... shouldn't that be returning promises or sth?
12:59:46FromDiscord<Phil> Well, Futures in nim
13:00:17PMunchHmm, good point
13:00:28FromDiscord<jmgomez> sent a code paste, see https://paste.rs/wjd
13:01:13FromDiscord<jmgomez> In reply to @Isofruit "Ah, so the scenario": Im doing an implementing of virtual functions and dont want to rewrite a generator for the fields
13:01:20FromDiscord<Rika> `With asynchronous I/O, write requests are handled by a separate thread running in the background. This means that the thread that initiates a database write does not have to wait for (sometimes slow) disk I/O to occur. The write seems to happen very quickly, though in reality it is happening at its usual slow pace in the background.`
13:01:23FromDiscord<jmgomez> (edit) "implementing" => "implementation"
13:01:24FromDiscord<Phil> Oh, you want the field names how they'll be declared in the generated code because they have these weird NII prefixes
13:01:42FromDiscord<Rika> you technically dont need a future for a write
13:02:00FromDiscord<Rika> since theres usually no (important) result
13:02:15FromDiscord<jmgomez> In reply to @Isofruit "Oh, you want the": I dont really care about the names, I dont want to generate all of it myself (specially because they are a lot of cases)
13:03:05FromDiscord<Phil> In reply to @Rika "since theres usually no": So basically you're just establishing an earlier step where you hand the task off and then return from there, sort of
13:03:29FromDiscord<Phil> While the tasks you handed off then proceeds in the background
13:03:56FromDiscord<jmgomez> (edit) "they" => "there"
13:10:46PMunchNo async reads though?
13:11:00FromDiscord<Phil> Pretty much, and even then that module is deprecated
13:11:42FromDiscord<Phil> What SQLITE suggests instead is using their "write ahead log" (WAL) mode, which means you're still doing the same code as before, but now it works slightly different
13:12:08FromDiscord<Phil> sent a long message, see http://ix.io/4maa
13:14:15FromDiscord<Rika> yeah
13:15:11FromDiscord<Phil> But basically you're still writing synchronous code and you're not writing any "Execute when value is there later" procs, you're just changing the way you use sqlite
13:16:34FromDiscord<Rika> i believe you just dont generally use "traditional" async with sqlite
13:16:42FromDiscord<Rika> you prolly really have to use a different thread
13:17:42FromDiscord<Nerve> Is there any way to store columns of unequal length in a DataMancer dataframe?
13:17:47FromDiscord<Nerve> (edit) "DataMancer" => "datamancer"
13:22:08FromDiscord<albassort> In reply to @Rika "i believe you just": Do it in a coroutine like an adult
13:22:32FromDiscord<albassort> Not in nim though, I still need to wrap libAco
13:22:34FromDiscord<albassort> One Day
13:25:37FromDiscord<Rika> In reply to @albassort "Do it in a": ~~i barely use nim nowadays~~
13:28:50FromDiscord<Phil> Hmm so assuming I have 3 super expensive SQL queries to separate sqlite files in a row, the way to deal with them is basically maintaining my own threadpool to do this stuff async?
13:28:59FromDiscord<Phil> Not that I have any idea how that'd even look like
13:30:13FromDiscord<Phil> Wait, treeform's implementation looks almost trivial
13:49:37*xet7 joined #nim
13:50:52FromDiscord<Phil> You innocently want to run your nimforum installation with the nim 1.6.10 compiler
13:51:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mah
13:51:23FromDiscord<Phil> (edit) "run" => "compile"
13:57:29FromDiscord<albassort> In reply to @Rika "~~i barely use nim": :( same
13:57:54FromDiscord<albassort> At my job I'm in C sharp and SQL and JS
13:58:01FromDiscord<albassort> The second I get home I'm in C
13:58:04FromDiscord<albassort> Pain
13:58:07FromDiscord<civbag> In reply to @Rika "~~i barely use nim": why?
13:58:12FromDiscord<Rika> moving on to elixir
13:58:19FromDiscord<albassort> But elixir isn't even that cool
13:58:38FromDiscord<Rika> ? does it seem like i care about what you think
13:59:09FromDiscord<albassort> Is it bad that I'm unironically crying
13:59:20FromDiscord<civbag> In reply to @Rika "moving on to elixir": i see
13:59:36FromDiscord<Rika> sorry to put it so bluntly
13:59:47FromDiscord<albassort> I was joking lol
13:59:57FromDiscord<civbag> In reply to @albassort "Is it bad that": pat pat
14:00:02FromDiscord<albassort> I was trying to maybe hint you to tell me some things you might like about it
14:00:46FromDiscord<Rika> ive found the philosophy interesting
14:00:55FromDiscord<Rika> you already most likely have heard of it
14:01:42FromDiscord<albassort> I've seen it, and I've looked at the code. It's functional but I don't know if it has any killer features over say Haskell
14:01:47FromDiscord<civbag> elixir actually has a good track record in business
14:02:44FromDiscord<albassort> Oh yeah I remember elixir
14:02:52FromDiscord<albassort> I actually suggested something related to elixir to my company, I feel like it would be a good fit for some things we do
14:03:06FromDiscord<albassort> Obviously, not really practical nobody Is there very much a serious software developer besides a few people
14:03:21FromDiscord<Rika> i mean a good amount of people would probably say that the use of BEAM is a killer feature
14:03:24FromDiscord<albassort> (edit) "there" => "here is"
14:09:28ZevvI also moved to elixir for some time, mostly for the beam
14:10:09Zevvbut i found interfacing with the rest of my ecosystem too cumbersome. the beam is like a different OS, I'm no longer 'on linux'
14:36:44FromDiscord<ShalokShalom> In reply to @albassort "I've seen it, and": The runtime and OTP is what makes it so special
14:37:07FromDiscord<ShalokShalom> You barely see that on the language level, at least as someone who is new to the language ☺️
14:38:31FromDiscord<ShalokShalom> In reply to @albassort "At my job I'm": You could theoretically convince them, that they allow you to use fsharp instead 😉
14:40:02FromDiscord<albassort> Nah
14:40:11FromDiscord<ShalokShalom> sent a long message, see http://ix.io/4mat
14:40:15FromDiscord<Phil> I am fascinated you guys appear to have such liberal language environments. Over here its basically "For tech stack adoption the entire team must speak it and the benefit must be massive"
14:40:36FromDiscord<Phil> (edit) "massive"" => "massive. Otherwise not worth the effort""
14:40:44FromDiscord<albassort> That's exactly how it is here
14:40:48FromDiscord<albassort> There is no liberalness
14:40:48FromDiscord<ShalokShalom> Most tech spaces are as you describe
14:41:16FromDiscord<albassort> You can't write your code in cobol because you then become a liability
14:42:39FromDiscord<Rika> im still having difficulty not programming defensively lmao
14:42:41FromDiscord<ShalokShalom> I was half way joking and half way playing to the fact, that most dotnet shops are so desperate for programmer, that they actually accept F# devs as well
14:42:41FromDiscord<ShalokShalom> Startups are basically the only place, at which adventures are allowed.
14:42:43FromDiscord<ShalokShalom> Jet.com is one of them. Fully build on FSharp and got to be the quickest unicorn in the history
14:42:43FromDiscord<Rika> hard habit to break
14:43:16FromDiscord<ShalokShalom> In reply to @Rika "hard habit to break": I think its a wonderful opportunity for you 😊
14:43:26FromDiscord<Rika> yeah
14:43:28FromDiscord<Rika> something new
14:43:46FromDiscord<ShalokShalom> Particularly as someone who comes from a language, that does a lot of things not as bad as the traditional languages
14:43:57FromDiscord<Rika> wdym
14:44:16FromDiscord<ShalokShalom> Its not so simple for you, to find something that is really making a difference positively
14:44:24FromDiscord<ShalokShalom> Since Nim is already a sane language
14:44:50FromDiscord<Gumbercules> In reply to @ShalokShalom "As Rika already mentioned": Yes you do
14:44:56FromDiscord<ShalokShalom> From someone's else perspective, a lot of languages and even just changed paradigms would make a big difference
14:45:00FromDiscord<Tanguy> This project brings BEAM like features to languages that can target WASM: https://lunatic.solutions/ for now only rust & assemblyscript, but someone could do nim bindings for instance (I started to do it but didn't finish)
14:45:30FromDiscord<ShalokShalom> I know a similar project
14:45:37FromDiscord<Gumbercules> Just because the VM has a way to restart your processes doesn't mean you stop coding defensively
14:46:06FromDiscord<ShalokShalom> https://eigr.io/
14:46:13FromDiscord<ShalokShalom> In reply to @Gumbercules "Just because the VM": Read again 😄
14:46:19FromDiscord<ShalokShalom> Its the standard library
14:46:22FromDiscord<ShalokShalom> OTP
14:46:33FromDiscord<Gumbercules> Okay I'm not even going to start
14:46:44FromDiscord<Gumbercules> I work in Elixir and Erlang professionally
14:46:54FromDiscord<ShalokShalom> Idiomatic Erlang and Elixir play into your hands
14:47:00FromDiscord<Tanguy> In reply to @ShalokShalom "https://eigr.io/": Interesting thanks, I'll take a look
14:47:01FromDiscord<Gumbercules> If you think any of the OTP functionality would work without the VN
14:47:07FromDiscord<Gumbercules> vm
14:47:16FromDiscord<Gumbercules> Go ahead and believe that
14:47:24FromDiscord<ShalokShalom> In reply to @Tanguy "Interesting thanks, I'll take": On a first look, lunatic seems a bit more approachable
14:47:30FromDiscord<ShalokShalom> But have to look deeper
14:47:40FromDiscord<ShalokShalom> In reply to @Gumbercules "If you think any": I dont say that
14:47:50FromDiscord<ShalokShalom> I said from the start its BEAM plus OTP
14:48:07FromDiscord<Gumbercules> Okay then why do you nitpick my statement?
14:48:08FromDiscord<Rika> haiya another argument between you two
14:48:11FromDiscord<ShalokShalom> You came and said
14:48:19FromDiscord<ShalokShalom> In reply to @Gumbercules "Just because the VM": This
14:48:21FromDiscord<Gumbercules> Because what you were saying is wrong
14:48:28FromDiscord<ShalokShalom> Nobody said that 😅
14:48:49FromDiscord<Gumbercules> You don't just throw away defensive programming because you're using OTP or a language on beam
14:49:42FromDiscord<Tanguy> Though the lower you are in the hierarchy, the less you can care
14:49:45FromDiscord<ShalokShalom> But the architecture and the tools and how you typically write code, aids to that
14:50:04FromDiscord<Gumbercules> No it leads to recoverability and fault tolerance
14:50:17FromDiscord<Tanguy> It's not like in nim where any of the 500k+ LoC of your code / compiler can crash the entire thing
14:50:18FromDiscord<ShalokShalom> Which avoids defensive programming
14:50:23FromDiscord<ShalokShalom> Or makes it useless
14:50:30FromDiscord<Tanguy> (nim or any other langage, not attacking nim specifically)
14:50:41FromDiscord<Gumbercules> It doesn't make your code any safer and a NPE will still crash your process over and over until you do something about it
14:50:49FromDiscord<Gumbercules> No it doesn't make it uses ugh
14:50:52FromDiscord<ShalokShalom> In reply to @Tanguy "Though the lower you": In which hierarchy you mean? 🙂
14:50:57FromDiscord<Rika> In reply to @Tanguy "It's not like in": i mean if nim actually went into the defect route....
14:51:02FromDiscord<Gumbercules> Useless even
14:51:34FromDiscord<ShalokShalom> In reply to @Gumbercules "It doesn't make your": Who said it automated deals with crashes
14:51:42FromDiscord<Gumbercules> well it does
14:51:44FromDiscord<Rika> In reply to @Gumbercules "It doesn't make your": NPE?
14:51:48FromDiscord<Gumbercules> null pointer exception
14:51:58FromDiscord<ShalokShalom> If you connect to a host, and loose connection, it will try again
14:51:59FromDiscord<Gumbercules> that's the point of the supervisors / supervision hierarchy
14:51:59FromDiscord<Tanguy> In reply to @ShalokShalom "In which hierarchy you": The OTP process tree: https://user-images.githubusercontent.com/4210829/80588480-063c0b00-8a4b-11ea-9df3-48705ea2914f.gif (random example)
14:52:09FromDiscord<ShalokShalom> In most of the cases, this solves the problem
14:52:11FromDiscord<Gumbercules> no it won't
14:52:28FromDiscord<ShalokShalom> Sure, since most connection issues are temporary
14:52:30FromDiscord<Rika> you can have pointers in elixir? or do you mean in nifs?
14:52:35FromDiscord<ShalokShalom> And those who are, obviously have to be handled
14:52:45FromDiscord<ShalokShalom> (edit) "are," => "are not,"
14:53:06FromDiscord<Gumbercules> @Rika if I try to access a field on an object and that object is `nil` - NPE
14:53:08FromDiscord<Tanguy> In reply to @Rika "i mean if nim": What do you mean? Defects are just one of the way that can happen. Even rust can "panic" in a lot of different ways
14:53:19FromDiscord<Rika> In reply to @Gumbercules "<@259277943275126785> if I try": oh in that sense
14:53:29FromDiscord<Gumbercules> @ShalokShalom and OTP / the VM do none of this for you
14:53:32FromDiscord<Gumbercules> you're talking out of your ass I'm sorry
14:53:33FromDiscord<Rika> In reply to @Tanguy "What do you mean?": i meant that it would have been worse
14:53:55FromDiscord<Gumbercules> the VM will allow me to say - supervise this process and have this process responsible for supervising this other process / processes
14:54:07FromDiscord<Gumbercules> I can set up restart strategies along with that process supervision
14:54:32FromDiscord<ShalokShalom> @Tanguy I think the platform kinda misses a statically typed language. Yes, there is Gleam and its neat. I would still like to write in something like Elm or F# ↵↵Sadly, the wasm implementation makes GC needed
14:54:38FromDiscord<Gumbercules> but there is nothing in OTP / BEAM which is going to retry making a DB connection or whatever you're talking about
14:54:45FromDiscord<ShalokShalom> And that means shipping a runtime
14:54:58FromDiscord<Gumbercules> I can set up a supervision hierarchy so that if my process trying to make a DB connection crashes, it will be restarted in some way
14:55:02FromDiscord<Tanguy> In reply to @Gumbercules "<@259277943275126785> if I try": The point isn't that BEAM prevents every bug, it's that "just restarting a small process" can solve a non-negligible percent of the bugs automatically (there was some studies, can't remember the numbers), instead of having to restart the entire program everytime
14:55:19FromDiscord<ShalokShalom> In reply to @Gumbercules "I can set up": And that's how its implemented usually
14:55:19FromDiscord<Gumbercules> I believe the statement made was - defensive programming is worthless
14:55:34FromDiscord<Gumbercules> no it's not, usually people have code that explicitly retries failed connections
14:55:38FromDiscord<ShalokShalom> In this environment I consider it pointless most of the time
14:55:43FromDiscord<Gumbercules> because they don't want their client trying to endlessly reconnect to whatever endpoint
14:55:46FromDiscord<ShalokShalom> And that's kinda the point
14:55:50FromDiscord<Rika> damn
14:55:50FromDiscord<Gumbercules> whatever
14:56:16FromDiscord<Rika> im able to follow the conversation but this is a lot of back and forth so
14:56:18FromDiscord<Gumbercules> @Rika you still need to program defensively in any programming language
14:56:25FromDiscord<Gumbercules> Elixir and Erlang are no exception
14:56:27FromDiscord<Rika> sure its just much reduced
14:56:30FromDiscord<Gumbercules> not really
14:56:37FromDiscord<Gumbercules> you are more recoverable
14:56:41FromDiscord<ShalokShalom> 😅
14:56:42FromDiscord<Gumbercules> the language doesn't make you any safer
14:56:47FromDiscord<Rika> of course
14:57:18FromDiscord<ShalokShalom> I would say, defensive programming is also different
14:57:31FromDiscord<Gumbercules> you don't need to worry about getting out of bad state X because the runtime will get you back to state Y
14:57:31FromDiscord<ShalokShalom> Its not like you would usually do it.
14:57:40FromDiscord<Gumbercules> but if something in your application state is going to cause you to get back to state X again
14:57:44FromDiscord<Gumbercules> you're still fucked
14:57:52FromDiscord<Rika> i understood that from the conversation
14:58:18FromDiscord<ShalokShalom> And that's a logic error
14:58:29FromDiscord<Gumbercules> noooo
14:58:30FromDiscord<ShalokShalom> And nobody said, they shouldn't be handled
14:58:35FromDiscord<Gumbercules> let's say I parse a file in my process
14:58:42FromDiscord<Gumbercules> and it returns a deeply nested map of data
14:58:50FromDiscord<Rika> the thought i have about that is that at least in elixir that wouldnt end my whole webserver unlike maybe nim where i have to make sure i catch it somewhere
14:58:54FromDiscord<ShalokShalom> In reply to @Tanguy "Though the lower you": And why is that, would you say?
14:58:55FromDiscord<Gumbercules> and I access a field in that deeply nested object and the parent object of the field is nil
14:59:09FromDiscord<Gumbercules> it doesn't matter how many times erlang / elixir restarts my process
14:59:14FromDiscord<Gumbercules> it will crash over and over and over again
14:59:18FromDiscord<Rika> you'd get stuck in a sort of kinda not really livelock there
14:59:33FromDiscord<Gumbercules> or once and then stop - it depends on what my supervision strategy is
14:59:50FromDiscord<Gumbercules> now if I'm coding defensively (which I should be) I'd check to make sure that field doesn't belong to a `nil` object
15:00:27FromDiscord<Tanguy> In reply to @ShalokShalom "And why is that,": you can care less↵Because of the hierarchy, if something "high up" crashes, every child dies, vs if one child dies, doesn't matter as much
15:00:47FromDiscord<Gumbercules> this isn't accurate either
15:01:02FromDiscord<Gumbercules> I mean yes the statement was correct
15:01:09FromDiscord<Gumbercules> but the level of care depends much more on what the process is actually doing
15:01:29FromDiscord<Gumbercules> vs where in the hierarchy it finds itself
15:01:35FromDiscord<Rika> i mean ig i still program defensively in some sense (i'm using typecheck for my program so far)
15:01:37FromDiscord<Gumbercules> generally root level supervisors do nothing but supervise
15:02:23FromDiscord<ShalokShalom> sent a long message, see http://ix.io/4maA
15:02:45FromDiscord<Rika> ill have to go now
15:03:52FromDiscord<Gumbercules> In reply to @ShalokShalom "My case is, that": if you set up your supervision hierarchy correctly and architect your application correctly then yes you could make your application automatically recover from this situation gracefully
15:03:58FromDiscord<Gumbercules> but that's a far cry from saying "defensive programming is useless"
15:04:16FromDiscord<Gumbercules> I hear this get thrown around way too much in reference to Erlang and Elixir and it's just factually incorrect
15:05:26FromDiscord<Gumbercules> defensive programming isn't just about handling crashes, it's about trying to avoid them in the first place and not every situation is going to be a recoverable one and in some cases (a lot of cases) you don't want to just let things fail, you want to do something else that you can't model in a supervision tree
15:05:35FromDiscord<ShalokShalom> @Tanguy they two know each other and there seems to be some integration work going on
15:06:28FromDiscord<ShalokShalom> In reply to @Gumbercules "defensive programming isn't just": Well, the point is that the founders think very different from you, about how often which mistake happens
15:06:29FromDiscord<ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/1067822777563893780/image0.png
15:07:04FromDiscord<Gumbercules> huh?
15:07:15FromDiscord<Gumbercules> that screenshot doesn't tell me anything
15:07:42FromDiscord<ShalokShalom> That is in the Eigr Discord, if you happen to be interested
15:07:54FromDiscord<ShalokShalom> @Gumbercules Its not for you, sorry
15:08:14FromDiscord<Gumbercules> In reply to @ShalokShalom "Well, the point is": the founders of what?
15:08:18FromDiscord<ShalokShalom> Erlang
15:08:24FromDiscord<Gumbercules> source?
15:08:24FromDiscord<Tanguy> Ok, good to know 🙂
15:08:39FromDiscord<ShalokShalom> Joe said, that the most issues happen in a way, that is recoverable
15:08:45FromDiscord<ShalokShalom> Some of his talks, sorry
15:09:00FromDiscord<Gumbercules> we can use our logic to figure this out we don't need to cite heresay
15:09:07FromDiscord<Gumbercules> I already laid out an example
15:09:11FromDiscord<Gumbercules> which is quite common - parsing a file
15:09:20FromDiscord<Gumbercules> how are you going to recover from this with restarting a process?
15:09:56FromDiscord<Gumbercules> if I try to parse an empty file, my process is going to crash and it will continue to crash no matter how many times it is restarted
15:10:08FromDiscord<Gumbercules> I should probably check to see if the file is empty before parsing it, no?
15:10:43FromDiscord<Gumbercules> assuming I want to recover....
15:13:12FromDiscord<pmp-p> In reply to @Gumbercules "I should probably check": if it's a job queue most likely you would want to notify job sender to either resend (if not using checksum bad!) or notify job submiter etc ...
15:13:30FromDiscord<Gumbercules> you're assuming a lot of things about my application there
15:14:16FromDiscord<Gumbercules> but even if that were the case - having the VM restart my process or terminate it isn't going to handle that
15:14:43FromDiscord<pmp-p> yes it can
15:15:18FromDiscord<Gumbercules> it could via telemetry...
15:15:24FromDiscord<Gumbercules> which would be horrible
15:15:50FromDiscord<pmp-p> error can be a one time condition, that may not repeat itself on relaunch ( eg network or other io error ), terminate is a way to signal an unsolvable condition to notify
15:16:07FromDiscord<Gumbercules> this is missing my point...
15:16:45FromDiscord<Gumbercules> if I have a process which is going to parse a file and do something with its content and the file it's trying to parse is unparseable - it doesn't matter how many times my process is started, the file will remain unparseable
15:17:32FromDiscord<Gumbercules> so I can't just rely on the VM / whatever to fix that situation for me - I need to understand that the file is not parseable and do something about that - I either need to check to see if I can parse the file and then if not have some sort of fallback
15:17:58*PMunch quit (Quit: Leaving)
15:18:05FromDiscord<pmp-p> In reply to @Gumbercules "if I have a": usually i augment the time beetween retries, and then failed the job for good
15:18:20FromDiscord<pmp-p> (edit) "failed" => "fails"
15:18:25FromDiscord<Gumbercules> yes but I'm not even talking about a distributed application here
15:18:58FromDiscord<Gumbercules> you could write a simple elixir application that just parses a file and saves some other representation to disk
15:19:40FromDiscord<Gumbercules> all of the OTP / BEAM magic isn't going to solve the root problem for you, or provide you with a solution for doing anything other than failing and restarting the failed process or terminating it
15:20:49FromDiscord<Gumbercules> an explicit check to determine whether or not the file is able to be parsed however, will allow you to do something about it other than fail / retry
15:21:26FromDiscord<Gumbercules> and thus the need for some defensive program if you want your JSON parsing application to be able to do anything when it encounters an empty file other than crash / crash over and over again
15:21:34FromDiscord<Gumbercules> (edit) "program" => "programming"
15:23:01FromDiscord<pmp-p> i don't think most people are coding everyday like if they were on some automotive industrial project
15:23:13FromDiscord<Gumbercules> you need to handle non-exceptional errors
15:23:17FromDiscord<pmp-p> they don't sanitize their input, deal with it
15:23:47FromDiscord<Gumbercules> right, you need to deal with it
15:24:09FromDiscord<Rika> In reply to @Gumbercules "you need to handle": i always thought this was true
15:24:46FromDiscord<Gumbercules> well that's good
15:24:51FromDiscord<Rika> when i said its hard to get used to not defensively program, i meant in the sense that i had to deal with every single imaginable issue to just have my program work in some way
15:25:09FromDiscord<Rika> with elixir, now i can just focus on the errors that matter, i think
15:25:13FromDiscord<Gumbercules> that wasn't what set me off it was the - defensive programming is useless comment
15:25:18FromDiscord<Rika> yeah
15:25:31FromDiscord<Gumbercules> well you still need to think about exceptional failures but you can leverage the VM to help you handle them
15:25:35FromDiscord<Rika> elixir has :ok/:error for a reason
15:25:41FromDiscord<Gumbercules> right
15:25:57FromDiscord<Rika> In reply to @Gumbercules "well you still need": yeah its not just a massive try catch thing
15:26:10FromDiscord<Gumbercules> what @pmp-p said is a good example or @ShalokShalom - you have some connection you want to attempt to reestablish N number of times
15:26:25FromDiscord<Gumbercules> you set up a supervisor and supervisor strategy to monitor your process attempting the connection
15:26:33FromDiscord<Rika> im reading some stuff now and what you said is coming up in them like in here https://devdecks.io/2021-let-it-crash-explained
15:27:03FromDiscord<Gumbercules> yeah
15:27:18FromDiscord<Rika> and i dont think ive disagreed before i read it
15:27:19FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4maP
15:27:22FromDiscord<Rika> (edit) "and i dont think ive disagreed ... before" added "with it"
15:27:58FromDiscord<Rika> in what i said above, its the thing where one error in one dude's web request doesnt murder my whole server as an example
15:28:06FromDiscord<Gumbercules> I'd be remiss if someone came in here and read that about the language and then started writing code that way
15:28:21FromDiscord<ShalokShalom> We simply disagree about how often such cases do happen
15:28:23FromDiscord<Gumbercules> In reply to @Rika "in what i said": sure, this is definitely a nice thing
15:29:21FromDiscord<Gumbercules> In reply to @ShalokShalom "We simply disagree about": well based on my experience at work, recoverable runtime errors that need to be explicitly handled happen quite a bit
15:29:36FromDiscord<Rika> In reply to @Gumbercules "well based on my": quite a bit feels like a massive understatement
15:29:40FromDiscord<Gumbercules> more than a bad connection to a database / http server / whatever
15:29:43FromDiscord<Gumbercules> I mean it is
15:29:54FromDiscord<Gumbercules> those are the majority of the errors I encounter by far
15:30:04FromDiscord<Gumbercules> the exceptional stuff which the beam vm can help me with is much rarer
15:30:20FromDiscord<Rika> its still hard for me to identify when i should handle an error or not, personally
15:30:31FromDiscord<Gumbercules> I just go with - can I predict this happening
15:30:40FromDiscord<Gumbercules> can I predict that someone will send me an empty file - certainly
15:30:49FromDiscord<Gumbercules> can I predict that the database will be down when I make this call or it will time out? nope!
15:31:19FromDiscord<Rika> im not sure whether its good to keep on having `{:ok, val} = ...` or `case expr do ... {:ok, val } -> ... {:error, reason} -> ...`
15:31:36FromDiscord<Gumbercules> `case` is the way to go if you can
15:31:41FromDiscord<Gumbercules> `with` expressions help a lot here too
15:31:48FromDiscord<Rika> yeah ive used them both
15:31:59FromDiscord<Rika> idk though, with kinda feels wrong to me
15:32:18FromDiscord<Rika> since it kinda feels like mixing errors from different functions
15:32:22FromDiscord<Rika> feels really wrong to me for some reaosn
15:32:26FromDiscord<Gumbercules> well, generally I use `with` to cache a bunch of values I want to use in a `case`
15:32:47FromDiscord<Gumbercules> yeah, you can certainly encounter errors using `with` and then not have a great way to handle them
15:33:04FromDiscord<Gumbercules> but at least the error will be cached in the result, so you can do what you want with it in the body of the `with`
15:33:17*jmdaemon joined #nim
15:33:17FromDiscord<Gumbercules> it is pretty dirty though, but sometimes very necessary
15:34:07FromDiscord<Gumbercules> mostly when you run into limits regarding what invocations you can make in a conditional
15:34:54FromDiscord<Rika> might be getting into territory where i cant understand here
15:34:56FromDiscord<Rika> lol
15:39:16FromDiscord<Gumbercules> probably not - generally most of this stuff is introduced by dependencies, like Ecto, where certain expressions cannot be evaluated in certain contexts
15:40:05FromDiscord<Phil> Elixir runs on the erlang VM?
15:40:14FromDiscord<Gumbercules> well the BEAM virtual machine
15:40:22FromDiscord<Phil> (I have no clue about the entire ecosystem as a disclaimer)
15:40:32FromDiscord<Phil> (Not even naming of anything)
15:40:32FromDiscord<Gumbercules> but Erlang was the original language implemented for that VM when Erikson created it
15:40:42FromDiscord<Gumbercules> the US telecom industry runs on Erlang
15:40:59FromDiscord<Gumbercules> OTP stands for - open telecom platform
15:41:00FromDiscord<Phil> The most I know about Erlang is that its very fault tolerant and is very message based
15:41:23FromDiscord<Gumbercules> yeah it implements the actor model
15:41:38FromDiscord<Gumbercules> fault tolerance mostly comes from the VM which allows for processes to be supervised
15:42:16FromDiscord<Gumbercules> OTP provides a bunch of abstractions like https://www.erlang.org/doc/man/gen_server.html
15:42:33FromDiscord<Gumbercules> https://learnyousomeerlang.com/ is a good place to start if you want to explore more 🙂
15:51:31FromDiscord<Rika> ~~be careful the erlang syntax is very funky~~
15:52:25*arkurious joined #nim
15:52:50Amun-Rahmm, calling proc that was forward declared adds raises: Exception to the callee
15:53:01FromDiscord<0xʎ> why doesn't nim lsp at least warn me about uninitialized variables? https://media.discordapp.net/attachments/371759389889003532/1067834484860407938/image.png
15:53:17FromDiscord<0xʎ> when I compile it doesn't warn either, it goes to segfault
15:53:44FromDiscord<0xʎ> or does it implicitly initialize it to nil ?
15:53:44Amun-Rait is initialized, ref are initialized to nil
15:53:49FromDiscord<0xʎ> I see
15:54:10FromDiscord<0xʎ> so everything is implicitly initialized including primitives?
15:54:18FromDiscord<0xʎ> I assume numbers 0, strings "", etc. ?
15:54:18Amun-Raunless you add {.noinit.}
15:54:23FromDiscord<0xʎ> epic
15:54:30FromDiscord<pyolyokh> <https://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement>
15:54:31FromDiscord<0xʎ> k I got scared for a sec
15:54:35FromDiscord<0xʎ> got C vibes for a sec
15:54:35FromDiscord<0xʎ> lol
15:54:56Amun-Ravar x {.noinit.} x: ModuleRed # C vibes \o/.
15:57:13*jmdaemon quit (Ping timeout: 252 seconds)
15:57:48FromDiscord<Phil> One of the reasons I almost never use var
15:57:58FromDiscord<Phil> Compiler shouts at you if you try to do that stuff with let
15:58:32FromDiscord<Rika> Of course because it makes no sense
15:59:17FromDiscord<rutenl> sent a code paste, see https://play.nim-lang.org/#ix=4mb4
15:59:40FromDiscord<Rika> I forgot but I think that’s supposed to work
15:59:44FromDiscord<Rika> What’s the issue exactly
15:59:49FromDiscord<huantian> you need a `[]=` proc right?
16:00:06FromDiscord<Rika> He just says access
16:00:19FromDiscord<huantian> > so that I can write to it with such syntax
16:00:19FromDiscord<rutenl> when i try to write an int to it now it says type mismatch
16:00:30FromDiscord<rutenl> https://media.discordapp.net/attachments/371759389889003532/1067836369042411661/image.png
16:01:01FromDiscord<Rika> Ah I didn’t read it properly, yeah
16:01:23FromDiscord<rutenl> so i need a []= proc here?
16:01:29Amun-Rarutenl: how about https://play.nim-lang.org/#ix=4mb6
16:01:53FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=4mb7
16:02:37FromDiscord<rutenl> ok i'll try now
16:02:39FromDiscord<Nerve> How is one supposed to use tables and JSON objects in `nimf`source filters? It seems like they don't allow `[]` dereferencing at all, especially with string keys.
16:03:29FromDiscord<rutenl> sent a code paste, see https://play.nim-lang.org/#ix=4mbb
16:03:35FromDiscord<Nerve> If I drop a `$some_table"some"key"]` in a source filter, it just pretty prints the entire table.
16:03:46FromDiscord<Nerve> (edit) "table." => "table with copious newlines."
16:03:54FromDiscord<Nerve> (edit) "`$some_table"some"key"]`" => "`$some_table["some"key"]`"
16:04:02FromDiscord<Nerve> (edit) "`$some_table["some"key"]`" => "`$some_table["some_key"]`"
16:10:26FromDiscord<Nerve> Think I figured it out, any complex expression like a table access should be in a `${}` container.
16:32:35FromDiscord<Nerve> However, it does leave quotes around everything. That's annoying.
17:20:33*azimut joined #nim
17:27:42FromDiscord<rutenl> I've got a grid type that's just a ref array[16, int], how do I initialize this? a normal non-ref array initialized on its own but i cant figure it out for this `type Grid = ref array[ArrSize, int]`
17:29:29FromDiscord<rutenl> i had the type as non-ref array[16, int] before, but then I needed var in function parameters and i hear i should just put ref in the original type instead
17:35:00FromDiscord<Phil> `new(Grid)`
17:35:26FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mby
17:35:43FromDiscord<Phil> Kinda surprised it didn't echo a memory location
17:36:03FromDiscord<Phil> (edit) "Kinda surprised it didn't echo a memory location ... " added "as well with the "ref" mention of the array"
17:38:48FromDiscord<rutenl> Nice thanks, couldn't find it in the docs but guess I was searching wrong
17:39:01FromDiscord<Phil> `new` is generally the keyword to get something allocated on the heap
17:39:14FromDiscord<Phil> Same as java for example
17:40:30*azimut quit (Remote host closed the connection)
17:41:05*azimut joined #nim
17:50:44Zevvwhat happened to nimble; my packages go to ~/.nimble/pkg2 but nim can't find my imports
17:51:36Zevvalso, `nimble develop` no longer makes a link for me
17:54:51FromDiscord<Leftbones> Is there a good way to get something made with nim-ncurses to work on Windows?
17:55:18FromDiscord<Leftbones> Haven't played with it much yet, I used to use ncurses-windows with Python but even that wasn't always a drop-in solution.
17:56:50Zevvi have some reasonable okayis experience with a win32 curses compatible lib, let me find that
17:57:20*azimut quit (Ping timeout: 255 seconds)
18:00:23*azimut joined #nim
18:02:38FromDiscord<Leftbones> Hm okay, so I'd probably have to go about wrapping that myself, I assume
18:03:00FromDiscord<Leftbones> There's a deprecated nim-pdcurses on GitHub already which could be a good starting point
18:03:11FromDiscord<Leftbones> I miss the days when I didn't care if something worked on Windows or not lol
18:04:00Zevvpdcurses api is just a drop in for normal unix curses
18:04:11Zevvso you should be able to get any wrapper running without too much pain
18:10:05FromDiscord<Leftbones> Cool. Thanks.
18:10:39FromDiscord<Leftbones> Still considering forking Illwill and shoe-horning in true color support since the maintainer doesn't seem to have an interest
18:10:44FromDiscord<Leftbones> That would probably be easier lol
18:16:31Amun-Rarutenl: you can always initialize it in any moment via .reset
18:23:53FromDiscord<Nerve> Does anyone know how to use format specifiers NOT in the `fmt` or `&` macros? I'd like a simple damn proc that transforms some value into another, one that can be called in nimja templates or elsewhere, which crap out on `fmt` and `&` usage.
18:24:04FromDiscord<Nerve> (edit) "NOT in" => "WITHOUT using"
18:24:25FromDiscord<Nerve> (edit) "elsewhere, which crap" => "elsewhere; every solution I try craps"
18:24:43FromDiscord<Nerve> (edit) "another," => "a formatted string,"
18:26:33FromDiscord<Nerve> Ideally I could just do something like `format(3.14159, ".2f")
18:26:36FromDiscord<Nerve> (edit) "".2f")" => "".2f")`"
18:26:55FromDiscord<Nerve> (edit) "`format(3.14159," => "`let two_sig_digits = format(3.14159,"
18:27:26FromDiscord<Nerve> (edit) "two_sig_digits" => "two_sig_digits: string"
18:28:58FromDiscord<Nerve> Does `$` contain this functionality for types that can use specifiers?
18:34:08FromDiscord<rutenl> In reply to @Amun-Ra "<@298182739289702400>: you can always": nice to know, thx
18:39:03FromDiscord<Nerve> In reply to @Nerve "Ideally I could just": In fact since DateTime objects do exactly this, why not other values?
18:44:27FromDiscord<demotomohiro> @Nerve I think `formatValue` procs in strformat module is what you are looking for: https://nim-lang.org/docs/strformat.html#implementation-details↵https://nim-lang.org/docs/strformat.html#formatValue%2Cstring%2CSomeFloat%2Cstring
18:49:42FromDiscord<nqeron> sent a long message, see http://ix.io/4mbL
18:50:22FromDiscord<nqeron> (edit) "long message," => "code paste," | "http://ix.io/4mbL" => "https://play.nim-lang.org/#ix=4mbM"
18:51:11FromDiscord<nqeron> (edit) "https://play.nim-lang.org/#ix=4mbM" => "https://play.nim-lang.org/#ix=4mbN"
18:52:08FromDiscord<demotomohiro> @nqeron How about to explicity specify unsigned int like`Bitmap[5'u]`?
18:54:47FromDiscord<demotomohiro> Or define `groups` generic proc with type class like `proc groups(bitmap: Bitmap): GroupIter =`.
18:57:27FromDiscord<michaelb.eth> sent a long message, see http://ix.io/4mbO
19:01:19FromDiscord<Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4mbS
19:01:44FromDiscord<Nerve> Could probably make it a `func`
19:01:53FromDiscord<Nerve> (edit) "https://play.nim-lang.org/#ix=4mbS" => "https://play.nim-lang.org/#ix=4mbT"
19:02:20FromDiscord<Nerve> (edit) "https://play.nim-lang.org/#ix=4mbT" => "https://play.nim-lang.org/#ix=4mbU"
19:03:07FromDiscord<0xʎ> why was the `result` variable quirk chosen to be part of Nim?
19:03:17FromDiscord<Leftbones> In reply to @michaelb.eth "I’ve been making progress": Nice, I’ll check it out. I’ve never used notcurses but I’ve known about it for a few years.
19:03:45FromDiscord<0xʎ> In other words, are there any specific benefits that it provides that made the developers decide to add it to the language?
19:04:13FromDiscord<michaelb.eth> `result` certainly has some pitfalls
19:04:33FromDiscord<michaelb.eth> https://status-im.github.io/nim-style-guide/language.result.html
19:06:32FromDiscord<0xʎ> hm
19:06:39Amun-Raand some pros, too
19:06:49FromDiscord<michaelb.eth> true
19:07:08FromDiscord<0xʎ> are there any pros. apart from the ones outlined there?
19:10:18Amun-Ra0xʎ: 'https://play.nim-lang.org/#ix=4mbW'
19:20:13*genpaku quit (Read error: Connection reset by peer)
19:21:00*genpaku joined #nim
19:24:50FromDiscord<demotomohiro> In reply to @Nerve "Here's a function that": But it seems `formatValue` procs exists to just implement `fmt` and `&` macros.
19:25:19*Jjp137 quit (Ping timeout: 260 seconds)
19:27:19FromDiscord<jtv> Hmm, speaking of which, strformat needs to tell me when I have a string that is NOT an f string, yet, if it WERE one, would be accessing valid variables (i.e., a warning when I'm probably forgetting fmt). I notice people make this mistake a ton
19:27:56FromDiscord<Nerve> Why can't `formatValue` also be used for this? Seems to work well, and my func would only add two lines of code to `std/strformat`.
19:28:48FromDiscord<Nerve> Anyways I made an issue, let's see what the team thinks and if they want to implement it another way or not at all
19:28:49FromDiscord<Nerve> https://github.com/nim-lang/Nim/issues/21300
19:55:15FromDiscord<Elegantbeef> @Nerve\: people generally just use `%` from strutils
19:57:03FromDiscord<Elegantbeef> You also can just use `formatFloat` with your value
19:57:26FromDiscord<Nerve> How do you use specifiers with `%`? It's unclear from the documentation.
19:57:53FromDiscord<Elegantbeef> `"My string $#" % formatFloat(myFloat, ...)`
19:58:01FromDiscord<Elegantbeef> You dont use specifiers in the string
19:58:09FromDiscord<Nerve> Ah, I see
19:58:53FromDiscord<Elegantbeef> I'd say it's more readable cause you can do `percision = 4` or whatever you want
19:58:53FromDiscord<Elegantbeef> Or even spelled properly 😄
19:59:08FromDiscord<Nerve> Okay, I did not stumble across this whole selection of functions, and they're deep in `strutils`
19:59:19FromDiscord<Nerve> That decision is a head-scratcher
20:01:03FromDiscord<Elegantbeef> What's a headscratcher?
20:03:14FromDiscord<Elegantbeef> `strformat` implements the `fmt` and `&` macros only
20:04:44FromDiscord<Nerve> But no other utilities for formatting strings
20:05:36FromDiscord<Nerve> Anyways, I think my function is still useful for cases where the "g" specifier is needed, unless there's a proc/function for that.
20:06:04FromDiscord<Nerve> (edit) "strings" => "strings, many of which are in `strutils`"
20:06:20FromDiscord<Nerve> (edit) "the "g"" => "the`g`"
20:06:28FromDiscord<Elegantbeef> `formatFloat` has another argument
20:06:50FromDiscord<Elegantbeef> It does decimal or scientific notation depending on size
20:08:21FromDiscord<Nerve> I want to display the 2 or 3 most significant digits in an engineering case where they might be left or right of the decimal, and not in scientific notation
20:08:28FromDiscord<Nerve> does `formatEng` have what I need?
20:08:51FromDiscord<sOkam!> is it possible to create a reference to an already existing value, such that when you modify the first value all references are modified with it?↵Is that default behavior, or does creating a ref starts a new separate value instead?
20:08:54FromDiscord<Elegantbeef> Perhaps
20:09:12FromDiscord<Elegantbeef> You cannot do that sokam
20:09:39FromDiscord<Elegantbeef> A reference is heap allocated data, turning a stack value into a reference cannot be done. The only way you can get that semantic is by taking the address of that stack value
20:10:31FromDiscord<sOkam!> i guess the issue is not using ref in every variable related, then 🤔
20:10:40FromDiscord<Hourglass [She/Her]> In reply to @jtv "Hmm, speaking of which,": That sounds weird to implement tbh
20:10:43FromDiscord<sOkam!> I thought non-ref would be better, but true it should be ref instead
20:11:32FromDiscord<Elegantbeef> term rewriting macros to the rescue↵(@Hourglass [She/Her])
20:12:27FromDiscord<Elegantbeef> I only slightly joke, they could detect a string that would be a valid `fmt` or `&` string, and warning/hint
20:12:30FromDiscord<demotomohiro> Or use variables outside of procs. When you modify them, other procs see modified values.
20:12:32FromDiscord<Elegantbeef> But that is quite tedious
20:13:26FromDiscord<Hourglass [She/Her]> In reply to @Elegantbeef "term rewriting macros to": Hm that sounds annoying but also interesting
20:15:38FromDiscord<sOkam!> Const don't need to be references, right?
20:18:51FromDiscord<demotomohiro> Does Nim have something like `memset_explicit`, `memset_s` or `SecureZeroMemory` to clear secret data on memory?↵https://en.cppreference.com/w/c/string/byte/memset
20:20:25FromDiscord<Elegantbeef> https://nim-lang.org/docs/system.html#zeroMem%2Cpointer%2CNatural
20:22:42*PMunch joined #nim
20:26:14FromDiscord<demotomohiro> @ElegantBeef It seems it calls `memset` in C stdlib that is not securely clear secret on memory as `memset` can be optimized out.
20:31:11FromDiscord<demotomohiro> It seems I can use `memset_s` as long as backend C compiler supports C11.
20:54:11Amun-Rayou can also play with emited memset wrapped in -O0 function, attribute __used__ etc.
20:54:41Amun-Raand volatile
20:55:27Amun-Rabtw. there's also explicit_bzero on freebsd
20:58:47FromDiscord<demotomohiro> @Amun-Ra thank you. It seems currently no portable simple secure memory clear functions.
20:59:56Amun-Rayes, there's no portable way
21:00:39FromDiscord<demotomohiro> `memset_s` is actually not avaliable on my GCC.↵`memset_explicit` might become portable way as it is in C23, but require new C compiler.↵https://www.open-std.org/JTC1/SC22/WG14/www/docs/n2897.htm
21:01:53Amun-RaIIRC musl has it
21:04:23Amun-Raperhaps I'll make a module for that
21:05:35FromDiscord<Elegantbeef> It needs to be called 'TheHero'
21:06:33*argonica quit (Quit: Leaving)
21:07:17FromDiscord<sOkam!> Can variables inside objects be made immutable? 🤔
21:07:27FromDiscord<Elegantbeef> No
21:07:39FromDiscord<demotomohiro> If you make a module for that, here is secure memory clear C function implementation from argon2 code:↵https://github.com/P-H-C/phc-winner-argon2/blob/master/src/core.c#L134
21:07:41FromDiscord<Elegantbeef> If you want that use properties
21:08:38FromDiscord<sOkam!> ah good idea ✍️
21:09:03Amun-RaI've seen that volatile pointer trick somewhere
21:10:02FromDiscord<Elegantbeef> Since it's in the same module
21:10:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mce
21:10:19FromDiscord<Elegantbeef> But if you export `MyType` and import this module you cannot mutate `myType.data`
21:19:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mcf
21:20:49FromDiscord<Phil> Basically the procs a,b and c are blocking despite being annotated with the async pragma and I don't get why
21:21:16FromDiscord<michaelb.eth> I’m aware that historically that was a big difference between std and the design of nim-chronos
21:21:26FromDiscord<michaelb.eth> I guess maybe it’s still a thing?
21:21:52FromDiscord<Phil> Never used nim chronos
21:21:58FromDiscord<Phil> Just trying to wrap my head around async here
21:22:02FromDiscord<Phil> (edit) "async" => "std/async"
21:22:30FromDiscord<michaelb.eth> https://github.com/status-im/nim-chronos/wiki/AsyncDispatch-comparison
21:23:05FromDiscord<michaelb.eth> > The order of Future[T] completion callbacks:↵↵Current version of asyncdispatch processes Future[T] completion callbacks in reverse order, but Chronos schedules callbacks in forward order: https://github.com/nim-lang/Nim/issues/7197
21:23:22FromDiscord<michaelb.eth> (edit) "callbacks:↵↵Current" => "callbacks:↵>↵> Current"
21:23:36FromDiscord<michaelb.eth> (edit) "callbacks:↵>↵>" => "callbacks:↵> ↵>"
21:25:07FromDiscord<Elegantbeef> phil you're using `sleep`
21:25:17FromDiscord<Elegantbeef> not `waitfor asyncSleep`
21:25:42FromDiscord<Elegantbeef> Not that it changes the overall behaviour you're using a blocking sleep 😄
21:28:38FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mci
21:28:49FromDiscord<wiga> im not quite sure of what the doc says about importc pragma. Can anyone explains me how this works?(i want to includes windows.h in my proc)
21:28:56FromDiscord<Phil> This doesn't block now, which is nice.↵But it also doesn't ever execute the callbcaks, which is dumb
21:29:00FromDiscord<Elegantbeef> I mean you also are discarding the futures
21:29:07FromDiscord<Phil> Not anymore I'm not
21:29:30FromDiscord<Phil> I was originally discarding it because the callbacks ran through regardless, now the callbacks aren't even running with it
21:31:12FromDiscord<Elegantbeef> I mean you are discarding the asyncs afaik
21:31:22FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mcj
21:33:59FromDiscord<Phil> Uuuuugh, so every future must ultimately be waitfor'd
21:34:20FromDiscord<Phil> And only if you write the code with that in mind does it actually behave as you'd expect
21:34:43FromDiscord<Phil> If you don't explicitly wait for a future to complete it'll just get GC'd
21:35:28FromDiscord<Elegantbeef> It's more like if you dont tell the async dispatcher you care about a future it's not scheduled
21:35:51Amun-Rawiga: you don't need to include C header in order for importc to work
21:35:56FromDiscord<Elegantbeef> Also works
21:35:58FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mck
21:36:41FromDiscord<wiga> In reply to @Amun-Ra "<@795785229699645491>: you don't need": cuz yeah uh, it kinda doesnt really work https://media.discordapp.net/attachments/371759389889003532/1067920970049916958/image.png
21:37:02FromDiscord<wiga> (its not the full proc)
21:37:03FromDiscord<System64 ~ Flandre Scarlet> Is it possible to define compilation flags directly in a Nim file?
21:37:19FromDiscord<wiga> In reply to @System64 "Is it possible to": create a config.nims
21:37:25FromDiscord<Elegantbeef> ImportC isnt c2nim or futhark, it just says "Import this procedure by this name"
21:37:45FromDiscord<wiga> sent a code paste, see https://play.nim-lang.org/#ix=4mcl
21:38:06Amun-Rawiga: you need to import these types
21:38:08FromDiscord<wiga> In reply to @Elegantbeef "ImportC isnt c2nim or": so i have to use c2nim
21:38:27FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mcm
21:38:48FromDiscord<System64 ~ Flandre Scarlet> In reply to @wiga "and write in it": Ah alright, thanks↵I want to do some tests with Emscripten↵Is emcc included with Nim or I have to set it up?
21:38:52Amun-Rawiga: also, you don't use imoprt that way; you are using importc the wrong way; emit works that way
21:39:01FromDiscord<auxym> In reply to @wiga "so i have to": you don't have to, you can create the bindings manually if you want to
21:39:17FromDiscord<Elegantbeef> emcc is not included with Nim
21:39:22FromDiscord<auxym> c2nim (and furthark) are tools that automate the creation of bindings
21:39:31FromDiscord<wiga> In reply to @Amun-Ra "<@795785229699645491>: also, you don't": then how do i import ?
21:39:34FromDiscord<Phil> So in the end it's still just all a chain of futures that end up depending on the final waitFor
21:39:42FromDiscord<wiga> doc is confusing
21:39:58Amun-Rawiga: 'https://play.nim-lang.org/#ix=4mcn'
21:40:34Amun-Raimportc works like forward function declaraction in C
21:40:52FromDiscord<wiga> so in my context
21:40:57FromDiscord<Elegantbeef> You have to import the entire API you want to use in Nim language
21:41:01FromDiscord<wiga> how do i use the importc correctly
21:41:07FromDiscord<Elegantbeef> `takeScreenShot` is not a procedure in gdi
21:41:11FromDiscord<Elegantbeef> So you do not import c that
21:41:18FromDiscord<wiga> oh wait ok
21:41:18FromDiscord<Elegantbeef> You import c all the types and procedures you use
21:41:27FromDiscord<wiga> i just fucking realized
21:41:42FromDiscord<wiga> the proc name is the actual function from the dll in the prgma
21:41:44FromDiscord<wiga> (edit) "prgma" => "pragma"
21:41:59FromDiscord<Elegantbeef> https://github.com/beef331/wasm3/blob/master/src/wasm3/wasm3c.nim here is how one imports
21:43:01FromDiscord<Elegantbeef> so you'd do `proc takeScreenShot(name: cstring){.importc, dynlib: "gdi32.dll".}`
21:43:12FromDiscord<Elegantbeef> Assuming gdi32 had that procedure
21:43:16FromDiscord<Elegantbeef> But given your code i doubt it does
21:43:26FromDiscord<wiga> no the thing is
21:43:33FromDiscord<wiga> i want to make a takeScreenshot function
21:43:36FromDiscord<wiga> i do not have a dll
21:43:41FromDiscord<Elegantbeef> https://github.com/khchen/winim/blob/a485708a243e2f2acbce783027b8cf8582536414/winim/inc/wingdi.nim but like i said
21:44:04FromDiscord<wiga> i just want functions from C in the proc
21:44:19FromDiscord<Elegantbeef> Yes use winim
21:44:27FromDiscord<Elegantbeef> you do not need to annotate that procedure with anything
21:44:33FromDiscord<wiga> aight ty
21:44:37FromDiscord<Elegantbeef> It's a nim procedure, it's not imported
21:44:49FromDiscord<wiga> which module in winim
21:44:56FromDiscord<wiga> lean, com or the other?
21:44:58FromDiscord<Elegantbeef> Perhaps the one i linked
21:45:07FromDiscord<wiga> ah yes indeed
21:45:26FromDiscord<Elegantbeef> I dont have a windows PC so i have no clue the windows API
21:45:38FromDiscord<Elegantbeef> I can only say read winim's manual and the windows manual
21:45:50FromDiscord<wiga> yes
21:46:36*Jjp137 joined #nim
21:47:37FromDiscord<michaelb.eth> In reply to @System64 "Is it possible to": yes, you can put e.g. `{.passC:"...".}` and `{.passL:"...".}` directly into a .nim module
21:48:37FromDiscord<Elegantbeef> Personallg for compiling to wasm i use https://github.com/beef331/wasm3/blob/master/wasmsources/config.nims which is based off of https://github.com/treeform/nim_emscripten_tutorial
21:49:09FromDiscord<Elegantbeef> My version is more for wasm3 modules that are not stand alone programs but 'scripts'
21:49:33FromDiscord<michaelb.eth> In reply to @System64 "Ah alright, thanks I": here's an example: https://github.com/status-im/nim-nat-traversal/blob/master/nat_traversal/miniupnpc.nim#L18-L20
21:51:20FromDiscord<michaelb.eth> In reply to @System64 "Is it possible to": here's an example: https://github.com/status-im/nim-nat-traversal/blob/master/nat_traversal/miniupnpc.nim#L18-L20
21:56:51FromDiscord<wiga> In reply to @Elegantbeef "My version is more": that sucks there's no windows.h in the winim
21:57:43FromDiscord<Elegantbeef> Why does it matter?
21:58:26FromDiscord<wiga> cuz i need this header for the screenshot function
21:58:29FromDiscord<Elegantbeef> I'm like 90% certain all the procedures you use are wrapped inside winim
21:58:33FromDiscord<Elegantbeef> ...?
21:58:43FromDiscord<wiga> i have a program in C
21:58:46FromDiscord<wiga> that takes a screenshot
21:58:50FromDiscord<wiga> and it uses windows.h
21:59:00FromDiscord<wiga> and i dont seem to find it in winim
21:59:20FromDiscord<Elegantbeef> I'm so confused
21:59:30FromDiscord<Elegantbeef> Isnt the program what you wrote in Nim
21:59:38FromDiscord<Elegantbeef> Why do you need windows.h
21:59:50FromDiscord<wiga> to take a screenshot 😐
22:00:01FromDiscord<Elegantbeef> ....
22:00:06FromDiscord<Elegantbeef> You clearly call specific procedures from windows.h
22:00:22FromDiscord<wiga> on god
22:00:29FromDiscord<wiga> thats why i kinda need it
22:00:50FromDiscord<Elegantbeef> What procedures do you call that are not inside winim?
22:01:00FromDiscord<wiga> ZeroMemory
22:01:13FromDiscord<wiga> hBitmap type
22:01:17FromDiscord<Elegantbeef> Alternatively compile the C code into an object and link it
22:01:23FromDiscord<Elegantbeef> https://github.com/khchen/winim/blob/a485708a243e2f2acbce783027b8cf8582536414/winim/inc/winbase.nim#L2779
22:01:50FromDiscord<Elegantbeef> https://github.com/khchen/winim/search?q=HBitmap
22:01:52FromDiscord<Elegantbeef> It's clearly there
22:02:39FromDiscord<wiga> ok nvm im just retard
22:03:04FromDiscord<wiga> i literally imported winim/inc/wingdi instead of the whole library 🗿
22:03:24FromDiscord<Elegantbeef> On god
22:03:56FromDiscord<Elegantbeef> I really should make a rule that if i have to pull teeth to help, you have to make a PR to Nim
22:05:03FromDiscord<wiga> lmfao
22:05:13FromDiscord<wiga> 💀 https://media.discordapp.net/attachments/371759389889003532/1067928151193305158/image.png
22:06:06*PMunch quit (Quit: Leaving)
22:13:03FromDiscord<Gumbercules> In reply to @Elegantbeef "I really should make": Not sure we'd want some of those PRs...
22:13:31FromDiscord<wiga> homemade garbage collector
22:16:43FromDiscord<Elegantbeef> Hey fixing a typo is a PR
22:24:11Amun-Rahomemade garbo (AU)
22:31:17FromDiscord<jmgomez> In reply to @jmgomez "Can the compiler API": Hey beef, do you happen to have an answer for this?
22:31:36FromDiscord<Elegantbeef> Nope
22:34:12FromDiscord<jmgomez> Ok, took a look at cgtypes.nim but didnt see anything that I could use (not even sure if it can be used outside the compiler)
22:51:06*cm quit (Quit: Bye.)
22:56:57FromDiscord<JOHN William> Do you need financial support? Are you tired living from paycheck to paycheck… wanna say goodbye to 9to5? Wanna make $2000 daily $5000 weekly before your next pay check arrives?THEN ASK HOW....📥↵https://t.me/+KuOs8q7WfH8zZGZk↵(@jmgomez)
22:58:32FromDiscord<Nilts> In reply to @JOHN William "Do you need financial": wtf is this
22:58:58*cm joined #nim
22:59:16FromDiscord<System64 ~ Flandre Scarlet> In reply to @michaelb.eth "here's an example: https://github.com/status-im/nim": Sounds interesting!
22:59:33*FromDiscord quit (Remote host closed the connection)
22:59:46*FromDiscord joined #nim
23:01:14FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4mcD
23:03:22FromDiscord<Gumbercules> In reply to @not logged in "is this allowed?": no it's not... <@&371760044473319454>
23:07:30FromDiscord<Hourglass [She/Her]> In reply to @Elegantbeef "I really should make": Lmao that would be horrid but funny
23:08:25FromDiscord<Hourglass [She/Her]> In reply to @Gumbercules "no it's not... <@&371760044473319454>": What was it if I can ask?
23:09:10FromDiscord<Nilts> In reply to @Hourglass, When the Hour Strikes "What was it if": this stuff: https://discord.com/channels/371759389889003530/706542664643772436/1067941376043536567
23:09:19FromDiscord<Hourglass [She/Her]> In reply to @not logged in "<@1046486398850576494> how would": Obviously I'm not the person you're asking, but maybe something that stores the identifier of the function, the parameter types and return types?
23:09:25FromDiscord<Hourglass [She/Her]> In reply to @not logged in "this stuff: https://discord.com/channels/3717593898": Aaah
23:09:52FromDiscord<Nilts> In reply to @Hourglass, When the Hour Strikes "Obviously I'm not the": Nahh, i would need to store the address of the code more likely
23:10:08FromDiscord<Hourglass [She/Her]> In reply to @Hourglass, When the Hour Strikes "Obviously I'm not the": (I'm using the generalised assumption that it's somewhat like JVM bytecode but that's probably wrong)
23:10:21FromDiscord<Nilts> (edit) "likely" => "likely, and then store that function object under the ident"
23:10:53FromDiscord<Hourglass [She/Her]> In reply to @not logged in "Nahh, i would need": Oh so no global function table or something? That's fair
23:12:09FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4mcE
23:13:19FromDiscord<Hourglass [She/Her]> Fair!
23:13:29FromDiscord<Hourglass [She/Her]> I'm clueless then haha
23:13:44FromDiscord<Nilts> we were all clueless once ¯\_(ツ)_/¯
23:16:14FromDiscord<Hourglass [She/Her]> True!
23:16:29FromDiscord<Elegantbeef> A function is practically a jump with a psuh
23:16:32FromDiscord<Elegantbeef> push\
23:16:41FromDiscord<Elegantbeef> You push your parameters on the stack, then jump to the procedure
23:16:52FromDiscord<Elegantbeef> Which grabs the elements off the stack and carries on
23:18:28FromDiscord<Hourglass [She/Her]> Yeah that makes sense, JVM bytecode used a bytecode instruction for calling a method instead of jumping to a block though when I was looking through it
23:24:15FromDiscord<Nilts> In reply to @Elegantbeef "You push your parameters": is the stack the ident table or the seq that the PUSH command sends data to
23:25:58FromDiscord<Hourglass [She/Her]> The latter
23:26:18FromDiscord<Hourglass [She/Her]> 'Stack' of data used by the program is a good way to remember it imo
23:31:47FromDiscord<Nilts> In reply to @Elegantbeef "A function is practically": wait, but would i need a skip or jump to jump to the end of the func?
23:32:59FromDiscord<Hourglass [She/Her]> It'd be jumping to the start of the function, no? Since you wanna run the function's code
23:33:15FromDiscord<Hourglass [She/Her]> Wdym by skip?
23:33:42FromDiscord<Nilts> In reply to @Hourglass, When the Hour Strikes "Wdym by skip?": well, you don't run a function the first time around, only when called
23:34:27FromDiscord<Hourglass [She/Her]> Yep, so when you encounter a function call in the bytecode you'd jump to the function-
23:34:41FromDiscord<Hourglass [She/Her]> Unless I'm missing something
23:35:03FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4mcF
23:36:32FromDiscord<Elegantbeef> Pretty much
23:38:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mcG
23:38:14FromDiscord<Elegantbeef> This is actually how some C calling conventions handle it