00:02:23 | FromDiscord | <Girvo> Hmm |
00:02:25 | FromDiscord | <Girvo> It really doesn't like that |
00:02:42 | FromDiscord | <Girvo> Either with an HTTPS or `[email protected]:` url |
00:02:43 | FromDiscord | <Elegantbeef> Dont think you need the `@` |
00:02:49 | FromDiscord | <Girvo> Yeah I dropped it |
00:02:59 | FromDiscord | <Girvo> Even tried dropping the `#devel` bit altogether just in case |
00:03:24 | FromDiscord | <Girvo> Ohhhhh |
00:03:28 | FromDiscord | <Elegantbeef> I know anuken uses giturls so give me a moment |
00:03:29 | FromDiscord | <Girvo> Its the `.git` part that its whinging |
00:03:36 | FromDiscord | <Elegantbeef> https://github.com/Anuken/fau/blob/master/fau.nimble#L10-L12 |
00:03:45 | FromDiscord | <Girvo> Sweet cheers |
00:04:33 | FromDiscord | <Girvo> Ah it was an invalid package in `pkgs` that was making it choke |
00:04:34 | FromDiscord | <Girvo> Weird |
00:04:56 | FromDiscord | <Girvo> Sweet it works π |
00:04:57 | FromDiscord | <Girvo> Thanks! |
00:06:46 | FromDiscord | <Girvo> Is it possible to override `nimble build`? |
00:06:54 | * | yolo quit (Quit: Client closed) |
00:07:14 | FromDiscord | <Elegantbeef> I dont think so |
00:08:30 | FromDiscord | <Girvo> Damn |
00:09:06 | FromDiscord | <Girvo> `nimble compile src/main.nim` seems to work, but it sticks `nimcache` in the wrong folder (ignoring the location set in `src/nim.cfg`. I hate my custom `build_main` task lol. Oh well, it'll do |
00:47:04 | FromDiscord | <! Nilts> what happend to play.nim-lang.org |
01:02:45 | FromDiscord | <Elegantbeef> It crashes a lot and requires pmunch to hit it wit hammer |
01:09:32 | FromDiscord | <! Nilts> ah |
01:19:07 | FromDiscord | <! Nilts> btw, is it possible to monitor an http request in nim. Like get the exact look of it |
01:21:19 | * | arkurious quit (Quit: Leaving) |
01:25:06 | FromDiscord | <Girvo> What do you mean an exact look of it? |
01:25:13 | FromDiscord | <Girvo> Watching its bytes in-transit or something? |
01:40:11 | FromDiscord | <! Nilts> In reply to @Girvo "Watching its bytes in-transit": like headers and content |
01:40:21 | FromDiscord | <! Nilts> like curl format or whatever |
01:42:21 | * | wallabra quit (Ping timeout: 260 seconds) |
01:48:01 | FromDiscord | <Girvo> I guess I'm not understanding what you mean π can you explain it in another way? |
01:50:15 | FromDiscord | <! Nilts> Like i want to know the exact request data. Because i have a request that does not work in nim with the same headers etc. but it works find in curl. so im trying to find the issue |
01:53:10 | FromDiscord | <Girvo> Right okay! What are you using to make the request? In my case, I just have to print the `repr` of `client.headers` but that might not work for your setup |
01:53:17 | * | jmdaemon quit (Ping timeout: 265 seconds) |
01:54:37 | FromDiscord | <Girvo> https://github.com/LemonBoy/cassette this could help you π |
01:54:59 | FromDiscord | <Girvo> It'll capture/log/replay httpclient calls, should fit what you're looking for I think |
01:55:37 | FromDiscord | <! Nilts> In reply to @Girvo "Right okay! What are": how do i repr |
01:55:45 | FromDiscord | <Girvo> `echo repr yourVar` |
01:56:12 | FromDiscord | <Girvo> Prints the representation of the object, useful for debugging. But in your case `cassette` would probably be even more handy |
01:57:22 | FromDiscord | <! Nilts> In reply to @Girvo "Prints the representation of": but it seem really complicated to use |
01:57:53 | FromDiscord | <Girvo> Its not. You literally just nimble install, and replace `newHttpClient` with `newCassetteClient` |
01:58:44 | FromDiscord | <Girvo> It should output a json file for you. But try the `repr` examination of your `client.headers` first. Thats all I can really suggest without having the code in front of me I'm afraid |
01:59:53 | FromDiscord | <! Nilts> In reply to @Girvo "It should output a": I tried that. It outputed smthing i did not understand |
02:00:29 | FromDiscord | <Girvo> I don't know what you're looking for, I'm afraid |
02:01:23 | FromDiscord | <! Nilts> ok, the gist is im trying to send an api request to https://htmlcompressor.com/api/ |
02:01:32 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=4awl |
02:01:41 | FromDiscord | <Girvo> Then run your code and you'll get a dump.json file which will tell you everything |
02:01:43 | FromDiscord | <! Nilts> In reply to @not logged in "ok, the gist is": and i can't get it working |
02:07:56 | FromDiscord | <Monke> Is parametric polymorphism possible in Nim? |
02:10:12 | FromDiscord | <Rika> `proc square[T](a: T): T = a a` if im not misunderstanding, does this match what you're asking for? |
02:10:22 | FromDiscord | <Elegantbeef> Nim has concepts and also allows generic ducktyping so yes |
02:10:23 | FromDiscord | <Elegantbeef> It's closer to how you get it in C++ than with Haskell or similar |
02:10:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4awn |
02:10:46 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=4awo |
02:11:02 | FromDiscord | <Girvo> @! Nilts That works. cURL automatically uses `application/x-www-form-urlencoded`, httpclient does not |
02:11:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4awp |
02:12:39 | FromDiscord | <Monke> Thanks a ton! |
02:13:02 | FromDiscord | <Monke> I used Nim back in ~2018 or 19 but I've been busy and can't really remember much about it. |
02:13:57 | FromDiscord | <Elegantbeef> There are also concepts like i said which allow you to explicitly state the API required to match a procedure |
02:14:02 | FromDiscord | <Elegantbeef> Personally i think it's the better thing but YMMV |
02:15:14 | FromDiscord | <Monke> Yeah, those concepts do look nice. I'll give that a try and see how it goes. |
02:15:22 | FromDiscord | <Monke> Thanks again. |
02:16:11 | FromDiscord | <!&luke> How can I have objects values default to stuff if theyβre not provided |
02:16:39 | * | monkeybusiness quit (Quit: Leaving) |
02:52:38 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=4awz |
02:53:51 | FromDiscord | <Bung> dunno why need this online service, totally can be done in locall |
03:35:47 | FromDiscord | <ravinder387> nim chart.js example https://media.discordapp.net/attachments/371759389889003532/1019813756718567434/youtube.mp4 |
03:38:16 | FromDiscord | <ravinder387> I'm just using dom , nim itself, and calling chart.js function. |
03:49:43 | * | CyberTailor joined #nim |
03:51:27 | * | jmdaemon joined #nim |
04:25:38 | FromDiscord | <Girvo> Is there a compile-time version of `case`? |
04:25:53 | FromDiscord | <Elegantbeef> Nope |
04:25:55 | FromDiscord | <Elegantbeef> I do mean to make a macro for it |
04:26:02 | FromDiscord | <Girvo> Cool fair enough π |
04:26:44 | FromDiscord | <Elegantbeef> Would be nice if case worked on types, but alas semantics |
04:26:59 | FromDiscord | <Elegantbeef> yes yes there are case statement macros, shush pedants |
04:28:07 | FromDiscord | <Girvo> haha |
04:28:15 | FromDiscord | <Girvo> It _would_ be nice, yeah |
05:04:29 | FromDiscord | <flywind> Using path concatenation in the global config (config.nims) increases ~200 MB memory usage when booting the Nim compiler π |
05:05:26 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=4awV |
05:07:47 | FromDiscord | <flywind> Ah, it is actually importing `std/os` that causes the bigger memeroy usage. |
05:08:52 | FromDiscord | <Bung> π
|
05:09:00 | FromDiscord | <Elegantbeef> Does it not dispose of the VM after loading the config? |
05:09:11 | FromDiscord | <Elegantbeef> Sounds like the issue is it's holding the entire std/os open then |
05:12:43 | FromDiscord | <flywind> Yeah, it is weird |
05:28:27 | FromDiscord | <soda> sent a code paste, see https://paste.rs/dSZ |
05:45:06 | FromDiscord | <Elegantbeef> Speaking of nimble, does it clone submodules? |
05:46:37 | FromDiscord | <Elegantbeef> Ah good it does seem to respect them |
05:48:58 | FromDiscord | <mratsim> In reply to @Elegantbeef "Ah good it does": not sure if they aren't in `src` or the `mypackagename` |
05:49:23 | FromDiscord | <Elegantbeef> Yea i follow nimbles forced directory cause i cannot be arsed with fighting it |
05:50:23 | FromDiscord | <mratsim> In asyncdispatch, it seems like addProcess is making the process "Resource Temporarily Busy" |
05:50:51 | FromDiscord | <mratsim> from 3 years ago :/ https://forum.nim-lang.org/t/5565 |
05:52:08 | FromDiscord | <Elegantbeef> Ah 3 years that means plenty of time to think of a solution π |
05:52:29 | FromDiscord | <mratsim> I'm polling with sleepAsync :/ |
05:53:06 | FromDiscord | <mratsim> trying to create a parallel task runner because GNU parallel farted once too many times, on Github Action Windows, tired of trying to get it in the path |
05:54:25 | FromDiscord | <Elegantbeef> A task runner for processes or nim code? |
05:54:39 | FromDiscord | <mratsim> wait 2min while I finish my PR |
05:54:45 | FromDiscord | <mratsim> for processes |
05:54:46 | FromDiscord | <Elegantbeef> Mmmk |
05:55:06 | FromDiscord | <Elegantbeef> and execProcesses being blocking is a nogo i take it |
05:56:20 | FromDiscord | <mratsim> In reply to @Elegantbeef "and execProcesses being blocking": mostly log are unreadable, it's to run tests in parallel |
05:56:28 | FromDiscord | <mratsim> (edit) "log" => "logs" |
05:56:43 | FromDiscord | <Elegantbeef> Ah i did a silly thing for nimibook in this regard |
05:57:07 | FromDiscord | <Elegantbeef> https://github.com/pietroppeter/nimibook/commit/3e6723afcfe148d3ee3e4e3369cc752cc16c6cf9#diff-296b9b043ee4ab30b508d575fde250f3ef5306782e0da8e1ef7bf84011d10f5eR12-R25 |
06:03:18 | FromDiscord | <mratsim> In reply to @Elegantbeef "A task runner for": https://github.com/mratsim/constantine/blob/887b686b56cb29b02edc614bd204719befaecc5e/helpers/pararun.nim |
06:04:39 | FromDiscord | <Elegantbeef> This is where i joking start flaming your code |
06:04:58 | FromDiscord | <Elegantbeef> Like not doing `for line in lines(commandFile)`! |
06:05:33 | FromDiscord | <Elegantbeef> You dont even close `f` in a short lived program, think of the fish or something like that |
06:06:39 | FromDiscord | <mratsim> In reply to @Elegantbeef "Like not doing `for": actually there was a defer that somehow disappeared in refactoring |
06:07:34 | FromDiscord | <mratsim> At first I interleaved processing with reading the file and wanted to pause line reading hence the current leftover π
|
06:14:43 | FromDiscord | <Elegantbeef> Async always throws me through a loop, cause i read that code and was very much "How is this doing anything parallel" π |
06:15:29 | FromDiscord | <mratsim> In reply to @Elegantbeef "Async always throws me": It isn't, it's concurrent |
06:15:40 | FromDiscord | <mratsim> it just happens that I start new processes |
06:16:24 | FromDiscord | <Elegantbeef> Sure, either way |
06:16:25 | FromDiscord | <Elegantbeef> I dont often use async so reading async code makes me thing extra hard how things work |
06:16:26 | FromDiscord | <Elegantbeef> think\ |
06:18:38 | FromDiscord | <Elegantbeef> I'll proceed to just think of async as weird continuations |
06:23:48 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=4ax6 |
06:50:23 | FromDiscord | <Girvo> One can't really use messagepack2nim to handle object variants can they..β΅`assignment to discriminant changes object branch; compile with -d:nimOldCaseObjects for a transition period` |
07:17:43 | * | CyberTailor left #nim (Konversation terminated!) |
07:33:13 | * | m5zs7k quit (Ping timeout: 252 seconds) |
07:34:31 | * | m5zs7k joined #nim |
07:48:38 | * | tiorock joined #nim |
07:48:38 | * | rockcavera is now known as Guest9927 |
07:48:38 | * | Guest9927 quit (Killed (calcium.libera.chat (Nickname regained by services))) |
07:48:38 | * | tiorock is now known as rockcavera |
08:11:03 | FromDiscord | <Forest [She/Her]> Is there an existing Box2D wrapper for Nim? |
08:11:50 | FromDiscord | <Forest [She/Her]> If not, what's the best way to wrap it? Futhark is C only, and idk what the difference is between c2nim and nimterop |
08:12:13 | FromDiscord | <Elegantbeef> Doesnt box2D have a c-api |
08:12:32 | FromDiscord | <Elegantbeef> https://github.com/erincatto/box2d/tree/main/include/box2d |
08:12:46 | FromDiscord | <Forest [She/Her]> Does it? Huh |
08:12:54 | FromDiscord | <Elegantbeef> Any sane library will |
08:13:12 | FromDiscord | <Forest [She/Her]> Sweet |
08:14:17 | FromDiscord | <Elegantbeef> The hell that folder is full of C++ π |
08:15:13 | FromDiscord | <Elegantbeef> C2nim might work with that but idk |
08:15:59 | FromDiscord | <Forest [She/Her]> Well that's not fun |
08:16:57 | FromDiscord | <mratsim> if you thought programming was fun, you're in for a rude awakening π |
08:17:01 | FromDiscord | <Forest [She/Her]> Honestly I should probs look for an easier lib to use at this point |
08:17:19 | FromDiscord | <Forest [She/Her]> In reply to @mratsim "if you thought programming": Half the fun is the suffering :') |
08:17:35 | FromDiscord | <Elegantbeef> I think c2nim wouldnt be too hard there |
08:18:28 | FromDiscord | <Elegantbeef> `g++ -E box2d.h -o expandedbox2d.h` then `c2nim expandedbox2d.h` and remove all cruft |
08:27:14 | * | rockcavera quit (Remote host closed the connection) |
09:03:02 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
09:04:55 | FromDiscord | <Forest [She/Her]> I have decided to work on a very simple physics engine |
09:05:16 | FromDiscord | <Forest [She/Her]> My issue is naming lmao, what's a good name for checking if a shape is intersecting with another? |
09:05:30 | FromDiscord | <Elegantbeef> `intersect` |
09:06:03 | FromDiscord | <enthus1ast> or `intersects` |
09:08:14 | FromDiscord | <Forest [She/Her]> Would be nice if there was a symbol for it but eh, thanks |
09:10:17 | FromDiscord | <Elegantbeef> Could overload `` given that's used for intersection of sets |
09:10:20 | FromDiscord | <Elegantbeef> But that's a bit ugh |
09:11:25 | FromDiscord | <enthus1ast> imho its much more common that a user wants to get a callback if something overlaps, than checking manually |
09:13:39 | FromDiscord | <enthus1ast> also imho treeform's bumpy is the start of such an engine, maybe you could have a look at itβ΅(@Forest [She/Her]) |
09:13:58 | FromDiscord | <Elegantbeef> It's an AABB intersection library |
09:14:27 | FromDiscord | <enthus1ast> it can also do polygons and circle etc |
09:14:39 | FromDiscord | <Elegantbeef> Yea sorry i mean it's axis aligned |
09:14:47 | FromDiscord | <Elegantbeef> Tired is my excuse |
09:15:34 | FromDiscord | <enthus1ast> and also this\: https://github.com/treeform/spacy |
09:15:42 | FromDiscord | <enthus1ast> which is the basis for fast checking |
09:15:43 | * | sforman quit (Remote host closed the connection) |
09:15:43 | * | Freneticks quit (Remote host closed the connection) |
09:15:43 | * | noeontheend quit (Remote host closed the connection) |
09:15:43 | * | mronetwo_ quit (Write error: Broken pipe) |
09:15:43 | * | xigoi quit (Remote host closed the connection) |
09:15:43 | * | Schnouki quit (Write error: Broken pipe) |
09:16:11 | FromDiscord | <Elegantbeef> It's certainly much easier to just wrap box2d |
09:16:31 | FromDiscord | <enthus1ast> or use the already wrapped chipmunks |
09:17:12 | FromDiscord | <enthus1ast> with chipmunks you can do most of the stuff you can do with box2d |
09:17:12 | FromDiscord | <enthus1ast> if not all |
09:17:19 | * | mronetwo joined #nim |
09:17:19 | * | Schnouki joined #nim |
09:17:32 | FromDiscord | <Elegantbeef> This does remind me i want to make an open source multiplayer pool game |
09:17:39 | * | Freneticks joined #nim |
09:17:43 | FromDiscord | <Elegantbeef> Fuck my list of things i want to do is massive π |
09:17:44 | FromDiscord | <enthus1ast> pool? |
09:17:45 | FromDiscord | <Elegantbeef> billiards |
09:17:47 | FromDiscord | <enthus1ast> ahh |
09:17:48 | * | noeontheend joined #nim |
09:17:59 | FromDiscord | <Elegantbeef> My NA is showing |
09:18:00 | FromDiscord | <enthus1ast> but thats good, its not fast paced \:) |
09:18:03 | * | xigoi joined #nim |
09:18:21 | FromDiscord | <Elegantbeef> Sure but it's a networked physics game |
09:18:21 | FromDiscord | <enthus1ast> muuuch easier than fast realtime multiplayer |
09:18:29 | FromDiscord | <Elegantbeef> Oh it's not certainly turnbased |
09:18:40 | FromDiscord | <Elegantbeef> It's more of a party game and less of a serious billiards game |
09:18:45 | FromDiscord | <Elegantbeef> Atleast is the idea |
09:18:47 | * | sforman joined #nim |
09:19:13 | FromDiscord | <Elegantbeef> Game modes would exist is pretty much what i'm saying |
09:20:54 | FromDiscord | <enthus1ast> the good thing is, you could just play the physic animation on both sides, but tween it to the correc server position |
09:21:15 | FromDiscord | <enthus1ast> once done |
09:21:36 | FromDiscord | <Elegantbeef> Yep or lerp to the players simulation |
09:21:37 | FromDiscord | <enthus1ast> or just do it how fast paced works |
09:21:38 | FromDiscord | <Elegantbeef> Given it's casual |
09:22:21 | FromDiscord | <enthus1ast> in fps games, the packages are sent in chunks eg every 100ms, so every other party has a delayed with 100ms + lag |
09:22:28 | FromDiscord | <Elegantbeef> Yea i know |
09:22:30 | FromDiscord | <enthus1ast> kk |
09:22:44 | FromDiscord | <Elegantbeef> Rollback and intepolation, fun stuff |
09:22:48 | FromDiscord | <enthus1ast> yeah |
09:23:00 | FromDiscord | <enthus1ast> its magical when it starts to work though \:) |
09:23:25 | FromDiscord | <Elegantbeef> Given it's a casual physics game just making the server simulate the game then relaying back is probably the best |
09:23:32 | FromDiscord | <Elegantbeef> Yea except it also causes unintended bugs like rollback hacks |
09:24:03 | FromDiscord | <Elegantbeef> No clue if you know what that is but if you artificially state your ping you increase the volume of "where the play was" so the server allows you to hit when you clearly didnt |
09:25:10 | FromDiscord | <enthus1ast> in fps you must simulate on all clients \:= client prediction |
09:25:27 | FromDiscord | <enthus1ast> it would be just too laggy if you don't do it |
09:25:50 | FromDiscord | <enthus1ast> then just repair the stuff thats off \:) |
09:28:37 | FromDiscord | <Forest [She/Her]> In reply to @Elegantbeef "Could overload `*` given": Eh... |
09:28:53 | FromDiscord | <Forest [She/Her]> In reply to @enthus1ast "imho its much more": Hm i'll look into that |
09:29:08 | FromDiscord | <Elegantbeef> https://www.youtube.com/watch?v=JXzkcKP_qFU |
09:29:11 | * | xet7 joined #nim |
09:37:00 | * | jjido joined #nim |
09:37:55 | * | jjido quit (Client Quit) |
09:55:56 | * | wallabra joined #nim |
10:17:01 | * | jmdaemon quit (Ping timeout: 250 seconds) |
10:18:21 | * | xet7 quit (Ping timeout: 268 seconds) |
10:27:50 | FromDiscord | <axyz> sent a code paste, see https://play.nim-lang.org/#ix=4ayb |
10:33:35 | FromDiscord | <enthus1ast> Elegantbeef\: also the "classic" https://www.gabrielgambetta.com/client-server-game-architecture.html |
10:48:35 | NimEventer | New thread by axyz: Enum union type and "Kind" pattern in recursive types, see https://forum.nim-lang.org/t/9467 |
11:09:59 | FromDiscord | <sOkam!> @Yardanico sry i wrote on gamedev. meant to post on main, didn't noticeβ΅do you have an example of a custom iterator? never made one, so not sure how to tackle it |
11:10:51 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4ayh |
11:11:12 | FromDiscord | <Yardanico> ah right, x.field |
11:11:53 | FromDiscord | <sOkam!> how do you increase a pointer in NIm? does it work like in C? |
11:12:11 | FromDiscord | <mratsim> In reply to @axyz "hi, I have a": use sets: foo in {Rule, Comment, AtRule} |
11:12:40 | FromDiscord | <Rika> In reply to @sOkam! "how do you increase": Are you interfacing with C? |
11:12:57 | FromDiscord | <Rika> If you are, it might be better to use the unchecked array functionality instead |
11:13:21 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ayi |
11:13:31 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4ayi" => "https://play.nim-lang.org/#ix=4ayj" |
11:14:11 | FromDiscord | <sOkam!> In reply to @Rika "Are you interfacing with": im translating the simple gc example from http://maplant.com/gc.html fully to nim. so no interfacing in this case |
11:17:32 | FromDiscord | <Rika> I guess itβs fine to use the pointer math thing for now to ensure the initial implementation works |
11:17:36 | FromDiscord | <Rika> Then to slowly improve it |
11:18:00 | FromDiscord | <Rika> But in Nim, you must cast from pointer to int then back to pointer after adding to do addition and stuff |
11:18:06 | FromDiscord | <sOkam!> how would you do it without pointer math? |
11:18:17 | FromDiscord | <Rika> Or make a + operator that just does that for you |
11:18:46 | FromDiscord | <Rika> In reply to @sOkam! "how would you do": Not sure since I havenβt read the article |
11:18:52 | FromDiscord | <Rika> Might have subtleties I donβt know about |
11:19:45 | FromDiscord | <sOkam!> so, i guess i would have to implement the `..` operand for `ptr MyType`, and that will make it work? |
11:20:07 | FromDiscord | <sOkam!> (edit) "operand" => "and `<`operands" |
11:23:06 | FromDiscord | <Generic> just cast them to ByteAddress |
11:23:32 | FromDiscord | <Generic> and then use countup with 8 byte steps |
11:24:14 | FromDiscord | <axyz> sent a code paste, see https://play.nim-lang.org/#ix=4ayn |
11:31:13 | * | pro joined #nim |
11:33:47 | * | pro quit (Client Quit) |
11:34:29 | * | pro joined #nim |
11:35:43 | * | pro quit (Client Quit) |
11:37:23 | FromDiscord | <mratsim> In reply to @axyz "can you elaborate with": Not directly in the type section, well maybe you can hack range type for that but meh.β΅β΅Best is to create an initialization proc and have all checks in and all inilizations go through that. |
11:48:40 | FromDiscord | <axyz> sent a code paste, see https://play.nim-lang.org/#ix=4ayu |
12:21:05 | FromDiscord | <mratsim> In reply to @axyz "mhm I see, but": You shouldn't need visitors in a language with object variants / sum types |
12:21:13 | FromDiscord | <mratsim> At least you have the option not to need them |
12:22:09 | FromDiscord | <mratsim> This is a machine learning compiler, no visitors: https://github.com/numforge/laser/blob/master/laser/lux_compiler/core/lux_types.nim |
12:23:41 | FromDiscord | <mratsim> You have plentyof markdown files detailing the design, and if you're writing a dsl and looking for inspiration you can look into the papers I reference here: https://github.com/numforge/laser/blob/master/research/porting_Halide_to_Nim.md#semantic-pass-and-the-extension-problem |
12:26:19 | * | PMunch joined #nim |
12:31:44 | FromDiscord | <axyz> In reply to @mratsim "You shouldn't need visitors": thanks I'll take a look |
12:31:45 | * | yolo joined #nim |
12:31:56 | * | arkurious joined #nim |
12:56:12 | * | derpydoo joined #nim |
13:02:01 | * | PMunch quit (Quit: Leaving) |
13:04:22 | * | jjido joined #nim |
13:16:25 | * | derpydoo quit (Ping timeout: 250 seconds) |
13:38:26 | * | yolo quit (Quit: Client closed) |
13:55:09 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ayW |
13:56:35 | FromDiscord | <Generic> yes |
13:56:49 | FromDiscord | <Generic> assuming you want to include endpc, otherwise use endpc-1 |
13:57:20 | FromDiscord | <sOkam!> what type is an address, btw?β΅does `var thing :Type; thing.addr` convert to `ptr Type`? |
13:58:03 | FromDiscord | <Generic> yes |
14:07:45 | FromDiscord | <Require Support> working with `chronos` how would I get into on the exception hit since there isnt much support for it except for `CatchableError` .. would I just keep raising it? |
14:07:56 | FromDiscord | <Require Support> (edit) "into" => "info" |
14:08:08 | FromDiscord | <Require Support> (edit) ".." => ";" |
14:10:25 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=4az0 |
14:14:03 | FromDiscord | <Require Support> In reply to @Tanguy "What do you mean?": honestly idk why im over complicating things π
thanks |
14:16:19 | * | LuxuryMode joined #nim |
14:17:54 | * | yolo joined #nim |
14:38:56 | FromDiscord | <sOkam!> is there a "cleaner" way to do something like this?β΅trying to translate some C code that uses a do-while, but don't know if there is a better way to do it π€ https://media.discordapp.net/attachments/371759389889003532/1019980639728050266/unknown.png |
14:42:32 | FromDiscord | <Rika> No |
14:43:49 | FromDiscord | <sOkam!> any reason to avoid the template? the infinite loop doesn't loop appealing, tbh. but don't know what that person meant by code being "duplicated" |
14:44:13 | FromDiscord | <sOkam!> (edit) "template? the" => "template?β΅the" |
14:44:34 | FromDiscord | <Rika> The code would be copied twice |
14:44:56 | FromDiscord | <sOkam!> is that a bad thing? |
14:45:02 | FromDiscord | <Rika> For code size sure |
14:45:14 | FromDiscord | <Rika> If you care about code size |
14:45:26 | FromDiscord | <Rika> This includes binary size |
14:45:33 | FromDiscord | <Tanguy> The template seems like a bad idea, I'll take the infinite loop any day |
14:45:38 | FromDiscord | <Rika> Maybe the C compiler would optimise it but still |
14:45:51 | FromDiscord | <Tanguy> This template |
14:46:39 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=4azb |
14:46:56 | FromDiscord | <sOkam!> oh i see what you mean |
14:47:20 | FromDiscord | <sOkam!> couldn't the infinite loop be turned into a template too? |
14:48:10 | FromDiscord | <Rika> sure |
14:48:10 | FromDiscord | <sOkam!> meaning so that the body code is not duplicated |
14:48:27 | FromDiscord | <Rika> it could yes |
14:48:34 | FromDiscord | <sOkam!> (edit) "duplicated" => "duplicated, and the syntax explains what the code does" |
14:48:59 | FromDiscord | <exelotl> it's a bit weird though, usually in languages with do..while (or repeat..until) the condition goes at the end |
14:49:15 | FromDiscord | <planetis> just do while true and at the end the condition negated `while true: code; if not cond: break` |
14:50:17 | * | Schnouki left #nim (WeeChat 3.6) |
14:51:07 | FromDiscord | <Rika> i mean thats what the screenshot says |
14:51:47 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4azc |
14:51:49 | FromDiscord | <Rika> if not a |
14:57:25 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4azg |
15:01:34 | FromDiscord | <sOkam!> could converters create any potential issues?β΅i think they could make things a bit cleaner, maybe π€ |
15:02:23 | FromDiscord | <Rika> it would make things more confusing |
15:02:39 | FromDiscord | <Rika> youd then need to figure out where which converters run |
15:06:30 | FromDiscord | <exelotl> it looks ugly because you're trying to write Nim exactly like it's C π |
15:14:44 | FromDiscord | <taven> hi |
15:14:49 | FromDiscord | <Dumb Dragon> I could get if it's necessary if you're interfacing with a C library. But if you're trying to translate a C library over, why not just leave it be and use an FFI? |
15:15:07 | FromDiscord | <taven> does nim have a borrow checker or does it use gc? |
15:15:23 | FromDiscord | <Dumb Dragon> It uses GC, but there are optional move semantics |
15:15:36 | FromDiscord | <Dumb Dragon> (edit) "It uses ... GC," added "a reference counter with a backup" |
15:16:08 | FromDiscord | <taven> is that better than a borrow checker? |
15:16:22 | FromDiscord | <taven> (in your subjective opinion) |
15:16:28 | FromDiscord | <Dumb Dragon> depends really |
15:16:46 | FromDiscord | <Dumb Dragon> the refcounter can be kinda annoying when dealing with threads, not to mention slower overall |
15:17:02 | FromDiscord | <Dumb Dragon> but I enjoy it because it's an "out of sight out of mind" type of thing |
15:17:22 | FromDiscord | <Dumb Dragon> (edit) "the refcounter can be kinda annoying when dealing with threads, not to mention ... slowercompared" added "a bit" | "a bitslower overall ... " added "compared to borrow checking" |
15:17:43 | FromDiscord | <Dumb Dragon> though I wouldn't mind seeing borrow checked types |
15:17:58 | FromDiscord | <taven> i will not be dealing with threads (most likely), mostly trying to do distributed computing |
15:18:44 | FromDiscord | <taven> so stuff like paxos/raft, writing databases and so on |
15:18:58 | FromDiscord | <Dumb Dragon> ah, I can't really say as I don't have any experience with that |
15:19:16 | FromDiscord | <Dumb Dragon> I mostly do game development and low-level |
15:19:22 | FromDiscord | <Dumb Dragon> (edit) "I mostly do game development and low-level ... " added "stuff" |
15:19:32 | FromDiscord | <taven> i see |
15:22:40 | FromDiscord | <sOkam!> In reply to @exelotl "it looks ugly because": i know πβ΅but im trying to translate some C code, and i don't know how else to do it π’ |
15:22:42 | FromDiscord | <Rika> i fail to see the connection of distributed computing and the gc v bc argument |
15:23:43 | FromDiscord | <Dumb Dragon> if you're dealing with completely separate computers then I imagine the reference counter shouldn't cause any issue |
15:23:46 | FromDiscord | <sOkam!> In reply to @Dumb Dragon "I could get if": the party poopper is being the syntax, but the goal is learning pointers and manual memory management |
15:24:08 | FromDiscord | <Dumb Dragon> ah got it |
15:26:27 | FromDiscord | <taven> In reply to @Rika "i fail to see": well i need to build partial indexes of my data in a hypergraph data structureβ΅is building a hypergraph and traversing generalized tree structures easy in nim? |
15:27:52 | FromDiscord | <Rika> that's a hard question to answer, what would make building such data structures hard? |
15:48:53 | * | yolo quit (Quit: Client closed) |
16:08:35 | NimEventer | New question by ASVI: use typed nodes in untyped arg of nim macros, see https://stackoverflow.com/questions/73734312/use-typed-nodes-in-untyped-arg-of-nim-macros |
16:33:13 | * | vicecea joined #nim |
16:39:11 | * | syl quit (Quit: C-x C-c) |
16:39:47 | * | syl joined #nim |
16:56:46 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzβ¦) |
17:00:58 | * | rockcavera joined #nim |
17:00:58 | * | rockcavera quit (Changing host) |
17:00:58 | * | rockcavera joined #nim |
17:03:11 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4azX |
17:05:37 | FromDiscord | <Phil> Wait, just tested it in isolation, that already works... hmmm something dumb is happening in my code, I need to go back and investigate |
17:06:06 | * | rockcavera quit (Read error: Connection reset by peer) |
17:06:26 | FromDiscord | <Phil> Nevermind, found the issue, was just being blind |
17:13:45 | FromDiscord | <B L Γ D Γ> Hi guys I'm implementing a bytecode vm for my programming language in nimβ΅I have a question if i want to make bindings for say raylib or any other lib what is a convenient way to make bindings |
17:14:00 | FromDiscord | <B L Γ D Γ> Without hard coding raylib into the language |
17:14:36 | FromDiscord | <B L Γ D Γ> How can i make an abstraction to bind existing libraries to my language without hard coding specific libraries |
17:15:55 | FromDiscord | <auxym> In reply to @Isofruit "Can one specifically export": you are missing an asterisk `dbHost` if you want it to be avaible from other modules |
17:16:48 | FromDiscord | <TheOctoberSurprise> In reply to @B L Γ D Γ "How can i make": Like some sort of dynamic bindings? |
17:17:11 | FromDiscord | <B L Γ D Γ> In reply to @TheOctoberSurprise "Like some sort of": Yes |
17:17:24 | FromDiscord | <auxym> In reply to @B L Γ D Γ "How can i make": to clarify, you mean you want to include an FFI mechanism in your language, so it can call into Nim? |
17:17:30 | FromDiscord | <B L Γ D Γ> Yes |
17:18:13 | FromDiscord | <B L Γ D Γ> I want to implement raylib into my lang, |
17:18:23 | FromDiscord | <leorize> libffi is a good one for this |
17:18:25 | FromDiscord | <B L Γ D Γ> Without hatdcoding it to the lang |
17:18:29 | FromDiscord | <auxym> call into compiled nim code (C ABI), or into nimscript to be interpreted by the VM? |
17:19:06 | FromDiscord | <auxym> tbh I have no idea either way, but I'd look into how python does C ffi for inspiration |
17:19:53 | FromDiscord | <B L Γ D Γ> I don't want to add new types of values just for raylib to workβ΅Imagine i have to implement another lib |
17:20:00 | FromDiscord | <B L Γ D Γ> This is gonna be a mess |
17:21:21 | FromDiscord | <auxym> yeah, like I said, I'd look into however ctypes works in python: https://docs.python.org/3/library/ctypes.html |
17:21:29 | FromDiscord | <auxym> it can load a dynamic library at runtime |
17:21:42 | FromDiscord | <B L Γ D Γ> https://media.discordapp.net/attachments/371759389889003532/1020021606069850171/Screenshot_2022-09-15-19-21-32-20_320a9a695de7cdce83ed5281148d6f19.jpg |
17:21:58 | FromDiscord | <B L Γ D Γ> Like here this is nim raylib bindings |
17:22:20 | FromDiscord | <B L Γ D Γ> How to make the lib work with my lang data structures? |
17:22:57 | FromDiscord | <B L Γ D Γ> I just want tot make a game to be a proof of concept to my lang |
17:23:02 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
17:25:27 | FromDiscord | <leorize> you can look at lua for inspiration |
17:25:33 | FromDiscord | <leorize> lua basically offloads these stuff to C interface via `userdata` |
17:25:45 | FromDiscord | <Phil> In reply to @auxym "you are missing an": That was me missing that from the example I provided. My actual mistake was that I redefined the const in the same module 20 lines lower and didn't notice |
17:32:39 | FromDiscord | <Bubblie> Other than cligen is there another cli like library for nim? |
17:35:29 | FromDiscord | <Yardanico> In reply to @Bubblie "Other than cligen is": argparse |
17:35:47 | FromDiscord | <Yardanico> it's more on the manual side, but I like it for being pluggable |
17:35:48 | FromDiscord | <Yardanico> https://github.com/iffy/nim-argparse |
17:36:06 | FromDiscord | <Yardanico> there are also of course options like docopt and stuff, you can search on github |
17:36:52 | FromDiscord | <Bubblie> Thanks! |
18:07:31 | * | yolo joined #nim |
18:15:10 | * | buster_blue[m] is now known as TrueBlue[m] |
18:29:38 | NimEventer | New Nimble package! getdns - Wrapper over the getdns API, see https://getdnsapi.net/ |
18:44:37 | NimEventer | New thread by morturo: Any way to prevent GC from collecting some values?, see https://forum.nim-lang.org/t/9468 |
18:59:48 | FromDiscord | <Ecorous> so uh |
18:59:54 | FromDiscord | <Ecorous> we have an issue |
19:00:17 | FromDiscord | <Ecorous> argparse is definitely installed |
19:00:17 | FromDiscord | <Ecorous> S:\Projects\Nim\Test\src\Test.nim(15, 8) Error: cannot open file: argparse |
19:00:34 | FromDiscord | <Ecorous> am trying with this |
19:00:36 | FromDiscord | <Ecorous> sent a code paste, see https://play.nim-lang.org/#ix=4aAt |
19:00:58 | FromDiscord | <Ecorous> https://media.discordapp.net/attachments/371759389889003532/1020046584928555128/unknown.png |
19:07:01 | * | jmdaemon joined #nim |
19:42:45 | FromDiscord | <mratsim> In reply to @taven "is that *better* than": Anything sufficiently complex like graphs and trees and daga in Rust uses reference counting Rc<T> or for multithreading Atomic Reference Counting Arc<T> |
19:44:47 | FromDiscord | <mratsim> In reply to @taven "so stuff like paxos/raft,": The biggest open-source (abd closed?) Nim program is an Ethereum blockchain client so consensus engine like Paxos and Raft are sefinitely possible, easy and efficient in Nim (The client in Nim uses less memory, at least 1.5x than the clients in Go, Rust and Java) |
19:45:34 | FromDiscord | <mratsim> In reply to @taven "well i need to": I don't know about hypergraphs but trees are easy. |
19:47:29 | FromDiscord | <mratsim> In reply to @B L Γ D Γ "How can i make": There are several ways to offer multiple backend selected at compile time with `when`. At runtime you might be able to get away with dlopen |
19:51:16 | * | yolo quit (Quit: Client closed) |
19:58:54 | FromDiscord | <B L Γ D Γ> sent a code paste, see https://play.nim-lang.org/#ix=4aAF |
19:58:59 | FromDiscord | <B L Γ D Γ> These are the value types of my interpreter |
19:59:15 | FromDiscord | <B L Γ D Γ> when i added the array variant The performance droped massivly |
19:59:23 | FromDiscord | <B L Γ D Γ> why is that? |
19:59:41 | FromDiscord | <B L Γ D Γ> I'm not even using the variant |
20:00:03 | FromDiscord | <leorize> are you using orc/arc? |
20:00:06 | FromDiscord | <B L Γ D Γ> yes |
20:00:10 | * | jjido joined #nim |
20:01:27 | FromDiscord | <B L Γ D Γ> with refc it drops even more |
20:01:37 | FromDiscord | <B L Γ D Γ> by just adding the variant |
20:01:47 | FromDiscord | <leorize> looks like matrix is lagging |
20:01:58 | FromDiscord | <B L Γ D Γ> if i change the type to ptr seq[Value] |
20:02:02 | FromDiscord | <B L Γ D Γ> the perf stays the same |
20:02:12 | FromDiscord | <leorize> anyhow, I think your issue might have to do with the `seq[T]` is very huge |
20:02:18 | FromDiscord | <leorize> in arc/orc |
20:02:21 | FromDiscord | <leorize> it's 16 bytes |
20:02:36 | FromDiscord | <leorize> with the variant selector that is a total of 24 bytes for that structure |
20:02:37 | FromDiscord | <B L Γ D Γ> In reply to @leorize "in arc/orc": It happens with refc also |
20:03:20 | FromDiscord | <B L Γ D Γ> should i go with manual ref counting and use a ptr? |
20:03:23 | FromDiscord | <leorize> might be genericAssign shenanigans in that case, try profilling |
20:03:35 | FromDiscord | <B L Γ D Γ> In reply to @leorize "might be genericAssign shenanigans": Profiling with what? |
20:03:39 | FromDiscord | <B L Γ D Γ> Valgrind? |
20:03:47 | FromDiscord | <leorize> that or `perf`, anything works |
20:06:44 | FromDiscord | <B L Γ D Γ> This is the overhead https://media.discordapp.net/attachments/371759389889003532/1020063134347690004/unknown.png |
20:07:01 | FromDiscord | <B L Γ D Γ> when i remove the variant these don't appear |
20:07:16 | FromDiscord | <leorize> try comparing the generated code of that function |
20:07:34 | FromDiscord | <B L Γ D Γ> these are not my functions |
20:07:54 | FromDiscord | <B L Γ D Γ> I think it's something with copying? |
20:08:22 | FromDiscord | <B L Γ D Γ> Isn't a ref to anything defaults to nil |
20:08:30 | FromDiscord | <B L Γ D Γ> So why does it make a diffrence |
20:08:37 | FromDiscord | <B L Γ D Γ> it makes no sense to me |
20:08:57 | FromDiscord | <B L Γ D Γ> when i change ref to ptr everything works normal |
20:09:12 | FromDiscord | <leorize> ref counting happens when ref is copied, if that helps |
20:09:17 | FromDiscord | <leorize> though that should be basically free |
20:09:24 | FromDiscord | <B L Γ D Γ> In reply to @leorize "though that should be": yea |
20:09:48 | FromDiscord | <B L Γ D Γ> And if ptr makes no diffrenceβ΅then i should manage it myself i guess |
20:10:08 | FromDiscord | <B L Γ D Γ> And btw that variant isn't used anywhere in the code |
20:10:21 | FromDiscord | <B L Γ D Γ> By just adding it the perf drops alot |
20:10:35 | FromDiscord | <leorize> for arc/orc, I'm pretty sure it's the size inflation |
20:10:40 | FromDiscord | <leorize> for refc it's weird |
20:11:10 | FromDiscord | <TheOctoberSurprise> How can Value be a seq[Value]? |
20:11:28 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4aAI |
20:11:32 | FromDiscord | <leorize> In reply to @TheOctoberSurprise "How can Value be": because seq[T] is indirect |
20:11:49 | FromDiscord | <leorize> ie, it doesn't store the value in the same memory space, if that makes sense |
20:12:41 | FromDiscord | <B L Γ D Γ> sent a code paste, see https://play.nim-lang.org/#ix=4aAJ |
20:12:43 | FromDiscord | <B L Γ D Γ> So why does it make a diffrence to my code |
20:13:16 | FromDiscord | <B L Γ D Γ> (edit) "https://play.nim-lang.org/#ix=4aAJ" => "https://play.nim-lang.org/#ix=4aAK" |
20:13:42 | FromDiscord | <TheOctoberSurprise> In reply to @leorize "because seq[T] is indirect": I'm new to Nim so this just looked weird to me. It seems like a recursive definition |
20:15:48 | FromDiscord | <leorize> sent a code paste, see https://play.nim-lang.org/#ix=4aAN |
20:18:51 | FromDiscord | <leorize> In reply to @TheOctoberSurprise "I'm new to Nim": if you've ever written a linked list in any typed language, then the principle is kinda the same |
20:19:16 | FromDiscord | <B L Γ D Γ> sent a code paste, see https://play.nim-lang.org/#ix=4aAO |
20:19:32 | FromDiscord | <B L Γ D Γ> The perf gap is huge with no apparent cause |
20:19:53 | FromDiscord | <TheOctoberSurprise> Oh yes, of course π |
20:20:00 | FromDiscord | <TheOctoberSurprise> Thanks |
20:20:48 | FromDiscord | <B L Γ D Γ> sent a code paste, see https://play.nim-lang.org/#ix=4aAP |
20:20:55 | FromDiscord | <B L Γ D Γ> Even when i add string variant |
20:21:08 | FromDiscord | <B L Γ D Γ> the perf doped 4x times |
20:21:25 | FromDiscord | <B L Γ D Γ> I think the problem is with heap objects |
20:21:59 | FromDiscord | <B L Γ D Γ> If i change the string to ptr string everything is normal again!!! |
20:22:52 | NimEventer | New thread by Tuatarian: Nim 2 feature request - Custom operators, see https://forum.nim-lang.org/t/9469 |
20:22:55 | FromDiscord | <leorize> note that string is the same as seq[byte] |
20:26:33 | FromDiscord | <huantian> how are you using the object? are you doing copies? |
20:27:16 | FromDiscord | <Elegantbeef> Use `--mm:orc` if you arent presently |
20:28:18 | FromDiscord | <B L Γ D Γ> In reply to @huantian "how are you using": Poping and pushing to a stack |
20:28:21 | FromDiscord | <B L Γ D Γ> it's a VM |
20:28:28 | FromDiscord | <B L Γ D Γ> In reply to @Elegantbeef "Use `--mm:orc` if you": I'm using it |
20:28:57 | FromDiscord | <B L Γ D Γ> And the variant isn't even being usedf |
20:29:13 | FromDiscord | <B L Γ D Γ> Just by adding it perf dropped signifcantly |
20:29:29 | FromDiscord | <Elegantbeef> the string doesnt allocated by default so it really shouldnt |
20:30:07 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
20:30:14 | FromDiscord | <B L Γ D Γ> In reply to @Elegantbeef "the string doesnt allocated": Yes that's what i'm talking about |
20:30:27 | FromDiscord | <Elegantbeef> Code? |
20:30:29 | FromDiscord | <B L Γ D Γ> In reply to @B L Γ D Γ "This is the overhead": And these are the functions that slow things down |
20:30:45 | FromDiscord | <B L Γ D Γ> In reply to @Elegantbeef "Code?": wait ill push to the repo |
20:31:01 | FromDiscord | <leorize> my hypothesis is the 16 bytes object grew into 24 bytes with string/seq added, slowing the program down :p |
20:31:08 | * | ehmry joined #nim |
20:31:18 | FromDiscord | <Elegantbeef> leorize `string` is the same size as `ptr string` |
20:31:45 | FromDiscord | <leorize> not in arc tho? didn't len got inlined in that case? |
20:31:59 | FromDiscord | <Elegantbeef> They're pointers with all mm |
20:32:12 | FromDiscord | <leorize> hmm, I guess my info is outdated |
20:32:20 | FromDiscord | <huantian> oh huh I thought it was a ptr and a len too |
20:32:38 | FromDiscord | <B L Γ D Γ> https://github.com/joetifa2003/wind-nim |
20:32:45 | FromDiscord | <Elegantbeef> Oh actually orc is 16 |
20:32:45 | FromDiscord | <Elegantbeef> Shit i was wrong! |
20:32:54 | FromDiscord | <leorize> damn it beef |
20:33:19 | FromDiscord | <leorize> that would explain the ptr not having the issue |
20:33:25 | * | yolo joined #nim |
20:33:30 | FromDiscord | <leorize> wouldn't explain how it still sucks with refc tho |
20:33:46 | FromDiscord | <B L Γ D Γ> In reply to @leorize "wouldn't explain how it": wait i'll benchmark the two |
20:33:54 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1020069977065279488/image.png |
20:34:16 | FromDiscord | <Elegantbeef> So sad |
20:34:45 | FromDiscord | <leorize> we no longer have to load a ptr to check length, but at what cost? :p |
20:35:21 | FromDiscord | <Elegantbeef> So then yea it's likely the cache coherency |
20:35:22 | FromDiscord | <Elegantbeef> use `ref string` and possibly be merry |
20:35:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aAS |
20:35:55 | FromDiscord | <Elegantbeef> I honestly doubt it's cache coherency |
20:36:12 | FromDiscord | <Elegantbeef> I think it's just improper usage of movesemantics |
20:36:12 | FromDiscord | <Elegantbeef> Implicit copies probably |
20:36:36 | FromDiscord | <leorize> if they never used the object, I don't have any hypothesis that would explain the perf changes |
20:36:51 | FromDiscord | <Elegantbeef> Yea what's the benchmark? |
20:37:15 | FromDiscord | <huantian> In reply to @Elegantbeef "Implicit copies probably": that seems reasonable |
20:37:46 | FromDiscord | <leorize> In reply to @leorize "if they never used": by this I meant never storing a string/seq btw |
20:37:47 | FromDiscord | <Elegantbeef> If refc is also slow it'd explain the issue perfectly |
20:38:20 | FromDiscord | <Elegantbeef> But that'd imply they populate strings |
20:38:59 | FromDiscord | <B L Γ D Γ> sent a long message, see http://ix.io/4aAV |
20:40:06 | FromDiscord | <leorize> hmm, even if string copying code is borked, it couldn't have caused such a major diff if string is not used at all |
20:40:34 | FromDiscord | <Elegantbeef> I mean 40% of their program is spent in eqcopy |
20:40:53 | FromDiscord | <Elegantbeef> So something is being copied, and without knowing the benchmark code we cannot say what's going on |
20:41:08 | FromDiscord | <B L Γ D Γ> wait |
20:41:11 | FromDiscord | <leorize> oh, without the string the object can be byte-copied |
20:41:27 | FromDiscord | <B L Γ D Γ> So the problem is with the SET opcode? |
20:41:46 | FromDiscord | <Elegantbeef> no |
20:42:01 | FromDiscord | <leorize> with the string, conditionals must be checked to handle copying when that arise |
20:42:03 | FromDiscord | <leorize> that can explain the perf |
20:42:20 | FromDiscord | <Elegantbeef> It's just why dont you just do `vm.envStack.set(instruction.setScopeIndex, instruction.setIndex, vm[^1])` |
20:42:44 | FromDiscord | <Elegantbeef> popping then pushing seems pointless |
20:43:00 | FromDiscord | <leorize> btw this kind of pop/push is why high-speed vms uses registers |
20:43:30 | FromDiscord | <Elegantbeef> Also you use macros like templates, it makes me sad |
20:43:46 | FromDiscord | <Elegantbeef> I'm still looking for the issue though |
20:43:58 | FromDiscord | <B L Γ D Γ> In reply to @Elegantbeef "Also you use macros": I know XD |
20:44:10 | FromDiscord | <B L Γ D Γ> I'm a begginer though just learned about templates π¦ |
20:44:17 | FromDiscord | <Elegantbeef> Lol |
20:44:43 | FromDiscord | <Elegantbeef> Learning about macros before templates is a feat |
20:47:28 | FromDiscord | <B L Γ D Γ> changed it |
20:47:31 | FromDiscord | <B L Γ D Γ> sent a code paste, see https://play.nim-lang.org/#ix=4aAY |
20:47:42 | FromDiscord | <B L Γ D Γ> I think was high when i wrote this code lol |
20:47:46 | FromDiscord | <B L Γ D Γ> (edit) "I think ... was" added "i" |
20:49:00 | FromDiscord | <Elegantbeef> https://github.com/joetifa2003/wind-nim/blob/master/src/compiler/compiler.nim#L126-L132 stuff like this isnt great either |
20:49:19 | FromDiscord | <Elegantbeef> `result.add` can move a variable, but you reuse the variables after you can move them so now you need to do implicit copies |
20:49:43 | FromDiscord | <Elegantbeef> Fuck |
20:49:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aB1 |
20:49:52 | FromDiscord | <B L Γ D Γ> XD |
20:49:57 | FromDiscord | <B L Γ D Γ> Yea u are right |
20:50:20 | FromDiscord | <B L Γ D Γ> Sorry master |
20:50:35 | FromDiscord | <B L Γ D Γ> I'm still a noob π¦ |
20:50:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aB2 |
20:50:56 | FromDiscord | <Elegantbeef> The fuck was about accidently pasting |
20:51:40 | FromDiscord | <Elegantbeef> That applies to all your adding procedures |
20:53:12 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
20:53:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aB4 |
20:53:34 | * | dtomato joined #nim |
20:53:43 | FromDiscord | <Elegantbeef> It'll statically error where a implicit copy is made and you can either refactor to remove it or call `deepCopy` |
20:55:24 | FromDiscord | <Elegantbeef> Oh actually your AST is a `ref object` |
20:55:24 | FromDiscord | <Elegantbeef> So that doesnt matter π |
20:55:45 | FromDiscord | <B L Γ D Γ> And all of this isn't the hot code |
20:56:09 | FromDiscord | <B L Γ D Γ> https://media.discordapp.net/attachments/371759389889003532/1020075569741832242/unknown.png |
20:56:09 | FromDiscord | <Elegantbeef> Yea i know i'm just reading through the code |
20:56:13 | FromDiscord | <Elegantbeef> You still havent said how to benchmark it |
20:56:36 | FromDiscord | <Elegantbeef> yea sorry it's `a: var Value, b: Value` |
20:56:57 | FromDiscord | <B L Γ D Γ> run the build.sh and it will interpret the main.wind file |
20:57:05 | FromDiscord | <B L Γ D Γ> ./build.sh has all the compiler flags' |
20:57:18 | FromDiscord | <Elegantbeef> Why not make a nimble task π |
20:57:40 | FromDiscord | <B L Γ D Γ> and in the vm/value.nim comment and uncomment the string varaint |
20:57:44 | FromDiscord | <B L Γ D Γ> to see the diffrence |
20:57:51 | FromDiscord | <B L Γ D Γ> In reply to @Elegantbeef "Why not make a": What the hell is that lol |
20:58:06 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/nimble#nimble-tasks |
20:58:43 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasm3/blob/master/wasm3.nimble#L18-L21 you can do things like this |
20:59:34 | FromDiscord | <B L Γ D Γ> Oh |
20:59:41 | FromDiscord | <B L Γ D Γ> I thinks it copies in the interpret proc |
20:59:43 | FromDiscord | <B L Γ D Γ> in the vm |
20:59:48 | FromDiscord | <B L Γ D Γ> cause i have an op called const |
20:59:55 | FromDiscord | <B L Γ D Γ> which has a value object in it |
21:00:09 | FromDiscord | <B L Γ D Γ> so when i get the intruction form the array it copies the value with it |
21:00:12 | FromDiscord | <B L Γ D Γ> right? |
21:00:48 | FromDiscord | <Elegantbeef> Only if it cannot move |
21:01:00 | FromDiscord | <Elegantbeef> Given you dont use instruction after i imagine it moves |
21:01:20 | FromDiscord | <B L Γ D Γ> Error: '=copy' is not available for type <OpCode>; requires a copy because it's not the last read of 'y[i]' |
21:01:49 | FromDiscord | <Elegantbeef> Well then yep |
21:01:55 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1020077023395319858/image.png |
21:01:56 | FromDiscord | <Elegantbeef> thanks github |
21:02:11 | FromDiscord | <B L Γ D Γ> sent a code paste, see https://play.nim-lang.org/#ix=4aBa |
21:02:12 | FromDiscord | <B L Γ D Γ> So the problem is in this part right |
21:02:33 | FromDiscord | <B L Γ D Γ> I have an idea |
21:02:35 | FromDiscord | <Elegantbeef> That's a copy yes |
21:02:44 | FromDiscord | <B L Γ D Γ> i can make a an array of constants |
21:02:51 | FromDiscord | <B L Γ D Γ> and pass the index to the opcode |
21:03:05 | FromDiscord | <B L Γ D Γ> LoL that won't make a diffrence |
21:03:09 | FromDiscord | <Elegantbeef> `template instruction(): auto = instructions[ip]` π |
21:03:28 | FromDiscord | <B L Γ D Γ> In reply to @Elegantbeef "`template instruction(): auto =": What will this do? |
21:03:30 | FromDiscord | <Elegantbeef> It will in other cases you use instruction |
21:04:05 | FromDiscord | <Elegantbeef> Just do what you were going to do |
21:04:45 | FromDiscord | <B L Γ D Γ> Thanks elegant beef β€οΈ |
21:05:13 | FromDiscord | <Elegantbeef> I'm kinda just being silly |
21:46:40 | FromDiscord | <! Nilts> What is the type of a type? Like people use types as markers in procs |
21:47:13 | FromDiscord | <planetis> typedesc |
21:48:05 | FromDiscord | <Monke> Does anybody know of any actively maintained graphics library bindings? I'm looking for things like GLFW, SFML, LGJW, etc. |
21:51:34 | * | rockcavera joined #nim |
21:51:35 | * | rockcavera quit (Changing host) |
21:51:35 | * | rockcavera joined #nim |
22:01:04 | FromDiscord | <Patitotective> In reply to @Monke "Does anybody know of": perhaps https://github.com/nimgl/nimgl |
22:01:25 | FromDiscord | <Monke> Thanks. That's the most up to date that I could find as well. |
22:04:37 | FromDiscord | <! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4aBm |
22:11:06 | FromDiscord | <auxym> what does this have to do with nim? run it through chardet or something like that |
22:30:41 | FromDiscord | <auxym> a macro question: how do I generate something like `var s: string` but where `s` is the result of `gensym`? |
22:34:45 | FromDiscord | <Patitotective> In reply to @auxym "a macro question: how": store the result of `gensym` in a variable and use it instead of `nnkIdent("a")` https://nim-lang.org/docs/macros.html#statements-var-section |
22:35:12 | FromDiscord | <Elegantbeef> `newvarStmt` |
22:35:12 | FromDiscord | <Elegantbeef> genast |
22:35:13 | FromDiscord | <Elegantbeef> quote do |
22:41:34 | FromDiscord | <halc> I've been looking at the async sources because I want to finally understand whatever the hell is happening, on one hand, I'm learning a lot, on the other hand, oh god oh fuck I've been jumping between the macros docs and async source for an hour |
22:43:30 | FromDiscord | <Elegantbeef> how hard could generating a closure iterator be π |
22:46:15 | FromDiscord | <! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4aBt |
22:55:57 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4aBv |
22:56:18 | FromDiscord | <auxym> but then expandMacros gives me `var string_436207689 = nil` which isn't really what I want |
22:56:25 | FromDiscord | <Elegantbeef> Of course |
22:56:27 | FromDiscord | <Patitotective> thats what gensym does |
22:56:49 | FromDiscord | <auxym> so how do I get `var string_94u85hgu5n: string` ? |
22:57:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aBx |
22:57:48 | FromDiscord | <Elegantbeef> Whoops missed a `)` |
22:58:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aBy |
22:59:18 | FromDiscord | <auxym> awesome π I do like genast and try to use it whenever possible |
23:01:53 | FromDiscord | <! Nilts> How do i raise an error in nim |
23:02:26 | FromDiscord | <auxym> you mean a runtime exception? https://nim-lang.org/docs/tut2.html#exceptions |
23:02:45 | FromDiscord | <auxym> for a compile-time error use the `{.error.}` pragma |
23:03:24 | FromDiscord | <halc> In reply to @auxym "awesome π I do": for the record, the `std/macros` docs has a neat breakdown of many common types of node https://nim-lang.org/docs/macros.html#statements-var-section |
23:06:28 | FromDiscord | <! Nilts> ok, how to i compare ints |
23:07:25 | FromDiscord | <Patitotective> In reply to @not logged in "How do i raise": `raise newException(Exception, "Message")` |
23:07:33 | FromDiscord | <! Nilts> In reply to @Patitotective "`raise newException(Exception, "Message")`": ox |
23:07:36 | FromDiscord | <! Nilts> (edit) "ox" => "ok" |
23:08:45 | FromDiscord | <auxym> In reply to @halc "for the record, the": thanks. I had seen that, was just confused where gensym fit in |
23:22:35 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzβ¦) |
23:26:15 | FromDiscord | <! Nilts> How would i get the "png" out of `https://mywebsite.com/files/something.png` |
23:26:22 | FromDiscord | <! Nilts> like get the file extention |
23:26:26 | FromDiscord | <! Nilts> im using std/uri |
23:28:31 | FromDiscord | <Elegantbeef> You might be able to use spltifile from os, but it's clearly not proper for more advance urls |
23:29:32 | FromDiscord | <! Nilts> then what do i use |
23:29:33 | FromDiscord | <EyeCon> First `parseUri`, then something like https://nim-lang.org/docs/strutils.html#rsplit%2Cstring%2Cchar%2Cint |
23:29:55 | FromDiscord | <EyeCon> With `.` as separator |
23:30:12 | FromDiscord | <Elegantbeef> That doesnt even work eyecon |
23:30:25 | FromDiscord | <Elegantbeef> You need to rfind `.` then assume the right hand is the extension |
23:30:26 | FromDiscord | <Elegantbeef> then walk until you hit a query symbol |
23:30:40 | FromDiscord | <EyeCon> That's why we are using `parseUri` |
23:30:46 | FromDiscord | <EyeCon> To split the query parts away |
23:31:17 | FromDiscord | <Elegantbeef> Ah yea i'm dumb |
23:31:54 | FromDiscord | <EyeCon> But I think the problem is that the extension as such is not well defined |
23:32:15 | FromDiscord | <! Nilts> In reply to @EyeCon "First `parseUri`, then something": `let suffix = rsplit(parseURi(node_attrs["data-src"]).path, '.', maxsplit=1)`? |
23:32:27 | FromDiscord | <EyeCon> You might find `.com` as the extension when you have `http://example.com` |
23:33:04 | FromDiscord | <! Nilts> In reply to @EyeCon "You might find `.com`": i can guarantee that the url is an image url. |
23:33:06 | FromDiscord | <EyeCon> In reply to @not logged in "`let suffix = rsplit(parseURi(node_attrs["data-src"": Yes, that's what I had in mind, but you have to select `[^1]` from the result as well |
23:33:55 | FromDiscord | <EyeCon> Because `rsplit` gives back left side, separator, then right side AFAICR |
23:36:42 | FromDiscord | <EyeCon> Correction: it doesn't give the separator back |
23:37:03 | FromDiscord | <EyeCon> So left side, right side - and then you'd select the last one |
23:37:22 | FromDiscord | <Elegantbeef> Hmm? |
23:37:28 | FromDiscord | <ElegantBeef> Oh matrix moment |
23:38:23 | FromDiscord | <EyeCon> Ah, the bridge again |
23:38:50 | FromDiscord | <EyeCon> Why not rsplit? |
23:39:13 | FromDiscord | <Elegantbeef> It allocates a sequence when it's not needed |
23:40:14 | FromDiscord | <Elegantbeef> Though that only works if you're certain it's an image path |
23:40:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aBL |
23:58:16 | FromDiscord | <ravinder387> how to create generic tables in nim |
23:58:34 | FromDiscord | <Elegantbeef> Elaborate |
23:58:43 | FromDiscord | <Elegantbeef> Generic how |
23:59:10 | FromDiscord | <ravinder387> {"name" : "peter", "age": 40} |
23:59:47 | FromDiscord | <Elegantbeef> I mean you're using JS so you can just make a table of `string, JSobject` |
23:59:59 | FromDiscord | <Elegantbeef> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark otherwise |