00:00:46 | FromDiscord | <Rika> It’s scuffed |
00:11:04 | NimEventer | New question by itil memek cantik: Nim regex to perform once not global replace, see https://stackoverflow.com/questions/71229867/nim-regex-to-perform-once-not-global-replace |
00:27:54 | FromDiscord | <jmgomez> Was able to compile the code and run it on iOS after importing it from Unity and call it from csharp oc.. The xcode part was easier than I initially imagined |
00:28:44 | FromDiscord | <jmgomez> so having the json that nim generates should not be too difficult to generate a xcode project from it |
00:29:09 | FromDiscord | <jmgomez> the thing is that you have to sign the library with your apple cert |
00:30:58 | * | vicfred quit (Quit: Leaving) |
00:33:54 | FromDiscord | <huantian> In reply to @huantian "is something like this": hm ok this does not work with multisync painnnn |
00:35:47 | FromDiscord | <Elegantbeef> What's the multisync turn it into? |
00:36:25 | FromDiscord | <huantian> uh I should check |
00:36:34 | FromDiscord | <huantian> actually this might be because I'm not modifying await |
00:37:05 | FromDiscord | <huantian> since I'd assume the non-async verion multisync makes uses it's own await stuff |
00:40:23 | FromDiscord | <huantian> lemme try modifying await |
00:43:47 | * | krux02 joined #nim |
01:00:14 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
01:02:34 | FromDiscord | <huantian> perhaps I'm using mulitsync wrong, this doesn't seem to work:↵<https://play.nim-lang.org/#ix=3Qs8> |
01:03:14 | FromDiscord | <huantian> quote the docs, ↵> whereas the generated synchronous procedures simply strip off the await calls. |
01:12:00 | FromDiscord | <huantian> yeah no I think I'm just using it wrong lmao |
01:13:53 | FromDiscord | <huantian> man multisync is interesting |
01:16:05 | * | Gustavo6046_ joined #nim |
01:17:30 | * | Gustavo6046 is now known as Guest5407 |
01:17:30 | * | Guest5407 quit (Killed (silver.libera.chat (Nickname regained by services))) |
01:17:30 | * | Gustavo6046_ is now known as Gustavo6046 |
01:25:26 | FromDiscord | <huantian> isInAsync seems to fail when you use multisync incorrectly, which is probably not good since it'll print a misleading error message↵but that seems like it's multisync's problem |
01:28:29 | NimEventer | New thread by Mardiyah: To get the PCRE version by executing Nim, see https://forum.nim-lang.org/t/8941 |
01:51:01 | * | rockcavera quit (Remote host closed the connection) |
01:54:37 | FromDiscord | <Fail> sent a code paste, see https://play.nim-lang.org/#ix=3Qsm |
01:54:49 | FromDiscord | <Elegantbeef> Depends what the macros do |
01:54:58 | FromDiscord | <Fail> well, im trying to do this |
01:54:58 | FromDiscord | <Fail> https://docs.microsoft.com/en-us/windows/win32/learnwin32/your-first-windows-program |
01:55:08 | FromDiscord | <Elegantbeef> https://github.com/khchen/winim/blob/b7b32603f4ef672bc34405bc6200e8aab2c366b1/examples/hellowin.nim#L10 |
01:55:11 | FromDiscord | <Elegantbeef> Just use winim |
01:55:30 | FromDiscord | <Fail> In reply to @Elegantbeef "Just use winim": okay |
02:58:28 | * | neurocyte0917090 quit (Ping timeout: 272 seconds) |
03:02:27 | * | arkurious quit (Quit: Leaving) |
03:16:15 | FromDiscord | <dangbinghoo> hi, is there any higher level nim2c generator tools? what I want is that I can export some nim proc to C, the generator just output a C header and static lib (or a single C source can be easily add to pure C project without setting nim lib c headers path ), thanks! |
03:16:42 | FromDiscord | <Elegantbeef> genny perhaps |
03:17:02 | FromDiscord | <Elegantbeef> https://github.com/treeform/genny |
03:22:24 | FromDiscord | <dangbinghoo> ok, that's almost what I want, but it seems that genny can only generate dynamic-lib? |
03:27:28 | FromDiscord | <Elegantbeef> Seems that way i guess |
03:28:25 | * | Gustavo6046 quit (Quit: Leaving) |
03:34:25 | FromDiscord | <congusbongus> would you need to transpile to C in order to create a static lib? |
03:36:10 | FromDiscord | <dangbinghoo> I just want to call nim proc in C |
03:37:14 | FromDiscord | <Elegantbeef> You should be able to make a static lib using Nim, the header is the main issue |
03:37:38 | FromDiscord | <Elegantbeef> doesnt know much about static libs, so assuming a header is needed |
03:37:52 | FromDiscord | <dangbinghoo> I guess I can just-compile-and-dont-link nim compiler generated nimcache to a static lib? |
03:38:17 | FromDiscord | <Elegantbeef> there is a `--staticlib` flag i think |
03:39:28 | FromDiscord | <dangbinghoo> OK, I will try it, only need to manually write exported nim proc to a c header. |
03:40:16 | FromDiscord | <dangbinghoo> thanks for all your help ! 🤝 |
03:40:34 | FromDiscord | <Elegantbeef> ah it's `--app:staticlib` |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:31 | * | supakeen joined #nim |
04:11:14 | FromDiscord | <dangbinghoo> In reply to @Elegantbeef "ah it's `--app:staticlib`": 👍 |
04:12:42 | madprops | hi animals |
04:43:46 | FromDiscord | <Rika> Hello alien |
04:58:11 | * | slowButPresent quit (Quit: leaving) |
05:16:31 | * | krux02 quit (Remote host closed the connection) |
06:26:35 | FromDiscord | <dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3Qte |
06:27:07 | FromDiscord | <dangbinghoo> a_b_jsexp.nim(14, 14) Warning: implicit conversion to 'cstring' from a non-const location: $j; this will become a compile time error in the future [CStringConv] |
06:27:30 | FromDiscord | <dangbinghoo> --------- |
06:27:31 | FromDiscord | <Elegantbeef> `cstring $j` |
06:27:52 | FromDiscord | <Elegantbeef> Though that's still unsafe |
06:28:18 | FromDiscord | <dangbinghoo> is there any safe way to solve this? |
06:28:50 | * | jmdaemon joined #nim |
06:28:58 | FromDiscord | <Rika> What do you mean unsafe? I don’t see how |
06:29:04 | FromDiscord | <Elegantbeef> Copy the string to a cstring, return it then require the user to free it |
06:29:10 | FromDiscord | <Elegantbeef> This is in a library rika |
06:29:43 | FromDiscord | <Elegantbeef> `$j` will not outlive the function |
06:29:50 | FromDiscord | <dangbinghoo> yes, lora_gw_t_to_jsonstr_p is nim proc exported to be used in C land |
06:30:22 | FromDiscord | <Elegantbeef> you know you can give it a proper Nim name then do `exportC: "myCProcName"`? |
06:30:35 | FromDiscord | <Elegantbeef> Atleast i think yo ucan |
06:33:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/sHV |
06:33:29 | FromDiscord | <Rika> In reply to @Elegantbeef "`$j` will not outlive": Ain’t this a copy |
06:33:51 | FromDiscord | <Elegantbeef> the return type is `cstring` |
06:33:57 | FromDiscord | <Rika> I guess |
06:34:28 | FromDiscord | <Elegantbeef> It's returning a pointer across the library barrier, it's unsafe to have a pointer to gc'd memory |
06:34:56 | FromDiscord | <Rika> Ah yeah it’s a string |
06:35:22 | FromDiscord | <Elegantbeef> then you also need a `func nimFree(p: pointer) {.exportC.} = dealloc(p)` |
06:36:23 | FromDiscord | <Elegantbeef> Hopefully that makes sense |
06:37:07 | FromDiscord | <dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3Qti |
06:37:16 | FromDiscord | <Elegantbeef> There you go |
06:37:20 | FromDiscord | <Elegantbeef> take in a `cstring` |
06:37:26 | FromDiscord | <Elegantbeef> not a `ptr char` |
06:37:44 | FromDiscord | <dangbinghoo> so, I just copy generated cstring to a C char buffer. |
06:37:45 | FromDiscord | <Rika> They are equivalent in C |
06:37:56 | FromDiscord | <Rika> A cstring is a char buffer |
06:38:02 | FromDiscord | <dangbinghoo> ok |
06:38:11 | FromDiscord | <Elegantbeef> Shouldnt you also pass in the size of the allocated string? |
06:38:18 | FromDiscord | <Rika> Yes |
06:38:29 | FromDiscord | <Rika> It’s better to |
06:39:33 | FromDiscord | <dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3Qtj |
06:39:47 | FromDiscord | <Rika> Again ptr char -> cstring |
06:40:03 | FromDiscord | <Elegantbeef> Well i'd still say use `cstring` just cause it's easier to work with from nim |
06:40:11 | FromDiscord | <dangbinghoo> (edit) "https://play.nim-lang.org/#ix=3Qtj" => "https://play.nim-lang.org/#ix=3Qtk" |
06:40:35 | FromDiscord | <dangbinghoo> ok, thanks! |
06:41:03 | FromDiscord | <Elegantbeef> Otherwise you need to do` copyMem(cast[ptr UncheckedArray[char](strBuff)[0].addr, str[0].addr, str.len + 1)` |
06:41:20 | FromDiscord | <Elegantbeef> Bit tedious given you can just change it to a `cstring` 😛 |
06:48:54 | FromDiscord | <dangbinghoo> In reply to @Elegantbeef "Bit tedious given you": thank you for your great help. |
06:49:29 | FromDiscord | <Elegantbeef> No problem |
06:49:38 | FromDiscord | <dangbinghoo> I'm doing this, just cause cJson is very ugly to me. |
06:50:40 | FromDiscord | <Elegantbeef> interesting |
06:50:41 | FromDiscord | <dangbinghoo> so I implement the C struct to json manipulation in nim, and export to C users.😂 |
06:50:59 | * | GreaseMonkey quit (Read error: Connection reset by peer) |
06:51:12 | FromDiscord | <Elegantbeef> Make sure you build the library using `--gc:orc` |
06:51:22 | FromDiscord | <Elegantbeef> This way you dont have any setup so no need for `nimMain()` |
06:52:02 | FromDiscord | <dangbinghoo> I will use this for ESP32, so, is `--gc:arc` OK? |
06:52:48 | FromDiscord | <Elegantbeef> yea |
06:52:49 | FromDiscord | <Elegantbeef> Probably, atleast |
06:52:55 | FromDiscord | <Elegantbeef> Json nodes are acyclical iirc |
06:53:32 | FromDiscord | <dangbinghoo> this is how I generate the .a `nim c --app:staticLib --noMain a_b_jsexp.nim` |
06:54:05 | FromDiscord | <Elegantbeef> you can make a `config.nims` with those flags so you can just do `nim c a_b_jsexp.nim` |
06:54:41 | FromDiscord | <dangbinghoo> In reply to @Elegantbeef "you can make a": ok |
06:57:04 | FromDiscord | <Rika> In reply to @Elegantbeef "Json nodes are acyclical": You do recall correctly |
06:57:16 | FromDiscord | <Rika> JSON that is cyclical is not JSON |
06:57:38 | FromDiscord | <Elegantbeef> I more meant marked as such |
06:58:07 | FromDiscord | <Rika> I believe so as well then |
07:01:34 | FromDiscord | <Rika> In reply to @dangbinghoo "I will use this": Are you sure you have enough RAM for whatever you are doing? |
07:02:08 | FromDiscord | <Rika> In reply to @Elegantbeef "This way you dont": Depends on what he’s doing exactly though? |
07:02:36 | FromDiscord | <Elegantbeef> Well yea, if they have toplevel statements they need main |
07:03:05 | FromDiscord | <Elegantbeef> But given they're just using the Nim JSON library it's less of an issue |
07:04:25 | FromDiscord | <Elegantbeef> One could avoid the double allocation and unsafety if the added the strings to a sequence or similar |
07:04:55 | FromDiscord | <Elegantbeef> Some sort of buffer of the strings to keep them alive until freed |
07:29:06 | FromDiscord | <dangbinghoo> In reply to @Rika "Are you sure you": I don't know, I should have a test after I got the basic experiment done on my PC Linux. |
07:29:55 | FromDiscord | <dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3Qtu |
07:30:12 | FromDiscord | <dangbinghoo> Error: attempting to call routine: 'max_sz' |
07:30:27 | FromDiscord | <Elegantbeef> `-1` should be `- 1` |
07:30:52 | FromDiscord | <Rika> Consistent spacing is important in Nim |
07:31:15 | FromDiscord | <Elegantbeef> In nim operators bind tightly if there is no space |
07:31:25 | FromDiscord | <dangbinghoo> wow, ok, thanks! |
07:45:36 | FromDiscord | <dangbinghoo> can nim's generic (or template) proc be exported to C land? |
07:47:38 | FromDiscord | <Elegantbeef> No, you need a concrete instantiation |
07:48:23 | FromDiscord | <Elegantbeef> If you have a generic function you want to export you'll have to manually wrap it end export it |
07:49:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Qtv |
07:49:12 | FromDiscord | <Elegantbeef> You can of course automate this a bit with a template |
07:49:24 | FromDiscord | <dangbinghoo> OK |
07:49:46 | * | PMunch joined #nim |
08:24:35 | FromDiscord | <dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3QtG |
08:25:19 | FromDiscord | <dangbinghoo> is my_str a string constructed directly using the cstring `in_str`'s memory? |
08:26:36 | FromDiscord | <dangbinghoo> (edit) "https://play.nim-lang.org/#ix=3QtG" => "https://play.nim-lang.org/#ix=3QtH" |
08:27:05 | FromDiscord | <Elegantbeef> yes it's going to be like `strcpy` in C |
08:27:23 | PMunch | There you are @Elegantbeef! |
08:27:40 | FromDiscord | <Elegantbeef> It'll go up to the first null terminator and copy it into a string |
08:27:40 | FromDiscord | <Elegantbeef> There i am? |
08:27:40 | FromDiscord | <Elegantbeef> Did you need me?! |
08:27:55 | PMunch | I was working with nimscripter yesterday |
08:28:04 | FromDiscord | <Elegantbeef> Fuuuuck a bug report |
08:28:19 | PMunch | Haha, no I haven't created a bug report :P |
08:28:20 | PMunch | https://github.com/PMunch/ratel |
08:28:24 | PMunch | Oops |
08:28:36 | PMunch | I was trying to implement this: https://github.com/PMunch/ratel/issues/10 |
08:28:47 | FromDiscord | <Elegantbeef> Well i never hear anyone say "Oh yea i was using your library, and it works wonderfully" |
08:29:03 | PMunch | And was struggling to get those `--` templates registered properly |
08:29:26 | FromDiscord | <Elegantbeef> Yea this is a common issue i've been seeing, the VM that Nim uses is special |
08:29:41 | PMunch | I was basically trying to do this: http://ix.io/3Qnt |
08:29:54 | PMunch | Special? |
08:30:03 | FromDiscord | <Elegantbeef> Ah nevermind you did that |
08:30:09 | PMunch | Just adding in "nimscript" as a library and it works just fine |
08:30:29 | PMunch | But I want to overload them so they're not actually changing switches in my NimScript environment |
08:30:56 | FromDiscord | <Elegantbeef> Give me a moment, need to test this |
08:31:03 | FromDiscord | <Elegantbeef> Dont know the error |
08:31:57 | FromDiscord | <Elegantbeef> and you said this wasnt a bug report |
08:33:27 | FromDiscord | <Elegantbeef> you might not be able to export templates this way |
08:33:40 | FromDiscord | <Elegantbeef> Which makes sense given their symbols are funky |
08:34:23 | PMunch | https://irclogs.nim-lang.org/22-02-2022.html#11:56:03 |
08:34:28 | PMunch | That's from yesterday |
08:36:11 | FromDiscord | <Elegantbeef> Yep i'm right we cannot export templates this way |
08:46:29 | FromDiscord | <Elegantbeef> There you go pmunch `1.0.12` should do the trick for you |
08:46:55 | FromDiscord | <Elegantbeef> Will need to follow https://github.com/beef331/nimscripter#exporting-code-verbatim though |
08:47:38 | PMunch | Oh wow, that was quick :) |
08:48:02 | FromDiscord | <Elegantbeef> What can i say shitty code is easy to write |
08:48:19 | PMunch | Haha :P |
08:51:00 | FromDiscord | <Elegantbeef> I would like to make it a bit smarter, but templates dont work like procs symbol wise |
08:53:20 | PMunch | Hmm, they work differently? |
08:53:31 | FromDiscord | <Elegantbeef> Yea you cant pass them as a symbol |
08:54:12 | FromDiscord | <Elegantbeef> Oh atleast i dont think so |
08:54:19 | PMunch | Ah so the export(module, myTemplate) thing can't work? |
08:54:35 | FromDiscord | <Elegantbeef> hmm i might be wrong |
08:54:48 | FromDiscord | <Elegantbeef> I'm very wrong |
09:00:02 | FromDiscord | <Elegantbeef> It was actually an overload issue |
09:00:57 | * | jmdaemon quit (Ping timeout: 240 seconds) |
09:01:15 | FromDiscord | <Elegantbeef> there you now can happily do exportTo(shims, switch, `--`) |
09:01:27 | * | jmdaemon joined #nim |
09:02:53 | FromDiscord | <Elegantbeef> So pmunch go with the most recent nimscripter, and be merry i guess |
09:03:02 | FromDiscord | <Elegantbeef> Hopefully it doesnt have any other issues |
09:03:27 | PMunch | Oh cool! |
09:04:27 | FromDiscord | <Elegantbeef> \yes i felt like i had to tell mention the exportTo since i seen the two independant statements |
09:07:56 | * | jjido joined #nim |
09:08:23 | FromDiscord | <Elegantbeef> Also odd that I didnt get pinged with your mention of me, perhaps it was the '@' |
09:19:16 | PMunch | By the way, would be nice with some more in-depth documentation :P |
09:20:45 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:21:43 | FromDiscord | <Elegantbeef> If only I hated myself |
09:25:47 | PMunch | One day I hope to find the weirdo who loves writing documentation but doesn't like to code |
09:26:01 | FromDiscord | <Elegantbeef> Lol, good luck |
09:26:22 | FromDiscord | <abdu> How do we check a file name exist, like Bash if [ -f "FOO" ] ;then echo "YUP file is there" |
09:27:48 | FromDiscord | <Elegantbeef> `import std/os; if fileExists("foo"): echo("Yep file is there")` |
09:40:16 | FromDiscord | <abdu> ... then make sure its reading works no error at all ? |
09:46:59 | PMunch | `try: readFile("foo") except: echo "Something went wrong"` |
09:47:38 | FromDiscord | <xx_ns> yolo, try reading it even if it fails or the file isn't there |
09:48:32 | FromDiscord | <Goel> readFile already: `Raises an IO exception in case of an error` |
09:49:34 | * | jjido joined #nim |
09:57:37 | * | jmdaemon quit (Ping timeout: 240 seconds) |
10:17:19 | FromDiscord | <demotomohiro> It sounds like https://en.m.wikipedia.org/wiki/Time-of-check_to_time-of-use |
10:21:49 | FromDiscord | <Rika> toctou is important even if single threaded ESPECIALLY if its files |
11:04:14 | FromDiscord | <ShalokShalom> Mosh + Editor is probably the most simple solution to code on the go? |
11:10:50 | PMunch | Or just termux |
11:11:12 | PMunch | Nim can run under Termux so you can dev directly on your phone |
11:12:35 | FromDiscord | <ShalokShalom> Hnn. Sounds awesome |
11:20:09 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3Quq |
11:20:11 | FromDiscord | <impbox [ftsf]> this code used to compile |
11:20:43 | FromDiscord | <impbox [ftsf]> just had to reinstall OS and nim and now things are broken |
11:21:48 | FromDiscord | <impbox [ftsf]> hmm, seems broken since 1.6 |
11:22:07 | FromDiscord | <mratsim> float32 now can silently convert to float32? |
11:22:15 | FromDiscord | <mratsim> is it a float literal? |
11:22:37 | FromDiscord | <impbox [ftsf]> it's a comparison between a float32 and 0 literal |
11:22:46 | FromDiscord | <impbox [ftsf]> now needs 0f i guess |
11:38:10 | PMunch | Wait, that means float32 can now implicitly convert to int? |
11:38:14 | PMunch | That doesn't seem right |
11:41:08 | FromDiscord | <impbox [ftsf]> hmm, i think it's because i have converters |
11:41:21 | FromDiscord | <impbox [ftsf]> but the behaviour seems to have changed between versions |
11:41:48 | FromDiscord | <impbox [ftsf]> but doesn't seem to be a documented change in converter behaviour |
11:41:54 | PMunch | Converters are always a mess.. |
11:54:04 | FromDiscord | <Hamid_Bluri> sent a long message, see https://paste.rs/sXE |
11:54:31 | FromDiscord | <Hamid_Bluri> of |
11:57:52 | PMunch | Hmm, I guess I could. Got plenty other stuff to do though |
11:58:09 | PMunch | Is there anything in particular you don't get? |
11:58:16 | PMunch | Just the {.effects.} pragma? |
12:00:07 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3QuA |
12:00:17 | NimEventer | New thread by Drkameleon: AsyncHttpServer running in the background, spawn & closures, see https://forum.nim-lang.org/t/8942 |
12:01:52 | PMunch | I'm also struggling with a converter issue right now.. |
12:02:04 | PMunch | Seems like something might've messed up converters lately |
12:02:26 | PMunch | @Hamid_Bluri ^ |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:32 | * | supakeen joined #nim |
12:11:09 | FromDiscord | <impbox [ftsf]> hmm is there a way to make a proc take a `SomeNumber` or similar and have it implicitly converted to `int` for example? |
12:11:32 | FromDiscord | <impbox [ftsf]> i was doing it via converters, but they seem to have further reaching effects |
12:11:52 | FromDiscord | <impbox [ftsf]> I only want the conversions to happen when passing arguments to these procs |
12:12:25 | FromDiscord | <Tanguy> You can do a macro that automatically creates a overloaded proc |
12:12:37 | FromDiscord | <impbox [ftsf]> I don't want an overloaded proc |
12:12:49 | FromDiscord | <impbox [ftsf]> otherwise i'd just use SomeNumber |
12:13:33 | PMunch | impbox_[ftsf], how about taking SomeNumber and then just calling `int` on it manually? |
12:13:50 | FromDiscord | <impbox [ftsf]> that'll be creating lots of extra procs |
12:13:53 | PMunch | Or am I missing something? Why do you need it to be implicit? |
12:13:54 | FromDiscord | <impbox [ftsf]> (edit) "that'll be creating lots of extra procs ... " added "in the code space" |
12:14:09 | FromDiscord | <impbox [ftsf]> I want the caller to not have to care about what they're passing it |
12:14:17 | FromDiscord | <impbox [ftsf]> and have the conversion done outside the proc |
12:14:40 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=3QuJ |
12:14:57 | FromDiscord | <impbox [ftsf]> so if the proc wants an int and the caller passes a float it'd be implicitly converted to an int at the call site |
12:15:42 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://paste.rs/byb |
12:16:02 | FromDiscord | <impbox [ftsf]> (edit) "https://play.nim-lang.org/#ix=3QuK" => "https://paste.rs/U8E" |
12:16:34 | FromDiscord | <impbox [ftsf]> this is pretty much what I'm doing with converters, and it worked great previously |
12:17:04 | PMunch | This is so freaking annoying: /home/peter/.choosenim/toolchains/nim-1.6.4/lib/system/dollars.nim(108, 12) Error: request to generate code for .compileTime proc: Lit |
12:17:17 | PMunch | It doesn't even tell me what called the dollars procedure.. |
12:18:33 | FromDiscord | <Tanguy> You could also have a macro at call site, would be even better since you could mix the SomeNumbers and ints |
12:21:12 | FromDiscord | <konsumlamm> In reply to @impbox "hmm is there a": it doesn't even make sense for every number type to be implicitly converted to `int` (e.g. `uint` or floats) |
12:24:22 | FromDiscord | <impbox [ftsf]> I'd like it to act just as if they did whatever.int, if that would throw an error it can throw an error. It's for a "friendly" game programming framework, I don't want people to have to care about whether the argument they're passing is a float or an int |
12:24:35 | FromDiscord | <impbox [ftsf]> it's also more to avoid breaking all the existing game code which relies on the old behaviour |
12:26:07 | FromDiscord | <untoreh> can nim do named arguments from identifiers? |
12:26:12 | FromDiscord | <mratsim> In reply to @impbox "hmm is there a": use a template to scope conversion? |
12:26:38 | FromDiscord | <mratsim> the proc are defined in the template and so accessible only within its scope. |
12:26:50 | FromDiscord | <mratsim> There is an example for safe pointer arithmetic in the forum. |
12:27:06 | FromDiscord | <impbox [ftsf]> mmm, I guess it's doable, a lot of work though |
12:27:11 | FromDiscord | <impbox [ftsf]> pretty big API |
12:27:40 | FromDiscord | <Tanguy> https://play.nim-lang.org/#ix=3QuN↵Dumb macro example↵The real one would need to read the parameters of the passed `v` and cast every one of them that you want to cast |
12:27:45 | FromDiscord | <mratsim> personally I had converters for float -> complex, and then just banned them from my codebase |
12:28:13 | FromDiscord | <impbox [ftsf]> mmm if i was building it from scratch maybe i wouldn't do the converter thing again |
12:28:33 | FromDiscord | <impbox [ftsf]> but all the explicit conversions get pretty ugly |
12:29:44 | FromDiscord | <impbox [ftsf]> @Tanguy that'd pretty nice |
12:29:48 | FromDiscord | <impbox [ftsf]> (edit) "that'd" => "that's" |
12:33:20 | FromDiscord | <mratsim> {.push magicmacro.} |
12:34:27 | PMunch | I have converters in macroutils, and my problem with them is that whenever there's a type issue it tries to call the converter and craps out because it tries to create a NimNode.. |
12:35:05 | FromDiscord | <mratsim> Ah yes. |
12:35:12 | FromDiscord | <mratsim> And ambiguous calls ... |
12:36:14 | FromDiscord | <mratsim> https://github.com/mratsim/Arraymancer/issues/394 |
12:36:15 | PMunch | The logic around when to apply a converter should really be improved |
12:36:51 | FromDiscord | <mratsim> converter breaks as soon as you need `$` on non-int |
12:37:01 | FromDiscord | <impbox [ftsf]> mmm, i'm gonna sleep on it |
12:37:03 | PMunch | It should be something like `when not compiles(somecode): when compiles(applyConverters(somecode)): applyConverters(someCode) else: somecode else: somecode` |
12:37:04 | FromDiscord | <impbox [ftsf]> thanks for the ideas |
12:43:32 | PMunch | Hmm, even if I try to mark the converter as `{.compileTime.}` it doesn't work.. |
12:43:55 | PMunch | Like why would it try to apply a converter it can't apply without crashing?! |
12:43:59 | PMunch | It's so dumb! |
12:48:13 | FromDiscord | <haolian9 (高浩亮)> lol, even pro like PMunch can get upset |
12:49:12 | FromDiscord | <mratsim> In reply to @haolian9 (高浩亮) "lol, even pro like": watch me get upset about types in macros or genric instantiation |
12:49:37 | FromDiscord | <mratsim> https://github.com/nim-lang/RFCs/issues/44 |
12:50:11 | FromDiscord | <mratsim> https://github.com/nim-lang/Nim/issues/8677 |
12:54:48 | PMunch | Nim is such a nice language, but the bugs are so frustrating when you find them :P |
12:57:25 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:00:34 | FromDiscord | <Tanguy> In reply to @mratsim "{.push magicmacro.}": Nope :p remember https://github.com/nim-lang/Nim/issues/12867 |
13:16:04 | * | jjido joined #nim |
13:16:59 | FromDiscord | <Hamid_Bluri> I remember this stupid issue 😄 ↵https://github.com/nim-lang/Nim/issues/18342 |
13:17:54 | * | krux02 joined #nim |
13:19:20 | FromDiscord | <locriacyber> Nim contributors, how do I add tests for std |
13:20:06 | FromDiscord | <Hamid_Bluri> in runnableExamples I guess if it's specific for a proc |
13:20:28 | FromDiscord | <Hamid_Bluri> @locriacyber |
13:20:38 | FromDiscord | <locriacyber> How do I run the specific test |
13:21:38 | PMunch | `runnableExamples` isn't really meant for tests |
13:22:03 | PMunch | It's meant for examples, but the examples are compiled and tested whenever the documentation is built (with `nim doc`). |
13:22:46 | PMunch | If you want to create an actual test for the standard library you should add them here: https://github.com/nim-lang/Nim/tree/devel/tests |
13:23:02 | FromDiscord | <locriacyber> Thanks |
13:23:07 | PMunch | That README alse tells you how tests are written, and how you can run a test |
13:23:39 | FromDiscord | <locriacyber> I'm trying to make sequtils usable with iterable in #19557 |
13:24:22 | FromDiscord | <Hamid_Bluri> wow, I really wished that |
13:24:25 | FromDiscord | <locriacyber> Does all the intermediate `seq` get compiled away or what |
13:24:49 | PMunch | Not quite sure what you mean? |
13:25:23 | FromDiscord | <locriacyber> So `filterIt` returns a seq |
13:25:37 | PMunch | I believe so, yes |
13:26:00 | FromDiscord | <locriacyber> What if I chain two together |
13:26:25 | FromDiscord | <Hamid_Bluri> https://github.com/zero-functional/zero-functional ? |
13:26:45 | FromDiscord | <locriacyber> Thanks, that's what I'm looking for |
13:26:54 | FromDiscord | <Hamid_Bluri> you're welcome |
13:27:39 | PMunch | If you chain two together it will create intermediary sequences |
13:29:04 | * | slowButPresent joined #nim |
13:29:20 | FromDiscord | <konsumlamm> ye, `sequtils` allocates a lot of unnecessary intermediate seqs, there is no fusion going on |
13:29:56 | PMunch | Damn it.. Foiled by macros and the damn `os` switch again.. |
13:30:14 | PMunch | Well, I guess this example wouldn't have worked anyways |
13:31:40 | PMunch | But I tried to run Futhark while cross compiling with `--os:windows`. This means the macro in Futhark now uses backslash instead of slash as the path separator and then tries to run Opir on Linux with incorrect paths.. |
13:32:04 | PMunch | There should really be a better distinction of runtime and compile-time OS in Nim.. |
13:32:36 | PMunch | Macros shouldn't fail because the target OS doesn't support something the running OS does |
13:32:59 | PMunch | (See my previous rants on `--os:any` and macros trying to read from the file system of the compiling machine) |
13:34:28 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:48:33 | FromDiscord | <coldfussion> Found a legit question on fedi\: "why nim documentation of libraries suck so much balls?" |
13:49:43 | PMunch | Hard to tell without knowing which libraries they're talking about. Most likely because people are having too much fun writing Nim code to write documentation :P |
13:56:37 | FromDiscord | <Hamid_Bluri> Nim doc is much better than python btw |
13:58:23 | * | Abrax quit (Quit: Leaving) |
14:07:28 | PMunch | By the way, what is fedi? |
14:09:56 | FromDiscord | <konsumlamm> nim doc is better than a whole language? /s |
14:17:49 | FromDiscord | <coldfussion> Fediverse, a bunch of federated social networks, e.g. mastodon, pleroma, peertube...↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
14:20:55 | FromDiscord | <deeuu> Hey people,↵Does anyone actually use exception tracking (e.g.`{.push raises:[].}↵` at top) in general? Curious to hear opinions and use cases! Cheers |
14:21:24 | FromDiscord | <coldfussion> Well, I noticed too that for a lot of libraries I'm lucky if there even is some kind of documentation. "Hosted docs" button on nimble.directory only led me to error pages. And when there is a documentation it's usually some automated index of modules with little to no explanation or just very scarce overview of basic functions...↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
14:21:45 | * | arkurious joined #nim |
14:25:27 | FromDiscord | <coldfussion> Never used that. But I'm coming from python, so I'm used to exception flying everywhere🙂↵(@deeuu) |
14:29:45 | FromDiscord | <auxym> In reply to @konsumlamm "nim doc is better": sphinx is pretty good TBH, I'm not sure nim-doc is exactly there yet |
14:30:15 | PMunch | @deeuu, I've used it in a dynamic library |
14:30:43 | PMunch | Ah wait, not with `{.push.}` |
14:30:56 | PMunch | I just had it on the main entry-point |
14:32:28 | PMunch | @coldfussion, hmm that's unfortunate. The nimble.directory hosted docs do tend to break quite often. federico3, you're aware of this, right? Otherwise it's usually a matter of reading the README for the projects if you can't find all you need in the doc-comments |
14:51:27 | PMunch | @Elegantbeef, you still around? |
14:51:42 | PMunch | Tried to do http://ix.io/3QvI, but it fails |
14:53:12 | PMunch | Hmm, it seems like it's `Whitespace` it doesn't like.. |
14:53:48 | PMunch | I guess the easiest thing would be to just create nimscript shim and add that as a NimScript module |
15:23:33 | FromDiscord | <abdu> i can't print ie. echo a variable reference by `addr` or `unsafeAddr` ↵how to do correctly ? |
15:25:12 | FromDiscord | <mratsim> In reply to @abdu "i can't print ie.": use `repr` for debugging thouse |
15:25:17 | FromDiscord | <mratsim> (edit) "thouse" => "those" |
15:25:24 | FromDiscord | <mratsim> echo foo.repr |
15:27:49 | NimEventer | New thread by Mardiyah: Must check to decide whether this current iteration in a loop is the last , see https://forum.nim-lang.org/t/8943 |
15:54:56 | FromDiscord | <Iapetus11> Considering some people fall for these it may be wise to ban this guy. ID: 907276095072632893 https://media.discordapp.net/attachments/371759389889003532/946072643319234630/unknown.png https://media.discordapp.net/attachments/371759389889003532/946072643554148382/unknown.png |
16:00:06 | * | happycorsair[m] quit (Quit: You have been kicked for being idle) |
16:12:22 | FromDiscord | <haolian9 (高浩亮)> with ORC, do i have to define `proc =destroy` for my custom object type? |
16:18:21 | FromDiscord | <haolian9 (高浩亮)> i found the answer in [here](https://nim-lang.org/docs/destructors.html#hook-generation), ignore me. |
16:35:28 | FromDiscord | <treeform> In reply to @PMunch "<@107140179025735680>, I'm looking at": We have updated the python package to match the Nim one. |
16:41:16 | PMunch | Nice |
17:09:11 | FromDiscord | <Phil> On the one hand, I now have time again to deal with this libwebp wrapping thing |
17:09:18 | FromDiscord | <Phil> On the other, I still really don't want to deal with it |
17:09:37 | FromDiscord | <Phil> (edit) "On the other, I still really don't want to deal with it ... " added "and it feels very non-trivial with tons of gotchas waiting for me" |
17:09:59 | PMunch | (Obligatory "haaaave you heard about Futhark" pitch) |
17:10:24 | FromDiscord | <Phil> My gotchas thingy was including futhark |
17:10:35 | FromDiscord | <Phil> Because it still means understanding this clusterfuck of a libwebp API |
17:10:54 | PMunch | Ah :P |
17:11:11 | FromDiscord | <Phil> Or maybe it's not a clusterfuck and I'm just too unused to dealing with C code |
17:11:22 | FromDiscord | <Phil> (edit) "Or maybe it's not a clusterfuck and I'm just too unused to dealing with C code ... " added "and thus pulling up the horse blinders" |
17:12:25 | PMunch | Well Futhark should do most of the heavy lifting with the C code |
17:13:14 | FromDiscord | <Phil> It pretty much does... I think (I haven't actually tried out the one function I wrapped so far). It grants me the function in nim, which allows me to make a more easy-to-use API out of it |
17:14:25 | FromDiscord | <Phil> But that still leaves me to deal with procs like this and pray you properly understood them:↵` let size: csize_t = WebPEncodeRgb(dataFirstBytePointer, width, height, stride, qualityFactor, outputFirstBytePointer)` |
17:14:39 | FromDiscord | <Phil> variable names provided by me as I understood that proc so far |
17:15:50 | FromDiscord | <Phil> Which I'm maybe a sissy on because I have my roots in python/JS but I do not consider the doccomments in the header file really all that useful where I would have expected them to be |
17:16:17 | FromDiscord | <Phil> (edit) "file" => "files of libwebp" |
17:16:18 | FromDiscord | <ajusa> hopefully this is just me being stupid, but why do the docs here say that the last parameter defaults to s.high when it defaults to 0? https://nim-lang.org/docs/strutils.html#find%2Cstring%2Cstring%2CNatural%2Cint |
17:19:15 | FromDiscord | <Phil> I don't think I understand what you mean by s.high.↵As far as I understand the proc: Look for the given substring "sub" in the string "s" from index 0 to index s.high (aka s.len - 1). |
17:19:20 | PMunch | @ajusa, because if it is 0 it is set to high in the body: https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/strutils.nim#L1821 |
17:19:38 | FromDiscord | <Phil> Ohhh you mean the default value is 0 |
17:19:56 | FromDiscord | <Phil> (edit) "Ohhh you mean the default value is 0 ... " added "as given by the parameter" |
17:20:47 | * | PMunch quit (Quit: leaving) |
17:20:51 | * | vicfred joined #nim |
17:23:40 | FromDiscord | <Phil> @treeform You don't, perchance, have webp support in pixie like right around the corner, do you? |
17:30:12 | FromDiscord | <abdu> Got error in handling command line:↵`Error: undeclared identifier: 'commandLineParams'`↵How solving it |
17:30:25 | * | jjido joined #nim |
17:32:27 | FromDiscord | <Phil> It'd help to show what you're executing that causes that error 😛 |
17:50:36 | FromDiscord | <ajusa> In reply to @PMunch "<@102899813149855744>, because if it": huh, I wonder why it isn't just set in the proc definition? thanks for the code link though, I should have glanced at that first |
17:53:29 | FromDiscord | <Phil> Hmmm design question |
17:59:31 | * | Guest15 joined #nim |
18:01:11 | * | gsalazar quit (Ping timeout: 245 seconds) |
18:01:22 | FromDiscord | <Phil> sent a long message, see http://ix.io/3Qx9 |
18:01:29 | * | Guest15 quit (Client Quit) |
18:01:39 | FromDiscord | <Phil> (edit) "http://ix.io/3Qx9" => "http://ix.io/3Qxa" |
18:18:28 | * | gsalazar joined #nim |
18:23:37 | * | gsalazar quit (Ping timeout: 240 seconds) |
18:23:46 | FromDiscord | <Phil> Wait... Fuck I'm an idiot |
18:23:49 | FromDiscord | <Phil> noooooooooo |
18:24:27 | FromDiscord | <Phil> to follow "Controller --> Service --> Repository --> Database" correctly I have to wrap all these procs in the service. I don't have to import repositories left and right but the service is required |
18:24:30 | FromDiscord | <Phil> Oh fuuuuuuuck me |
18:36:30 | FromDiscord | <ajusa> In reply to @Elegantbeef "What you might want": pretty sure you aren't online Elegantbeef, but as it turns out converters are weird when used with generics. |
18:36:36 | NimEventer | New question by Dimitri Lesnoff: Nim : How to constrain an existing type, see https://stackoverflow.com/questions/71242378/nim-how-to-constrain-an-existing-type |
18:36:59 | FromDiscord | <dlesnoff> I wanted to ask a question on this channel, but made a Stack Overflow post about it in the end : https://stackoverflow.com/questions/71242378/nim-how-to-constrain-an-existing-type↵oh the bot preceded me ^^ |
18:37:58 | FromDiscord | <Phil> In reply to @Jiezron "I wanted to ask": hmm, would enums be a solution? |
18:38:26 | FromDiscord | <Phil> Could make an enum for nucleotides (and where those are amino acids typically aren't that far away) |
18:39:47 | FromDiscord | <Phil> I contemplated a lot, realized that it doesn't matter, my suggestion stays enums for now |
18:40:14 | FromDiscord | <Phil> If you're not familiar with the concept I can provide material |
18:41:46 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Qxk |
18:44:18 | FromDiscord | <treeform> In reply to @Isofruit "<@!107140179025735680> You don't,": No, I do not sorry. No plans for webp at the moment. PRs welcome though. |
18:44:42 | FromDiscord | <Phil> In reply to @treeform "No, I do not": ~~Noooooooooooooooooooo, I so definitely did not want to deal with wrapping that lib though~~ |
18:47:03 | FromDiscord | <treeform> It looks like to support webp you need like 200k lines of code |
18:47:09 | FromDiscord | <treeform> no way we are re-implementing that |
18:47:14 | FromDiscord | <treeform> Looking at this go project: 275,124 |
18:47:21 | FromDiscord | <treeform> https://github.com/chai2010/webp/graphs/contributors |
18:47:32 | FromDiscord | <Phil> .... holy fuck |
18:48:13 | FromDiscord | <treeform> Just like apple's HEIF |
18:48:14 | * | def- quit (Quit: -) |
18:48:19 | FromDiscord | <dlesnoff> sent a long message, see http://ix.io/3Qxp |
18:48:26 | * | def- joined #nim |
18:48:30 | FromDiscord | <ajusa> range types? |
18:49:10 | FromDiscord | <treeform> In reply to @Isofruit ".... holy fuck": I think I would rely on external lib for that, it looks like Windows/Apple have OS level hooks to decode nearly any image, I would probably use that. |
18:49:18 | FromDiscord | <treeform> I don't like shipping extra dlls |
18:49:38 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Qxq |
18:50:06 | FromDiscord | <treeform> In reply to @Isofruit ".... holy fuck": Looks like libwebp is also around 250k https://github.com/webmproject/libwebp/graphs/contributors |
18:50:20 | FromDiscord | <treeform> Its a monster of a format |
18:50:36 | FromDiscord | <Phil> In reply to @treeform "I think I would": It's a REST API application server, I'm essentially auto-converting uploaded images to webp to speed up pageloads |
18:50:52 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=3Qxr |
18:51:00 | FromDiscord | <ajusa> oh hey @treeform if you're online I've got a question: what's a good way to extend flatty? |
18:51:12 | FromDiscord | <treeform> In reply to @ajusa "oh hey <@!107140179025735680> if": With PRs? or hooks? |
18:51:31 | FromDiscord | <Phil> ~~With PR's that get you hooked~~ |
18:52:01 | FromDiscord | <ajusa> hm, closer to hooks I think. What I'm trying to do is use custom types for serializing and parsing. More specifically, minecraft uses a varint for sizes, whereas flatty defaults to an int when using the `seq` type |
18:52:28 | FromDiscord | <treeform> In reply to @Isofruit "It's a REST API": I doubt the extra % improvement of webp vs say png is wroth the complexity. |
18:52:44 | FromDiscord | <ajusa> so I think what I want to do is create a new type that basically wraps a Nim seq and then declare my own toFlatty and fromFlatty procs right? |
18:52:46 | FromDiscord | <treeform> In reply to @ajusa "hm, closer to hooks": Do you want my minecraft level loader? |
18:53:04 | FromDiscord | <ajusa> In reply to @treeform "Do you want my": trying to do packet parsing, but that may be useful |
18:53:16 | FromDiscord | <Phil> In reply to @treeform "I doubt the extra": My entire prologue webproject is not worth the complexity, this is purely for ego and because I'm sometimes dumb and upload 10mb images and don't want to bother correcting them manually, this is a "try shit out" project of mine |
18:53:51 | FromDiscord | <Phil> I just also had that functionality in python before (this is a rewrite from that backend) and wanted to keep it with the nim backend |
18:54:31 | FromDiscord | <ajusa> as an example, I've tried extending flatty to do more general binary parsing here: https://github.com/ajusa/nimtenbrew/blob/master/src/v2.nim↵the only issue is that sometimes I need to make a type distinct (not sure why), which needs me to create a converter, but the generic converter doesn't always match (not sure why) |
18:55:04 | FromDiscord | <treeform> sure, doing complex things to learn is always great, I support that. |
18:55:57 | FromDiscord | <Phil> In reply to @treeform "sure, doing complex things": This is two desires of mine clashing, on the one hand I like to learn, on the other my every sense of emotion is looking at wrapping libwebp and telling me to procrastinate |
18:56:07 | FromDiscord | <Phil> (edit) "In reply to @treeform "sure, doing complex things": This is two desires of mine clashing, on the one hand I like to learn, on the other my every sense of emotion is looking at wrapping libwebp and telling me to procrastinate ... " added "because that looks very not fun" |
18:56:22 | FromDiscord | <treeform> In reply to @ajusa "as an example, I've": I am not sure what is going on there. It should work without distinct? |
18:56:47 | FromDiscord | <treeform> In reply to @Isofruit "This is two desires": 🤷 |
18:56:48 | FromDiscord | <ajusa> In reply to @treeform "I am not sure": without distinct I think it ends up matching the built in flatty procs rather than the one I've defined |
18:57:08 | FromDiscord | <treeform> Yeah I find that strange |
18:57:22 | FromDiscord | <ajusa> so my proc never runs unless I throw a distinct at it. I realize I'm asking more of a general question here than a flatty question but not really sure if you have any ideas |
18:57:50 | FromDiscord | <ajusa> I hope it isn't a Nim bug... |
18:58:03 | FromDiscord | <treeform> I think you are too deap into meta typing here, I bet this could be much simpler and just work: https://github.com/ajusa/nimtenbrew/blob/master/src/v2.nim#L3-L7 |
18:58:57 | FromDiscord | <treeform> what `Size[0x80, UTF16]` supposed to represent? |
18:59:10 | FromDiscord | <ajusa> In reply to @treeform "I think you are": a UTF16 string of size 0x80 bytes |
18:59:45 | FromDiscord | <treeform> can't like array[80, uint16], not work? |
18:59:59 | FromDiscord | <ajusa> it does, but then the interface for writing and reading from that type feels weird |
19:00:18 | FromDiscord | <ajusa> it's inherently a string, so I want to be able to treat it as a string without any crazy casting |
19:00:52 | FromDiscord | <treeform> I think you have two things fighting here, you want the objcs to match the bits of objects, and have a nice API. |
19:00:59 | FromDiscord | <ajusa> yes |
19:01:27 | FromDiscord | <treeform> I would shuffle the weirdness from types to like helper methods like getters and setters. |
19:02:01 | FromDiscord | <ajusa> I see. You're suggesting I have this internal parsing object, but then I expose all the "sane" API through procs and docs? |
19:02:20 | FromDiscord | <treeform> I think that would be simpler. |
19:02:35 | FromDiscord | <treeform> Alternative suggestions: |
19:02:59 | FromDiscord | <treeform> `Size[N : static[int], T] = distinct T` make that like like Utf16[N] string instead? |
19:03:09 | FromDiscord | <treeform> you are like too many levels deep |
19:03:16 | FromDiscord | <treeform> its just confusing |
19:03:33 | FromDiscord | <ajusa> I see, I could flatten my types a bit |
19:04:17 | FromDiscord | <treeform> I would actually not use flatty like this at all |
19:04:30 | FromDiscord | <ajusa> oh |
19:04:35 | FromDiscord | <treeform> Flatty is mostly taking plain nim objects and turning them binary and back |
19:04:48 | FromDiscord | <treeform> not not reading binary things produces by others |
19:04:53 | FromDiscord | <treeform> binary parsing is just to strange/complex |
19:05:05 | FromDiscord | <treeform> I would just use binny for that and imperative style |
19:05:39 | FromDiscord | <treeform> we don't use flatty to parse binary data see here for examples: https://github.com/treeform/pixie/tree/master/src/pixie/fileformats |
19:05:44 | FromDiscord | <ajusa> a lot of the time binary parsing can be as straightforward as types, which is why I was gravitating towards flatty |
19:06:01 | FromDiscord | <treeform> https://github.com/treeform/pixie/blob/master/src/pixie/fontformats/opentype.nim#L538-L552 |
19:06:08 | FromDiscord | <treeform> we write code like this instead |
19:06:23 | FromDiscord | <treeform> as binary formats are usually crazy complex and hard to describe with a type system |
19:07:06 | FromDiscord | <treeform> binary formats have bit fields (which are hard to describe in nim) |
19:07:17 | FromDiscord | <treeform> binary formats love offsets etc... |
19:07:28 | FromDiscord | <treeform> which again hard to describe and unflatten |
19:08:21 | FromDiscord | <treeform> this is how I read minecrafts TAG structure: |
19:08:27 | FromDiscord | <treeform> utf16 strings |
19:08:28 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3Qxy |
19:08:36 | FromDiscord | <ajusa> yeah, offsets and sizes that aren't prefixed are messy. does the imperative style work well, or does it have lots of code duplication? |
19:08:50 | FromDiscord | <treeform> I prefer imperative style for binary data |
19:09:00 | FromDiscord | <treeform> rather then descriptive style of the type system |
19:09:58 | FromDiscord | <treeform> because binary data is usually crazy complex mess. Too complex for descriptive style. |
19:12:40 | FromDiscord | <ajusa> thanks for the advice! |
19:15:15 | FromDiscord | <treeform> In reply to @Isofruit "This is two desires": I predict formats like webp and HEIF are dead ends. We will have a neural network based compression format soon. Neural network are really good at compressing things. |
19:15:59 | FromDiscord | <treeform> And I bet they would not be that complex to implement. Train yes, but implement? Just some matrix multiplications. |
19:16:01 | FromDiscord | <haolian9 (高浩亮)> how to list all symbols that used by `defined()` in a project? |
19:16:55 | FromDiscord | <Phil> In reply to @treeform "I predict formats like": Would that someone wrote such a thing with an API that doesn't force me to actually contemplate the layout of the memory of that imagedate to adjust stepsize and the like and just gives me "Here goes RGB Array, out comes webp image binaries that you can store wherever" |
19:18:40 | FromDiscord | <Phil> Either way, it'll be either me running out of ways to procrastinate or me finding a more-low-effort-way to do this |
19:18:51 | FromDiscord | <Phil> (edit) "Either way, it'll be either me running out of ways to procrastinate ... or" added "the approach of futhark-wrapping-libwebp" |
19:19:43 | FromDiscord | <treeform> In reply to @Isofruit "Either way, it'll be": Don't beat yourself up about procrastination, its just a way for your sub mind telling you that maybe its not the right thing... |
19:19:54 | FromDiscord | <treeform> Find other avenues of expressing your self. |
19:20:17 | FromDiscord | <treeform> Some times what we want is not what we really want. |
19:20:44 | FromDiscord | <Rika> In reply to @treeform "I predict formats like": Every format is a dead end for the future. Use whatever we have now |
19:20:55 | FromDiscord | <Rika> Speaking of which, do you know of QOI? |
19:21:09 | FromDiscord | <Phil> It sounds weird enough to be interesting |
19:21:20 | FromDiscord | <treeform> In reply to @Rika "Speaking of which, do": ahh, yes? https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/qoi.nim |
19:22:09 | FromDiscord | <Phil> Is qoi another image format that compresses well? |
19:22:11 | FromDiscord | <treeform> I find QOI quite neat, that it packs such a punch in such low amount of effort. |
19:22:35 | FromDiscord | <treeform> In reply to @Isofruit "Is qoi another image": yeah, just use qoi instead of webp if you want a new quirky format to play with. |
19:22:37 | FromDiscord | <Rika> It’s a low effort high compression lossless format |
19:22:46 | FromDiscord | <treeform> Its like all the boxes I like. |
19:22:57 | FromDiscord | <Rika> You guys were talking about how webp was crazy so |
19:23:24 | FromDiscord | <treeform> yeah its really crazy |
19:23:34 | FromDiscord | <treeform> Look at QOI is quite good: https://qoiformat.org/benchmark/ |
19:24:23 | FromDiscord | <treeform> https://news.ycombinator.com/item?id=29328750 |
19:25:11 | FromDiscord | <treeform> A dude had a brilliant idea and it worked, while webp is a "design by committee" everything and the kitchen sink. |
19:25:24 | FromDiscord | <Phil> I may be too wonkered from work but I'm not sure I comprehend the benchmarks |
19:25:30 | FromDiscord | <Rika> In reply to @treeform "Look at QOI is": You mean quite okay? |
19:25:33 | FromDiscord | <Rika> xd |
19:25:34 | FromDiscord | <Phil> is libpng just "converts to ".png" ? |
19:25:47 | FromDiscord | <treeform> yes a "quite okay idea" ... |
19:26:07 | FromDiscord | <treeform> libpng can read/write png |
19:26:11 | FromDiscord | <treeform> but so can pixie |
19:26:15 | FromDiscord | <Phil> Which means it compresses about 20% better than png? |
19:26:17 | FromDiscord | <treeform> just use pixie's version |
19:26:37 | FromDiscord | <treeform> In reply to @Isofruit "Which means it compresses": yes, not hard to do to be honest |
19:26:42 | FromDiscord | <Rika> Looking at the QOI page and what the fuck? |
19:26:44 | FromDiscord | <Rika> https://github.com/pfusik/cito |
19:26:49 | FromDiscord | <Rika> What is this language lmao |
19:26:50 | FromDiscord | <treeform> png uses zlib which s like 90s compression |
19:26:51 | Amun-Ra | that depends on the picture, some qois are smaller, some are quite largeish comp. to png |
19:27:14 | FromDiscord | <treeform> In reply to @Rika "https://github.com/pfusik/cito": c#? |
19:27:32 | Amun-Ra | no, that's Ć, a kind of C transpiler |
19:28:00 | FromDiscord | <treeform> In reply to @Isofruit "Which means it compresses": I had my own image format "flippy" it was faster and compressed better then pngs. |
19:28:09 | FromDiscord | <Rika> I’ve never heard of it yet it has 1.2k stars |
19:28:16 | FromDiscord | <ShalokShalom> How would you check if a NimScript is executed as admin? |
19:28:30 | FromDiscord | <Rika> ? |
19:28:43 | FromDiscord | <Rika> Not a Nim binary but a script! |
19:28:46 | FromDiscord | <Rika> ? |
19:29:21 | Amun-Ra | Rika: I only know it exists bc I'm writing an image viewer for old formats in nim |
19:29:30 | FromDiscord | <ShalokShalom> Yeah, both in general |
19:29:32 | FromDiscord | <treeform> In reply to @Rika "I’ve never heard of": If you think running on 10 backends is neat, take a look at mal, its like 100s backends: https://github.com/kanaka/mal |
19:29:36 | FromDiscord | <ShalokShalom> But a script, in this case |
19:30:20 | FromDiscord | <treeform> In reply to @Rika "What is this language": Some one even made mal in GNU make language, whaat? |
19:30:30 | FromDiscord | <Rika> In reply to @treeform "If you think running": If it doesn’t include Nim it’s trash smh |
19:30:49 | FromDiscord | <treeform> In reply to @Rika "If it doesn’t include": but it does? |
19:31:14 | FromDiscord | <treeform> In reply to @Rika "If it doesn’t include": https://github.com/kanaka/mal/tree/master/impls/nim |
19:31:31 | FromDiscord | <ShalokShalom> so how to wait for an answer by the system? |
19:31:40 | FromDiscord | <ShalokShalom> like a password, or even any input generally |
19:31:54 | FromDiscord | <Rika> It has a post script implementation? How the fuck |
19:32:32 | FromDiscord | <treeform> In reply to @Rika "It has a post": How about just transistors: https://github.com/kanaka/mal/tree/master/impls/vhdl |
19:32:40 | * | fowl4 joined #nim |
19:32:55 | FromDiscord | <treeform> vhdl = "Very High-Speed Integrated Circuit Hardware Description Language " |
19:34:15 | FromDiscord | <Rika> I know I somehow missed that |
19:34:20 | FromDiscord | <Jonah> what's the best way to check if a given string/Uri is encoded or not? |
19:34:39 | FromDiscord | <Rika> Encoded in what? Percent? |
19:34:42 | * | fowl quit (Ping timeout: 272 seconds) |
19:34:43 | * | fowl4 is now known as fowl |
19:34:46 | FromDiscord | <Rika> In reply to @ShalokShalom "so how to wait": Not sure sorry |
19:35:08 | FromDiscord | <Rika> On Linux I believe it would be to set the SUID bit or something |
19:37:49 | FromDiscord | <Jonah> In reply to @Rika "Encoded in what? Percent?": encoded according to RFC3986 |
19:38:55 | Amun-Ra | suid won't work with "scripts" |
19:41:35 | FromDiscord | <ceramicskate0> Question. I made a nim dll and get the entry-point 'DLLRegisterServer' (but is defined in emit section) not found error. Im using an emit to add the code from my c dll into the nim file, the export is in the code in the emit section. the nim file compiles fine into a dll. Trying to run dll with regsvr32 (no entry point defined error). I think im messing up when trying to pass the --def file but idk. |
19:43:45 | * | jmdaemon joined #nim |
19:47:33 | FromDiscord | <Rika> In reply to @Amun-Ra "suid won't work with": Of course, but you asked about in general |
19:47:39 | FromDiscord | <Rika> As well |
19:57:03 | * | rockcavera joined #nim |
19:57:03 | * | rockcavera quit (Changing host) |
19:57:03 | * | rockcavera joined #nim |
20:23:19 | * | PMunch joined #nim |
20:40:29 | PMunch | Nice, got my Hacktoberfest t-shirt in the mail today |
20:47:11 | FromDiscord | <ynfle> Does nim do tail call optimization (or if it would be done by the c compiler, does nim output code in a way that makes it possible for it to be done?? |
20:49:32 | FromDiscord | <Waldecir Santos> In reply to @ynfle "Does nim do tail": I don't think so but you can use https://github.com/zero-functional/zero-functional |
20:49:51 | * | rockcavera quit (Remote host closed the connection) |
20:56:40 | FromDiscord | <Forest> In reply to @Forest "Will the template from": Anyone? :P |
20:59:30 | PMunch | @ynfle, Nim doesn't do tail call optimisation, but in general it outputs highly optimiseable C code |
21:00:34 | PMunch | @Forest, who knows, try it out and see |
21:03:22 | FromDiscord | <Forest> Fair enough lol |
21:03:48 | FromDiscord | <Forest> I just don't know how I'd use it alongside the existing compilers (and preferably without rebuilding Nim lol) |
21:04:39 | FromDiscord | <Phil> sent a long message, see http://ix.io/3QxU |
21:05:22 | PMunch | @Forest, I doubt it works without rebuilding the compiler |
21:05:36 | PMunch | Unless you somehow write one version which can load backends by dynamic library or something |
21:06:25 | PMunch | @Phil, afterWorkHours |
21:06:55 | FromDiscord | <Phil> If only those numbers were for describing hours 😛 |
21:07:31 | PMunch | Well you gave no context, so a stab in the dark is about as good as you're going to get I'm afraid |
21:07:38 | FromDiscord | <Forest> Fair enough lol |
21:09:35 | FromDiscord | <Phil> I've got a sorted array of "Encounters", an Encounter being a scene in a dndcampaign, think scene in a theater play. You have characters in them that talk to each other and do things and that's noted down somewhere, an encounter is a the written down scene.↵The encounters have an order to them, provided by the field "orderIndex". I want all encounters after a specific encounter. |
21:10:17 | FromDiscord | <Phil> Which doesn't really change the initial question, I'm looking for some kind of suffix, prefix or something that in general allows you to denote "a bunch of entries in a sorted array/list that come after some entry within that array/list" |
21:10:49 | FromDiscord | <Phil> (edit) "that" => "the overall" |
21:11:05 | PMunch | I mean a common term for that is "rest" |
21:11:16 | PMunch | But that's typically when you're most interested in the first bit |
21:12:22 | PMunch | "last-" as a prefix, or "post<whatever event>" might work |
21:12:34 | PMunch | What are you coding for DnD by the way? |
21:12:56 | FromDiscord | <Phil> Reimplementing the backend for my DnD-Wiki webpage |
21:13:28 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:14:21 | FromDiscord | <Phil> It's essentially a wiki for your campaign. Stores characters, items, encounters, "diaryentries" (session notes), Locations, maps (leaflet), markers on those maps, organizations, quests, rules, spells, sessions, creatures and recordings of the sessions |
21:14:40 | FromDiscord | <Phil> (edit) "notes)," => "notes, basically just a list of encounters really)," |
21:15:11 | PMunch | Huh, sounds handy |
21:15:18 | FromDiscord | <Phil> I found nim pretty much at the perfect time |
21:16:03 | FromDiscord | <Phil> Because I wanted to procrastinate a couple feature implementations that sounded boring (being able to disallow uploading session recordings for example because only my own campaign shall be allowed to do that for they fucking eeeeaaaat my harddrive space like nothing else) |
21:16:14 | FromDiscord | <Phil> And learning nim sounded really fun! |
21:16:45 | FromDiscord | <Phil> (edit) "else)" => "else and I can't really afford just enabling that for everybody)" |
21:17:08 | FromDiscord | <Phil> (edit) "everybody)" => "everybody. So far that's working on the "honors" system)" |
21:17:43 | PMunch | Heh, sounds like a good thing to disallow yeah |
21:17:49 | PMunch | What is the original implemented in? |
21:18:01 | FromDiscord | <Phil> Comes with the added benefit that I'm expecting it to crunch my pageloads from 50-200ms to 10-50ms |
21:18:05 | FromDiscord | <Phil> Django |
21:18:21 | PMunch | Ah right |
21:18:31 | FromDiscord | <Phil> That's why I draw so much inspiration from Django's featureset and reimplemented a bunch of it (Django Signals, the encryption, django's datetime format) |
21:21:54 | FromDiscord | <qb> Anyone did some scripting with fish? |
21:25:22 | PMunch | I've used haddock and bream in the past |
21:31:01 | FromDiscord | <auxym> fish shell? I use it as my main shell everywhere, but I avoid writing shell scripts in general and write python instead |
21:39:04 | FromDiscord | <qb> well yea I should have do that aswell |
21:39:23 | FromDiscord | <Elegantbeef> @ajusa\: converters do not do return type inference so you need an explicit return type |
21:40:12 | FromDiscord | <ajusa> In reply to @Elegantbeef "<@102899813149855744>\: converters do not": Ah, thanks for clarifying. |
21:49:59 | * | jjido joined #nim |
21:50:36 | FromDiscord | <Phil> Hmmm |
21:51:04 | * | kenran joined #nim |
21:52:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3Qy3 |
21:53:01 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3Qy3" => "https://play.nim-lang.org/#ix=3Qy4" |
21:53:27 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3Qy4" => "https://play.nim-lang.org/#ix=3Qy5" |
21:57:14 | * | PMunch quit (Quit: leaving) |
21:59:12 | * | kenran quit (Quit: WeeChat info:version) |
22:00:34 | FromDiscord | <Phil> Huh, it was deepCopy |
22:02:58 | FromDiscord | <Rika> In reply to @Isofruit "argh, names are hard....": “All after” |
22:03:15 | FromDiscord | <Rika> Or just “after” |
22:25:50 | FromDiscord | <ShalokShalom> How is that second command meant? https://media.discordapp.net/attachments/371759389889003532/946171016122597467/Screenshot_20220223_232431.png |
22:27:07 | FromDiscord | <ShalokShalom> Ah, got it |
22:27:11 | FromDiscord | <ShalokShalom> Was confused |
22:29:00 | * | greaser|q joined #nim |
22:30:06 | * | greaser|q quit (Changing host) |
22:30:06 | * | greaser|q joined #nim |
22:30:10 | * | greaser|q is now known as GreaseMonkey |
22:34:27 | FromDiscord | <qb> Woho, steam deck can be ordered friday |
22:35:23 | FromDiscord | <Rika> wrong channel? lo |
22:38:16 | FromDiscord | <auxym> In reply to @Rika "“All after”": `head`, `tail` are reasonably common programming idioms, especially in functional languages |
22:38:29 | FromDiscord | <Rika> In reply to @auxym "`head`, `tail` are reasonably": they mean specific things thouhg |
22:38:39 | FromDiscord | <Rika> where head is first element and tail is everything else |
22:38:44 | FromDiscord | <Rika> this is describing something else no> |
22:46:15 | FromDiscord | <mratsim> In reply to @Rika "where head is first": in blockchains, head is the most recent block of the chain, and tail is the oldest 🤷 |
22:46:46 | FromDiscord | <Rika> there is also those meanings, but i dont know of any that mean "elements after the specified" |
22:47:58 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:48:17 | FromDiscord | <mratsim> in functional programming you often do "x:xs" with x being say 1 and xs being 2, 3, 4, 5, .... |
22:48:20 | * | rockcavera joined #nim |
22:48:20 | * | rockcavera quit (Changing host) |
22:48:20 | * | rockcavera joined #nim |
22:48:46 | * | jjido joined #nim |
22:49:21 | FromDiscord | <Rika> In reply to @Rika "where head is first": ?? |
22:49:38 | FromDiscord | <Rika> that's "after the first" is it not |
22:49:52 | FromDiscord | <mratsim> yes |
22:57:45 | FromDiscord | <Phil> Rika was mostly replying to my request for a name, which would be to name on the array [1,2,3,4,5,6,7] the part of it after e.g. 3, so [4,5,6,7]. And that name should express just the generell idea "this is the part of the array after the specified element", in this case the element being 3. |
22:57:48 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:58:32 | FromDiscord | <Phil> That's why "tail" doesn't seem to quite work since that sub-array appears to have its start closer to the start of the array, which isn't the case here. here the start of this sub array can literally be anywhere |
22:59:53 | FromDiscord | <auxym> meh, I often use head, tail whenever I'm splitting anything in two parts, wherever it may be |
23:00:01 | FromDiscord | <Phil> So "followingNumbers", "afterNumbers" are the names I have for that so far, but none of them fit quite perfectly |
23:00:33 | FromDiscord | <Phil> well, followingEncounters and afterEncounters more like, but that doesn't mean anything for anyone other than myself, so let's stick with the numbers example |
23:01:00 | FromDiscord | <Rika> i'd just name it only "after" even if its "specialised" |
23:01:22 | FromDiscord | <Phil> hmmmm in a very specific, short proc that naming could work |
23:01:53 | FromDiscord | <Rika> i dont see how adding the name of the type to the proc would help |
23:02:40 | FromDiscord | <Phil> Oh no, as in, that works while within a short, specific proc because then it's easiest to tell that the "after" relates to the "numbers" |
23:02:57 | FromDiscord | <Phil> And not to X other variables that might be flying around in the context of a longer proc |
23:03:18 | FromDiscord | <Rika> "items after" |
23:04:03 | FromDiscord | <Phil> hmmm that one I could see also work fair |
23:12:08 | * | rockcavera quit (Remote host closed the connection) |
23:46:57 | * | rockcavera joined #nim |
23:54:26 | * | rockcavera quit (Remote host closed the connection) |