00:27:03 | tk | Why does from std/enumerate import enumerate not work? |
00:27:18 | tk | using the enumerate macro results in: Error: undeclared identifier: 'enumerate' |
00:27:27 | tk | simply replacing the line with "import std/enumerate" fixes the issue |
00:28:23 | FromDiscord | <Elegantbeef> It might be a product of module name == symname or the for loop macro |
00:28:35 | FromDiscord | <Elegantbeef> Eitherway it literally has a single macro in it π |
00:29:14 | tk | I am aware, but confusing language behaviour does not make me happy. Which is why I want to understand exactly what happened. |
00:29:56 | FromDiscord | <Elegantbeef> Well give it a whirl with another macro with the same name as the module if that works make it a for loop macro, if that works the end is upon us |
00:30:50 | tk | okay, fair idea, I will try that tomorrow |
00:47:00 | * | arkurious quit (Quit: Leaving) |
01:14:27 | * | neurocyte0132889 quit (Ping timeout: 260 seconds) |
01:30:13 | * | lively_s1 joined #nim |
01:39:00 | * | lively_s1 quit (Ping timeout: 260 seconds) |
02:19:04 | FromDiscord | <reilly> Is it documented anywhere what operating systems are available to the `defined()` proc? |
02:22:29 | FromDiscord | <leorize> it's not documented but it's the same as the possible names for `hostOS` constant, which is documented |
02:48:34 | NimEventer | New thread by Oden: Sequitls documentation outdated?, see https://forum.nim-lang.org/t/8556 |
02:48:49 | FromDiscord | <geekrelief> is it possible to assign a returned `var T` to a variable? https://play.nim-lang.org/#ix=3Dek after I assign increment `bar`, I expect `val` to be 2, but it's 1. |
02:50:52 | FromDiscord | <Elegantbeef> Without experimental views nope, but you can use `std/decls` to get it as long as you know it doesnt escape |
02:50:59 | FromDiscord | <geekrelief> Strangely, things kinda work with var return type for iterators |
02:51:39 | FromDiscord | <geekrelief> Hey beef, would you mind taking a look at this? https://play.nim-lang.org/#ix=3Dem |
02:52:34 | FromDiscord | <geekrelief> I'm trying define an iterator that returns a mutable value over `UncheckedArray[T]| ptr T` |
02:52:51 | FromDiscord | <geekrelief> They work separately, but not when the type is or'ed. And I don't understand why. |
02:53:28 | FromDiscord | <Elegantbeef> does using `ptr` change anything |
02:54:04 | FromDiscord | <geekrelief> well I have two `mitems` in the sample |
02:54:13 | FromDiscord | <geekrelief> one takes `ptr T` |
02:54:46 | FromDiscord | <Elegantbeef> Well you're using ptr math so this makes it more annoying to test |
02:55:00 | FromDiscord | <geekrelief> I'm cleaning up the sameple https://play.nim-lang.org/#ix=3Den |
02:55:14 | FromDiscord | <geekrelief> yeah, I've include the `ptr` math ops I'm using |
02:55:19 | FromDiscord | <geekrelief> (edit) "include" => "included" |
02:55:32 | FromDiscord | <geekrelief> those work for sure |
02:55:44 | FromDiscord | <Elegantbeef> that's cause it fits both definitions |
02:55:57 | FromDiscord | <Elegantbeef> It's a `ptr T` and an `var UncheckedArray` |
02:56:57 | FromDiscord | <geekrelief> oh you're saying `var UncheckedArray[T] | ptr T` is redudant? |
02:58:29 | FromDiscord | <geekrelief> if I uncomment `iterator mitems[T](a: var UncheckedArray[T] | ptr T, len: SomeInteger): var T =` and comment out the ones above I get an error: `expression has no address` |
02:58:48 | FromDiscord | <geekrelief> on the `yield a[i]` |
02:59:35 | FromDiscord | <geekrelief> It doesn't like the UncheckedArray but if pass the ptr T for `var UncheckedArray[T] | ptr T` it works |
03:01:55 | FromDiscord | <Elegantbeef> being tired is not helping this π |
03:02:07 | FromDiscord | <geekrelief> don't worry, thanks for taking a look |
03:02:24 | FromDiscord | <Elegantbeef> I'll try to get it working, but i'm not seeing the connections |
03:03:27 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3Der |
03:03:47 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3Des |
03:04:57 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3Det |
03:04:59 | FromDiscord | <Elegantbeef> I wonder if mitems even works with an ord typedesc |
03:05:10 | FromDiscord | <Elegantbeef> or'd\ |
03:06:42 | FromDiscord | <geekrelief> I still get the same result |
03:06:42 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3Deu |
03:07:10 | FromDiscord | <geekrelief> don't worry about it, I'll post to the forum |
03:15:23 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Dez |
03:17:13 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3DeA |
03:17:41 | FromDiscord | <Elegantbeef> That'd be enough if it's enough for you |
03:18:12 | FromDiscord | <ajusa> I guess what I'm asking is what's the most "nim-like" way of doing it. Are pragmas/macros my only option? |
03:18:46 | FromDiscord | <Elegantbeef> I mean you of course can do it N-zillion ways, pragmas/macros are probably the most sensible |
03:19:07 | FromDiscord | <ajusa> In reply to @Elegantbeef "I mean you of": Alright, that's basically what I was trying to confirm. Thanks! |
03:22:37 | NimEventer | New thread by Geekrelief: Trouble with or'ed type and var return type., see https://forum.nim-lang.org/t/8557 |
03:23:04 | FromDiscord | <Elegantbeef> Will say you have the two options of doing the pragmas like that or doing `SignupForm.name.setLabel"First and Last Name"` |
03:24:13 | FromDiscord | <Elegantbeef> The latter might be nice as it could allow possibly allow for localization |
03:24:20 | FromDiscord | <Elegantbeef> Though i might be wrong on that front |
03:32:18 | FromDiscord | <ajusa> In reply to @Elegantbeef "Will say you have": How does that option work exactly? Does it need dotOperators? |
03:34:57 | FromDiscord | <Elegantbeef> `setLabel` would be a macro which would add it to a list which you could refer to later, you could either do `setLocale` or include a locale flag into the macro |
03:35:38 | FromDiscord | <ajusa> ah so it figures out the parent type and then the nested field then, got it |
03:35:53 | * | lively_s1 joined #nim |
03:36:08 | FromDiscord | <Elegantbeef> Yea you should get the entire dot expression |
03:56:02 | FromDiscord | <Elegantbeef> @ajusa\: here is my idea half implemented https://play.nim-lang.org/#ix=3DeG |
03:58:19 | FromDiscord | <ajusa> In reply to @Elegantbeef "<@102899813149855744>\: here is my": Thanks, I'll try working off of this! |
03:59:04 | FromDiscord | <Elegantbeef> To actually support local you'll want to output a table instead since this is all CT |
04:04:14 | FromDiscord | <ajusa> Oh hey I got a codegen crash on Nim 1.6 |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:31 | * | supakeen joined #nim |
04:08:16 | FromDiscord | <ajusa> In reply to @ajusa "Oh hey I got": turns out you can't use fieldPairs with Karax's DSL |
04:08:38 | FromDiscord | <ajusa> (edit) "In reply to @ajusa "Oh hey I got": turns out you can't use fieldPairs with Karax's DSL ... " added "- I think it is still an issue with Nim though since it crashes in codegen" |
04:09:30 | * | lively_s1 quit (Ping timeout: 260 seconds) |
04:12:49 | * | rockcavera quit (Remote host closed the connection) |
04:46:19 | FromDiscord | <Elegantbeef> @ajusa\: shouldnt you be compiling for JS anyway? |
05:18:01 | * | vicecea quit (Remote host closed the connection) |
05:18:29 | * | vicecea joined #nim |
05:45:51 | * | lively_s1 joined #nim |
06:11:19 | * | sagax joined #nim |
06:22:54 | NimEventer | New Nimble package! riff - RIFF file handling for Nim , see https://github.com/johnnovak/nim-riff |
06:44:14 | * | PMunch_ is now known as PMunch |
06:49:35 | * | lively_s1 quit (Ping timeout: 264 seconds) |
06:57:53 | * | neurocyte0132889 joined #nim |
06:57:53 | * | neurocyte0132889 quit (Changing host) |
06:57:53 | * | neurocyte0132889 joined #nim |
07:18:18 | Amun-Ra | I know it works but is it save to copy to string with copyMem(addr s[0], β¦)? |
07:18:22 | Amun-Ra | safe* |
08:18:00 | PMunch | Hmm, I have a weird bug. Something causes a segfault in a shared library I've written in Nim. It only happens in our production environment and I'm not even 100% sure it is caused by my code. I tried to build a debug version of Nim but that just yielded the line "No stack trace available" before the segfault message. What would be my best steps to further debug this issue.. |
08:18:05 | PMunch | s/../? |
08:24:38 | FromDiscord | <leorize> if you can get it to segfault on nim \>= 1.6.0, it should create a coredump that you can use to investigate |
08:26:40 | PMunch | Oh really? |
08:26:48 | PMunch | Where does it store that? |
08:27:35 | FromDiscord | <Imperatorn> What OS? |
08:28:03 | PMunch | Ubuntu in a Docker container |
08:28:22 | FromDiscord | <leorize> is this a bug with that unbound plugin you wrote a while back? |
08:28:35 | PMunch | Yup |
08:28:44 | PMunch | It's been running in production ever since I wrote it |
08:28:52 | PMunch | Handling about 100M DNS queries a day |
08:29:43 | FromDiscord | <leorize> https://le.qun.ch/en/blog/core-dump-file-in-docker/ \<- this might work |
08:30:27 | FromDiscord | <leorize> and that's some nice stats |
08:31:04 | PMunch | Yeah it works pretty well and has been fairly problem free |
08:31:30 | FromDiscord | <leorize> also, make sure that your nim library\: does not use dlopen via dynlib and is compiled with nim \>= 1.4.0 |
08:33:17 | FromDiscord | <leorize> make sure that you don't deallocate any memory coming from unbound using Nim's `dealloc` |
08:33:28 | FromDiscord | <leorize> or send any Nim's memory to `unbound`, for that matter |
08:33:50 | PMunch | Yeah I've taken all the normal steps |
08:33:56 | FromDiscord | <leorize> `-d:noSignalHandler` might come in handy to not overrides unbound's signal handlers by accident |
08:34:24 | PMunch | I mean I was running it on my machine just blasting it with queries and I wasn't able to crash it |
08:34:38 | PMunch | So there is some edge-case scenario when hit with the real world |
08:35:33 | FromDiscord | <leorize> run it with coredump enabled and hope that you can catch it then |
08:36:27 | PMunch | Starting with 1.6.0 I get a lot of CStringConv warnings by the way |
08:37:07 | PMunch | I had a version that didn't crash before, but it had some performance issues. Slight refactor and update the versions of different things and now it crashes sometimes |
08:37:37 | FromDiscord | <leorize> just remember to replace the convs with addr I guess |
08:37:47 | FromDiscord | <leorize> hmm, it wasn't mentioned on 1.6.0 release note at all |
08:37:57 | PMunch | Hmm, what do you mean? |
08:38:54 | FromDiscord | <leorize> to silence those warnings, that is |
08:39:13 | FromDiscord | <leorize> I think now `addr` must be used to signify those conversions since they are dangerous |
08:39:18 | FromDiscord | <leorize> (rightfully so) |
08:44:05 | PMunch | I use it to convert C library error strings into Nim strings |
08:44:30 | PMunch | Oh wait, I convert Nim strings to C strings.. |
08:44:31 | PMunch | Hmm |
08:45:57 | * | lively_s1 joined #nim |
08:47:20 | PMunch | I call the Unbound log_* functions which obviously take a cstring. And I do things like `log_err("Unable to get key: " & getCurrentExceptionMsg())`. |
08:47:33 | PMunch | What is the lifetime of that string actually? |
09:00:13 | PMunch | Seems to all be freed right after the log statement, which should be fine |
09:02:14 | PMunch | Hmm, by explicitly converting it to cstring it works just fine.. |
09:09:27 | * | lively_s1 quit (Ping timeout: 265 seconds) |
09:15:09 | FromDiscord | <leorize> i think you're fine on that front |
09:16:36 | FromDiscord | <leorize> there's always --gc\:orc -d\:useMalloc to debug the harder cases |
09:17:47 | FromDiscord | <leorize> and if the memory corruption is too hard to track with the coredump then sanitizers are an option, but it might create too much of a performance hit |
09:58:29 | * | lively_s1 joined #nim |
10:24:17 | FromDiscord | <Arend | ααα’α±ααα> <@&371760044473319454> any here that I could talk to? |
10:24:28 | * | lively_sparkle joined #nim |
10:24:33 | PMunch | Fire away |
10:24:54 | FromDiscord | <Arend | ααα’α±ααα> I got banned from nim's forum on my 1st comment lmao |
10:25:11 | PMunch | How'd you manage that? |
10:25:25 | FromDiscord | <Arend | ααα’α±ααα> well thats what I need a moderator for |
10:26:27 | PMunch | Oh that's what your @ was |
10:26:40 | PMunch | On IRC they just come through as a bunch of numbers |
10:26:47 | * | lively_s1 quit (Ping timeout: 264 seconds) |
10:27:02 | FromDiscord | <Arend | ααα’α±ααα> apologies |
10:27:17 | supakeen | Not like you could know :) |
10:28:19 | PMunch | What was your post though? Now I'm curious |
10:28:29 | FromDiscord | <impbox [ftsf]> i am a mod, you can message me |
10:29:00 | FromDiscord | <impbox [ftsf]> though i am not a forum mod, so i can't help with that |
10:29:13 | FromDiscord | <Arend | ααα’α±ααα> I simply posted in the nim 2.0 thread and got banhammered straight away hehe |
10:29:29 | FromDiscord | <impbox [ftsf]> were you deserving? |
10:30:14 | FromDiscord | <Arend | ααα’α±ααα> I dont think so, it's not like I was saying to get rid of signifcant whitespace or case insensitivity |
10:30:19 | FromDiscord | <Arend | ααα’α±ααα> in that case, ban away |
10:30:22 | FromDiscord | <Arend | ααα’α±ααα> hah |
10:30:46 | PMunch | So what did you post? |
10:30:52 | FromDiscord | <xflywind> New users are moderated at the beginning. It needs a moderator to unlock. |
10:31:05 | FromDiscord | <xflywind> no related to banning |
10:31:09 | FromDiscord | <xflywind> (edit) "no" => "not" |
10:31:10 | PMunch | I think few things should be instantly banable |
10:31:41 | FromDiscord | <impbox [ftsf]> unless you were spamming or phishing it's unlikely you'd be banned for a first post |
10:31:48 | FromDiscord | <Arend | ααα’α±ααα> just that I didnt like try/catch blocks as error handling and preferred something like Zig |
10:31:57 | FromDiscord | <impbox [ftsf]> so It's likely just moderated until it's approved |
10:31:59 | FromDiscord | <Arend | ααα’α±ααα> apparently that's a few bridges to far |
10:32:04 | FromDiscord | <Arend | ααα’α±ααα> no, my acount is literally banned |
10:32:11 | FromDiscord | <impbox [ftsf]> does it say you're banned? |
10:32:27 | FromDiscord | <Arend | ααα’α±ααα> "Your account was banned." |
10:32:34 | FromDiscord | <Arend | ααα’α±ααα> Rank Troll |
10:33:00 | PMunch | Huh, that's odd |
10:33:03 | FromDiscord | <impbox [ftsf]> hmm mod in a bad mood perhaps. seems overkill |
10:33:13 | PMunch | How does Zig handle errors by the way? |
10:33:25 | PMunch | Some kind of optional return system? |
10:34:26 | FromDiscord | <Arend | ααα’α±ααα> well, they switch over errors rather than try blocks, makes it look less cluttered |
10:35:53 | PMunch | So you get something like a (error: Option[Defect], result: Option[T]) as a return? |
10:38:15 | FromDiscord | <haxscramper> You can do it already to an extent - disable all raises, and use Result or leorize union |
10:38:23 | FromDiscord | <haxscramper> And switch over errors |
10:38:54 | FromDiscord | <haxscramper> I need to try out union, certainly worth adding somewhere in the code |
11:15:55 | * | lively_sparkle quit (Ping timeout: 260 seconds) |
11:16:40 | PMunch | Huh union looks pretty neat |
11:21:57 | FromDiscord | <haxscramper> I think it would also be possible to wrap procedure call into union automatically - check for possible exceptions with `std/effecttraits`, generate `try/except` and make it return `union(Ok | Error1 | Error2 | Error3)` etc) |
11:26:46 | PMunch | Ooh, that would probably be possible |
11:27:07 | PMunch | A simple pragma that took all the possible exceptions and instead returned a union with the original return type and all the exceptions |
11:36:35 | FromDiscord | <hmmm> hi lovelies |
11:36:47 | FromDiscord | <hmmm> how does the magic thingy "items" work |
11:36:49 | FromDiscord | <haxscramper> `Error: invalid package name: /mnt/workspace/clean-clone/hack/nimdeps/pkgs/union` |
11:36:53 | FromDiscord | <haxscramper> nim can't handle dash in absolute package name? |
11:37:41 | FromDiscord | <haxscramper> you mean `for a in MyObject` calls `items()`? |
11:38:09 | FromDiscord | <hmmm> yes |
11:38:12 | FromDiscord | <haxscramper> `/hm+/` |
11:38:53 | FromDiscord | <haxscramper> you can define `iterator items(arg: SomeType)` and it will be called in the `for a in <expr of SomeType>` implicitly |
11:39:08 | FromDiscord | <haxscramper> `for a` calls `items()`, `for a, b` calls `pairs()` |
11:39:41 | * | lively_sparkle joined #nim |
11:40:28 | FromDiscord | <hmmm> so it works on objects like "for in in myseq" does for seqs |
11:40:51 | FromDiscord | <hmmm> for x in myseq |
11:41:53 | FromDiscord | <haxscramper> yes, `seq` also implements `items` iterator |
11:42:12 | FromDiscord | <hmmm> this is quite comfy |
11:42:28 | FromDiscord | <hmmm> how do I know if an object supports items? |
11:43:08 | FromDiscord | <haxscramper> you can calls `items()` explicitly |
11:43:14 | FromDiscord | <haxscramper> `for a in items(Object())` |
11:43:20 | FromDiscord | <haxscramper> compiler will tell you if something is missing |
11:43:58 | FromDiscord | <hmmm> perfect |
11:44:19 | FromDiscord | <hmmm> the relevant section of the manual is where it talks about iterators? |
11:45:23 | * | lively_sparkle quit (Ping timeout: 264 seconds) |
11:45:54 | FromDiscord | <haxscramper> yes |
11:46:48 | FromDiscord | <hmmm> ty hexxy π |
11:53:46 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3DgD |
11:54:14 | FromDiscord | <haxscramper> `union(int | ref Exc2:ObjectType | ref Exc:ObjectType)` |
11:55:15 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3DgF |
11:55:34 | FromDiscord | <haxscramper> no syntax sugar for matching union, but this can be implemented as |
11:55:43 | FromDiscord | <haxscramper> hm, actually I think it will work |
11:56:34 | PMunch | Pretty neat actually |
11:58:28 | PMunch | And since == automatically unpacks you can do `someWrappedProc() == 42` and if it threw something it would fall into an else branch |
11:59:36 | FromDiscord | <haxscramper> It almost worked |
11:59:37 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3DgH |
12:00:12 | FromDiscord | <haxscramper> fusion/matching can work with derived objects using `of` check, and union implements `of` operator to check, so I though I might merge these two together |
12:00:28 | FromDiscord | <haxscramper> But I got `/tmp/union/raiseunion.nim(42, 30) Error: there is only one type <A> in the typeclass <A | B>` |
12:00:43 | FromDiscord | <haxscramper> ο»Ώleorize\: maybe you have an idea what might be wrong here? |
12:01:03 | FromDiscord | <haxscramper> It complains about `func isNil[A, B](u: union(A | B)): bool = false` |
12:02:36 | FromDiscord | <haxscramper> "got error" |
12:02:40 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3DgL |
12:03:52 | PMunch | of of? |
12:04:00 | FromDiscord | <haxscramper> I know `of of` looks weird - first one is a part of `case/of` syntax, second is a part of the DSL so I can figure whether you want to match for `Kind()` or `of DerivedSubtype()` |
12:04:21 | PMunch | Ah I see |
12:05:04 | FromDiscord | <tandy> [impbox](https://matrix.to/#/@impbox:matrix.org)\: do you have an example for nico that uses oolib? |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:32 | * | supakeen joined #nim |
12:11:32 | FromDiscord | <Rika> Maybe name it βsub kindβ or something instead of βifβ |
12:11:34 | FromDiscord | <Rika> βOfβ |
12:14:40 | FromDiscord | <haxscramper> how it would look? |
12:14:46 | FromDiscord | <haxscramper> `of sub Exc()`? |
12:15:38 | PMunch | `of subKind Exc()` looks pretty neat |
12:15:40 | FromDiscord | <haxscramper> there is a built-in `of` operator for checking if type is a subtype of another one, so I used it here as well |
12:15:53 | PMunch | Maybe have both? |
12:16:14 | FromDiscord | <haxscramper> it is not a subkind, it is a subtype |
12:16:55 | FromDiscord | <haxscramper> having both is undeirable, I would prefer to have one way of writing things in the same DSl |
12:17:11 | FromDiscord | <Arend | ααα’α±ααα> I love how this code experimentation started because I got hammered on my first post π |
12:17:33 | FromDiscord | <haxscramper> I might consider something different than `of`, though probably not `subtype` |
12:17:45 | FromDiscord | <haxscramper> I really wonder what happened thereβ΅(@Arend | ααα’α±ααα) |
12:18:01 | FromDiscord | <xflywind> In reply to @Arend | ααα’α±ααα "I love how this": what's your forum username? |
12:18:06 | PMunch | Oh by the way @Arend_|_ααα’α±ααα, why have you written the name of a French place in runes at the end of your nick? |
12:18:35 | PMunch | I mean this is like 50% of my weird code experiments |
12:19:05 | FromDiscord | <Arend | ααα’α±ααα> @xflywind just Arend; PMunch, a French place? It says Maurice |
12:19:35 | FromDiscord | <Arend | ααα’α±ααα> in Dutch phonetics |
12:20:05 | PMunch | Oh I thought it said Mouries |
12:20:10 | FromDiscord | <xflywind> In reply to @Arend | ααα’α±ααα "@xflywind just Arend; PMunch,": @dom96 @Araq @narimiran are there something wrong with the forum post? |
12:20:44 | PMunch | I mean phonetically I guess those are the same :P |
12:21:08 | * | Vladar joined #nim |
12:23:50 | FromDiscord | <Arend | ααα’α±ααα> PMunch, it does say that if you transliterate it into Latin but I was working on a Runic alphabet for the Modern Dutch language and I yeeted some letters; the letters x,c,q,v are useless phonetically in effect so they got removed. |
12:23:59 | FromDiscord | <haxscramper> also "rank - troll" |
12:24:06 | FromDiscord | <haxscramper> lmao, who came up with this |
12:24:44 | FromDiscord | <haxscramper> I know that araq is not a big fan of union/result/option fp things, so there might be a chance |
12:25:32 | PMunch | But still, we shouldn't ban people just because we disagree with them.. |
12:25:40 | FromDiscord | <Rika> I doubt he did it |
12:25:50 | PMunch | @Arend_|_ααα’α±ααα, ah I see |
12:31:02 | FromDiscord | <ajusa> In reply to @Elegantbeef "<@102899813149855744>\: shouldnt you be": Nah this is server side generated HTML |
12:51:19 | NimEventer | New thread by Didlybom: Nimsuggest issue with the (nim-based) VS Code extension and nim 1.6.0, see https://forum.nim-lang.org/t/8559 |
12:53:19 | NimEventer | New thread by Didlybom: Nimsuggest issue with the VS Code extension and nim 1.6.0, see https://forum.nim-lang.org/t/8560 |
13:12:21 | * | arkurious joined #nim |
13:14:34 | * | rockcavera joined #nim |
13:14:34 | * | rockcavera quit (Changing host) |
13:14:34 | * | rockcavera joined #nim |
13:16:51 | * | lively_sparkle joined #nim |
13:34:43 | * | lively_sparkle quit (Quit: WeeChat 3.3) |
13:39:32 | FromDiscord | <galen> Hi! I'm trying to make a small program which is opened when clicking on a certain kind of file, like a .log for example. How would I go about finding out which file the program just got "opened" on? |
13:39:59 | PMunch | Depends on how your file manager passes files to programs |
13:40:12 | FromDiscord | <galen> In reply to @PMunch "Depends on how your": its on windows only |
13:41:03 | PMunch | Probably it is some kind of parameter passing, so need paramCount and paramStr to find the name of the file |
13:42:16 | FromDiscord | <galen> Thank you! Will start there π |
13:43:45 | PMunch | At least that's the way it'd be done on Linux. But since it's Windows it might be a five word system call to get a wide string with BOM markers or something equally silly |
13:44:02 | nixfreak_nim[m] | This is weird , this simple program works fine on playgound but gives me error on emacs and nvim (neovim) https://play.nim-lang.org/. I get the error Error: missing closing ' for character literal |
13:44:02 | FromDiscord | <galen> π damn hahah |
13:44:28 | nixfreak_nim[m] | I am using 1.4.8 on emacs and neovim |
13:44:32 | PMunch | What small program nixfreak_nim[m] |
13:44:53 | PMunch | @galen, try the paramStr route first, I think it works |
13:45:34 | nixfreak_nim[m] | var s: set[char] = {'d' .. 'f', '!'}... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/5a3d28bd29d50acd8039de1e66e9485daeead978) |
13:46:30 | PMunch | Works fine for me running it locally |
13:46:50 | nixfreak_nim[m] | and running 1.4.8 ? |
13:47:04 | PMunch | 2.6.0 |
13:47:07 | PMunch | 1.6.0* |
13:47:26 | NimEventer | New thread by Didlybom: Error: type mismatch: got <End>, see https://forum.nim-lang.org/t/8561 |
13:47:26 | nixfreak_nim[m] | let me try 1.6.0 |
13:47:28 | PMunch | Just tested with 1.4.8 as well, and it works fine there as well |
13:47:38 | nixfreak_nim[m] | I don't get it then |
13:48:20 | PMunch | Maybe you've added some hidden characters in your file by accident? |
13:48:58 | PMunch | I get sha256 4a1142b3360227f0a8246cb81dae73da2e072d870f788b6f984bcb06c6bd8d4e on the file with the content copied from the playground |
13:49:26 | NimEventer | New thread by Didlybom: Forum issue when creating a thread, see https://forum.nim-lang.org/t/8562 |
13:51:44 | * | nixfreak_nim[m] uploaded an image: (154KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/PUUKeRSDJzhNZGwUGtoBayvv/image.png > |
13:51:57 | FromDiscord | <galen> In reply to @PMunch "<@121291582367334400>, try the paramStr": Only returns the name of the executable π€· |
13:52:49 | PMunch | With a `for i in 0..paramCount: echo paramStr(i)` loop? |
13:53:10 | * | nixfreak_nim[m] uploaded an image: (250KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/HrbfZxhBBIGgRbCRRDkoOgFB/image.png > |
13:54:11 | FromDiscord | <galen> In reply to @PMunch "With a `for i": π π the paramCount was 1 so I figured paramStr(0) would be the only valid thing to do, I do get the file now, thank you! |
13:54:37 | nixfreak_nim[m] | is it nim-suggest having issues , but then why won't it compile ? |
13:55:42 | PMunch | @galen, yeah this is a bit goofy. You have 1 extra parameter in addition to your filename which is always included |
13:55:57 | nixfreak_nim[m] | I need to get ready for work , bbl |
13:57:00 | FromDiscord | <galen> In reply to @PMunch "<@121291582367334400>, yeah this is": Ah, the more I know! Thanks again stranger!!!!!! |
13:57:53 | PMunch | No problem :) |
13:57:55 | FromDiscord | <Illusive> So |
13:58:18 | FromDiscord | <Illusive> I am currently writing a discord bot with usage of dimscmd and dimscord. |
13:58:26 | FromDiscord | <Illusive> I would like to let the user fill some varitables |
13:58:36 | FromDiscord | <Illusive> and then program will run with his varitables |
13:58:58 | PMunch | So a configuration file? |
13:59:05 | FromDiscord | <hmmm> hi boyz |
13:59:16 | FromDiscord | <Illusive> In reply to @PMunch "So a configuration file?": Not really a best choice |
13:59:25 | FromDiscord | <hmmm> how do I append elements to a seq of seq matrix thingie |
13:59:40 | FromDiscord | <Rika> I made something like that but you still need an evaluator for your βscriptβ |
13:59:48 | FromDiscord | <hmmm> let's say that every seq must have 5 elements |
13:59:51 | FromDiscord | <Rika> What are you thinking of running? Math? Full script? |
14:00:07 | FromDiscord | <Rika> Sequences cannot be given a size invariant easily |
14:00:31 | FromDiscord | <Rika> You must check yourself (with a macro or manually or whatever) |
14:00:35 | FromDiscord | <hmmm> rika sama don't talk difficoult to me |
14:00:52 | FromDiscord | <Illusive> sent a code paste, see https://play.nim-lang.org/#ix=3Dhc |
14:05:55 | * | PMunch quit (Quit: Leaving) |
14:07:01 | FromDiscord | <hmmm> ah it was simple, I just x.add(seq) to the seq[seq] thingie |
14:08:29 | FromDiscord | <Illusive> tbh i am not sure how to figure out about my problem i have in my case |
14:09:22 | FromDiscord | <Rika> I have no idea what you mean |
14:09:48 | FromDiscord | <Rika> You want to concatenate strings to create a command? |
14:10:21 | FromDiscord | <Illusive> Yeah |
14:19:18 | FromDiscord | <hmmm> with the new imports like std/strutils can I still do something like from strutils import parsefloat |
14:20:10 | FromDiscord | <enthus1ast> @Illusive\:https://nim-lang.org/docs/strformat.html |
14:28:11 | FromDiscord | <Illusive> thanks, but s1 and d1 variatble should be defined by the user who uses the bot |
14:29:00 | FromDiscord | <enthus1ast> so they're unknown on compiletime? |
14:32:21 | FromDiscord | <Illusive> we can say yes |
14:32:29 | FromDiscord | <enthus1ast> then\: β΅https://nim-lang.org/docs/strutils.html#%25%2Cstring%2CopenArray%5Bstring%5D |
14:34:19 | FromDiscord | <Illusive> and by idea dimscord will let user fill the variatble right? |
14:34:56 | FromDiscord | <enthus1ast> i do not understand |
14:37:28 | FromDiscord | <Illusive> When the bot is deployed, and user uses the command `/copy` it should tell the user to fill `s1` varitable then after user filled it it will ask to fill the variatble `d1` . After user filled all variatbles it will execute the command which is specified in python code by `proc` variatble. |
14:37:51 | FromDiscord | <enthus1ast> ok so only the value is not known at compile time. |
14:38:10 | FromDiscord | <enthus1ast> the user is not able to define a `z4` variable right? |
14:38:15 | FromDiscord | <Illusive> Yeah |
14:38:23 | FromDiscord | <enthus1ast> ok then you can go with strformat |
14:38:59 | FromDiscord | <Illusive> about filling the variatbles the discord bot will ask to do that in discord itself |
14:40:06 | FromDiscord | <enthus1ast> so discord gives you a string ala\:β΅β΅/copy foo baa d1=baa zaa s1=traa |
14:40:08 | FromDiscord | <enthus1ast> ? |
14:41:04 | FromDiscord | <Illusive> `/copy s1:"foo" d2:"bar"` |
14:41:19 | FromDiscord | <enthus1ast> and this you will get as a string? |
14:41:57 | FromDiscord | <Illusive> It will get the string and then pass it to the `proc` variatble which has the specified command |
14:43:02 | FromDiscord | <enthus1ast> yes so then you must tokenize and parse the string that discord gives you and fill the desired variables and call you run process code |
14:47:07 | FromDiscord | <Illusive> any idea how? |
14:47:39 | FromDiscord | <Illusive> apart from strutils and strformat docs |
14:48:40 | FromDiscord | <enthus1ast> Are " allowed inside the strings you pass to the variables? |
14:49:56 | FromDiscord | <enthus1ast> Well you could do it with the strscan or the parseutils or the various regex modules |
14:50:10 | FromDiscord | <enthus1ast> Or even a split could be enough |
14:56:15 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3Dho |
14:56:29 | FromDiscord | <enthus1ast> outputs\:β΅`my s1:foo my d2:bar` |
14:58:39 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3Dhp |
15:00:12 | FromDiscord | <Rika> you cant receive the raw message with slash commands |
15:02:52 | FromDiscord | <Illusive> https://bin.snopyta.org/?f05e0415667f80b2#F3AgY2B59KwrphHzs8hknJ8gFVwmdtoXRwmYK2Tuk5HU |
15:02:57 | FromDiscord | <Illusive> here is the whole thing |
15:03:45 | FromDiscord | <Rika> can you define the variable name? i assume not? |
15:06:36 | FromDiscord | <Illusive> ? |
15:07:35 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3DhK |
15:08:27 | FromDiscord | <enthus1ast> so i guess a`md.addSlash("copy") do (s1: string, d2: string)`should do it? |
15:08:49 | FromDiscord | <enthus1ast> cmd |
15:08:56 | FromDiscord | <Rika> yes |
15:17:36 | FromDiscord | <Illusive> Damn |
15:17:42 | FromDiscord | <Illusive> Now my code screams with lots of errors |
15:17:52 | FromDiscord | <Rika> which is |
15:19:28 | FromDiscord | <Illusive> https://bin.snopyta.org/?432f7050dcc4f385#AUYzp1Qqq9QbjPxoMLsaVENpxf8PfB5bpjnrVNkJFeKB |
15:21:37 | FromDiscord | <Rika> `"GC:{$s1}"` should be `&"GC:{s1}"` same with the other one |
15:21:40 | NimEventer | New thread by Vsajip: Trying to unify an object model, see https://forum.nim-lang.org/t/8563 |
15:22:13 | FromDiscord | <tandy> https://github.com/drellem/bitboard |
15:22:16 | FromDiscord | <tandy> this is cool |
15:22:44 | FromDiscord | <Rika> what is that |
15:23:19 | FromDiscord | <tandy> a nice way for storing checkers board represenation |
15:23:22 | FromDiscord | <Illusive> sent a code paste, see https://play.nim-lang.org/#ix=3DhP |
15:23:38 | FromDiscord | <tandy> https://www.3dkingdoms.com/checkers/bitboards.htm |
15:23:53 | FromDiscord | <Rika> i guess its cool |
15:23:55 | FromDiscord | <tandy> i dont think u can do padded arrays in nim |
15:24:05 | FromDiscord | <tandy> so il try make this work for my checkers game |
15:24:38 | FromDiscord | <Rika> wdym? |
15:24:45 | FromDiscord | <Rika> you can align types in nim |
15:26:16 | FromDiscord | <tandy> huh how |
15:27:13 | FromDiscord | <tandy> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-align-pragma |
15:33:52 | FromDiscord | <hmmm> hoy doods is there a version of strutils find that is case insensitive |
15:34:00 | FromDiscord | <Rika> ? |
15:34:03 | FromDiscord | <Rika> example |
15:35:02 | FromDiscord | <hmmm> From the manual: "Searching is case-sensitive. If sub is not in s, -1 is returned. Otherwise the index returned is relative to s[0], not start. Use s[start..last].find for a start-origin index." |
15:37:16 | FromDiscord | <Rika> no |
15:37:26 | FromDiscord | <Rika> convert everything to lowercase then search is the easy way out |
15:38:36 | FromDiscord | <hmmm> wot |
15:38:57 | FromDiscord | <hmmm> is this the official way people do things when searching for case insensitive stuff? |
15:39:01 | FromDiscord | <Rika> no |
15:39:12 | FromDiscord | <Rika> i said its the easy way not the common way |
15:39:15 | FromDiscord | <haxscramper> there is no "official way people do things when searching for case insensitive stuff" |
15:39:19 | FromDiscord | <hmmm> what is the common way :3 |
15:39:24 | FromDiscord | <Rika> i dont know |
15:39:52 | FromDiscord | <hmmm> Rika sometimes I love you but sometimes I love you a bit less |
15:40:01 | FromDiscord | <Rika> thanks, i dont care |
15:40:04 | FromDiscord | <haxscramper> `let start = sentence.toLowerAscii().find("word".toLowerAscii()); sentence[start .. <something>]` |
15:40:16 | FromDiscord | <haxscramper> done |
15:40:38 | FromDiscord | <hmmm> hmm |
15:40:40 | FromDiscord | <haxscramper> well, I haven't compiled it, but anyway there is no "official" way for writing 1-2 lines of code |
15:40:44 | FromDiscord | <Rika> (if you still need a disclaimer, i am joking) |
15:40:46 | FromDiscord | <hmmm> ok I'll try lowering the cases |
15:44:38 | nixfreak_nim[m] | Ok I figured it out , you can't use single quotes , you have to use double quotes for echo " " |
15:45:10 | nixfreak_nim[m] | but still doesn't make sense why it worked on playground and not emacs and nvim |
15:45:50 | FromDiscord | <haxscramper> how it worked on playground? |
15:45:58 | FromDiscord | <haxscramper> `echo ' '` is valid though |
15:45:58 | FromDiscord | <enthus1ast> Maybe a different nim version? β΅echo a char should work afaik |
15:46:17 | nixfreak_nim[m] | I used both versions 1.4.8 and 1.6.0 |
15:46:44 | FromDiscord | <Rika> can you send the playground link or have you sent it before |
15:46:47 | FromDiscord | <enthus1ast> What you mean not emacs and nim? |
15:46:58 | FromDiscord | <enthus1ast> Nvim |
15:47:06 | nixfreak_nim[m] | neovim and Emacs |
15:47:11 | nixfreak_nim[m] | I used both IDE |
15:47:43 | nixfreak_nim[m] | * both IDE's to and used emcas plugin to compile |
15:48:45 | FromDiscord | <enthus1ast> Yes, so it does not compile when you write this code in emacs or nvim? |
15:49:10 | nixfreak_nim[m] | it errors out yes , unless I change the single quotes or double |
15:49:15 | nixfreak_nim[m] | s/or/to/ |
15:49:31 | nixfreak_nim[m] | brb need to update element |
15:49:44 | FromDiscord | <Rika> is whats inside the quotes one character or more |
15:49:51 | FromDiscord | <haxscramper> what is the error |
15:49:59 | FromDiscord | <Rika> the whole error |
15:55:17 | FromDiscord | <hmmm> yea rika it works, also the python dudes do the same |
15:55:25 | FromDiscord | <hmmm> so we can say now it's the official way |
15:56:29 | FromDiscord | <enthus1ast> No this will be totally unperformant |
15:56:38 | FromDiscord | <enthus1ast> For larger datasets |
15:56:48 | FromDiscord | <hmmm> they have the prettier lower instead of the toLowerAscii monstrosity tho |
15:57:00 | FromDiscord | <haxscramper> you need to do what exactly? Find word in a sentence in case-insensetive way? |
15:57:24 | nixfreak_nim[m] | Since deleting the whole line I can't recreate it, sorry. There must of been something there I couldn't see |
15:57:25 | FromDiscord | <hmmm> I have a dataset and I want to search a column for substrings |
15:57:56 | FromDiscord | <enthus1ast> And how bis is the dataset? |
15:58:08 | FromDiscord | <hmmm> absolutely tiny lol |
15:58:12 | FromDiscord | <haxscramper> I wanted to suggest just copying `find` from stdlib and then replacing `str[idx] == word[idx2]` with case-insensetive compare |
15:58:16 | FromDiscord | <enthus1ast> Big |
15:58:19 | FromDiscord | <haxscramper> but then I looked into implementaiton of find |
15:58:42 | FromDiscord | <haxscramper> and holy shit I do not recommend to even look at it |
15:58:55 | FromDiscord | <enthus1ast> Then it's fine I guess πβ΅(@hmmm) |
15:58:56 | FromDiscord | <haxscramper> what in the world is `hasCStringBuiltin` even |
15:59:55 | FromDiscord | <hmmm> I trust our find is on par with python find or I will personally call the manager and they will hear me |
16:01:41 | FromDiscord | <haxscramper> https://forum.nim-lang.org/t/447 |
16:01:53 | FromDiscord | <haxscramper> https://forum.nim-lang.org/t/1730 |
16:09:44 | FromDiscord | <Rika> In reply to @hmmm "they have the prettier": theres a reason its named like that |
16:12:59 | FromDiscord | <hmmm> the reason would be they like aesthetics and we like monsters and vampires? |
16:17:28 | FromDiscord | <Rika> no, its more explicit that it doesnt handle unicode (obviously) and that it is not inplace |
16:33:42 | * | mahlon quit (Read error: Connection reset by peer) |
16:34:24 | * | mahlon joined #nim |
16:39:20 | * | [R] quit (Quit: No Ping reply in 180 seconds.) |
16:39:27 | * | [R] joined #nim |
16:48:59 | FromDiscord | <Bung> hi I'v written a mysql driver in nim , there's problem when handle concurrent requests , the driver need increase squence number one send and receive round , when two pendding requests it becoming a problem , any suggestion ? |
17:07:50 | FromDiscord | <saviorcyberteam> Everybody Can Obtain The New Trillion Dollar Crypto Coin Whitepapers To Become A Millionaire Easilyβ΅https://saviorsfromcyber.com/economy/2021/everybody-can-obtain-the-new-trillion-dollar-crypto-coin-whitepapers-to-become-millionaire-easily/ |
17:08:17 | FromDiscord | <Rika> lol |
17:08:29 | FromDiscord | <Rika> <@&371760044473319454> do you think you can do anything about this? i dont know |
17:08:46 | FromDiscord | <dom96> lol, gotta love these bridges |
17:08:55 | FromDiscord | <Rika> triple the spam |
17:08:59 | FromDiscord | <dom96> !ban saviorcyberteam |
17:09:19 | FromDiscord | <dom96> !matrix |
17:09:21 | FromDiscord | <matrix-appservice-discord-t2bot> sent a long message, see http://ix.io/3qay |
17:09:29 | FromDiscord | <dom96> !matrix ban saviorcyberteam |
17:09:39 | FromDiscord | <matrix-appservice-discord-t2bot> sent a long message, see http://ix.io/3Din |
17:09:43 | FromDiscord | <Rika> bruh |
17:09:58 | FromDiscord | <dom96> well, it gave an error, so... I dunno if it worked |
17:13:19 | * | Ekho quit (*.net *.split) |
17:15:30 | * | Ekho- joined #nim |
17:23:41 | * | Ekho- is now known as Ekho |
17:59:24 | * | PMunch joined #nim |
18:03:17 | FromDiscord | <leorize> it didn'tβ΅(@dom96) |
18:03:47 | FromDiscord | <dom96> yeah, I still need to give the bridge mod perms I guess |
18:04:48 | FromDiscord | <dom96> but I still get this error... https://media.discordapp.net/attachments/371759389889003532/903705942200303756/unknown.png |
18:17:08 | FromDiscord | <leorize> it means that A and B was the same type, I'll look into it in a bit |
18:17:35 | FromDiscord | <leorize> the error was intended to catch early bugs but it might be causing problem |
18:48:27 | * | anjovi joined #nim |
18:50:11 | anjovi | anyone played with httpclient.AsyncHTTPClient recently? how do I access the response body that came after 30x? body() always gives me the body that from before the redirect |
18:50:49 | FromDiscord | <Rika> set redirects to 0 and read the body |
18:50:56 | FromDiscord | <Rika> `newHttpClient(maxRedirects = 0)` |
18:51:46 | anjovi | and then what? req the Location myself? |
18:52:07 | FromDiscord | <Rika> oh |
18:52:08 | FromDiscord | <Rika> misread |
18:52:10 | FromDiscord | <Rika> or misunderstood |
18:52:14 | anjovi | ah |
18:52:21 | FromDiscord | <Rika> how many redirects does it do |
18:52:33 | anjovi | one |
18:52:48 | anjovi | well, I'm assuming. wait, I'll check for sure quick |
18:53:12 | FromDiscord | <Rika> i think i know whats wrong |
18:53:37 | FromDiscord | <Rika> do `await response.bodyStream.readAll` instead i guess |
18:53:44 | anjovi | ok, yes, a single redirect. http://blah.tld gets 301 to https://blah.tld |
18:53:52 | anjovi | I'll try that |
18:54:01 | FromDiscord | <Rika> needs `import streams` afaik |
18:54:02 | FromDiscord | <Rika> sorry |
19:01:43 | * | vicfred joined #nim |
19:04:48 | anjovi | (taking awhile (FutureStream giving me all sorts of trouble)) |
19:14:19 | anjovi | Rika: how sure are you about that? streams.readAll() wont accept FutureStream[string], which AsyncResponse.bodyStream is |
19:14:42 | FromDiscord | <Rika> bodyStream is not a string |
19:14:45 | FromDiscord | <Rika> its in the name |
19:18:51 | anjovi | I meant it wont compile because readAll() expects Stream and bodyStream isn't (of Stream type) |
19:22:56 | NimEventer | New thread by Wwderw: Linking on Linux and Windows, see https://forum.nim-lang.org/t/8564 |
19:25:38 | FromDiscord | <Rika> ah |
19:25:46 | FromDiscord | <Rika> anjovi: asyncstreams not streams mb i didnt realise |
19:30:01 | anjovi | Rika np |
20:11:06 | FromDiscord | <dom96> wow, https://github.com/dom96/httpbeast/pull/63 |
20:11:50 | FromDiscord | <dom96> Just benchmarked it. It sends httpbeast from 870k QPS to 1.2 million QPS! |
20:13:03 | FromDiscord | <Recruit_main707> with just that? |
20:13:05 | FromDiscord | <Recruit_main707> damn |
20:13:38 | FromDiscord | <dom96> yeah, crazy |
20:14:17 | FromDiscord | <dom96> but not altogether unexpected, I haven't done any profiling of it so not surprising there are low hanging fruit here |
20:18:18 | FromDiscord | <Elegantbeef> The nice part is seeing my porting effort of hottie getting use π |
20:19:55 | FromDiscord | <Rika> now does &"" look better + work just as fast i do wonder |
20:19:57 | FromDiscord | <Imperatorn> Ppl sat I should write Rust instead. Please convince me why Nim is better |
20:20:08 | FromDiscord | <Imperatorn> (edit) "sat" => "say" |
20:20:32 | FromDiscord | <Rika> did they convince you why rust is better? |
20:20:36 | FromDiscord | <Rika> if not why should we |
20:21:03 | FromDiscord | <Imperatorn> Hmm, because they might be lying |
20:21:14 | FromDiscord | <Imperatorn> Rust is "hyped" |
20:21:23 | FromDiscord | <Imperatorn> They might be high and blinded |
20:22:09 | FromDiscord | <Imperatorn> Seems like ppl say "use Rust" whatever you say.β΅β΅"Need to fix your marriage? Use Rust" |
20:22:41 | FromDiscord | <Elegantbeef> There is the misconception Rust makes it impossible to write bugs |
20:22:52 | FromDiscord | <Elegantbeef> It makes it harder but it's still possible |
20:23:00 | FromDiscord | <Imperatorn> Yeah |
20:23:11 | FromDiscord | <Imperatorn> Like I took a look at the cves lol |
20:23:42 | FromDiscord | <Rika> it makes it harder to write anything |
20:23:43 | FromDiscord | <Imperatorn> https://www.cvedetails.com/vulnerability-list.php?vendor_id=19029&product_id=48677&version_id=0&page=1&hasexp=0&opdos=0&opec=0&opov=0&opcsrf=0&opgpriv=0&opsqli=0&opxss=0&opdirt=0&opmemc=0&ophttprs=0&opbyp=0&opfileinc=0&opginf=0&cvssscoremin=0&cvssscoremax=0&year=0&month=0&cweid=0&order=1&trc=19&sha=95e4d3703da65f4f319b5bfa6167ff26c6a83c13 |
20:23:51 | FromDiscord | <Elegantbeef> Personally i prefer the terseness of the language over Rust, it's easier to read and understand |
20:24:50 | FromDiscord | <Imperatorn> Yes |
20:25:01 | FromDiscord | <Rika> how did they convince you to use rust |
20:25:10 | FromDiscord | <Imperatorn> They did not |
20:25:31 | FromDiscord | <Rika> then why did you as |
20:25:33 | FromDiscord | <Rika> (edit) "as" => "ask" |
20:26:33 | FromDiscord | <Imperatorn> I'm just saying they want me to write Rust instead. I'm on the fence. Half-sensible ppl. But the syntax is pain |
20:26:56 | FromDiscord | <Imperatorn> Nim seems to me like a productive language |
20:27:02 | FromDiscord | <Rika> well why are you sold on rust |
20:27:50 | FromDiscord | <Rika> and why are you not sold on nim |
20:28:03 | FromDiscord | <Imperatorn> I'm not really. It's just a general question. Why would an unspecified individual choose Nim over Rust in general |
20:28:28 | FromDiscord | <Imperatorn> I'm not sold on Rust |
20:28:48 | FromDiscord | <Rika> there are many reasons which depend on the individual |
20:29:23 | FromDiscord | <Imperatorn> Ok, let's take it like this |
20:29:30 | FromDiscord | <Imperatorn> Memory management |
20:29:37 | FromDiscord | <Rika> i guess the general consensus is if you value your time, use nim, if its absolutely imperative to have no bugs, use rust |
20:30:07 | FromDiscord | <Imperatorn> That's a good decision model |
20:30:22 | * | PMunch quit (Quit: leaving) |
20:30:24 | FromDiscord | <Rika> that isnt to say that nim can get really close to rust wrt bugs but its not there yet |
20:30:25 | FromDiscord | <Elegantbeef> Nim is memory safe, though has nil, which requires either `wrapnils` `option` or memory that things are nilable π |
20:30:29 | FromDiscord | <Rika> (edit) "can" => "cant" |
20:30:45 | FromDiscord | <Imperatorn> In general I value time over safety |
20:30:54 | FromDiscord | <Elegantbeef> Yea i mean we have subrange types which allow you to catch other bugs |
20:30:57 | FromDiscord | <Imperatorn> I'm used to null so no biggie |
20:31:11 | FromDiscord | <Imperatorn> What safety features does Nim have? |
20:31:27 | FromDiscord | <Imperatorn> Like for example in D there's the @safe attribute |
20:31:32 | FromDiscord | <Rika> im still waiting on defaults+init fixes |
20:31:40 | FromDiscord | <Rika> In reply to @Imperatorn "Like for example in": which does what |
20:32:48 | FromDiscord | <Imperatorn> sent a long message, see http://ix.io/3DiY |
20:33:04 | FromDiscord | <Rika> let me see |
20:33:45 | FromDiscord | <Rika> nim unsafe features are basically just `cast` and `addr`/`unsafeAddr` (both are unsafe even if one doesnt say it is) |
20:33:56 | FromDiscord | <Rika> i guess also `ptr`/`pointer` of course |
20:34:30 | FromDiscord | <Rika> so no matter what, you can consider any usage of cast and others as unsafe |
20:34:41 | FromDiscord | <Rika> so its really simple to disallow it |
20:34:56 | FromDiscord | <Imperatorn> gshared means traditional global basically |
20:35:13 | FromDiscord | <Elegantbeef> Yea that keyword really just seems to be "our semantics are difficult to follow, so we need a keyword" |
20:35:17 | FromDiscord | <Rika> globals arent considered "unsafe" but they are considered "gc unsafe" |
20:35:33 | FromDiscord | <Rika> what is a void initialiser |
20:35:34 | FromDiscord | <Imperatorn> The weird name is because you shouldn't use it basically π
|
20:35:38 | FromDiscord | <Rika> oh yeah |
20:35:55 | FromDiscord | <Imperatorn> void init is uninitialized memory |
20:35:57 | FromDiscord | <Rika> okay six unsafe stuff, the ones listed above PLUS `emit` i guess |
20:36:10 | FromDiscord | <Imperatorn> By default all variables in D has default values |
20:36:25 | FromDiscord | <Rika> same with nim, but currently it is just zeroed memory] |
20:36:34 | FromDiscord | <Rika> waiting on the RFCs for default |
20:36:40 | FromDiscord | <Imperatorn> π |
20:36:56 | FromDiscord | <Rika> `When indexing or slicing an array, an out of bounds access will cause a runtime error.` is default on -d:release |
20:37:21 | FromDiscord | <Rika> `No inline assembler` can be grepped with `asm` |
20:37:36 | FromDiscord | <Rika> `No catching of exceptions that are not derived from class Exception.` completely impossible in nim afaik? |
20:37:43 | FromDiscord | <Imperatorn> So, Nim is a bit "safe" by default? |
20:37:46 | FromDiscord | <Rika> `Calling any System Functions.` what does this even mean? |
20:38:06 | FromDiscord | <Elegantbeef> Yea rika i dont think s |
20:38:08 | FromDiscord | <Rika> `No pointer arithmetic (including pointer indexing).` impossible by default in nim without importing a (third party afaik) module |
20:38:37 | FromDiscord | <Rika> unions are still unsafe in nim so eh |
20:38:49 | FromDiscord | <Rika> i guess theres a lot to grep to check for unsafe features in nim |
20:38:52 | FromDiscord | <Elegantbeef> Well unions are inherently unsafe |
20:38:57 | FromDiscord | <Rika> but its not "we need a new keyword" level |
20:39:00 | FromDiscord | <Elegantbeef> So dont use unions, use tagged unions |
20:39:22 | FromDiscord | <Imperatorn> Sorry, safe is an attribute as well |
20:39:34 | FromDiscord | <Imperatorn> sent a long message, see http://ix.io/3DiZ |
20:40:39 | FromDiscord | <Imperatorn> (edit) "safe" => "system" |
20:41:53 | FromDiscord | <Rika> i still have no idea what those are |
20:41:59 | FromDiscord | <Rika> is that like |
20:42:09 | FromDiscord | <Rika> poor mans effect tracking |
20:42:30 | FromDiscord | <Elegantbeef> It seems like it, poormans strict effects/funcs |
20:42:34 | FromDiscord | <Imperatorn> https://dlang.org/spec/function.html#system-functions |
20:42:37 | FromDiscord | <Rika> nim has effect tracking so you can check if it raises |
20:42:45 | FromDiscord | <Rika> or if it uses stdout/in/err |
20:42:59 | FromDiscord | <Rika> (well not precisely, that was just an example) |
20:44:07 | FromDiscord | <Rika> i guess there should be an effect for unsafe stuff like `cast` `asm` `emit` etc |
20:44:13 | FromDiscord | <Rika> might be nice |
20:44:17 | FromDiscord | <Rika> or useful too |
20:44:25 | FromDiscord | <Rika> i have to go, its like 6 am right now |
20:44:29 | FromDiscord | <Imperatorn> PR coming π |
20:44:33 | FromDiscord | <Imperatorn> Oh damn |
20:44:34 | FromDiscord | <Imperatorn> Sleep |
20:44:49 | FromDiscord | <Imperatorn> Thanks for your time! |
20:45:45 | FromDiscord | <Rika> beef go take over |
20:46:08 | FromDiscord | <Elegantbeef> Uhh Rust bad, use Nim |
20:46:12 | FromDiscord | <Elegantbeef> Did i do it right? |
20:46:47 | FromDiscord | <Recruit_main707> nailed it |
20:47:38 | FromDiscord | <Imperatorn> Just a quick anecdote.β΅β΅Some time ago I tried like 50 languages. Wanted to do a simple rest-client thing. Json. It was the only language of those about 40-50 that just worked tm. And I actually understood what I was doing. And was fast |
20:48:28 | FromDiscord | <Imperatorn> So my and Nim already have a past. But I need to go from friends with benefits to something more |
20:50:30 | FromDiscord | <Imperatorn> I don't know where I should start. Is there a "Nim tour" or something?β΅β΅I want to skip the most basic stuff, but not jump right into thousand-dimensional self-modifying metamorphic self healing code |
20:51:28 | mst | I read through the language spec (because I like doing that) and my next step is probably going to be reading the source code to nitter since I probably understand the domain decently |
20:53:52 | FromDiscord | <Rika> Reading source code is okay until you read the fucked ones |
20:54:00 | FromDiscord | <Rika> Not gonna name any names |
20:54:06 | FromDiscord | <Imperatorn> Lol, yeah |
20:54:24 | FromDiscord | <Imperatorn> I want to learn right from the beginning |
20:54:26 | FromDiscord | <Rika> Not just because rude but also because I donβt know who the fuck I would name either |
20:54:32 | FromDiscord | <Rika> Thereβs a book |
20:54:36 | FromDiscord | <Rika> Itβs on manning |
20:54:38 | FromDiscord | <Rika> I think |
20:54:56 | FromDiscord | <Imperatorn> I'll take a look, thanks |
20:55:12 | mst | Rika, I do a lot of reading source code to learn stuff and I can absolutely confirm that sometimes what I learn from a given thing's source code is a whole list of things to never inflict on other developers ever :D |
20:55:42 | FromDiscord | <Imperatorn> Let's put it like this |
20:56:16 | FromDiscord | <Imperatorn> Can you point me to some well written medium-sized Nim project(s)? |
20:56:52 | FromDiscord | <Rika> Anything with a few tens of stars should do |
20:57:41 | nrds | <Prestige99> not sure if it would help but have you seen nep1? |
21:10:11 | * | stkrdknmibalz joined #nim |
21:18:17 | FromDiscord | <exelotl> In reply to @Imperatorn "I don't know where": personally I like Nim By Example the most: https://nim-by-example.github.io/getting_started/ |
21:23:15 | FromDiscord | <exelotl> on the flipside, I absolutely hate Learn Nim in Y Minutes xD |
21:23:48 | FromDiscord | <Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3Djj |
21:25:20 | FromDiscord | <Elegantbeef> No it cannot tried solving that for prestige and just ended up making a proc that unpacks it to the type |
21:25:33 | FromDiscord | <Elegantbeef> Cant even cast it to work afaik |
21:26:35 | FromDiscord | <Recruit_main707> that sucks :(β΅β΅i guess methods would do for most cases, but i am passing the function pointers to c++ and i dont even want to get into that hole |
21:27:14 | FromDiscord | <Elegantbeef> So the best thing to do is just make a template to make a lambda that unpacks it |
21:27:55 | FromDiscord | <Recruit_main707> im sorry but im gonna need an example to understand that π
|
21:31:35 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Djm |
21:31:43 | FromDiscord | <exelotl> it seems I never run into this issue with my vtable system because I {.exportc.} the procs and {.emit.} the tables containing the procs, and C just allows it. |
21:31:48 | FromDiscord | <Elegantbeef> Prestige you might want to look at that aswell, might be a cleaner solution to your problem |
21:32:42 | FromDiscord | <Recruit_main707> does that work when you are doing it in different files? |
21:33:00 | FromDiscord | <Elegantbeef> I dont see why it wouldnt |
21:33:07 | FromDiscord | <Elegantbeef> templates are pasted at their callsite |
21:33:21 | FromDiscord | <Recruit_main707> i meant exelotl's solution |
21:33:42 | FromDiscord | <Elegantbeef> Remember C/C++ is just making one long file |
21:34:20 | FromDiscord | <exelotl> oh, mine is a pain to make work across files, but I got there eventually |
21:34:31 | FromDiscord | <Recruit_main707> the problem with what i did before was that certain types were defined in one file, and then even though i import them on the nim side, the c++ side doesnt (or something like that i am going crazy of staring at the generated code) |
21:34:37 | FromDiscord | <exelotl> https://forum.nim-lang.org/t/7827 |
21:35:24 | FromDiscord | <Elegantbeef> You can still use the macro cache to get around it i think exelotl π |
21:36:46 | FromDiscord | <exelotl> I don't think macrocache can solve this, right? https://media.discordapp.net/attachments/371759389889003532/903759289208934410/unknown.png |
21:37:22 | FromDiscord | <Elegantbeef> Well you add the symbols to the table and access them from other modules, so as long as they're added first it doesnt matter since the symbols are looked up |
21:37:36 | nrds | <Prestige99> I missed it, what beef? |
21:37:47 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Djm this solution |
21:37:57 | FromDiscord | <Elegantbeef> I might misunderstand the issue and like using macro cache for all my solutions π |
21:40:45 | nrds | <Prestige99> ah yes, interesting |
21:40:49 | nrds | <Prestige99> that looks like it'll work |
21:41:00 | FromDiscord | <Elegantbeef> Less macro heavy and more auditable |
21:42:01 | nrds | <Prestige99> Thanks for keeping an eye out, this looks nice |
21:43:49 | FromDiscord | <Elegantbeef> Yea it's better than what i had π |
21:44:33 | FromDiscord | <Recruit_main707> thanks for the help btw beef, looking into it rn |
22:01:05 | FromDiscord | <leorize> [haxscramper](https://matrix.to/#/@haxscramper:matrix.org)\: I found the issue with union, `A` and `B` have `sameType()` evaluated to true |
22:02:01 | FromDiscord | <leorize> so I'm just gonna add a hack by evaluating deduplication of generic params by comparing symbols |
22:02:21 | FromDiscord | <leorize> just another day with Nim's typed macros |
22:09:05 | FromDiscord | <Elegantbeef> Yea macrocache does not help that issue exelotl π |
22:16:10 | FromDiscord | <Recruit_main707> xd made the compiler segfault |
22:18:33 | FromDiscord | <Recruit_main707> oh, made it compile, now pray it works |
22:20:48 | FromDiscord | <Recruit_main707> nvm im so dumb lol |
22:32:57 | * | Vladar quit (Quit: Leaving) |
23:31:27 | * | stkrdknmibalz quit (Ping timeout: 260 seconds) |
23:32:35 | FromDiscord | <no name fits> In reply to @Rika "Reading source code is": I felt a disturbance |
23:32:57 | FromDiscord | <no name fits> My excuse right now is, it's for a gamejam |