00:00:03 | * | dv^_^ quit (*.net *.split) |
00:00:03 | * | supakeen quit (*.net *.split) |
00:00:03 | * | lucerne quit (*.net *.split) |
00:00:03 | * | kayabaNerve quit (*.net *.split) |
00:00:53 | * | Colt quit (Remote host closed the connection) |
00:01:54 | * | kayabaNerve joined #nim |
00:02:07 | * | kayabaNerve quit (Remote host closed the connection) |
00:02:14 | * | Colt joined #nim |
00:02:23 | * | supakeen joined #nim |
00:02:34 | * | kayabaNerve joined #nim |
00:02:43 | * | dv^_^ joined #nim |
00:04:45 | * | nrds quit (Ping timeout: 256 seconds) |
00:23:00 | * | rockcavera quit (Remote host closed the connection) |
00:26:31 | FromDiscord | <sOkam!> Is there any std library that can send raw inputs from code to the OS?↵Like sending specific mouse movements or keystrokes↵Or does that need an external lib? |
00:29:32 | FromDiscord | <Elegantbeef> There is not something like that in the stdlib that i know of, so yea you'd need an external library |
00:29:50 | FromDiscord | <Elegantbeef> SDL2 i believe can give you that abillity in a cross platform way, though could be wrong |
00:30:03 | FromDiscord | <Elegantbeef> You can also just use system calls of course |
00:32:52 | FromDiscord | <Elegantbeef> On unix i wager you can just write directly to the mouse device, windows probably has an API specifically for this |
00:35:27 | FromDiscord | <creikey> In reply to @sOkam! "Is there any std": For Linux uinput is low level but is very capable https://www.kernel.org/doc/html/v4.12/input/uinput.html |
00:43:59 | FromDiscord | <sOkam!> In reply to @creikey "For Linux uinput is": I'm super new to os interfacing and programming↵How would one go about communicating with uinput?↵_(im on lnx, so its what I'd use, since I can't find a ready made lib atm)_ |
00:44:15 | FromDiscord | <creikey> In reply to @sOkam! "I'm super new to": You call the functions in c |
00:44:25 | FromDiscord | <creikey> There's an example on that page |
00:44:32 | FromDiscord | <Elegantbeef> I mean you can do it in Nim |
00:44:41 | FromDiscord | <sOkam!> In reply to @creikey "You call the functions": i meant in nim. i can read the page just fine |
00:44:44 | FromDiscord | <Elegantbeef> The fun part is there is this library i found that wraps the code and is MIT licensed https://github.com/cjxgm/hiddle/blob/e407976bdfdefda397467fb94a7b22bd03924c4e/src/input.nim |
00:45:07 | FromDiscord | <Elegantbeef> So you can probably copy that module assuming you properly abide by MIT when you share it 😀 |
00:46:00 | FromDiscord | <Elegantbeef> There is also https://github.com/cjxgm/hiddle/blob/e407976bdfdefda397467fb94a7b22bd03924c4e/src/uinput.nim |
00:46:18 | FromDiscord | <sOkam!> :IF: i share it 😈 ↵But yeah, joke aside, tysm |
00:46:36 | FromDiscord | <creikey> In reply to @Elegantbeef "There is also https://github.com/cjxgm/hiddle/blob/": This doesn't seem like it has all the uinput enums |
00:46:48 | FromDiscord | <creikey> I remember it has a lot of stuff |
00:47:08 | FromDiscord | <Elegantbeef> Hey it's a start for a `uinput` package 😛 |
00:48:30 | FromDiscord | <Elegantbeef> I really need to be more productive cause i'm have tempted to run c2nim on this and nimify uinput \:d |
00:48:40 | FromDiscord | <Elegantbeef> half tempted even |
00:51:21 | FromDiscord | <Elegantbeef> I guess there is also https://github.com/luked99/libevdev.nim |
00:55:25 | FromDiscord | <sOkam!> In reply to @Elegantbeef "I really need to": How hard is it to make a wrapper with the automated tools like that one (or the other, cant remember the name)?↵Is it error prone, or what's the issue? Why are they not the norm, an people go for something more manual? |
00:55:47 | FromDiscord | <Elegantbeef> Well there are also things like futhark |
00:56:20 | FromDiscord | <Elegantbeef> More manual stuff is better imo since it's more idiomatic |
00:56:32 | FromDiscord | <Elegantbeef> You can always of course do the tool converted with a wrapping on top |
00:56:50 | FromDiscord | <sOkam!> ic |
00:57:32 | FromDiscord | <Elegantbeef> It does very much depend on what you're after |
00:58:09 | FromDiscord | <Elegantbeef> If you want to just use code then stuff like futhark is nice, but if you want have use Nim features and make it a bit more idiomatic you'll want to use something like c2nim then manually annotate it |
01:00:49 | FromDiscord | <Elegantbeef> For an instance of something you might do, C tends to use integers for bitsets, but Nim has proper bitset support so you might replace usages of that integer with `set[YourEnum]` |
01:03:21 | FromDiscord | <Elegantbeef> Another thing is using `distinct T` instead of just `T` in cases that there should be type safety (GPIO pins in a microcontroller stdlib for example) |
01:09:21 | * | nrds joined #nim |
01:10:58 | nrds | <Prestige99> Yeah the internet cut out |
01:11:09 | nrds | <sorcerer99> ah i see senior |
01:13:11 | FromDiscord | <Elegantbeef> I never though prestige was that old, but the more you learn |
01:14:08 | nrds | <sorcerer99> his social security number is in roman numerals |
01:18:22 | nrds | <Prestige99> Heh |
01:45:32 | FromDiscord | <creikey> In reply to @nrds "<sorcerer> his social security": My social security number opsec is horrible am I doomed |
01:57:18 | FromDiscord | <evoalg> there is c2nim? |
01:57:28 | FromDiscord | <Elegantbeef> There is |
01:57:54 | FromDiscord | <Rika> it cant convert everything though |
01:58:20 | FromDiscord | <Elegantbeef> Yea we're not going to get a tool converted linux kernel |
01:58:50 | FromDiscord | <evoalg> hehe ... still, nice to hear! |
01:59:03 | FromDiscord | <Rika> itll get you lets say maybe 90 or 95% of the way tho |
01:59:29 | FromDiscord | <evoalg> nice |
02:21:02 | * | arkurious quit (Quit: Leaving) |
02:24:43 | FromDiscord | <exelotl> hey I have a weird Nim doc issue... |
02:25:08 | FromDiscord | <exelotl> https://natu.exelo.tl/waitstates.html↵does anyone know why the "Source" links on the page don't work? The URL is valid, and you can right-click -> "open in new tab" to open it. But clicking it does nothing |
02:29:19 | FromDiscord | <Elegantbeef> `target="_blank"` is the culprit it seems\` |
02:31:58 | FromDiscord | <exelotl> weird... |
02:33:07 | FromDiscord | <Elegantbeef> Yea i dont have a degree in webology so cannot help any, maybe there is a way to override it |
02:43:40 | * | rockcavera joined #nim |
02:43:40 | * | rockcavera quit (Changing host) |
02:43:41 | * | rockcavera joined #nim |
02:47:00 | FromDiscord | <exelotl> here's the culprit: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox |
02:47:28 | FromDiscord | <exelotl> I can't change this because it's enforced by Sourcehut Pages ;_; |
03:46:40 | * | noeontheend joined #nim |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:31 | * | supakeen joined #nim |
04:12:18 | FromDiscord | <impbox [ftsf]> works when i middle click or ctrl click |
04:24:21 | * | nrds quit (Remote host closed the connection) |
04:24:36 | * | nrds joined #nim |
04:33:48 | FromDiscord | <the cws came hme> that's the same as right click open in new tab |
04:36:10 | * | sagax quit (Quit: Konversation terminated!) |
04:38:15 | * | _c quit (Ping timeout: 250 seconds) |
04:38:58 | * | noeontheend quit (Quit: noeontheend) |
04:39:11 | * | noeontheend joined #nim |
04:39:28 | * | _c joined #nim |
04:39:52 | * | _c is now known as Guest1971 |
05:43:35 | FromDiscord | <recreation> hello, anyone mind giving me a lil help |
05:44:32 | FromDiscord | <Elegantbeef> If you just ask it'll find it's way |
05:46:00 | FromDiscord | <recreation> sent a code paste, see https://play.nim-lang.org/#ix=3GDC |
05:46:30 | FromDiscord | <recreation> (edit) "https://play.nim-lang.org/#ix=3GDC" => "https://play.nim-lang.org/#ix=3GDD" |
05:46:40 | FromDiscord | <recreation> `integers.txt` is a text file with one integer per line |
05:46:49 | FromDiscord | <Elegantbeef> split lines might have an extra value |
05:47:35 | FromDiscord | <Elegantbeef> you dont parse integers so you're comparing characters |
05:50:06 | FromDiscord | <Rika> Beef are you okay |
05:50:08 | FromDiscord | <recreation> In reply to @Elegantbeef "you dont parse integers": ahhh that was the issue, i solved it now |
05:50:24 | FromDiscord | <Elegantbeef> What do you mean eika? |
05:50:26 | FromDiscord | <Elegantbeef> rika\ |
05:50:35 | FromDiscord | <recreation> thank you for the help! |
05:50:55 | FromDiscord | <Rika> That doesn’t seem to be the issue |
05:51:02 | FromDiscord | <Elegantbeef> Which? |
05:51:06 | FromDiscord | <Rika> Is it not because of -1 and then again ..< |
05:51:25 | FromDiscord | <Rika> Double subtraction hence the 1680 |
05:51:27 | FromDiscord | <Elegantbeef> Oh that probably is it |
05:51:34 | FromDiscord | <Elegantbeef> I read them backwards |
05:51:40 | FromDiscord | <recreation> it magically resolved itself when i added `.map(parseInt)`, so idk why e.e |
05:51:51 | FromDiscord | <Rika> Then you’re comparing strings? |
05:52:52 | FromDiscord | <Rika> Do we really have a string comparison operator |
05:52:53 | FromDiscord | <recreation> ye, i assumed the comparison will remain the same even if i dont parse them to int |
05:53:04 | FromDiscord | <Rika> Not necessarily I assume |
05:53:20 | FromDiscord | <Elegantbeef> The comparison is just length iirc |
05:53:25 | FromDiscord | <Rika> Isn’t this the lexical vs numerical comparison issue |
05:53:49 | FromDiscord | <Elegantbeef> It is lexical |
05:53:52 | FromDiscord | <Elegantbeef> So it is fine |
05:54:04 | FromDiscord | <recreation> sent a code paste, see https://play.nim-lang.org/#ix=3GDF |
05:54:07 | FromDiscord | <Elegantbeef> `var` |
05:54:11 | FromDiscord | <Elegantbeef> `let` is immutable |
05:54:35 | FromDiscord | <recreation> ahhh thats mbad haha, i hopped into it without reading the docs |
05:54:41 | FromDiscord | <recreation> thanks again |
06:07:50 | * | rockcavera quit (Remote host closed the connection) |
06:16:29 | * | energizer joined #nim |
06:16:34 | * | energizer left #nim (Leaving) |
06:26:47 | FromDiscord | <evoalg> @recreation one way to read in the lines and convert to ints (like the python program does) is to do:↵ `let data = readFile("integers.txt").splitLines().map(parseInt)` |
06:27:58 | FromDiscord | <Rika> That’s what he did ye |
06:27:59 | FromDiscord | <Rika> Yes |
06:28:06 | FromDiscord | <Rika> In reply to @recreation "it magically resolved itself": Here |
06:28:22 | FromDiscord | <evoalg> ahhh I missed that! |
06:28:27 | FromDiscord | <Elegantbeef> AoC is really going to encourage me to make ore iterator utilities |
06:28:45 | FromDiscord | <evoalg> Nice1 |
06:28:45 | FromDiscord | <Rika> Miner iterators |
06:29:28 | FromDiscord | <recreation> e.e i thought i hid it well that that was aoc |
06:29:39 | FromDiscord | <Elegantbeef> Not even close 😛 |
06:29:45 | FromDiscord | <Elegantbeef> I knew first glance it was aoc |
06:29:55 | FromDiscord | <recreation> haha i guess it was really obvious, finding the increase |
06:30:13 | FromDiscord | <recreation> i got bored after i finished it in python so i tried to rewrite it in nim |
06:30:23 | FromDiscord | <Rika> Any questions asked during AoC should be assumed to be about AoC lol |
06:30:40 | FromDiscord | <evoalg> lol true |
06:30:51 | FromDiscord | <Rika> I guess especially from someone new |
06:34:41 | FromDiscord | <evoalg> @recreation you can find some other nim solutions that you can compare yours to (after you've finished writing yours), which may help see what's possible in Nim, and also ask in here for tips before that 😉 |
06:36:53 | FromDiscord | <recreation> ye, i was trying to hack something together with `sum` and `zip` in nim and use one of those `block` thingies but failed terribly haha |
06:37:40 | FromDiscord | <recreation> i find nim pretty cool, plus i am on my holidays and learning it sounds fun |
06:45:11 | FromDiscord | <pyautogui> @recreation minor thing, generally I do believe inc(x) is prefered to x += 1 in Nim. |
06:49:39 | FromDiscord | <Rika> Use one or the other. Determine yourself which is more appropriate |
07:27:10 | FromDiscord | <pyautogui> Thanks. Good to know there is not a prefered standard. |
07:54:23 | * | Guest1971 quit (Quit: leaving) |
08:02:33 | FromDiscord | <evoalg> oh zip in Nim ... `zip(seq1, seq2)` works but not `zip(seq1, seq2, seq3)` |
08:03:02 | Amun-Ra | I use inc to increment by one += otherwise |
08:25:29 | * | neurocyte0132889 joined #nim |
08:25:29 | * | neurocyte0132889 quit (Changing host) |
08:25:30 | * | neurocyte0132889 joined #nim |
08:43:13 | FromDiscord | <@MaskRay:matrix.org> So I indeed run into the issue for my WIP ELF linker\: https://github.com/nim-lang/Nim/issues/19205 (`[arc] of operation segfaults for a ptr object containing traced reference`) |
08:46:17 | FromDiscord | <Elegantbeef> Hmm seems something doesnt check if the field is `nil` before a dereference i guess |
08:48:45 | FromDiscord | <Elegantbeef> Ah yes it seems `obj.isNil or` added to line 233 of `arc.nim` might be all that's needed |
08:49:18 | FromDiscord | <Elegantbeef> Hmm that could be wrong |
08:50:43 | FromDiscord | <Elegantbeef> The issue is actually the inheritance check it seems |
08:50:49 | FromDiscord | <Clonkk> If you have a nimble file with multiple binary is it possible to different options for each binary when using `nimble build` |
08:50:52 | * | advesperacit joined #nim |
08:52:51 | FromDiscord | <Elegantbeef> probably can get away with `yourNimFile.config.nims` |
08:57:15 | FromDiscord | <Clonkk> I assume you meant `yourNimFile.nim.cfg` ? |
08:58:18 | FromDiscord | <Elegantbeef> Which ever you prefer |
08:58:27 | FromDiscord | <Elegantbeef> Or is it `yourNimFile.nims` |
08:58:32 | FromDiscord | <Elegantbeef> I think it's that 😀 |
08:59:13 | FromDiscord | <Clonkk> .config.nims works as wel ? |
08:59:16 | FromDiscord | <Clonkk> Ah yeah |
08:59:24 | FromDiscord | <Clonkk> So many config file options |
09:02:36 | FromDiscord | <Elegantbeef> config.nims might not work |
09:02:44 | FromDiscord | <Elegantbeef> That's probably just a fever dream of mine |
09:03:09 | FromDiscord | <Clonkk> yourfile.nims works and the compiler documentation mentions yourfile.nim.cfg |
09:03:33 | FromDiscord | <Clonkk> yourfile.config.nims does not work |
09:04:56 | FromDiscord | <Elegantbeef> yea `config.nims` is used at the root of the project but would apply to everything |
09:05:07 | FromDiscord | <Elegantbeef> but `name.config.nims` is me being dumb |
09:05:30 | FromDiscord | <Clonkk> Eh I don't blame you, it's all very confusing |
09:05:37 | FromDiscord | <Clonkk> You can feel the legacy |
09:06:09 | FromDiscord | <Clonkk> I remember reading on the forums that .nims were then new recommanded way I think ? |
09:06:18 | FromDiscord | <Rika> pretty much afaik |
09:06:28 | FromDiscord | <Rika> but also afaik you can do things in cfg that you cant on nims |
09:06:52 | FromDiscord | <Clonkk> Such as ?↵(@Rika) |
09:07:16 | FromDiscord | <Rika> im not so sure anymore but i think i remember it being mentioned here a while back |
09:07:27 | FromDiscord | <Rika> i guess it doesnt matter until you hit the issue though |
09:11:51 | FromDiscord | <Elegantbeef> There was an issue that you couldnt use config for setting release flags but that applied to both |
09:13:39 | FromDiscord | <Clonkk> I think that's fixed nowadays ? |
09:14:14 | FromDiscord | <Clonkk> Or are we still limited to danger / Release being on the command line |
09:14:55 | FromDiscord | <Elegantbeef> It's been fixed iirc |
09:22:26 | advesperacit | When using testament, is there a way to set `cmd` to apply to all tests instead of repeating it in each test file? |
09:25:14 | advesperacit | It appears that I need `cmd: "nim c -r $options $file"` for third party imports to not break with "cannot open file" |
09:29:51 | * | PMunch joined #nim |
10:08:56 | FromDiscord | <tbrekalo> Is there a nicer way of writting this? https://media.discordapp.net/attachments/371759389889003532/915544985313632266/unknown.png |
10:12:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3oQs |
10:12:37 | FromDiscord | <Elegantbeef> https://github.com/beef331/slicerator |
10:12:39 | FromDiscord | <Elegantbeef> Shameless plug |
10:12:39 | nrds | <R2D299> itHub: 7"A simple iterator library to enable more efficient iterators" |
10:12:54 | FromDiscord | <Elegantbeef> Otherwise yea you've got to do that factory method |
10:13:13 | FromDiscord | <tbrekalo> So what's this doing? https://media.discordapp.net/attachments/371759389889003532/915546068509409291/unknown.png |
10:14:15 | FromDiscord | <Elegantbeef> I realize now you arent actually saving state |
10:15:04 | FromDiscord | <tbrekalo> in the second example I create a copy of a closure iterator and just call it? |
10:16:08 | FromDiscord | <Elegantbeef> well you instantiate it |
10:16:48 | FromDiscord | <tbrekalo> thanks |
10:20:21 | * | Vladar joined #nim |
10:25:14 | FromDiscord | <hmmm> our std xml facilities are imo very good but I'm missing the xpath facilities I had in python 🤔 |
10:25:19 | FromDiscord | <hmmm> rika pls add them |
10:25:26 | FromDiscord | <hmmm> you have 1 hour 🧐 |
10:28:45 | FromDiscord | <Rika> wtf |
10:28:59 | FromDiscord | <Rika> u do it |
10:37:37 | FromDiscord | <hmmm> I do it? I do not have the skills, you do it! |
10:38:08 | FromDiscord | <Rika> get the skills then |
10:38:15 | FromDiscord | <hmmm> it's not easy! |
10:38:56 | FromDiscord | <amadan> @hmmm is something like this what you are looking for?↵https://github.com/OpenSystemsLab/q.nim |
10:38:57 | nrds | <R2D299> itHub: 7"Query HTML/XML elements using a CSS3 or jQuery-like selector syntax" |
10:41:04 | FromDiscord | <hmmm> hmm it's not clear to me if it does what I want amadan. What I want is this https://docs.python.org/3/library/xml.etree.elementtree.html#elementtree-xpath |
10:41:24 | FromDiscord | <Rika> its close |
10:41:39 | FromDiscord | <hmmm> xpath is super comfy for people like me that suck at xml and stuff |
10:55:03 | PMunch | Gotta laugh a bit when I see things like this in C# code `[HttpPost("transfertask")] // POST /api/transfertask` |
10:55:36 | PMunch | And know that that comment explaining what this line does is almost exactly the code you'd use in Nim for the same result :) |
10:55:51 | PMunch | Just lowercase that POST and you're good |
10:56:25 | PMunch | Of course completely dropping the next line `public async Task<IActionResult> NewTransferTask()` |
11:00:58 | FromDiscord | <tbrekalo> is there something as python `reduce` from functools in vanilla nim? |
11:01:50 | PMunch | foldl? |
11:03:36 | PMunch | @tbrekalo ^ |
11:12:51 | FromDiscord | <tbrekalo> In reply to @PMunch "foldl?": but it takes a sequence as the argument; I just want to pass an iterator object |
11:14:42 | FromDiscord | <Rika> need 3rd party library then |
11:15:28 | PMunch | Or convert it to a seq first, although that's not the most efficient |
11:16:08 | PMunch | You have `foldl` in iterutils: https://github.com/def-/nim-iterutils/blob/master/src/iterutils.nim#L171 |
11:16:33 | FromDiscord | <tbrekalo> thanks guys 🙂 |
11:16:39 | PMunch | But that takes a proc.. |
11:17:07 | FromDiscord | <Rika> isnt that normal |
11:17:13 | PMunch | Sure |
11:17:23 | PMunch | But `foldl` in sequtils takes untyped |
11:17:33 | PMunch | And exposes the variables `a` and `b` |
11:21:42 | FromDiscord | <apahl> sent a long message, see http://ix.io/3BaQ |
11:27:32 | FromDiscord | <Rika> its not always true |
11:27:54 | FromDiscord | <Rika> ah |
11:27:55 | FromDiscord | <Rika> wait |
11:28:02 | FromDiscord | <Rika> of course the first element is the same address |
11:28:08 | FromDiscord | <Rika> ah wait no okay i get what you mean |
11:40:18 | PMunch | They aren't always copied |
11:41:43 | PMunch | Nim will pass any type by address if it is beneficial. The compiler doesn't allow you to change it anyways (as long as it's not `var`) so it's safe to do so. However if you take a seq argument and then do `var x = mySeqArg` and modify `x` then `x` will be a copy of `mySeqArg`. |
11:44:16 | FromDiscord | <apahl> Yes, that makes sense. |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:31 | * | supakeen joined #nim |
12:27:41 | * | kobi joined #nim |
12:29:41 | FromDiscord | <Rika> actually you dont even need to modify x |
12:29:45 | FromDiscord | <Rika> as long as x is var, its already copied |
12:34:02 | PMunch | Well, there is a change it gets optimised out isn't it? |
12:34:28 | PMunch | Or will it always copy if you do `var x = mySeqArg; echo x[0]`? |
12:40:14 | NimEventer | New thread by Miran: This Month with Nim: November, see https://forum.nim-lang.org/t/8667 |
12:45:23 | PMunch | @Yardanico, how's that Sciter testing going? |
12:45:44 | FromDiscord | <Yardanico> i missed it - did you reply with how you got it to compile? |
12:46:08 | FromDiscord | <Yardanico> the char16_t thing |
12:47:16 | FromDiscord | <apahl> In reply to @Rika "as long as x": If you change `let` to `var` in my example above, the address of the first element still stays the same, so not copied, I would say. |
12:47:49 | FromDiscord | <Yardanico> In reply to @apahl "If you change `let`": as you figured out, Nim can optimize the copy if it sees that it's safe, but unsafeAddr (as well as addr), is, well, unsafe :) |
12:47:57 | FromDiscord | <Yardanico> so this code just relies on internal implementation details |
12:47:59 | FromDiscord | <Yardanico> and is not guaranteed to work |
12:48:36 | FromDiscord | <apahl> Yes, I do not want to do anything with the address, I just was interested whether the sequence was copied or not. |
12:49:43 | FromDiscord | <apahl> And to be clear: I think it is very good, that the sequence does not unnecessarily get copied. |
12:52:40 | PMunch | Yardanico, sorry I missed that |
12:52:44 | PMunch | What was the problem? |
12:53:34 | FromDiscord | <Yardanico> Error: unknown type name 'char16_t' and I forgot how to solve it in futhark :) |
12:55:31 | FromDiscord | <Yardanico> that comes from opir, so I guess it actually comes from clang? |
12:55:40 | PMunch | Yup |
12:55:54 | PMunch | Could you share what you have so far? |
12:56:06 | FromDiscord | <Yardanico> in nimterop I had to do "-TBOOL=bool,char16_t=cushort,UINT=cuint,SBOOL=bool" btw |
12:56:15 | FromDiscord | <Yardanico> @PMunch just this: |
12:56:23 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GEK |
12:57:39 | FromDiscord | <Rika> In reply to @apahl "If you change `let`": thats not what i mean |
12:58:08 | FromDiscord | <Rika> if you make another var in the function, `x`, then let will have the same addr but var will not |
12:59:50 | kobi | hi |
13:01:47 | PMunch | Hello |
13:02:03 | kobi | how are you PMunch |
13:02:21 | PMunch | Well, I'm sick, but otherwise fine |
13:03:17 | kobi | ah, that's too bad |
13:04:07 | kobi | well, u know, i believe that when some gets sick, their karma is pushed out of their body, then they feel sickness and suffer, but afterwards they are healthier than before |
13:04:39 | * | src joined #nim |
13:05:03 | FromDiscord | <apahl> In reply to @Rika "if you make another": Ah, ok. True. Thanks for the clarification. |
13:05:13 | kobi | so all of it is good, anyway |
13:06:16 | NimEventer | New thread by Argl: Making a distinct type slightly less distinct, see https://forum.nim-lang.org/t/8668 |
13:08:04 | PMunch | kobi healthier than before sounds good, currently I can't even taste or smell anything.. |
13:10:02 | kobi | sorry to hear that, man |
13:11:30 | kobi | in israel we have a saying, something like: a trouble for many is a fool's comfort |
13:12:16 | kobi | it's like, if i told u, that i am currently unemployed. would it make u feel better? |
13:12:24 | kobi | :-) |
13:13:13 | kobi | Today I am attempting to understand async in Nim ... |
13:13:38 | FromDiscord | <Rika> any problems with undersatnding? |
13:13:50 | PMunch | @Yardanico, I also get that error, but it seems to build fine |
13:14:25 | FromDiscord | <Yardanico> huh, weird, opir does "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" and futhark can't parse that obviously :) |
13:14:28 | FromDiscord | <Yardanico> for me |
13:14:32 | FromDiscord | <Yardanico> after showing that error |
13:15:06 | kobi | Rika: hi Rika, can i ask in a private msg? |
13:15:24 | FromDiscord | <Yardanico> yes but you'll have to join discord :) |
13:15:40 | FromDiscord | <Yardanico> i mean even to have the possibility to pm to rika, idk if he'll agree |
13:15:43 | kobi | haven't irced in a long time |
13:16:42 | PMunch | Hmm, do you have the latest version, and Nim 1.6.0? |
13:17:22 | FromDiscord | <Yardanico> i have devel nim and latest futhark (0.3.1) |
13:17:49 | PMunch | kobi, of course that wouldn't make me feel better. Now I'm sick and sad that you're unemployed.. |
13:18:16 | kobi | apparently, you're not a fool, then :-) |
13:18:41 | kobi | it's ok, i am trying to start a side business |
13:19:01 | PMunch | Oh cool, what do you want to do? |
13:19:04 | kobi | still in feasability checking stage |
13:19:10 | FromDiscord | <Yardanico> @PMunch after I enabled stacktraces Nim says that SIGSEGV happens on line "var cursor = getTranslationUnitCursor(unit)" for me |
13:19:41 | kobi | well, writing portable apps for lin,win, android |
13:19:48 | FromDiscord | <Yardanico> and with `echo` i can indeed confirm that it stops on that call |
13:19:56 | kobi | technologically it is feasable. financially i don't know yet |
13:20:03 | FromDiscord | <Yardanico> that said, I have the latest clang 13.0.0 too |
13:20:19 | FromDiscord | <Yardanico> are you sure it should actually continue just fine after showing an error? |
13:21:25 | kobi | I am trying to create a general purpose lib for managing async requests, by making them feel very single threaded... think queues. |
13:22:39 | kobi | writing the manager is familiar to me, but I am missing a crucial bit. how to work with async and I want to basically wrap what the user passes |
13:23:07 | kobi | so that when the future succeeds it'll be added to a success queue, if failed to a failed queue, if timeout ... |
13:23:41 | kobi | so it's like a template where in between the user code i can add this code to "notify" the manager of the state. |
13:25:35 | kobi | still not working though. |
13:25:48 | kobi | Are there examples for async code out there? |
13:26:51 | PMunch | Yardanico, some errors are fine. It should error out on critical ones |
13:27:07 | PMunch | Hmm, I have clang 12.0.1 apparently |
13:27:26 | PMunch | But I wonder if I might've modified the clang Nim library at some point |
13:27:29 | PMunch | Just a sec |
13:28:10 | PMunch | kobi there should be quite a few examples of async code out there |
13:28:26 | PMunch | Have you seen my article on async and the tutorial page on it? |
13:28:37 | PMunch | Or even the Nim in Action chapter on async? |
13:35:27 | PMunch | Seems I didn't do anything to the clang library |
13:36:06 | * | sagax joined #nim |
13:36:08 | PMunch | Yardanico, could you try to install Futhark again? |
13:36:47 | kobi | ah ok i think i got it |
13:36:56 | FromDiscord | <Yardanico> hm, I tried it a few times, still doesn't work |
13:37:01 | FromDiscord | <Yardanico> is it supposed to change anything @PMunch ? |
13:37:16 | PMunch | Nah, just wanted to make sure you where on the latest version |
13:39:43 | PMunch | Bit surprised that I don't have 13.0.0 yet though |
13:40:33 | PMunch | Ah, just haven't updated my system |
13:40:38 | PMunch | I'll try with 13.0.0 |
13:43:15 | * | rockcavera joined #nim |
13:43:15 | * | rockcavera quit (Changing host) |
13:43:15 | * | rockcavera joined #nim |
13:44:37 | kobi | how do I add a timeout to an async request? |
13:45:06 | kobi | I see addTimer in asyncdispatch but not sure how to use |
13:46:33 | FromDiscord | <Yardanico> In reply to @kobi "how do I add": not sure what you mean |
13:46:38 | FromDiscord | <Yardanico> there's withTimeout |
13:46:47 | FromDiscord | <Yardanico> but it might not be what you want - https://nim-lang.org/docs/asyncdispatch.html#withTimeout%2CFuture%5BT%5D%2Cint |
13:48:11 | kobi | hmm |
13:48:38 | kobi | I forgot i can search github for code samples in advanced search |
13:52:27 | * | noeontheend quit (Ping timeout: 252 seconds) |
13:52:57 | kobi | why does addTimer needs an AsyncFD? |
13:57:18 | PMunch | Yardanico, hmm with the latest clang version I get the same results |
14:02:14 | PMunch | @Yardanico, here is what it ends up creating for me by the way: http://ix.io/3GFg |
14:02:26 | PMunch | You could try that for now |
14:02:51 | FromDiscord | <dom96> anything that takes an AsyncFD is a low-level proc, you likely don't want to use it |
14:09:54 | FromDiscord | <dithpri> So, I've been fiddling around with concepts, and I'd appreciate any explanation as to why this doesn't work (and how to make it work):↵https://play.nim-lang.org/#ix=3GFh |
14:12:34 | kobi | ok i think i've got it. |
14:12:53 | kobi | thanks dom96 |
14:13:45 | * | arkurious joined #nim |
14:20:34 | PMunch | Yardanico, it's kinda hard to figure out what's wrong when it works for me.. |
14:22:26 | PMunch | This is my sciter.nim file by the way: http://ix.io/3GFp |
14:22:58 | PMunch | sciter-js-sdk is git cloned from here: https://github.com/c-smile/sciter-js-sdk |
14:23:01 | nrds | <R2D299> itHub: 7"Sciter.JS - Sciter but with QuickJS on board instead of my TIScript" |
14:27:48 | PMunch | Oh hey, I appear to have my taste back |
14:28:45 | PMunch | Compiled with: nim c --maxLoopIterationsVM:100000000 sciter.nim |
14:29:49 | FromDiscord | <hmmm> is there somewhere a discord / telegram bot that for x activity will buld a mini calendar of people available dates for something? Like dinner with friends activity you tell the bot : sat or mon no sun. The bot keeps track and tries to fit a date |
14:30:10 | FromDiscord | <Yardanico> In reply to @hmmm "is there somewhere a": that's a question for #offtopic I think |
14:30:14 | FromDiscord | <hmmm> if it doesnt exist I will build it ffs I'm sick of all the peoples |
14:30:35 | FromDiscord | <hmmm> you are right, how do I transfer it there |
14:30:41 | FromDiscord | <Yardanico> just post a message there too :P |
14:30:51 | FromDiscord | <hmmm> 😋 |
14:30:57 | FromDiscord | <Yardanico> deleting the message here is pointless at this point, because messages are relayed to matrix and IRC |
14:31:04 | FromDiscord | <Yardanico> and irc doesn't have a feature to delete messages :) |
14:31:16 | FromDiscord | <Yardanico> so anything you post in this chat is saved forever, for everyone to see |
14:31:32 | FromDiscord | <hmmm> sorry boiz I didnt think it throu 😅 |
14:31:47 | FromDiscord | <Yardanico> no, it's fine |
14:31:57 | FromDiscord | <Yardanico> In reply to @PMunch "<@177365113899057152>, it's kinda hard": yeah, I don't really know either... |
14:32:15 | FromDiscord | <Yardanico> after cloning the same sciter repo again from scratch and using your code it still errors out |
14:32:26 | FromDiscord | <Yardanico> your clang is 13.0.0 right? since you're on arch |
14:37:15 | PMunch | Yup |
14:37:43 | PMunch | And Nim 1.6.0 |
14:38:45 | * | fputs2 joined #nim |
14:41:02 | * | fputs quit (Ping timeout: 252 seconds) |
14:41:02 | * | fputs2 is now known as fputs |
14:59:17 | FromDiscord | <dain> can you override the `[]` like you can in python? |
14:59:26 | FromDiscord | <Yardanico> yes |
15:00:28 | FromDiscord | <Yardanico> obviously in real code you wouldn't return the key itself :) |
15:00:47 | FromDiscord | <Yardanico> and to export the operator you use the asterisk |
15:01:13 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/9ov |
15:01:18 | kobi | thanks guys for the help and moral support ;-) see you later! |
15:01:19 | FromDiscord | <Yardanico> So that if other modules import this module, they get access to `[]`. Don't forget to export `MyType` too if you want that though |
15:01:26 | * | kobi quit (Quit: Leaving) |
15:01:33 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/arG |
15:15:29 | FromDiscord | <dain> what if other modules don't import my module |
15:16:03 | FromDiscord | <dain> like suppose in some stdlib module there is `foo[x]` and I override `[]` so that it works with the type of `x` |
15:16:12 | FromDiscord | <Yardanico> In reply to @dain "what if other modules": i was talking specifically about if other modules want to use your type and your [] |
15:16:19 | FromDiscord | <Yardanico> if they don't import your module, they won't be able to use it obviously |
15:16:49 | FromDiscord | <dain> oh |
15:16:58 | FromDiscord | <dain> so i can't use it like static duck typing? |
15:18:40 | FromDiscord | <Yardanico> can't say I really understood your question, but you can use generics as "static duck typing" |
15:18:47 | FromDiscord | <Yardanico> but only for procs that actually accept something generic |
15:19:58 | Amun-Ra | dain: you can have concepts that work pretty similar |
15:20:07 | FromDiscord | <Yardanico> you can't have your operator "propagate" to all modules, they need to import your module explicitly |
15:20:19 | FromDiscord | <Yardanico> @Amun-Ra they're still generics though, but yes |
15:21:06 | FromDiscord | <dain> well in this julia talk https://www.youtube.com/watch?v=kc9HwsxE1OY↵they have a pre-existing algorithm that uses a generic matrix multiplication. they create a special vector type and define a function for matrix-vector product that is optimized for their special vector type. they pass the vector into the pre-existing algorithm and it automatically uses the optimized implementation for that type |
15:21:08 | nrds | <R2D299> outube: 7"JuliaCon 2019 | The Unreasonable Effectiveness of Multiple Dispatch | Stefan Karpinski" |
15:21:31 | FromDiscord | <dain> despite the existing algorithm not having any knowledge of this type or the optimized multiplication implementation |
15:22:05 | FromDiscord | <Yardanico> In reply to @dain "well in this julia": well, as i said, use generics if you want this |
15:22:16 | FromDiscord | <Yardanico> they are using generics, it's just that in julia if you omit the types you get a generic function it seems like |
15:22:29 | FromDiscord | <dain> ah okay |
15:22:43 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#generics |
15:24:25 | FromDiscord | <Yardanico> so if you make a `proc call[T](data: T)` it'll accept a value of any type, but of course it will only work if the type has all the necessary procedures/fields that you are using inside the proc |
15:24:39 | FromDiscord | <Yardanico> concepts help with that - they allow you to _specify_ what exactly do you want in a type for the proc to work for it |
15:24:56 | FromDiscord | <Yardanico> https://nim-lang.github.io/Nim/manual_experimental.html#concepts |
15:25:18 | FromDiscord | <Yardanico> just don't forget that concepts are a purely compile-time thing and don't exist on runtime, so you can't do seq[MyConcept] |
15:25:26 | * | Vladar quit (Remote host closed the connection) |
15:26:42 | * | lumo_e joined #nim |
15:31:46 | FromDiscord | <dain> hm |
15:32:25 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GFZ |
15:33:12 | FromDiscord | <dain> `sum` is already generic but the return type has to be the same, i.e. sum over sequence of ints must be an int |
15:33:18 | FromDiscord | <dain> but here i have bool,bool->int |
15:33:23 | FromDiscord | <dain> and i don't know how to annotate it |
15:33:50 | FromDiscord | <dain> (edit) "`sum` ... is" added "in the math module" |
15:34:48 | FromDiscord | <Yardanico> In reply to @dain "okay so how do": not sure what you mean, your return type is just `int` isn't it? |
15:35:04 | FromDiscord | <dain> yes but when I'm defining `sum` I don't know that yet, do I? |
15:35:08 | FromDiscord | <dain> because it's generic |
15:35:33 | FromDiscord | <dain> like i could make bool+bool return a string if i wanted to |
15:35:58 | FromDiscord | <Rika> `sum[T, U](x: openArray[T]): U` ? |
15:36:08 | FromDiscord | <Yardanico> that'll require you to specify the return type manually |
15:36:12 | FromDiscord | <Rika> which is basically just the auto one too |
15:36:17 | FromDiscord | <Rika> just explicit |
15:36:22 | FromDiscord | <Rika> not sure what you want to be honest |
15:36:31 | FromDiscord | <Yardanico> i get what you want @dain , wait a bit |
15:36:39 | FromDiscord | <dain> In reply to @Rika "`sum[T, U](x: openArray[T]): U`": that was the first thing I tried, it said it couldn't instantiate `U` or something |
15:36:39 | FromDiscord | <Yardanico> i'm sure this can be made to work through typeof |
15:36:53 | FromDiscord | <Rika> ah yeah |
15:36:55 | FromDiscord | <Rika> i get why] |
15:36:57 | FromDiscord | <Yardanico> In reply to @dain "that was the first": yeah nim doesn't have return type inference |
15:36:58 | FromDiscord | <Rika> dumb mistake |
15:37:00 | FromDiscord | <Rika> sorry |
15:37:05 | FromDiscord | <Yardanico> so you can't do it the U way |
15:37:13 | FromDiscord | <Rika> auto is the only way i assume |
15:38:47 | * | lumo_e quit (Ping timeout: 252 seconds) |
15:39:14 | FromDiscord | <Yardanico> @Rika auto won't work here because `result` is of an unkown type |
15:39:17 | FromDiscord | <Yardanico> (edit) "unkown" => "unknown" |
15:40:08 | FromDiscord | <dain> yeah I wondered if there was a way to ask the compiler about the return type and use that |
15:40:15 | FromDiscord | <Yardanico> @dain this works but I'm not sure it's the best way |
15:40:22 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GG0 |
15:40:29 | FromDiscord | <Yardanico> the first line in the proc is to hint to the compiler what the return type should be |
15:40:45 | FromDiscord | <dain> `result = default(typeof(default(T) + default(T)))` <- perfect, this is what I was thinking of |
15:40:48 | FromDiscord | <Yardanico> sadly `typeof(default(T) + default(T))` as the return type doesn't seem to work |
15:40:53 | FromDiscord | <Yardanico> but it works in the proc body |
15:40:56 | FromDiscord | <dain> oh :( |
15:41:04 | FromDiscord | <dain> oh :) |
15:41:34 | FromDiscord | <Yardanico> basically you ask typeof for the type returned by + for two T's |
15:41:39 | FromDiscord | <Yardanico> and then assing default of that type to result |
15:41:50 | FromDiscord | <Yardanico> default for types is just the zeroed value, so for basic value types it's all 0 |
15:41:55 | FromDiscord | <Yardanico> for ref types it'll be nil for example |
15:42:06 | FromDiscord | <dain> hm |
15:42:46 | FromDiscord | <dain> is there a way to get the return type purely from the type information? rather than instantiating the zero-values and then adding them and reflecting on the return type |
15:43:03 | FromDiscord | <Rika> not really |
15:43:26 | FromDiscord | <dain> like some kind of function where I can ask the compiler:↵↵`return_type_of(some_func, T, U, V, ...)` |
15:43:42 | FromDiscord | <dain> would be useful |
15:43:53 | FromDiscord | <Rika> doesnt really work |
15:44:29 | FromDiscord | <Rika> nim has argument name overloading so in some (admittedly very rare) cases that wouldnt work↵though i guess it could just error when it does |
15:45:11 | FromDiscord | <dain> what is argument name overloading |
15:45:55 | FromDiscord | <Rika> proc (a: int, b: int) and proc (a: int, x: int) can be distinguished by `call(1, x = 0)` or `call(1, b = 0)` |
15:46:41 | FromDiscord | <dain> oh damn |
15:46:55 | FromDiscord | <Rika> ...i think its still there |
15:47:01 | FromDiscord | <Rika> not sure if it was ever removed or whatever |
15:47:03 | FromDiscord | <Yardanico> @dain as I thought, that example can be made to work with concepts |
15:47:14 | FromDiscord | <dain> well maybe it could be `return_type_of(some_func, a=T, b=U)` |
15:47:18 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GG5 |
15:47:59 | FromDiscord | <Yardanico> MyType.T here is syntax for getting the type parameter for an implicit generic type |
15:48:12 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GG6 |
15:48:16 | FromDiscord | <Yardanico> you can have it as `func sum[T](x: openArray[MyType[T]]): T =` instead (with same concept definition) |
15:48:44 | FromDiscord | <Yardanico> In reply to @dain "i dont understand what": concepts are basically constraints for types |
15:49:06 | FromDiscord | <dain> so in this case we could call `MyType[T]` `Summable[T]` or something? |
15:49:18 | FromDiscord | <Yardanico> i guess, yeah |
15:49:25 | FromDiscord | <Yardanico> but usually summables return the sum of the same type |
15:49:28 | FromDiscord | <dain> well more like `SummableTo[T]` |
15:49:32 | FromDiscord | <Yardanico> yeah |
15:50:28 | FromDiscord | <Yardanico> just keep in mind that concepts are (still) experimental and the change that you'll get a compiler crash when using them is higher than in normal code :) |
15:50:33 | FromDiscord | <Yardanico> (edit) "change" => "chance" |
15:51:06 | FromDiscord | <TryAngle> @Yardanico ↵hi sorry for interfering,↵how stable are concepts right now as they're still experimental & is there a roadmap / general idea when they'll be stabilized? |
15:51:34 | FromDiscord | <Yardanico> I can't say for sure, but in https://github.com/nim-lang/RFCs/issues/437 they're in stretch goals |
15:51:51 | FromDiscord | <Yardanico> and about the stability - well, it's hard to judge, when they work, they work |
15:52:07 | FromDiscord | <Yardanico> you can check open issues with the Concepts label - https://github.com/nim-lang/Nim/issues?q=is%3Aopen+is%3Aissue+label%3AConcepts |
15:52:16 | FromDiscord | <dain> there are some other places where you could conceivably have a sum that returns something of a different type. e.g. char+char->string |
15:53:14 | FromDiscord | <TryAngle> because if they get stable I don't think I would ever use something other than nim again 😂 |
15:53:17 | FromDiscord | <TryAngle> In reply to @Yardanico "you can check open": thanks |
15:59:23 | FromDiscord | <dain> on a completely other topic |
15:59:27 | FromDiscord | <dain> does nim have a mascot? |
16:00:04 | FromDiscord | <Yardanico> no |
16:00:15 | FromDiscord | <Yardanico> there were some proposed designs but nothing was made official :) |
16:00:32 | FromDiscord | <dain> i would buy a nim plushie |
16:00:36 | FromDiscord | <dain> whatever the animal is |
16:01:10 | FromDiscord | <Yardanico> just buy a crown instead :P |
16:04:42 | FromDiscord | <IsaacPaul> How I support nim: "Treat yourself... king" 🤴 ↵😂 |
16:20:13 | FromDiscord | <dithpri> sent a code paste, see https://play.nim-lang.org/#ix=3GGs |
16:39:19 | FromDiscord | <IsaacPaul> o.O |
16:39:22 | FromDiscord | <IsaacPaul> I don't see the bug |
16:39:43 | FromDiscord | <IsaacPaul> wait |
16:43:24 | FromDiscord | <IsaacPaul> I think m[K] is not Stringifiable? |
16:43:46 | FromDiscord | <IsaacPaul> It looks like you're using a type as a key when you need to use a key as a key? but idk |
16:48:40 | FromDiscord | <IsaacPaul> having generics and [] accessor use the same characters [] is kinda confusing but I think that's what's going on. I just don't have time to research and verify. |
16:58:32 | FromDiscord | <Recruit_main707> what happens if you do \`[]`(m, K)? |
17:00:06 | FromDiscord | <dain> how do I specify that a parameter can just be anything that can be iterated over |
17:00:17 | FromDiscord | <dain> I tried `iterator[T]` and `iterable[T]` but they didn't work |
17:00:55 | FromDiscord | <Yardanico> one way is |
17:01:05 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GGR |
17:01:07 | FromDiscord | <dain> :D neat |
17:01:11 | FromDiscord | <Yardanico> but this just ensures that the type has `items` defined for it |
17:01:14 | FromDiscord | <dain> let me try that |
17:01:17 | FromDiscord | <Yardanico> so you can just say |
17:01:55 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GGS |
17:02:22 | FromDiscord | <Yardanico> i actually used that concept in https://github.com/Yardanico/nimpylib/blob/master/src/pylib.nim#L27 (that whole pylib module is really made just for fun though, don't use it in real projects :P) |
17:02:29 | FromDiscord | <dain> doesn't x.items give an iterable over T and not the T itself? |
17:02:47 | FromDiscord | <Yardanico> it |
17:02:56 | FromDiscord | <Yardanico> it's the return type of the `items` iterator |
17:03:08 | FromDiscord | <Yardanico> so it's T since we don't exactly know it |
17:06:24 | FromDiscord | <dain> awesome |
17:06:26 | FromDiscord | <dain> so i can do this |
17:06:35 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GGT |
17:06:46 | FromDiscord | <dain> overload `[]` to take a function |
17:06:56 | FromDiscord | <Yardanico> xdddd |
17:07:08 | FromDiscord | <Yardanico> that is an... interesting usage of `[]` |
17:07:09 | FromDiscord | <dain> although it breaks if i use `=>` |
17:07:12 | FromDiscord | <Yardanico> never seen before |
17:07:29 | FromDiscord | <dain> pandas has it |
17:07:34 | FromDiscord | <Yardanico> i mean it's obvious that this works because an anonymous procedure is a first class value just like a string |
17:07:42 | FromDiscord | <Yardanico> In reply to @dain "pandas has it": yes but nim is not pandas :) |
17:07:43 | FromDiscord | <dain> although it works differently, the argument is the whole array rather than an individual element |
17:07:54 | FromDiscord | <Yardanico> you can have templates and a lot of other stuff instead of overloading [] |
17:08:25 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GGU |
17:08:37 | FromDiscord | <dain> `Error: A nested proc can have generic parameters only when it is used as an operand to another routine and the types of the generic paramers can be inferred from the expected signature.` |
17:08:45 | FromDiscord | <Yardanico> yes, because nim can't figure out the types |
17:09:59 | FromDiscord | <Yardanico> while not exactly what you want, have you seen https://github.com/zero-functional/zero-functional? |
17:10:00 | FromDiscord | <Yardanico> (edit) "https://github.com/zero-functional/zero-functional?" => "https://github.com/zero-functional/zero-functional ?" |
17:10:01 | nrds | <R2D299> itHub: 7"A library providing zero-cost chaining for functional abstractions in Nim." |
17:10:02 | nrds | <R2D299> itHub: 7"A library providing zero-cost chaining for functional abstractions in Nim." |
17:10:20 | FromDiscord | <dain> ive heard of it but not looked in great detail |
17:18:02 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3GGY |
17:18:15 | FromDiscord | <Yardanico> nope |
17:18:23 | FromDiscord | <TryAngle> ok ty |
17:19:02 | FromDiscord | <Yardanico> that said, I'd recommend using https://nim-lang.github.io/fusion/src/fusion/matching.html for matching object variants so that you do less mistakes (accessing the wrong branch, etc) |
17:19:32 | FromDiscord | <TryAngle> I've read fusion was "dead" |
17:19:39 | FromDiscord | <TryAngle> is that not the case "anymore" |
17:19:42 | FromDiscord | <TryAngle> (edit) ""anymore"" => ""anymore"?" |
17:19:49 | FromDiscord | <haxscramper> yes, it is dead |
17:20:05 | FromDiscord | <haxscramper> you just won't get new fixes unless someone moves their fat ass |
17:20:17 | FromDiscord | <haxscramper> most likely this won't happen though |
17:20:52 | FromDiscord | <haxscramper> I moved pattern matching here https://haxscramper.github.io/hmisc/hmisc/macros/matching.html |
17:22:03 | FromDiscord | <haxscramper> I mean, it is not even on the roadmap |
17:22:10 | FromDiscord | <TryAngle> hmm haven't felt the need for extra matching libraries yet but will look into it maybe |
17:22:24 | FromDiscord | <haxscramper> it is not "extra" matching library |
17:22:26 | FromDiscord | <Yardanico> In reply to @TryAngle "hmm haven't felt the": I mean it'll be pretty useful if you're doing a lot of stuff with object variants |
17:22:30 | FromDiscord | <haxscramper> it is the "official" library |
17:22:36 | FromDiscord | <haxscramper> that I just don't want to die |
17:23:17 | FromDiscord | <haxscramper> anyway, just for using variant objects it is not necessary |
17:23:32 | FromDiscord | <Yardanico> yeah, I didn't say it's necessary, just that it's useful |
17:23:33 | FromDiscord | <haxscramper> and `case` thing does not add readability either |
17:23:41 | FromDiscord | <haxscramper> why in the world did I even use this feature |
17:23:56 | FromDiscord | <TryAngle> In reply to @Yardanico "I mean it'll be": might be I'm working a markdown-like parser, so nothing that huge↵but if I have somehting huge, I will sure look into it thanks! |
17:24:01 | FromDiscord | <Yardanico> In reply to @TryAngle "might be I'm working": oh, okay |
17:24:18 | FromDiscord | <Yardanico> for some "inspiration" we have https://github.com/kyoheiu/nmark and https://github.com/soasme/nim-markdown |
17:24:20 | nrds | <R2D299> itHub: 7"A fast markdown converter, based on CommonMark, written in Nim." |
17:24:25 | FromDiscord | <Yardanico> the latter seems to be more popular, but quite overengineered |
17:25:34 | FromDiscord | <TryAngle> In reply to @Yardanico "for some "inspiration" we": thanks!↵also MIT License 😳 |
17:25:40 | FromDiscord | <Yardanico> is that not ok? |
17:25:46 | FromDiscord | <Yardanico> Nim itself is MIT, and most libraries for it are MIT |
17:25:49 | FromDiscord | <TryAngle> no that's a good thing XD |
17:28:21 | FromDiscord | <Yardanico> nmark is about 5 times faster than nim-markdown but it doesn't pass all commonmark tests |
17:30:11 | FromDiscord | <Yardanico> nmark itself is also around 10% faster when compiled with orc, but markdown is much much much slower with orc, but that's not its fault |
17:30:27 | FromDiscord | <Yardanico> it's just because methods are at least 10x slower under orc than in refc |
17:31:24 | FromDiscord | <TryAngle> ah I see, I will look into them 😄 |
17:31:53 | PMunch | soasme/nim-markdown is pretty neat |
17:31:58 | PMunch | Quite extensible |
17:32:21 | PMunch | I wanted to use it for a small thing, but I couldn't get Gtk to show a webview properly |
17:32:31 | FromDiscord | <Yardanico> well nmark actuall does have an AST representation too :) |
17:33:09 | FromDiscord | <Yardanico> the problem with markdown is that it uses methods extensively, and also pcre |
17:33:20 | FromDiscord | <Yardanico> nmark is built on procs with pure-nim `regex` module and is fater |
17:33:22 | FromDiscord | <Yardanico> (edit) "fater" => "faster" |
17:33:45 | PMunch | Pro of markdown is that you can add/remove features to your liking very easily |
17:33:56 | PMunch | Haven't tried nmark though, might be possible there as well |
17:34:40 | FromDiscord | <Yardanico> ah yeah, nmark doesn't have that, but it shouldn't be hard to add to the library |
17:37:13 | FromDiscord | <TryAngle> In reply to @PMunch "Pro of markdown is": that was why I started using it but the combination of some plugins is just so tiresome at least in VSC that I jsut can't anymore |
17:37:36 | PMunch | Huh? |
17:37:38 | FromDiscord | <Yardanico> did you mean markdown as in the format itself? we were talking about the library :P |
17:37:49 | FromDiscord | <TryAngle> ah yes I mean markdown itself XD |
17:37:53 | PMunch | Ah right :P |
17:38:03 | PMunch | soasme/nim-markdown |
17:38:04 | FromDiscord | <Yardanico> since nim doesn't have a lot of packages, packages get to "occupy" nice names |
17:38:10 | FromDiscord | <TryAngle> thought the last comment was about it |
17:38:13 | FromDiscord | <Yardanico> e.g. soasme's nim-markdown is just `nimble install markdown` |
17:39:20 | PMunch | What did you replace markdown (the tech) with @TryAngle |
17:41:11 | FromDiscord | <narimiran> hey PMunch! will you stream your AoC solving this year? |
17:44:00 | FromDiscord | <TryAngle> In reply to @PMunch "What did you replace": well I'm working on implementing the most basic things atm and learning the lang nim (it's my first project with it), got some things working already aswell...↵but mainly I want to remove the need for html and get KaTeX working.. maybe also make some parts of KaTeX easier to write but idk yet.. I really dont like the constant need for `\begin{..} ... \end{..}` and also I don't like typing ` |
17:44:29 | PMunch | Don't think so unfortunately :( I'm not living alone any longer, and I fear it might be a bit disruptive if I stream for two hours every day in the living room :P |
17:44:37 | PMunch | But I can do today :) |
17:45:01 | FromDiscord | <narimiran> congrats? 🙂 |
17:47:34 | * | lumo_e joined #nim |
17:53:16 | PMunch | Haha, congrats is correct :P |
17:53:48 | PMunch | Moving in with my new girlfriend, haven't hit hard times and have to rent out a room to a stranger |
17:54:30 | FromDiscord | <narimiran> congrats! |
17:57:04 | anddam | howdy, back again at using imgui binding, I installed nimgl/imgui from repo, using nimble, then try to run tests/test.nim for starters |
17:57:30 | anddam | I used nim cpp test.nim in order to use the native library and not the C wrapper |
17:58:35 | anddam | I have a missing library (and rightfully so) since I do not have imgui header installed, but am I supposed to install in one of the "default" nim looking path? |
17:59:25 | FromDiscord | <Yardanico> what error do you get? nimgl/imgui ships imgui with itself |
17:59:26 | anddam | case in point the failing line has -I/home/anddam/Development/Nim/nimgl-imgui-git/src/imgui/private/cimgui -I/home/anddam/.choosenim/toolchains/nim-1.6.0/lib -I/home/anddam/Development/Nim/nimgl-imgui-git/tests |
17:59:51 | FromDiscord | <Yardanico> can you show the full output of the error? you can post to some pasting service |
18:00:16 | FromDiscord | <Yardanico> how did you install imgui btw? |
18:00:21 | FromDiscord | <Yardanico> did you `git clone` it by any chance? |
18:01:04 | anddam | https://termbin.com/kct2 |
18:01:05 | FromDiscord | <Yardanico> if so, you probably didn't do `git clone --recursive` which is required because cimgui is a git submodule of nimgl/imgui |
18:01:06 | PMunch | @narimiran, dinner first, then stream I think :) |
18:01:14 | anddam | oh the submodules |
18:01:26 | PMunch | Oh damn, it's 7PM already :S |
18:01:32 | FromDiscord | <Yardanico> it shows nimble direct isntall just below btw @anddam |
18:01:35 | FromDiscord | <Yardanico> (edit) "isntall" => "install" |
18:01:38 | anddam | I installed by simple git clone, but not nimgl, just nimgl/imgui's repo |
18:01:38 | FromDiscord | <Yardanico> in the readme i mean |
18:01:40 | FromDiscord | <narimiran> ah, later on i'll have to do my family obligations, so i'll probably miss it |
18:02:18 | FromDiscord | <narimiran> but hopefully you'll do it in the following days too 🙂 (when the tasks are easy and solvable in ~15 min) |
18:02:18 | anddam | mmm I think I used nimble install |
18:02:32 | anddam | can I force install over it using nimble just to be sure? |
18:02:58 | FromDiscord | <Yardanico> if you already have a git repo you can do `git submodule update --init --recursive` and then run `nimble install` again |
18:03:10 | FromDiscord | <Yardanico> you can also just do `nimble install https://github.com/nimgl/imgui.git` to let nimble do the cloning by itself |
18:03:41 | * | krux02 joined #nim |
18:03:43 | anddam | I checked shell history, I had installed with nimble in first place, and I have overwrote it now |
18:05:39 | anddam | ok, I get the very same output by running nim cpp tnull.nim |
18:05:48 | anddam | whereas test.nim lacks nimgl/opengl |
18:06:02 | anddam | installing nimgl with nimble now |
18:06:56 | anddam | and now the various X dev packages |
18:08:11 | anddam | Yardanico: I remember you told me that the C API required building cimgui lib, whereas the cpp backend would work without any specific lib |
18:08:17 | FromDiscord | <Yardanico> yes |
18:08:38 | FromDiscord | <Yardanico> but you need something like opengl to _output_ imgui to something |
18:08:50 | anddam | and I did install that |
18:09:05 | anddam | I still have the missing imgui/imgui.h header |
18:09:26 | anddam | what I do not get are these inclusion options -I/home/ada/Development/Nim/nimgl-imgui-git/src/imgui/private/cimgui -I/home/ada/.choosenim/toolchains/nim-1.6.0/lib -I/home/ada/Development/Nim/nimgl-imgui-git/tests |
18:09:49 | FromDiscord | <Yardanico> is there a problem with them? they seem normal |
18:10:08 | FromDiscord | <Yardanico> also I just did `nimble install https://github.com/nimgl/imgui` and imgui works for me |
18:10:10 | FromDiscord | <Yardanico> the test.nim |
18:10:52 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHj |
18:11:20 | FromDiscord | <Yardanico> because `lines` itself is an iterator |
18:11:32 | FromDiscord | <dain> yeah that's what I want |
18:11:34 | FromDiscord | <dain> i want to map over it |
18:11:37 | FromDiscord | <dain> lazily |
18:12:24 | anddam | Yardanico: the problem is those are "odd" paths for me to provide the library |
18:12:44 | FromDiscord | <Yardanico> why? they're perfectly normal |
18:12:50 | FromDiscord | <Yardanico> since imgui lib bundles the imgui itself |
18:12:55 | FromDiscord | <Yardanico> so it needs imgui include files to compile |
18:13:12 | FromDiscord | <Yardanico> In reply to @dain "yeah that's what I": well this wasn't even possible before nim 1.6, but now you can use `iterable[T]` to at least pass an iterator like that to a template, not an iterator though |
18:13:15 | anddam | I am missing something |
18:13:50 | FromDiscord | <dain> In reply to @Yardanico "well this wasn't even": i don't understand why the thing i'm passing to map (the result of `lines`) isn't matching the concept I defined |
18:13:55 | FromDiscord | <Yardanico> for me it uses `g++ -c -std=gnu++14 -funsigned-char -w -fmax-errors=3 -fpermissive -I/home/dian/.nimble/pkgs/imgui-1.84.2/imgui/private/cimgui -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS=1 -D_GLFW_X11 -I/home/dian/Things/nim/lib -I/home/dian/Projects/nmark -o /home/dian/.cache/nim/fa_d/imgui_demo.cpp.o /home/dian/.nimble/pkgs/imgui-1.84.2/imgui/private/cimgui/imgui/imgui_demo.cpp` to compile and works |
18:14:12 | FromDiscord | <Yardanico> In reply to @dain "i don't understand why": because default nim iterators are inline iterators, they're not really first class values |
18:14:17 | FromDiscord | <dain> oh |
18:14:34 | FromDiscord | <dain> so how do you lazily map over them? |
18:14:40 | anddam | Yardanico: -I/home/dian/.nimble/pkgs/imgui-1.84.2/imgui/private/cimgui is saner since it points to .nimble |
18:14:51 | FromDiscord | <Yardanico> but that's because I installed with `nimble install` |
18:15:03 | FromDiscord | <Yardanico> did you perhaps do `nimble develop` in the past? maybe that's why it still links to your own dir |
18:15:12 | FromDiscord | <Yardanico> but it should've overwritten it anyway, hm |
18:15:21 | FromDiscord | <Yardanico> In reply to @dain "so how do you": well, as I said, with nim 1.6 you can use a template with `iterable[T]` |
18:15:40 | anddam | I don't think so, I didn't even have nim on this system until a few minutes ago |
18:16:09 | FromDiscord | <dain> In reply to @Yardanico "well, as I said,": how does it work with a template? can I still use yield inside? if not what do I replace it with |
18:16:37 | FromDiscord | <Yardanico> In reply to @anddam "I don't think so,": so again, did you do `nimble install https://github.com/nimgl/imgui` or not? |
18:16:44 | FromDiscord | <Yardanico> it will take a while and you shouldn't ctrl+c it |
18:16:51 | FromDiscord | <Yardanico> because it clones recursively and takes some time to finish cloning |
18:17:07 | FromDiscord | <Yardanico> if you installed `nimgl`, you need to refer to imgui in it with `nimgl/imgui` because that's a different module |
18:17:11 | anddam | Yardanico: yes, I did. I did not kill the process |
18:17:38 | anddam | I have now removed all nimble packages using 'nimble remove' |
18:17:52 | anddam | I have zero packages listed using --install and will try again |
18:18:30 | anddam | https://termbin.com/8ogb |
18:18:36 | anddam | took ~20 seconds |
18:18:58 | FromDiscord | <Yardanico> yep |
18:19:15 | anddam | ok, now I get the test.nim file, only the file and not the whole repo |
18:19:17 | anddam | sounds about right? |
18:19:21 | FromDiscord | <Yardanico> yes |
18:19:27 | anddam | and try nim cpp test.nim |
18:19:35 | anddam | /home/ada/.nimble/pkgs/imgui-1.84.2/imgui/impl_opengl.nim(11, 23) Error: cannot open file: nimgl/opengl |
18:19:46 | FromDiscord | <Yardanico> yes, because imgui needs opengl for drawing |
18:19:47 | anddam | this is because the test.nim example does in fact rely on nimgl |
18:19:51 | FromDiscord | <Yardanico> so you `nimble install nimgl` |
18:20:05 | anddam | running |
18:20:39 | * | anddam oopses |
18:20:43 | anddam | /bin/ld: cannot find -lGL |
18:20:51 | FromDiscord | <Yardanico> heh |
18:20:59 | FromDiscord | <Yardanico> you need opengl dev libs for your distro |
18:21:21 | FromDiscord | <Yardanico> mesa-devel or something like that |
18:21:41 | FromDiscord | <Yardanico> on debian-like distros it's `libgl1-mesa-dev` |
18:21:44 | anddam | libglvnd in my case |
18:21:58 | FromDiscord | <Yardanico> that's not the same thing |
18:22:12 | FromDiscord | <Yardanico> but if it works, okay |
18:22:12 | anddam | but it's the package providing libGL |
18:22:28 | anddam | and the linker was failing there |
18:22:42 | FromDiscord | <Yardanico> just install `mesa-common-dev` and be done with it :) |
18:22:48 | FromDiscord | <Yardanico> it installs all necessary dev viles |
18:22:49 | FromDiscord | <Yardanico> (edit) "viles" => "files" |
18:22:59 | FromDiscord | <michaelb> will `isValidSha1Hash` in Nim 1.6's `std/sha1` be backported to 1.2.x and 1.4.x so those release lines will be compatible with nimble >= 0.14.0 ? |
18:23:02 | anddam | actually I had to install libglvnd-devel, apparently /usr/lib/libGL.so.1 was not enough |
18:23:09 | anddam | Yardanico: not on my system, that is Void |
18:23:22 | anddam | running |
18:23:25 | anddam | thanks |
18:23:42 | anddam | now for the sake of knowledge how do I go in order to build the cimgui? |
18:23:45 | FromDiscord | <Yardanico> In reply to @brainproxy "will `isValidSha1Hash` in Nim": i think you should ask that on the forum or open an issue, your question will get lost in this chat quite quickly |
18:23:58 | FromDiscord | <michaelb> good point, thanks 🙂 |
18:24:23 | FromDiscord | <michaelb> and in any case would be better to ask in #nimble |
18:24:26 | anddam | or rather by cimgui do I need to build https://github.com/nimgl/cimgui this? |
18:24:28 | nrds | <R2D299> itHub: 7"c-api for imgui (https://github.com/ocornut/imgui)" |
18:24:34 | FromDiscord | <Yardanico> In reply to @anddam "or rather by cimgui": nonono |
18:24:51 | FromDiscord | <Yardanico> In reply to @anddam "now for the sake": you do all the necessary cloning and compilation steps in https://github.com/cimgui/cimgui, place the resulting `cimgui.so` in the same folder as `test.nim` and then compile your test with `nim c` and run with `LD_LIBRARY_PATH=. ./test` |
18:25:03 | FromDiscord | <Yardanico> you can have it in a different folder too, but then you'll have to point `LD_LIBRARY_PATH` to that folder |
18:25:18 | FromDiscord | <Yardanico> or just place it somewhere in your $PATH, then you won't need to set LD_LIBRARY_PATH |
18:25:24 | anddam | or place the so in a path where the linker looks by default |
18:25:36 | FromDiscord | <Zoom> So, how was your first day of AOC? Pretty content with myself, managed to want an `{.experimental.}` feature on the first day |
18:25:53 | FromDiscord | <Yardanico> @Zoom fine, btw, we have a separate channel for AoC :) it's fine to post here though too |
18:25:56 | anddam | can I make a static build of that and then bundle the whole shebang in the resulting executable from the nim compilation? |
18:26:02 | FromDiscord | <Zoom> Anyone had any experience with extending zero functinoal using their DSL? |
18:26:08 | FromDiscord | <Yardanico> In reply to @anddam "can I make a": yes, you'll have to link cimgui statically then |
18:26:11 | anddam | (I remember I was told I could, I need some pointers again) |
18:26:33 | FromDiscord | <Zoom> I don't see it in the Space↵(@Yardanico) |
18:26:46 | FromDiscord | <Yardanico> i guess it's not bridged to matrix :( |
18:28:03 | FromDiscord | <Yardanico> In reply to @anddam "(I remember I was": compile cimgui statically with the docs they have, then you add it as an argument to link for the C compiler (with passC/passL), and also do --dynlibOverride:"cimgui" |
18:29:09 | FromDiscord | <Yardanico> so that nim doesn't try to load it at runtime (that's what `dynlib` pragma does and imgui module uses it) |
18:29:12 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHn |
18:31:49 | FromDiscord | <Zoom> Here's the issue I'm having with zero\_functional\: https://play.nim-lang.org/#ix=3GHo |
18:32:31 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GHq |
18:32:51 | FromDiscord | <Zoom> The line 16 compiles fine, but there's the `state` variable injection fails for line 18. |
18:33:53 | FromDiscord | <dain> In reply to @Yardanico "i don't remember why": that still gives me an error |
18:34:00 | FromDiscord | <Yardanico> huh |
18:34:12 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHs |
18:34:21 | FromDiscord | <dain> i'm on 1.6 |
18:34:42 | FromDiscord | <Yardanico> works on 1.6 in the playground though https://play.nim-lang.org/#ix=3GHt |
18:34:51 | FromDiscord | <Yardanico> it might be that it's choosing the wrong `map` if you have more than one of them in the same namespace |
18:35:05 | FromDiscord | <Yardanico> wait, ah |
18:35:09 | FromDiscord | <Yardanico> you're trying to iterate over that iterator |
18:35:28 | FromDiscord | <Yardanico> closure iterators are different from normal ones, you need to use loops to iterate over them (or write a helper iterator that does that for you) |
18:35:37 | FromDiscord | <Yardanico> wait nvm, that works as well |
18:35:38 | FromDiscord | <dain> ? |
18:35:59 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GHu |
18:36:34 | FromDiscord | <dain> it breaks |
18:36:58 | FromDiscord | <Yardanico> huh |
18:37:08 | FromDiscord | <Yardanico> ahh right |
18:37:16 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHw |
18:37:20 | FromDiscord | <Yardanico> @dain you need to import `sequtils` as well |
18:37:39 | FromDiscord | <Yardanico> it has an iterator to iterate over values in a closure iterator because they don't have `items` by default, as I said |
18:37:39 | FromDiscord | <Yardanico> https://nim-lang.org/docs/sequtils.html#items.i |
18:37:45 | FromDiscord | <dain> why? i deliberately didn't import sequtils so that its `map` doesn't interfere with mine |
18:37:49 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GHx |
18:37:56 | FromDiscord | <Yardanico> In reply to @Yardanico "https://nim-lang.org/docs/sequtils.html#items.i": because of this ^ |
18:37:59 | FromDiscord | <dain> oh |
18:38:07 | FromDiscord | <Yardanico> In reply to @Yardanico "it has an iterator": meant to point to this, but ok |
18:38:08 | FromDiscord | <michaelb> is it possible to get forum.nim-lang.org to resend an email confirmation link?↵↵apparently, about 1 year ago I signed up but didn't click the confirmation link (because it landed in my Junk email folder, found it a few min ago); I tried doing a password reset just now, but after re-login, I'm still seeing my email is unconfirmed and therefore I can't create a past |
18:38:12 | FromDiscord | <michaelb> (edit) "past" => "post" |
18:38:20 | FromDiscord | <Yardanico> In reply to @brainproxy "is it possible to": i can confirm you manually, what's your nickname ? |
18:38:24 | FromDiscord | <michaelb> brainproxy |
18:38:33 | FromDiscord | <dain> okay yes now it works |
18:38:37 | FromDiscord | <Yardanico> In reply to @brainproxy "brainproxy": yeah, confirmed |
18:38:40 | FromDiscord | <michaelb> nice, thanks! |
18:39:04 | FromDiscord | <dain> also yes needing parentheses for the iterator is ugly looking |
18:40:25 | FromDiscord | <dain> okay now I stuck a `.to_seq` at the end and it broke again |
18:40:26 | FromDiscord | <dain> :( |
18:40:35 | FromDiscord | <dain> how do I get it as a sequence |
18:40:51 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GHy |
18:41:04 | FromDiscord | <Yardanico> you still need sequtils because toSeq needs it to iterate over the "thing" that you want to make into a seq |
18:41:13 | FromDiscord | <Yardanico> needs `items` specifically |
18:41:50 | FromDiscord | <dain> that's exactly what I have |
18:42:27 | FromDiscord | <Yardanico> ah you're right it doesn't work |
18:42:44 | FromDiscord | <Yardanico> it's not really meant to work with closure iterators it seems like, you can write a custom `toSeq` though |
18:42:44 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHz |
18:42:53 | FromDiscord | <dain> why is this so hard :x |
18:43:18 | FromDiscord | <Yardanico> and generally composing iterators like that is a pain even currently, because iterable[T] only works in templates and closure iterators are different from inline iterators |
18:43:29 | FromDiscord | <Yardanico> and used less than inline iterators |
18:43:34 | NimEventer | New thread by Brainproxy: Will isValidSha1Hash in Nim 1.6's std/sha1 be backported to 1.2.x and 1.4.x?, see https://forum.nim-lang.org/t/8669 |
18:43:36 | FromDiscord | <dain> i just want to be able to work with lazy iterations the same as I do in python |
18:43:39 | FromDiscord | <dain> composing them and stuff |
18:44:39 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3GHA |
18:44:43 | FromDiscord | <DaiChimpo> I'm not too great at regex, if I wanted to split a string by the vowels, and include the vowels, wouldn't it be string.split(r"(A|E|I|O|U)") |
18:45:18 | FromDiscord | <dain> In reply to @Zoom "dain I use zero\_functional,": I did look at zero functional but it looks like you have to use its own special DSL if you want to define your own functions that work with it |
18:45:22 | FromDiscord | <dain> and it looks awkward |
18:45:34 | NimEventer | New thread by Nick14: Read next string from stdin, see https://forum.nim-lang.org/t/8670 |
18:46:01 | FromDiscord | <Zoom> dain, do you really need to extend it? In it's basic form it's just one arrow and dot chaining |
18:46:27 | FromDiscord | <Zoom> I tried to extend it and got bitten though. Would appreciate if anyone with macro skills could look at↵https://play.nim-lang.org/#ix=3GHo |
18:46:42 | FromDiscord | <dain> well yes, it doesn't even have a `count()` function |
18:46:51 | FromDiscord | <dain> there's an example of `count()` in the docs but i couldn't make that work |
18:48:22 | FromDiscord | <Zoom> It works, or you can just `map(1).sum()` |
18:50:45 | FromDiscord | <Zoom> You can see in the paste above how the expansion works. You need to import macro, define/copy-paste `zfInline` block and call `static: zfCreateExtension()`. That's all |
18:53:28 | FromDiscord | <Zoom> All macros look awkward, and if you want to implement iterator composition you currently need to use lots them, unfortunately. |
18:53:52 | FromDiscord | <dain> okay I remember the problem I had now, I couldn't make `zip` work how I wanted with zero functional |
18:54:28 | FromDiscord | <TryAngle> How would I compile nim to a real C file or is that not possible? |
18:54:43 | FromDiscord | <Yardanico> In reply to @TryAngle "How would I compile": wdym "real C file"? |
18:54:50 | FromDiscord | <Yardanico> Nim is always compiled to C files when you use the C backends |
18:54:53 | FromDiscord | <Yardanico> they're just stored in the cache folder |
18:54:58 | FromDiscord | <Yardanico> (edit) "backends" => "backend" |
18:55:02 | FromDiscord | <Zoom> It does compile to real C by default↵(@TryAngle) |
18:55:24 | FromDiscord | <TryAngle> When I use nim or nimble it always compiles directly to a binary |
18:55:32 | FromDiscord | <TryAngle> Where do I find this cache folder? |
18:55:47 | FromDiscord | <Yardanico> In reply to @TryAngle "Where do I find": If you're on nix, it's ~/.cache/nim |
18:55:50 | FromDiscord | <Yardanico> why do you need it though? |
18:56:02 | FromDiscord | <TryAngle> I'm just interested |
18:56:11 | FromDiscord | <Yardanico> you're not supposed to look at C files unless you want to check for optimizations |
18:56:21 | FromDiscord | <Yardanico> it's not exactly supposed to be human readable, so just be warned :) |
18:56:47 | FromDiscord | <Yardanico> if you really want to study C code compiled by Nim without all the noise like safety checks, compile the program you want manually with `nim c -d:danger --gc:orc` |
18:56:59 | FromDiscord | <Yardanico> orc is not the default nim GC, but it offers less "noise" in the C code |
18:58:03 | FromDiscord | <TryAngle> Hmm I'm using WSL so I hope that path is the same |
18:58:50 | FromDiscord | <Yardanico> that directory has dirs that are named like "file_r" or "file_d" where file is the name of the main program Nim file |
18:58:51 | FromDiscord | <TryAngle> In reply to @Yardanico "if you really want": Using none or arc depending in the context could make it even more readable? |
18:58:54 | FromDiscord | <Yardanico> r or d mean debug or release |
18:59:08 | FromDiscord | <Yardanico> In reply to @TryAngle "Using none or arc": yes, but some programs have cycles so comparing with orc is more fair :) |
18:59:11 | FromDiscord | <Yardanico> you can use arc as well, yes |
18:59:15 | FromDiscord | <Yardanico> don't use `none` |
19:00:05 | FromDiscord | <TryAngle> What is bad with none?↵I thought the nim GBA game is written with none? |
19:00:30 | FromDiscord | <Yardanico> that is the case because it was written before ARC became a viable option for general usage |
19:00:40 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHG |
19:01:03 | FromDiscord | <Yardanico> In reply to @TryAngle "What is bad with": also goodboy galaxy doesn't use dynamically allocated memory at all |
19:01:05 | FromDiscord | <Yardanico> "Natu works with both --gc:none and --gc:arc, though arc didn't exist when I started working on Goodboy Galaxy, but I've had success with it for other small projects. Right now everything in the game is on the stack or statically allocated, which is nice for performance, so the choice of memory management strategy doesn't matter all that much for me. However, I'm envious of the benefits that destructors could bring if I'd written the en |
19:01:13 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/8375#54033 |
19:01:58 | FromDiscord | <Zoom> @dain\: you forgot to import `macros` |
19:02:04 | FromDiscord | <TryAngle> In reply to @Yardanico "that is the case": Ah ok I see thanks |
19:02:10 | FromDiscord | <dain> In reply to @Zoom "<@225449938258100225>\: you forgot to": ty |
19:03:44 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHK |
19:05:18 | FromDiscord | <TryAngle> Speaking of Arc and Orc, the sink, lent, destructors etc. are only available when using them and the acyiclic pragma only with orc, using other gc they're all "ignored" @Yardanico ? |
19:05:35 | FromDiscord | <Yardanico> In reply to @TryAngle "Speaking of Arc and": destructors work with refc - they're mapped to finalizers, but of course then they're not deterministic |
19:05:42 | FromDiscord | <Yardanico> sink will just always copy on refc |
19:05:47 | FromDiscord | <Yardanico> lent doesn't work on refc as far as I know |
19:05:52 | FromDiscord | <Yardanico> acyclic pragma is only for orc, yes |
19:07:08 | FromDiscord | <TryAngle> Does lent on refc error or is it just ignored? |
19:07:20 | FromDiscord | <Yardanico> don't know, I guess it's easy to try out :) |
19:08:45 | FromDiscord | <TryAngle> I guess so 👍 |
19:27:33 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHN |
19:28:07 | FromDiscord | <dain> why do I need to make a separate variable before passing it to `to_seq`? that's maddening |
19:28:30 | FromDiscord | <dain> i only discovered it by accident |
19:29:33 | FromDiscord | <dain> this has to be a bug right |
19:29:43 | FromDiscord | <Yardanico> it probably is |
19:32:55 | FromDiscord | <dain> right i'll make a github issue |
19:45:42 | * | PMunch quit (Quit: leaving) |
19:46:56 | * | PMunch joined #nim |
19:50:13 | FromDiscord | <Zoom> Zip is pretty fragile and expects sequences, as far as I understand. You don't need zip for the task though.↵(@dain) |
19:51:58 | * | advesperacit quit (Quit: advesperacit) |
19:52:14 | FromDiscord | <--HA--> sent a code paste, see https://play.nim-lang.org/#ix=3GHU |
19:52:23 | FromDiscord | <Yardanico> In reply to @--HA-- "What do I do": use `_` instead of `i` |
19:52:27 | FromDiscord | <dain> In reply to @Zoom "Zip is pretty fragile": yeah but i want to use zip :( |
19:52:45 | FromDiscord | <--HA--> Is `_somevarname` also a thing? |
19:52:52 | FromDiscord | <Yardanico> no |
19:52:56 | FromDiscord | <Yardanico> `_` is a special variable name |
19:52:59 | FromDiscord | <--HA--> Ok, thanks. |
20:04:14 | PMunch | AoC stream live now! https://www.twitch.tv/pmunche |
20:06:46 | FromDiscord | <DaiChimpo> Checking if a seq is empty should be done using if len(seq) == 0, right? |
20:07:13 | FromDiscord | <Yardanico> one of the ways to do it, yes |
20:07:28 | FromDiscord | <Yardanico> you can do seq.len for a "nicer" oop-like syntax |
20:09:28 | FromDiscord | <DaiChimpo> ok I'm getting an "`len(a) == L` the length of the seq changed while iterating over it [AssertionDefect]", but not on the check, if I add an else |
20:09:38 | FromDiscord | <DaiChimpo> sent a code paste, see https://play.nim-lang.org/#ix=3GI3 |
20:10:20 | FromDiscord | <metamuffin> 9B9CB7C264E36573B4E381BFDEB519E8E26C2E6D917226AB90EFE1E4740BAB7AA578AA310524 |
20:10:31 | FromDiscord | <DaiChimpo> (edit) "https://play.nim-lang.org/#ix=3GI3" => "https://play.nim-lang.org/#ix=3GI4" |
20:11:00 | FromDiscord | <DaiChimpo> If I comment out the else, no errors |
20:12:13 | FromDiscord | <Yardanico> In reply to @DaiChimpo "ok I'm getting an": can you show more code? |
20:12:43 | FromDiscord | <DaiChimpo> sure I'll edit it |
20:13:59 | FromDiscord | <DaiChimpo> done |
20:18:58 | FromDiscord | <Yardanico> In reply to @DaiChimpo "done": do you maybe have another loop outside of this one which iterates over `seq` as well or something? |
20:19:05 | FromDiscord | <Yardanico> that error comes when you modify a seq while iterating (quite obviously) |
20:19:22 | FromDiscord | <Yardanico> so if removing your second else means that you have some outer loop that is iterating over that seq as well? |
20:19:34 | FromDiscord | <Yardanico> (edit) "so if removing your second else ... means" added "removes the issue, it" |
20:20:37 | FromDiscord | <DaiChimpo> A different seq finishes looping before this ifelse, otherwise this one is only instantiated at program start |
20:20:51 | FromDiscord | <DaiChimpo> this is a head scratcher |
20:21:08 | FromDiscord | <Yardanico> maybe you can try to minimize the code or share the whole code somewhere? if it's not closed of course |
20:21:09 | FromDiscord | <Yardanico> as a repo maybe |
20:23:36 | FromDiscord | <Yardanico> also @DaiChimpo you can avoid using `i` in the innermost loop by using `mitems` :) |
20:23:54 | FromDiscord | <Yardanico> ah wait nvm |
20:24:04 | FromDiscord | <Yardanico> @DaiChimpo you modify the seq right in the loop |
20:24:22 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GI9 |
20:24:36 | FromDiscord | <DaiChimpo> ahh |
20:24:37 | FromDiscord | <Yardanico> either change the algorithm or copy the sequence and then add to your copy |
20:25:08 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GIa |
20:27:08 | FromDiscord | <DaiChimpo> hmm is there an optimal way to check for duplicates in a seq? something like if seq.contains(token): ? |
20:27:37 | FromDiscord | <DaiChimpo> if I can separate that out this loop's algorithm is elementary |
20:27:43 | FromDiscord | <Yardanico> ah lol |
20:27:53 | FromDiscord | <Yardanico> yeah, you can either just use contains or the nim `in` sugar over `contains` |
20:28:05 | FromDiscord | <Yardanico> `if value in seq` |
20:28:12 | FromDiscord | <Yardanico> or `if value notin seq` for the reverse |
20:28:39 | FromDiscord | <Yardanico> `in` and `notin` operators in nim just map to `contains` procedures, so you can write even write `contains` for your own types and still use `in` |
20:28:44 | FromDiscord | <DaiChimpo> these english keywords mess with me |
20:29:21 | FromDiscord | <DaiChimpo> earlier got stuck on Advent because I couldn't figure out how to write int mod 4 lol |
20:30:07 | FromDiscord | <Yardanico> In reply to @DaiChimpo "earlier got stuck on": https://nim-lang.org/docs/system.html#system-module-numbers :) |
20:30:18 | FromDiscord | <Yardanico> specifically the "Also known as (in other languages)" for comparison |
20:30:31 | FromDiscord | <DaiChimpo> I tried % and it was giving me errors! |
20:30:37 | FromDiscord | <Yardanico> yes, because as I linked it |
20:30:39 | FromDiscord | <DaiChimpo> whatever, it's done now and I've learned from it |
20:30:41 | FromDiscord | <Yardanico> % is not how it is written in Nim |
20:30:50 | FromDiscord | <DaiChimpo> why can't I read table headers |
20:30:52 | FromDiscord | <Yardanico> "usage" is nim, third column is other languages https://media.discordapp.net/attachments/371759389889003532/915701503380054047/unknown.png |
20:31:28 | FromDiscord | <DaiChimpo> oh yeah I did try to use | earlier in this program too. it's rough. |
20:37:37 | * | lumo_e quit (Ping timeout: 252 seconds) |
20:52:25 | PMunch | @DaiChimpo, sounds like you and I solved AoC about the same way :P |
20:52:32 | PMunch | I used mod 3 though :) |
20:53:18 | FromDiscord | <DaiChimpo> ah yeah I did mine a little inefficiently to get an answer quick haha |
20:53:28 | FromDiscord | <Yardanico> yeah @PMunch i'll admit i solved it the dumb way with the seq for part 2 :) |
20:53:53 | FromDiscord | <DaiChimpo> Mine was an array of 4 values, the ABCD registers, and the loop kept track of which was the dead spot, essentially |
20:54:18 | FromDiscord | <DaiChimpo> got some points in a private leaderboard though :happy: |
20:55:13 | FromDiscord | <Yardanico> yeah, you can use aoc for "speed programming" to solve tasks fast, and then use it for "clever code" by changing code you made |
20:56:49 | FromDiscord | <DaiChimpo> sent a code paste, see https://play.nim-lang.org/#ix=3GIf |
20:56:51 | PMunch | @DaiChimpo, aah I see, I kept a rolling window which just had a small array of the window size so I could subtract values as they left the sum |
20:57:40 | FromDiscord | <Yardanico> In reply to @DaiChimpo "I saw someone solve": i think it's because it fit _their_ puzzle input |
20:57:51 | PMunch | Yeah, that doesn't look correct :P |
20:57:59 | FromDiscord | <DaiChimpo> fit mine too, must've been a coincidence lol |
20:58:14 | FromDiscord | <Yardanico> mine too :D |
20:58:19 | FromDiscord | <DaiChimpo> lolll |
20:58:20 | FromDiscord | <Yardanico> yeah, maybe an oversight in the puzzle input |
20:58:37 | FromDiscord | <Yardanico> they exploited an edge case :P |
20:58:44 | FromDiscord | <DaiChimpo> there's too many counterexamples in my head, gotta be coincedences |
20:58:54 | FromDiscord | <DaiChimpo> BUT it is a lesson in algorithm optimization |
20:58:55 | FromDiscord | <Yardanico> this is clever, but it's kind of cheating and not on the point :P |
20:59:08 | FromDiscord | <DaiChimpo> why do more when less do right |
20:59:09 | FromDiscord | <Yardanico> it's just solving the task with _specific_ input, not generic-for-anything |
20:59:55 | FromDiscord | <DaiChimpo> yeah I think this mainly works because the trend was very steep. if the differences in group sums was like, +/- 5, this would be less likely |
21:00:09 | FromDiscord | <DaiChimpo> now I'm gonna be looking for a similar cheat on day 2 |
21:04:22 | * | lumo_e joined #nim |
21:05:49 | PMunch | Damn it.. Works for my input as well.. |
21:06:41 | FromDiscord | <Yardanico> actual aoc exploit :P |
21:06:50 | FromDiscord | <Yardanico> In reply to @DaiChimpo "I saw someone solve": did they post it as a reddit thread? |
21:10:29 | FromDiscord | <Zoom> I've finally bent std/pegs to my will for the 18th day of 2020. Made it a challenge to not use 3d party libs |
21:11:20 | FromDiscord | <Yardanico> ===restarting the discord-irc bridge, expect a <1 minute downtime=== |
21:11:21 | FromDiscord | <dain> it isn't a nedge case |
21:11:24 | FromDiscord | <Zoom> That `eventParser` in pegs looks a bit clumsy but it gets the job done |
21:11:26 | FromDiscord | <dain> (edit) "a nedge" => "an edge" |
21:11:28 | * | FromDiscord quit (Remote host closed the connection) |
21:12:03 | * | FromDiscord joined #nim |
21:12:26 | FromDiscord | <Yardanico> restarted the bridge |
21:12:26 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GIk |
21:12:41 | PMunch | @Zoom, haha why oh why :P |
21:12:48 | PMunch | npeg is such a nice fit for AoC |
21:12:59 | PMunch | Here's my repo by the way: https://github.com/PMunch/aoc2021 |
21:12:59 | FromDiscord | <dain> so for comparing (a + b + c) to (b + c + d), the b + c is shared between them |
21:13:00 | nrds | <R2D299> itHub: 7"Advent of Code 2021 solutions in Nim" |
21:13:02 | FromDiscord | <dain> so they cancel out |
21:13:06 | FromDiscord | <dain> and you only have to compare a with d |
21:13:08 | FromDiscord | <Yardanico> In reply to @dain "so they cancel out": oh, okay |
21:13:13 | FromDiscord | <Yardanico> so they made a really clever solution, nice |
21:13:32 | FromDiscord | <Zoom> Even this fact barely explains that sub 30s result on the graph |
21:14:18 | Yardanico | oh so R2D2 has been writing this stuff in colours since forever |
21:14:25 | FromDiscord | <Zoom> I'd say they made a really clever task so all who rushed would be punished for not taking their time to think↵(@Yardanico) |
21:14:25 | Yardanico | guess ircord irc color stripping works after all |
21:14:47 | FromDiscord | <Yardanico> In reply to @Zoom "I'd say they made": well, not exactly "punished" |
21:14:57 | FromDiscord | <Yardanico> default aoc rules and leaderboard are made for speed programming |
21:15:13 | FromDiscord | <Yardanico> generally not caring how code is implemented |
21:15:19 | FromDiscord | <Yardanico> of course there are exceptions where things like bruteforce won't work |
21:15:22 | FromDiscord | <Yardanico> but not on the starting days |
21:15:22 | PMunch | Why strip them :P |
21:15:33 | FromDiscord | <Yardanico> @PMunch discord doesn't have colours :( |
21:15:40 | FromDiscord | <Yardanico> for text formatting |
21:15:45 | FromDiscord | <Zoom> Feeling real dumb is a fine punishment↵(@Yardanico) |
21:16:07 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3GIl |
21:16:15 | FromDiscord | <Recruit_main707> spoilers! |
21:16:19 | FromDiscord | <Yardanico> yep |
21:16:22 | PMunch | W11ha13t?03! 05No07 c09ol11ou13rs03! |
21:16:25 | FromDiscord | <dain> oh sorry |
21:16:26 | FromDiscord | <Yardanico> also we have #aoc |
21:16:29 | FromDiscord | <Yardanico> but it's not bridged to matrix |
21:16:40 | FromDiscord | <dain> deleted :x |
21:16:44 | FromDiscord | <Yardanico> too late |
21:16:47 | FromDiscord | <dain> ;-; |
21:17:30 | FromDiscord | <Yardanico> irc doesn't have a way to delete messages, so your message is left for everyone to see |
21:17:36 | FromDiscord | <Recruit_main707> hehe, well tbh i already have a pretty clear idea of what needs to be done, the problem is im using a stack language and im not used to it at all lol, its been over an hour of thinking how to do something i perfectly know how |
21:17:43 | FromDiscord | <Yardanico> although it's a link to a code paste on play.nim-lang.org, so if ix.io goes down your code will disappear |
21:21:18 | Zevv | PMunch: last year there were a few natural fits for npeg, like https://github.com/zevv/aoc2020/tree/master/04 |
21:22:02 | FromDiscord | <Zoom> Does anyone here share their nvim `.vimrc`s? Looking for inspiration, preferably with minimal plugins. |
21:22:59 | FromDiscord | <Zoom> Is the nimlsp the way to go? |
21:23:22 | FromDiscord | <Yardanico> i've never used nvim but doesn't https://github.com/alaviss/nim.nvim work fine with it? |
21:23:24 | nrds | <R2D299> itHub: 7"Nim plugin for NeoVim" |
21:23:35 | FromDiscord | <Yardanico> it's a "native" nimsuggest nvim plugin, so it doesn't use nimlsp |
21:25:24 | FromDiscord | <Smarc> Hello Guys, I did not found a specialized code review room, so I'm going to try it in here. I'd like to know what I could improve in my code (not in particular linewise, more like the whole lot) and make more the nim way https://github.com/Smarcy/nim_chess |
21:25:25 | nrds | <R2D299> itHub: 7"<No Description>" |
21:25:49 | FromDiscord | <Yardanico> In reply to @Smarc "Hello Guys, I did": sure, it's fine to post it here, but for more exposure you might also post it on the forum |
21:26:03 | FromDiscord | <Smarc> Noted :) |
21:26:37 | FromDiscord | <Zoom> It does and that's what I'm using currently↵(@Yardanico) |
21:26:52 | FromDiscord | <Yardanico> already a small note - did you do "Board = object of RootObj" because you want to create some objects that will inherit from Board in the future? |
21:26:57 | PMunch | Zevv, I had four days I used it for. 7, 16, 19, and 21 |
21:26:59 | FromDiscord | <Yardanico> "of RootObj" is only needed for that |
21:27:09 | FromDiscord | <Yardanico> otherwise you can just have "Board = object" and fields below |
21:27:35 | FromDiscord | <Smarc> Maybe that was an idea in the beginning, but not anymore. Thank you for the catch |
21:28:47 | FromDiscord | <Yardanico> Also, instead of having `Piece` as `ref object` you can have it as `object`, I see you inherit Piece but it'll work the same with `object`. You might want to keep it a `ref` if you plan on using `method`s in the future though (dynamic dispatch) |
21:29:12 | * | Jjp137 quit (Quit: Leaving) |
21:29:23 | * | Jjp137 joined #nim |
21:30:52 | FromDiscord | <Smarc> That is crashing for me, the compiler does not allow inheritance if the base class is not ref of `ref of RootObj` |
21:31:10 | FromDiscord | <Yardanico> inheritance will work with `of RootObj` without a ref |
21:31:40 | FromDiscord | <Smarc> Ah, I see. What about the several Pieces? Should they be refs for any reason? |
21:31:41 | FromDiscord | <Yardanico> ah, right, you're also using `ref` objects for easier mutability |
21:32:03 | FromDiscord | <Smarc> I never were really sure if I should use ref or not actually |
21:32:05 | FromDiscord | <Yardanico> ooh, also you should never cast like `cast[Rook](sourcePiece)` |
21:32:13 | FromDiscord | <Yardanico> this is unsafe, you should use a type-safe conversion instead |
21:32:15 | FromDiscord | <Yardanico> like Rook(sourcePiece) |
21:32:15 | FromDiscord | <Michal58> In reply to @DaiChimpo "I saw someone solve": Huh, here I am wondering why so many people didn't do it this way.. |
21:32:24 | FromDiscord | <Yardanico> `cast` is just treating the same bytes as a different type |
21:32:48 | FromDiscord | <Smarc> I figured that that would be smelly :D Gonna try it out |
21:34:02 | FromDiscord | <Yardanico> hmm |
21:34:58 | FromDiscord | <Smarc> I'm getting an error if I change it to `Rook(sourcePiece)`. type mismatch: got queen instead of (rook|bishop) .. huh? |
21:35:20 | FromDiscord | <Yardanico> well, because it's kind of unsafe actually |
21:35:32 | FromDiscord | <Yardanico> i think that you can convert between the subtype and its parent type |
21:35:35 | FromDiscord | <Yardanico> but not between subtypes |
21:36:07 | FromDiscord | <Smarc> Okay so the unsafe `cast` is maybe the only sane solution? I mean it should work every time there, I still feel its unsafe |
21:36:19 | FromDiscord | <Yardanico> well, it might work every time but it'll remain unsafe |
21:36:23 | FromDiscord | <Yardanico> I can easily show you how it's unsafe |
21:36:56 | FromDiscord | <Smarc> Thank you, I'm more interested in a code review :) |
21:37:25 | FromDiscord | <Yardanico> well, this is kind of a part of the code review :P |
21:37:49 | FromDiscord | <Yardanico> ahh i understand why you used casting |
21:38:01 | FromDiscord | <Yardanico> you wanted queen code to reuse the same code for bishop and rook |
21:38:02 | FromDiscord | <Yardanico> it does make sense, yeah |
21:38:16 | FromDiscord | <Smarc> should work every time :s |
21:39:52 | FromDiscord | <DaiChimpo> In reply to @dain "so for comparing (a": THANK you. I'm on fifty hours no sleep, this cause was elusive |
21:40:09 | FromDiscord | <Yardanico> In reply to @Smarc "should work every time": it will, but it's actually undefined behaviour |
21:40:11 | FromDiscord | <Yardanico> "/home/dian/Projects/NimExperiments/nim_chess/src/model/pieces.nim:36:29: runtime error: load of value 49, which is not a valid value for type 'bool'" |
21:40:25 | FromDiscord | <Yardanico> because you're reaching memory you actually might not have access to |
21:40:35 | FromDiscord | <Smarc> I was able to change the cast into a type-safe variant. I just reassigned sourcePiece to (Piece)sourcePiece beforehand |
21:40:49 | FromDiscord | <Smarc> oh, how did you provoke that? |
21:41:14 | FromDiscord | <Yardanico> In reply to @Smarc "I was able to": yes, that'll work if you don't need to mutate it in those can move procs |
21:41:18 | FromDiscord | <Yardanico> In reply to @Smarc "oh, how did you": I used clang's UBSAN |
21:41:57 | FromDiscord | <Yardanico> it won't show that error on your tests because you didn't test for it though |
21:42:52 | FromDiscord | <Smarc> yeah, I just started testing in nim a few days ago and am adding some step by step |
21:43:52 | FromDiscord | <Yardanico> sent a long message, see http://ix.io/3GIs |
21:44:13 | FromDiscord | <Yardanico> so if you access `canCastle` of a `Rook` casted from Queen you might get an access violating, a sigsegv, or something else |
21:44:42 | FromDiscord | <Smarc> Does this behaviour happen when I use type-safe casting? |
21:44:44 | FromDiscord | <Michal58> I have a quite simple lichens bot written Nim, we can let them play some time. https://github.com/MichalMarsalek/nimbochromis |
21:44:44 | FromDiscord | <Yardanico> and in your case that can actually be dangerous because you do ` sourcePiece.canCastle = false` in Rook's checking proc |
21:44:45 | nrds | <R2D299> itHub: 7"<No Description>" |
21:44:51 | FromDiscord | <Yardanico> In reply to @Smarc "Does this behaviour happen": no, then it'll be safe |
21:44:56 | FromDiscord | <Michal58> (edit) "lichens" => "lichess" |
21:45:32 | FromDiscord | <Smarc> Okay great, then you already fixed that and thanks a lot for the explanation! |
21:45:56 | FromDiscord | <Yardanico> i remember there being a malloc implementation that was specifically crafted to find all sorts of memory-related bugs, can't remember the name |
21:46:23 | FromDiscord | <Smarc> Why does a Piece have 32 Bytes, but a Queen only 8, though? And the Rook has one byte more? |
21:46:23 | FromDiscord | <Yardanico> but clang's UBSAN also works for most cases |
21:46:31 | FromDiscord | <Yardanico> In reply to @Smarc "Why does a Piece": nonon, I meant that data inside the Piece has 32 bytes |
21:46:41 | FromDiscord | <Yardanico> piece itself is 8 bytes since it's a reference to that data (on 64-bit) |
21:46:45 | FromDiscord | <Yardanico> Queen is the same |
21:46:45 | FromDiscord | <iffy (Matt Haggard)> This program's segfault is not a true segfault, right? It's a Nim-emitted "segfault"? https://play.nim-lang.org/#ix=3GIt |
21:46:52 | FromDiscord | <Yardanico> and Rook has 8 bytes more because it has an additional field |
21:47:00 | FromDiscord | <Smarc> Ahhh, I see |
21:47:04 | FromDiscord | <Yardanico> even if it's `bool` objects are aligned by default on most platforms |
21:47:09 | FromDiscord | <Yardanico> so 1 byte is aligned to 8 bytes |
21:47:19 | FromDiscord | <Yardanico> because that's the native machine word "size" for 64-bit |
21:47:27 | FromDiscord | <Smarc> okay, understood |
21:49:04 | FromDiscord | <Yardanico> @Smarc about the code itself - I can see a way to make piece_factory code much shorter by using loops |
21:49:19 | FromDiscord | <Yardanico> it'll be a tiny bit less efficient, but it doesn't really matter since it's only executed once at the start as I understand |
21:49:45 | FromDiscord | <iffy (Matt Haggard)> And same with this "segfault"? https://play.nim-lang.org/#ix=3GIu |
21:50:24 | FromDiscord | <Yardanico> In reply to @iffy (Matt Haggard) "This program's segfault is": this just fails because JsonNode is a ref object |
21:50:29 | FromDiscord | <Yardanico> and dereferencing a nil ref object is a SIGSEGV |
21:50:46 | FromDiscord | <Yardanico> In reply to @iffy (Matt Haggard) "And same with this": same here, Future[T] is a ref object |
21:50:46 | FromDiscord | <iffy (Matt Haggard)> But it's Nim that's catching that, right? Not the OS |
21:50:56 | FromDiscord | <Smarc> In reply to @Yardanico "it'll be a tiny": I thought about that, just lazyness kept me from refactor it tbh. But is there anything in this code that you would call an anti-nim-pattern or something? |
21:51:01 | FromDiscord | <Yardanico> In reply to @iffy (Matt Haggard) "But it's Nim that's": it's OS catching that and reporting it to Nim since Nim has a default signal handler for SIGSEGV |
21:51:14 | FromDiscord | <iffy (Matt Haggard)> oh, okay |
21:52:28 | FromDiscord | <Yardanico> In reply to @Smarc "I thought about that,": hmm, don't think so, can't see anything bad in the nim code itself |
21:52:46 | FromDiscord | <iffy (Matt Haggard)> I'd be interested in adding a compile mode that fails for possible nils during compilation or maybe that disables nils altogether. No, I haven't thought it all the way through \:) I'm just tired of getting those errors. |
21:53:01 | FromDiscord | <Yardanico> there's the "return" vs "result" thing, and Nim code usually leans to the "result" side more, but you can use return just as fine |
21:53:19 | FromDiscord | <Yardanico> also, @Smarc if you were to use methods you wouldn't need this proc at all https://media.discordapp.net/attachments/371759389889003532/915722248839630869/unknown.png |
21:53:37 | FromDiscord | <Yardanico> you'll just have isValidMovePattern for each piece type and since they're methods they'll be dynamically dispatched |
21:54:03 | FromDiscord | <Yardanico> but OOP is "kind of" less popular in Nim since it leans towards composition |
21:54:36 | FromDiscord | <Yardanico> In reply to @iffy (Matt Haggard) "I'd be interested in": there was an experimental notNil feature that was never finished really |
21:54:43 | FromDiscord | <Yardanico> it might get finished for 2.0 though :) https://github.com/nim-lang/RFCs/issues/437 |
21:54:59 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual_experimental.html#not-nil-annotation |
21:55:16 | FromDiscord | <Smarc> Well, I'm coming from Java, I think you can see that from some structural attributes. :)↵What do you mean by using method? I don't really understood what it differs from proc yet |
21:55:18 | FromDiscord | <Yardanico> it's an experimental feature though, so it might break anywhere or crash your compiler |
21:55:29 | FromDiscord | <Yardanico> In reply to @Smarc "Well, I'm coming from": basically nim `proc`s are static dispatch |
21:55:37 | FromDiscord | <Yardanico> the compiler figures out which proc you are actually calling at compile time |
21:55:43 | FromDiscord | <Yardanico> by checking the (static) type of the variable |
21:56:09 | FromDiscord | <Yardanico> with methods it uses runtime dispatch - it finds the best suited method to call for that type and calls it |
21:56:23 | FromDiscord | <Yardanico> so basically runtime dispatch is the java way |
21:56:44 | FromDiscord | <Yardanico> you might've seen "static" methods in java - those are actually static dispatch |
21:58:02 | FromDiscord | <Yardanico> @Smarc see https://nim-lang.org/docs/manual.html#methods for some documentation on methods |
21:58:25 | FromDiscord | <Yardanico> also https://nim-lang.org/docs/tut2.html#object-oriented-programming |
21:59:13 | FromDiscord | <Smarc> Hm, I'm getting an error if I remove the cast and change the proc to method. I shall add {.base.} to the method, which results in a `this method is not a base` |
21:59:30 | FromDiscord | <Yardanico> In reply to @Smarc "Hm, I'm getting an": you need to define a base method for the `Piece` |
21:59:37 | FromDiscord | <Yardanico> base methods are the ones that are defined on the base type |
22:00:04 | FromDiscord | <Yardanico> and in that method you can write an error or something if you don't intend to actually have that logic implemented for `Piece` |
22:02:36 | FromDiscord | <iffy (Matt Haggard)> Maybe `notnil` doesn't work with inheritance? https://play.nim-lang.org/#ix=3GIA |
22:03:58 | FromDiscord | <Yardanico> In reply to @iffy (Matt Haggard) "Maybe `notnil` doesn't work": it emits a warning though |
22:03:59 | FromDiscord | <Yardanico> `/home/dian/Projects/NimExperiments/aoc/2021/what.nim(4, 29) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]` |
22:04:15 | FromDiscord | <Yardanico> did you maybe miss it? |
22:04:45 | FromDiscord | <iffy (Matt Haggard)> oh, the playground doesn't show compile warnings \:) |
22:05:11 | FromDiscord | <iffy (Matt Haggard)> Unless you click that button. Okay, yes, I see it. That's great! This is what I want |
22:05:41 | FromDiscord | <Elegantbeef> @apahl\: did i say they were copied passing to a proc, that seems very wrong and i must've been dumb in that minute 😜 |
22:06:02 | FromDiscord | <iffy (Matt Haggard)> Well, I want a way to add a `not nil` annotation to JsonNode and Future, too (enabled with a flag is fine). Maybe that's the part I can contribute |
22:06:40 | FromDiscord | <Yardanico> the thing is that the patch won't get accepted |
22:06:46 | FromDiscord | <Yardanico> precisely because not nil is an experimental feature |
22:06:58 | FromDiscord | <bananahead> Hi all, are there any good docs explaining differences between procs and funcs? Not sure I understand the difference. |
22:07:07 | FromDiscord | <iffy (Matt Haggard)> Even if it's only enabled explicitly? |
22:07:08 | FromDiscord | <Yardanico> there's actually a different implementation of notnil in nim that's newer and also experimental - https://nim-lang.github.io/Nim/manual_experimental_strictnotnil.html |
22:07:23 | FromDiscord | <Yardanico> In reply to @bananahead "Hi all, are there": funcs are just `proc`s with `{.noSideEffect.}` |
22:07:38 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#procedures-func, and for the noSideEffect itself - https://nim-lang.org/docs/manual.html#effect-system-side-effects |
22:07:43 | FromDiscord | <Elegantbeef> No side effect means the procedure cannot touch global state |
22:08:42 | FromDiscord | <Yardanico> so if you use `func` you tell the compiler that the routine doesn't access global state, and if that's not the case, it'll show you an error |
22:08:45 | FromDiscord | <Yardanico> and refuse to compile the code |
22:09:23 | FromDiscord | <Elegantbeef> There's also the lovely experimental `strictFuncs` which prevents mutation of even `ref T` without `var` |
22:09:38 | FromDiscord | <iffy (Matt Haggard)> So if a patch won't be accepted, is my only option at this point to `type MyJsonNode = JsonNode not nil` in my own code and convert from `MyJsonNode` back to `JsonNode` for other things to use? |
22:09:48 | FromDiscord | <iffy (Matt Haggard)> And same with `Future`s? |
22:10:10 | FromDiscord | <iffy (Matt Haggard)> I think Futures are too invasive for it to be practical to have my own `not nil` version |
22:10:37 | FromDiscord | <bananahead> Oh thats good. So funcs are analogous to pure functions in a way, only modifying the function input . |
22:11:25 | FromDiscord | <Elegantbeef> Yea that's their goal |
22:11:34 | FromDiscord | <Elegantbeef> hence `func` instead of \`proc1 |
22:11:43 | FromDiscord | <iffy (Matt Haggard)> gtg, but thanks for pointing me in the right direction, Yardanico. Good luck with AoC \:) |
22:11:55 | FromDiscord | <Yardanico> thanks :P |
22:12:23 | PMunch | I think maybe proc and func needs to be documented a bit better. Seems multiple people are confused about them |
22:13:14 | FromDiscord | <Elegantbeef> Be the change you want to see in the world pmunch 😛 |
22:13:20 | FromDiscord | <bananahead> In reply to @Elegantbeef "hence `func` instead of": Yeah so generally funcs should be preffered over procs I guess. |
22:14:26 | FromDiscord | <Elegantbeef> Yep, Nim also will implicitly mark procs as `noSideEffect` if they dont have any side effect |
22:15:37 | FromDiscord | <Elegantbeef> Which might seem pointless but if you do someting like `var someEvent = somePureProc` you cannot reassign `someEvent` to a proc with a side effect |
22:15:42 | FromDiscord | <Elegantbeef> Without type conversions of course |
22:15:53 | * | neurocyte0132889 quit (Ping timeout: 252 seconds) |
22:17:19 | FromDiscord | <bananahead> Ahh that's good to know. Thank you @ElegantBeef |
22:17:46 | PMunch | @Elegantbeef, hmm I guess |
22:19:36 | FromDiscord | <Elegantbeef> Hey if i dont make shitty jokes what'll get done?! |
22:22:02 | FromDiscord | <Yardanico> [Zoom](https://matrix.to/#/@Zoom:matrix.org)\: AoC is now bridged to #nim-aoc\:matrix.org |
22:22:08 | FromDiscord | <Yardanico> feel free to join it for AoC discussions |
22:22:44 | FromDiscord | <Yardanico> (us mere mortals in Discord already have #aoc if anyone missed it) |
22:23:19 | anddam | Yardanico: thanks for the info earlier. I got the cimgui dynamic lib working, so I can use nim with C backend and nimgl/imgui |
22:23:26 | FromDiscord | <Yardanico> nice |
22:23:44 | anddam | Yardanico: not really clear how to statically link the lib, I placed libcimgui.a near test.nim then ran |
22:24:03 | anddam | nim c --dynlibOverride:cimgui --passC:libcimgui.a --passL:-L. --passL:-lcimgui test.nim |
22:24:19 | PMunch | Hmm, just to figure out where to put it.. |
22:24:33 | anddam | actually I am not even sure I should pass -L -l for a static lib, rather than just passing the archive to the compiler |
22:24:39 | PMunch | @bananahead, where would you have expected to find the proc/func difference definition |
22:24:41 | anddam | so just --passC in my case |
22:24:43 | Yardanico | anddam: you don't need passC and -L here |
22:24:45 | Yardanico | just the last passL |
22:24:49 | Yardanico | and did it error out or work? |
22:38:27 | PMunch | Hmm, my dunst config finally borked out. Might be time to replace it with notifishower/-catcher |
22:39:41 | anddam | Yardanico: https://termbin.com/9aib |
22:39:49 | anddam | errored |
22:40:00 | Yardanico | aha |
22:40:06 | Yardanico | that looks like an actual bug in the wrapper, but it should be easy to fix |
22:40:27 | anddam | like a mismatch between nimgl/imgui and the imgui I used in cimgui repo? |
22:40:44 | Yardanico | hmm, maybe that, or more likely a wrong type used in nimgl/imgui for a cimgui function signature |
22:40:52 | anddam | btw I checked the difference between cimgui/cimgui and nimgl/cimgui, the latter has its own imgui version bump |
22:41:00 | anddam | so I'll have a try at its master |
22:41:17 | anddam | its == nimgl/cimgui's |
22:46:48 | anddam | btw the error only happens with the static lib, it works fine with the dynamic lib |
22:47:04 | * | src quit (Quit: Leaving) |
22:49:25 | FromDiscord | <Yardanico> yeah because types aren't strictly checked for dynamic library :) |
22:49:46 | FromDiscord | <Yardanico> But with a static library the C compiler has access to both definition and can compare them |
22:50:00 | PMunch | Type mismatches in a wrapper? Haaave you tried Futhark? |
22:50:05 | FromDiscord | <Yardanico> I'll check out the error soon |
22:54:38 | anddam | PMunch: I haven't, considering I had to look for it on the web three times just to find it |
22:55:04 | PMunch | Three times? It should be the top result for "Nim futhark" |
22:55:26 | anddam | ah I did not use nim |
22:56:01 | anddam | oh lol https://github.com/PMunch/futhark |
22:56:03 | nrds | <R2D299> itHub: 7"Automatic wrapping of C headers in Nim" |
22:56:10 | PMunch | Once you've used Nim long enough you don't have to :) |
22:56:14 | anddam | the title says it all |
22:56:23 | anddam | yeah this is my second night |
22:56:49 | PMunch | Tried to make it as easy as possible |
22:57:08 | PMunch | Starting out with wrapping C, brave! |
22:58:57 | anddam | no, I really would just like to statically link dear imgui |
22:59:32 | FromDiscord | <Yardanico> yeah I get the same error as you @anddam, will try to see how to fix it now |
23:02:17 | anddam | I am reading those errors |
23:02:40 | anddam | the igBegin definition seems alike, although not the same |
23:02:59 | anddam | it is N_CDECL(NIM_BOOL, igBegin) with # define N_CDECL(rettype, name) rettype name macro |
23:03:09 | anddam | so NIM_BOOL igBegin |
23:03:15 | FromDiscord | <Yardanico> nonono, the latter is not a definition |
23:03:29 | anddam | I figured that was another macro defining a bool type |
23:03:40 | FromDiscord | <Yardanico> you're comparing wrong lines |
23:03:48 | FromDiscord | <Yardanico> its N_CDECL(NIM_BOOL, igBegin)(NCSTRING name, NIM_BOOL p_open, tyEnum_ImGuiWindowFlagslvrkR9a8PwSfwRiBZ19bRNCw flags); and CIMGUI_API bool igBegin(const char name,bool p_open,ImGuiWindowFlags flags); |
23:03:52 | FromDiscord | <Yardanico> for the first mismatch |
23:04:29 | anddam | and that's the part I copied |
23:04:42 | anddam | the error is at the igBegin symbol, isn't it? |
23:06:32 | FromDiscord | <Yardanico> no, the error seems to be with `bool` vs `NIM_BOOL` |
23:07:53 | anddam | yes, that's where I was going |
23:10:37 | FromDiscord | <Yardanico> oh, actually it can be because of `const char ` vs `char ` which is treated as separate types in C++ |
23:13:00 | PMunch | Hmm, accessing a global `let` from a func is an error. Should it be? |
23:13:04 | FromDiscord | <Yardanico> yes |
23:13:22 | FromDiscord | <Yardanico> i think the logic is that let is initialized in runtime |
23:13:22 | PMunch | Why? It's immutable |
23:13:40 | FromDiscord | <Yardanico> @PMunch not always, let refs are mutable (but strictFuncs deals with all mutable refs anyway) |
23:13:43 | PMunch | But if it's defined before the func it is initialised |
23:20:09 | FromDiscord | <Yardanico> so @anddam static linking works if you compile with the C++ backend |
23:20:33 | FromDiscord | <Yardanico> i think the problem is that cimgui itself is a C++ library, and the definitions don't match with nim cimgui, and I'm not sure how to fix that really |
23:20:44 | FromDiscord | <Yardanico> i don't understand why is it checking for C++ rules when compiling with the C backend |
23:21:14 | FromDiscord | <Yardanico> well there is one way to fix that |
23:21:22 | FromDiscord | <Yardanico> by changing all const char to char in cimgui.h :D |
23:22:13 | FromDiscord | <Yardanico> oof https://media.discordapp.net/attachments/371759389889003532/915744624507777074/unknown.png |
23:24:13 | FromDiscord | <Yardanico> @anddam after changing all const char to char this issue appears, and I can fix it by the last comment in https://github.com/cimgui/cimgui/issues/183 |
23:25:15 | * | lumo_e quit (Remote host closed the connection) |
23:25:48 | FromDiscord | <Yardanico> yeah now it works |
23:26:19 | FromDiscord | <Yardanico> so @anddam to build it you:↵1) rename all `const char ` in imgui.h to `char ` |
23:26:29 | FromDiscord | <Yardanico> 2) add ` -fno-threadsafe-statics` to CXXFLAGS in Makefile |
23:26:38 | FromDiscord | <Yardanico> then just build with `make -j8 static` and use that library with nim's C backend |
23:26:58 | FromDiscord | <Yardanico> and it works https://media.discordapp.net/attachments/371759389889003532/915745817569136680/unknown.png |
23:28:02 | FromDiscord | <Yardanico> 1.3mb binary with arc and -d:release after stripping |
23:31:10 | anddam | still quite big |
23:31:31 | anddam | but I guess it's still a full-featured GUI lib |
23:31:59 | PMunch | Happy now @Elegantbeef? https://github.com/nim-lang/Nim/pull/19207 |
23:32:15 | FromDiscord | <Yardanico> In reply to @anddam "still quite big": yeah i think it should be smaller |
23:34:27 | NimEventer | New thread by Dom96: Nim at FOSDEM 2022 - CfP is open!, see https://forum.nim-lang.org/t/8671 |
23:36:54 | anddam | Yardanico: is that replacement supposed to have the space? |
23:36:59 | FromDiscord | <Yardanico> doesn't matter |
23:37:06 | anddam | i.e. 'const char' but not 'const char*' |
23:37:21 | FromDiscord | <Yardanico> yeah for easier replacement just replace `const char` with `char` |
23:37:21 | FromDiscord | <evoalg> In reply to @PMunch "Happy now <@145405730571288577>? https://github.com": but what's a method |
23:37:32 | anddam | well it matters here, replacing all const char* to char* yields a huge amount of errors while building cimgui |
23:38:10 | anddam | cimgui.cpp:4569:22: error: invalid conversion from 'const char*' to 'char*' [-fpermissive] |
23:39:28 | anddam | can you pastebin your patched imgui.h? |
23:39:44 | FromDiscord | <bananahead> In reply to @PMunch "<@451387344109568011>, where would you": I followed this to begin with - https://nim-lang.org/docs/tut1.html#procedures It could mention there the difference between func and proc. As I started to see func more when I was reading random nim code |
23:40:11 | FromDiscord | <Yardanico> In reply to @anddam "cimgui.cpp:4569:22: error: invalid conversion": ah yeah there are two replacements that are different |
23:40:24 | FromDiscord | <Yardanico> search for CIMGUI_API void ImGuiTextBuffer_appendf in cimgui.h |
23:40:44 | FromDiscord | <Yardanico> and igLogText above it too |
23:40:52 | PMunch | @evoalg, methods are already defined there? @bananahead so my PR looks good? https://github.com/nim-lang/Nim/pull/19207 |
23:41:51 | anddam | https://termbin.com/gpq2 |
23:42:49 | FromDiscord | <Yardanico> just add -fpermissive then I guess |
23:43:16 | FromDiscord | <Yardanico> anyway, my cimgui.h |
23:43:27 | FromDiscord | <Yardanico> http://ix.io/3GIP |
23:43:33 | FromDiscord | <Yardanico> works without fpermissive |
23:45:01 | anddam | wait what was your imgui basis? |
23:45:19 | FromDiscord | <Yardanico> the nimgui one |
23:45:25 | anddam | I was editing the imgui/imgui.h file, not the one generated |
23:45:33 | FromDiscord | <Yardanico> oh yeah that's not the right one |
23:45:36 | FromDiscord | <Yardanico> you must edit cimgui.h |
23:45:59 | anddam | oh I took the previous "imgui.h" literally |
23:46:04 | anddam | so restoring this |
23:46:26 | FromDiscord | <Yardanico> i said cimgui.h previously too btw :P |
23:46:46 | FromDiscord | <Yardanico> ah nvm i see where i said imgui.h |
23:46:47 | FromDiscord | <Yardanico> sorry |
23:48:22 | anddam | np |
23:48:26 | anddam | you are more than helpfule |
23:48:53 | FromDiscord | <Yardanico> but yeah, seems like cimgui wasn't really developed for static linkage with C |
23:49:21 | * | PMunch quit (Quit: leaving) |
23:54:34 | anddam | semi-different topic, willing to make a very small executable that just displays a splash screen on win/lin/mac |
23:54:53 | anddam | what would be a good approach? size is the main metric here |
23:55:04 | anddam | using native API on three systems? |
23:55:27 | anddam | so win32|MFC|whatever windows use/Xlib/Cocoa? |
23:55:55 | FromDiscord | <ynfle (ynfle)> Is it a bug that math isn't reported as unused?https://play.nim-lang.org/#ix=3GIR |
23:56:00 | FromDiscord | <Elegantbeef> The easiest and most memory conscious would probably be statically linked sdl, but idk |
23:56:28 | anddam | this is partially related to this imgui interest, I want to create a full GUI app so I am going with that, but at the same time I hoped it would fit the bill for the small splash screen app too |
23:56:33 | FromDiscord | <Yardanico> In reply to @Elegantbeef "The easiest and most": yeah, although it's a bit wasteful for runtime resources since it uses OpenGL |
23:56:43 | FromDiscord | <Yardanico> for a simple splash screen |
23:56:51 | FromDiscord | <Elegantbeef> What are you talking about? |
23:56:54 | FromDiscord | <Yardanico> sdl2 |
23:57:02 | FromDiscord | <Elegantbeef> Why would sdl2 use opengl? |
23:57:04 | FromDiscord | <Yardanico> what |
23:57:17 | FromDiscord | <Elegantbeef> You can write directly to the window context without opengl |
23:57:31 | * | krux02 quit (Remote host closed the connection) |
23:57:47 | FromDiscord | <Yardanico> any examples? never heard of that |
23:58:00 | FromDiscord | <Elegantbeef> I mean Nico doesnt use opengl for drawing |
23:58:22 | FromDiscord | <Elegantbeef> It's rendered without an graphics API context |
23:59:10 | FromDiscord | <ynfle (ynfle)> Is it a bug that the math package isn't reported as unused here https://play.nim-lang.org/#ix=3GIR? |
23:59:33 | FromDiscord | <Elegantbeef> I swear i've seen this question before 😛 |