<< 15-09-2022 >>

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