00:45:45 | FromDiscord | <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:05 | FromDiscord | <Elegantbeef> Yea i've decided the pragma was too invasive |
00:46:25 | FromDiscord | <geekrelief> ok |
00:46:30 | FromDiscord | <geekrelief> so what's the new plan? |
00:46:31 | FromDiscord | <geekrelief> 🙂 |
00:46:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3BS8 |
00:46:52 | FromDiscord | <Elegantbeef> I have update version somewhere |
00:46:55 | FromDiscord | <geekrelief> oh I see |
00:47:26 | FromDiscord | <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:10 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3BS9 |
00:48:41 | FromDiscord | <Elegantbeef> Well i solved some overloading |
00:49:19 | FromDiscord | <Elegantbeef> like `circle(a, b, c: float or int)` will emit `circle321321(a, b, c: float)` and `circle321322(a, b, c: int)` |
00:49:55 | FromDiscord | <geekrelief> cool, the example compiled except `time` was declared |
00:50:22 | FromDiscord | <geekrelief> I guess the warnings are expected too? |
00:52:18 | FromDiscord | <Elegantbeef> Yea i'll cast gcsafe eventually |
00:53:06 | FromDiscord | <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:11 | FromDiscord | <Elegantbeef> So things like `time` emit a template on the nimscript side so you can do `time` instead of `time()` 🙂 |
00:53:25 | FromDiscord | <Elegantbeef> `time` being a global variable |
00:55:56 | FromDiscord | <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:13 | FromDiscord | <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:43 | FromDiscord | <Elegantbeef> Not yet |
01:04:43 | FromDiscord | <Elegantbeef> It might be possible to do |
01:06:24 | FromDiscord | <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:30 | nrds | <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:48 | FromDiscord | <Elegantbeef> Give me one moment and i will |
02:24:52 | nrds | <Prestige99> I tried recreating it with a minimal example, but my examples all work 🤔 |
02:24:55 | nrds | <Prestige99> Thanks |
02:26:09 | FromDiscord | <Elegantbeef> Where is the add issue at? |
02:26:31 | nrds | <Prestige99> the addchild part? 1 sec |
02:26:45 | nrds | <Prestige99> https://git.einheit.tech/EinheitTechnologies/shade/src/branch/example/platformer/examples/platformer/king.nim#L82 |
02:27:10 | nrds | <Prestige99> If I comment out those two lines, I can echo repr player[].addr |
02:27:30 | nrds | <Prestige99> in https://git.einheit.tech/EinheitTechnologies/shade/src/branch/example/platformer/examples/platformer/platformer_example.nim |
02:29:07 | FromDiscord | <Elegantbeef> Guess i should clone this to test it |
02:29:43 | nrds | <Prestige99> There are some reqs - sdl, sdl_mixer, sdl_gpu, and chipmunk (v7) |
02:30:15 | nrds | <Prestige99> If you're on arch they're all in the repos except sdl_gpu, iirc |
02:30:36 | nrds | <Prestige99> https://git.einheit.tech/EinheitTechnologies/shade/src/branch/example/platformer#setting-up-sdl_gpu |
02:30:42 | FromDiscord | <Elegantbeef> look at this guy assuming everyone runs arch |
02:30:52 | nrds | <Prestige99> I thought you did for some reason :P |
02:31:44 | FromDiscord | <Elegantbeef> Nah i'm an ubuntu derived heathen |
02:33:09 | nrds | <Prestige99> good enough ;P |
02:34:22 | FromDiscord | <Elegantbeef> You dont have vmath in the deps |
02:34:45 | nrds | <Prestige99> hmm oh right, I think that was with pixie but I stopped using pixie |
02:35:16 | FromDiscord | <Elegantbeef> Uhh `Error: type mismatch: got 'proc (this: Task, deltaTime: float){.closure.}' for 'onUpdate' but expected 'proc (this: Node, deltaTime: float){.closure.}` |
02:35:29 | FromDiscord | <Elegantbeef> Is that branch up to date? |
02:35:34 | nrds | <Prestige99> Yep |
02:36:00 | nrds | <Prestige99> If you just add `echo repr player[].addr` in platformer_example.nim you should see the error |
02:36:25 | FromDiscord | <Elegantbeef> Is this compiler error expected? |
02:37:03 | nrds | <Prestige99> Which error are you seeing? I get a runtime error about illegal storage access |
02:37:22 | FromDiscord | <Elegantbeef> I pasted the error a couple messages ago |
02:37:39 | FromDiscord | <Elegantbeef> The type mismatch due to `Task` and `Node` not matching |
02:37:42 | nrds | <Prestige99> oh - weird |
02:37:45 | * | arkurious quit (Quit: Leaving) |
02:37:57 | FromDiscord | <Elegantbeef> Ah was due to being on devel apparently |
02:38:01 | FromDiscord | <Elegantbeef> Rather 1.6.0 |
02:38:09 | nrds | <Prestige99> oh ok |
02:38:13 | nrds | <Prestige99> yeah I'm on stable |
02:38:27 | nrds | <Prestige99> and the example/platformer branch |
02:39:05 | FromDiscord | <Elegantbeef> "failed to load image" |
02:39:42 | nrds | <Prestige99> try `nimble platformer` from the project directory |
02:39:57 | FromDiscord | <Elegantbeef> Ah didnt realize you had that setup |
02:40:02 | FromDiscord | <Elegantbeef> Yea got the proper nil error |
02:40:12 | nrds | <Prestige99> \o/ |
02:40:25 | FromDiscord | <Elegantbeef> Now to see the culprit |
02:41:28 | nrds | <Prestige99> It somehow has something to do with the node's children.. |
02:55:18 | FromDiscord | <Elegantbeef> You're code is fine just the reprv1 impl that has an issue |
02:55:21 | FromDiscord | <Elegantbeef> your code even |
02:56:59 | FromDiscord | <Elegantbeef> The node is assumed to not be nil but somehow it's getting nil, line 195 in compiler/repr.nim |
02:57:40 | nrds | <Prestige99> dang it |
02:57:46 | nrds | <Prestige99> was hoping it was my fault |
02:57:47 | FromDiscord | <Elegantbeef> you dont even need to do the `player[].addr.repr` `repr(player)` hits the same bug |
02:58:02 | FromDiscord | <Elegantbeef> Well eitherway there isnt a big issue here |
03:02:27 | FromDiscord | <Elegantbeef> Ah somewhere the kind of a nimnode is invalidly set |
03:04:53 | * | rockcavera quit (Remote host closed the connection) |
03:06:00 | nrds | <Prestige99> So need to patch the compiler eh? |
03:06:30 | FromDiscord | <Elegantbeef> Something is indeed off |
03:07:38 | FromDiscord | <Elegantbeef> Well it's not compiler since it's the system module |
03:08:19 | FromDiscord | <Elegantbeef> So you have two avenues to fix it either fix the bad generated code passed or fix the cause 😛 |
03:10:21 | nrds | <Prestige99> Not sure how to fix it other than fixing the system module |
03:11:40 | FromDiscord | <Elegantbeef> Something is really off though |
03:14:00 | nrds | <Prestige99> Yeah.. |
03:16:36 | FromDiscord | <Elegantbeef> Yea i tried to just change the stdlib and no cigar |
03:16:41 | FromDiscord | <Elegantbeef> So need to fix the compiler for repr |
03:16:57 | FromDiscord | <Elegantbeef> reprv2 didnt like your code |
03:22:21 | nrds | <Prestige99> Hmm I wonder why |
03:57:09 | nrds | <Prestige99> using --gc:arc or orc give a different error at least |
03:57:29 | nrds | <Prestige99> expression cannot be cast to pointer |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:31 | * | supakeen joined #nim |
04:41:00 | FromDiscord | <retkid> is there a library for imperial measurements |
04:41:10 | FromDiscord | <retkid> 1 quart / 1 tablespoon |
04:41:18 | FromDiscord | <retkid> lol |
04:48:31 | nrds | <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:01 | FromDiscord | <ElegantBeef> Look at the VM's magic and see where it get stuff is what i'd suggest |
05:14:21 | FromDiscord | <ElegantBeef> For some reason the values got are incorrect for some values it gets some odd enum value |
05:15:35 | nrds | <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:45 | nrds | <Prestige99> Hopefully it's an easy fix, and I can get back to my project |
05:18:30 | FromDiscord | <ElegantBeef> I couldnt get a repro to work so yea that makes it harder |
05:18:36 | FromDiscord | <ElegantBeef> Minimizing it is the key to resolving it imo |
05:19:07 | FromDiscord | <ElegantBeef> I think there is a chance it's having a proc named `children` and `children: seq[Node]` |
05:19:12 | nrds | <Prestige99> I'll keep stripping down my code to make it as minimal as possible |
05:19:23 | nrds | <Prestige99> Good thinking |
06:07:45 | nrds | <Prestige99> Renaming it didn't seem to change any behavior |
06:15:22 | FromDiscord | <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:10 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3BTa |
06:21:17 | FromDiscord | <codic> (edit) "https://play.nim-lang.org/#ix=3BTa" => "https://play.nim-lang.org/#ix=3BTb" |
06:38:15 | FromDiscord | <Elegantbeef> It works fine https://play.nim-lang.org/#ix=3BTd |
06:40:46 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3BTf for an "openarray" solution |
06:41:13 | FromDiscord | <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:31 | FromDiscord | <codic> ah, the conversion to openArray is not implicit in a converter here I guess |
06:42:38 | FromDiscord | <codic> sure, then I'll use that, thanks |
06:43:07 | FromDiscord | <Elegantbeef> openarray's conversions are often disappointing |
06:43:20 | FromDiscord | <Elegantbeef> Make a typeclass and you instantly lose auto converting |
06:52:41 | nrds | <Prestige99> Aha, it has to do with c interop |
06:52:51 | nrds | <Prestige99> I'll continue tomorrow |
06:54:54 | FromDiscord | <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:15 | FromDiscord | <retkid> is it possible to use floats in an enum |
09:14:19 | FromDiscord | <Elegantbeef> No but you can make an `array[yourEnum, float]` |
09:16:09 | FromDiscord | <retkid> welp then i might as well keep my table |
09:16:20 | FromDiscord | <Elegantbeef> I just gave you a cheaper/better alternative |
09:17:42 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3BTL |
09:20:14 | FromDiscord | <retkid> that is cleaner code |
09:20:15 | FromDiscord | <retkid> thank you. |
09:22:21 | FromDiscord | <retkid> actually |
09:22:29 | FromDiscord | <retkid> i dont think this fits for my problem |
09:24:34 | FromDiscord | <Rika> Well what is your problen |
09:24:38 | FromDiscord | <Rika> (edit) "problen" => "problem" |
09:27:47 | FromDiscord | <retkid> just converting strings to consts |
09:27:54 | FromDiscord | <retkid> (edit) "consts" => "consts, table keys work the best" |
09:28:15 | FromDiscord | <Rika> Okay yeah I guess |
09:43:47 | FromDiscord | <impbox [ftsf]> Or a case statement |
09:44:34 | FromDiscord | <impbox [ftsf]> Actually I forget if case support strings in nim |
09:47:39 | FromDiscord | <Rika> It does |
10:04:23 | FromDiscord | <el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3BTY |
10:04:44 | FromDiscord | <el__maco> I know we have the union pragma, but I guess I'm not sure how to create that anonymous struct |
10:07:45 | FromDiscord | <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:06 | FromDiscord | <haxscramper> you can use `tuple[r,g,b,a: uint8]` |
10:08:22 | FromDiscord | <haxscramper> For anonymous union |
10:08:29 | FromDiscord | <el__maco> right, I'll try that |
10:08:47 | FromDiscord | <el__maco> keep forgetting about tuples 😁 |
11:02:22 | * | xet7 quit (Remote host closed the connection) |
11:03:21 | * | xet7 joined #nim |
11:45:39 | FromDiscord | <el__maco> hmm, still not able to pull it off |
11:46:01 | FromDiscord | <el__maco> not only does it complain about the union, it also wants the tuple named |
11:46:38 | FromDiscord | <el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3BUb |
11:46:54 | FromDiscord | <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:01 | FromDiscord | <el__maco> (edit) ">Warning:" => "> Warning:" | "[Deprecated]↵>Error:" => "[Deprecated]↵> Error:" |
11:53:20 | FromDiscord | <Rika> Needs a name |
11:53:32 | FromDiscord | <impbox [ftsf]> You can use a cast instead of a union |
11:53:45 | FromDiscord | <Rika> I don't think you can do anonymous struts in an object |
11:54:23 | FromDiscord | <impbox [ftsf]> Just give it value and use procs with cast for the rgba |
11:54:25 | FromDiscord | <el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3BUe |
11:54:41 | FromDiscord | <impbox [ftsf]> Yeah that should be fine too |
11:54:56 | FromDiscord | <impbox [ftsf]> Though i think someone had issues with the code generator using the name |
11:55:03 | FromDiscord | <impbox [ftsf]> Which doesn't exist in c |
11:55:18 | FromDiscord | <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:22 | FromDiscord | <el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3BUm |
12:14:40 | FromDiscord | <Rika> mitems iterator |
12:14:53 | FromDiscord | <el__maco> what does that mean |
12:15:08 | FromDiscord | <Rika> Just put “.mitems” after data in the first line of your second block |
12:15:11 | FromDiscord | <Rika> And it will work |
12:15:15 | FromDiscord | <Rika> Mutable items |
12:15:19 | FromDiscord | <Rika> Oh wait it’s pairs |
12:15:23 | FromDiscord | <Rika> So it’s mpairs |
12:15:31 | FromDiscord | <el__maco> texture.data is a seq |
12:15:37 | FromDiscord | <Rika> I am aware |
12:15:51 | FromDiscord | <Rika> Try what I just said at least |
12:16:13 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3BUo |
12:16:37 | FromDiscord | <el__maco> ah yes, that works. Nice! |
12:17:00 | FromDiscord | <el__maco> not sure what is a "pair" here tho |
12:17:19 | FromDiscord | <Rika> Pair of values, in the case of a seq it is index and value |
12:17:24 | FromDiscord | <Rika> For a table it is key and value |
12:17:25 | FromDiscord | <Rika> Etc |
12:17:31 | FromDiscord | <el__maco> I see |
12:17:40 | FromDiscord | <el__maco> good to know |
12:17:41 | FromDiscord | <Rika> Only the second part is variable when it is an m type iterator |
12:17:56 | FromDiscord | <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:07 | FromDiscord | <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:09 | FromDiscord | <Rika> I don’t see why it wouldn’t work… |
12:40:57 | FromDiscord | <el__maco> sent a long message, see http://ix.io/3BUy |
12:41:58 | FromDiscord | <Rika> Ah because it’s not variable |
12:42:09 | FromDiscord | <Rika> Nim doesn’t have slicing in stable yet |
12:42:14 | FromDiscord | <Rika> It does in experimental |
12:44:45 | * | arkurious joined #nim |
13:00:11 | FromDiscord | <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:34 | FromDiscord | <Rika> Did you save |
13:03:12 | FromDiscord | <Rika> Never mind looks like you did |
13:03:26 | FromDiscord | <Rika> Honestly can’t tell you |
13:03:31 | FromDiscord | <Rika> Dunno what’s up |
13:05:08 | FromDiscord | <Smarc> I just don't get it .. Compiling actually gives me a SIGSEGV error if I try to output x[0] |
13:05:47 | FromDiscord | <Gumber> are your pawns ref objects? |
13:05:50 | FromDiscord | <Rika> Legitimately odd I would say |
13:06:02 | FromDiscord | <Smarc> Yes, Pawn is a ref object of Piece is a ref object of RootObj |
13:06:07 | FromDiscord | <Rika> Eh I wouldn’t think that would be an issue |
13:06:15 | FromDiscord | <Gumber> I'm just trying to understand what their definition is |
13:06:25 | FromDiscord | <Rika> Okay |
13:06:29 | FromDiscord | <Gumber> wait |
13:06:33 | FromDiscord | <Gumber> you're returning a seq of pawns |
13:06:42 | FromDiscord | <Gumber> but you're not assigning anything to the result... |
13:06:49 | FromDiscord | <Gumber> white pawns rather |
13:07:08 | FromDiscord | <Gumber> white pawns is a immutable seq |
13:07:13 | FromDiscord | <Rika> That’s wrong logic but it shouldn’t be causing segfaults |
13:07:30 | FromDiscord | <Gumber> @Smarc can you just create a gist or something of your code so we can try to compile it? |
13:07:45 | FromDiscord | <Gumber> or set up a `play.nim-lang.org` share for us? |
13:08:52 | FromDiscord | <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:15 | FromDiscord | <Rika> OH YEAH |
13:09:19 | FromDiscord | <Rika> That’s true |
13:09:29 | FromDiscord | <Rika> They’re all nil before you put anything in them |
13:09:38 | FromDiscord | <Rika> Which is why accessing them will segfault |
13:09:58 | FromDiscord | <Gumber> yeah ref objects need to be initialized |
13:09:59 | FromDiscord | <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:12 | FromDiscord | <Rika> Yes, wPawn1 will update, but not the sea |
13:10:13 | FromDiscord | <Rika> Seq |
13:10:32 | FromDiscord | <Gumber> the seq is storing references to uninitialized memory |
13:10:58 | FromDiscord | <Smarc> Hm, what is the Nim-way to do this then? |
13:10:59 | FromDiscord | <Gumber> because you haven't assigned anything to your pawn references yet |
13:11:10 | FromDiscord | <Gumber> it's the same way to do it as in C/C++ |
13:11:26 | FromDiscord | <Gumber> you can't just store a nil pointer in a container |
13:11:55 | FromDiscord | <Gumber> because that's a copy |
13:12:06 | FromDiscord | <Gumber> then you update the original pointer to make it point at some intialized memory |
13:12:21 | FromDiscord | <Rika> You’re reassigning the pointer, not changing the data within the pointer |
13:12:26 | FromDiscord | <Smarc> Ahh |
13:12:27 | FromDiscord | <Gumber> the container still holds the copies that point to the unnitialized memory |
13:12:44 | FromDiscord | <Smarc> Pointers are .. confusing |
13:12:45 | FromDiscord | <retkid> so i got this compile thing here |
13:12:50 | FromDiscord | <Gumber> nah they're not bad |
13:12:54 | FromDiscord | <retkid> " lastOrd(tyGenericParam)" |
13:12:55 | FromDiscord | <Rika> Not really once you got the hang of it |
13:12:57 | FromDiscord | <Gumber> think of a pointer as an address |
13:13:01 | FromDiscord | <Gumber> to some location in memory |
13:13:06 | FromDiscord | <Rika> In reply to @Gumber "think of a pointer": I mean… it is |
13:13:09 | FromDiscord | <Rika> 😛 |
13:13:21 | FromDiscord | <Gumber> and the memory you allocate to store the data for objects |
13:13:23 | FromDiscord | <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:27 | FromDiscord | <Gumber> lives in these memory locations |
13:13:33 | FromDiscord | <Gumber> the pointer is just a layer of indirection |
13:13:47 | FromDiscord | <Smarc> Thank you both for clearing this up! |
13:13:48 | FromDiscord | <Gumber> things get a little confusing when you start dealing with double pointers and the fact that C lacks type safety |
13:13:54 | FromDiscord | <Rika> In reply to @retkid "`there is a lot": Not that I know of |
13:13:59 | FromDiscord | <Gumber> so like in C arrays are pointers |
13:14:04 | FromDiscord | <Rika> Maybe with Koch |
13:14:38 | FromDiscord | <Gumber> @retkid what do you mean `this compiler thing`? |
13:14:50 | FromDiscord | <Gumber> like is the compiler crashing when trying to compile your program? |
13:15:00 | * | Guest77 quit (Quit: Client closed) |
13:15:06 | FromDiscord | <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:01 | FromDiscord | <Rika> Looks like a compiler crash |
13:16:13 | FromDiscord | <Rika> In reply to @retkid "" lastOrd(tyGenericParam)"": See this |
13:16:17 | FromDiscord | <retkid> its a trackeback |
13:16:27 | FromDiscord | <retkid> so likely some kind of crash |
13:16:38 | FromDiscord | <retkid> I've had this happen before except I didn't compile for a whole and theres a lot of new code |
13:16:41 | FromDiscord | <retkid> so i dont know where to start |
13:17:00 | FromDiscord | <retkid> the only thing i got is just delete code randomly until something works |
13:17:25 | FromDiscord | <retkid> oh hey it worked |
13:17:39 | FromDiscord | <retkid> proc highestKey(input : OrderedTable[int, float] | OrderedTable[string, float] ) : seq[int] | seq[string]= |
13:17:43 | FromDiscord | <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:19 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=" => "https://play.nim-lang.org/#ix=3BUK" |
13:18:23 | FromDiscord | <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:22 | FromDiscord | <Fancy> Hi guys |
14:47:14 | FromDiscord | <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:53 | FromDiscord | <Shoto> How do i make a Nim function that's usable with CFFI in other languages? |
14:57:31 | FromDiscord | <Shoto> And is there a way to actually use Nim functions that return and accept C types in C/C++/similar langs? |
14:57:45 | FromDiscord | <Shoto> Without using a .so file or something |
15:03:10 | FromDiscord | <Gumber> sent a long message, see http://ix.io/3BVb |
15:03:26 | FromDiscord | <Gumber> I tried `importcpp`ing the symbol into module A and aplying `nodecl` as well, but that didn't seem to help :/ |
15:04:09 | FromDiscord | <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:43 | FromDiscord | <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:12 | FromDiscord | <Rika> look into the types that start with `c`, `cstring cint` etc |
15:07:38 | FromDiscord | <Fancy> ahh yeah that was it |
15:08:50 | FromDiscord | <Fancy> I just realised I used it when I was doing the canvas api thing |
15:16:35 | FromDiscord | <Himiko> Ah okay, thanks 👍 |
15:20:35 | FromDiscord | <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:41 | FromDiscord | <Gumber> just like in C++ xD |
15:22:24 | * | Pyautogui joined #nim |
15:43:56 | FromDiscord | <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:25 | FromDiscord | <Fancy> C++ never again. haha |
15:45:13 | FromDiscord | <Fancy> I never want to touch Cpp again, that was an absolute nightmare. |
15:54:05 | FromDiscord | <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:22 | FromDiscord | <haxscramper> Actually no, it still goes through the dynamic library for this one |
16:10:06 | FromDiscord | <Himiko> Thanks aha |
16:11:55 | nrds | <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:33 | FromDiscord | <dom96> In reply to @Fancy "I started playing around": Welcome to the Nim community 🙂 |
16:22:58 | nrds | <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:15 | nrds | <Prestige99> it was also happening with sdl_gpu as well, though |
16:24:57 | FromDiscord | <dom96> The hacktoberfest contributions I've been getting so far have been amazing 😄 |
16:28:50 | nrds | <Prestige99> specifically seems to be, storing an object created via a c wrapper inside a Nim type/ref object |
16:29:14 | nrds | <Prestige99> If I have some object with an sdl_gpu.Image and try to echo the repr, it fails |
16:36:57 | nrds | <Prestige99> https://play.nim-lang.org/#ix=3BVB here's the minimal example |
16:44:47 | * | Pyautogui quit (Ping timeout: 264 seconds) |
16:54:19 | FromDiscord | <Fancy> In reply to @dom96 "Welcome to the Nim": Thank you so much it is a pleasure to be here. 🙂 |
16:56:45 | FromDiscord | <Fancy> So nim is a suitable alternative to cpp for making 2d game engines? |
16:58:49 | FromDiscord | <exelotl> yeah, very ^^ |
16:59:40 | FromDiscord | <Fancy> Oh cool become quite fascinated in game engines recently |
17:01:18 | FromDiscord | <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:34 | FromDiscord | <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:40 | FromDiscord | <Gumber> and even then you'd be relying on C calls |
17:02:49 | FromDiscord | <Gumber> so knowing C/C++ will only benefit you |
17:03:05 | FromDiscord | <Gumber> depending on the complexity of your project, it could be a requirement |
17:03:18 | FromDiscord | <Gumber> also I wouldn't make 2d game engines - they're pretty pointless to a large degree |
17:03:36 | FromDiscord | <Gumber> unless you're trying to do something unique in terms of software rasterization like Nico does |
17:03:52 | FromDiscord | <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:06 | FromDiscord | <Gumber> you end up dealing with the warts either way |
17:05:06 | FromDiscord | <Fancy> I would be definitely beneficial to do a refresher tho that is for sure |
17:05:15 | FromDiscord | <Gumber> especially if you rely on the cpp backend |
17:05:48 | FromDiscord | <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:51 | FromDiscord | <Gumber> then R&D |
17:05:55 | FromDiscord | <Gumber> then build a prototyping sandbox |
17:05:57 | FromDiscord | <Gumber> then make your game |
17:05:59 | FromDiscord | <Fancy> The engine is more of a hobby project than anything else |
17:06:09 | FromDiscord | <Gumber> well hobby projects can have end goals / purposes |
17:06:14 | FromDiscord | <Gumber> hobby game engines tend not to |
17:06:14 | FromDiscord | <Fancy> I don't think I will be making anything too complex |
17:06:43 | FromDiscord | <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:31 | FromDiscord | <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:53 | FromDiscord | <Gumber> https://github.com/GameTechDev/GTS-GamesTaskScheduler |
17:07:55 | FromDiscord | <Fancy> So you would recommend focus on making a game opposed to making an engine, right? |
17:08:09 | FromDiscord | <Gumber> https://github.com/charles-lunarg/vk-bootstrap |
17:08:17 | FromDiscord | <Gumber> https://github.com/martty/vuk |
17:08:36 | FromDiscord | <Gumber> https://github.com/glfw/glfw |
17:08:40 | FromDiscord | <Fancy> Thanks for all the feedback 🙂 |
17:08:43 | FromDiscord | <Gumber> etc... |
17:09:08 | FromDiscord | <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:23 | FromDiscord | <Gumber> my advice is not to try to build an engine - it's a pointless goal |
17:09:49 | FromDiscord | <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:30 | FromDiscord | <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:46 | FromDiscord | <Gumber> focus on data oriented design and don't get wrapped up in ECS at first |
17:10:58 | FromDiscord | <Gumber> avoid object oriented design and design patterns like the plague |
17:11:15 | FromDiscord | <Gumber> (edit) "avoid object oriented design and ... design" added "object oriented" |
17:11:31 | FromDiscord | <Gumber> really focus on data because your engine is just transforming a bunch of data |
17:11:47 | FromDiscord | <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:00 | FromDiscord | <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:12 | FromDiscord | <Fancy> sent a long message, see http://ix.io/3BVR |
17:22:41 | FromDiscord | <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:30 | FromDiscord | <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:58 | FromDiscord | <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:58 | FromDiscord | <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:52 | NimEventer | New 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:21 | FromDiscord | <haxscramper> https://forum.nim-lang.org/t/8508#55071> Please notice that the 1.6 release is officially scheduled for next Monday. |
18:32:14 | Pyautogui | Wow! |
18:50:27 | * | max22- joined #nim |
19:04:16 | FromDiscord | <Rika> In reply to @treeform "hmm I think a": Distinct void I think works |
19:36:15 | NimEventer | New 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:13 | FromDiscord | <Elegantbeef> Prestige you about, are any of the structs incomplete when you attempt to repr? |
20:27:32 | FromDiscord | <Elegantbeef> Cause like https://play.nim-lang.org/#ix=3BWG works fine |
20:32:22 | nrds | <Prestige99> hm let's see.. |
20:34:42 | nrds | <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:00 | nrds | <Prestige99> I've just modified an existing wrapper for chipmunk |
20:37:02 | FromDiscord | <Elegantbeef> I'll check it in a bit |
20:42:46 | Pyautogui | Noob question: When should I use a template versus an inline pragma? |
20:43:47 | Pyautogui | I am trying undertand the nim-bigints library use of the {.inline.} pragma. |
20:44:11 | * | neurocyte0132889 quit (Ping timeout: 264 seconds) |
20:44:36 | nrds | <Prestige99> thanks |
20:45:00 | nrds | <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:26 | FromDiscord | <Elegantbeef> Well you generally should default to the inline unless guaranteed inlining is a desired |
20:45:46 | FromDiscord | <Elegantbeef> templates certainly inline, whereas you're at the mercy of the compiler and your settings for the pragma |
20:46:04 | Pyautogui | Thanks. |
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:49 | FromDiscord | <Hamid Bluri> me:↵8 hours writing my ideal DSL↵1 hour |
22:13:05 | FromDiscord | <Hamid Bluri> 1 hour actually working on project |
22:13:25 | FromDiscord | <Hamid Bluri> (edit) "DSL↵1 hour" => "DSL" |
22:13:50 | FromDiscord | <Hamid Bluri> i cant even imagine the world without macro 😄 |
22:43:55 | * | Pyautogui quit (Quit: Connection closed) |
22:51:39 | FromDiscord | <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:37 | FromDiscord | <codic> I want to pass a `ptr cuchar` (as a string) to a C function, from an original nim `string` |
22:53:00 | FromDiscord | <codic> I tried `cast[ptr cuchar](nim_string)` and `cast[ptr cuchar](nim_string.unsafeAddr)` but neither works, what do I do? |
22:53:19 | FromDiscord | <codic> oh it seems I can do .cstring |
23:14:47 | * | audiophile_ joined #nim |
23:20:16 | FromDiscord | <Elegantbeef> Looking at the C and the bindings doesnt give me much reason to think this should cause this |
23:20:31 | FromDiscord | <Elegantbeef> Guess i should say a name like prestige for that above message |
23:23:12 | nrds | <Prestige99> Hey Elegantbeef - thanks |
23:23:21 | nrds | <Prestige99> I'm not sure where to go from here... |
23:23:48 | FromDiscord | <Elegantbeef> Well where is the C struct declared? |
23:25:15 | nrds | <Prestige99> aha! found it https://github.com/slembcke/Chipmunk2D/blob/master/include/chipmunk/chipmunk_structs.h#L225 |
23:25:28 | nrds | <Prestige99> Perhaps this is the issue, then. |
23:25:55 | nrds | <Prestige99> Presumably I need to add these members to the wrapper |
23:27:33 | FromDiscord | <Elegantbeef> Yea idk the minimal case of what you're doing ostensibly works https://play.nim-lang.org/#ix=3BXo |
23:29:47 | nrds | <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:33 | nrds | <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:53 | nrds | <Prestige99> (and PolyShape inherits from Shape) |
23:35:23 | Mister_Magister | Hi, 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:17 | Mister_Magister | i can probably use socket.sendTo to send to broadcast but how do i listen to broadcast? |
23:38:20 | * | Pyautogui joined #nim |
23:39:16 | FromDiscord | <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:42 | Mister_Magister | yep and nothing about receiving udp broadcast packets : |
23:41:44 | Mister_Magister | :/ |
23:42:05 | Mister_Magister | it literally says in the example "you can create a TCP server by calling the bindAddr and listen procedures" |
23:43:08 | Mister_Magister | i imagine i need to do something with this https://nim-lang.org/docs/net.html#recvFrom%2CSocket%2Cstring%2Cint%2Cstring%2CPort%2Cint32 |
23:43:16 | FromDiscord | <Elegantbeef> `newSocket` has an optional `protocol` and `sockType` |
23:44:09 | Mister_Magister | true |
23:44:49 | FromDiscord | <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:39 | Mister_Magister | i'm trying it as we speak :) thanks |
23:46:44 | Mister_Magister | hmm when using udp "Error: unhandled exception: Operation not supported" |
23:48:47 | Mister_Magister | ah can't call .listen |
23:49:07 | FromDiscord | <Elegantbeef> Yea udp is connectionless afterall |
23:49:17 | FromDiscord | <Elegantbeef> So you just do `recvFrom` |
23:50:03 | Mister_Magister | mhm |
23:50:12 | Mister_Magister | i got something to follow now, thanks! |
23:50:31 | Mister_Magister | i can prably figure it out from here |
23:51:17 | FromDiscord | <Elegantbeef> Yay the blind can lead the blind |
23:51:32 | Mister_Magister | :D |
23:51:37 | Mister_Magister | it's similar to rubberducking |
23:51:55 | Mister_Magister | i just needed something to bite |