00:26:36 | * | rockcavera joined #nim |
00:26:36 | * | rockcavera quit (Changing host) |
00:26:36 | * | rockcavera joined #nim |
01:19:21 | * | noeontheend quit (Ping timeout: 248 seconds) |
01:42:23 | * | noeontheend joined #nim |
01:48:23 | FromDiscord | <STATUS_404> @ElegantBeef Can I please have some of your beefy and elegant advice bro? |
01:57:31 | FromDiscord | <STATUS_404> https://tenor.com/view/fancy-dog-fancy-steak-husky-gif-13608501 |
02:00:18 | FromDiscord | <Prestige> What's your question @STATUS_404 ? |
02:01:35 | FromDiscord | <STATUS_404> Can I please DM you a code snippet? |
02:01:42 | FromDiscord | <STATUS_404> I need that prestige advice |
02:09:31 | * | Jjp137 joined #nim |
02:33:32 | * | arkurious quit (Quit: Leaving) |
02:56:10 | * | wallabra quit (Remote host closed the connection) |
02:58:21 | * | wallabra joined #nim |
02:59:32 | FromDiscord | <Prestige> Nah just put the snippet here |
03:38:33 | * | noeontheend quit (Ping timeout: 248 seconds) |
04:00:57 | NimEventer | New thread by Morturo: How to copy dir using nimscript?, see https://forum.nim-lang.org/t/9245 |
04:23:58 | FromDiscord | <Yardanico> deleted again :( |
04:48:38 | FromDiscord | <Elegantbeef> Who's deleting these? |
05:08:25 | FromDiscord | <deadmeme77> Is Nim on termux outdated? |
05:08:38 | FromDiscord | <Elegantbeef> Probably |
05:09:58 | FromDiscord | <demotomohiro> Package manager on termux installed nim-1.6.6 on my android phone. |
05:10:49 | FromDiscord | <deadmeme77> It's 1.6.6 in mine too. Not too shabby |
05:11:29 | FromDiscord | <deadmeme77> Enough for some quick demo I'd say |
05:11:39 | FromDiscord | <Elegantbeef> That's stable |
05:11:42 | FromDiscord | <Elegantbeef> So yes that's up to date |
05:12:45 | FromDiscord | <demotomohiro> As far as I know, package manager on gentoo and arch linux provides nim-1.6.6 now. |
05:19:04 | FromDiscord | <deadmeme77> It runs perfectly. Nice 👍 |
05:24:25 | FromDiscord | <deadmeme77> @demotomohiro have you been using Nim to script batch jobs in your phone? If so, do you need root for Termux to be able to find files in Android's SD cards? |
05:44:25 | FromDiscord | <demotomohiro> I just use Nim to test some code on termux. |
05:46:09 | FromDiscord | <demotomohiro> @deadmeme77 It seems you can read sdcard from termux: https://wiki.termux.com/wiki/Internal_and_external_storage |
06:04:20 | FromDiscord | <Prestige> Elegantbeef are you familiar with testing frameworks that can "mock" function calls? I've been thinking of implementing this for my Nim testing framework but am not sure it's possible, without compiler access... |
06:05:08 | FromDiscord | <Elegantbeef> I doubt you need compiler access |
06:05:46 | FromDiscord | <Prestige> I can describe the functionality if you are unfamiliar |
06:06:03 | FromDiscord | <Elegantbeef> I'm unfamiliar so go ahead but yea i doubt you need compiler access |
06:06:56 | FromDiscord | <Prestige> "mocking" a function allows you to substitute the body of the function, basically. Change what it does and what it returns. The tricky part, I think, is substituting this for the whole Nim program |
06:07:19 | FromDiscord | <Rika> Just import some other module that mocks the function? |
06:07:20 | FromDiscord | <Elegantbeef> Yea that's what i figured you might have IO/Capi and at test time want to only return X thing |
06:07:33 | FromDiscord | <Elegantbeef> Yea that's less complex than my idea |
06:07:48 | FromDiscord | <Elegantbeef> My idea would be replace a call with your own function using a macro |
06:07:52 | FromDiscord | <Rika> Oh wait hm I get it |
06:07:57 | FromDiscord | <Prestige> In reply to @Rika "Just import some other": How could you do that globally for your program? |
06:07:58 | FromDiscord | <Rika> No I get it wait |
06:08:48 | FromDiscord | <Rika> You prolly “have” to put a define flag |
06:08:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=40s7 |
06:08:51 | FromDiscord | <Rika> Yeah that |
06:08:57 | FromDiscord | <Rika> Wait I got a warning brb |
06:09:20 | FromDiscord | <Prestige> hmmm |
06:10:01 | FromDiscord | <Prestige> Elegantbeef is there some neat way you could have the testing framwork search all files that would be used, see if it has said import, then replace it with that? |
06:10:04 | FromDiscord | <Prestige> Or am I overthinking this |
06:10:29 | FromDiscord | <Elegantbeef> I mean just make that your module |
06:10:41 | FromDiscord | <Elegantbeef> There is no reason for fancy shit |
06:10:52 | FromDiscord | <Prestige> Because I don't want anything related to testing to actually imported into files unrelated to testing, basically |
06:11:02 | FromDiscord | <Prestige> I want to keep all testing logic within the test |
06:11:28 | FromDiscord | <Elegantbeef> put a `when not defined(test): {.error: "you imported test in non test environment".}` inside `mymoduletest` |
06:11:37 | FromDiscord | <Elegantbeef> I dont see that you really need any magic here |
06:11:45 | FromDiscord | <Elegantbeef> But you know me i'm often wrong |
06:12:09 | FromDiscord | <Prestige> I could write like an example of what I want to be writing in a test I guess, if that would help |
06:13:00 | FromDiscord | <Elegantbeef> You can also emit your own procedures/calls if you really wanted |
06:13:22 | FromDiscord | <Elegantbeef> But that requires macros which dont make this reasonable to look at imo |
06:14:17 | FromDiscord | <Prestige> perhaps |
06:15:13 | FromDiscord | <Prestige> in my test I want to be able to just do like, `mock(module.someProc, myImpl)` and when I compile and run the test, it calls `myImpl` instead of `module.someProc` |
06:15:25 | FromDiscord | <Prestige> Then I don't need to create other files, etc |
06:15:43 | FromDiscord | <Elegantbeef> Sure but that requires replacing all `someProc` usage without the information where |
06:15:51 | FromDiscord | <Prestige> Yeah |
06:15:58 | FromDiscord | <Elegantbeef> So that surely needs compiler support |
06:16:27 | FromDiscord | <Elegantbeef> But you could do something like `mock(someProcCall(args), myProcToReplace, myReplacementProc)` |
06:17:10 | FromDiscord | <Elegantbeef> You might be able to abuse term rewriting macros |
06:17:53 | FromDiscord | <Prestige> hm |
06:17:57 | FromDiscord | <Prestige> I'd like more info on that |
06:20:51 | FromDiscord | <Prestige> this would be really powerful for testing |
06:21:10 | FromDiscord | <Elegantbeef> Writing an example |
06:21:54 | FromDiscord | <Prestige> sweet |
06:27:26 | FromDiscord | <Elegantbeef> Nope order of operations issue as always |
06:27:49 | FromDiscord | <Prestige> well damn |
06:28:16 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3ZTJ |
06:28:24 | FromDiscord | <Elegantbeef> We could do it unsafely with just idents |
06:28:49 | FromDiscord | <Elegantbeef> So you'd do `mock(doThing, proc() = echo "no")` and it'd replace all `doThing` with the name of that proc |
06:29:42 | FromDiscord | <Elegantbeef> i mean we could make it a tinge safer with checking the type and if the module is the same |
06:29:56 | FromDiscord | <Elegantbeef> so you could do like `mock("mymodule.myProc", ...)` |
06:30:41 | FromDiscord | <Prestige> that playground didnt work out |
06:30:50 | FromDiscord | <Prestige> it's not code |
06:30:55 | FromDiscord | <Elegantbeef> Eh doesnt matter i have a proper implementation incomming |
06:30:59 | FromDiscord | <Prestige> kk |
06:52:03 | FromDiscord | <Elegantbeef> @Prestige\: https://wandbox.org/permlink/QH7tzss8BNQAbhU6 |
06:52:21 | FromDiscord | <Elegantbeef> That norewrite pragma doesnt seem to be working... odd |
06:52:27 | FromDiscord | <Prestige> https://media.discordapp.net/attachments/371759389889003532/987973116141658112/unknown.png |
06:52:47 | FromDiscord | <Prestige> Can you see the image I posted? |
06:52:50 | FromDiscord | <Elegantbeef> It's a multi file project what want me to zip it? |
06:53:01 | FromDiscord | <Prestige> Sure |
06:53:35 | FromDiscord | <Prestige> maybe use wormhole.app |
06:54:00 | FromDiscord | <Elegantbeef> What matrix files are too spooky for you? |
06:54:21 | FromDiscord | <Prestige> matrix files? |
06:54:34 | FromDiscord | <Prestige> if you mean that wandbox.org thing, that didn't work |
06:54:34 | FromDiscord | <Elegantbeef> Matrix supports file uploads |
06:54:41 | FromDiscord | <Elegantbeef> It's a multi media protocol |
06:55:05 | FromDiscord | <Prestige> I mean send it however you can, but that site didn't work |
06:56:27 | FromDiscord | <Elegantbeef> mocker.tar.gz https://media.discordapp.net/attachments/371759389889003532/987974123382800424/mocker.tar.gz |
06:56:47 | FromDiscord | <Prestige> ty |
06:59:04 | FromDiscord | <Elegantbeef> Would be nice if `noRewrite` was respected |
07:04:10 | FromDiscord | <Elegantbeef> If unclear you need to pass `-d:test` |
07:06:46 | FromDiscord | <Elegantbeef> and you probably want to do `--hint[Pattern]:off` if you dont like the noise, this way of mocking will cause the compiler to be slower since norewrite isnt respected for whatever reason |
07:10:33 | FromDiscord | <Prestige> i'll try to break it |
07:24:45 | * | ltriant quit (Ping timeout: 256 seconds) |
07:36:57 | FromDiscord | <Prestige> hm I can't import and export `mocker` from a file where I'm using `newStmtList` |
07:37:18 | FromDiscord | <Prestige> `Error: expression ' {.noRewrite.}: newStmtList([])' is of type 'NimNode' and has to be used (or discarded)` |
07:39:14 | FromDiscord | <Elegantbeef> Dont export mocker anyway |
07:39:36 | FromDiscord | <Elegantbeef> It needs to me imported in all files to work as it's supposed to |
07:41:32 | FromDiscord | <Prestige> hmm |
07:42:55 | FromDiscord | <Elegantbeef> Dont know if you noticed the config.nims but that's how we're injecting it |
08:09:36 | FromDiscord | <Prestige> So it's always implicitly imported, hmm |
08:22:14 | * | pro joined #nim |
08:40:27 | * | kayabaNerve joined #nim |
08:44:51 | FromDiscord | <Prestige> yeah not sure how I should be using this |
08:44:59 | FromDiscord | <Prestige> with the weird import thing |
08:45:23 | FromDiscord | <Prestige> because my testing framework needs to export that file right? |
08:49:39 | FromDiscord | <Prestige> Closest I can get to it working, is the previous error I posted above |
08:56:01 | * | ltriant joined #nim |
08:56:25 | * | jmdaemon quit (Ping timeout: 248 seconds) |
08:57:13 | * | kayabaNerve quit (Ping timeout: 244 seconds) |
08:57:40 | FromDiscord | <d4rckh> does it happen for anyone else for vs code to keep resetting your indentation settings? |
08:58:07 | FromDiscord | <d4rckh> i like indenting with 2 spaces in nim but vs code keeps resetting it to 4 spaces 🤔 |
08:59:55 | * | kayabaNerve joined #nim |
09:02:10 | FromDiscord | <Elegantbeef> No you testing framework doesnt need to export any file |
09:02:45 | FromDiscord | <Elegantbeef> You have to import that module in all modules to have `mock` work properly |
09:03:03 | FromDiscord | <Elegantbeef> So you need to bring that around and use `--import:mocker` |
09:14:06 | * | kayabaNerve quit (Remote host closed the connection) |
09:18:43 | * | kayabaNerve joined #nim |
09:29:28 | * | kayabaNerve quit (Ping timeout: 248 seconds) |
09:36:55 | FromDiscord | <j-james> In reply to @d4rckh "i like indenting with": i don't think you can set per-language indentation settings in vscode |
09:37:29 | FromDiscord | <d4rckh> i have to go manually and click detect indentation from file every time i open vs code |
09:37:34 | FromDiscord | <d4rckh> (edit) "i have to go manually ... and" added "to each file" |
09:37:44 | FromDiscord | <d4rckh> why doesnt it detect the indentation automatically? |
09:37:53 | FromDiscord | <j-james> oh that's unexpected |
09:38:05 | FromDiscord | <j-james> there should be a "detect indentation" setting |
09:38:43 | FromDiscord | <d4rckh> wait i found it |
09:38:48 | FromDiscord | <d4rckh> but i swear i enabled it before and it didnt work |
09:39:00 | FromDiscord | <d4rckh> now it works 🤦♂️ |
09:39:31 | FromDiscord | <j-james> i've had annoyances with it not indenting with two spaces when creating new files, but existing always works fine |
09:39:49 | FromDiscord | <d4rckh> it should do something like |
09:40:18 | FromDiscord | <d4rckh> if it detects im indenting manually using 2 spaces, like pressing space 2 times to indent, it should automatically change the behavior of the tab key to insert 2 spaces |
09:54:20 | NimEventer | New thread by Justb: Optimize this code?, see https://forum.nim-lang.org/t/9246 |
10:04:01 | * | kayabaNerve joined #nim |
10:08:14 | FromDiscord | <xflywind> sent a code paste, see https://play.nim-lang.org/#ix=40sG |
10:08:16 | FromDiscord | <xflywind> found a VM bug |
10:08:27 | FromDiscord | <xflywind> (edit) "bug" => "bug: field 'node' is not accessible for type 'TFullReg' using 'kind = rkRegisterAddr' [FieldDefect]" |
10:18:20 | * | kayabaNerve quit (Ping timeout: 244 seconds) |
10:32:15 | FromDiscord | <STATUS_404> In reply to @Avahe "Nah just put the": No thank you bro, that sounds unreasonable. If you are not confident you can help me alone your expertise is not really what I am looking for. |
10:32:51 | * | kayabaNerve joined #nim |
10:38:01 | FromDiscord | <Phil> That is impressively rude for a message in a help chat |
10:40:12 | * | gsalazar quit (Ping timeout: 276 seconds) |
10:42:06 | FromDiscord | <exelotl> lmao |
10:43:31 | FromDiscord | <xflywind> ? |
10:46:09 | FromDiscord | <aph> In reply to @Isofruit "That is impressively rude": they can't see it now anyway, they left i think |
10:48:51 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=40sL |
10:48:53 | FromDiscord | <d4rckh> any reason for why $filePath is empty? |
11:00:29 | FromDiscord | <d4rckh> maybe i need to allocate the buffer? |
11:06:34 | FromDiscord | <Rika> LP means it’s a pointer? |
11:06:47 | FromDiscord | <Rika> It starts off null, so you should initialise it yes |
11:56:01 | FromDiscord | <d4rckh> In reply to @Rika "It starts off null,": uhh no really sure how |
11:56:14 | FromDiscord | <d4rckh> is this the proper way? 🤔 |
11:56:16 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=40sQ |
11:56:26 | FromDiscord | <Rika> im not familiar with raw windows apis so i cant help you there |
12:06:48 | * | kayabaNerve quit (Ping timeout: 248 seconds) |
12:30:25 | * | arkurious joined #nim |
12:31:22 | FromDiscord | <d4rckh> just trying to get the file path of my executable |
12:31:32 | * | kayabaNerve joined #nim |
12:48:40 | FromDiscord | <amadan> @d4rckh this gets the path the the binary https://nim-lang.org/docs/os.html#getAppFilename |
12:50:06 | FromDiscord | <amadan> (you can take a look at how it uses the winapi if you want to do it manually) |
12:50:10 | FromDiscord | <d4rckh> ah, thanks! |
12:55:53 | * | krux02 joined #nim |
13:11:48 | * | pro quit (Quit: pro) |
13:21:00 | FromDiscord | <federico3> the compiler and stdlib uses both `defined(osx)` and `defined(macosx)` |
13:28:28 | * | kayabaNerve quit (Ping timeout: 244 seconds) |
14:29:35 | * | kayabaNerve joined #nim |
15:19:20 | * | kayabaNerve quit (Ping timeout: 248 seconds) |
15:36:39 | * | kayabaNerve joined #nim |
15:41:12 | * | kayabaNerve quit (Ping timeout: 248 seconds) |
15:45:08 | * | kayabaNerve joined #nim |
15:50:23 | FromDiscord | <proton> What's the equivalent of nginx proxy_pass for Jester? |
15:55:29 | FromDiscord | <Yardanico> proxy_pass |
15:55:45 | FromDiscord | <Phil> Do you want to use jester as the reverse proxy? |
15:55:48 | FromDiscord | <Yardanico> oh, if you want to do the same with jester, it doesn't have that functionality |
15:55:51 | FromDiscord | <Yardanico> you'll have to do it manually |
15:56:14 | FromDiscord | <Phil> I feel like you'd be better served using nginx for that either way |
16:00:42 | FromDiscord | <Rika> yes |
16:02:13 | FromDiscord | <proton> ok, thanks |
16:03:56 | FromDiscord | <proton> There is a requirement to serve website built by Next.js as well as apis at the same time |
16:11:46 | FromDiscord | <Phil> Run 3 servers would be my suggestion |
16:12:21 | FromDiscord | <Phil> Nginx , jester and next ja, with nginx being reverse proxy for the others at the same time |
16:12:32 | FromDiscord | <Phil> (edit) "ja," => "js," |
16:12:57 | FromDiscord | <Phil> Just run next js and jester on different ports |
16:26:22 | * | xet7 joined #nim |
16:39:16 | * | krux02 quit (Read error: Connection reset by peer) |
16:44:46 | * | PMunch joined #nim |
16:50:28 | * | krux02 joined #nim |
17:04:25 | * | TakinOver quit (Ping timeout: 248 seconds) |
17:05:28 | * | kayabaNerve quit (Ping timeout: 248 seconds) |
17:18:40 | FromDiscord | <Xzayler> sent a code paste, see https://play.nim-lang.org/#ix=40tN |
17:19:10 | FromDiscord | <Rika> `self.selected` is a type descriptor? |
17:19:24 | FromDiscord | <Rika> more info please? like what is self? what is selected? |
17:19:27 | FromDiscord | <Xzayler> Not sure what that is, I declared it like: var selected = seq[Plant] |
17:19:29 | FromDiscord | <Elegantbeef> it... cant be but somehow is? |
17:19:33 | FromDiscord | <Xzayler> (edit) "var" => "`var" | "seq[Plant]" => "seq[Plant]`" |
17:19:38 | FromDiscord | <Rika> yeah thats wrong |
17:19:41 | FromDiscord | <Elegantbeef> `: seq[Plant]` |
17:20:16 | FromDiscord | <Xzayler> omg I have to stop for today |
17:20:19 | FromDiscord | <Xzayler> so sorry guys |
17:24:00 | FromDiscord | <Phil> It's fine, I semi regularly ask waaaaay dumber questions here |
17:24:25 | Amun-Ra | I'd use haproxy for reverse proxying |
17:24:56 | FromDiscord | <Rika> i'd say haproxy is better for load balancing ironically |
17:24:58 | FromDiscord | <Phil> Why not just industry standards like Apache and nginx ? |
17:25:10 | FromDiscord | <Rika> haproxy is also industry standard.......... |
17:25:10 | Amun-Ra | it is industry standard |
17:25:13 | FromDiscord | <Phil> Oh wait, I'm dumb |
17:25:22 | FromDiscord | <Phil> Ah, too slow |
17:25:28 | Amun-Ra | and it's way better status page than (free) nginx does ;> |
17:25:34 | Amun-Ra | it's → it has |
17:25:37 | FromDiscord | <Rika> yes that is true |
17:25:38 | FromDiscord | <Phil> Memory kicked in way to late |
17:25:46 | FromDiscord | <Rika> metrics are better on haproxy |
17:26:05 | FromDiscord | <Rika> i should prolly migrate my nginx config then |
17:26:19 | FromDiscord | <Phil> Hmm, my old workplace used haproxy |
17:26:31 | FromDiscord | <Phil> Current one swears on nginx |
17:26:36 | Amun-Ra | I use nginx as httpd and haproxy for ssl offload/revproxy/lb |
17:27:06 | FromDiscord | <Phil> And I'm too unknowing to know if one has cases where they are better than the other |
17:29:35 | * | haskellandchill joined #nim |
17:31:43 | FromDiscord | <Rika> haproxy is equal with nginx with reverse proxy stuff, but ofc it isnt an httpd |
17:32:33 | Amun-Ra | mhm |
17:33:33 | FromDiscord | <Phil> So basically given I just want it to serve my front-end and forward requests to my backend and serve image /audio files I could just as easily use haproxy ? |
17:36:07 | Amun-Ra | yes |
17:36:37 | FromDiscord | <Phil> Hmmmm |
17:36:56 | FromDiscord | <Phil> I might make a second docker image of by project eventually then |
17:41:10 | haskellandchill | hi is this the most active chat for nim discussion? I wanted to evaluate Nim's feature claims like https://mawfig.github.io/2022/06/18/v-lang-in-2022.html did for V lang. I expect Nim to do much better than V did. |
17:42:17 | FromDiscord | <huantian> Yeah this is probably the most active chat |
17:42:35 | haskellandchill | ok and if I access it from discord it's the same basically? |
17:42:49 | FromDiscord | <Phil> Pretty much |
17:42:57 | FromDiscord | <huantian> Mhm the chat is bridged between discord, irc, and matrix |
17:44:13 | FromDiscord | <huantian> Depending on your topic it might be better to make a forum post tho |
17:45:25 | * | haskellandchill quit (Quit: Client closed) |
17:45:33 | FromDiscord | <Phil> Aye. Form post is more likely to get attention if you want some more elaborate answers |
17:45:50 | FromDiscord | <haskellandchill> interesting |
17:46:07 | FromDiscord | <dom96> Matrix<->Discord<->IRC. It's all linked together here |
17:46:29 | FromDiscord | <Elegantbeef> Even had telegram at one point but "They're too noisey" 😄 |
17:46:30 | FromDiscord | <haskellandchill> I just want to be fair to the community and also yeah not be missing anything basic with my approach |
17:47:29 | FromDiscord | <haskellandchill> I just started: https://github.com/svanderbleek/x-language-review/blob/main/lrnim/review.md |
17:48:29 | FromDiscord | <Elegantbeef> Well we're already off to the races with ways to add to your post! 😄 |
17:49:31 | FromDiscord | <haskellandchill> one thing I can't figure out is how to refer to `$` as a function |
17:49:42 | FromDiscord | <Elegantbeef> backtick before and after |
17:49:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=40tU |
17:50:07 | FromDiscord | <Yardanico> also https://media.discordapp.net/attachments/371759389889003532/988138623914344508/unknown.png |
17:50:28 | FromDiscord | <haskellandchill> Makes sense |
17:51:58 | FromDiscord | <haskellandchill> It seems contradictory to the goal in the faq |
17:52:07 | FromDiscord | <dom96> The segfault in that case can be thought of as a NilPointerException and indeed there is a Nim module which makes it so: https://nim-lang.org/docs/segfaults.html |
17:52:22 | FromDiscord | <haskellandchill> I understand why it's happening and that it's intended behavior |
17:52:26 | FromDiscord | <dom96> (edit) "NilPointerException" => "NilAccessException" |
17:52:30 | FromDiscord | <Elegantbeef> Nim does have mechanisms for no nil in `experimenta:strictNotNil` |
17:52:51 | FromDiscord | <haskellandchill> ooo |
17:53:11 | FromDiscord | <Elegantbeef> Though as the name implies it's not complete |
17:53:15 | FromDiscord | <Phil> In reply to @Elegantbeef "Nim does have mechanisms": Aaaaand bookmarked |
17:53:25 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#strict-not-nil-checking |
17:53:37 | FromDiscord | <Yardanico> In reply to @haskellandchill "ooo": also just to be clear - nim and rust are different in quite a lot of things |
17:53:43 | FromDiscord | <Yardanico> even the basic approach to safety/etc is very different |
17:53:46 | FromDiscord | <haskellandchill> oh for sure |
17:53:49 | FromDiscord | <Yardanico> and memory management |
17:53:51 | FromDiscord | <haskellandchill> I'm just using it as an example |
17:54:07 | FromDiscord | <haskellandchill> oh how it could be handled to be more in line with the faq statement: "How about security and memory safety?↵Nim provides memory safety by not performing pointer arithmetic, with optional checks, traced and untraced references and optional non-nullable types." |
17:54:20 | FromDiscord | <haskellandchill> specifically a "traced reference" |
17:54:24 | FromDiscord | <Yardanico> a lot of the manual is quite old, yes |
17:54:47 | FromDiscord | <Elegantbeef> Memory safety also isnt a overwhelmingly concise term |
17:55:02 | FromDiscord | <Elegantbeef> Depending on what you consider it means changes what that means 😄 |
17:55:17 | FromDiscord | <haskellandchill> the goal of the project is to be more precise and have verified support for language claims |
17:55:35 | FromDiscord | <haskellandchill> (edit) "the goal of the project is to be more precise ... and" added "with" |
17:56:05 | FromDiscord | <haskellandchill> but I believe that experimental feature is in line with it |
17:56:49 | FromDiscord | <haskellandchill> `nim c --experimental:strictNotNil file.nim`? |
17:57:10 | FromDiscord | <Elegantbeef> Yep or you can just include `{.experimental: "strictNotNil".}` in the fiile before your nilable code |
17:57:43 | FromDiscord | <haskellandchill> hm it doesn't seem to do anything for this case |
17:57:53 | FromDiscord | <haskellandchill> are there any examples for it? |
17:58:00 | FromDiscord | <Elegantbeef> You need to annotate the type is nilable |
17:58:07 | FromDiscord | <Elegantbeef> Scroll down on that link |
17:58:08 | FromDiscord | <Rika> you mean not nilable |
17:58:41 | FromDiscord | <haskellandchill> oh cool thanks |
17:59:02 | FromDiscord | <Elegantbeef> It doesnt turn all `ref T` into `not nil` only the ones you annotate |
17:59:38 | FromDiscord | <Elegantbeef> It also isnt complete so there are probably bugs and the like, but it's there so thought i'd mention it |
17:59:59 | FromDiscord | <haskellandchill> this syntax confuses me |
17:59:59 | FromDiscord | <haskellandchill> sent a code paste, see https://play.nim-lang.org/#ix=40tW |
18:00:07 | FromDiscord | <Rika> ? in what whay |
18:00:08 | FromDiscord | <Rika> (edit) "whay" => "way" |
18:00:15 | FromDiscord | <Elegantbeef> Object is a type alias to `NilableObject not nil` |
18:00:17 | FromDiscord | <haskellandchill> hm so I need two types to do it? |
18:00:21 | FromDiscord | <Rika> not necessarily |
18:00:22 | FromDiscord | <Elegantbeef> Yes |
18:00:26 | FromDiscord | <Rika> wait really? |
18:00:34 | FromDiscord | <Rika> you cant directly `ref object not nil`? |
18:00:39 | FromDiscord | <haskellandchill> I tried that |
18:00:41 | FromDiscord | <haskellandchill> it didn't work |
18:00:46 | FromDiscord | <Elegantbeef> You cannot directly do that rika |
18:00:47 | FromDiscord | <Rika> when did it change |
18:00:53 | FromDiscord | <Rika> prolly read the rfc and forgot |
18:01:00 | FromDiscord | <Elegantbeef> `notNil` vs `strictNotNil` |
18:01:29 | FromDiscord | <haskellandchill> oh there's another? |
18:01:41 | FromDiscord | <Elegantbeef> Actually no nevermind neither support it |
18:01:54 | FromDiscord | <Elegantbeef> Eh `notNil` was a different implementation that is really deprecated by the latter |
18:02:08 | FromDiscord | <huantian> There are some alternative ways to make ref objects nil safe like Option and byref ig↵↵Or just don’t use ref objects |
18:02:53 | FromDiscord | <huantian> Oh is notNil just an older version? I was always confused why there’s two |
18:02:58 | FromDiscord | <Elegantbeef> I think the definition Nim uses of memory safe is more along the lines of "Memory is never lost and is always freed" |
18:03:03 | FromDiscord | <haskellandchill> byref ig? |
18:03:21 | FromDiscord | <Elegantbeef> Yea i think `notNil` was an old implementation that's only kept around due to possible old code that relies on it |
18:06:35 | FromDiscord | <Elegantbeef> I don't think the current implementation of `strictNotNil` actually catches a field access oddly |
18:06:49 | FromDiscord | <dom96> sent a code paste, see https://play.nim-lang.org/#ix=40tZ |
18:07:19 | FromDiscord | <Elegantbeef> It's probably just easier on the parser this way |
18:08:27 | FromDiscord | <haskellandchill> hm it doesn't seem to catch field access |
18:08:40 | FromDiscord | <haskellandchill> but I can change the example |
18:09:06 | FromDiscord | <Elegantbeef> I dont think it presently ever assumes the `not nil` object can be nil |
18:09:19 | FromDiscord | <Elegantbeef> So yea that's one of those bugs i mentioned 😄 |
18:10:32 | FromDiscord | <haskellandchill> > We show an error for each dereference ([], .field, [index] () etc) which is of a tracked expression which is in MaybeNil or Nil state. |
18:10:39 | FromDiscord | <huantian> Pragma you can use on non-ref value types to make them pass by reference iirc↵(@haskellandchill) |
18:10:45 | FromDiscord | <haskellandchill> what does it mean by "We show an error" |
18:10:54 | FromDiscord | <haskellandchill> compile error? doesn't seem to |
18:11:02 | FromDiscord | <Elegantbeef> Eh huan most types are passed by ref as they're larger than 3 floats |
18:11:14 | FromDiscord | <Yardanico> both of these not nil things are unfinished, I don't think they ever worked as advertised :) |
18:11:36 | FromDiscord | <Elegantbeef> Eh yard it works just on `Nilable -> not nil` it doesnt work on the `not nil` part presently |
18:11:40 | FromDiscord | <dom96> it's also unclear what their future looks like, there were questions posed in https://github.com/nim-lang/RFCs/issues/437 but not answered |
18:11:59 | FromDiscord | <Elegantbeef> It's intended to be kept |
18:12:08 | FromDiscord | <Elegantbeef> > "Not nil annotation" -- Should be planned for Nim 2.x but removed from the "experimental" manual. |
18:12:10 | FromDiscord | <Yardanico> ? https://media.discordapp.net/attachments/371759389889003532/988144172835930272/unknown.png |
18:12:18 | FromDiscord | <Yardanico> although it's a stretch goal |
18:12:45 | FromDiscord | <Elegantbeef> yardanico that's for `out` parameters |
18:14:16 | FromDiscord | <huantian> We have our parameters?? |
18:14:23 | FromDiscord | <Elegantbeef> No we do not |
18:14:38 | FromDiscord | <Elegantbeef> It's reserved in the language and araq wants them for definite assignment |
18:17:50 | FromDiscord | <huantian> Interesting |
18:18:03 | FromDiscord | <huantian> I can’t tell if this convo was helpful or confusing lmao |
18:18:13 | FromDiscord | <haskellandchill> woa strictNotNil worked without the `not nil` annotation |
18:19:17 | FromDiscord | <Elegantbeef> Uhh? |
18:19:19 | FromDiscord | <Elegantbeef> Code? |
18:20:13 | FromDiscord | <haskellandchill> sent a code paste, see https://play.nim-lang.org/#ix=40u0 |
18:20:24 | FromDiscord | <haskellandchill> with `nim c --experimental:strictNotNil ref.nim` |
18:20:55 | FromDiscord | <dom96> what's the error you get? :o |
18:21:09 | FromDiscord | <Yardanico> warning |
18:21:16 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=40u2 |
18:21:21 | FromDiscord | <Yardanico> but of course you can always turn warnings into errors |
18:21:26 | FromDiscord | <dom96> cool |
18:22:01 | FromDiscord | <ElegantBeef> odd it doesnt work for field access right now 😄 |
18:22:31 | FromDiscord | <haskellandchill> how do I turn warnings into errors? |
18:23:10 | FromDiscord | <Elegantbeef> `--warningAsError[StrictNotNil]` i think |
18:23:20 | FromDiscord | <haskellandchill> oh I can't do it for all warnings? |
18:24:16 | FromDiscord | <Elegantbeef> Seems not |
18:25:19 | reversem3[m] | What am I doing wrong https://play.nim-lang.org/#ix=40u1... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/4924a04ad4f9b641468e458c6f520920204d1dbe) |
18:26:20 | FromDiscord | <Elegantbeef> With thinks like strictNotNil though it propagates down to the stdlib aswell and some things arent presently setup to handle that |
18:26:23 | FromDiscord | <Elegantbeef> things like\ |
18:26:33 | FromDiscord | <Elegantbeef> Nim's `strictFunc` also has a similar issue |
18:26:44 | om3ga | Hello! Is there some lib that can plot fft of wave file? |
18:27:10 | * | noeontheend joined #nim |
18:28:02 | FromDiscord | <haskellandchill> This seems weird |
18:28:10 | FromDiscord | <haskellandchill> sent a code paste, see https://play.nim-lang.org/#ix=40u3 |
18:28:21 | FromDiscord | <haskellandchill> where did `digits100` come from |
18:28:21 | FromDiscord | <Elegantbeef> Like i said it's the stdlib not presently written with strictNotNil in mind |
18:28:34 | FromDiscord | <Elegantbeef> You call `echo t.x` |
18:28:39 | FromDiscord | <haskellandchill> ah |
18:29:23 | FromDiscord | <Phil> In reply to @reversem3 "What am I doing": I'll take a look in an hour or so, currently only on phone and on phone it looks too garbled to properly see anything |
18:29:41 | FromDiscord | <Elegantbeef> Even at a desktop it's too garbled |
18:29:59 | FromDiscord | <Phil> Ah so that wasn't my phone |
18:30:48 | reversem3[m] | Its showing the errors from vim |
18:30:59 | FromDiscord | <Phil> In that case could you also add a clean copy paste of a minimal example reversem3? |
18:31:05 | reversem3[m] | do you want me to post without the errors |
18:31:15 | reversem3[m] | ok |
18:32:28 | reversem3[m] | https://play.nim-lang.org/#ix=40u4 |
18:32:34 | reversem3[m] | no errors , sorry about that |
18:32:51 | reversem3[m] | * no error in the paste now , sorry about that |
18:33:05 | FromDiscord | <Phil> That's f fine |
18:33:39 | FromDiscord | <Phil> You can't access the dB like that. First things first, you using sqlite or postgres? |
18:34:15 | reversem3[m] | db_postgres |
18:34:38 | FromDiscord | <Phil> Because your key problem is you're trying to use a dB connection (dB) without creating it first |
18:35:57 | FromDiscord | <Phil> Norm has a template for that, let me see |
18:36:31 | reversem3[m] | So this doesn't work ? `import std/db_postgres |
18:36:31 | reversem3[m] | let db = open("localhost", "user", "password", "dbname") |
18:36:31 | reversem3[m] | db.close()` |
18:37:55 | FromDiscord | <Phil> It does but the line running create tables is line 21 |
18:38:06 | FromDiscord | <Phil> You create the connection way later |
18:40:12 | NimEventer | New thread by Bulat_Ziganshin: Lifetime of pointer returned by str.cstring, see https://forum.nim-lang.org/t/9247 |
18:40:16 | reversem3[m] | Ok, so I shouldn't have a separate file for opening the connection then? |
18:40:24 | FromDiscord | <Phil> Although even then you might get ringtone errors because those login credentials do not look like valid postgres login credentials. However, I have not used postgres before so no idea if those are some sort of valid default |
18:42:07 | FromDiscord | <Phil> Ohhh wait .. Oh fuck it, this is too painful on phone, I'll look at it when I'm in front of a computer. |
18:44:05 | FromDiscord | <haskellandchill> ringtone errors? |
18:44:57 | FromDiscord | <huantian> Probably autocorrect from runtime |
18:46:35 | FromDiscord | <haskellandchill> ah I was picturing somehow opening a connection to postgres like a dial up modem |
18:47:40 | FromDiscord | <Phil> Runtime |
18:47:49 | FromDiscord | <Phil> Not ringtone. Gna |
18:48:16 | FromDiscord | <huantian> In reply to @haskellandchill "ah I was picturing": That would be funny 😄 |
18:56:21 | NimEventer | New question by justb: How could I optimize this Nim code with lots of similar functions?, see https://stackoverflow.com/questions/72679549/how-could-i-optimize-this-nim-code-with-lots-of-similar-functions |
18:58:04 | FromDiscord | <Phil> Yeeeeh that's a design question |
19:14:21 | * | noeontheend quit (Ping timeout: 276 seconds) |
19:18:12 | * | jmdaemon joined #nim |
19:26:49 | * | jmdaemon quit (Ping timeout: 248 seconds) |
19:27:36 | * | jmdaemon joined #nim |
19:28:37 | * | rockcavera quit (Read error: Connection reset by peer) |
19:29:08 | * | rockcavera joined #nim |
19:29:08 | * | rockcavera quit (Changing host) |
19:29:08 | * | rockcavera joined #nim |
19:29:27 | FromDiscord | <Gennadiy> sent a long message, see http://ix.io/40uc |
19:42:56 | * | kayabaNerve joined #nim |
19:46:16 | FromDiscord | <exelotl> I'm using Norm right now and _dang_ it would really benefit from stable `not nil` in the language |
19:46:43 | FromDiscord | <Elegantbeef> Or not being written with OOP as the base 😄 |
19:47:17 | FromDiscord | <exelotl> nrm |
19:47:18 | * | kayabaNerve_ joined #nim |
19:48:08 | FromDiscord | <Elegantbeef> I havent used it whatsoever but i did notice it's usage of `Model` should be doable with a base `Model = object of RootObj` or just a concept |
19:48:52 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=40uh |
19:49:02 | FromDiscord | <d4rckh> 🤔 How do I prevent this error? |
19:49:11 | FromDiscord | <d4rckh> should i check for `socket.isClosed`? |
19:49:16 | FromDiscord | <Elegantbeef> Open the socket |
19:49:28 | FromDiscord | <Elegantbeef> Apparently |
19:49:46 | * | kayabaNerve quit (Ping timeout: 244 seconds) |
19:49:53 | * | Jjp137 quit (Quit: Leaving) |
19:51:19 | FromDiscord | <exelotl> In reply to @Elegantbeef "I havent used it": I mean, the OOP aspect is exactly what I want, the thing is before doing a query you're expected to have a fully instantiated object which will be populated with the results of the query, but if that object (or any of its fields which are also model objects) happen to be `nil` then it just segfaults :x |
19:51:30 | * | kayabaNerve_ quit (Ping timeout: 240 seconds) |
19:51:35 | FromDiscord | <Elegantbeef> What? |
19:52:06 | FromDiscord | <Elegantbeef> I dont know Norm related APIs but given phil's code i didnt see any benefit in the OOP method of code, i could be wrong |
19:53:21 | * | Jjp137 joined #nim |
19:54:08 | FromDiscord | <Elegantbeef> Like does it actually benefit from being able to dynamically point at any model, or is it all mostly static? |
19:54:34 | * | Jjp137 quit (Client Quit) |
19:55:04 | FromDiscord | <exelotl> oh, you mean like that |
19:56:03 | FromDiscord | <exelotl> not sure if the inheritance is necessary or if dynamic dispatch is actually used |
19:57:28 | * | Jjp137 joined #nim |
19:57:44 | * | PMunch quit (Quit: leaving) |
19:58:05 | FromDiscord | <exelotl> seems mostly just useful as a way to ensure every model has the necessary internal fields (e.g. `id`) |
19:58:27 | FromDiscord | <Elegantbeef> Yea that's my point concepts + value type inheritance works |
19:58:34 | FromDiscord | <Elegantbeef> For instance |
19:58:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=40ui |
19:59:49 | FromDiscord | <Elegantbeef> But i really should make it clear i've never used Norm or anything like it so i dont even know what it does |
20:31:44 | FromDiscord | <ripluke> Is there a function I can use to rename files |
20:32:30 | FromDiscord | <Elegantbeef> `moveFile` |
20:34:48 | FromDiscord | <ripluke> Ohk |
20:43:47 | * | noeontheend joined #nim |
20:55:21 | FromDiscord | <Phil> In reply to @reversem3 "https://play.nim-lang.org/#ix=40u4": Alright, finally can look at it on a proper screen |
20:56:08 | FromDiscord | <Phil> Issue 1) You don't import the postgres module in norm. the norm/model module is for defining models. The methods for doing things on a given database are in the sqlite/postgres modules |
20:57:05 | FromDiscord | <Phil> Issue 2) db is a DbConn object from std/db_sqlite (which norm has its own version of but they are literally the same type |
20:57:24 | FromDiscord | <Phil> (edit) "type" => "thing and can be used interchangeably)" |
20:57:32 | FromDiscord | <Phil> (edit) "interchangeably)" => "interchangeably). It does not have a "userFoo" attribute" |
20:57:57 | FromDiscord | <Phil> (edit) "Issue 2) db is a DbConn object from std/db_sqlite (which norm has its own version of but they are literally the same thing and can be used interchangeably). It does not have a "userFoo" attribute ... " added "(The echo `db.userFoo` will get you there)" |
20:59:40 | FromDiscord | <Phil> (Minor) Issue 3) Which won't be a runtime error but is in general advisable: database connection pooling is neat and saves you the runtime-effort of creating and destroying database connections all the time. |
21:00:56 | FromDiscord | <Phil> Issue 4) You might want to double check if you can access your postgres database with neither a username nor a password (since you pass those as empty strings). |
21:01:06 | FromDiscord | <Phil> (edit) "strings)." => "strings when creating a connection)." |
21:01:10 | FromDiscord | <Elegantbeef> I see phil has replaced me 😄 |
21:01:15 | FromDiscord | <Phil> (edit) "Issue 4) You might want to double check if you ... can" added "actually" |
21:01:32 | FromDiscord | <Phil> This is questions about like the 1 project I've actually made semi-significant contributions to |
21:02:14 | FromDiscord | <Elegantbeef> That's how it starts! |
21:02:29 | FromDiscord | <Phil> Sorry if I might be a bit short, was in a theme park for birthday celebrations of a friend of mine and my brain is woozy af |
21:03:07 | FromDiscord | <Phil> Way too much rollercoaster stuff |
21:10:35 | reversem3[m] | Yeah I got it to work now buy fixing the lines , I can see the rows now |
21:11:07 | * | rockcavera quit (Read error: Connection reset by peer) |
21:12:09 | reversem3[m] | So it’s ‘import norm/[model,postgres]’ |
21:13:04 | reversem3[m] | I wonder if I can use my db_connect.nim file now |
21:13:09 | * | rockcavera joined #nim |
21:14:44 | FromDiscord | <Phil> Generally I would not recommend the model of having one global database connection that you reuse over and over |
21:14:46 | reversem3[m] | I need to figure out though why I can’t just select the email from the row , it’s tells me I have to select everything. Just to the User.email. |
21:14:55 | reversem3[m] | * Just to get the User.email. |
21:15:07 | FromDiscord | <Phil> norm wants to build you the entire object |
21:15:13 | FromDiscord | <Phil> Or what do you mena? |
21:15:38 | reversem3[m] | Let get back on pc to show you |
21:15:45 | FromDiscord | <Phil> norm should generate the SQL for you other than the WHERE clause, which you can modify yourself, so not sure where precisely you're meaning |
21:19:40 | * | pro joined #nim |
21:34:30 | * | noeontheend quit (Ping timeout: 240 seconds) |
21:41:07 | FromDiscord | <whisper> Araq mentioned in forum combination of trial deletion algorithms with ideas from generational GCs. Is there any specific paper or group of papers he was referring to? |
21:57:53 | FromDiscord | <Elegantbeef> You could ask in the forum post or ask him yourself 😄 |
22:01:11 | NimEventer | New thread by Treeform: Show Nim: Pure Nim .jpeg decoder in Pixie, see https://forum.nim-lang.org/t/9248 |
22:01:41 | FromDiscord | <treeform> In reply to @NimEventer "New thread by Treeform:": I am around to answer any questions you might have. |
22:12:09 | * | pro quit (Quit: pro) |
22:27:34 | FromDiscord | <ajusa> In reply to @treeform "I am around to": Thank you for doing this! |
22:35:43 | FromDiscord | <treeform> 🙂 |
22:53:14 | * | adium quit (Quit: Stable ZNC by #bnc4you) |
23:08:33 | * | adium joined #nim |
23:13:06 | FromDiscord | <demotomohiro> In reply to @treeform "I am around to": Pure Nim .jpeg decoder implementation is awesome! |
23:14:37 | FromDiscord | <ynfle> In reply to @treeform "I am around to": Can pixie be used to implement computer vision algorithms? Like does it give you random access to the data? |
23:16:12 | FromDiscord | <demotomohiro> In reply to @ynfle "Can pixie be used": pixie reads image file to `Image` type object and you can do random access each pixels. |
23:21:53 | FromDiscord | <treeform> Yeah you can do anything to the images, for CV, you might scale them to fit your neural network. |
23:24:29 | FromDiscord | <ynfle> I will definitely be trying out seam carving with pixie. Looking forward |
23:24:34 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=40uT |
23:28:19 | FromDiscord | <ynfle> The real question is who influenced who for the "py" name ending schema? Do all your collaborators have to use that schema? |
23:32:17 | FromDiscord | <Elegantbeef> You mean the `y` suffix? |
23:33:54 | FromDiscord | <!Patitotective> its better than calling it imagenim |
23:34:24 | FromDiscord | <Elegantbeef> Not as good as nimagine |
23:34:38 | FromDiscord | <Elegantbeef> I'm joking of couruse |
23:34:40 | FromDiscord | <Elegantbeef> course even |
23:35:35 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=40uV |
23:35:57 | FromDiscord | <treeform> In reply to @ynfle "The real question is": Just kind of happened one day |
23:36:18 | FromDiscord | <treeform> or Justy kinddy of happeneddy oniey day |
23:36:41 | FromDiscord | <ynfle> Is that why guzba called it zippy? |
23:36:52 | FromDiscord | <ynfle> Or is that not the same decision/happening? |
23:37:02 | FromDiscord | <guzba> zippy was right around when the "y" thing happened iirc |
23:37:38 | FromDiscord | <guzba> supersnappy was before, but just happens to fit?↵the "before" treeform repos are like "chroma" "chrono" "vmath" etc lots of em↵the "after", well those are obvious haha |
23:38:21 | FromDiscord | <ynfle> I think it should go in the official nim style guide |
23:38:33 | FromDiscord | <!Patitotective> its part of treeforms master plan |
23:39:21 | FromDiscord | <guzba> we had some epic debates of pixxy / pixy / pixie↵is the y sound the important part, or the y letter? |
23:39:24 | FromDiscord | <guzba> existential questions |
23:39:43 | FromDiscord | <Elegantbeef> Nah it's atrocious for people that like pun filled library names!↵(@ynfle) |
23:40:03 | FromDiscord | <Elegantbeef> you just cant beat kashae for a cache library |
23:40:31 | FromDiscord | <ynfle> vershun too |
23:41:36 | FromDiscord | <Elegantbeef> Though i guess oopsie fits the suffix |
23:41:57 | FromDiscord | <guzba> hottie also went "sound" over "letter" |
23:42:09 | FromDiscord | <guzba> i think it is slightly more flexible but still on brand |
23:42:10 | FromDiscord | <guzba> hahaha |
23:45:45 | * | xaltsc joined #nim |