<< 23-02-2022 >>

00:00:46FromDiscord<Rika> It’s scuffed
00:11:04NimEventerNew 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:54FromDiscord<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:44FromDiscord<jmgomez> so having the json that nim generates should not be too difficult to generate a xcode project from it
00:29:09FromDiscord<jmgomez> the thing is that you have to sign the library with your apple cert
00:30:58*vicfred quit (Quit: Leaving)
00:33:54FromDiscord<huantian> In reply to @huantian "is something like this": hm ok this does not work with multisync painnnn
00:35:47FromDiscord<Elegantbeef> What's the multisync turn it into?
00:36:25FromDiscord<huantian> uh I should check
00:36:34FromDiscord<huantian> actually this might be because I'm not modifying await
00:37:05FromDiscord<huantian> since I'd assume the non-async verion multisync makes uses it's own await stuff
00:40:23FromDiscord<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:34FromDiscord<huantian> perhaps I'm using mulitsync wrong, this doesn't seem to work:↵<https://play.nim-lang.org/#ix=3Qs8>
01:03:14FromDiscord<huantian> quote the docs, ↵> whereas the generated synchronous procedures simply strip off the await calls.
01:12:00FromDiscord<huantian> yeah no I think I'm just using it wrong lmao
01:13:53FromDiscord<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:26FromDiscord<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:29NimEventerNew 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:37FromDiscord<Fail> sent a code paste, see https://play.nim-lang.org/#ix=3Qsm
01:54:49FromDiscord<Elegantbeef> Depends what the macros do
01:54:58FromDiscord<Fail> well, im trying to do this
01:54:58FromDiscord<Fail> https://docs.microsoft.com/en-us/windows/win32/learnwin32/your-first-windows-program
01:55:08FromDiscord<Elegantbeef> https://github.com/khchen/winim/blob/b7b32603f4ef672bc34405bc6200e8aab2c366b1/examples/hellowin.nim#L10
01:55:11FromDiscord<Elegantbeef> Just use winim
01:55:30FromDiscord<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:15FromDiscord<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:42FromDiscord<Elegantbeef> genny perhaps
03:17:02FromDiscord<Elegantbeef> https://github.com/treeform/genny
03:22:24FromDiscord<dangbinghoo> ok, that's almost what I want, but it seems that genny can only generate dynamic-lib?
03:27:28FromDiscord<Elegantbeef> Seems that way i guess
03:28:25*Gustavo6046 quit (Quit: Leaving)
03:34:25FromDiscord<congusbongus> would you need to transpile to C in order to create a static lib?
03:36:10FromDiscord<dangbinghoo> I just want to call nim proc in C
03:37:14FromDiscord<Elegantbeef> You should be able to make a static lib using Nim, the header is the main issue
03:37:38FromDiscord<Elegantbeef> doesnt know much about static libs, so assuming a header is needed
03:37:52FromDiscord<dangbinghoo> I guess I can just-compile-and-dont-link nim compiler generated nimcache to a static lib?
03:38:17FromDiscord<Elegantbeef> there is a `--staticlib` flag i think
03:39:28FromDiscord<dangbinghoo> OK, I will try it, only need to manually write exported nim proc to a c header.
03:40:16FromDiscord<dangbinghoo> thanks for all your help ! 🤝
03:40:34FromDiscord<Elegantbeef> ah it's `--app:staticlib`
04:06:02*supakeen quit (Quit: WeeChat 3.4)
04:06:31*supakeen joined #nim
04:11:14FromDiscord<dangbinghoo> In reply to @Elegantbeef "ah it's `--app:staticlib`": 👍
04:12:42madpropshi animals
04:43:46FromDiscord<Rika> Hello alien
04:58:11*slowButPresent quit (Quit: leaving)
05:16:31*krux02 quit (Remote host closed the connection)
06:26:35FromDiscord<dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3Qte
06:27:07FromDiscord<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:30FromDiscord<dangbinghoo> ---------
06:27:31FromDiscord<Elegantbeef> `cstring $j`
06:27:52FromDiscord<Elegantbeef> Though that's still unsafe
06:28:18FromDiscord<dangbinghoo> is there any safe way to solve this?
06:28:50*jmdaemon joined #nim
06:28:58FromDiscord<Rika> What do you mean unsafe? I don’t see how
06:29:04FromDiscord<Elegantbeef> Copy the string to a cstring, return it then require the user to free it
06:29:10FromDiscord<Elegantbeef> This is in a library rika
06:29:43FromDiscord<Elegantbeef> `$j` will not outlive the function
06:29:50FromDiscord<dangbinghoo> yes, lora_gw_t_to_jsonstr_p is nim proc exported to be used in C land
06:30:22FromDiscord<Elegantbeef> you know you can give it a proper Nim name then do `exportC: "myCProcName"`?
06:30:35FromDiscord<Elegantbeef> Atleast i think yo ucan
06:33:22FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/sHV
06:33:29FromDiscord<Rika> In reply to @Elegantbeef "`$j` will not outlive": Ain’t this a copy
06:33:51FromDiscord<Elegantbeef> the return type is `cstring`
06:33:57FromDiscord<Rika> I guess
06:34:28FromDiscord<Elegantbeef> It's returning a pointer across the library barrier, it's unsafe to have a pointer to gc'd memory
06:34:56FromDiscord<Rika> Ah yeah it’s a string
06:35:22FromDiscord<Elegantbeef> then you also need a `func nimFree(p: pointer) {.exportC.} = dealloc(p)`
06:36:23FromDiscord<Elegantbeef> Hopefully that makes sense
06:37:07FromDiscord<dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3Qti
06:37:16FromDiscord<Elegantbeef> There you go
06:37:20FromDiscord<Elegantbeef> take in a `cstring`
06:37:26FromDiscord<Elegantbeef> not a `ptr char`
06:37:44FromDiscord<dangbinghoo> so, I just copy generated cstring to a C char buffer.
06:37:45FromDiscord<Rika> They are equivalent in C
06:37:56FromDiscord<Rika> A cstring is a char buffer
06:38:02FromDiscord<dangbinghoo> ok
06:38:11FromDiscord<Elegantbeef> Shouldnt you also pass in the size of the allocated string?
06:38:18FromDiscord<Rika> Yes
06:38:29FromDiscord<Rika> It’s better to
06:39:33FromDiscord<dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3Qtj
06:39:47FromDiscord<Rika> Again ptr char -> cstring
06:40:03FromDiscord<Elegantbeef> Well i'd still say use `cstring` just cause it's easier to work with from nim
06:40:11FromDiscord<dangbinghoo> (edit) "https://play.nim-lang.org/#ix=3Qtj" => "https://play.nim-lang.org/#ix=3Qtk"
06:40:35FromDiscord<dangbinghoo> ok, thanks!
06:41:03FromDiscord<Elegantbeef> Otherwise you need to do` copyMem(cast[ptr UncheckedArray[char](strBuff)[0].addr, str[0].addr, str.len + 1)`
06:41:20FromDiscord<Elegantbeef> Bit tedious given you can just change it to a `cstring` 😛
06:48:54FromDiscord<dangbinghoo> In reply to @Elegantbeef "Bit tedious given you": thank you for your great help.
06:49:29FromDiscord<Elegantbeef> No problem
06:49:38FromDiscord<dangbinghoo> I'm doing this, just cause cJson is very ugly to me.
06:50:40FromDiscord<Elegantbeef> interesting
06:50:41FromDiscord<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:12FromDiscord<Elegantbeef> Make sure you build the library using `--gc:orc`
06:51:22FromDiscord<Elegantbeef> This way you dont have any setup so no need for `nimMain()`
06:52:02FromDiscord<dangbinghoo> I will use this for ESP32, so, is `--gc:arc` OK?
06:52:48FromDiscord<Elegantbeef> yea
06:52:49FromDiscord<Elegantbeef> Probably, atleast
06:52:55FromDiscord<Elegantbeef> Json nodes are acyclical iirc
06:53:32FromDiscord<dangbinghoo> this is how I generate the .a `nim c --app:staticLib --noMain a_b_jsexp.nim`
06:54:05FromDiscord<Elegantbeef> you can make a `config.nims` with those flags so you can just do `nim c a_b_jsexp.nim`
06:54:41FromDiscord<dangbinghoo> In reply to @Elegantbeef "you can make a": ok
06:57:04FromDiscord<Rika> In reply to @Elegantbeef "Json nodes are acyclical": You do recall correctly
06:57:16FromDiscord<Rika> JSON that is cyclical is not JSON
06:57:38FromDiscord<Elegantbeef> I more meant marked as such
06:58:07FromDiscord<Rika> I believe so as well then
07:01:34FromDiscord<Rika> In reply to @dangbinghoo "I will use this": Are you sure you have enough RAM for whatever you are doing?
07:02:08FromDiscord<Rika> In reply to @Elegantbeef "This way you dont": Depends on what he’s doing exactly though?
07:02:36FromDiscord<Elegantbeef> Well yea, if they have toplevel statements they need main
07:03:05FromDiscord<Elegantbeef> But given they're just using the Nim JSON library it's less of an issue
07:04:25FromDiscord<Elegantbeef> One could avoid the double allocation and unsafety if the added the strings to a sequence or similar
07:04:55FromDiscord<Elegantbeef> Some sort of buffer of the strings to keep them alive until freed
07:29:06FromDiscord<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:55FromDiscord<dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3Qtu
07:30:12FromDiscord<dangbinghoo> Error: attempting to call routine: 'max_sz'
07:30:27FromDiscord<Elegantbeef> `-1` should be `- 1`
07:30:52FromDiscord<Rika> Consistent spacing is important in Nim
07:31:15FromDiscord<Elegantbeef> In nim operators bind tightly if there is no space
07:31:25FromDiscord<dangbinghoo> wow, ok, thanks!
07:45:36FromDiscord<dangbinghoo> can nim's generic (or template) proc be exported to C land?
07:47:38FromDiscord<Elegantbeef> No, you need a concrete instantiation
07:48:23FromDiscord<Elegantbeef> If you have a generic function you want to export you'll have to manually wrap it end export it
07:49:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Qtv
07:49:12FromDiscord<Elegantbeef> You can of course automate this a bit with a template
07:49:24FromDiscord<dangbinghoo> OK
07:49:46*PMunch joined #nim
08:24:35FromDiscord<dangbinghoo> sent a code paste, see https://play.nim-lang.org/#ix=3QtG
08:25:19FromDiscord<dangbinghoo> is my_str a string constructed directly using the cstring `in_str`'s memory?
08:26:36FromDiscord<dangbinghoo> (edit) "https://play.nim-lang.org/#ix=3QtG" => "https://play.nim-lang.org/#ix=3QtH"
08:27:05FromDiscord<Elegantbeef> yes it's going to be like `strcpy` in C
08:27:23PMunchThere you are @Elegantbeef!
08:27:40FromDiscord<Elegantbeef> It'll go up to the first null terminator and copy it into a string
08:27:40FromDiscord<Elegantbeef> There i am?
08:27:40FromDiscord<Elegantbeef> Did you need me?!
08:27:55PMunchI was working with nimscripter yesterday
08:28:04FromDiscord<Elegantbeef> Fuuuuck a bug report
08:28:19PMunchHaha, no I haven't created a bug report :P
08:28:20PMunchhttps://github.com/PMunch/ratel
08:28:24PMunchOops
08:28:36PMunchI was trying to implement this: https://github.com/PMunch/ratel/issues/10
08:28:47FromDiscord<Elegantbeef> Well i never hear anyone say "Oh yea i was using your library, and it works wonderfully"
08:29:03PMunchAnd was struggling to get those `--` templates registered properly
08:29:26FromDiscord<Elegantbeef> Yea this is a common issue i've been seeing, the VM that Nim uses is special
08:29:41PMunchI was basically trying to do this: http://ix.io/3Qnt
08:29:54PMunchSpecial?
08:30:03FromDiscord<Elegantbeef> Ah nevermind you did that
08:30:09PMunchJust adding in "nimscript" as a library and it works just fine
08:30:29PMunchBut I want to overload them so they're not actually changing switches in my NimScript environment
08:30:56FromDiscord<Elegantbeef> Give me a moment, need to test this
08:31:03FromDiscord<Elegantbeef> Dont know the error
08:31:57FromDiscord<Elegantbeef> and you said this wasnt a bug report
08:33:27FromDiscord<Elegantbeef> you might not be able to export templates this way
08:33:40FromDiscord<Elegantbeef> Which makes sense given their symbols are funky
08:34:23PMunchhttps://irclogs.nim-lang.org/22-02-2022.html#11:56:03
08:34:28PMunchThat's from yesterday
08:36:11FromDiscord<Elegantbeef> Yep i'm right we cannot export templates this way
08:46:29FromDiscord<Elegantbeef> There you go pmunch `1.0.12` should do the trick for you
08:46:55FromDiscord<Elegantbeef> Will need to follow https://github.com/beef331/nimscripter#exporting-code-verbatim though
08:47:38PMunchOh wow, that was quick :)
08:48:02FromDiscord<Elegantbeef> What can i say shitty code is easy to write
08:48:19PMunchHaha :P
08:51:00FromDiscord<Elegantbeef> I would like to make it a bit smarter, but templates dont work like procs symbol wise
08:53:20PMunchHmm, they work differently?
08:53:31FromDiscord<Elegantbeef> Yea you cant pass them as a symbol
08:54:12FromDiscord<Elegantbeef> Oh atleast i dont think so
08:54:19PMunchAh so the export(module, myTemplate) thing can't work?
08:54:35FromDiscord<Elegantbeef> hmm i might be wrong
08:54:48FromDiscord<Elegantbeef> I'm very wrong
09:00:02FromDiscord<Elegantbeef> It was actually an overload issue
09:00:57*jmdaemon quit (Ping timeout: 240 seconds)
09:01:15FromDiscord<Elegantbeef> there you now can happily do exportTo(shims, switch, `--`)
09:01:27*jmdaemon joined #nim
09:02:53FromDiscord<Elegantbeef> So pmunch go with the most recent nimscripter, and be merry i guess
09:03:02FromDiscord<Elegantbeef> Hopefully it doesnt have any other issues
09:03:27PMunchOh cool!
09:04:27FromDiscord<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:23FromDiscord<Elegantbeef> Also odd that I didnt get pinged with your mention of me, perhaps it was the '@'
09:19:16PMunchBy 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:43FromDiscord<Elegantbeef> If only I hated myself
09:25:47PMunchOne day I hope to find the weirdo who loves writing documentation but doesn't like to code
09:26:01FromDiscord<Elegantbeef> Lol, good luck
09:26:22FromDiscord<abdu> How do we check a file name exist, like Bash if [ -f "FOO" ] ;then echo "YUP file is there"
09:27:48FromDiscord<Elegantbeef> `import std/os; if fileExists("foo"): echo("Yep file is there")`
09:40:16FromDiscord<abdu> ... then make sure its reading works no error at all ?
09:46:59PMunch`try: readFile("foo") except: echo "Something went wrong"`
09:47:38FromDiscord<xx_ns> yolo, try reading it even if it fails or the file isn't there
09:48:32FromDiscord<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:19FromDiscord<demotomohiro> It sounds like https://en.m.wikipedia.org/wiki/Time-of-check_to_time-of-use
10:21:49FromDiscord<Rika> toctou is important even if single threaded ESPECIALLY if its files
11:04:14FromDiscord<ShalokShalom> Mosh + Editor is probably the most simple solution to code on the go?
11:10:50PMunchOr just termux
11:11:12PMunchNim can run under Termux so you can dev directly on your phone
11:12:35FromDiscord<ShalokShalom> Hnn. Sounds awesome
11:20:09FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3Quq
11:20:11FromDiscord<impbox [ftsf]> this code used to compile
11:20:43FromDiscord<impbox [ftsf]> just had to reinstall OS and nim and now things are broken
11:21:48FromDiscord<impbox [ftsf]> hmm, seems broken since 1.6
11:22:07FromDiscord<mratsim> float32 now can silently convert to float32?
11:22:15FromDiscord<mratsim> is it a float literal?
11:22:37FromDiscord<impbox [ftsf]> it's a comparison between a float32 and 0 literal
11:22:46FromDiscord<impbox [ftsf]> now needs 0f i guess
11:38:10PMunchWait, that means float32 can now implicitly convert to int?
11:38:14PMunchThat doesn't seem right
11:41:08FromDiscord<impbox [ftsf]> hmm, i think it's because i have converters
11:41:21FromDiscord<impbox [ftsf]> but the behaviour seems to have changed between versions
11:41:48FromDiscord<impbox [ftsf]> but doesn't seem to be a documented change in converter behaviour
11:41:54PMunchConverters are always a mess..
11:54:04FromDiscord<Hamid_Bluri> sent a long message, see https://paste.rs/sXE
11:54:31FromDiscord<Hamid_Bluri> of
11:57:52PMunchHmm, I guess I could. Got plenty other stuff to do though
11:58:09PMunchIs there anything in particular you don't get?
11:58:16PMunchJust the {.effects.} pragma?
12:00:07FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3QuA
12:00:17NimEventerNew thread by Drkameleon: AsyncHttpServer running in the background, spawn & closures, see https://forum.nim-lang.org/t/8942
12:01:52PMunchI'm also struggling with a converter issue right now..
12:02:04PMunchSeems like something might've messed up converters lately
12:02:26PMunch@Hamid_Bluri ^
12:06:01*supakeen quit (Quit: WeeChat 3.4)
12:06:32*supakeen joined #nim
12:11:09FromDiscord<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:32FromDiscord<impbox [ftsf]> i was doing it via converters, but they seem to have further reaching effects
12:11:52FromDiscord<impbox [ftsf]> I only want the conversions to happen when passing arguments to these procs
12:12:25FromDiscord<Tanguy> You can do a macro that automatically creates a overloaded proc
12:12:37FromDiscord<impbox [ftsf]> I don't want an overloaded proc
12:12:49FromDiscord<impbox [ftsf]> otherwise i'd just use SomeNumber
12:13:33PMunchimpbox_[ftsf], how about taking SomeNumber and then just calling `int` on it manually?
12:13:50FromDiscord<impbox [ftsf]> that'll be creating lots of extra procs
12:13:53PMunchOr am I missing something? Why do you need it to be implicit?
12:13:54FromDiscord<impbox [ftsf]> (edit) "that'll be creating lots of extra procs ... " added "in the code space"
12:14:09FromDiscord<impbox [ftsf]> I want the caller to not have to care about what they're passing it
12:14:17FromDiscord<impbox [ftsf]> and have the conversion done outside the proc
12:14:40FromDiscord<Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=3QuJ
12:14:57FromDiscord<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:42FromDiscord<impbox [ftsf]> sent a code paste, see https://paste.rs/byb
12:16:02FromDiscord<impbox [ftsf]> (edit) "https://play.nim-lang.org/#ix=3QuK" => "https://paste.rs/U8E"
12:16:34FromDiscord<impbox [ftsf]> this is pretty much what I'm doing with converters, and it worked great previously
12:17:04PMunchThis 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:17PMunchIt doesn't even tell me what called the dollars procedure..
12:18:33FromDiscord<Tanguy> You could also have a macro at call site, would be even better since you could mix the SomeNumbers and ints
12:21:12FromDiscord<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:22FromDiscord<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:35FromDiscord<impbox [ftsf]> it's also more to avoid breaking all the existing game code which relies on the old behaviour
12:26:07FromDiscord<untoreh> can nim do named arguments from identifiers?
12:26:12FromDiscord<mratsim> In reply to @impbox "hmm is there a": use a template to scope conversion?
12:26:38FromDiscord<mratsim> the proc are defined in the template and so accessible only within its scope.
12:26:50FromDiscord<mratsim> There is an example for safe pointer arithmetic in the forum.
12:27:06FromDiscord<impbox [ftsf]> mmm, I guess it's doable, a lot of work though
12:27:11FromDiscord<impbox [ftsf]> pretty big API
12:27:40FromDiscord<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:45FromDiscord<mratsim> personally I had converters for float -> complex, and then just banned them from my codebase
12:28:13FromDiscord<impbox [ftsf]> mmm if i was building it from scratch maybe i wouldn't do the converter thing again
12:28:33FromDiscord<impbox [ftsf]> but all the explicit conversions get pretty ugly
12:29:44FromDiscord<impbox [ftsf]> @Tanguy that'd pretty nice
12:29:48FromDiscord<impbox [ftsf]> (edit) "that'd" => "that's"
12:33:20FromDiscord<mratsim> {.push magicmacro.}
12:34:27PMunchI 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:05FromDiscord<mratsim> Ah yes.
12:35:12FromDiscord<mratsim> And ambiguous calls ...
12:36:14FromDiscord<mratsim> https://github.com/mratsim/Arraymancer/issues/394
12:36:15PMunchThe logic around when to apply a converter should really be improved
12:36:51FromDiscord<mratsim> converter breaks as soon as you need `$` on non-int
12:37:01FromDiscord<impbox [ftsf]> mmm, i'm gonna sleep on it
12:37:03PMunchIt should be something like `when not compiles(somecode): when compiles(applyConverters(somecode)): applyConverters(someCode) else: somecode else: somecode`
12:37:04FromDiscord<impbox [ftsf]> thanks for the ideas
12:43:32PMunchHmm, even if I try to mark the converter as `{.compileTime.}` it doesn't work..
12:43:55PMunchLike why would it try to apply a converter it can't apply without crashing?!
12:43:59PMunchIt's so dumb!
12:48:13FromDiscord<haolian9 (高浩亮)> lol, even pro like PMunch can get upset
12:49:12FromDiscord<mratsim> In reply to @haolian9 (高浩亮) "lol, even pro like": watch me get upset about types in macros or genric instantiation
12:49:37FromDiscord<mratsim> https://github.com/nim-lang/RFCs/issues/44
12:50:11FromDiscord<mratsim> https://github.com/nim-lang/Nim/issues/8677
12:54:48PMunchNim 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:34FromDiscord<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:59FromDiscord<Hamid_Bluri> I remember this stupid issue 😄 ↵https://github.com/nim-lang/Nim/issues/18342
13:17:54*krux02 joined #nim
13:19:20FromDiscord<locriacyber> Nim contributors, how do I add tests for std
13:20:06FromDiscord<Hamid_Bluri> in runnableExamples I guess if it's specific for a proc
13:20:28FromDiscord<Hamid_Bluri> @locriacyber
13:20:38FromDiscord<locriacyber> How do I run the specific test
13:21:38PMunch`runnableExamples` isn't really meant for tests
13:22:03PMunchIt's meant for examples, but the examples are compiled and tested whenever the documentation is built (with `nim doc`).
13:22:46PMunchIf 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:02FromDiscord<locriacyber> Thanks
13:23:07PMunchThat README alse tells you how tests are written, and how you can run a test
13:23:39FromDiscord<locriacyber> I'm trying to make sequtils usable with iterable in #19557
13:24:22FromDiscord<Hamid_Bluri> wow, I really wished that
13:24:25FromDiscord<locriacyber> Does all the intermediate `seq` get compiled away or what
13:24:49PMunchNot quite sure what you mean?
13:25:23FromDiscord<locriacyber> So `filterIt` returns a seq
13:25:37PMunchI believe so, yes
13:26:00FromDiscord<locriacyber> What if I chain two together
13:26:25FromDiscord<Hamid_Bluri> https://github.com/zero-functional/zero-functional ?
13:26:45FromDiscord<locriacyber> Thanks, that's what I'm looking for
13:26:54FromDiscord<Hamid_Bluri> you're welcome
13:27:39PMunchIf you chain two together it will create intermediary sequences
13:29:04*slowButPresent joined #nim
13:29:20FromDiscord<konsumlamm> ye, `sequtils` allocates a lot of unnecessary intermediate seqs, there is no fusion going on
13:29:56PMunchDamn it.. Foiled by macros and the damn `os` switch again..
13:30:14PMunchWell, I guess this example wouldn't have worked anyways
13:31:40PMunchBut 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:04PMunchThere should really be a better distinction of runtime and compile-time OS in Nim..
13:32:36PMunchMacros shouldn't fail because the target OS doesn't support something the running OS does
13:32:59PMunch(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:33FromDiscord<coldfussion> Found a legit question on fedi\: "why nim documentation of libraries suck so much balls?"
13:49:43PMunchHard 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:37FromDiscord<Hamid_Bluri> Nim doc is much better than python btw
13:58:23*Abrax quit (Quit: Leaving)
14:07:28PMunchBy the way, what is fedi?
14:09:56FromDiscord<konsumlamm> nim doc is better than a whole language? /s
14:17:49FromDiscord<coldfussion> Fediverse, a bunch of federated social networks, e.g. mastodon, pleroma, peertube...↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
14:20:55FromDiscord<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:24FromDiscord<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:27FromDiscord<coldfussion> Never used that. But I'm coming from python, so I'm used to exception flying everywhere🙂↵(@deeuu)
14:29:45FromDiscord<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:15PMunch@deeuu, I've used it in a dynamic library
14:30:43PMunchAh wait, not with `{.push.}`
14:30:56PMunchI just had it on the main entry-point
14:32:28PMunch@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:27PMunch@Elegantbeef, you still around?
14:51:42PMunchTried to do http://ix.io/3QvI, but it fails
14:53:12PMunchHmm, it seems like it's `Whitespace` it doesn't like..
14:53:48PMunchI guess the easiest thing would be to just create nimscript shim and add that as a NimScript module
15:23:33FromDiscord<abdu> i can't print ie. echo a variable reference by `addr` or `unsafeAddr` ↵how to do correctly ?
15:25:12FromDiscord<mratsim> In reply to @abdu "i can't print ie.": use `repr` for debugging thouse
15:25:17FromDiscord<mratsim> (edit) "thouse" => "those"
15:25:24FromDiscord<mratsim> echo foo.repr
15:27:49NimEventerNew 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:56FromDiscord<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:22FromDiscord<haolian9 (高浩亮)> with ORC, do i have to define `proc =destroy` for my custom object type?
16:18:21FromDiscord<haolian9 (高浩亮)> i found the answer in [here](https://nim-lang.org/docs/destructors.html#hook-generation), ignore me.
16:35:28FromDiscord<treeform> In reply to @PMunch "<@107140179025735680>, I'm looking at": We have updated the python package to match the Nim one.
16:41:16PMunchNice
17:09:11FromDiscord<Phil> On the one hand, I now have time again to deal with this libwebp wrapping thing
17:09:18FromDiscord<Phil> On the other, I still really don't want to deal with it
17:09:37FromDiscord<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:59PMunch(Obligatory "haaaave you heard about Futhark" pitch)
17:10:24FromDiscord<Phil> My gotchas thingy was including futhark
17:10:35FromDiscord<Phil> Because it still means understanding this clusterfuck of a libwebp API
17:10:54PMunchAh :P
17:11:11FromDiscord<Phil> Or maybe it's not a clusterfuck and I'm just too unused to dealing with C code
17:11:22FromDiscord<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:25PMunchWell Futhark should do most of the heavy lifting with the C code
17:13:14FromDiscord<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:25FromDiscord<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:39FromDiscord<Phil> variable names provided by me as I understood that proc so far
17:15:50FromDiscord<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:17FromDiscord<Phil> (edit) "file" => "files of libwebp"
17:16:18FromDiscord<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:15FromDiscord<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:20PMunch@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:38FromDiscord<Phil> Ohhh you mean the default value is 0
17:19:56FromDiscord<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:40FromDiscord<Phil> @treeform You don't, perchance, have webp support in pixie like right around the corner, do you?
17:30:12FromDiscord<abdu> Got error in handling command line:↵`Error: undeclared identifier: 'commandLineParams'`↵How solving it
17:30:25*jjido joined #nim
17:32:27FromDiscord<Phil> It'd help to show what you're executing that causes that error 😛
17:50:36FromDiscord<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:29FromDiscord<Phil> Hmmm design question
17:59:31*Guest15 joined #nim
18:01:11*gsalazar quit (Ping timeout: 245 seconds)
18:01:22FromDiscord<Phil> sent a long message, see http://ix.io/3Qx9
18:01:29*Guest15 quit (Client Quit)
18:01:39FromDiscord<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:46FromDiscord<Phil> Wait... Fuck I'm an idiot
18:23:49FromDiscord<Phil> noooooooooo
18:24:27FromDiscord<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:30FromDiscord<Phil> Oh fuuuuuuuck me
18:36:30FromDiscord<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:36NimEventerNew 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:59FromDiscord<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:58FromDiscord<Phil> In reply to @Jiezron "I wanted to ask": hmm, would enums be a solution?
18:38:26FromDiscord<Phil> Could make an enum for nucleotides (and where those are amino acids typically aren't that far away)
18:39:47FromDiscord<Phil> I contemplated a lot, realized that it doesn't matter, my suggestion stays enums for now
18:40:14FromDiscord<Phil> If you're not familiar with the concept I can provide material
18:41:46FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Qxk
18:44:18FromDiscord<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:42FromDiscord<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:03FromDiscord<treeform> It looks like to support webp you need like 200k lines of code
18:47:09FromDiscord<treeform> no way we are re-implementing that
18:47:14FromDiscord<treeform> Looking at this go project: 275,124
18:47:21FromDiscord<treeform> https://github.com/chai2010/webp/graphs/contributors
18:47:32FromDiscord<Phil> .... holy fuck
18:48:13FromDiscord<treeform> Just like apple's HEIF
18:48:14*def- quit (Quit: -)
18:48:19FromDiscord<dlesnoff> sent a long message, see http://ix.io/3Qxp
18:48:26*def- joined #nim
18:48:30FromDiscord<ajusa> range types?
18:49:10FromDiscord<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:18FromDiscord<treeform> I don't like shipping extra dlls
18:49:38FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Qxq
18:50:06FromDiscord<treeform> In reply to @Isofruit ".... holy fuck": Looks like libwebp is also around 250k https://github.com/webmproject/libwebp/graphs/contributors
18:50:20FromDiscord<treeform> Its a monster of a format
18:50:36FromDiscord<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:52FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=3Qxr
18:51:00FromDiscord<ajusa> oh hey @treeform if you're online I've got a question: what's a good way to extend flatty?
18:51:12FromDiscord<treeform> In reply to @ajusa "oh hey <@!107140179025735680> if": With PRs? or hooks?
18:51:31FromDiscord<Phil> ~~With PR's that get you hooked~~
18:52:01FromDiscord<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:28FromDiscord<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:44FromDiscord<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:46FromDiscord<treeform> In reply to @ajusa "hm, closer to hooks": Do you want my minecraft level loader?
18:53:04FromDiscord<ajusa> In reply to @treeform "Do you want my": trying to do packet parsing, but that may be useful
18:53:16FromDiscord<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:51FromDiscord<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:31FromDiscord<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:04FromDiscord<treeform> sure, doing complex things to learn is always great, I support that.
18:55:57FromDiscord<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:07FromDiscord<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:22FromDiscord<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:47FromDiscord<treeform> In reply to @Isofruit "This is two desires": 🤷
18:56:48FromDiscord<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:08FromDiscord<treeform> Yeah I find that strange
18:57:22FromDiscord<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:50FromDiscord<ajusa> I hope it isn't a Nim bug...
18:58:03FromDiscord<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:57FromDiscord<treeform> what `Size[0x80, UTF16]` supposed to represent?
18:59:10FromDiscord<ajusa> In reply to @treeform "I think you are": a UTF16 string of size 0x80 bytes
18:59:45FromDiscord<treeform> can't like array[80, uint16], not work?
18:59:59FromDiscord<ajusa> it does, but then the interface for writing and reading from that type feels weird
19:00:18FromDiscord<ajusa> it's inherently a string, so I want to be able to treat it as a string without any crazy casting
19:00:52FromDiscord<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:59FromDiscord<ajusa> yes
19:01:27FromDiscord<treeform> I would shuffle the weirdness from types to like helper methods like getters and setters.
19:02:01FromDiscord<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:20FromDiscord<treeform> I think that would be simpler.
19:02:35FromDiscord<treeform> Alternative suggestions:
19:02:59FromDiscord<treeform> `Size[N : static[int], T] = distinct T` make that like like Utf16[N] string instead?
19:03:09FromDiscord<treeform> you are like too many levels deep
19:03:16FromDiscord<treeform> its just confusing
19:03:33FromDiscord<ajusa> I see, I could flatten my types a bit
19:04:17FromDiscord<treeform> I would actually not use flatty like this at all
19:04:30FromDiscord<ajusa> oh
19:04:35FromDiscord<treeform> Flatty is mostly taking plain nim objects and turning them binary and back
19:04:48FromDiscord<treeform> not not reading binary things produces by others
19:04:53FromDiscord<treeform> binary parsing is just to strange/complex
19:05:05FromDiscord<treeform> I would just use binny for that and imperative style
19:05:39FromDiscord<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:44FromDiscord<ajusa> a lot of the time binary parsing can be as straightforward as types, which is why I was gravitating towards flatty
19:06:01FromDiscord<treeform> https://github.com/treeform/pixie/blob/master/src/pixie/fontformats/opentype.nim#L538-L552
19:06:08FromDiscord<treeform> we write code like this instead
19:06:23FromDiscord<treeform> as binary formats are usually crazy complex and hard to describe with a type system
19:07:06FromDiscord<treeform> binary formats have bit fields (which are hard to describe in nim)
19:07:17FromDiscord<treeform> binary formats love offsets etc...
19:07:28FromDiscord<treeform> which again hard to describe and unflatten
19:08:21FromDiscord<treeform> this is how I read minecrafts TAG structure:
19:08:27FromDiscord<treeform> utf16 strings
19:08:28FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3Qxy
19:08:36FromDiscord<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:50FromDiscord<treeform> I prefer imperative style for binary data
19:09:00FromDiscord<treeform> rather then descriptive style of the type system
19:09:58FromDiscord<treeform> because binary data is usually crazy complex mess. Too complex for descriptive style.
19:12:40FromDiscord<ajusa> thanks for the advice!
19:15:15FromDiscord<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:59FromDiscord<treeform> And I bet they would not be that complex to implement. Train yes, but implement? Just some matrix multiplications.
19:16:01FromDiscord<haolian9 (高浩亮)> how to list all symbols that used by `defined()` in a project?
19:16:55FromDiscord<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:40FromDiscord<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:51FromDiscord<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:43FromDiscord<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:54FromDiscord<treeform> Find other avenues of expressing your self.
19:20:17FromDiscord<treeform> Some times what we want is not what we really want.
19:20:44FromDiscord<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:55FromDiscord<Rika> Speaking of which, do you know of QOI?
19:21:09FromDiscord<Phil> It sounds weird enough to be interesting
19:21:20FromDiscord<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:09FromDiscord<Phil> Is qoi another image format that compresses well?
19:22:11FromDiscord<treeform> I find QOI quite neat, that it packs such a punch in such low amount of effort.
19:22:35FromDiscord<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:37FromDiscord<Rika> It’s a low effort high compression lossless format
19:22:46FromDiscord<treeform> Its like all the boxes I like.
19:22:57FromDiscord<Rika> You guys were talking about how webp was crazy so
19:23:24FromDiscord<treeform> yeah its really crazy
19:23:34FromDiscord<treeform> Look at QOI is quite good: https://qoiformat.org/benchmark/
19:24:23FromDiscord<treeform> https://news.ycombinator.com/item?id=29328750
19:25:11FromDiscord<treeform> A dude had a brilliant idea and it worked, while webp is a "design by committee" everything and the kitchen sink.
19:25:24FromDiscord<Phil> I may be too wonkered from work but I'm not sure I comprehend the benchmarks
19:25:30FromDiscord<Rika> In reply to @treeform "Look at QOI is": You mean quite okay?
19:25:33FromDiscord<Rika> xd
19:25:34FromDiscord<Phil> is libpng just "converts to ".png" ?
19:25:47FromDiscord<treeform> yes a "quite okay idea" ...
19:26:07FromDiscord<treeform> libpng can read/write png
19:26:11FromDiscord<treeform> but so can pixie
19:26:15FromDiscord<Phil> Which means it compresses about 20% better than png?
19:26:17FromDiscord<treeform> just use pixie's version
19:26:37FromDiscord<treeform> In reply to @Isofruit "Which means it compresses": yes, not hard to do to be honest
19:26:42FromDiscord<Rika> Looking at the QOI page and what the fuck?
19:26:44FromDiscord<Rika> https://github.com/pfusik/cito
19:26:49FromDiscord<Rika> What is this language lmao
19:26:50FromDiscord<treeform> png uses zlib which s like 90s compression
19:26:51Amun-Rathat depends on the picture, some qois are smaller, some are quite largeish comp. to png
19:27:14FromDiscord<treeform> In reply to @Rika "https://github.com/pfusik/cito": c#?
19:27:32Amun-Rano, that's Ć, a kind of C transpiler
19:28:00FromDiscord<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:09FromDiscord<Rika> I’ve never heard of it yet it has 1.2k stars
19:28:16FromDiscord<ShalokShalom> How would you check if a NimScript is executed as admin?
19:28:30FromDiscord<Rika> ?
19:28:43FromDiscord<Rika> Not a Nim binary but a script!
19:28:46FromDiscord<Rika> ?
19:29:21Amun-RaRika: I only know it exists bc I'm writing an image viewer for old formats in nim
19:29:30FromDiscord<ShalokShalom> Yeah, both in general
19:29:32FromDiscord<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:36FromDiscord<ShalokShalom> But a script, in this case
19:30:20FromDiscord<treeform> In reply to @Rika "What is this language": Some one even made mal in GNU make language, whaat?
19:30:30FromDiscord<Rika> In reply to @treeform "If you think running": If it doesn’t include Nim it’s trash smh
19:30:49FromDiscord<treeform> In reply to @Rika "If it doesn’t include": but it does?
19:31:14FromDiscord<treeform> In reply to @Rika "If it doesn’t include": https://github.com/kanaka/mal/tree/master/impls/nim
19:31:31FromDiscord<ShalokShalom> so how to wait for an answer by the system?
19:31:40FromDiscord<ShalokShalom> like a password, or even any input generally
19:31:54FromDiscord<Rika> It has a post script implementation? How the fuck
19:32:32FromDiscord<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:55FromDiscord<treeform> vhdl = "Very High-Speed Integrated Circuit Hardware Description Language "
19:34:15FromDiscord<Rika> I know I somehow missed that
19:34:20FromDiscord<Jonah> what's the best way to check if a given string/Uri is encoded or not?
19:34:39FromDiscord<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:46FromDiscord<Rika> In reply to @ShalokShalom "so how to wait": Not sure sorry
19:35:08FromDiscord<Rika> On Linux I believe it would be to set the SUID bit or something
19:37:49FromDiscord<Jonah> In reply to @Rika "Encoded in what? Percent?": encoded according to RFC3986
19:38:55Amun-Rasuid won't work with "scripts"
19:41:35FromDiscord<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:33FromDiscord<Rika> In reply to @Amun-Ra "suid won't work with": Of course, but you asked about in general
19:47:39FromDiscord<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:29PMunchNice, got my Hacktoberfest t-shirt in the mail today
20:47:11FromDiscord<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:32FromDiscord<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:40FromDiscord<Forest> In reply to @Forest "Will the template from": Anyone? :P
20:59:30PMunch@ynfle, Nim doesn't do tail call optimisation, but in general it outputs highly optimiseable C code
21:00:34PMunch@Forest, who knows, try it out and see
21:03:22FromDiscord<Forest> Fair enough lol
21:03:48FromDiscord<Forest> I just don't know how I'd use it alongside the existing compilers (and preferably without rebuilding Nim lol)
21:04:39FromDiscord<Phil> sent a long message, see http://ix.io/3QxU
21:05:22PMunch@Forest, I doubt it works without rebuilding the compiler
21:05:36PMunchUnless you somehow write one version which can load backends by dynamic library or something
21:06:25PMunch@Phil, afterWorkHours
21:06:55FromDiscord<Phil> If only those numbers were for describing hours 😛
21:07:31PMunchWell 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:38FromDiscord<Forest> Fair enough lol
21:09:35FromDiscord<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:17FromDiscord<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:49FromDiscord<Phil> (edit) "that" => "the overall"
21:11:05PMunchI mean a common term for that is "rest"
21:11:16PMunchBut that's typically when you're most interested in the first bit
21:12:22PMunch"last-" as a prefix, or "post<whatever event>" might work
21:12:34PMunchWhat are you coding for DnD by the way?
21:12:56FromDiscord<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:21FromDiscord<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:40FromDiscord<Phil> (edit) "notes)," => "notes, basically just a list of encounters really),"
21:15:11PMunchHuh, sounds handy
21:15:18FromDiscord<Phil> I found nim pretty much at the perfect time
21:16:03FromDiscord<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:14FromDiscord<Phil> And learning nim sounded really fun!
21:16:45FromDiscord<Phil> (edit) "else)" => "else and I can't really afford just enabling that for everybody)"
21:17:08FromDiscord<Phil> (edit) "everybody)" => "everybody. So far that's working on the "honors" system)"
21:17:43PMunchHeh, sounds like a good thing to disallow yeah
21:17:49PMunchWhat is the original implemented in?
21:18:01FromDiscord<Phil> Comes with the added benefit that I'm expecting it to crunch my pageloads from 50-200ms to 10-50ms
21:18:05FromDiscord<Phil> Django
21:18:21PMunchAh right
21:18:31FromDiscord<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:54FromDiscord<qb> Anyone did some scripting with fish?
21:25:22PMunchI've used haddock and bream in the past
21:31:01FromDiscord<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:04FromDiscord<qb> well yea I should have do that aswell
21:39:23FromDiscord<Elegantbeef> @ajusa\: converters do not do return type inference so you need an explicit return type
21:40:12FromDiscord<ajusa> In reply to @Elegantbeef "<@102899813149855744>\: converters do not": Ah, thanks for clarifying.
21:49:59*jjido joined #nim
21:50:36FromDiscord<Phil> Hmmm
21:51:04*kenran joined #nim
21:52:38FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3Qy3
21:53:01FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3Qy3" => "https://play.nim-lang.org/#ix=3Qy4"
21:53:27FromDiscord<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:34FromDiscord<Phil> Huh, it was deepCopy
22:02:58FromDiscord<Rika> In reply to @Isofruit "argh, names are hard....": “All after”
22:03:15FromDiscord<Rika> Or just “after”
22:25:50FromDiscord<ShalokShalom> How is that second command meant? https://media.discordapp.net/attachments/371759389889003532/946171016122597467/Screenshot_20220223_232431.png
22:27:07FromDiscord<ShalokShalom> Ah, got it
22:27:11FromDiscord<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:27FromDiscord<qb> Woho, steam deck can be ordered friday
22:35:23FromDiscord<Rika> wrong channel? lo
22:38:16FromDiscord<auxym> In reply to @Rika "“All after”": `head`, `tail` are reasonably common programming idioms, especially in functional languages
22:38:29FromDiscord<Rika> In reply to @auxym "`head`, `tail` are reasonably": they mean specific things thouhg
22:38:39FromDiscord<Rika> where head is first element and tail is everything else
22:38:44FromDiscord<Rika> this is describing something else no>
22:46:15FromDiscord<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:46FromDiscord<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:17FromDiscord<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:21FromDiscord<Rika> In reply to @Rika "where head is first": ??
22:49:38FromDiscord<Rika> that's "after the first" is it not
22:49:52FromDiscord<mratsim> yes
22:57:45FromDiscord<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:32FromDiscord<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:53FromDiscord<auxym> meh, I often use head, tail whenever I'm splitting anything in two parts, wherever it may be
23:00:01FromDiscord<Phil> So "followingNumbers", "afterNumbers" are the names I have for that so far, but none of them fit quite perfectly
23:00:33FromDiscord<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:00FromDiscord<Rika> i'd just name it only "after" even if its "specialised"
23:01:22FromDiscord<Phil> hmmmm in a very specific, short proc that naming could work
23:01:53FromDiscord<Rika> i dont see how adding the name of the type to the proc would help
23:02:40FromDiscord<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:57FromDiscord<Phil> And not to X other variables that might be flying around in the context of a longer proc
23:03:18FromDiscord<Rika> "items after"
23:04:03FromDiscord<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)