<< 16-10-2021 >>

00:45:45FromDiscord<geekrelief> @ElegantBeef I'm checking out nimscripter again. I haven't touched it since I started working on my TM binding. But I went back after pulling nim devel and compiling your example for drawim https://play.nim-lang.org/#ix=3Az7, and I'm getting an error: `invalid pragma exportToScript: drawim`. I pulled nimscripter and it looks like the pragma is gone (except for the readme and tests)? Do you have an updated sample?
00:46:05FromDiscord<Elegantbeef> Yea i've decided the pragma was too invasive
00:46:25FromDiscord<geekrelief> ok
00:46:30FromDiscord<geekrelief> so what's the new plan?
00:46:31FromDiscord<geekrelief> 🙂
00:46:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3BS8
00:46:52FromDiscord<Elegantbeef> I have update version somewhere
00:46:55FromDiscord<geekrelief> oh I see
00:47:26FromDiscord<geekrelief> btw, I just learned about `lienientops` today from the NimNuggets thread, I was wondering if that would help with the overloading issue.
00:48:10FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3BS9
00:48:41FromDiscord<Elegantbeef> Well i solved some overloading
00:49:19FromDiscord<Elegantbeef> like `circle(a, b, c: float or int)` will emit `circle321321(a, b, c: float)` and `circle321322(a, b, c: int)`
00:49:55FromDiscord<geekrelief> cool, the example compiled except `time` was declared
00:50:22FromDiscord<geekrelief> I guess the warnings are expected too?
00:52:18FromDiscord<Elegantbeef> Yea i'll cast gcsafe eventually
00:53:06FromDiscord<geekrelief> nice, alright I'm going to see how this plays with TM 🙂 Here's my binding if you or anyone is interested https://github.com/geekrelief/tm-nim
00:53:11FromDiscord<Elegantbeef> So things like `time` emit a template on the nimscript side so you can do `time` instead of `time()` 🙂
00:53:25FromDiscord<Elegantbeef> `time` being a global variable
00:55:56FromDiscord<geekrelief> In reply to @Elegantbeef "So things like `time`": What's `time` on the nim side? When I compiled your example, I had to comment it out.
01:00:13FromDiscord<geekrelief> hmm so if I make `time` a `var` I can access it, but it's immutable. Is there a way to export mutable values?
01:00:43FromDiscord<Elegantbeef> Not yet
01:04:43FromDiscord<Elegantbeef> It might be possible to do
01:06:24FromDiscord<geekrelief> no worries, using a 2 procs to set and get will do for now
02:06:40*notchris quit (Ping timeout: 252 seconds)
02:08:46*robertmeta quit (Ping timeout: 268 seconds)
02:10:51*robertmeta joined #nim
02:23:05*notchris joined #nim
02:24:30nrds<Prestige99> Elegantbeef: If you have a min or two, could you look at what I posted above? I'm curious if this is a bug, or if it's actually my fault...
02:24:48FromDiscord<Elegantbeef> Give me one moment and i will
02:24:52nrds<Prestige99> I tried recreating it with a minimal example, but my examples all work 🤔
02:24:55nrds<Prestige99> Thanks
02:26:09FromDiscord<Elegantbeef> Where is the add issue at?
02:26:31nrds<Prestige99> the addchild part? 1 sec
02:26:45nrds<Prestige99> https://git.einheit.tech/EinheitTechnologies/shade/src/branch/example/platformer/examples/platformer/king.nim#L82
02:27:10nrds<Prestige99> If I comment out those two lines, I can echo repr player[].addr
02:27:30nrds<Prestige99> in https://git.einheit.tech/EinheitTechnologies/shade/src/branch/example/platformer/examples/platformer/platformer_example.nim
02:29:07FromDiscord<Elegantbeef> Guess i should clone this to test it
02:29:43nrds<Prestige99> There are some reqs - sdl, sdl_mixer, sdl_gpu, and chipmunk (v7)
02:30:15nrds<Prestige99> If you're on arch they're all in the repos except sdl_gpu, iirc
02:30:36nrds<Prestige99> https://git.einheit.tech/EinheitTechnologies/shade/src/branch/example/platformer#setting-up-sdl_gpu
02:30:42FromDiscord<Elegantbeef> look at this guy assuming everyone runs arch
02:30:52nrds<Prestige99> I thought you did for some reason :P
02:31:44FromDiscord<Elegantbeef> Nah i'm an ubuntu derived heathen
02:33:09nrds<Prestige99> good enough ;P
02:34:22FromDiscord<Elegantbeef> You dont have vmath in the deps
02:34:45nrds<Prestige99> hmm oh right, I think that was with pixie but I stopped using pixie
02:35:16FromDiscord<Elegantbeef> Uhh `Error: type mismatch: got 'proc (this: Task, deltaTime: float){.closure.}' for 'onUpdate' but expected 'proc (this: Node, deltaTime: float){.closure.}`
02:35:29FromDiscord<Elegantbeef> Is that branch up to date?
02:35:34nrds<Prestige99> Yep
02:36:00nrds<Prestige99> If you just add `echo repr player[].addr` in platformer_example.nim you should see the error
02:36:25FromDiscord<Elegantbeef> Is this compiler error expected?
02:37:03nrds<Prestige99> Which error are you seeing? I get a runtime error about illegal storage access
02:37:22FromDiscord<Elegantbeef> I pasted the error a couple messages ago
02:37:39FromDiscord<Elegantbeef> The type mismatch due to `Task` and `Node` not matching
02:37:42nrds<Prestige99> oh - weird
02:37:45*arkurious quit (Quit: Leaving)
02:37:57FromDiscord<Elegantbeef> Ah was due to being on devel apparently
02:38:01FromDiscord<Elegantbeef> Rather 1.6.0
02:38:09nrds<Prestige99> oh ok
02:38:13nrds<Prestige99> yeah I'm on stable
02:38:27nrds<Prestige99> and the example/platformer branch
02:39:05FromDiscord<Elegantbeef> "failed to load image"
02:39:42nrds<Prestige99> try `nimble platformer` from the project directory
02:39:57FromDiscord<Elegantbeef> Ah didnt realize you had that setup
02:40:02FromDiscord<Elegantbeef> Yea got the proper nil error
02:40:12nrds<Prestige99> \o/
02:40:25FromDiscord<Elegantbeef> Now to see the culprit
02:41:28nrds<Prestige99> It somehow has something to do with the node's children..
02:55:18FromDiscord<Elegantbeef> You're code is fine just the reprv1 impl that has an issue
02:55:21FromDiscord<Elegantbeef> your code even
02:56:59FromDiscord<Elegantbeef> The node is assumed to not be nil but somehow it's getting nil, line 195 in compiler/repr.nim
02:57:40nrds<Prestige99> dang it
02:57:46nrds<Prestige99> was hoping it was my fault
02:57:47FromDiscord<Elegantbeef> you dont even need to do the `player[].addr.repr` `repr(player)` hits the same bug
02:58:02FromDiscord<Elegantbeef> Well eitherway there isnt a big issue here
03:02:27FromDiscord<Elegantbeef> Ah somewhere the kind of a nimnode is invalidly set
03:04:53*rockcavera quit (Remote host closed the connection)
03:06:00nrds<Prestige99> So need to patch the compiler eh?
03:06:30FromDiscord<Elegantbeef> Something is indeed off
03:07:38FromDiscord<Elegantbeef> Well it's not compiler since it's the system module
03:08:19FromDiscord<Elegantbeef> So you have two avenues to fix it either fix the bad generated code passed or fix the cause 😛
03:10:21nrds<Prestige99> Not sure how to fix it other than fixing the system module
03:11:40FromDiscord<Elegantbeef> Something is really off though
03:14:00nrds<Prestige99> Yeah..
03:16:36FromDiscord<Elegantbeef> Yea i tried to just change the stdlib and no cigar
03:16:41FromDiscord<Elegantbeef> So need to fix the compiler for repr
03:16:57FromDiscord<Elegantbeef> reprv2 didnt like your code
03:22:21nrds<Prestige99> Hmm I wonder why
03:57:09nrds<Prestige99> using --gc:arc or orc give a different error at least
03:57:29nrds<Prestige99> expression cannot be cast to pointer
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
04:41:00FromDiscord<retkid> is there a library for imperial measurements
04:41:10FromDiscord<retkid> 1 quart / 1 tablespoon
04:41:18FromDiscord<retkid> lol
04:48:31nrds<Prestige99> @Elegantbeef if you have any idea of where I should look to repair this I'd appreciate it, could start looking into it tomorrow... if not, I'll start with repr_v2
05:02:16*Pyautogui joined #nim
05:14:01FromDiscord<ElegantBeef> Look at the VM's magic and see where it get stuff is what i'd suggest
05:14:21FromDiscord<ElegantBeef> For some reason the values got are incorrect for some values it gets some odd enum value
05:15:35nrds<Prestige99> Hmm okay. I've never poked around in that code, but I'll see what I can find out
05:16:50*Pyautogui quit (Ping timeout: 265 seconds)
05:17:45nrds<Prestige99> Hopefully it's an easy fix, and I can get back to my project
05:18:30FromDiscord<ElegantBeef> I couldnt get a repro to work so yea that makes it harder
05:18:36FromDiscord<ElegantBeef> Minimizing it is the key to resolving it imo
05:19:07FromDiscord<ElegantBeef> I think there is a chance it's having a proc named `children` and `children: seq[Node]`
05:19:12nrds<Prestige99> I'll keep stripping down my code to make it as minimal as possible
05:19:23nrds<Prestige99> Good thinking
06:07:45nrds<Prestige99> Renaming it didn't seem to change any behavior
06:15:22FromDiscord<codic> is it at all possible to take the address of a rvalue? like `abc [5].unsafeAddr`, I want to deal with C apis that take multi-item pointers for parameter packs and I don't want to hoist the parameters for each call into a separate array
06:21:10FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3BTa
06:21:17FromDiscord<codic> (edit) "https://play.nim-lang.org/#ix=3BTa" => "https://play.nim-lang.org/#ix=3BTb"
06:38:15FromDiscord<Elegantbeef> It works fine https://play.nim-lang.org/#ix=3BTd
06:40:46FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3BTf for an "openarray" solution
06:41:13FromDiscord<Elegantbeef> @codic\: if i can guess your issue you arent converting to an open array and as such it'd need to convert to open array then to pointer
06:42:31FromDiscord<codic> ah, the conversion to openArray is not implicit in a converter here I guess
06:42:38FromDiscord<codic> sure, then I'll use that, thanks
06:43:07FromDiscord<Elegantbeef> openarray's conversions are often disappointing
06:43:20FromDiscord<Elegantbeef> Make a typeclass and you instantly lose auto converting
06:52:41nrds<Prestige99> Aha, it has to do with c interop
06:52:51nrds<Prestige99> I'll continue tomorrow
06:54:54FromDiscord<Elegantbeef> Ah i thought that might be an issue aswell
07:11:29*max22- joined #nim
07:50:06*Gustavo6046 quit (Ping timeout: 245 seconds)
07:52:42*Gustavo6046 joined #nim
08:24:44*Gustavo6046_ joined #nim
08:25:16*Gustavo6046 quit (Read error: Connection reset by peer)
08:28:03*Gustavo6046_ is now known as Gustavo6046
09:13:15FromDiscord<retkid> is it possible to use floats in an enum
09:14:19FromDiscord<Elegantbeef> No but you can make an `array[yourEnum, float]`
09:16:09FromDiscord<retkid> welp then i might as well keep my table
09:16:20FromDiscord<Elegantbeef> I just gave you a cheaper/better alternative
09:17:42FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3BTL
09:20:14FromDiscord<retkid> that is cleaner code
09:20:15FromDiscord<retkid> thank you.
09:22:21FromDiscord<retkid> actually
09:22:29FromDiscord<retkid> i dont think this fits for my problem
09:24:34FromDiscord<Rika> Well what is your problen
09:24:38FromDiscord<Rika> (edit) "problen" => "problem"
09:27:47FromDiscord<retkid> just converting strings to consts
09:27:54FromDiscord<retkid> (edit) "consts" => "consts, table keys work the best"
09:28:15FromDiscord<Rika> Okay yeah I guess
09:43:47FromDiscord<impbox [ftsf]> Or a case statement
09:44:34FromDiscord<impbox [ftsf]> Actually I forget if case support strings in nim
09:47:39FromDiscord<Rika> It does
10:04:23FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3BTY
10:04:44FromDiscord<el__maco> I know we have the union pragma, but I guess I'm not sure how to create that anonymous struct
10:07:45FromDiscord<el__maco> (the point is that you can set value quad using ``bitmap[0].value=0x11223344`` or one component at a time ``bitmap[0].r=255``)
10:08:06FromDiscord<haxscramper> you can use `tuple[r,g,b,a: uint8]`
10:08:22FromDiscord<haxscramper> For anonymous union
10:08:29FromDiscord<el__maco> right, I'll try that
10:08:47FromDiscord<el__maco> keep forgetting about tuples 😁
11:02:22*xet7 quit (Remote host closed the connection)
11:03:21*xet7 joined #nim
11:45:39FromDiscord<el__maco> hmm, still not able to pull it off
11:46:01FromDiscord<el__maco> not only does it complain about the union, it also wants the tuple named
11:46:38FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3BUb
11:46:54FromDiscord<el__maco> >Warning: type pragmas follow the type name; this form of writing pragmas is deprecated [Deprecated]↵>Error: identifier expected, but got 'keyword tuple'
11:47:01FromDiscord<el__maco> (edit) ">Warning:" => "> Warning:" | "[Deprecated]↵>Error:" => "[Deprecated]↵> Error:"
11:53:20FromDiscord<Rika> Needs a name
11:53:32FromDiscord<impbox [ftsf]> You can use a cast instead of a union
11:53:45FromDiscord<Rika> I don't think you can do anonymous struts in an object
11:54:23FromDiscord<impbox [ftsf]> Just give it value and use procs with cast for the rgba
11:54:25FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3BUe
11:54:41FromDiscord<impbox [ftsf]> Yeah that should be fine too
11:54:56FromDiscord<impbox [ftsf]> Though i think someone had issues with the code generator using the name
11:55:03FromDiscord<impbox [ftsf]> Which doesn't exist in c
11:55:18FromDiscord<impbox [ftsf]> But yours isn't importc so it might be fine
11:56:33*max22- quit (Ping timeout: 265 seconds)
12:06:01*supakeen quit (Quit: WeeChat 3.3)
12:06:30*supakeen joined #nim
12:14:22FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3BUm
12:14:40FromDiscord<Rika> mitems iterator
12:14:53FromDiscord<el__maco> what does that mean
12:15:08FromDiscord<Rika> Just put “.mitems” after data in the first line of your second block
12:15:11FromDiscord<Rika> And it will work
12:15:15FromDiscord<Rika> Mutable items
12:15:19FromDiscord<Rika> Oh wait it’s pairs
12:15:23FromDiscord<Rika> So it’s mpairs
12:15:31FromDiscord<el__maco> texture.data is a seq
12:15:37FromDiscord<Rika> I am aware
12:15:51FromDiscord<Rika> Try what I just said at least
12:16:13FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3BUo
12:16:37FromDiscord<el__maco> ah yes, that works. Nice!
12:17:00FromDiscord<el__maco> not sure what is a "pair" here tho
12:17:19FromDiscord<Rika> Pair of values, in the case of a seq it is index and value
12:17:24FromDiscord<Rika> For a table it is key and value
12:17:25FromDiscord<Rika> Etc
12:17:31FromDiscord<el__maco> I see
12:17:40FromDiscord<el__maco> good to know
12:17:41FromDiscord<Rika> Only the second part is variable when it is an m type iterator
12:17:56FromDiscord<Rika> Cuz it kinda makes no sense to change a key or an index
12:25:20*rockcavera joined #nim
12:25:20*rockcavera quit (Changing host)
12:25:20*rockcavera joined #nim
12:38:07FromDiscord<el__maco> pardon me while I'm trying to learn the language 😅 it seems I can iterate over a slice of that seq like this ``for index,pixel in the_texture.data[0..31]:`` but if I do this then .mpairs no longer works
12:40:09FromDiscord<Rika> I don’t see why it wouldn’t work…
12:40:57FromDiscord<el__maco> sent a long message, see http://ix.io/3BUy
12:41:58FromDiscord<Rika> Ah because it’s not variable
12:42:09FromDiscord<Rika> Nim doesn’t have slicing in stable yet
12:42:14FromDiscord<Rika> It does in experimental
12:44:45*arkurious joined #nim
13:00:11FromDiscord<Smarc> Can you guys tell me why this is giving me an 'undeclared identifier' error? Both files are in the same directory https://media.discordapp.net/attachments/371759389889003532/898918241286639686/Screenshot_20211016_145604.png
13:02:34FromDiscord<Rika> Did you save
13:03:12FromDiscord<Rika> Never mind looks like you did
13:03:26FromDiscord<Rika> Honestly can’t tell you
13:03:31FromDiscord<Rika> Dunno what’s up
13:05:08FromDiscord<Smarc> I just don't get it .. Compiling actually gives me a SIGSEGV error if I try to output x[0]
13:05:47FromDiscord<Gumber> are your pawns ref objects?
13:05:50FromDiscord<Rika> Legitimately odd I would say
13:06:02FromDiscord<Smarc> Yes, Pawn is a ref object of Piece is a ref object of RootObj
13:06:07FromDiscord<Rika> Eh I wouldn’t think that would be an issue
13:06:15FromDiscord<Gumber> I'm just trying to understand what their definition is
13:06:25FromDiscord<Rika> Okay
13:06:29FromDiscord<Gumber> wait
13:06:33FromDiscord<Gumber> you're returning a seq of pawns
13:06:42FromDiscord<Gumber> but you're not assigning anything to the result...
13:06:49FromDiscord<Gumber> white pawns rather
13:07:08FromDiscord<Gumber> white pawns is a immutable seq
13:07:13FromDiscord<Rika> That’s wrong logic but it shouldn’t be causing segfaults
13:07:30FromDiscord<Gumber> @Smarc can you just create a gist or something of your code so we can try to compile it?
13:07:45FromDiscord<Gumber> or set up a `play.nim-lang.org` share for us?
13:08:52FromDiscord<Smarc> I just noticed it is working if I assign wPawn1 before creating the whitePawns seq .. So somehow the undeclared identifier error is on my vim side I guess?!
13:09:15FromDiscord<Rika> OH YEAH
13:09:19FromDiscord<Rika> That’s true
13:09:29FromDiscord<Rika> They’re all nil before you put anything in them
13:09:38FromDiscord<Rika> Which is why accessing them will segfault
13:09:58FromDiscord<Gumber> yeah ref objects need to be initialized
13:09:59FromDiscord<Smarc> I thought if I call createPawns() before accessing them the wPawn1 would update? :x What am I mixing up here?
13:09:59*Guest77 joined #nim
13:10:12FromDiscord<Rika> Yes, wPawn1 will update, but not the sea
13:10:13FromDiscord<Rika> Seq
13:10:32FromDiscord<Gumber> the seq is storing references to uninitialized memory
13:10:58FromDiscord<Smarc> Hm, what is the Nim-way to do this then?
13:10:59FromDiscord<Gumber> because you haven't assigned anything to your pawn references yet
13:11:10FromDiscord<Gumber> it's the same way to do it as in C/C++
13:11:26FromDiscord<Gumber> you can't just store a nil pointer in a container
13:11:55FromDiscord<Gumber> because that's a copy
13:12:06FromDiscord<Gumber> then you update the original pointer to make it point at some intialized memory
13:12:21FromDiscord<Rika> You’re reassigning the pointer, not changing the data within the pointer
13:12:26FromDiscord<Smarc> Ahh
13:12:27FromDiscord<Gumber> the container still holds the copies that point to the unnitialized memory
13:12:44FromDiscord<Smarc> Pointers are .. confusing
13:12:45FromDiscord<retkid> so i got this compile thing here
13:12:50FromDiscord<Gumber> nah they're not bad
13:12:54FromDiscord<retkid> " lastOrd(tyGenericParam)"
13:12:55FromDiscord<Rika> Not really once you got the hang of it
13:12:57FromDiscord<Gumber> think of a pointer as an address
13:13:01FromDiscord<Gumber> to some location in memory
13:13:06FromDiscord<Rika> In reply to @Gumber "think of a pointer": I mean… it is
13:13:09FromDiscord<Rika> 😛
13:13:21FromDiscord<Gumber> and the memory you allocate to store the data for objects
13:13:23FromDiscord<retkid> `there is a lot of code and i have no idea where that could be caused by and it isn't giving me any information, is there anyway i can get the compiler to give me any more info
13:13:27FromDiscord<Gumber> lives in these memory locations
13:13:33FromDiscord<Gumber> the pointer is just a layer of indirection
13:13:47FromDiscord<Smarc> Thank you both for clearing this up!
13:13:48FromDiscord<Gumber> things get a little confusing when you start dealing with double pointers and the fact that C lacks type safety
13:13:54FromDiscord<Rika> In reply to @retkid "`there is a lot": Not that I know of
13:13:59FromDiscord<Gumber> so like in C arrays are pointers
13:14:04FromDiscord<Rika> Maybe with Koch
13:14:38FromDiscord<Gumber> @retkid what do you mean `this compiler thing`?
13:14:50FromDiscord<Gumber> like is the compiler crashing when trying to compile your program?
13:15:00*Guest77 quit (Quit: Client closed)
13:15:06FromDiscord<Gumber> or is your program failing to compile because of some error in your code and that's something that's being logged?
13:16:01FromDiscord<Rika> Looks like a compiler crash
13:16:13FromDiscord<Rika> In reply to @retkid "" lastOrd(tyGenericParam)"": See this
13:16:17FromDiscord<retkid> its a trackeback
13:16:27FromDiscord<retkid> so likely some kind of crash
13:16:38FromDiscord<retkid> I've had this happen before except I didn't compile for a whole and theres a lot of new code
13:16:41FromDiscord<retkid> so i dont know where to start
13:17:00FromDiscord<retkid> the only thing i got is just delete code randomly until something works
13:17:25FromDiscord<retkid> oh hey it worked
13:17:39FromDiscord<retkid> proc highestKey(input : OrderedTable[int, float] | OrderedTable[string, float] ) : seq[int] | seq[string]=
13:17:43FromDiscord<retkid> (edit) "proc highestKey(input : OrderedTable[int, float] | OrderedTable[string, float] ) : seq[int] | seq[string]=" => "sent a code paste, see https://play.nim-lang.org/#ix="
13:18:19FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=" => "https://play.nim-lang.org/#ix=3BUK"
13:18:23FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3BUK" => "https://play.nim-lang.org/#ix=3BUL"
13:23:25*max22- joined #nim
13:47:35*rockcavera quit (Remote host closed the connection)
14:30:22FromDiscord<Fancy> Hi guys
14:47:14FromDiscord<Fancy> sent a long message, see http://ix.io/3BUW
14:51:14*Pyautogui joined #nim
14:52:16*Pyautogui quit (Client Quit)
14:56:07*Pyautogui joined #nim
14:56:53FromDiscord<Shoto> How do i make a Nim function that's usable with CFFI in other languages?
14:57:31FromDiscord<Shoto> And is there a way to actually use Nim functions that return and accept C types in C/C++/similar langs?
14:57:45FromDiscord<Shoto> Without using a .so file or something
15:03:10FromDiscord<Gumber> sent a long message, see http://ix.io/3BVb
15:03:26FromDiscord<Gumber> I tried `importcpp`ing the symbol into module A and aplying `nodecl` as well, but that didn't seem to help :/
15:04:09FromDiscord<Gumber> oh I have one idea... maybe the header pragma since it's complaining about the virtual interface not being found not the implementation....
15:06:43FromDiscord<Fancy> In reply to @Himiko Toga "And is there a": I am pretty sure I saw something about that in the Nim book they recommend on the Nim site
15:06:59*Pyautogui quit (Ping timeout: 264 seconds)
15:07:12FromDiscord<Rika> look into the types that start with `c`, `cstring cint` etc
15:07:38FromDiscord<Fancy> ahh yeah that was it
15:08:50FromDiscord<Fancy> I just realised I used it when I was doing the canvas api thing
15:16:35FromDiscord<Himiko> Ah okay, thanks 👍
15:20:35FromDiscord<Gumber> okay got my problem figured out - needed to put the header emit for the class in a separate module and include it everywhere
15:20:41FromDiscord<Gumber> just like in C++ xD
15:22:24*Pyautogui joined #nim
15:43:56FromDiscord<Fancy> Ahhh I hate those situations where you can't work it out and it turns out is a simple fix like that
15:44:25FromDiscord<Fancy> C++ never again. haha
15:45:13FromDiscord<Fancy> I never want to touch Cpp again, that was an absolute nightmare.
15:54:05FromDiscord<haxscramper> In reply to @Himiko Toga "How do i make": https://github.com/treeform/genny while main focus is generation of the `.so` files, it also automates creation of the procs that would actually be exported (in the dl), and you can use those
15:55:22FromDiscord<haxscramper> Actually no, it still goes through the dynamic library for this one
16:10:06FromDiscord<Himiko> Thanks aha
16:11:55nrds<Prestige99> Wrapping a c function that has a const pointer to some data, is there anything special I have to write (other than ptr foo)?
16:21:33FromDiscord<dom96> In reply to @Fancy "I started playing around": Welcome to the Nim community 🙂
16:22:58nrds<Prestige99> @Elegantbeef: I narrowed it down to https://git.einheit.tech/EinheitTechnologies/shade/src/branch/bug/reprv2/src/shadepkg/math/collision/collisionshape.nim#L114 which is creating an object via the chipmunk wrapper - curious if this means my wrapper is incorrect...
16:23:15nrds<Prestige99> it was also happening with sdl_gpu as well, though
16:24:57FromDiscord<dom96> The hacktoberfest contributions I've been getting so far have been amazing 😄
16:28:50nrds<Prestige99> specifically seems to be, storing an object created via a c wrapper inside a Nim type/ref object
16:29:14nrds<Prestige99> If I have some object with an sdl_gpu.Image and try to echo the repr, it fails
16:36:57nrds<Prestige99> https://play.nim-lang.org/#ix=3BVB here's the minimal example
16:44:47*Pyautogui quit (Ping timeout: 264 seconds)
16:54:19FromDiscord<Fancy> In reply to @dom96 "Welcome to the Nim": Thank you so much it is a pleasure to be here. 🙂
16:56:45FromDiscord<Fancy> So nim is a suitable alternative to cpp for making 2d game engines?
16:58:49FromDiscord<exelotl> yeah, very ^^
16:59:40FromDiscord<Fancy> Oh cool become quite fascinated in game engines recently
17:01:18FromDiscord<Fancy> (edit) "Oh cool ... becomea" added "I've" | "quite fascinated in" => "a bit obsessed with" | "recently" => "recently, so that suits me. I don't have to do everything in cpp yay. 🙂"
17:02:34FromDiscord<Gumber> In reply to @Fancy "Oh cool I've become": You're still going to be relying on C/C++ unless you want to want to write all the cross platform windowing / input stuff yourself
17:02:40FromDiscord<Gumber> and even then you'd be relying on C calls
17:02:49FromDiscord<Gumber> so knowing C/C++ will only benefit you
17:03:05FromDiscord<Gumber> depending on the complexity of your project, it could be a requirement
17:03:18FromDiscord<Gumber> also I wouldn't make 2d game engines - they're pretty pointless to a large degree
17:03:36FromDiscord<Gumber> unless you're trying to do something unique in terms of software rasterization like Nico does
17:03:52FromDiscord<Fancy> I have dabbled in C and Cpp before so that is alright. I just meant I am happy that I don't have to rely on it 100%
17:05:06FromDiscord<Gumber> you end up dealing with the warts either way
17:05:06FromDiscord<Fancy> I would be definitely beneficial to do a refresher tho that is for sure
17:05:15FromDiscord<Gumber> especially if you rely on the cpp backend
17:05:48FromDiscord<Gumber> I'd just advise not to write game engines - if you want to write your own tech pick a game you want to write and then figure out what tech you need to make it happen
17:05:51FromDiscord<Gumber> then R&D
17:05:55FromDiscord<Gumber> then build a prototyping sandbox
17:05:57FromDiscord<Gumber> then make your game
17:05:59FromDiscord<Fancy> The engine is more of a hobby project than anything else
17:06:09FromDiscord<Gumber> well hobby projects can have end goals / purposes
17:06:14FromDiscord<Gumber> hobby game engines tend not to
17:06:14FromDiscord<Fancy> I don't think I will be making anything too complex
17:06:43FromDiscord<Gumber> trust me - I've written several hobby game engines in Nim - I am now building a 3d RTS with networked physics in Nim
17:07:18*neurocyte0132889 joined #nim
17:07:18*neurocyte0132889 quit (Changing host)
17:07:18*neurocyte0132889 joined #nim
17:07:31FromDiscord<Gumber> I'm using - https://github.com/jrouwe/JoltPhysics - (although eventually I'd like to rip the STL out and replace it with EASTL or something else)
17:07:53FromDiscord<Gumber> https://github.com/GameTechDev/GTS-GamesTaskScheduler
17:07:55FromDiscord<Fancy> So you would recommend focus on making a game opposed to making an engine, right?
17:08:09FromDiscord<Gumber> https://github.com/charles-lunarg/vk-bootstrap
17:08:17FromDiscord<Gumber> https://github.com/martty/vuk
17:08:36FromDiscord<Gumber> https://github.com/glfw/glfw
17:08:40FromDiscord<Fancy> Thanks for all the feedback 🙂
17:08:43FromDiscord<Gumber> etc...
17:09:08FromDiscord<Gumber> no problem - I've worked in the industry on game engines and done hobby game engine development for the past six or so years
17:09:23FromDiscord<Gumber> my advice is not to try to build an engine - it's a pointless goal
17:09:49FromDiscord<Gumber> pick a game you want to make and figure out what your requirements are and then figure out what you need to build it on a technical level
17:10:30FromDiscord<Gumber> do some upfront research to figure out how to make that happen - consult books, look at other github repos, read blogs / dev blogs, talk to other devs, etc....
17:10:46FromDiscord<Gumber> focus on data oriented design and don't get wrapped up in ECS at first
17:10:58FromDiscord<Gumber> avoid object oriented design and design patterns like the plague
17:11:15FromDiscord<Gumber> (edit) "avoid object oriented design and ... design" added "object oriented"
17:11:31FromDiscord<Gumber> really focus on data because your engine is just transforming a bunch of data
17:11:47FromDiscord<Gumber> (edit) "really focus on data because your engine is just transforming a bunch of data ... " added "at the end of the day"
17:12:00FromDiscord<Gumber> this is better in #gamedev btw so let's move there
17:12:25*neurocyte0132889 quit (Ping timeout: 252 seconds)
17:20:02*Pyautogui joined #nim
17:21:12FromDiscord<Fancy> sent a long message, see http://ix.io/3BVR
17:22:41FromDiscord<Fancy> I will need to head off to bed, but I would be happy to continue this later when I am bit more well rested.
17:40:25*Pyautogui quit (Quit: Connection closed)
17:41:11*Pyautogui joined #nim
17:49:30FromDiscord<treeform> Is there a way to keep the normal `foo[3] foo.add()` but add a my own namespace for methods, some thing like `foo.u[3] foo.u.add()` Can I create a zero cost object/namepsace `.u` that I can have my own extra methods on, but not actually create anything at run time? As its nearly just a namespace?
17:50:58FromDiscord<Gumber> In reply to @Fancy "Six years you know": have a good night! I doubt it - I don't watch many videos about Rust 🙂 I've known about data oriented design in game engines for quite some time, since before Unity or Godot
18:04:58FromDiscord<treeform> hmm I think a `type U = distinct ptr string` might work?
18:06:10*neurocyte0132889 joined #nim
18:06:10*neurocyte0132889 quit (Changing host)
18:06:10*neurocyte0132889 joined #nim
18:11:52NimEventerNew thread by Orlean: Documentation for Nim 1.6?, see https://forum.nim-lang.org/t/8508
18:17:55*max22- quit (Ping timeout: 260 seconds)
18:30:21FromDiscord<haxscramper> https://forum.nim-lang.org/t/8508#55071> Please notice that the 1.6 release is officially scheduled for next Monday.
18:32:14PyautoguiWow!
18:50:27*max22- joined #nim
19:04:16FromDiscord<Rika> In reply to @treeform "hmm I think a": Distinct void I think works
19:36:15NimEventerNew thread by Prestige: Repr a ref object with a property from a C library, see https://forum.nim-lang.org/t/8509
19:38:00*oddish joined #nim
19:43:15*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
19:45:59*Pyautogui quit (Ping timeout: 264 seconds)
19:51:09*neurocyte0132889 joined #nim
19:51:09*neurocyte0132889 quit (Changing host)
19:51:09*neurocyte0132889 joined #nim
20:10:58*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
20:14:05*neurocyte0132889 joined #nim
20:14:05*neurocyte0132889 quit (Changing host)
20:14:05*neurocyte0132889 joined #nim
20:26:27*Pyautogui joined #nim
20:27:13FromDiscord<Elegantbeef> Prestige you about, are any of the structs incomplete when you attempt to repr?
20:27:32FromDiscord<Elegantbeef> Cause like https://play.nim-lang.org/#ix=3BWG works fine
20:32:22nrds<Prestige99> hm let's see..
20:34:42nrds<Prestige99> Doesn't help that I don't know C that well, but: https://github.com/slembcke/Chipmunk2D/blob/master/include/chipmunk/cpPolyShape.h is the header and https://github.com/avahe-kellenberger/nim-chipmunk/blob/master/src/chipmunk7.nim#L93 is the wrapper for it
20:35:00nrds<Prestige99> I've just modified an existing wrapper for chipmunk
20:37:02FromDiscord<Elegantbeef> I'll check it in a bit
20:42:46PyautoguiNoob question: When should I use a template versus an inline pragma?
20:43:47PyautoguiI am trying undertand the nim-bigints library use of the {.inline.} pragma.
20:44:11*neurocyte0132889 quit (Ping timeout: 264 seconds)
20:44:36nrds<Prestige99> thanks
20:45:00nrds<Prestige99> I believe the inline pragma tries to tell the c compiler to inline the code (in c) but using a template inlines the nim code. iirc
20:45:26FromDiscord<Elegantbeef> Well you generally should default to the inline unless guaranteed inlining is a desired
20:45:46FromDiscord<Elegantbeef> templates certainly inline, whereas you're at the mercy of the compiler and your settings for the pragma
20:46:04PyautoguiThanks.
21:29:58*max22- quit (Remote host closed the connection)
21:32:37*max22- joined #nim
21:41:18*max22- quit (Quit: Leaving)
22:12:49FromDiscord<Hamid Bluri> me:↵8 hours writing my ideal DSL↵1 hour
22:13:05FromDiscord<Hamid Bluri> 1 hour actually working on project
22:13:25FromDiscord<Hamid Bluri> (edit) "DSL↵1 hour" => "DSL"
22:13:50FromDiscord<Hamid Bluri> i cant even imagine the world without macro 😄
22:43:55*Pyautogui quit (Quit: Connection closed)
22:51:39FromDiscord<f_l_a> Hello everyone I want to bind NimVm to Nim such as binding python with c++ imagine I write basic functions with basic structs and compile with nim to binary and fast so file and use this function in NimVm .anyone can help?
22:52:37FromDiscord<codic> I want to pass a `ptr cuchar` (as a string) to a C function, from an original nim `string`
22:53:00FromDiscord<codic> I tried `cast[ptr cuchar](nim_string)` and `cast[ptr cuchar](nim_string.unsafeAddr)` but neither works, what do I do?
22:53:19FromDiscord<codic> oh it seems I can do .cstring
23:14:47*audiophile_ joined #nim
23:20:16FromDiscord<Elegantbeef> Looking at the C and the bindings doesnt give me much reason to think this should cause this
23:20:31FromDiscord<Elegantbeef> Guess i should say a name like prestige for that above message
23:23:12nrds<Prestige99> Hey Elegantbeef - thanks
23:23:21nrds<Prestige99> I'm not sure where to go from here...
23:23:48FromDiscord<Elegantbeef> Well where is the C struct declared?
23:25:15nrds<Prestige99> aha! found it https://github.com/slembcke/Chipmunk2D/blob/master/include/chipmunk/chipmunk_structs.h#L225
23:25:28nrds<Prestige99> Perhaps this is the issue, then.
23:25:55nrds<Prestige99> Presumably I need to add these members to the wrapper
23:27:33FromDiscord<Elegantbeef> Yea idk the minimal case of what you're doing ostensibly works https://play.nim-lang.org/#ix=3BXo
23:29:47nrds<Prestige99> This was also happening with sdl_gpu, but I couldn't get a super minimal example. So I suspect it has something to do with the wrappers
23:31:33nrds<Prestige99> It seems a lot of the definitions in the wrappers don't include properties, e.g. `Shape* = ptr ShapeObj` is the entire definition. But there are like, 12 or so properties on the actual c struct
23:31:53nrds<Prestige99> (and PolyShape inherits from Shape)
23:35:23Mister_MagisterHi, i want to send broadcast packet from one nim app and then respond from second nim app with ip address, i want to use it to discover where is the server at in network. Do you perhaps have some pointers or example?
23:37:17Mister_Magisteri can probably use socket.sendTo to send to broadcast but how do i listen to broadcast?
23:38:20*Pyautogui joined #nim
23:39:16FromDiscord<Elegantbeef> https://nim-lang.org/docs/net.html#examples-creating-a-server did you look at?
23:40:14*Pyautogui quit (Client Quit)
23:41:42Mister_Magisteryep and nothing about receiving udp broadcast packets :
23:41:44Mister_Magister:/
23:42:05Mister_Magisterit literally says in the example "you can create a TCP server by calling the bindAddr and listen procedures"
23:43:08Mister_Magisteri imagine i need to do something with this https://nim-lang.org/docs/net.html#recvFrom%2CSocket%2Cstring%2Cint%2Cstring%2CPort%2Cint32
23:43:16FromDiscord<Elegantbeef> `newSocket` has an optional `protocol` and `sockType`
23:44:09Mister_Magistertrue
23:44:49FromDiscord<Elegantbeef> I dont know much about sockets but if i understand what you're after does `IpProtoUdp` and `SockRaw` not fit the bill?
23:45:39Mister_Magisteri'm trying it as we speak :) thanks
23:46:44Mister_Magisterhmm when using udp "Error: unhandled exception: Operation not supported"
23:48:47Mister_Magisterah can't call .listen
23:49:07FromDiscord<Elegantbeef> Yea udp is connectionless afterall
23:49:17FromDiscord<Elegantbeef> So you just do `recvFrom`
23:50:03Mister_Magistermhm
23:50:12Mister_Magisteri got something to follow now, thanks!
23:50:31Mister_Magisteri can prably figure it out from here
23:51:17FromDiscord<Elegantbeef> Yay the blind can lead the blind
23:51:32Mister_Magister:D
23:51:37Mister_Magisterit's similar to rubberducking
23:51:55Mister_Magisteri just needed something to bite