00:08:52 | * | Zevv quit (Ping timeout: 248 seconds) |
01:03:32 | FromDiscord | <ringabout> Mostly likely |
01:04:57 | FromDiscord | <Elegantbeef> Yea i confirmed it did |
01:05:10 | FromDiscord | <Elegantbeef> It ruins `getImpl`(Did make a bug report for it) |
01:05:47 | FromDiscord | <ringabout> Yeah, I saw that. |
02:39:34 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
02:47:27 | FromDiscord | <voidwalker> is it possible to define a proc type that I can use to shorten the definition of procs of that type ? If so, what is the syntax |
02:48:23 | * | arkurious quit (Quit: Leaving) |
02:48:34 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4g04 |
02:57:45 | FromDiscord | <Elegantbeef> you can use the using statement |
02:58:08 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement |
03:02:31 | FromDiscord | <scarf> are there parametrized test for nim?↵for example stdlib test have hundreds of lines of `doAssert` |
03:17:38 | FromDiscord | <dizzyliam> @ElegantBeef here's the traceback from that AST issue I was having https://pastes.io/yixawkrmxg |
03:26:20 | FromDiscord | <ringabout> I have looked into https://github.com/nim-lang/Nim/issues/20856 and cannot think of a good solution. Though there is no guarantee regarding what's the first node of `nkObjConstr`. I can add a changelog. |
03:34:56 | FromDiscord | <Elegantbeef> Yea this breaks macros quite a bit, so the VM needs a change at the very least |
03:41:35 | * | derpydoo quit (Ping timeout: 260 seconds) |
03:46:36 | FromDiscord | <ringabout> I don't know whether node of `nkType` can be regarded as a symbol. |
03:46:47 | FromDiscord | <ringabout> (edit) "I don't know whether ... nodekind" added "a" | "anode of `nkType` ... can" added "kind" |
03:46:57 | FromDiscord | <Elegantbeef> `nktyp.typ.sym` |
03:47:20 | FromDiscord | <Elegantbeef> That falls apart for generics though |
03:49:22 | FromDiscord | <ringabout> I see |
03:50:54 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4g09 |
03:50:57 | FromDiscord | <ringabout> doesn't work for 1.6.8 either. |
03:51:34 | FromDiscord | <Elegantbeef> Right we there is no way of instantiating a generic in the present state |
03:51:39 | FromDiscord | <Elegantbeef> Forgot about that |
03:54:55 | FromDiscord | <ringabout> It is hard to make it work, I guess `getTypeInst` can be used a workaround for now. |
05:10:48 | * | Zevv joined #nim |
06:35:37 | * | kenran joined #nim |
06:57:29 | * | ltriant quit (Ping timeout: 260 seconds) |
07:23:40 | NimEventer | New thread by HJarausch: Nimble on Termux uses invalid temp folder, see https://forum.nim-lang.org/t/9622 |
07:27:40 | NimEventer | New thread by HJarausch: Internal compiler error - how to debug? , see https://forum.nim-lang.org/t/9623 |
07:44:38 | * | ltriant joined #nim |
07:55:51 | * | ltriant quit (Ping timeout: 268 seconds) |
08:00:20 | * | PMunch joined #nim |
08:57:03 | * | xet7 quit (Remote host closed the connection) |
09:04:03 | PMunch | Anyone else getting ready for christmas? https://uploads.peterme.net/nim-xmas.png |
09:06:55 | FromDiscord | <ChocolettePalette> I long for it because I'll finally be able to dedicate a couple of weeks to reinstalling my Gentoo |
09:24:39 | * | jjido joined #nim |
09:52:07 | NimEventer | New thread by icedquinn: Metadesk parser, see https://forum.nim-lang.org/t/9624 |
09:56:03 | Amun-Ra | PMunch: that's not a tree, that's a tree https://play.nim-lang.org/#ix=4g1c |
09:57:14 | FromDiscord | <Elegantbeef> Make the tree 3 wide and life is easier |
09:57:33 | FromDiscord | <Elegantbeef> Atleast artistically easier |
09:57:40 | FromDiscord | <Elegantbeef> I want a point on the tree and a centred trunk! |
09:57:46 | Amun-Ra | :> |
09:57:57 | Amun-Ra | and a star? |
09:58:20 | FromDiscord | <Elegantbeef> Why the entire tree is made from what one might call a star |
09:58:31 | Amun-Ra | :D |
09:58:35 | Amun-Ra | fair point |
10:02:04 | FromDiscord | <luteva> is there a nim lib for autosuggestion in a terminal? (comparable to the autosuggestion in fish) |
10:02:18 | FromDiscord | <luteva> or something similar |
10:03:16 | * | alice quit (Remote host closed the connection) |
10:06:20 | * | alice joined #nim |
10:13:55 | FromDiscord | <HJarausch (HJarausch)> How to input a variable length seq[int]↵This is a FAQ, still I couldn't find a solution.↵I want to enter [1,2,3] at the input prompt.↵Do I have to parse the input string myself? |
10:20:17 | FromDiscord | <Bung> u can use terminal based editor which support nimlsp↵(@luteva) |
10:20:52 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
10:30:27 | * | dnh joined #nim |
10:33:12 | * | PMunch quit (Remote host closed the connection) |
10:33:18 | * | PMunch_ joined #nim |
10:45:47 | * | jmdaemon quit (Ping timeout: 260 seconds) |
11:10:26 | FromDiscord | <hmmm> hmmm how do I make an int an int16? |
11:10:43 | FromDiscord | <hmmm> 6.int16 or something? |
11:11:12 | FromDiscord | <hmmm> hmm it seems like it |
11:16:34 | FromDiscord | <.tochka> yes |
11:16:47 | FromDiscord | <hmmm> so how would I go to get an intersection of a seq[set[int16]]? |
11:18:36 | FromDiscord | <Generic> intersection? |
11:18:57 | FromDiscord | <hmmm> I mean if I have 2 set[int16] I can AB and get an intersection |
11:19:05 | FromDiscord | <Generic> use a hashset |
11:19:09 | FromDiscord | <hmmm> if I have 10 sets in a seq how do I get the intersection |
11:19:25 | FromDiscord | <Generic> yeah, definitely use hashsets |
11:19:38 | FromDiscord | <hmmm> hmmmm |
11:19:44 | FromDiscord | <hmmm> make an example pls :3 |
11:20:05 | FromDiscord | <Generic> ah no |
11:20:07 | FromDiscord | <Rika> Why use a hash table? |
11:20:07 | FromDiscord | <.tochka> i mean, set will work too |
11:20:27 | FromDiscord | <Generic> In reply to @Rika "Why use a hash": yeah I read seq[seq[int16]] |
11:20:38 | FromDiscord | <Generic> still set[int16] is rarely good |
11:20:42 | FromDiscord | <Rika> In reply to @hmmm "I mean if I": Prolly just use those fold procedures in sequtils |
11:20:50 | FromDiscord | <Generic> because it's 64 kb |
11:21:07 | FromDiscord | <hmmm> I'll look into it rika-sama 🥰 |
11:21:09 | FromDiscord | <Generic> I mean this is just very basic programming |
11:21:16 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
11:21:17 | FromDiscord | <Rika> Do you need it to be a 16 bit integer by the way |
11:21:24 | FromDiscord | <Rika> Because it’s massive as generic said |
11:21:38 | * | dnh joined #nim |
11:22:00 | FromDiscord | <hmmm> well the numbers are not very big so I figured the builtin set int 16 would suffice |
11:22:19 | FromDiscord | <Rika> Use smaller like 8 if it fits |
11:22:21 | FromDiscord | <.tochka> 64kb of absolutely destroyed space 😔 |
11:22:31 | FromDiscord | <hmmm> nu int8 is too smol |
11:22:42 | FromDiscord | <Rika> Then prolly a hash set would be better? |
11:22:51 | FromDiscord | <Rika> Are your sets sparse? |
11:22:53 | FromDiscord | <Generic> ah there's also intsets |
11:22:55 | FromDiscord | <Generic> in the stdlib |
11:22:56 | FromDiscord | <hmmm> what's the difference between set and hashset |
11:23:15 | FromDiscord | <Rika> In reply to @Generic "ah there's also intsets": Oh yeah |
11:23:26 | FromDiscord | <Generic> In reply to @hmmm "what's the difference between": set is a bitset, hashset, well a hashtable |
11:23:31 | FromDiscord | <Generic> (edit) "hashtable" => "hashset" |
11:24:36 | FromDiscord | <Generic> it's pretty basic computer science stuff, it's probably better if you read up on this |
11:24:44 | FromDiscord | <Generic> and if you still have questions, ask them here |
11:25:11 | FromDiscord | <hmmm> hmm I get all my basic cs info from rika and elegantbeef because they dumb it down to me 😃 |
11:25:21 | FromDiscord | <Rika> The basic difference between a bit set and a hash set is similar to an array and a sequence |
11:25:30 | FromDiscord | <Rika> Whoops |
11:25:42 | FromDiscord | <Rika> Maybe I shouldn’t then 🤭 |
11:25:49 | FromDiscord | <hmmm> 😑 |
11:25:53 | FromDiscord | <Rika> Lol |
11:27:31 | FromDiscord | <Rika> But yeah a bit set would use a lot of space while a hash set needs a heap allocation |
11:27:37 | FromDiscord | <Rika> Similar idea |
11:28:01 | FromDiscord | <hmmm> ok let's say I make 10 hash sets and put them into a seq, now what? how do I get the intersection |
11:28:08 | FromDiscord | <Rika> Bit set identifies elements by the “index of the set bit”↵Hash set identifies elements by “if the hash of the element is in the internal sequence” |
11:28:16 | * | jjido joined #nim |
11:28:17 | FromDiscord | <Rika> Uh I don’t know read the docs lol |
11:28:21 | FromDiscord | <hmmm> haha |
11:28:26 | FromDiscord | <hmmm> rika 🥰 |
11:29:47 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4g1A |
11:29:50 | FromDiscord | <Rika> In reply to @Rika "Uh I don’t know": Import both the int set and the seq utils modules and use the fold and intersection proc |
11:29:55 | FromDiscord | <Generic> (edit) "https://play.nim-lang.org/#ix=4g1A" => "https://play.nim-lang.org/#ix=4g1B" |
11:29:56 | FromDiscord | <Rika> Sure that works too |
11:30:08 | FromDiscord | <Rika> If you can’t tell I’m on mobile |
11:30:15 | FromDiscord | <Rika> And also am not a masochist |
11:30:38 | FromDiscord | <hmmm> or maybe I can make it in steps and intersect A with B and then B with C till 10, it should work just the same as doing it at the same time right? |
11:31:02 | FromDiscord | <Generic> yes |
11:31:20 | FromDiscord | <Rika> ✨make tests✨ |
11:31:27 | FromDiscord | <Generic> In reply to @Rika "And also am not": I chose this approach for educational reasons |
11:31:33 | FromDiscord | <Generic> it has less magic |
11:31:45 | FromDiscord | <Rika> In reply to @Generic "I chose this approach": I mean I’m not a masochist to program on a phone |
11:31:50 | FromDiscord | <hmmm> perfect I think we got something workable here! I'll stuff some code and see if it blows up, thanks for all the beauties who help'd |
11:31:50 | FromDiscord | <Generic> ah |
11:32:21 | FromDiscord | <Generic> In reply to @Rika "✨make tests✨": tests only tell you if something is wrong, to tell if something is right you need to prove it |
11:33:22 | FromDiscord | <Rika> In reply to @Generic "tests only tell you": People don’t live long enough to prove everything |
11:33:53 | FromDiscord | <Generic> sure, I mean you don't need to formally prove everything |
11:34:32 | FromDiscord | <Generic> not that write proves for my programs |
11:34:42 | FromDiscord | <Generic> (edit) "that" => "like I" |
11:34:48 | FromDiscord | <Generic> (edit) "proves" => "proofs" |
11:36:08 | FromDiscord | <Bung> yeah, that happens sometime you want fix one then break another, so better put one good case and one bad case into one file. |
11:41:00 | FromDiscord | <Generic> but in this case it's very simple to reason about |
11:41:15 | FromDiscord | <Generic> set intersection is communative |
11:44:31 | FromDiscord | <HJarausch (HJarausch)> @HJarausch /quit |
11:51:52 | * | ltriant joined #nim |
11:56:30 | * | ltriant quit (Ping timeout: 240 seconds) |
12:01:06 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=4g1G |
12:07:06 | FromDiscord | <.tochka> nice python |
12:18:38 | FromDiscord | <hmmm> I firmly believe nim should write as closely as possible to python 🧐 |
12:19:30 | FromDiscord | <hmmm> now I run away before some old crustacean tries to whack my head with a steel mace 🤡 |
12:20:43 | FromDiscord | <scarf> to me it's typed hyperfast python |
12:20:46 | FromDiscord | <.tochka> remove types, done |
12:21:17 | FromDiscord | <scarf> tho i always type hint in python |
12:29:39 | FromDiscord | <ShalokShalom> In reply to @Rika "I mean I’m not": I actually like Termux with Micro↵Its not a full blown IDE, but for small parts, its quite decent. I think 🙂 https://media.discordapp.net/attachments/371759389889003532/1042416156163702788/Screenshot_20221116-132834.png |
12:31:03 | FromDiscord | <ShalokShalom> In reply to @Generic "tests only tell you": Isn't this in parts, what a type system does?↵🙄 |
12:31:58 | FromDiscord | <enthus1ast> thank god its not↵(@hmmm) |
12:32:35 | FromDiscord | <enthus1ast> every time i must write python i hate it |
12:34:45 | FromDiscord | <fbpyr> I still enjoy python, but I am surely missing some nim properties there.. 🙂 |
12:35:22 | FromDiscord | <enthus1ast> you enjoy that the application crashes on your customer instead on your dev machineß |
12:35:24 | FromDiscord | <enthus1ast> ? |
12:35:47 | * | xet7 joined #nim |
12:36:13 | FromDiscord | <hmmm> In reply to @enthus1ast "every time i must": that's because python wants us to join the cult of object and classes |
12:36:30 | FromDiscord | <hmmm> we want none of that we are free like nature so we write in nim |
12:36:51 | FromDiscord | <fbpyr> well python says it is pragmatic - that is the opposite of forced OOP |
12:38:48 | FromDiscord | <fbpyr> to be fair, that can happen with any language |
12:39:33 | FromDiscord | <enthus1ast> when you change something on a python application, you must test every code path, i bet only a fraction of python users do that |
12:40:03 | FromDiscord | <enthus1ast> on nim this is not needed, since its typed, and actually syntax checked before it executes ... |
12:40:13 | FromDiscord | <ShalokShalom> Well, its gradually typed and you can use Coconut/Expression, |
12:40:19 | FromDiscord | <ShalokShalom> (edit) "Coconut/Expression," => "Coconut/Expression." |
12:40:20 | FromDiscord | <luteva> if you have tests for each code path, there's no reason to not run the tests! |
12:40:54 | FromDiscord | <fbpyr> well a missing .so can still crash a nim app on the customer machine. typing is only one domain of potential errors. |
12:41:23 | FromDiscord | <enthus1ast> so far i have never seen any test written for a python code base (me as a code reviewer in an university context) |
12:41:24 | FromDiscord | <fbpyr> but I agree, that I enjoy having my nim app type checked by the compiler. 😌 |
12:44:14 | FromDiscord | <ShalokShalom> In reply to @enthus1ast "so far i have": Its one of those things, the Ruby community is leaps and bounds ahead of Python |
12:44:25 | FromDiscord | <ShalokShalom> You won't find much Ruby code that's untested |
12:44:33 | FromDiscord | <ShalokShalom> They are really obsessed with it. |
12:44:58 | * | PMunch_ is now known as PMunch |
12:48:06 | FromDiscord | <enthus1ast> Well, dependency issues are WAY more annoying on python.↵So far so, that you cannot easily distribute a python application. |
12:48:38 | FromDiscord | <fbpyr> pyinstaller? |
12:48:55 | FromDiscord | <Rika> See word “easily” |
12:48:55 | FromDiscord | <ShalokShalom> In reply to @enthus1ast "Well, dependency issues are": Yeah, I feel that |
12:48:55 | FromDiscord | <fbpyr> it is a fat slow executable, but it is simple. |
12:49:10 | FromDiscord | <enthus1ast> why not docker? |
12:49:19 | FromDiscord | <ShalokShalom> I have not tried yet, but in theory, this could also do work fine via Graal |
12:49:26 | FromDiscord | <fbpyr> because you get docker as dependency? |
12:49:35 | FromDiscord | <ShalokShalom> Graal lets you compile into a single file with all deps 🙂 |
12:49:57 | FromDiscord | <fbpyr> pyinstaller bundles its dependency but is always \> 8mb. 🙁 |
12:50:03 | FromDiscord | <ShalokShalom> And its much faster than regular Python and can be mixed with other languages |
12:50:03 | Zevv | PMunch_: ping |
12:50:07 | FromDiscord | <enthus1ast> i was just mocking around |
12:50:12 | FromDiscord | <fbpyr> I prefer the slim nim executables |
12:50:30 | FromDiscord | <ShalokShalom> Yeah, sure |
12:50:31 | FromDiscord | <ShalokShalom> Me too |
12:50:46 | FromDiscord | <ShalokShalom> But if you need to work in Python |
12:50:51 | FromDiscord | <fbpyr> one thing I would like is if they also try to bundle dependencies like go. |
12:50:58 | FromDiscord | <ShalokShalom> Its also much less work to do via Nim. |
12:51:02 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
12:51:11 | FromDiscord | <enthus1ast> Sure i know of stuff like pyinstaller, nuitka and others↵(@ShalokShalom) |
12:51:31 | FromDiscord | <ShalokShalom> Nuitka.. |
12:51:39 | FromDiscord | <ShalokShalom> I looked at that ages ago |
12:51:43 | FromDiscord | <ShalokShalom> 😅 |
12:51:46 | FromDiscord | <enthus1ast> it still works |
12:51:50 | FromDiscord | <ShalokShalom> Feels like I am so. Old |
12:52:00 | FromDiscord | <ShalokShalom> Never tried. Is it unmaintained? |
12:52:14 | FromDiscord | <enthus1ast> but the thing is for example\: pyinstaller can only bundle for the platform you're on |
12:52:16 | FromDiscord | <fbpyr> meaning nim executables would have an easy way to bundle static libs |
12:52:55 | FromDiscord | <fbpyr> so far I have seen the "doubled exe" a packer exe + app, or memlib |
12:53:06 | FromDiscord | <enthus1ast> i /think/ they're quite active, but i'm not an active python dev↵(@ShalokShalom) |
12:53:11 | FromDiscord | <ShalokShalom> I see |
12:53:18 | FromDiscord | <ShalokShalom> I like their Discord |
12:53:31 | FromDiscord | <ShalokShalom> Pretty absurb, how fast you get good answers |
13:12:01 | FromDiscord | <hmmm> is there a fast sugary way of parseint a seq like @["1","2","3"] into @[1,2,3]? |
13:12:36 | FromDiscord | <Rika> Seq utils, map |
13:12:45 | FromDiscord | <hmmm> ❤️ rika |
13:12:48 | FromDiscord | <Rika> Then pass parse int |
13:17:10 | FromDiscord | <Generic> In reply to @ShalokShalom "Isn't this in parts,": no, strict typing (for the most part) doesn't guarantee that your programs behaviour is logically correct |
13:17:33 | FromDiscord | <Generic> I guess there are a few exceptions, like range types |
13:18:31 | FromDiscord | <ShalokShalom> Well, if the behavior of my app is build on types |
13:18:50 | FromDiscord | <ShalokShalom> Like in domain modeling |
13:19:13 | FromDiscord | <Generic> yes, but the type system doesn't verify that say your implementation of a sorting algorithm actually always returns a sorted list |
13:20:54 | FromDiscord | <Generic> I guess you could have a really complex type system |
13:21:17 | FromDiscord | <Generic> where a sorted list would be a type or a kind of type tag |
13:21:32 | FromDiscord | <Generic> and you would say that your function returns a value of that type |
13:22:18 | FromDiscord | <Generic> and for everything to compile the compiler would need to prove that the list you're constructing in that function actually has that property |
13:24:51 | FromDiscord | <ChocolettePalette> Coq? |
13:26:42 | FromDiscord | <vindaar> that's why one uses Emacs. same experience, no matter the platform 😎 (and no, Emacs shortcuts are not a problem 😉)↵(@ShalokShalom) |
13:26:51 | FromDiscord | <ShalokShalom> @Generic How is a sorted list different from any other list?↵↵Isnt a listed sortes, so ordered by definition? |
13:27:09 | FromDiscord | <ShalokShalom> @vindaar#0000 I am too stupid for Emacs. |
13:27:37 | FromDiscord | <Generic> to my knowledge the elements of a list can have any order |
13:27:43 | FromDiscord | <ShalokShalom> A list in F# is an ordered, immutable series of elements of the same type.↵↵That is very much a type in F# |
13:27:55 | FromDiscord | <ShalokShalom> Like, one of the more common |
13:27:56 | FromDiscord | <Generic> ok I see the problem |
13:28:01 | FromDiscord | <ShalokShalom> Ok? |
13:28:02 | FromDiscord | <Generic> I mixed up ordered and sorted |
13:28:16 | FromDiscord | <ShalokShalom> Ah |
13:28:21 | FromDiscord | <ShalokShalom> Are they different? |
13:29:49 | FromDiscord | <Generic> well now that I'm thinking about it, you could sort by any arbitrary order |
13:30:49 | FromDiscord | <Generic> but in casual speak, sorted means that there is an order like descending or ascending |
13:31:52 | FromDiscord | <Rika> In reply to @vindaar "that's why one uses": I don’t see how that’s relevant |
13:32:06 | FromDiscord | <ShalokShalom> In reply to @Generic "but in casual speak,": Yes |
13:32:22 | FromDiscord | <ShalokShalom> https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/lists |
13:32:49 | * | derpydoo joined #nim |
13:33:16 | FromDiscord | <ShalokShalom> This is very much common in FSharp. They are not only their own type, I can populate product types in a list, and then its that type. |
13:33:19 | NimEventer | New thread by tubbs: Seq too big I think Error: execution of an external program failed, see https://forum.nim-lang.org/t/9625 |
13:34:22 | FromDiscord | <Generic> yes, lists are always ordered like in your F# example |
13:34:34 | FromDiscord | <Generic> but the particular order is not part of the type |
13:34:47 | FromDiscord | <ShalokShalom> Ah, that you mean. |
13:34:55 | FromDiscord | <Generic> yeah |
13:36:03 | FromDiscord | <ShalokShalom> Well, lists only contain elements of the same type. |
13:36:15 | FromDiscord | <ShalokShalom> How would the type system make out an order? |
13:36:18 | FromDiscord | <ShalokShalom> Based on what? |
13:37:05 | FromDiscord | <Generic> well I had imagined something like this |
13:37:51 | FromDiscord | <Generic> I wanted to write an example |
13:38:04 | FromDiscord | <Generic> but I noticed that what I was going for was pretty much just post conditions |
13:38:18 | FromDiscord | <Generic> except that they're somehow attached to the type of the return value |
13:38:59 | FromDiscord | <ShalokShalom> I am confused |
13:39:13 | FromDiscord | <ShalokShalom> What would you want to do, ultimately? |
13:39:39 | FromDiscord | <ShalokShalom> Have you worked with HM type systems? |
13:40:23 | FromDiscord | <Generic> no |
13:41:05 | FromDiscord | <Generic> it could be something like the direction I was going for |
13:42:29 | FromDiscord | <Generic> my standpoint is mostly Nim and C++ when I'm talking about practical type systems |
13:43:52 | FromDiscord | <ShalokShalom> Ah, I see. |
13:44:01 | FromDiscord | <ShalokShalom> So you think they are unpractical? |
13:46:22 | FromDiscord | <Generic> I'm actually not that familiar with functional programming concepts |
13:46:30 | FromDiscord | <Generic> well I do know the basics like higher order functions and things like that |
13:48:54 | FromDiscord | <Generic> but functional programming was always too far away from how computers actually work to be interesting for the things I like to do |
13:51:26 | FromDiscord | <ShalokShalom> Low level programming? |
13:52:15 | FromDiscord | <ShalokShalom> FPGAs allow us to overcome this, particularly with RISC-V |
13:52:47 | FromDiscord | <Rika> ? |
13:52:50 | FromDiscord | <ShalokShalom> And a HM type system is a functional principle, and you can use it in imperative languages as well.↵↵Rust is HM typed. |
13:52:54 | FromDiscord | <Rika> i got lost when you suddenly mentioned fpgas |
13:53:09 | FromDiscord | <ShalokShalom> In reply to @Rika "?": Do you know the Lisp machines? |
13:53:26 | FromDiscord | <Rika> not really |
13:53:29 | FromDiscord | <ShalokShalom> Casual CPUs are designed to suit imperative programming |
13:53:32 | FromDiscord | <Rika> i know but i dont really do |
13:53:35 | FromDiscord | <Rika> sure they are |
13:53:41 | FromDiscord | <ShalokShalom> Lisp machines were an early attempt to change this |
13:54:36 | FromDiscord | <ShalokShalom> With a FPGA, you can do this as well |
13:54:53 | FromDiscord | <ShalokShalom> Pick the instruction sets who fit functional programming |
13:54:56 | FromDiscord | <Generic> I guess you can accelerate FP a bit |
13:55:19 | FromDiscord | <Generic> but some things like linked lists are just problematic due to how RAM works |
13:55:37 | FromDiscord | <Rika> i dont think riscv is an fp-oriented arch though |
13:55:43 | FromDiscord | <Generic> that as well |
13:55:52 | FromDiscord | <ShalokShalom> https://github.com/tommythorn/Reduceron |
13:56:03 | FromDiscord | <ShalokShalom> In reply to @Rika "i dont think riscv": Risc V lets you choose |
13:56:18 | FromDiscord | <ShalokShalom> There is a default subset and you can pick and change |
13:56:21 | FromDiscord | <Generic> > complete with hardware garbage collection |
13:56:25 | FromDiscord | <Rika> i am aware yes |
13:56:26 | FromDiscord | <Generic> that's just a waste of silicon |
13:56:39 | FromDiscord | <ShalokShalom> Why would it. |
13:56:42 | FromDiscord | <Generic> like I guess you could acclerate FP |
13:57:01 | FromDiscord | <Generic> but you could add bigger caches, wider ALUs, etc. |
13:57:22 | FromDiscord | <ShalokShalom> This 1x 300mhz CPU beat 2x dual core 3.4 at the time |
13:57:54 | FromDiscord | <Rika> oh shit i have access to a DE2-115 board |
13:57:59 | FromDiscord | <Rika> fuck yeah am i gonna run this |
13:58:04 | FromDiscord | <Generic> what kind of dual core? |
13:58:12 | FromDiscord | <Generic> (edit) "core?" => "core 3.4 mhz?" |
13:58:17 | FromDiscord | <ShalokShalom> In reply to @Generic "but some things like": You do know how immutable data structures work? |
13:58:17 | FromDiscord | <Generic> (edit) "mhz?" => "ghz?" |
13:58:27 | FromDiscord | <Generic> yes, they're terrible |
13:58:27 | FromDiscord | <ShalokShalom> In reply to @Generic "what kind of dual": I think its part of the paper |
13:58:47 | FromDiscord | <ShalokShalom> In reply to @Rika "fuck yeah am i": Cool 🥳 |
13:58:59 | FromDiscord | <Rika> i might not be able to tho |
13:59:08 | FromDiscord | <Rika> prolly not gonna be able to, i dont have access to it all the time |
13:59:19 | FromDiscord | <ShalokShalom> At university? |
14:00:12 | FromDiscord | <Rika> yes but i could take it home, its just cumbersome |
14:00:26 | FromDiscord | <ShalokShalom> I understand |
14:00:34 | FromDiscord | <Rika> shits fucking massive |
14:00:39 | FromDiscord | <Rika> big ass mf box |
14:00:41 | FromDiscord | <ShalokShalom> Maybe they got it for this case? |
14:00:56 | FromDiscord | <ShalokShalom> Seems to random otherwise |
14:01:12 | FromDiscord | <ShalokShalom> (edit) "to" => "a bit too" |
14:01:19 | FromDiscord | <Rika> wdym |
14:01:25 | FromDiscord | <Rika> no i mean i have an fpga course |
14:01:35 | FromDiscord | <ShalokShalom> Like your university |
14:01:46 | FromDiscord | <Rika> my university is a cs-oriented one |
14:01:50 | FromDiscord | <ShalokShalom> Might have gotten it for thia project specifically |
14:01:55 | FromDiscord | <Rika> no i dont think so |
14:02:01 | FromDiscord | <Generic> well I skimmed the paper and they compare FP programs |
14:02:03 | FromDiscord | <ShalokShalom> Particularly since it has cs background |
14:02:13 | FromDiscord | <Rika> there's a lot of fpga use cases and it would be crazy to assume that that's the specific reason |
14:02:38 | FromDiscord | <ShalokShalom> In reply to @Rika "no i mean i": How do you like it? |
14:02:59 | FromDiscord | <Generic> that dedicated even simpler dedicated hardware is at advantage is nothing new |
14:02:59 | FromDiscord | <ShalokShalom> In reply to @Rika "there's a lot of": Yeah. Idk how popular that specific board is. |
14:03:01 | FromDiscord | <Rika> it's fine aside from my classmates absolutely dying from the difficulty that i do not seem to notice |
14:03:11 | FromDiscord | <Rika> In reply to @ShalokShalom "Yeah. Idk how popular": its a common educational board |
14:03:27 | FromDiscord | <ShalokShalom> I see |
14:03:41 | FromDiscord | <Generic> we wouldn't have GPUs or in recent times neural net accelerators |
14:03:48 | FromDiscord | <Generic> if it wasn't for this |
14:04:07 | FromDiscord | <ShalokShalom> Would really love to see a RISC-V board for the framwork laptop |
14:04:25 | FromDiscord | <ShalokShalom> In reply to @Generic "that dedicated even simpler": Plays obviously a role |
14:04:33 | FromDiscord | <Generic> I also still don't see how RISC-V plays into this |
14:05:04 | FromDiscord | <Generic> as far as I looked into the RISC-V instruction set(s), they're just a run off the mill RISC instruction set |
14:05:17 | FromDiscord | <Generic> like ARM, PowerPC or MIPS |
14:05:38 | FromDiscord | <ShalokShalom> They are expandable |
14:05:53 | FromDiscord | <ShalokShalom> Like, you could add custom ones |
14:06:31 | FromDiscord | <ShalokShalom> And some instruction sets on today's CPUs are already accelerating functional computations |
14:06:52 | FromDiscord | <ShalokShalom> Like, not even since that a short while ago |
14:06:54 | FromDiscord | <Generic> 32-bit ARM used to have that too |
14:07:01 | FromDiscord | <ShalokShalom> Yep |
14:07:38 | FromDiscord | <Generic> the thing is that this is more meant for application specific low power things |
14:07:48 | FromDiscord | <Generic> with simpler processors that's possible |
14:07:48 | FromDiscord | <ShalokShalom> Multi core usage probably drives functional instruction sets forward too |
14:07:53 | FromDiscord | <ShalokShalom> I assume |
14:08:17 | FromDiscord | <ShalokShalom> In reply to @Generic "the thing is that": Yeah, largely. They also attack the smartphone market now. |
14:08:29 | FromDiscord | <ShalokShalom> Just released new CPUs a couple of days ago |
14:08:36 | FromDiscord | <ShalokShalom> Which they advertised this way |
14:09:24 | FromDiscord | <Generic> the thing is that with complex out of order cpus with really long pipelines you can't just stuff extra instructions in there |
14:09:44 | FromDiscord | <ShalokShalom> Well, I can drop old ones |
14:10:30 | FromDiscord | <ShalokShalom> And create new space |
14:10:40 | FromDiscord | <ShalokShalom> Even for more cache |
14:10:44 | FromDiscord | <Generic> no I'm talking about the capabilities of instructions, not the amount |
14:10:50 | FromDiscord | <ShalokShalom> Ah |
14:11:23 | FromDiscord | <ShalokShalom> I don't know enough about these specificd |
14:11:29 | FromDiscord | <ShalokShalom> (edit) "specificd" => "specifics" |
14:11:59 | FromDiscord | <Generic> like for example with aarch64 the maximum amount of registers a single instruction can read is iirc 3 |
14:12:12 | FromDiscord | <Generic> and probably lots of other parts in the processor rely on that |
14:13:34 | FromDiscord | <Generic> like register renaming or the dispatching to the execution units |
14:13:46 | * | lumo_e joined #nim |
14:14:40 | FromDiscord | <Generic> well I actually don't know, I don't work for ARM, but I imagine there atleast some complex relations between different parts of the cpu |
14:15:18 | FromDiscord | <ShalokShalom> In reply to @Generic "> complete with hardware": A CPU that is natively designed towards GC might have a 65-bit data bus but 64-bit arithmetic. |
14:15:26 | FromDiscord | <ShalokShalom> From the internet |
14:15:40 | FromDiscord | <ShalokShalom> https://cs.stackexchange.com/a/112403 |
14:16:18 | FromDiscord | <Generic> the N64 had 9 bit RAM, though only the GPU used the 9th bit |
14:16:34 | FromDiscord | <ShalokShalom> Cool |
14:16:42 | FromDiscord | <Generic> though I think most RAM nowdays is 8 bit |
14:19:13 | FromDiscord | <Generic> apparently you can still buy 9 bit dram |
14:31:41 | Zevv | Planetis here? |
14:36:30 | FromDiscord | <Rika> planet is below, sir |
14:41:38 | PMunch | @Generic, you can buy 9-bit RAM? |
14:41:55 | PMunch | Not sure what I'd use t for. But now I kinda want some |
14:43:13 | FromDiscord | <Generic> there's a bunch of it on Digikey |
14:43:22 | FromDiscord | <Generic> https://www.digikey.de/de/products/filter/speicher/774?s=N4IgjCBcpgLATFUBjKAzAhgGwM4FMAaEAeygG1wwA2MeADhCLAE4B2ABmYGZGQBWVgLrte8QXy4iizPn2ZTwVPmDqtRsObAhFYXGYh0a62ylXjsTY2Ut4yzzXtT7mGReBplqmbOBAC6RAAOAC5QIADKwQBOAJYAdgDmIAC%2ByW7kIDiBeDHIABZ4USB%2ByUA |
14:44:53 | FromDiscord | <Generic> sorry for the german link |
14:47:13 | Zevv | I bet PMunch knows how to german |
14:49:08 | PMunch | Haha, I understand enough german to navigate a webpage :) |
14:50:28 | Zevv | btw PMunch, you read the responses on the sharing-memory post? As far as I understand, it basically can not be done with 'bare' nim and arc. |
14:51:09 | PMunch | Yeah I just read it (and commented) |
14:51:10 | FromDiscord | <ChocolettePalette> What about pointers? |
14:51:24 | Zevv | what about them? |
14:51:42 | FromDiscord | <ChocolettePalette> You can share memory using them |
14:52:23 | PMunch | It seems to not be possible to ensure that the RC of something is 1, which I think is the only missing piece of the puzzle (at least then `send` could throw an error that it can't send memory that's referenced multiple times). |
14:52:37 | PMunch | I honestly thought this was what sink was for.. |
14:52:49 | Zevv | oh sure you can share memory with pointers, that's not the problem |
14:53:06 | Zevv | my point is that I always understood that arc was supposed to make it easy to share nim-managed memory over threads |
14:53:09 | FromDiscord | <Yepoleb> can someone link the post, i'm interested in reading it |
14:53:28 | Zevv | https://nim-lang.org/docs/mm.html states "The reference counting operations (= "RC ops") do not use atomic instructions and do not have to -- instead entire subgraphs are moved between threads" |
14:53:39 | Zevv | The problem is that we seem to miss the machinere to actually do this |
14:53:48 | PMunch | @Yepoleb, https://forum.nim-lang.org/t/9617 |
14:55:24 | Zevv | the thread got distracted a bit with discussions about globals, which was not my intention |
15:06:26 | FromDiscord | <Yepoleb> i thought with orc becoming the default in nim 2 it would actually deliver on the promise of a shared heap |
15:07:08 | Zevv | there is a shared heap. |
15:07:46 | Zevv | the problem is that there does not seem to be an easy way to safely move arc-managed data from one thread to another |
15:07:59 | * | lumo_e quit (Quit: Quit) |
15:08:20 | FromDiscord | <Yepoleb> maybe i am misunderstanding the term then |
15:08:59 | Zevv | or maybe I am. I'm not sure how this is defined, "shared heap". |
15:09:18 | Zevv | as far as I understand, it is safe to allocate something in thread A, then magically transfer it to thread B, and later have B free the memory |
15:09:27 | FromDiscord | <Yardanico> yes |
15:09:42 | Zevv | libc malloc() is also a shared heap |
15:09:52 | Zevv | so I don't think there is much special with that |
15:10:00 | Zevv | but I might be misunderstanding things as well here |
15:11:31 | FromDiscord | <Yepoleb> i thought it would mean concurrent access to the same data |
15:11:50 | FromDiscord | <Yepoleb> because of the mention of atomics |
15:11:52 | Zevv | as long as you have your locks in order, you're free to do so |
15:13:02 | FromDiscord | <Yepoleb> well not with GCd objects |
15:13:05 | FromDiscord | <Yardanico> In reply to @Yepoleb "because of the mention": nim RC isn't atomic so you have to do locks, yes |
15:13:10 | FromDiscord | <Yardanico> In reply to @Yepoleb "well not with GCd": with GC'd objects |
15:14:23 | FromDiscord | <Yepoleb> oh, so you need another lock that is not part of the object before assigning a ref |
15:15:28 | FromDiscord | <Horizon [She/Her]> Does Nim have an easy way to break a loop within a loop? |
15:16:10 | Zevv | In the end, Nim is just C, so you need to adhere to the C rules for shared memory. If you want to share data between threads, you need to first take a lock in thread A, then modify the data and release the lock. If B wants to read the data, it must first take the same lock, read the data, and release. |
15:16:15 | FromDiscord | <Yardanico> In reply to @Event Horizon "Does Nim have an": you mean nested loops? |
15:16:15 | Zevv | That is the only rule. |
15:16:24 | FromDiscord | <Yardanico> if normal loops, then you literally just use `break` |
15:16:35 | FromDiscord | <Horizon [She/Her]> In reply to @Yardanico "you mean nested loops?": Mhm |
15:16:38 | FromDiscord | <Yardanico> if you want to break out of an outermost loop in nested loops, use block with a label |
15:16:49 | Zevv | Nims arc reference counter does not use locking itself. So when sharing data between threads, things will break when you have the same arc object reachable in more then one thread |
15:16:57 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4g2H |
15:16:59 | FromDiscord | <Horizon [She/Her]> Ah thank you |
15:17:06 | FromDiscord | <Yardanico> but also you might want to rewrite your code so you don't need this |
15:17:14 | FromDiscord | <Yardanico> if it's feasible |
15:17:30 | Zevv | The idea is that nim does not *need* locked or atomic RCs because you can move a ref, or tree of refs, between threads to make sure the same ref is never owned by more then one thread at a time |
15:17:55 | FromDiscord | <Horizon [She/Her]> In reply to @Yardanico "but also you might": Yeah that's fair, was just curious really |
15:18:06 | FromDiscord | <Horizon [She/Her]> Is there any reason to avoid using a block like this or? |
15:18:31 | * | PMunch quit (Quit: Leaving) |
15:20:06 | FromDiscord | <Yepoleb> if i want concurrent read access i can't move or use an exclusive lock |
15:20:52 | Zevv | from what I understand, if you want concurrent access, ie shared memory between two threads, you need to do this yourself using raw pointers |
15:21:11 | Zevv | arc managed memory is never to be accessed from more then one thread at a time |
15:21:22 | Zevv | not even *reachable* from more then one thread at a time, even |
15:21:54 | Zevv | but of course if you know waht you are doing, you can just create a arc managed seq in thread A, get the pointer to element 0 and share that with thread B |
15:22:01 | FromDiscord | <Yardanico> In reply to @Zevv "not even *reachable* from": it is actually reachable from multiple threads at the same time, but idk if it's safe |
15:22:03 | FromDiscord | <Yardanico> with locks I mean |
15:22:03 | FromDiscord | <Yepoleb> atomic RCs would solve that problem |
15:22:22 | Zevv | atomic RCs would solve all these problems, but there is a hefty price to pay |
15:22:31 | Zevv | they are slow as hell, compared to plain RCs |
15:23:20 | Zevv | Yardanico: no, because you can not properly protect arc's RC with a lock |
15:23:26 | FromDiscord | <Yepoleb> but still faster than copy and safer than pointers |
15:24:11 | Zevv | Sure. Personally, I loathe shared memory and locks and threading in general. It is just error prone and unmaintanable |
15:24:19 | Zevv | I truly believe in the "share nothing" philosophy |
15:24:28 | Zevv | So I would *love* to properly get these moves working |
15:24:38 | FromDiscord | <Yepoleb> what's your alternative? |
15:24:41 | FromDiscord | <Yardanico> In reply to @Zevv "I truly believe in": processes :DD |
15:24:49 | Zevv | Making moves work |
15:25:09 | FromDiscord | <Yepoleb> but that still does not solve the problem of concurrent reads |
15:25:18 | Zevv | I do not want, nor need, concurrent reads |
15:25:49 | Zevv | I want to abstract that away over a channel-like primitive which lets me "send" data among processes, threads, or whatever you call them |
15:26:04 | Zevv | this is implemented by moves and memory barriers under the hood |
15:26:29 | Zevv | but the end result is that the same memory will never be owned or visible by more then one thread at the same time |
15:26:54 | Zevv | it's analogue to elixir/erlang messages or golang channels |
15:27:23 | Zevv | it's highly subjective, but I think that for me this is the only way to properly write concurrent scalable code without pain |
15:29:40 | FromDiscord | <Yepoleb> if you had to multithread a simulation of a grid, in the style of game of life, how would you do it? |
15:29:53 | FromDiscord | <Yepoleb> (edit) "grid," => "grid" |
15:31:29 | FromDiscord | <Yepoleb> that's kinda what i'm trying to do and i see no way to do it with moves or without a shitload of copies |
15:31:58 | Zevv | How would you do it in a threaded shared memory setup? You can split the board in X areas but you will have a problem at the borders of these areas |
15:32:56 | Zevv | I would probably split the board in X areas. Then move these areas to different threads, they update their part of the board and move the result back |
15:32:59 | Zevv | just sending messages |
15:33:24 | Zevv | there are no copies |
15:33:33 | Zevv | it's just sending around pointers |
15:34:15 | FromDiscord | <dlesnoff> but there are still problems on border |
15:34:28 | Zevv | sure, but that's also with threads. Which threads are responsible for the border |
15:34:59 | FromDiscord | <dlesnoff> You want to update the cells on another grid.↵Maybe he can copy the lines on the border then. |
15:35:11 | Zevv | Anyway, my goal is to get moves properly working to allow a real actor model working. No more data races, deadlocks, no mutexes and semaphores in my code. |
15:36:56 | FromDiscord | <Yepoleb> a border square can neatly be assigned a thread. but it needs access to a 3x3 grid to be calculated, this works fine with concurrent reads, because a thread can access memory beyond its assigned area, but not with moves |
15:37:39 | FromDiscord | <dlesnoff> In reply to @Zevv "sure, but that's also": sorry, I just jumped in the chat and thought @Yepoleb had a question separated from your previous discussion. |
15:39:02 | FromDiscord | <Yepoleb> the cells are always updated on a copy of the grid, that's inevitable in all cases |
15:41:06 | * | arkurious joined #nim |
15:43:06 | FromDiscord | <dlesnoff> I have a simple question. Are generics usable in procedural types ? |
15:43:35 | FromDiscord | <dlesnoff> I want to test sorting algorithms with always the same pattern |
15:44:42 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4g2S |
15:45:20 | Zevv | sure, what is your problem exactly? |
15:45:45 | FromDiscord | <dlesnoff> Sorry I have problem copy-pasting code from vim |
15:46:21 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4g2U |
15:47:32 | FromDiscord | <dlesnoff> I want to pass this kind of prototype to my testSort function, but I get many errors |
15:47:44 | Zevv | that should be just fine |
15:48:58 | FromDiscord | <dlesnoff> I get these:↵/home/lesnoff/Documents/dev/sortingAlgorithms/src/sortingAlgorithms.nim(236, 17) template/generic instantiation of `bubbleSort` from here↵/home/lesnoff/Documents/dev/sortingAlgorithms/src/sortingAlgorithms.nim(7, 17) Error: cannot instantiate: 'T' |
15:50:22 | FromDiscord | <dlesnoff> I don't understand why it can not automatically instantiate the generic |
15:50:46 | Zevv | You need to be specific when instantiating |
15:50:57 | Zevv | when `T` is not a concrete type, the compiler does not know what to do there |
15:51:58 | FromDiscord | <dlesnoff> Let me do a MWE. I can instantiate when compiling, but it doesn't solve it. |
15:54:55 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4g2Y |
15:55:51 | FromDiscord | <dlesnoff> (edit) "https://play.nim-lang.org/#ix=4g2Y" => "https://play.nim-lang.org/#ix=4g2Z" |
15:57:46 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4g30 |
15:58:54 | FromDiscord | <dlesnoff> I'll look more closely at the manual |
16:02:06 | Zevv | you're missing a `var` |
16:02:10 | FromDiscord | <Bung> what's a proper error message for wrong order of case branches? |
16:02:15 | Zevv | proc testSort[T](mySort: proc (x: var openArray[T]), size: int): bool = |
16:02:21 | Zevv | but the error message is super crappy indeed |
16:02:44 | Zevv | @bung: that was to dlensoff, although you also talekd about error messages :) |
16:03:52 | Zevv | well, the error message is not even super crappy, it's actually right on point |
16:04:05 | Zevv | dlensoff: https://play.nim-lang.org/#ix=4g33 fixes |
16:06:21 | FromDiscord | <dlesnoff> Yes, Thank you very much !!! ↵I am glad there is no compiler issue, but I just wish errors were a little more explicit. |
16:08:07 | Zevv | it actually is explicit, albeit a bit noisy. |
16:15:35 | NimEventer | New post on r/nim by yarn_install: This is disappointing to read coming from the Nim founder, see https://reddit.com/r/nim/comments/ywxsbz/this_is_disappointing_to_read_coming_from_the_nim/ |
16:21:47 | * | wallabra quit (Ping timeout: 260 seconds) |
16:24:02 | Amun-Ra | I only use they in plural; they in singular was typical for communists in my country during old times behind the curtain |
16:29:37 | * | kenran quit (Remote host closed the connection) |
16:32:54 | * | lumidify quit (Remote host closed the connection) |
16:34:02 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4g3f |
16:34:10 | FromDiscord | <Yardanico> template is just code substitution, so yes |
16:34:12 | FromDiscord | <Require Support> anyone have a problem with code compiling and running fine under debug but release build gets `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` 😦 |
16:35:19 | FromDiscord | <Require Support> on devel |
16:35:39 | Amun-Ra | compiling or running? |
16:35:45 | Amun-Ra | are you playing with pointers? |
16:35:46 | FromDiscord | <Require Support> running |
16:35:51 | FromDiscord | <Require Support> yes |
16:36:09 | FromDiscord | <Require Support> but i dont understand how debug version runs fine |
16:36:15 | Amun-Ra | could you paste the code somewhere online? |
16:36:19 | FromDiscord | <Require Support> or how i go about debugging the release version |
16:36:32 | Amun-Ra | I mean the part that results with segv |
16:36:39 | FromDiscord | <prestosilver> I normally use gdb to debug seg faults |
16:36:53 | FromDiscord | <prestosilver> Especially nil |
16:37:01 | FromDiscord | <prestosilver> (edit) "Especially nil ... " added "access" |
16:37:13 | FromDiscord | <Require Support> i guess ill use echo commands :/ im noob |
16:37:14 | Amun-Ra | hmm, do you use -d=danger too? |
16:37:23 | Amun-Ra | echo it the best for that ;> |
16:37:24 | FromDiscord | <Require Support> no just release |
16:38:26 | FromDiscord | <albassort> In reply to @Yardanico "template is just code": trying to find a cute way to branch over and over again |
16:38:30 | Amun-Ra | try to isolate where it fails, echo is quite fast for that |
16:38:36 | FromDiscord | <Yardanico> In reply to @albassort "trying to find a": can you show what you mean in pseudocode? |
16:38:50 | FromDiscord | <albassort> its easier to describe it |
16:39:04 | FromDiscord | <albassort> im writing like 20 functions for the same type, and they need to branch |
16:39:37 | FromDiscord | <albassort> I want to make it look nice and having IF X... ELIF ... ELIF ... ELSE in every function a bit ugly |
16:39:43 | FromDiscord | <albassort> and i dont think i can do case statements here |
16:41:15 | FromDiscord | <Yardanico> In reply to @albassort "its easier to describe": sorry I still don't understand, just please give a tiny bit of code you want to work |
16:42:23 | Amun-Ra | I guess he's asking for some kind of function guards |
16:44:01 | FromDiscord | <albassort> they all have the same opening |
16:44:01 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4g3k |
16:44:07 | FromDiscord | <albassort> i want to reduce the boilerplate |
16:46:20 | FromDiscord | <ieltan> Hi, I want to use this library (https://github.com/bmegli/wifi-scan) functionality for my personal program, I tried looking for an equivalent in Nim far and wide but to no avail. I suppose I need to wrap it? |
16:48:15 | NimEventer | New question by Joshua Fenner: Nim: How to wrap a c struct that contains bitfields?, see https://stackoverflow.com/questions/74463981/nim-how-to-wrap-a-c-struct-that-contains-bitfields |
16:48:18 | FromDiscord | <dlesnoff> In reply to @albassort "can i make a": I think you can do that with procs, funcs, methods, and converters |
16:48:48 | FromDiscord | <albassort> In reply to @ieltan "Hi, I want to": such a small library probably need to wrap it |
16:50:46 | FromDiscord | <albassort> In reply to @Jiezron "I think you can": realizing now i forgot about the method keyword and have never seen it in code |
16:51:00 | FromDiscord | <ieltan> In reply to @albassort "such a small library": Yes luckily it is pretty small but I wanted to be sure to not spend time wrapping something when it already exist in nim |
16:51:35 | FromDiscord | <ieltan> beside last time I did C was in high school for a project I'm not familiar with 100% of C syntax ☹️ |
16:54:33 | FromDiscord | <ieltan> For more info my personal program isn't much its originally written in python all it does it check stuff like wifi Bluetooth status without relying on external shell programs I want to rewrite it in Nim but there is a lack of libraries |
16:54:52 | NimEventer | New thread by RodSteward: Managed references to unmanaged references?, see https://forum.nim-lang.org/t/9626 |
16:56:01 | FromDiscord | <Arouzing> sent a code paste, see https://play.nim-lang.org/#ix=4g3n |
16:58:44 | FromDiscord | <Bung> do it in proc not at type declaration |
17:33:56 | NimEventer | New post on r/nim by orang-outan: How come nim is not a mess ?, see https://reddit.com/r/nim/comments/yx0508/how_come_nim_is_not_a_mess/ |
17:51:03 | * | dnh quit (Quit: Textual IRC Client: www.textualapp.com) |
18:07:31 | * | pro joined #nim |
18:13:22 | FromDiscord | <@thatrandomperson5-6310e3b26da03> I have this! |
18:14:50 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4g3S |
18:16:33 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Ive been stuck on this for awhile |
18:35:12 | * | jjido joined #nim |
18:37:32 | * | jmdaemon joined #nim |
19:08:59 | * | kenran joined #nim |
19:27:08 | FromDiscord | <Elegantbeef> How do you attempt to use it? |
19:27:44 | FromDiscord | <Elegantbeef> `proc newLimitedSeq[T](lst: seq[T], limit: int): LimitedSeq[T]` |
19:56:14 | * | robertmeta quit (Ping timeout: 252 seconds) |
19:59:36 | * | robertmeta joined #nim |
20:04:24 | * | robertmeta quit (Ping timeout: 260 seconds) |
20:05:22 | * | robertmeta joined #nim |
20:13:59 | * | om3ga quit (Ping timeout: 256 seconds) |
20:15:22 | * | om3ga joined #nim |
20:15:45 | * | LuxuryMode joined #nim |
20:25:53 | FromDiscord | <Bleant> Hello, everyone! What editor/IDE do you use mostly for Nim? I'm using VSCode, and I'd like to do some string templating for HTML, but I don't see a plugin to have the editor understand the content of the fmt string as HTML, which I'd really like. Is there any way? |
20:26:42 | * | kenran quit (Remote host closed the connection) |
20:36:36 | FromDiscord | <Phil> Heyho Bleant. That is a really good question and sadly I do not have a great response.↵A suggestion I could make would be, that you could have the HTML be in a separate HTML file and read that in at compile-time.↵That file will be read into a string and put into a variable at compile-time then and be part of your binary, but the actual HTML will still be in its own file. |
20:36:51 | FromDiscord | <Elegantbeef> But there are other templating methods |
20:37:58 | FromDiscord | <Elegantbeef> Damn matrix bridge |
20:38:08 | FromDiscord | <Elegantbeef> I said it first! 😛 |
20:38:24 | FromDiscord | <Phil> You did not, I have screenshot proof! |
20:38:49 | FromDiscord | <Array in a Matrix> no i do! |
20:38:53 | FromDiscord | <Phil> The technology you choose to deliver the answer is your responsibility and thus your loss if you're slower xP |
20:39:08 | FromDiscord | <Elegantbeef> Well i blame the bride |
20:39:11 | FromDiscord | <Elegantbeef> bridge even |
20:39:23 | FromDiscord | <Phil> First blaming a bride, then a random bridge |
20:39:29 | FromDiscord | <Bleant> In reply to @Isofruit "Heyho Bleant. That is": I see, that makes sense! Since you've been so kind as to answer, how may I get the path of the file to be read relative to the file I'm copying into? |
20:39:29 | FromDiscord | <Phil> No sense of responsibility |
20:40:10 | FromDiscord | <Bleant> In reply to @Elegantbeef "But there are other": You mean like ejs? If so, I'd prefer not to, just to keep things as raw as possible. If not, how could I achieve this? |
20:40:16 | FromDiscord | <Phil> In reply to @Bleant "I see, that makes": One sec, that last sentence takes me a bit to parse, I'm like 30% braindead at the moment from CS courses on top of QML learning |
20:41:06 | FromDiscord | <Phil> (edit) "courses" => "course" |
20:41:18 | FromDiscord | <Bleant> Hehehe, I undertand. CS course is a doozy, for sure. What's QML, though? |
20:41:21 | FromDiscord | <hugogranstrom> sent a code paste, see https://play.nim-lang.org/#ix=4g4w |
20:41:24 | FromDiscord | <Elegantbeef> https://nimble.directory/search?query=html+template |
20:41:44 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=4g4x |
20:41:48 | FromDiscord | <hmmm> nim seems angry with me |
20:41:50 | FromDiscord | <Elegantbeef> Internal compiler error nice |
20:41:53 | FromDiscord | <Phil> In reply to @Bleant "Hehehe, I undertand. CS": QML is a language of QT for declaring GUIs and having them be rendered by an engine in QT |
20:42:08 | FromDiscord | <Elegantbeef> you have a call somewhere passing in a nil |
20:42:18 | FromDiscord | <Phil> It's not that hard, particularly if you already know webdev, just a smidge different and I do it on the side during the workweek |
20:42:52 | FromDiscord | <hmmm> ye I called something that didn't exist apparently |
20:43:58 | FromDiscord | <hmmm> still why so obscure, beefy fix it for the greater good |
20:44:12 | FromDiscord | <hmmm> the line is nowhere near where this happened too |
20:44:16 | FromDiscord | <Phil> In reply to @Bleant "I see, that makes": Since it's a path you use at compiletime and never again once the binary is compiled you should be able to get away with a hard-coded path |
20:44:43 | FromDiscord | <Phil> The proc you're looking for is `staticRead` trying to figure out whether it used absolute or relative filepaths |
20:44:55 | FromDiscord | <Bleant> In reply to @Isofruit "It's not that hard,": Webdev, the inevitable path we all go to. |
20:45:14 | FromDiscord | <Elegantbeef> Webdev is da poopoo |
20:46:13 | FromDiscord | <Phil> I'd only partially disagree. Imo it can be quite nice... if you don't have to support 20 peoples different architectural ideas thrown all into one project. |
20:46:24 | FromDiscord | <Phil> but that's an issue with any software written by more than 2 people |
20:47:36 | FromDiscord | <Bleant> So, just wondering: if you were just starting out a project, would you use an SPA library, or server side templating with htmx? |
20:48:11 | pro | do we have a separate channel for advent of code? |
20:48:16 | FromDiscord | <Phil> In reply to @Bleant "I see, that makes": Okay,, figured it out, the path you give staticRead is realtive to the main file you're compiling. |
20:48:46 | FromDiscord | <Phil> Like, the one file you're passing to the compiler and that is the starting point of your whole project |
20:48:53 | FromDiscord | <Elegantbeef> There is a aoc discord channel so 'yes' |
20:49:16 | FromDiscord | <Phil> In reply to @Bleant "So, just wondering: if": Depends on the requirements, really |
20:49:44 | FromDiscord | <Bleant> Wish LeetCode had Nim 😦 |
20:49:50 | FromDiscord | <Phil> Like, I have a wiki webpage in nim that uses an SPA, but the webpage itself doesn't really benefit all that much from the technology. |
20:50:02 | FromDiscord | <Bleant> Maybe it's possible to get away with compiling to JS first, then uploading the answer? |
20:50:12 | FromDiscord | <Phil> I have that as a vanity project because it allows me to make the number for HTTP requests to go lower |
20:50:45 | FromDiscord | <Phil> And I basically wanted to see to how fast I could squeeze down on the HTTP request times |
20:50:55 | FromDiscord | <Bleant> Using Karax? |
20:51:40 | FromDiscord | <Phil> Nah, Angular, I am not a massive fan of compiling to JS based on principle alone.↵I've got nothing in particular against Karax, just that I believe you can have a better time if you actually write your frontend with frontend tech |
20:52:18 | FromDiscord | <Phil> I've heard many folks have a great time with karax though, so if you're fine with it don't let my opinion discourage you |
20:56:06 | FromDiscord | <Bleant> sent a long message, see http://ix.io/4g4z |
20:57:43 | FromDiscord | <Phil> In reply to @Bleant "I get you. It's": Fully fair point and the initial set up of writing up all your services in the frontend to do AJAX calls to the right points in the backend is....tedious to say the least for the first bit |
20:57:50 | FromDiscord | <Phil> As is writing all the interfaces, my lord |
20:57:55 | FromDiscord | <Phil> (edit) "As is writing all the interfaces, my lord ... " added "that was braindead work" |
20:58:35 | FromDiscord | <Phil> However, there are benefits of having your tech-stack decoupled like that |
20:59:25 | FromDiscord | <Phil> ~~Also I use prologue out of principle~~ |
21:14:56 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=4g4I |
21:15:41 | FromDiscord | <spoon> it says some of them are immutable, which i'm guessing is the problem |
21:22:12 | FromDiscord | <Elegantbeef> `union`, `toSeq`, `sort` all generate garbage |
21:22:36 | FromDiscord | <Elegantbeef> you want `sorted` `sort` is for `var openarray[char]` |
21:24:44 | FromDiscord | <spoon> gotcha, worked |
21:24:52 | FromDiscord | <spoon> is it because they're all macros? |
21:24:59 | FromDiscord | <Elegantbeef> No |
21:25:15 | FromDiscord | <Elegantbeef> It's cause Nim isnt a FP language so doesnt do the optimisations they do |
21:26:27 | FromDiscord | <Elegantbeef> This is a real big waste for strings |
21:28:05 | FromDiscord | <Elegantbeef> I dont even know why it's named longest but returns a string of the containing characters |
21:28:49 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4g4O gives you the characters in order of highest integer value |
21:29:37 | FromDiscord | <spoon> In reply to @Elegantbeef "I dont even know": it's taken from an exercise so i couldnt tell you either |
21:30:32 | FromDiscord | <Elegantbeef> My example only heap allocates for the result string |
21:36:36 | FromDiscord | <yrashk> I wonder if there's a way to tell Nim NOT to use `-shared` when trying to build with `--app:lib`? I am on macOS and trying to pass the `-bundle -bundle_loader PATH` to the linker (via `passL`), as this is making cc fail with an error? Simply removing `-shared` from the invocation of clang solves the problem. Or am I out of luck here? |
21:39:39 | FromDiscord | <Elegantbeef> What's the error? |
21:39:58 | FromDiscord | <Elegantbeef> I mean i think you can technically modify your `nim.config` located in your nim directory, but that's not a very usable solution |
21:43:26 | FromDiscord | <yrashk> clang-15: error: invalid argument '-bundle' not allowed with '-dynamiclib' |
21:44:04 | * | pro quit (Quit: pro) |
21:49:56 | FromDiscord | <Elegantbeef> I wonder if older clang didnt error |
21:50:28 | FromDiscord | <hmmm> wot |
21:50:48 | FromDiscord | <yrashk> looks like -shared is defined here https://github.com/nim-lang/Nim/blob/92a0f191bf837287eec180288465d7b64d9bf47f/compiler/extccomp.nim |
21:51:03 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=4g4P |
21:51:24 | FromDiscord | <Elegantbeef> Cause that's `[](Test, "hello".parseEnum)` |
21:51:31 | FromDiscord | <Elegantbeef> you want `"hello".parseEnumt[: Test]` |
21:51:50 | FromDiscord | <hmmm> I'm confus |
21:51:59 | FromDiscord | <Elegantbeef> `: Test` tells the compiler "This is a generic proc call" |
21:52:12 | FromDiscord | <Elegantbeef> think about `myObject.array[100]` |
21:52:19 | FromDiscord | <hmmm> ok |
21:52:25 | FromDiscord | <Elegantbeef> how do you distinguish a generic proc invocation from a `[]` invocation |
21:52:58 | FromDiscord | <pear> im here for like 5 minutes nd im already learning new stuff i love this community |
21:52:59 | FromDiscord | <Elegantbeef> There is no way in knowing that you wanted `parseEnum[Test]("hello")` instead of `[](Test, "hello".parseEnum)` |
21:53:58 | FromDiscord | <Elegantbeef> As such the `:T` syntax was added to disambiguate |
21:53:58 | FromDiscord | <Elegantbeef> yrashk i'd suggest opening an isssue |
21:53:58 | FromDiscord | <Elegantbeef> issue even |
21:53:59 | FromDiscord | <Elegantbeef> Or look to see if one exists |
22:02:26 | FromDiscord | <hmmm> hey beefy what was the name of that proc that checks if a path is valid for a given os? I remember using it but can't find it anymore 🫥 |
22:06:47 | FromDiscord | <Elegantbeef> I dont know i just attempt to open the file if it fails i handle the exception |
22:07:38 | FromDiscord | <hmmm> oh that's even better lol |
22:08:10 | FromDiscord | <hmmm> beefy one day your brain will explode out of your skull 🫣 |
22:11:14 | FromDiscord | <albassort> the paragma when you define something are macros right |
22:11:28 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix= |
22:13:42 | FromDiscord | <albassort> ah i remember how nim works |
22:39:06 | FromDiscord | <albassort> according to UTF8 "っ" isn't in it? |
22:40:11 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1042569803497476106/image.png |
22:40:13 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4g4Y |
23:05:57 | * | oprypin quit (Ping timeout: 255 seconds) |
23:12:50 | * | oprypin joined #nim |
23:49:52 | FromDiscord | <morgan> just curious, is there a way to include binary data from some file at compile time without copying it in manually and not just opening the file when it runs? |
23:50:58 | FromDiscord | <albassort> yes |
23:51:04 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix= |
23:51:22 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4g55 |
23:51:30 | FromDiscord | <albassort> on compile it'll link that data statically to the binary |
23:51:40 | FromDiscord | <morgan> cool thanks |
23:51:51 | FromDiscord | <albassort> your banner is sexy asf |
23:52:06 | FromDiscord | <albassort> adhdtrap |
23:53:53 | FromDiscord | <morgan> thanks |
23:54:13 | FromDiscord | <morgan> a lil bit of math i came up with a couple years ago and really like |