<< 22-05-2024 >>

00:58:43NimEventerNew Nimble package! negl - Nim bindings for EGL, see https://github.com/lualvsil/negl
01:16:53*pmp-p quit (Ping timeout: 240 seconds)
01:16:55*beholders_eye quit (Read error: Connection reset by peer)
01:22:20*beholders_eye joined #nim
01:23:28*beholders_eye quit (Read error: Connection reset by peer)
01:29:04*pmp-p joined #nim
01:29:41*beholders_eye joined #nim
01:41:30FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#pasty=TAZwTNFk
01:46:20*beholders_eye quit (Read error: Connection reset by peer)
01:48:55*disso-peach joined #nim
01:52:01*beholders_eye joined #nim
02:00:00*beholders_eye quit (Read error: Connection reset by peer)
02:05:27*beholders_eye joined #nim
02:15:43*krux02 quit (Remote host closed the connection)
02:17:06*disso-peach quit (Quit: Leaving)
02:20:56*deadmarshal_ quit (Quit: IRCNow and Forever!)
02:43:42*deadmarshal_ joined #nim
02:57:52*def- quit (Quit: -)
03:15:57*def- joined #nim
03:15:59*beholders_eye quit (Ping timeout: 268 seconds)
03:44:18*SchweinDeBurg joined #nim
04:21:38FromDiscord<that_dude.> sent a code paste, see https://play.nim-lang.org/#pasty=lERmahvm
04:31:24FromDiscord<Elegantbeef> The most recent issue is likely caused by needing to capture the `myProc` variable, but the procedure is a nimcall
04:31:29FromDiscord<Elegantbeef> Well sorry `temp`
04:31:32FromDiscord<Elegantbeef> I renamed it in testing 😄
04:34:06FromDiscord<that_dude.> When taking a look at https://github.com/nim-lang/Nim/blob/devel/lib/std/tasks.nim#L113-L129, I do see that there is an explicit check to make sure that the function is not a closure, which means I need to force it to be a nimcall afaik.
04:34:18FromDiscord<Elegantbeef> Right but it emits another procedure
04:34:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=zuoIcnym
04:34:49FromDiscord<Elegantbeef> This is invalid as it's a nimcall that has to capture `temp`
04:35:14FromDiscord<Elegantbeef> The reason it works with top level is global variables have static memory address so no capture is required
04:35:21FromDiscord<that_dude.> So could it be that this is only an issue caused by my first issue?
04:35:53FromDiscord<that_dude.> Because that rename/reassign is a work around for an unexpected type
04:36:43FromDiscord<Elegantbeef> I've not used `std/tasks` so cannot say what's intended behaviour
04:36:54FromDiscord<Elegantbeef> I imagine it's supposed to be safe of memory issues though
04:37:13FromDiscord<that_dude.> I haven't either, but it's what's malebolgia is based on so this is about as minimal as I could make it
04:37:27FromDiscord<Elegantbeef> The first issue is simply the macro does not expect `a.b(...)`
04:37:36FromDiscord<Elegantbeef> If we look at the example ` let b = toTask(hello(Runnable(data: 12)))`
04:37:48FromDiscord<Elegantbeef> Which means it does not expect ` let b = toTask(Runnable(data: 12).hello())`
04:38:00FromDiscord<Elegantbeef> If you make `Store` a ref object it should work
04:38:07FromDiscord<Elegantbeef> Perhaps it'll
04:38:09FromDiscord<Elegantbeef> given the test
04:39:03FromDiscord<Elegantbeef> Actually nope of course that does not solve anything
04:39:18FromDiscord<Elegantbeef> Tasks are supposed to take in parameters and expand into a procedure that takes those
04:40:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ggFpgDJB
04:41:00FromDiscord<that_dude.> Huge
04:41:25FromDiscord<that_dude.> I guess I'm considering whether I should file a bug report on this though
04:41:44FromDiscord<that_dude.> Because this seems kinda roundabout
04:42:17FromDiscord<Elegantbeef> Well the first is a bug
04:42:23FromDiscord<Elegantbeef> The latter is not a bug I'd say
04:42:31FromDiscord<Elegantbeef> Cause `store.bleh()` indeed requires a capture
04:42:45FromDiscord<that_dude.> That's what I was thinking. It just manifested due to my "workaround" of the first bug
04:44:16FromDiscord<that_dude.> Hold on. I really don't want to get this wrong and I'm kinda dense, by first bug you mean the first one I posted not the first one you answered right?
04:44:42FromDiscord<Elegantbeef> The first bug about dotexpr is a bug with the macro
04:44:50FromDiscord<that_dude.> Thanks
05:09:06FromDiscord<Elegantbeef> Well I'd not use the example you used on the github issue, but yea
05:09:23FromDiscord<that_dude.> F
05:09:33FromDiscord<that_dude.> Thought it showed it off ok
05:09:36FromDiscord<Elegantbeef> `Store(run: hello).runner()` shows the issue 😄
05:14:25FromDiscord<that_dude.> Yeah that's fair, Tbh when I posted it I was thinking that not dealing with wraping the whole thing in a function would make it a bit shorter. Probably not worth the effort for 2 lines lol
05:14:42FromDiscord<Elegantbeef> Well plus it brings up the other issue
05:14:49FromDiscord<Elegantbeef> Which is not an issue afaik
05:18:13FromDiscord<that_dude.> Yeah but I thought it isn't an issue when it's in the global scope. In fact I tested that with the tweak you gave and it compiled just fine
05:18:38FromDiscord<Elegantbeef> Oh
05:18:51FromDiscord<Elegantbeef> Oh right that makes sense
05:19:08FromDiscord<Elegantbeef> The `a.b` is turned into `b(a)` but the `a.b()` where `b` is a pointer proc is not
05:19:15FromDiscord<Elegantbeef> So it's the same issue as the latter 😄
05:30:41*def- quit (Quit: -)
05:31:06*def- joined #nim
06:07:17*def- quit (Quit: -)
06:07:34*def- joined #nim
06:12:22*def- quit (Client Quit)
06:30:18*rockcavera quit (Remote host closed the connection)
06:46:46*def- joined #nim
06:58:22*PMunch joined #nim
07:38:57*ntat joined #nim
08:07:41*ntat quit (Quit: leaving)
08:32:02*flynn joined #nim
08:58:19*SEP_ joined #nim
08:58:45*Onionhammer5 joined #nim
08:58:59*Goodbye_Vincent2 joined #nim
08:59:41*def-- joined #nim
09:01:01*anddam_ joined #nim
09:01:12*Jjp137 quit (Ping timeout: 268 seconds)
09:01:13*Goodbye_Vincent quit (Read error: Connection reset by peer)
09:01:13*def- quit (Write error: Connection reset by peer)
09:01:14*Onionhammer quit (Read error: Connection reset by peer)
09:01:15*anddam quit (Ping timeout: 268 seconds)
09:01:16*Goodbye_Vincent2 is now known as Goodbye_Vincent
09:01:16*Onionhammer5 is now known as Onionhammer
09:01:20*SEP quit (Ping timeout: 268 seconds)
09:01:23*def-- is now known as def-
09:04:40NimEventerNew thread by pietroppeter: Upcoming "Nim for Pythonistas" talk at PyCon Italy, see https://forum.nim-lang.org/t/11630
09:08:56FromDiscord<nocturn9x> hello folks
09:09:50FromDiscord<nocturn9x> what would be the best way to profile a nim application? nimprof is outdated af and I tried using `perf` with `--passC:"-g -fno-omit-frame-pointer` and while that works, it's a little tricky to figure out exactly what's going on in some cases, especially libc calls
09:10:31FromDiscord<nocturn9x> My suspects is that I'm stupid and forgot that I'm passing around some value type which is getting copied over and over, as I noticed a bunch of very long running calls to NimCopyMem, but can't figure out exactly what the source of those is
09:11:36FromDiscord<Clonkk> https://github.com/treeform/hottie ?↵(@nocturn9x)
09:11:55FromDiscord<nocturn9x> thanks! will check it out
09:13:21FromDiscord<Clonkk> If it's more benchmark related you have https://github.com/treeform/benchy
09:13:22FromDiscord<Clonkk> Otherwise if you jsut want to time stuff https://github.com/clonkk/timelog↵(@nocturn9x)
09:13:40FromDiscord<nocturn9x> seems like there's plenty of options :)
09:13:44FromDiscord<nocturn9x> but hottie sounds like what I need
09:13:48FromDiscord<nocturn9x> I'm interested in hot code paths
09:13:57FromDiscord<Clonkk> With timelog the API can hide the timing operation behind a `define` so you don't have ti change code, just need a compile time switch to enable / disable it
09:14:05FromDiscord<nocturn9x> I see
09:14:09FromDiscord<Clonkk> Then hottie yes↵(@nocturn9x)
09:14:32FromDiscord<Clonkk> timelog is just to time different stuff, it's not profiling it's more "measuring execution time" in your code
09:14:41FromDiscord<Clonkk> And benchy is a benchmark library
09:15:17FromDiscord<nocturn9x> gotcha!
09:15:21FromDiscord<nocturn9x> thanks a lot :)
09:15:32FromDiscord<Elegantbeef> I just use hotspot
09:15:36FromDiscord<Elegantbeef> Built on perf and works well
09:16:00FromDiscord<Elegantbeef> `--debugger:native` is important when debugging
09:18:14FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=rkftPiQS
09:18:20FromDiscord<nocturn9x> rip, not terribly useful
09:22:23FromDiscord<Phil> My money is on heaptrack, iirc they can also make/display flamegraphs
09:24:36FromDiscord<nocturn9x> perf isn't terribly useful either https://media.discordapp.net/attachments/371759389889003532/1242770073278480394/image.png?ex=664f0b53&is=664db9d3&hm=b98b9353a35cabccab9ba442915a9206683b8dc6f21a7af6402abdc7bd7b3759&
09:24:40FromDiscord<nocturn9x> lots of stuff is just "unknown"
09:25:48FromDiscord<odexine> well do you compile with --debugger:native as mentioned
09:28:13FromDiscord<nocturn9x> I am
09:28:18FromDiscord<nocturn9x> at least now it shows the relevant nim code
09:29:26FromDiscord<odexine> oh youre looking at libc
09:29:29FromDiscord<nocturn9x> if I sort an open array, that should create a view right
09:35:47FromDiscord<nocturn9x> I don't understand all this time being spent in libc https://media.discordapp.net/attachments/371759389889003532/1242772893243543553/image.png?ex=664f0df3&is=664dbc73&hm=1a04f0fbe30fdc2f121766655b8ba0eb7be432d5971c40e91ab3564759154b64&
09:36:05FromDiscord<nocturn9x> like a good 30% is just libc calls
09:36:12FromDiscord<nocturn9x> and I can't inspect those
09:38:01FromDiscord<odexine> install the debug symbols of libc maybe https://wiki.archlinux.org/title/Debuginfod
09:38:09FromDiscord<Clonkk> memcpy calls maybe ?↵(@nocturn9x)
09:38:27FromDiscord<nocturn9x> yes, okay, but how do I know which ones are supposed to be there
09:39:19FromDiscord<Phil> Flamegraphs
09:39:30FromDiscord<nocturn9x> how do I make on
09:39:32FromDiscord<nocturn9x> (edit) "on" => "one"
09:39:32FromDiscord<Phil> You really, really want flamegraphs
09:39:37*flynn quit (Quit: The Lounge - https://thelounge.chat)
09:40:54FromDiscord<Phil> I googled it back in the day, don't have the articles anymore tbh
09:40:55*flynn joined #nim
09:47:23FromDiscord<nocturn9x> can someone explain what eqcopy is and what it's doing? https://media.discordapp.net/attachments/371759389889003532/1242775810729840691/image.png?ex=664f10aa&is=664dbf2a&hm=b519f40180bd3c2e9453edcbf666d159d41c956c5bbc02cb36484cc1ee30850b&
09:47:35FromDiscord<nocturn9x> cuz it's eating up 30% of the runtime
09:49:16FromDiscord<odexine> eqcopy is `=copy`
09:49:27FromDiscord<odexine> you're copying data a lot
09:49:53FromDiscord<nocturn9x> well I'm using a copymake for my chessboard which makes sense, but _30%_?
09:50:02*deadmarshal_ quit (Remote host closed the connection)
09:50:02FromDiscord<nocturn9x> Is there a way to inspect the places where it is used
09:50:34FromDiscord<odexine> your searchmanager is being copied a lot
09:50:49FromDiscord<odexine> check where you use this type
09:53:57FromDiscord<nocturn9x> BRUH
09:53:59FromDiscord<nocturn9x> that was it.
09:54:55FromDiscord<nocturn9x> from 230k nodes per second to 700k
09:58:13FromDiscord<Phil> Changed a value type to a ref type?
10:01:33FromDiscord<nocturn9x> yes...
10:01:38FromDiscord<nocturn9x> oof me
10:06:22*deadmarshal_ joined #nim
10:17:02FromDiscord<frusadev> Hello! Can someone explain this to me ? note: parser.ConfigTypes is enum https://media.discordapp.net/attachments/371759389889003532/1242783271126040576/Screenshot_from_2024-05-22_10-15-08.png?ex=664f179d&is=664dc61d&hm=b85e1ccd58e65a99cb98b810d7ddf1df69df15b4cdde7a1b2dced313f94f1e82&
10:17:31FromDiscord<Phil> And this is why sometimes ref types are valid when objects get large or are often used 😄
10:19:59FromDiscord<frusadev> Can't i use enums inside of tables ?
10:26:26FromDiscord<nocturn9x> In reply to @isofruit "And this is why": yeah haha
10:26:32FromDiscord<nocturn9x> almost a 3x speedup
10:26:35FromDiscord<nocturn9x> actually bonkers
10:27:53FromDiscord<odexine> In reply to @frusadev "Can't i use enums": You can
10:28:29FromDiscord<odexine> In reply to @frusadev "Hello! Can someone explain": Does it compile nonetheless?
10:30:39FromDiscord<frusadev> In reply to @odexine "Does it compile nonetheless?": It compiles !
10:31:20FromDiscord<frusadev> So is this a bug from nimsuggest ?
10:31:33FromDiscord<nnsee> yes
10:31:49FromDiscord<nnsee> reloading nimsuggest might help
10:32:11FromDiscord<frusadev> In reply to @nnsee "reloading nimsuggest might help": Okay, Thanks
10:38:45*anddam_ is now known as anddam
11:08:52*Jjp137 joined #nim
11:14:05*PMunch quit (Quit: Leaving)
11:19:46*krux02 joined #nim
11:19:55*PMunch joined #nim
11:21:31*ntat joined #nim
11:46:58*beholders_eye joined #nim
12:04:09FromDiscord<Robyn [She/Her]> I wonder how hard it'd be to create a program that generates idiomatic Nim bindings to Python libraries
12:04:26FromDiscord<Robyn [She/Her]> Obviously Nimpy exists but you still need to create typesafe wrappers on top of that
12:10:01*beholders_eye quit (Ping timeout: 268 seconds)
12:18:48*krux02 quit (Remote host closed the connection)
12:31:11*rockcavera joined #nim
12:38:42FromDiscord<ShalokShalom> Is there a construct in Nim, that I can compile towards the semantics of multiple dispatched functions?
12:39:32FromDiscord<ShalokShalom> If I want to create a transpiler towards Nim
12:49:46NimEventerNew Nimble package! rng - Basic wrapper over std/sysrand, see https://github.com/penguinite/rng
12:50:19*beholders_eye joined #nim
12:55:48FromDiscord<nnsee> oh my https://github.com/penguinite/rng/blob/main/src/rng.nim#L42
13:03:38*def- quit (Quit: -)
13:03:55*def- joined #nim
13:10:43*disso-peach joined #nim
13:13:49*def- quit (Quit: -)
13:14:05*def- joined #nim
13:17:02strogon14Robyn: https://github.com/treeform/genny
13:27:38FromDiscord<Robyn [She/Her]> In reply to @NimEventer "New Nimble package! rng": Why-
13:37:35*beholders_eye quit (Ping timeout: 268 seconds)
13:42:17*def- quit (Quit: -)
13:42:34*def- joined #nim
13:52:00FromDiscord<nocturn9x> question
13:52:14FromDiscord<nocturn9x> I have a `seq[SearchManager]` inside my search manager object
13:52:17FromDiscord<nocturn9x> (it's a ref)
13:52:27FromDiscord<nocturn9x> I store them so I can collect statistics on all worker threads when logging
13:52:56FromDiscord<nocturn9x> when I iterate that seq I get `lent SearchManager`, which makes sense, but if I try to call, say, `child.stop()` it fails with a type error
13:53:15FromDiscord<nocturn9x> `.mitems()` yields `var SearchManager` objects instead so that's no good either
13:53:27FromDiscord<nocturn9x> do I have to redefine certain procedures to take `lent SearchManager`?
13:54:54FromDiscord<Robyn [She/Her]> In reply to @strogon14 "Robyn: https://github.com/treeform/genny": That's Nim -> Python
13:54:55FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=uCMtrANO
13:55:22FromDiscord<Robyn [She/Her]> I want Python -> Nim
13:55:31FromDiscord<nocturn9x> nimpy
13:55:37FromDiscord<nocturn9x> doesn't it work both ways
13:55:41FromDiscord<nocturn9x> or maybe you want nimporter
13:58:13FromDiscord<juancarlospaco> In reply to @chronos.vitaqua "Obviously Nimpy exists but": https://github.com/juancarlospaco/cpython (?)
14:00:10FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=sYiylYxr
14:00:11FromDiscord<nocturn9x> wtf
14:00:25strogon14Robyn: oh, sorry, I misread.
14:03:56FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=ilbiMHxS
14:03:58FromDiscord<nocturn9x> tf does this mean?
14:04:04FromDiscord<nocturn9x> self is just `self: SearchManager`
14:04:11FromDiscord<nocturn9x> why does it thinks it's an object type lol
14:05:12*beholders_eye joined #nim
14:08:31FromDiscord<solitudesf> sent a code paste, see https://play.nim-lang.org/#pasty=yKNAWgXE
14:08:58FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=Seidejhx
14:13:28NimEventerNew thread by giuliano: "fall-through" and default values, see https://forum.nim-lang.org/t/11633
14:16:59*PMunch quit (Quit: Leaving)
14:18:55FromDiscord<solitudesf> sent a code paste, see https://play.nim-lang.org/#pasty=zZUfxVpa
14:19:05FromDiscord<nocturn9x> _ohhh_
14:19:12FromDiscord<nocturn9x> mah bad!
14:20:47*wheatengineer joined #nim
14:21:07FromDiscord<Robyn [She/Her]> In reply to @juancarlospaco "https://github.com/juancarlospaco/cpython (?)": I was thinking of a Python script that automatically wrapped a Python module into a Nim module, for example, the `yfinance` package for Python
14:21:19FromDiscord<Robyn [She/Her]> In reply to @strogon14 "Robyn: oh, sorry, I": No worries!
14:36:51*wheatengineer quit (Quit: Leaving)
14:57:17*beholders_eye quit (Ping timeout: 240 seconds)
15:06:01*ntat quit (Quit: Leaving)
15:21:59*ntat joined #nim
15:29:51*SEP_ quit (Ping timeout: 256 seconds)
15:31:58*SEP joined #nim
15:41:09*def- quit (Quit: -)
15:41:52*def- joined #nim
15:47:00*def- quit (Quit: -)
15:47:11*def- joined #nim
15:56:53FromDiscord<dlesnoff> Hello! Is the cairo Nim wrapper still working?↵I try to run the first code snippet but I do not understand what ctx is.
15:57:24FromDiscord<dlesnoff> sent a long message, see https://pasty.ee/EOylAuZk
15:57:50FromDiscord<dlesnoff> (edit) "long message," => "code paste," | "https://pasty.ee/LgWehftp" => "https://play.nim-lang.org/#pasty=mJAidDyB"
15:58:44FromDiscord<dlesnoff> I am trying to plot an hexagonal grid, so any other plot library would be great too
16:03:43*beholders_eye joined #nim
16:09:49FromDiscord<polylokh_39446> dunno what the point is of that incomplete example
16:09:57FromDiscord<polylokh_39446> it's from <https://github.com/nim-lang/cairo/blob/master/tests/arc.nim> which defines ctx
16:12:32*gst joined #nim
16:35:59FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#pasty=WkWzDAMv
16:36:26*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
16:36:41*SchweinDeBurg joined #nim
16:40:20FromDiscord<dlesnoff> https://media.discordapp.net/attachments/371759389889003532/1242879732408782868/hexagonal_grid.png?ex=664f7173&is=664e1ff3&hm=ebe08e0538c38689c929bfef5bc452ae5ac77d761be2d8b2113bbcc16b82ba76&
16:51:50*gst quit (Quit: Client closed)
17:01:04*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
18:28:25*def- quit (Quit: -)
18:28:46*def- joined #nim
18:32:01*def- quit (Client Quit)
18:32:31*def- joined #nim
19:22:53*ntat quit (Quit: Leaving)
19:29:38*disso-peach quit (Quit: Leaving)
19:53:01FromDiscord<fenilli> sent a code paste, see https://play.nim-lang.org/#pasty=QyTeqfjG
19:54:08FromDiscord<fenilli> sent a code paste, see https://play.nim-lang.org/#pasty=HANdbApT
19:54:45FromDiscord<fenilli> If I read correctly NodeConcept should be a type that checks if Player has the valid procs there? is that incorrect?
19:56:00FromDiscord<Elegantbeef> Concepts are type constraints not concrete types
19:56:18FromDiscord<Elegantbeef> As such `array[1, NodeConcept]` is invalid since there is no runtime `NodeConcept`
19:56:39FromDiscord<Elegantbeef> Not to mention your usage of `load(nc)` is wrong
19:56:53FromDiscord<Elegantbeef> cause that expects `nc.load(nc)`
19:57:12FromDiscord<Elegantbeef> `load(nc)` is if there was a static `load(player)`
19:59:39FromDiscord<fenilli> oh I see I get the first point, the second I didn't, you mean that `concept ref nc load(nc)` should be what? `concept ref nc nc.load()`?
20:00:03FromDiscord<fenilli> well the first point was the biggest " think I need this "
20:00:09FromDiscord<fenilli> but oh well black to the drawing board.
20:00:14FromDiscord<fenilli> (edit) "black" => "back"
20:00:55FromDiscord<fenilli> I really wanted a generic way to have a seq of conceptable items, maybe a tuple would work?
20:01:50FromDiscord<fenilli> sent a code paste, see https://play.nim-lang.org/#pasty=OTNvuxNE
20:03:44FromDiscord<fenilli> the reason being I wanted `seq` to be able to accept `Player, Monster, Floor` any entity, so later I could just do `for e in entities: e.draw()` or something.
20:05:38FromDiscord<griffith1deadly> then u need use inheritance `ref object`s
20:05:51FromDiscord<fenilli> yeh that is the point i'm almost always getting
20:06:03FromDiscord<fenilli> but didn't want to use inheritance at all, wanted to follow composition.
20:07:12FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#pasty=rXUIPpYB
20:08:58FromDiscord<fenilli> that gives a hard constraint as if you add a new entity you need to make sure to update any and all intances of a contraint.
20:09:11FromDiscord<fenilli> and if you have like 100's of entity types
20:09:16FromDiscord<fenilli> imagine that draw proc.
20:20:31FromDiscord<Elegantbeef> Nim does not have shape based runtime polymorphism so if you want that you need to either use macros like traitor or do it manually
20:29:56FromDiscord<Elegantbeef> Here is how you manually box using the same logic as traitor https://play.nim-lang.org/#pasty=kcLyBXIK 😄
20:35:46FromDiscord<Elegantbeef> @fenilli ^
20:46:48FromDiscord<fenilli> looks good, will take a look.
20:47:34FromDiscord<fenilli> well at that case you're not using the node nor concepts, but inhertance no?
20:48:09FromDiscord<fenilli> I guess internally tho
20:48:45FromDiscord<Elegantbeef> Add `T: NodeConcept` to the `new` proc
20:49:08FromDiscord<Elegantbeef> You need type erasure to do what you want
20:49:17FromDiscord<Elegantbeef> As such you need inheritance or some other mechanism to type erase
20:49:19FromDiscord<fenilli> wel at that point it is not useful, the way you did looks fine without it no?
20:49:27FromDiscord<Elegantbeef> `ref T` gives us a nice type erasure
20:49:44FromDiscord<Elegantbeef> Well it's useful in that it gives you a type error when you attempt to do `Entity.new 10`
20:50:04FromDiscord<fenilli> I see
20:50:25FromDiscord<fenilli> will need to take a good look at it
20:50:32FromDiscord<fenilli> there are some keywords that I don't knwo about yet.
20:50:46FromDiscord<Elegantbeef> I still just say traitor but it's a dependency and uses macros
20:50:53FromDiscord<Elegantbeef> Both of which are less desirable I guess
20:51:38FromDiscord<fenilli> I could use it, but wanted to have the least amout of dependencies possible.
20:52:46FromDiscord<fenilli> sent a code paste, see https://play.nim-lang.org/#pasty=fRhjcVgE
20:53:08FromDiscord<Elegantbeef> It's not inheritance
20:53:10FromDiscord<Elegantbeef> It does the above
20:53:15FromDiscord<Elegantbeef> Which is not inheritance it's a type erasure
20:53:39FromDiscord<Elegantbeef> It just uses inheritance as it's the only mechanism that Nim has to type erase with data
20:53:50FromDiscord<fenilli> oh I see
20:54:15FromDiscord<fenilli> in that case would be better to just use a single level of inheritance instead and deal with the ugly `object of RootObj`
20:54:57FromDiscord<Elegantbeef> The overloaded is not inheritance anyway
20:54:57FromDiscord<Elegantbeef> The overloaded enables you to do `myTrait.overload()` and `myTrait.overload(10)`
20:55:17FromDiscord<Elegantbeef> Well you need type erasure for runtime polymorphism
20:55:32FromDiscord<Elegantbeef> So you need atleast 1 level deep
20:55:45FromDiscord<fenilli> I guess that makes sense
20:56:07FromDiscord<fenilli> was thinking in line with how implements work in other languages, but never thought in that way.
20:57:05FromDiscord<Elegantbeef> Well this is practically how C# classes work, they have a vtable though so the references store a integer in that table
20:57:24FromDiscord<Elegantbeef> When you do `Base.someProc(...)` it looks up the vtable for the instances proc then invokes that
20:58:46FromDiscord<fenilli> Well I was thinking more in the line of `Player | Monster | Floor` in TS, but with a interface, as in not implementation, just type check if its part of, I guess almost like a type alias.
20:58:51FromDiscord<Elegantbeef> Not like C#, Rust, or C++ really have a way to statically compose types together to make a union without boxing
20:59:04FromDiscord<Elegantbeef> Right that's a object variant in Nim
20:59:37FromDiscord<fenilli> yeh tried using that, but the syntax and the way it works is not really easy to deal with.
20:59:42FromDiscord<Elegantbeef> https://github.com/alaviss/union does work for anonymous unions
20:59:54FromDiscord<fenilli> as you have to almost for certain delay imports for that case.
21:00:13FromDiscord<Elegantbeef> Oh noes
21:00:31FromDiscord<fenilli> and neither can it be dynamic allocated as in, you need to add to the object variant to make sure it knows the type beforehand
21:01:10FromDiscord<fenilli> but the biggest pet peave there is having to have a var to keep the value in the type and not having a way to instantiate a type of itself, but from somewhere else.
21:01:22FromDiscord<fenilli> but I guess i'm to accostumed with dynamic languages
21:01:35FromDiscord<fenilli> need to learn how a static typed one work and deal with it lol
21:02:21FromDiscord<fenilli> now that I think about it, all objects in other dynamic languages have inheritance by default anyways from a master object
21:02:27FromDiscord<fenilli> and that is why array and seq work.
21:02:41FromDiscord<fenilli> now I feel stupid lol
21:06:46FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=JBdClbyK
21:06:58FromDiscord<Elegantbeef> Cause floats are floats
21:07:33FromDiscord<Elegantbeef> There is no `99.51` in a 64bit float that is `99.51000000000001`
21:08:28FromDiscord<Elegantbeef> Use string formatting instead of attempting to round decimals away
21:08:58FromDiscord<nnsee> In reply to @user2m "why does round(99.51000000000001,2) not": https://0.30000000000000004.com/
21:10:00FromDiscord<juancarlospaco> "You'll float too"
21:11:29*def- quit (Quit: -)
21:11:40*def- joined #nim
21:17:16FromDiscord<user2m> sent a code paste, see https://paste.rs/qIWLl
21:17:28FromDiscord<user2m> (edit) "https://paste.rs/dMNWT" => "https://play.nim-lang.org/#pasty=CrtNLXBB"
21:17:48FromDiscord<user2m> is there a parseFloat that doesn't return a float64?
21:18:13FromDiscord<Elegantbeef> Just convert it to 32bit float after parsing
21:19:11FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=QibpmyVc
21:19:42FromDiscord<Elegantbeef> What are you even doing
21:19:49FromDiscord<Elegantbeef> Cause what you're doing is likely the wrong way to do anything
21:20:57FromDiscord<user2m> In reply to @Elegantbeef "What are you even": LOL most likely yes. I have a float64 -99.51000000000001 which I'm trying to only get the last 2 places -99.51000000000001 -> -99.51
21:21:50FromDiscord<Elegantbeef> So use string formatting
21:22:06FromDiscord<Elegantbeef> https://nim-lang.org/docs/strutils.html#formatFloat%2Cfloat%2CFloatFormatMode%2Crange%5B%5D%2Cchar
21:22:22FromDiscord<Elegantbeef> `myFloat.formatFloat(ffDecimal, 2)`
21:22:30FromDiscord<Elegantbeef> There you go you now have 2 decimal points
21:23:25FromDiscord<albassort> hello so I just saw some cursed shit in c
21:23:47FromDiscord<albassort> is there anyway I can make a fixed length array that is a type and functions as a buffer
21:23:59FromDiscord<albassort> (edit) "is there anyway I can make a fixed length array that is ... a" added "also" | removed "and functions as a buffer"
21:24:23FromDiscord<Elegantbeef> Yes Nim has `static T` generic parameters
21:25:00FromDiscord<albassort> can i define say foo as a uint16 union of indice 2 to 3
21:25:27FromDiscord<albassort> if so, is it a good and readable idea?
21:27:45FromDiscord<Elegantbeef> If only you spoke plain english
21:27:58FromDiscord<albassort> beef y u so mean to me
21:28:05FromDiscord<albassort> im writing in psudo-code
21:28:19FromDiscord<Elegantbeef> Cause I could not understand what you said
21:28:34FromDiscord<Elegantbeef> "uint16 union of indices 2 to 3".... what
21:29:06FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=xUYNTcFa
21:29:59FromDiscord<Elegantbeef> How does that make sense?
21:30:06FromDiscord<albassort> heres its implementation in C
21:30:20FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=hhIkbwzm
21:30:24FromDiscord<albassort> its a packed struct
21:30:37FromDiscord<Elegantbeef> You know Nim has C unions and packed structs
21:30:44FromDiscord<albassort> i didn't know
21:31:27FromDiscord<albassort> can you perhaps point me into the right direction ?
21:31:55FromDiscord<Elegantbeef> Search `packed` and `union` on the manual
21:32:58FromDiscord<albassort> i dont think i can used {.packed.} as a buffer
21:33:01FromDiscord<albassort> (edit) "a buffer" => "an array"
21:33:19FromDiscord<Elegantbeef> Arrays are packed
21:33:37FromDiscord<albassort> i meant as a type declared as {.packed.}
21:33:53FromDiscord<albassort> wait
21:33:55FromDiscord<albassort> i can use copymem
21:34:05FromDiscord<Elegantbeef> If only the issue made sense
21:34:19FromDiscord<albassort> beef, if the issue made sense i'd probably figure it out myself
21:38:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=QBVmXmGt
21:38:45FromDiscord<Elegantbeef> No?
22:43:50FromDiscord<albassort> welp guess i gotta make my own socks5 server nobody can make shit
22:57:57*def- quit (Quit: -)
22:58:45*def- joined #nim
23:27:00FromDiscord<Robyn [She/Her]> https://github.com/treeform/genny#why-add-nim-binding-support-for-a-nim-library hm.... So, I could do some work with this to make the Nim compiler a DLL? /j
23:27:05FromDiscord<Robyn [She/Her]> (edit) "/j" => "/hj"
23:27:56FromDiscord<Elegantbeef> https://github.com/beef331/nimscripter/blob/dll/src/nimscripter/nimscr.nim i mean
23:28:19FromDiscord<Elegantbeef> https://github.com/beef331/nimscripter/blob/dll/tests/lib/nimscr.h
23:29:34FromDiscord<Robyn [She/Her]> Yeah that's a fair point, Nimscripter exists :P
23:29:59FromDiscord<Elegantbeef> If you learn to read you'll see that is a dynamically linked version of nimscripter
23:30:54FromDiscord<Robyn [She/Her]> Yeah I know, I was saying Nimscripter does that
23:31:39*SchweinDeBurg joined #nim
23:35:22*redj quit (Ping timeout: 256 seconds)
23:36:01*redj joined #nim
23:39:02*def- quit (Quit: -)
23:39:13*def- joined #nim