00:01:49 | FromDiscord | <theangryepicbanana> ... |
00:20:43 | * | Jjp137 quit (Quit: Leaving) |
00:23:10 | * | Jjp137 joined #nim |
01:12:08 | FromDiscord | <gogolxdong (liuxiaodong)> Is there any threadPool implementation in Nim? |
01:14:13 | FromDiscord | <ElegantBeef> There is `threadPool` in the stdlib, though there may be other implementations |
01:16:24 | FromDiscord | <gogolxdong (liuxiaodong)> Does spawn or parallel work well? |
01:17:03 | FromDiscord | <gogolxdong (liuxiaodong)> What about CPS? |
01:20:42 | FromDiscord | <gogolxdong (liuxiaodong)> Any other recommanded implementations? |
01:21:59 | FromDiscord | <konsumlamm> In reply to @gogolxdong (liuxiaodong) "Does spawn or parallel": not really afaik |
01:22:19 | FromDiscord | <konsumlamm> In reply to @gogolxdong (liuxiaodong) "What about CPS?": CPS is still experimental/WIP |
01:23:22 | FromDiscord | <konsumlamm> In reply to @gogolxdong (liuxiaodong) "Any other recommanded implementations?": there's weave, but that's quite low level (so not super useful unless you're making a high level wrapper for it), other thab that idk of any |
01:23:50 | FromDiscord | <konsumlamm> i heard there are plans to eventually rewrite the stdlib threadpool |
01:25:23 | FromDiscord | <leorize> cps is working, but it's not a threadpool, it's merely a backbone that you can build a pool on |
01:25:57 | FromDiscord | <konsumlamm> ah, is it finished now? |
01:26:28 | FromDiscord | <leorize> yea, you can check out the collection of examples in cps repo |
01:26:32 | FromDiscord | <konsumlamm> and yeah, it's by no means a threadpool implementation (it isn't even inherently concurrent or anything) |
01:26:44 | FromDiscord | <leorize> currently we are focused in actually using cps to see what can be improved |
01:26:50 | FromDiscord | <konsumlamm> nice |
01:29:13 | FromDiscord | <leorize> if you're interested in playing with cps, zevv is making a tutorial\: https://github.com/zevv/cpstut |
01:29:15 | fn | <R2D299> itHub: 7"<No Description>" |
01:30:54 | FromDiscord | <konsumlamm> will take a look |
01:38:44 | FromDiscord | <gogolxdong (liuxiaodong)> Why didn't we heard any news about CPS? |
01:41:32 | FromDiscord | <ElegantBeef> Cause you havent been looking closely |
01:42:04 | FromDiscord | <ElegantBeef> It was in last month's this month with nim 😄 |
01:47:52 | FromDiscord | <gogolxdong (liuxiaodong)> Anyone played Chia? |
01:56:37 | FromDiscord | <gogolxdong (liuxiaodong)> What's the essential of Continuations ? |
01:59:02 | FromDiscord | <leorize> I think this describes it best\: https://github.com/disruptek/cps/tree/master/docs |
02:28:55 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Can you change the default values of an initialized types? |
02:29:19 | FromDiscord | <@bracketmaster-5a708063d73408ce4> an object with integer members for example defaults the integers to 0 |
02:29:30 | FromDiscord | <ElegantBeef> You cannot override defaults |
02:30:08 | FromDiscord | <ElegantBeef> https://github.com/beef331/constructor#defaults you can checkout that for a macro solution for a default constructor |
02:30:10 | fn | <R2D299> itHub: 7"Nim macros to aid in object construction including event programming, and constructors." |
02:31:51 | FromDiscord | <@bracketmaster-5a708063d73408ce4> of course there a macro solution 😛 |
02:32:01 | FromDiscord | <Elegantbeef> Well there always are macros |
02:39:47 | FromDiscord | <Elegantbeef> @Bung\: so i do now support ref objects and sequences, so there is a chance that atleast Nimscript -\> Nim for jsonnodes will work 😀 |
02:40:16 | * | Figworm quit (Quit: Figworm) |
02:46:24 | FromDiscord | <Bung> why is one way direction |
02:54:17 | FromDiscord | <Bung> hmm , like before use compiler package directly will face compatible problem `Error: undeclared identifier: 'nativeStackTraceSupported'` |
02:55:55 | FromDiscord | <Elegantbeef> Cause i havent got the other way done yet |
02:56:02 | FromDiscord | <Elegantbeef> And yea make sure you're using 1.5.1 |
02:57:17 | FromDiscord | <Elegantbeef> I had the same issue but adding compiler as a dep fixed it |
02:57:19 | FromDiscord | <Bung> in this situation the version number does not enough |
02:57:26 | FromDiscord | <Elegantbeef> Yea i know |
03:06:18 | FromDiscord | <Elegantbeef> what's "like before use compiler package directly " about though, not like this can work any other way that i know of \:D |
03:07:58 | FromDiscord | <ajusa> In reply to @ajusa "Is there a zero": Do I need view types for this? |
03:10:27 | * | arkurious quit (Quit: Leaving) |
03:10:46 | FromDiscord | <Elegantbeef> Well you might be able to use https://nim-lang.org/docs/system.html#toOpenArray%2Ccstring%2Cint%2Cint but it doesnt return a string |
03:13:58 | FromDiscord | <Bung> `Error: expression 'multiplyBy10(a)' is of type 'int' and has to be used ` |
03:14:08 | FromDiscord | <Elegantbeef> Yea tests dont work yet |
03:14:26 | FromDiscord | <Elegantbeef> `example.nim` is the only thing that presently works |
03:15:38 | FromDiscord | <Elegantbeef> That whole not handling return types is in effect there |
03:30:12 | FromDiscord | <Bung> how to construct argBuffer when call invoke @ElegantBeef |
03:30:21 | FromDiscord | <Elegantbeef> You cannot presently \:D |
03:30:41 | FromDiscord | <Elegantbeef> Like i said only Nimscript -\> Nim is done |
03:31:42 | FromDiscord | <Bung> okay, I'll wait for nim -> nims then |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:36 | * | supakeen joined #nim |
04:36:25 | FromDiscord | <gogolxdong (liuxiaodong)> Is it possible to build thread pool based on CPS? |
04:38:02 | FromDiscord | <gogolxdong (liuxiaodong)> I found one in the example. |
04:46:34 | FromDiscord | <gogolxdong (liuxiaodong)> What is jield? |
04:48:26 | FromDiscord | <Rika> A weirder way to say yield I assume |
04:50:42 | FromDiscord | <ElegantBeef> well yield is a keyword so they used jield as their "keyword" |
05:11:54 | * | rockcavera quit (Remote host closed the connection) |
05:30:08 | fn | <ForumUpdaterBot99> New Nimble package! morepretty - Morepretty - Does more than nimpretty., see https://github.com/treeform/morepretty |
05:30:09 | fn | <R2D299> itHub: 7"Morepretty - like nimpretty but with more stuff." |
06:06:53 | FromDiscord | <gogolxdong (liuxiaodong)> Is there radix sort in stdlib? |
06:48:30 | * | max22- joined #nim |
07:40:01 | FromDiscord | <Tux> wanting to try to learn this language, does anyone know of an ncurses library? im gonna port some old code to nim if possible |
07:40:11 | FromDiscord | <Tux> @ElegantBeef hi |
07:41:55 | FromDiscord | <InventorMatt> https://github.com/johnnovak/illwill |
07:41:57 | fn | <R2D299> itHub: 7"<No Description>" |
07:42:06 | FromDiscord | <Tux> pog, this will work fine |
07:42:14 | FromDiscord | <Tux> thank ^w^ |
07:42:32 | FromDiscord | <ElegantBeef> There are also ncurses bindings of course |
07:42:42 | FromDiscord | <Tux> In reply to @ElegantBeef "There are also ncurses": i see |
07:42:48 | FromDiscord | <Tux> nim looks like python but good |
07:42:54 | FromDiscord | <Tux> so hopefully it wont take too long to understand |
07:44:50 | FromDiscord | <Rika> It’s not similar in usage |
07:44:50 | FromDiscord | <Rika> So do not expect it to be like Python other than in look |
07:45:18 | FromDiscord | <Tux> i see |
07:45:23 | FromDiscord | <Tux> it doesnt have any complex stuff like borrowing from rust does it? |
07:45:55 | FromDiscord | <Tux> if its a normal, sane GC language i should not have too much trouble w/ it |
07:45:55 | FromDiscord | <Rika> It does but not in the same way rust implements it |
07:46:03 | FromDiscord | <Tux> oh god |
07:46:10 | FromDiscord | <Rika> It’s easier |
07:46:10 | FromDiscord | <Rika> And optional |
07:46:10 | FromDiscord | <ElegantBeef> Well it has move semantics but they're not in your face, and also there is a borrow checker as an opt in feature for view types |
07:46:11 | FromDiscord | <Tux> ah |
07:46:11 | FromDiscord | <Tux> ok |
07:47:18 | FromDiscord | <Tux> does it support global vars |
07:47:18 | FromDiscord | <Rika> Yes |
07:47:18 | FromDiscord | <Rika> Not in threaded code though |
07:47:18 | FromDiscord | <Rika> (You shouldn’t do it in threaded code anyway but yeah) |
07:47:21 | FromDiscord | <Tux> ok |
07:50:59 | FromDiscord | <Tux> is nimble fast / powerful |
07:51:03 | FromDiscord | <Tux> or nim |
07:51:05 | FromDiscord | <Tux> sorry |
07:52:01 | FromDiscord | <ElegantBeef> Yes |
07:52:23 | FromDiscord | <Tux> am i in the special club now |
07:52:25 | FromDiscord | <Tux> for using this |
07:52:30 | FromDiscord | <ElegantBeef> An obscure club |
07:52:41 | FromDiscord | <Tux> it looks cool tho |
07:52:50 | FromDiscord | <Tux> imma watch a. vid on it and read the online tutorial maybe |
07:52:58 | FromDiscord | <ElegantBeef> have fun |
07:53:02 | FromDiscord | <Tux> it looks actually usable unlike rust |
07:53:20 | FromDiscord | <Tux> also what's when |
07:53:27 | FromDiscord | <Tux> is it like a special if? |
07:54:02 | FromDiscord | <ElegantBeef> It's compile time if |
07:54:12 | FromDiscord | <ElegantBeef> So anything inside the body is changed based off the conditions |
07:54:57 | FromDiscord | <ElegantBeef> So for generics you can use it for types to change the body of a function, or you can import a specific module based of OS |
07:55:48 | FromDiscord | <Tux> o |
07:55:56 | FromDiscord | <Tux> that's sounds like static if in D |
07:56:09 | FromDiscord | <ElegantBeef> Yea probably is |
07:56:17 | FromDiscord | <Tux> nim looks like if python and d had a baby |
07:57:01 | FromDiscord | <ElegantBeef> They do have some overlap |
08:01:00 | * | fredrikhr joined #nim |
08:02:36 | FromDiscord | <Tux> can i send a shitty meme i made |
08:02:50 | FromDiscord | <Tux> https://media.discordapp.net/attachments/371759389889003532/865141336252743680/image0.png |
08:03:56 | FromDiscord | <Tux> anyway |
08:04:06 | FromDiscord | <Tux> i'm off to read the docs and stuff |
08:04:08 | FromDiscord | <Tux> and yeah |
08:11:57 | FromDiscord | <Rika> Isn’t Nim older than D |
08:12:35 | FromDiscord | <ElegantBeef> Nah D first released in 2001 |
08:12:37 | FromDiscord | <ynfle (ynfle)> Which `--cpu` option do I use for cross compilling for Linux on a x86\_64 Intel Xeon? |
08:13:05 | FromDiscord | <Rika> In reply to @ElegantBeef "Nah D first released": Funny how we’re more popular from what I recall then |
08:13:42 | FromDiscord | <Tux> sadly d isn't popular which sucks bc it's a nice language |
08:18:04 | FromDiscord | <ElegantBeef> isnt it just `--os:linux`? |
08:18:30 | FromDiscord | <ElegantBeef> `--cpu` is only important for targeting different archs |
08:21:17 | FromDiscord | <richard stallmen(crazy GNU guy)> @Tux helo tox |
08:26:35 | FromDiscord | <ynfle (ynfle)> Oh ok |
08:26:36 | FromDiscord | <ynfle (ynfle)> I'll try that |
08:32:20 | FromDiscord | <richard stallmen(crazy GNU guy)> the eraseScreen() is a bit wrong , like , it does print \n a lot , but doesnt reset the cursor to home |
08:32:30 | FromDiscord | <richard stallmen(crazy GNU guy)> or is it becuase i am in android? |
08:34:51 | FromDiscord | <ynfle (ynfle)> sent a code paste, see https://play.nim-lang.org/#ix=3t3H |
08:37:11 | FromDiscord | <richard stallmen(crazy GNU guy)> i had to use this proc:↵↵proc setCursorPos(f: File; x, y: int) {...} |
08:38:20 | FromDiscord | <Tux> In reply to @richard stallmen(crazy GNU guy) "<@800941608560230441> helo tox": hello rms |
08:51:27 | FromDiscord | <richard stallmen(crazy GNU guy)> hehe |
08:51:29 | * | neceve joined #nim |
09:32:29 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Tux "or nim": It uses a C backend so you have C speed |
10:02:36 | * | Vladar joined #nim |
10:03:33 | arkanoid | I'm refactoring a project and I'm trying to apply some proper effect tracking. Do you know if it is possible to detect which procs are undercover funcs (noSideEffect)? |
10:11:47 | FromDiscord | <haxscramper> https://nim-lang.org/docs/effecttraits.html#hasNoSideEffects%2CNimNode |
10:12:21 | FromDiscord | <haxscramper> Or some other procedures from this module (empty tag list) |
10:12:47 | FromDiscord | <Rika> oh man a new module to read about |
10:14:02 | arkanoid | will this work even even proc is declared as "proc" and "noSideEffect" pragma is present, but proc really has no side effects? |
10:14:45 | arkanoid | from the docs seems that it just detects if pragma is present or not ("Return true if the func/proc/etc fn has noSideEffect") |
10:17:28 | FromDiscord | <ynfle (ynfle)> The compiler automatically generates it |
10:17:29 | FromDiscord | <haxscramper> No, compiler does not automatically add `.noSideEffect.` |
10:17:29 | FromDiscord | <haxscramper> It was added in `1.4.0`↵(@Rika) |
10:17:51 | FromDiscord | <haxscramper> Instead procedure symbol has tag effects store in it's type/definition, and when other procedure calls it the effects are callucated based on |
10:18:09 | FromDiscord | <haxscramper> so you can have `proc test() = discard`, and use it in `func()` |
10:18:38 | FromDiscord | <haxscramper> But if you decide to add some side effect in `test()` then it will break func's compilation |
10:19:11 | FromDiscord | <haxscramper> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/865175321019023380): Instead, a procedure symbol has tag effects stored in its type/definition, and when other procedure calls it the effects are calculated based on |
10:20:00 | FromDiscord | <haxscramper> And some procedures like `echo` are not properly tracked by their side effects alone - they have additional `sideEffect` annotation |
10:20:11 | * | xet7 quit (Remote host closed the connection) |
10:20:19 | arkanoid | ok, so if I have a project with a tons of procs and I want to refactor them by splitting between total pure {.noSideEffect, raises: [].} procs and others (where I'd use tags) I have to to this manually |
10:20:26 | FromDiscord | <haxscramper> I'm still not sure whether it is a bug or I've missed something in the compiler, but using `echo` does not add `WriteIOEffect` |
10:21:00 | * | xet7 joined #nim |
10:21:11 | FromDiscord | <haxscramper> And annotate your procs with `.clean.` |
10:21:12 | FromDiscord | <haxscramper> More or less. You can create `{.pragma clean: noSideEffect, raises: [].}`↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
10:21:28 | FromDiscord | <haxscramper> I think you can even `{.push clean.}` so you don't have to manually go over to each procedure and annotate it |
10:21:50 | arkanoid | interesting |
10:21:52 | FromDiscord | <haxscramper> Or `{.push noSideEffect.}`, `{.push: raises: [].}` |
10:22:54 | FromDiscord | <ynfle (ynfle)> How come I can't import effecttraits but `defined(nimHasEffectTraitsModule)` is true |
10:23:07 | arkanoid | I'm not fond of .push as it doesn't go over all proc definitions in the block. In particular it doesn't cover the callback proc types |
10:24:00 | FromDiscord | <Rika> ynfle what issues are you getting |
10:24:42 | FromDiscord | <ynfle (ynfle)> importtest.nim(1, 16) Error\: cannot open file\: effecttraits |
10:25:25 | FromDiscord | <Rika> requires std/ prefix apparently but not shown on docs... |
10:28:33 | arkanoid | I think the pragma definition syntax you suggested is wrong, I'm getting "Error: invalid pragma: {.pragma, clean: noSideEffect, raises: [].}" (but the code really contains "{.pragma clean: noSideEffect, raises: [].}" without the comma after pragma) |
10:29:41 | FromDiscord | <haxscramper> Yes, I don't always remember correct syntax |
10:30:47 | FromDiscord | <Rika> no comma |
10:30:49 | FromDiscord | <Rika> you added a comma |
10:30:59 | FromDiscord | <Rika> pragma clean vs pragma, clean |
10:31:04 | FromDiscord | <Rika> oh |
10:31:08 | FromDiscord | <Rika> i didnt see the next part lmao |
10:31:16 | FromDiscord | <Rika> thats odd then |
10:31:44 | FromDiscord | <Rika> let me see |
10:32:23 | FromDiscord | <Rika> it's `pragma: clean, nosideeffect...` |
10:37:39 | FromDiscord | <ynfle (ynfle)> @haxscramper\:matrix.org @\_discord\_709044657232936960\_arkanoid=5b=49=52=43=5d\:t2bot.io this works↵\`\`\`nim |
10:38:06 | FromDiscord | <ynfle (ynfle)> The compiler does generate `noSideEffect` for procs |
10:38:17 | arkanoid | whoa! I get "Error: recursive dependency: clean" if I use "{.push clean.}" |
10:39:29 | FromDiscord | <ynfle (ynfle)> sent a long message, see http://ix.io/1L1p |
10:39:53 | FromDiscord | <ynfle (ynfle)> (Not sure if the edits came through)↵\`\`\`nim |
10:40:07 | FromDiscord | <ynfle (ynfle)> sent a code paste, see https://play.nim-lang.org/#ix=1MUs |
10:42:17 | arkanoid | play.nim-lang is not working to me |
10:42:47 | FromDiscord | <haxscramper> https://wandbox.org/ |
10:43:27 | arkanoid | this is cool! |
10:44:34 | arkanoid | https://wandbox.org/permlink/AfmBxA9oFtpGHByS |
10:45:16 | arkanoid | it really seems that the compiler is capable of tag noSideEffect automatically |
10:45:29 | FromDiscord | <ynfle (ynfle)> It does |
10:46:09 | arkanoid | I would greatly benefit from this if there's a way to apply that macro to a module full of procs |
10:47:49 | FromDiscord | <ynfle (ynfle)> You can use this to get you started |
10:47:50 | FromDiscord | <ynfle (ynfle)> https://rosettacode.org/wiki/Reflection/List_methods#Nim |
10:48:27 | FromDiscord | <ynfle (ynfle)> Also, ar4q had a script that did this |
10:48:56 | FromDiscord | <Rika> someone told me this, its fine to say araq as it is because he is on discord now |
10:49:20 | FromDiscord | <ynfle (ynfle)> \:thumbsup\: |
10:49:40 | FromDiscord | <ynfle (ynfle)> araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq, araq |
10:50:29 | arkanoid | ? was it a rule to don't disturb the great leader? |
10:52:40 | FromDiscord | <ynfle (ynfle)> https://github.com/nim-lang/Nim/pull/14728/files#diff-ffac2d093d390ecc2878eaf5a01b509dda270516f0c1853e8ac5a0229fcbcf46 @\_discord\_709044657232936960\_arkanoid=5b=49=52=43=5d\:t2bot.io see this not merged file |
10:53:26 | FromDiscord | <Rika> arkanoid informally |
10:53:45 | FromDiscord | <ynfle (ynfle)> It says that clybber came up with a better solution |
10:56:48 | * | neceve quit (Ping timeout: 268 seconds) |
11:00:12 | arkanoid | thanks |
11:02:21 | arkanoid | btw, here's the minimal exaple that shows the pragma recursive dependency problem: https://wandbox.org/permlink/tG1xHMgAcOE3AYZr |
11:03:30 | arkanoid | it works by pushing the two pragmas separately: https://wandbox.org/permlink/tv9TCkuUUgTjb3cV |
11:25:24 | * | beshr joined #nim |
11:25:24 | * | beshr quit (Changing host) |
11:25:24 | * | beshr joined #nim |
11:28:23 | * | aeverr quit (Ping timeout: 255 seconds) |
11:30:33 | * | beshr quit (Read error: Connection reset by peer) |
11:52:55 | * | max22- quit (Ping timeout: 268 seconds) |
12:03:17 | * | beshr joined #nim |
12:03:17 | * | beshr quit (Changing host) |
12:03:17 | * | beshr joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:23 | arkanoid | isn't gcsafe enforced just like noSideEffect? https://wandbox.org/permlink/9BD4kLUk32dwQWNu |
12:06:38 | * | supakeen joined #nim |
12:08:46 | FromDiscord | <ynfle (ynfle)> What's the issue? |
12:09:00 | FromDiscord | <ynfle (ynfle)> It's only not gcsafe if it would modify a global variable |
12:09:06 | FromDiscord | <ynfle (ynfle)> This is just passed by pointer |
12:09:08 | FromDiscord | <hugogranstrom> arkanoid: if you accessed foo directly in add4 it complains |
12:12:52 | arkanoid | you're right, but it's not a compile error, but a warning https://wandbox.org/permlink/2NqAqCBLSzp0xC4j |
12:13:26 | FromDiscord | <haxscramper> I think you can turn warnings to errors |
12:13:29 | arkanoid | I can enforce warnings as errors, I know, but I was expecting a compiler error just like noSideEffect |
12:13:57 | arkanoid | no problem anyway. What's important is that safety belts are working correctly |
12:17:42 | * | TakinOver quit (Ping timeout: 255 seconds) |
12:18:43 | * | neceve joined #nim |
12:38:46 | * | TakinOver joined #nim |
13:06:20 | * | arkurious joined #nim |
13:16:54 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
13:31:42 | arkanoid | if I concat strings and values manually with & like in "value(" & $self.value & ")" I successfully compile with {.noSideEffects, raises: [].}, if I use strformat and &".." operator it complains "can raise unlisted exception: ref ValueError" |
13:32:56 | FromDiscord | <haxscramper> See what strformat generates with `std/macros.expandMacro` |
13:33:12 | FromDiscord | <haxscramper> `expandMacro(< your macro code here >)` |
13:35:08 | arkanoid | got it, it is here: https://github.com/nim-lang/Nim/blob/44e653a9314e1b8503f0fa4a8a34c3380b26fff3/lib/pure/strformat.nim#L552 |
13:36:41 | FromDiscord | <haxscramper> In general stdlib does raise |
13:37:08 | FromDiscord | <haxscramper> oh, I know what you can use |
13:38:04 | FromDiscord | <haxscramper> https://wandbox.org/permlink/BcQ2tkpuJBawBmmK |
13:38:11 | * | rockcavera joined #nim |
13:38:11 | * | rockcavera quit (Changing host) |
13:38:11 | * | rockcavera joined #nim |
13:38:12 | FromDiscord | <haxscramper> I used this code to convert exception to result |
13:38:29 | FromDiscord | <haxscramper> wandbox does not have any packages installed, so it does not compile |
13:38:52 | FromDiscord | <haxscramper> But I create temporary procedure and use it in order to get full list of sice effects for a single block of code |
13:40:19 | arkanoid | this is ninja level |
13:40:30 | FromDiscord | <haxscramper> Something like `exceptionalCall(<some expression>) except Handle` |
13:41:13 | arkanoid | I'll implement the same in monad flavour |
13:41:16 | arkanoid | thanks |
13:41:20 | FromDiscord | <haxscramper> But if you are aiming to completely get rid of exceptions you would need something like that |
13:41:52 | FromDiscord | <haxscramper> By the way, do you have your experiments somewhere public/will publish later? |
13:43:21 | arkanoid | no, but is far far from advanced code. Is just some playground around a reimplementation of Option to achieve some common FP pattern (monad chain). It is already present in std/Option with flatMap |
13:45:25 | arkanoid | I just want to learn how to control side effects in nim by applying some FP. So basically I've just to add some monads to catch exceptions and tags I use for functions with sideEffects |
13:46:58 | arkanoid | the nice part (sci-fi from my actual knowledge) would be to use metaprogramming to pick the right monad according to proc tags. For example if a proc as tag "IO" it would be wrapped automatically in a Writer monad to perform the side effect safely in the monad world |
13:47:30 | FromDiscord | <haxscramper> It is possible |
13:47:51 | FromDiscord | <haxscramper> `std/effecttraits` is the go-to module for that |
13:48:08 | FromDiscord | <haxscramper> And you can define your own effects as well |
13:48:09 | arkanoid | it's the main driver that is taking me studying FP side-by-side nim experiments |
13:51:12 | arkanoid | I bet there's already a nim programmer out there that has already implemented this in a rainy afternoon, but let's surf the flow mood |
13:52:06 | arkanoid | btw, I'm trying to use "expandMacros:" block. It compiles but it doesn't print anything |
13:53:22 | arkanoid | I'm using like this: "expandMacros:\n echo some(5).flatMap(add1).flatMap(isEven).toString" where toString is func "if self.isSome: &"some({self.value})" else: &"none({$T})"" that should trigger expandMacros |
13:53:58 | arkanoid | I've tried moving the expandMacros inside the toString func but I get zero addictional output at compile time |
14:04:11 | FromDiscord | <dom96> PMunch: you around? playground is down |
14:05:30 | FromDiscord | <haxscramper> `import std/[macros, strformat]; expandMacros(echo &"{1 + 2}")` |
14:05:54 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/xeC |
14:06:38 | FromDiscord | <haxscramper> `formatValue` can be made into `static[string]` btw |
14:07:07 | FromDiscord | <haxscramper> At least in most sane use cases you don't need runtime format specifier |
14:07:24 | FromDiscord | <haxscramper> Or it can be an overload |
14:07:33 | FromDiscord | <haxscramper> Would check format specifier at compile-time, which is IMO better than runtime |
14:07:42 | FromDiscord | <haxscramper> And no `ValueError` exception |
14:15:22 | * | max22- joined #nim |
14:16:34 | * | aeverr joined #nim |
14:31:33 | FromDiscord | <theangryepicbanana> wait so does nobody know what the operator precedence is of the deref operator? |
14:32:40 | FromDiscord | <Rika> deref operator? []? |
14:32:54 | FromDiscord | <theangryepicbanana> yes |
14:33:51 | FromDiscord | <Rika> its not an operator perse |
14:34:11 | FromDiscord | <theangryepicbanana> wait, is it literally just an empty subscript? |
14:34:49 | FromDiscord | <Rika> i dont see how there can be a precedence to [] |
14:34:54 | FromDiscord | <theangryepicbanana> well like |
14:35:00 | FromDiscord | <theangryepicbanana> `@a[]` |
14:35:04 | FromDiscord | <theangryepicbanana> how is that grouped |
14:45:24 | FromDiscord | <theangryepicbanana> ? |
14:48:26 | * | fn quit (Remote host closed the connection) |
14:48:39 | * | fn joined #nim |
14:58:58 | arkanoid | haxscramper, could you please rephrase "`formatValue` can be made into `static[string]` btw" for me? |
14:59:50 | fn | <Prestige99> @theangryepicbanana in that case `@a[]` I think it would deref a, then try to convert to a sequence with @ |
15:00:34 | FromDiscord | <haxscramper> This procedure could've accepted `static[string]` as a format specifier, and performed parsing at compile time |
15:00:53 | FromDiscord | <theangryepicbanana> In reply to @fn "<Prestige> <@356108561232953344> in that": yeah but there's still no docs about it lol |
15:01:00 | FromDiscord | <haxscramper> This is not something you can change, I just said it could be fixed in the strformat |
15:01:33 | FromDiscord | <haxscramper> You can try to implement and overload for this one, probably and in that case strformat won't raise exception for invalid format values |
15:02:46 | fn | <Prestige99> I see some stuff in https://nim-lang.org/docs/manual.html#syntax-precedence about it |
15:04:35 | FromDiscord | <theangryepicbanana> yeah but it doesn't mention the subscript operator |
15:05:16 | fn | <Prestige99> subscript operator? |
15:05:25 | FromDiscord | <theangryepicbanana> [] |
15:07:01 | fn | <Prestige99> It's not super clear but I also see https://nim-lang.org/docs/manual.html#lexical-analysis-other-tokens |
15:07:11 | fn | <Prestige99> maybe a good place to improve the docs |
15:07:17 | FromDiscord | <Rika> yes |
15:08:02 | FromDiscord | <Rika> also actually huh, nim says there are no postfix operators but is [] not a postfix op? |
15:08:16 | FromDiscord | <@bracketmaster-5a708063d73408ce4> how many hours do you think araq has put into developing nim so far? |
15:08:37 | fn | <Prestige99> at least 5 |
15:08:53 | fn | <Prestige99> @Rika that's a good point |
15:09:00 | fn | <Prestige99> probably a special exception? |
15:09:06 | FromDiscord | <Rika> {} |
15:09:14 | FromDiscord | <Rika> is also a possible "operator" |
15:09:36 | fn | <Prestige99> 🤔 |
15:10:06 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I mean, `.` is also an operator... |
15:11:34 | FromDiscord | <Rika> that's a binary operator |
15:12:08 | FromDiscord | <no name fits> I'm not sure if this is the right place to ask, but is there a way to practice getting better at prototyping and doing it faster? I think my main problem is scoping and my definition of done, but I have no idea how to fix it |
15:12:47 | FromDiscord | <Rika> wdym |
15:13:18 | FromDiscord | <Rika> better at prototyping? idk, i just write down the general idea of the base of what i'm making |
15:13:24 | FromDiscord | <Rika> on like a whiteboard or whatever |
15:13:30 | FromDiscord | <Rika> then i code those components up |
15:15:48 | * | fredrikhr quit (Quit: Disconnecting) |
15:16:04 | FromDiscord | <no name fits> Yeah but I struggle with scoping correctly when it's personal projects |
15:16:40 | fn | <Prestige99> just have to decide if X feature is actually required, and remove it |
15:31:00 | FromDiscord | <haxscramper> I just dump all design plans in the markdown/org-mode. Sort of personal RFC where I also go over some implementation details |
15:31:26 | FromDiscord | <haxscramper> Rubber duck debugging, except I feel stupid actually talking aloud, so write things down |
15:31:57 | FromDiscord | <haxscramper> And paste tons of links there as well, then it becomes Todo list that I track things in |
15:55:50 | FromDiscord | <enthus1ast> Also a kanban (kanboard?) can help.↵Also set yourself a deadline.↵(@no name fits) |
15:57:32 | FromDiscord | <no name fits> Yeah I know deadlines for myself help, but I guess it's hard to cut corners on personal projects. I guess it's a skill. Less hard at work because I have a clearer idea of the end product, so I know what can be cut. |
15:58:37 | FromDiscord | <no name fits> Maybe I need to get better at having a clearer end product in mind for personal stuff |
16:05:52 | * | pro joined #nim |
16:09:38 | * | stkrdknmibalz joined #nim |
16:25:17 | FromDiscord | <ynfle (ynfle)> Is there an equivalent of `-d:` & `when defined(...):` in C? |
16:26:06 | FromDiscord | <haxscramper> `#ifdef` |
16:26:25 | FromDiscord | <haxscramper> well, there is no direct equivalent, but `#ifdef DEBUG` is what people use |
16:28:42 | FromDiscord | <ynfle (ynfle)> How do i define debug? just -g for gcc etc? |
16:29:10 | FromDiscord | <leorize> `-DDEBUG` |
16:30:13 | FromDiscord | <ynfle (ynfle)> thx |
16:34:12 | * | TakinOver quit (Ping timeout: 252 seconds) |
16:49:33 | FromDiscord | <TurtleP> @ElegantBeef remember that issue with the `echo` I was having yesterday? Well turns out I was returning an object in a method that is called from `cligen`'s `dispatchMulti`.. 🤦♂️ |
16:52:23 | * | TakinOver joined #nim |
17:00:59 | FromDiscord | <Schelz> is there a way to create a function that return a variable that i can use later in python |
17:01:00 | FromDiscord | <Schelz> ? |
17:01:43 | FromDiscord | <Rika> python? this is a nim server |
17:01:51 | FromDiscord | <Schelz> so i need to use nim |
17:01:55 | FromDiscord | <Rika> huh? |
17:02:02 | FromDiscord | <Schelz> and after i compile it in python |
17:02:10 | FromDiscord | <Schelz> but thats not the point |
17:02:38 | FromDiscord | <Schelz> the point is how to create a function that return a variable as an argument |
17:03:12 | FromDiscord | <Schelz> or if nim can read from a link source code some values |
17:05:18 | FromDiscord | <Schelz> In reply to @Rika "python? this is a": this was the best tip ever thx for your info i didnt know that :) |
17:05:42 | FromDiscord | <Rika> i do not understand what you are even saying |
17:06:15 | FromDiscord | <Schelz> i know for some peoples programming is very hard to understand |
17:07:19 | FromDiscord | <Rika> i will not help you for you are rude, wait for someone else |
17:09:00 | FromDiscord | <Schelz> nvm i found it on google :feelsOk: |
17:42:02 | FromDiscord | <jfmonty2> How do you compare BackwardsIndexes? `^1 == ^1` produces a type mismatch. |
17:42:13 | FromDiscord | <jfmonty2> (edit) "mismatch." => "mismatch, apparently `==` is not defined for that type." |
17:42:27 | FromDiscord | <ynfle (ynfle)> Why do you need to compare them? |
17:42:39 | FromDiscord | <haxscramper> `index1.int == index2.int` |
17:42:41 | FromDiscord | <haxscramper> Or define `==` overload for them |
17:42:50 | FromDiscord | <jfmonty2> special-casing a specific backwards index in a container that I'm working on |
19:52:08 | FromDiscord | <iffy (Matt Haggard)> How do I build choosenim on Windows so I can test some changes to choosenim? I'm getting `pkg.version in data` LibArchive v3.4.3 not found as the current error while doing `nimble build` |
20:06:02 | * | neceve quit (Ping timeout: 250 seconds) |
20:27:45 | FromDiscord | <dom96> @iffy sadly last time I tried I haven't even been able to build it :/ |
20:28:02 | FromDiscord | <dom96> best point of call is the CI, I'll likely end up gutting the libarchive out of there though eventually |
20:30:05 | FromDiscord | <iffy (Matt Haggard)> oh rats \:) k, I'll figure something out. I'm running into this issue again and trying to figure out what's going on\: [dom96/choosenim#251](https://github.com/dom96/choosenim/issues/251) |
20:30:18 | FromDiscord | <iffy (Matt Haggard)> @\_discord\_132595483838251008\:t2bot.io ^ |
20:43:21 | fn | <ForumUpdaterBot99> New question by SLWW: Using Nim to generate a DLL for use in C#/VB6, see https://stackoverflow.com/questions/68400536/using-nim-to-generate-a-dll-for-use-in-c-vb6 |
20:49:53 | FromDiscord | <Ayy Lmao> Is there some way other than `echo` to print messages for debugging purposes? I've purposefully used `proc` instead of `func` for everything since `echo` apparently causes side effects. |
20:50:44 | FromDiscord | <Hi02Hi> `system.debugEcho` |
20:51:29 | FromDiscord | <Ayy Lmao> Ah cool, thanks! |
20:57:05 | * | max22- quit (Remote host closed the connection) |
20:57:23 | * | max22- joined #nim |
21:01:07 | FromDiscord | <dom96> @iffy: thanks for looking into it 🙂 |
21:06:36 | FromDiscord | <iffy (Matt Haggard)> @dom96 for sure! At this point, I can't do much looking without being to build a custom choosenim. I submitted an untested PR that adds more debugging output to perhaps shed light going forward |
21:12:47 | FromDiscord | <dom96> oh we only have travis there :/ |
21:15:27 | FromDiscord | <System64 ~ Flandre Scarlet> when I interop with C source code do I need the header file too? |
21:48:59 | * | max22- quit (Quit: Leaving) |
21:57:59 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
22:02:12 | * | Lord_Nightmare joined #nim |
22:02:51 | FromDiscord | <Ayy Lmao> In reply to @System64 "when I interop with": I believe so, I think the FFI code you do in Nim is just so Nim can check your work |
22:04:12 | FromDiscord | <Ayy Lmao> I could be wrong though, I haven't gotten too deep into FFI yet |
22:22:54 | FromDiscord | <exelotl> You don't usually need the header, unless it has `inline` functions and funky preprocessor macros that you want to use as-is from Nim. |
22:22:57 | FromDiscord | <System64 ~ Flandre Scarlet> I should try tomorrow |
22:23:27 | FromDiscord | <System64 ~ Flandre Scarlet> wait let me send what I want to interop with |
22:23:52 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/dmitrysmagin/a2t_play↵That |
22:27:27 | * | Vladar quit (Quit: Leaving) |
22:38:11 | * | mst quit (Ping timeout: 258 seconds) |
22:38:53 | * | mst joined #nim |
22:47:31 | FromDiscord | <exelotl> @System64 ~ Flandre Scarlet ah right my bad, I guess the headers are necessary because the C code #includes it |
22:48:47 | FromDiscord | <exelotl> if you had a precompiled version of the library (static lib, DLL or similar) then you wouldn't need the headers, because they just have simple function declarations and some integer #defines - once you translate that to Nim, the header becomes redundant, as the Nim module has all the same declarations |
22:51:18 | FromDiscord | <exelotl> but for this kind of library I guess it's best to keep the source with the .h and .c files, and use the {.compile.} pragma to ensure the C files get compiled and linked into your project |