00:04:33 | FromDiscord | <ghoom> In reply to @Elegantbeef "`taskPools` and `weave`": "weave"↵i love that name |
00:05:54 | FromDiscord | <!Patitotective> slurp |
00:08:08 | FromDiscord | <ghoom> imagine a package called fuck |
00:08:22 | FromDiscord | <ghoom> `import fuck` |
00:12:04 | FromDiscord | <!Patitotective> what would it do |
00:12:22 | FromDiscord | <!Patitotective> rm -rf / |
00:12:26 | FromDiscord | <ghoom> lol |
00:12:34 | FromDiscord | <ghoom> dat would be `nuke` |
00:12:48 | FromDiscord | <!Patitotective> yes, inside fuck |
00:12:54 | FromDiscord | <ghoom> ah |
00:13:02 | FromDiscord | <ghoom> `fuck/nuke` |
00:13:45 | FromDiscord | <ghoom> (edit) "`fuck/nuke`" => "`import fuck/nuke`" |
00:21:03 | FromDiscord | <Nimion #ඞ> hmm weave and taskpool seem to not work on iterators, u have to specifiy a range urself |
00:21:35 | FromDiscord | <Nimion #ඞ> and taskpool uses FlowVar↵do I need that in weave also to access sequences? |
00:44:14 | FromDiscord | <sOkam!> Is there a way to get the bit representation of a number, so it can be `echo`ed? |
00:44:26 | FromDiscord | <Elegantbeef> `strutils.toBin` |
00:44:29 | FromDiscord | <sOkam!> ty |
00:55:34 | FromDiscord | <ghoom> how do i bypass the `not all cases are covered` error? |
00:55:43 | FromDiscord | <Elegantbeef> Cover all cases |
00:55:47 | FromDiscord | <Elegantbeef> `else: discard` |
00:56:01 | FromDiscord | <ghoom> oh yeaa |
00:56:03 | FromDiscord | <ghoom> thanks |
00:56:12 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
00:56:26 | FromDiscord | <ghoom> i tried putting `;` in place of `discard` and it didn't work |
00:56:26 | FromDiscord | <Elegantbeef> Or if it's an range you can convert it to a subrange type `range[0..3](myVal)` |
00:56:41 | FromDiscord | <ghoom> shweet |
00:57:05 | FromDiscord | <Elegantbeef> Though i'd argue in that case where ever you got it from should convert to a subrange type |
00:58:25 | * | Lord_Nightmare joined #nim |
01:32:16 | FromDiscord | <Girvo> Hi all! |
01:33:28 | FromDiscord | <Girvo> Short of using StatusIM's `byteutils` stuff, whats the go-to way of grabbing the two `byte` parts that make up a `uint16`? |
01:39:10 | FromDiscord | <Girvo> Ah `std/bitops` |
01:40:18 | FromDiscord | <Girvo> Though the fact they all seem to mutate it is a little annoying lol |
01:41:38 | FromDiscord | <Girvo> Oh `bitand` doesn't at least |
01:45:44 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=455B |
01:49:51 | * | CyberTailor quit (Remote host closed the connection) |
01:51:23 | * | CyberTailor joined #nim |
01:51:33 | FromDiscord | <Rika> "bitand" is just a function version of the operator "and" |
01:51:50 | FromDiscord | <Rika> "and" is bitwise when used with numbers |
01:52:01 | FromDiscord | <Girvo> Hah. Cheers |
01:53:08 | FromDiscord | <Girvo> Way nicer |
01:53:11 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=455C |
02:01:20 | * | CyberTailor quit (Remote host closed the connection) |
02:02:19 | * | CyberTailor joined #nim |
02:07:28 | FromDiscord | <gibson> What's so bad about changing the active branch for a variant? The manual says don't do it, then the next immediate section is on `{.cast(uncheckedAssign).}` and it says here's how you do it. Is it because the underlying union fields might contain GC traced memory, and a caress active branch change could totally mess up how that memory is handled? |
02:07:51 | FromDiscord | <gibson> (edit) "caress" => "careless" |
02:16:21 | FromDiscord | <Rika> Changing the branch changes the types of the fields |
02:16:38 | FromDiscord | <Rika> The fields in an object variant are all stored in the same section of memory |
02:16:51 | FromDiscord | <Rika> You’ll essentially cast memory by changing the kind discriminator |
02:16:56 | * | toluene quit (Read error: Connection reset by peer) |
02:17:34 | FromDiscord | <gibson> So am I right that it's only an issue if that memory holds something GC traced? |
02:17:44 | FromDiscord | <Rika> No |
02:17:56 | FromDiscord | <Rika> It’s an issue for all types |
02:18:10 | FromDiscord | <Rika> Integers being interpreted as floats is undesirable |
02:18:19 | FromDiscord | <Rika> Booleans as arrays |
02:18:22 | FromDiscord | <Rika> Etcetera |
02:18:36 | * | toluene joined #nim |
02:18:37 | FromDiscord | <Nimion #ඞ> how can I get rid of warnings when casting int to enum? |
02:18:43 | FromDiscord | <gibson> Sure, but that's just how casting works. |
02:18:57 | FromDiscord | <gibson> Undesirable is dependent on context. |
02:19:08 | FromDiscord | <Rika> In reply to @gibson "Sure, but that's just": It’s not desired unless you explicitly write cast 🙂 |
02:19:23 | FromDiscord | <gibson> Okay, so I think that fits my intuition. Thanks! |
02:19:24 | FromDiscord | <Rika> That’s how Nim wants it |
02:22:17 | FromDiscord | <Prestige> isn't there `parseEnum` or something similar |
02:22:31 | FromDiscord | <Girvo> Silly question, `result` vs `return`? Way back when I picked up Nim (in the v0.10 days) result was common, but a lot more of the code I've seen out in the wild seems to use return a lot more nowaday |
02:23:16 | FromDiscord | <Prestige> Just preference |
02:24:24 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=455I |
02:24:49 | FromDiscord | <gibson> @Girvo Status.im Nim guidelines are very interesting to read through, as they're a company with some good nim experience. They suggest avoiding using `result`. No clue if that has anything to do with the trend you observe, though. |
02:25:16 | FromDiscord | <Prestige> I think result is warranted in some cases |
02:25:36 | FromDiscord | <Prestige> Because I think it is implicitly created anyway (maybe wrong about this) |
02:26:09 | FromDiscord | <!Patitotective> In reply to @Girvo "Silly question, `result` vs": in some video i watched araq saying that nim prefered structured programming and result over return |
02:26:11 | FromDiscord | <Nimion #ඞ> sent a code paste, see https://play.nim-lang.org/#ix=455J |
02:26:25 | FromDiscord | <!Patitotective> (edit) "return" => "return↵i think" |
02:26:50 | FromDiscord | <Prestige> Enums with holes usually ends up being a pain to deal with, if you can avoid it |
02:26:52 | FromDiscord | <!Patitotective> In reply to @TryAngle "ah wait it's a": then you can `switch("warning", "HoleEnumConv:off")` |
02:26:56 | FromDiscord | <gibson> @!Patitotective Araq does. Status.im has industry experience around commercial dev w/ Nim, and in their experience `result` is more confusing and harder for static analysis. |
02:27:14 | FromDiscord | <gibson> https://status-im.github.io/nim-style-guide/language.result.html |
02:27:16 | FromDiscord | <Nimion #ඞ> In reply to @Patitotective "then you can `switch("warning",": is there another way to do this code wise🥺 |
02:27:30 | FromDiscord | <!Patitotective> In reply to @TryAngle "is there another way": `--warning:HoleEnumConv:off` (?) |
02:27:35 | FromDiscord | <!Patitotective> In reply to @gibson "<@762008715162419261> Araq does. Status.im": 👀 |
02:28:38 | FromDiscord | <Nimion #ඞ> In reply to @Avahe "Enums with holes usually": hmm I'm interfacing with C in this case so i'ts not that possible 😢 |
02:28:51 | FromDiscord | <Nimion #ඞ> can a `converter` do the job? |
02:29:12 | FromDiscord | <Nimion #ඞ> In reply to @Patitotective "`--warning:HoleEnumConv:off` (?)": it's a library, I don't want to force that on anyone |
02:30:15 | FromDiscord | <Girvo> Yeah dealing with hole-y enums across the Nim-C boundary is a pain 😦 I'm yet to find a nice pattern myself |
02:30:22 | FromDiscord | <!Patitotective> `{.push warning[HoleEnumConv]: off.}` ... `{.pop.}` lol |
02:30:41 | FromDiscord | <Girvo> ^ I was literally just typing that lol. Thats what we've done in our bindings |
02:30:52 | FromDiscord | <Nimion #ඞ> lmao |
02:31:11 | FromDiscord | <Nimion #ඞ> ok this looks better than using warnings off completely at least |
02:31:41 | FromDiscord | <Girvo> `push` in general is handy for library-level bindings where you have to do weird shit and don't want to force your odd config on everyone else lol |
02:32:20 | FromDiscord | <Girvo> In our firmware we've got our "app" level code which is all nice idomatic nim, and the kernel level which is a nightmare of horrid bindings to ESP-IDF and other drivers and components lol |
02:32:32 | FromDiscord | <Girvo> So its handy to be able to disable stuff just where its needed |
02:36:07 | FromDiscord | <Girvo> I never know whether to be happy or sad when I find a library that does the exact thing I wanted but I was looking forward to writing myself lol |
02:42:44 | FromDiscord | <gibson> @Girvo what lib? |
02:52:50 | FromDiscord | <!Patitotective> In reply to @Girvo "I never know whether": hahah yeah↵second time ive been fooled |
02:59:55 | FromDiscord | <Girvo> https://github.com/sumatoshi/w8crc |
03:00:09 | FromDiscord | <Girvo> @gibson ^ |
03:00:39 | FromDiscord | <Girvo> I was going to implement CRC16 for the modbus implementation I'm working on but found this lol |
03:01:31 | FromDiscord | <voidwalker> In an ordered table, is it possible to get the order/position (it was added in) of a certain key ? |
03:03:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=455P |
03:03:30 | FromDiscord | <gibson> @voidwalker If you ask for the keys, they should be in order, right? Then just find the key in the resulting seq. |
03:04:03 | FromDiscord | <gibson> @ElegantBeef 's is better :p |
03:06:27 | FromDiscord | <voidwalker> hmm |
03:06:52 | FromDiscord | <voidwalker> maybe I should just store position as value, instead of the "count" that I do now, and do not need |
03:07:28 | FromDiscord | <voidwalker> I want to store/enumerate all uniqe strings of db column, so I can try and turn them into an INT using bitmask of their positions |
03:07:41 | FromDiscord | <voidwalker> Is ordered table what you would use for this? |
03:10:39 | * | pch quit (Quit: Leaving) |
03:11:42 | FromDiscord | <Elegantbeef> that's why i just did 😄 |
03:11:43 | FromDiscord | <Elegantbeef> Without allocating a seq for keys |
03:16:25 | FromDiscord | <gibson> @voidwalker Are you talking giant data? Otherwise turning the unique set of strings into a lookup table with index as their values might be faster. |
03:23:13 | * | pch joined #nim |
03:36:47 | FromDiscord | <voidwalker> About 10 million rows, with 1-4 entries (bitgs) |
03:36:54 | FromDiscord | <voidwalker> (edit) "(bitgs)" => "(bits)" |
03:37:48 | FromDiscord | <voidwalker> this is what I did so far |
03:37:49 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=455S |
03:39:27 | FromDiscord | <voidwalker> But I am thinking, better build that 32bit mask (28 possible values) from memory (the keys/position) rahter than lookup in the db |
03:41:50 | FromDiscord | <voidwalker> In reply to @Elegantbeef "The way to do": This needs to loop over the values to find position of "key". Not good. I wanted something instant. As my algorithm does not need to iterate over the keys but over the db values containing such keys, and map them to a position |
03:43:46 | FromDiscord | <ghoom> how do i define methods? |
03:44:08 | FromDiscord | <Elegantbeef> Dynamic dispatch 'methods' or procedures? |
03:44:27 | FromDiscord | <ghoom> like inside a `object` |
03:44:29 | FromDiscord | <ghoom> (edit) "a" => "an" |
03:44:44 | FromDiscord | <Elegantbeef> You dont define member functions in Nim |
03:44:59 | FromDiscord | <Elegantbeef> If you're using OOP nim has `method` for dynamic dispatch, if you're using procedure nim has `proc` |
03:45:02 | FromDiscord | <Elegantbeef> So what're you doing? |
03:47:41 | FromDiscord | <ghoom> sent a code paste, see https://play.nim-lang.org/#ix=455U |
03:47:53 | FromDiscord | <ghoom> i wanna do dis but in nim |
03:48:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=455V |
03:48:23 | FromDiscord | <Elegantbeef> Nim does not attach procedures to types |
03:48:31 | FromDiscord | <ghoom> ooh ok |
03:48:35 | FromDiscord | <ghoom> interesting |
03:49:00 | FromDiscord | <Elegantbeef> Nim is procedural with modules, so types can exist and modules implement logic that applies to those data types |
03:49:41 | FromDiscord | <ghoom> cool |
03:51:59 | FromDiscord | <!Patitotective> oop is just sugar syntax |
04:18:07 | * | arkurious quit (Quit: Leaving) |
04:26:50 | * | duuude quit (Ping timeout: 240 seconds) |
04:31:44 | FromDiscord | <j-james> In reply to @Patitotective "oop is just sugar": using nim's ufcs and rust's impls really helped make this click for me |
05:16:29 | * | CyberTailor quit (Read error: Connection reset by peer) |
05:17:12 | * | CyberTailor joined #nim |
05:18:33 | FromDiscord | <b1rdf00d> sent a long message, see http://ix.io/4566 |
05:20:43 | FromDiscord | <Elegantbeef> Yea i've seen the "if you just force all procedures to be called `f(...)` it's already uniform" 😄 |
05:24:46 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4567 |
05:27:26 | FromDiscord | <Elegantbeef> `import module as othername` |
05:28:05 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4568 |
05:40:03 | FromDiscord | <# Luke> Does Nim have classes |
05:40:09 | FromDiscord | <Prestige> Nope |
05:40:18 | FromDiscord | <# Luke> Or do I use objects |
05:40:32 | FromDiscord | <sOkam!> objects |
05:40:32 | FromDiscord | <Prestige> objects and functions |
05:40:48 | FromDiscord | <Elegantbeef> No |
05:40:48 | FromDiscord | <Elegantbeef> There are macros to simulate them but no |
05:40:49 | FromDiscord | <# Luke> Ah lol ok |
05:41:02 | FromDiscord | <sOkam!> then you do `object.theFunction` and you get the same thing |
05:41:50 | FromDiscord | <sOkam!> not encapsulated with classes, but with files instead |
05:42:06 | FromDiscord | <sOkam!> so, its more similar to C in that sense, but still get the nice functionality of dot notation |
05:42:59 | FromDiscord | <IDF> kinda like ocaml modules, but silly |
06:29:13 | FromDiscord | <sOkam!> Is it possible to export pragmas from one file to another? |
06:29:52 | FromDiscord | <Elegantbeef> Depends on the kind |
06:31:37 | FromDiscord | <Elegantbeef> template pragmas can be exported |
06:35:53 | * | CyberTailor quit (Write error: Connection reset by peer) |
06:36:45 | * | CyberTailor joined #nim |
06:57:17 | * | duuude joined #nim |
06:58:26 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=456j |
06:58:42 | * | CyberTailor quit (Remote host closed the connection) |
06:59:58 | * | CyberTailor joined #nim |
07:00:12 | FromDiscord | <Elegantbeef> inject doesnt do anything here |
07:04:22 | FromDiscord | <Elegantbeef> But i think you can |
07:05:15 | FromDiscord | <ajusa> Not sure if I've asked this before, but there's no way to remove a C linker flag right? Playing around with https://github.com/Yardanico/cosmonim |
07:05:59 | FromDiscord | <jmgomez> In reply to @Elegantbeef "But i think you": how? |
07:06:06 | FromDiscord | <Elegantbeef> `stack {.inject.}` |
07:06:15 | FromDiscord | <Elegantbeef> I dont get why you need to use inject here but alas |
07:06:16 | FromDiscord | <jmgomez> In reply to @Elegantbeef "inject doesnt do anything": well, its inside genAst |
07:07:19 | FromDiscord | <jmgomez> oh it seemed to work, I swear I tried that yesterday.. thanks! |
07:16:32 | * | duuude quit (Quit: Konversation terminated!) |
07:24:05 | * | jmdaemon joined #nim |
07:34:14 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=456o |
07:34:21 | FromDiscord | <Elegantbeef> `ord` |
07:34:32 | FromDiscord | <Elegantbeef> That works for all enums regardless if they're ordinal or not |
07:35:05 | NimEventer | New thread by Niminem: Weird Type Mismatch error for JS backend (1.6.X), see https://forum.nim-lang.org/t/9313 |
07:59:10 | * | toluene quit (Ping timeout: 272 seconds) |
08:03:12 | * | toluene joined #nim |
08:26:52 | FromDiscord | <frobnicate> I'm not sure you should depend on the "value" of an enum though, unless it's like a bitmask. Smells like an anti pattern |
08:27:00 | FromDiscord | <frobnicate> I don't know what you guys think |
08:27:31 | FromDiscord | <Elegantbeef> Enums should be ordinals is what i think |
08:28:07 | FromDiscord | <Elegantbeef> They're interoping with C so dont get the luxury |
08:28:22 | FromDiscord | <frobnicate> So would you make a type for bit masks? |
08:28:45 | FromDiscord | <Elegantbeef> Possibly |
08:28:50 | FromDiscord | <Elegantbeef> I've never really needed to so i dont know |
08:29:09 | FromDiscord | <Elegantbeef> I much prefer using Nim's bitsets where i can but that involves staying in Nim |
08:29:29 | FromDiscord | <frobnicate> Is that a type? |
08:29:39 | FromDiscord | <Elegantbeef> Bitsets are just `set[T]` |
08:30:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=456A |
08:30:27 | FromDiscord | <frobnicate> And I guess you make T a range 0..1? |
08:30:29 | FromDiscord | <Elegantbeef> That creates an 8 bit set and flicks the 3/4th bit on |
08:30:46 | FromDiscord | <frobnicate> Oh |
08:30:48 | FromDiscord | <frobnicate> Nvm |
08:31:01 | FromDiscord | <frobnicate> Yeah that's much more readable than normal bitmask stuff lol |
08:31:14 | NimEventer | New thread by Mildred: Error: both asyncdispatch.await and asyncmacro.await match, but asyncmacro is not imported, see https://forum.nim-lang.org/t/9314 |
08:31:15 | FromDiscord | <Elegantbeef> Think most call them bitflags but yea |
08:31:32 | FromDiscord | <Elegantbeef> You can also do them more programatically |
08:32:01 | FromDiscord | <frobnicate> I call them masks because of raycasting |
08:32:11 | FromDiscord | <frobnicate> Bad habit maybe |
08:32:27 | FromDiscord | <Elegantbeef> Like if you have bit fields you can generally do niftier things with enum + sets |
08:32:34 | FromDiscord | <frobnicate> I see |
08:32:43 | FromDiscord | <Elegantbeef> getting a link if you're interested |
08:32:49 | FromDiscord | <frobnicate> Yes please |
08:33:32 | FromDiscord | <Elegantbeef> https://github.com/mattrberry/gba/pull/5/files#diff-d93a4dfd344765bba00a8f3ea5773f9d2ab8c7ddc199238c23887da7f209ae33L34-L39 |
08:33:39 | FromDiscord | <frobnicate> Thank you |
08:33:59 | FromDiscord | <Elegantbeef> Also on that PR you can see me talk about Tables |
08:35:57 | FromDiscord | <Elegantbeef> Whoever originally implemented sets in pascal did it right 😄 |
08:36:27 | FromDiscord | <frobnicate> Yeah it looks cleaner than ORing |
08:36:37 | FromDiscord | <Elegantbeef> Sets also work on all ordinals(within uint16.high range) so if you need an efficient set of less than 65k integers you can use them |
08:37:52 | FromDiscord | <frobnicate> Is there a way to do this dynamically at runtime? Or is it only during compile? I'm just thinking of using it in an engine where the user creates a physics layer, for instance |
08:37:52 | FromDiscord | <Elegantbeef> It does use a lot of memory of course 2^16 bits always allocated is quite a lot |
08:38:08 | FromDiscord | <Elegantbeef> Nim's bitsets are statically typed |
08:38:36 | FromDiscord | <Elegantbeef> Statically sized rather |
08:39:00 | FromDiscord | <frobnicate> So I would have to handle it dynamically while the user is editing, and then when they hot reload I can recompile with their settings |
08:39:33 | FromDiscord | <Elegantbeef> I'd just say have a `seq[0..128]` then keep track of how many layers |
08:39:38 | FromDiscord | <Elegantbeef> `set` rather |
08:39:38 | FromDiscord | <frobnicate> So I would have to make a template for it and run it for each layer they've created, or something like that, right? |
08:40:03 | FromDiscord | <Elegantbeef> Like will you ever need more than 128 physics layers |
08:40:13 | FromDiscord | <Elegantbeef> If so i'm sorry for the shit you're in but get yourself a rope |
08:40:27 | FromDiscord | <frobnicate> I have no idea if someone would be that crazy |
08:40:40 | FromDiscord | <frobnicate> I usually use around 8 myself whenever I make a game |
08:40:50 | FromDiscord | <Elegantbeef> Exactly you can just do like `set[0..63]` or w/e |
08:41:10 | FromDiscord | <Elegantbeef> Your layer mask is then just `{range[0..63](0), 1, 2, 10, 13}` |
08:41:18 | FromDiscord | <frobnicate> Ok that makes sense |
08:41:49 | FromDiscord | <Elegantbeef> yes that conversion is required else Nim thinks "Oh you're trying to make a set of `int` that requires 2^64 bits" |
08:41:54 | FromDiscord | <frobnicate> I guess if they need more I can make a setting for another range of layers |
08:42:13 | * | rockcavera quit (Remote host closed the connection) |
08:42:43 | FromDiscord | <Elegantbeef> I mean Unity iirc only has 32 layers |
08:42:50 | FromDiscord | <Elegantbeef> I think their layermasks are uint32 |
08:43:41 | FromDiscord | <frobnicate> Yeah but screw unity |
08:44:08 | FromDiscord | <Elegantbeef> well then make 40 layers just to spite them |
08:45:40 | FromDiscord | <Elegantbeef> I mean i dont even know how one would keep track of 32 layers nevermind 40 or 64 |
08:46:04 | FromDiscord | <Elegantbeef> Even with a collision matrix gui, that's a lot of interactions |
08:46:15 | FromDiscord | <frobnicate> That's another thing |
08:46:26 | FromDiscord | <frobnicate> I wanted to come up with tools to help development |
08:46:34 | FromDiscord | <frobnicate> Like checking for dead ends |
08:46:43 | FromDiscord | <frobnicate> Or islands on nav mesh |
08:47:02 | FromDiscord | <Elegantbeef> Oh thought you mean if a poor programmer wrote `while true` 😄 |
08:47:08 | FromDiscord | <frobnicate> Lol no |
08:47:21 | FromDiscord | <frobnicate> Code analysis is a bit beyond me |
08:49:41 | FromDiscord | <frobnicate> I did want some kind of feature that made it possible to tag something as placeholder |
08:49:56 | FromDiscord | <frobnicate> And warning you if you do a release build with placeholders left |
08:50:11 | FromDiscord | <frobnicate> Because that's an oopsie I've done myself |
09:11:34 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=456K |
09:12:18 | * | jmdaemon quit (Ping timeout: 240 seconds) |
09:12:26 | FromDiscord | <sOkam!> isn't `<Syscall>` supposed to be that very same type? I don't have any other type named like that 🧩 |
09:13:46 | * | xet7 joined #nim |
09:13:47 | * | xet7 quit (Remote host closed the connection) |
09:19:22 | FromDiscord | <Elegantbeef> That seems like you're doing something wrong and the compiler doesnt get it |
09:21:08 | FromDiscord | <Asbjørn F> what's the code on the line? |
09:29:22 | * | xet7 joined #nim |
09:43:16 | FromDiscord | <sOkam!> trying to isolate the error into a separate simpler file, so that I can see what is wrong easier |
09:45:03 | FromDiscord | <ricky> weird q- |
09:46:37 | FromDiscord | <Rika> ? |
09:47:24 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=456W |
09:47:45 | FromDiscord | <ricky> I compiled something in Nim to a static bin and loaded it in-memory into a parent C program but am not sure best way to jmp back to the caller |
09:48:02 | FromDiscord | <ricky> it runs ok but ofc it will just exit normally at the end |
09:48:34 | FromDiscord | <Rika> If you’re gonna call those converters manually all the time then just make them procs |
09:49:04 | FromDiscord | <sOkam!> i will. im calling them explictely to be sure that's not the issue |
09:49:10 | FromDiscord | <Rika> Okay |
09:50:39 | FromDiscord | <sOkam!> I guess the problem is somewhere in the cast, or something 🤔 |
09:52:33 | FromDiscord | <Rika> youre passing a `proc(callNum: clong): clong` a `Syscall`? when it wants a `clong`? |
09:53:16 | FromDiscord | <sOkam!> it wants an `intptr_t` with the shape of that proc. so trying to convert the proc to the shape and passing that |
09:53:25 | FromDiscord | <sOkam!> (edit) "it" => "the C code" |
09:53:33 | FromDiscord | <sOkam!> (edit) "code" => "binary" |
09:53:46 | FromDiscord | <Rika> `Sysc.error.toSysc` is a `Syscall` i dont understand what you mean |
09:54:18 | FromDiscord | <sOkam!> oh, i see what you mean |
09:54:35 | FromDiscord | <sOkam!> im passing a function to the function, instead of a the callnum |
09:54:38 | FromDiscord | <Rika> yes |
10:03:41 | * | toluene quit (Read error: Connection reset by peer) |
10:04:12 | * | toluene joined #nim |
10:08:52 | FromDiscord | <sOkam!> how do you convert from clong to nim native int? |
10:09:05 | FromDiscord | <sOkam!> is there an expected way to do it? |
10:46:47 | FromDiscord | <sOkam!> i guess `theClongNumber.int` works 🤷♂️ |
10:54:24 | FromDiscord | <Nimion #ඞ> how does nim's hashtable or how do hashtables in the major langs handle collisions? In my uni course I learned about so many ways now but what is actually done in practice? |
10:56:19 | FromDiscord | <flywind> In reply to @TryAngle "how does nim's hashtable": It uses open addressing . |
10:56:53 | FromDiscord | <flywind> Basically it just tries the next slot iirc. |
10:58:16 | FromDiscord | <Nimion #ඞ> ah I see, thanks |
10:58:55 | FromDiscord | <Nimion #ඞ> linear probing 🤓 |
11:17:49 | NimEventer | New thread by Mantielero: Carbon lang, see https://forum.nim-lang.org/t/9315 |
11:21:28 | FromDiscord | <anonsh> Hey↵Does anyone know what nim's equivalent of 'not' is? |
11:24:04 | FromDiscord | <anonsh> Because right now I'm wrapping the whole statement in brackets and checking if it equates to false |
11:24:12 | FromDiscord | <Nimion #ඞ> In reply to @anonsh "Hey Does anyone know": nim is using not for booleans if this is ur question |
11:25:06 | FromDiscord | <Nimion #ඞ> sent a code paste, see https://play.nim-lang.org/#ix=457p |
11:25:06 | FromDiscord | <anonsh> sent a code paste, see https://paste.rs/0ws |
11:25:18 | FromDiscord | <Nimion #ඞ> u don't need ( ) but u can use them |
11:25:28 | FromDiscord | <anonsh> sent a code paste, see https://play.nim-lang.org/#ix=457q |
11:25:30 | FromDiscord | <anonsh> Thanks for clearing it up |
11:26:08 | FromDiscord | <Nimion #ඞ> nim doesn't even need you to use ( ) when callings procs or (funcs or macros or templates or convertes or iterators) |
11:26:45 | FromDiscord | <anonsh> sent a code paste, see https://play.nim-lang.org/#ix=457r |
11:27:30 | FromDiscord | <anonsh> So I guess in this case I would have to wrap in ()? |
11:27:43 | FromDiscord | <Nimion #ඞ> hmm maybe u need ( ) around input_cmd .. in given_evidence |
11:27:50 | FromDiscord | <Nimion #ඞ> it probably only looks at input_cmd |
11:27:54 | FromDiscord | <Nimion #ඞ> (edit) "it probably only looks at input_cmd ... " added ".." |
11:27:59 | FromDiscord | <anonsh> sent a code paste, see https://play.nim-lang.org/#ix=457t |
11:28:08 | FromDiscord | <Nimion #ඞ> ye try that |
11:29:01 | * | lain quit (Ping timeout: 244 seconds) |
11:29:31 | FromDiscord | <anonsh> Yep it works |
11:29:33 | FromDiscord | <anonsh> thanks again |
11:30:18 | FromDiscord | <Nimion #ඞ> 👍 |
11:31:17 | * | lain joined #nim |
11:32:57 | FromDiscord | <Rika> In reply to @anonsh "ok see I": Use "notin" |
11:33:13 | FromDiscord | <Rika> x not_in list |
11:33:36 | FromDiscord | <Nimion #ඞ> Oh wow we have that 😳😳 |
11:34:37 | FromDiscord | <anonsh> Nim's pretty easy to pick up |
11:34:53 | FromDiscord | <anonsh> If it had more accessible docs ↵This would be pretty neat |
11:42:34 | * | Guest25 joined #nim |
11:42:49 | * | Guest25 quit (Client Quit) |
11:48:57 | qwr | don't know, the docs have been fine for me, in what way these could be more accessible? |
11:49:52 | qwr | maybe some details are hard to find |
12:14:20 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/zxS |
12:28:05 | FromDiscord | <Rika> dynlib pragma |
12:28:12 | FromDiscord | <Rika> I forgot how to use |
12:28:20 | FromDiscord | <Rika> Youre missing that though |
13:07:38 | FromDiscord | <Dale> In reply to @qwr "don't know, the docs": I agree in general, overall the docs are quite comprehensive, but I'm finding a few things to be fragmented. For example, the current state of certain things isn't really documented that way, like the fact that `parallel` is going to be removed |
13:07:58 | FromDiscord | <Dale> (edit) "way," => "well," |
13:08:20 | FromDiscord | <Dale> It can be tricky to make sure you're doing certain things properly because of this |
13:08:24 | FromDiscord | <Phil> In reply to @Dale "I agree in general,": Imagine a long and in depth guide to macros that weren't in Araqs book |
13:08:32 | FromDiscord | <Dale> The whole GC arc/orc thing could be documented better, for example |
13:09:19 | FromDiscord | <Dale> I haven't read the book yet, but I'll probably pick it up soon |
13:09:27 | FromDiscord | <Rika> Is tutorial three not comprehensive enough for macros lol |
13:11:52 | FromDiscord | <Dale> A nice thing about Lua is that the standard library is so small and concise it's documented in the language manual itself. Now, Nim's std lib right now might be a bit too big to do that, but it is really nice to have a single document you can ctrl+f in, rather than having multiple tabs and pages open |
13:12:10 | FromDiscord | <Dale> also the doc generator would probably need to be reworked for that |
13:13:18 | FromDiscord | <Dale> Overall the nim docs aren't that bad at all, just that some specific things can be tricky to find |
13:13:58 | FromDiscord | <Dale> And to be honest, I think that's mostly because the language is still a bit volatile and experimental |
13:14:39 | FromDiscord | <Dale> So really, when you choose to program in Nim you have already signed up for those kind of issues |
13:16:08 | FromDiscord | <Dale> That's the way I see it anyways. I love the Nim syntax, and I like a lot of other features, but I'm still not 100% sure whether I should use C++ for my project. I want to use Nim so I'm continuing, but I have this nagging feeling that I might one day run into something and flip the table |
13:17:10 | FromDiscord | <Dale> I'd rather that not happen though, and I'm optimistic that Araq and the other contributors can figure stuff out |
13:36:55 | * | arkurious joined #nim |
13:43:22 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=4585 |
13:43:47 | FromDiscord | <lantos> (edit) "https://play.nim-lang.org/#ix=4585" => "https://play.nim-lang.org/#ix=4586" |
13:43:59 | FromDiscord | <lantos> (edit) "https://play.nim-lang.org/#ix=4586" => "https://play.nim-lang.org/#ix=4587" |
13:55:10 | FromDiscord | <hotdog> In reply to @lantos "<@107140179025735680> Hey, with": What error are you getting? |
14:03:14 | NimEventer | New post on r/nim by _culito_: Is Nim a good language to write Linux TUI applications?, see https://reddit.com/r/nim/comments/w5berx/is_nim_a_good_language_to_write_linux_tui/ |
14:13:18 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=458h |
14:17:19 | FromDiscord | <hotdog> sent a code paste, see https://play.nim-lang.org/#ix=458i |
14:20:08 | FromDiscord | <lantos> thanks,↵but think the coercion might not be the right way of doing it because if I need to serialize and send the object out I'll need to re-capitalize the object. |
14:22:13 | FromDiscord | <hotdog> In reply to @lantos "thanks, but think the": As long as the api is consistent that would work |
14:44:53 | * | rockcavera joined #nim |
14:44:53 | * | rockcavera quit (Changing host) |
14:44:53 | * | rockcavera joined #nim |
15:17:07 | FromDiscord | <christallo> hi |
15:17:20 | FromDiscord | <christallo> is there any plane to add support for zgc in nim? |
15:18:51 | FromDiscord | <Yardanico> I don't think so, ORC is expected to become the default and there are no experiments with new GCs |
15:18:56 | FromDiscord | <Yardanico> why specifically do you want zgc? |
15:24:22 | FromDiscord | <christallo> just looking for easy to implement automatic memory managment algorithms usable in realtime systems |
15:24:25 | FromDiscord | <christallo> (edit) "just looking for easy to implement automatic memory managment algorithms usable in ... realtime" added "hard" |
15:24:40 | FromDiscord | <Yardanico> well, ARC is usable in hard-realtime although it means that cycles will leak |
15:26:24 | FromDiscord | <sOkam!> In reply to @Rika "Youre missing that though": if i use dynlyb, it requires exportc. but im not exporting, afaik? |
15:26:42 | FromDiscord | <sOkam!> (edit) "dynlyb," => "dynlib," |
15:27:00 | FromDiscord | <Rika> im not sure what you're trying to do sorry |
15:27:15 | FromDiscord | <sOkam!> build a dll made with nim, to connect with a c binary |
15:27:31 | FromDiscord | <Rika> and you want those two functions to be seen in the dynlib |
15:27:35 | FromDiscord | <sOkam!> the binary compiles separately, and its written in c |
15:27:37 | FromDiscord | <Rika> so you have to export them |
15:28:07 | FromDiscord | <sOkam!> but isn't exportc something for compiling to C code, not library? |
15:28:15 | FromDiscord | <sOkam!> i assumed that, maybe i misunderstood |
15:29:26 | FromDiscord | <Rika> sent a code paste, see https://paste.rs/W4x |
15:29:45 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=458N |
15:30:42 | FromDiscord | <sOkam!> yea, definitely misread. tysm |
15:31:23 | FromDiscord | <Rika> yeah its usually in the manual |
15:33:00 | FromDiscord | <!Patitotective> is there a way to make the `{key: val, ...}` syntax create a sequence of tuples instead of an array so they can have different lenght ? (~~macros~~) |
15:34:04 | FromDiscord | <!Patitotective> :oooo `@{key: val, ...}` wors |
15:34:06 | FromDiscord | <!Patitotective> (edit) "wors" => "works" |
15:34:07 | FromDiscord | <!Patitotective> amazing |
15:34:53 | FromDiscord | <Yardanico> In reply to @Patitotective "amazing": yes, because @ is a proc in system and {} makes an array of tuples |
15:35:10 | FromDiscord | <!Patitotective> beautiful |
15:35:14 | FromDiscord | <ajusa> Is there an easy way to see why a module is being imported? Something is importing linenoise in my code and I want to figure out where it's coming from |
15:50:40 | FromDiscord | <sOkam!> Callback Hype #moment https://media.discordapp.net/attachments/371759389889003532/1000067362948644904/unknown.png |
15:57:14 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=458U |
15:57:27 | FromDiscord | <!Patitotective> are if else statements forbidden in formatted strings? |
16:12:59 | FromDiscord | <demotomohiro> Maybe `:` is special character in strformat and you cannot use any expressions contains `:`. |
16:13:52 | FromDiscord | <Rika> it is |
16:13:56 | FromDiscord | <Rika> its used for formatting |
16:14:29 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4592 |
16:16:38 | FromDiscord | <!Patitotective> :[[[[ |
16:18:23 | FromDiscord | <sOkam!> omegaSadge emoji |
16:18:37 | FromDiscord | <!Patitotective> ye |
16:20:29 | FromDiscord | <!Patitotective> there are no workarounds? :[ |
16:24:14 | FromDiscord | <Require Support> whats the syntax for getting last x characters of a string ? |
16:24:16 | FromDiscord | <Rika> no |
16:24:27 | FromDiscord | <Rika> that wasnt to you, req |
16:25:32 | FromDiscord | <Prestige> sent a code paste, see https://play.nim-lang.org/#ix=4594 |
16:25:36 | FromDiscord | <Prestige> here you get the last 2 characters |
16:25:45 | FromDiscord | <Rika> you could just ^1 though |
16:25:51 | FromDiscord | <Rika> why the foo.high |
16:26:11 | FromDiscord | <Prestige> ^1 would get you just the last character |
16:26:28 | FromDiscord | <!Patitotective> In reply to @Patitotective "there are no workarounds?": putting everything around parenthesis just works :DDDDDDDDdd |
16:26:42 | FromDiscord | <!Patitotective> In reply to @Avahe "^1 would get you": rika meant `foo[^2..^1]` |
16:26:48 | FromDiscord | <Prestige> oh, idk |
16:26:52 | FromDiscord | <Prestige> that works too lol |
16:37:39 | FromDiscord | <demotomohiro> Workaround for strformat `:` problem is create a new strformat that doesnt use `:` for formatting. |
16:39:15 | FromDiscord | <treeform> In reply to @lantos "<@107140179025735680> Hey, with": If you control the json, you should just make it match your objects. |
16:39:46 | FromDiscord | <!Patitotective> In reply to @demotomohiro "Workaround for strformat `:`": it was already solved and now you can use `:` inside parenthesis |
16:41:30 | FromDiscord | <Rika> oh yeah true its in the doc too |
16:41:30 | FromDiscord | <lantos> In reply to @treeform "If you control the": external API 😭 |
16:41:30 | FromDiscord | <Rika> `To enable evaluating Nim expressions within curlies, colons inside parentheses do not need to be escaped. ` |
16:43:53 | FromDiscord | <demotomohiro> @!Patitotective oh, I didn't know that. |
17:23:44 | * | wallabra_ joined #nim |
17:23:51 | * | wallabra quit (Ping timeout: 244 seconds) |
17:27:17 | * | wallabra joined #nim |
17:28:29 | * | wallabra_ quit (Ping timeout: 268 seconds) |
17:33:09 | FromDiscord | <Mike> sent a code paste, see https://play.nim-lang.org/#ix=459i |
17:33:42 | FromDiscord | <Mike> It waits like I would expect it to... but there's no vim. It acts like it's launched invisibly somewhere and I have to ctl-c to exit |
17:34:07 | FromDiscord | <Mike> I can launch firefox or something and it works just like I'd expect |
17:37:08 | FromDiscord | <Mike> Wait, got it! |
17:37:14 | FromDiscord | <Mike> `let p = startProcess("/usr/bin/nvim", options = {poParentStreams})` |
17:37:20 | FromDiscord | <sOkam!> In reply to @Mike "It waits like I": vim exists in a terminal window↵you'll need to launch that from the startprocess call, i understand↵what i do with alacritty is `alacritty -l nvim` |
17:39:55 | FromDiscord | <ghoom> is https://nim-lang.org/docs/nep1.html the most style nimmers use? |
17:40:02 | FromDiscord | <ghoom> (edit) "is https://nim-lang.org/docs/nep1.html the most ... style" added "common" |
17:40:16 | FromDiscord | <huantian> mhnm |
17:40:29 | FromDiscord | <ghoom> lonml |
17:40:38 | FromDiscord | <Mike> Hmm, so that does work too. It launches in a separate instance |
17:40:39 | FromDiscord | <Mike> Using `poParentStreams` launches in the same terminal window, which in that case is what I want. But that's still useful |
17:43:17 | * | wallabra quit (Ping timeout: 268 seconds) |
17:43:46 | FromDiscord | <!Patitotective> In reply to @ghoom "is https://nim-lang.org/docs/nep1.html the most": i think most people use what they feel looks better lol |
17:44:22 | FromDiscord | <ghoom> In reply to @Patitotective "i think most people": yeah but what's the most common "looks better" in repos? |
17:44:39 | FromDiscord | <ghoom> (edit) ""looks" => ""what they feel looks" |
17:45:15 | FromDiscord | <ghoom> also i just noticed that you're not Patitotective |
17:46:09 | FromDiscord | <!Patitotective> 👀 how |
17:47:02 | FromDiscord | <ghoom> cuz i'm a gamer |
17:47:04 | FromDiscord | <ghoom> i mean a programmer |
17:47:27 | FromDiscord | <!Patitotective> In reply to @ghoom "yeah but what's the": i think types with pascal case, everything else with camel case is the biggest convention lol |
17:48:11 | * | wallabra joined #nim |
17:48:14 | FromDiscord | <!Patitotective> you can always see if github has api for "looking at code" and analyse it and find the most common patterns 😁 |
17:48:24 | FromDiscord | <!Patitotective> In reply to @ghoom "also i just noticed": who am i then |
17:48:35 | FromDiscord | <ghoom> In reply to @Patitotective "who am i then": you're false |
17:48:49 | FromDiscord | <ghoom> cuz Patitotective's truth value is true |
17:49:02 | FromDiscord | <ghoom> cuz it's an object |
17:49:04 | FromDiscord | <Dale> Can you overload `!` in nim? |
17:49:12 | FromDiscord | <Rika> Yeah sure |
17:49:23 | FromDiscord | <Dale> Or rather, overload the boolean value of a type |
17:49:40 | FromDiscord | <Rika> Nim does not have truthiness |
17:49:44 | FromDiscord | <ghoom> In reply to @Dale "Can you overload `!`": nim has `not` instead of `!` btw |
17:49:44 | FromDiscord | <Dale> You can do that in C++ I think |
17:50:05 | FromDiscord | <Rika> Nim values do not implicitly have a Boolean value by default |
17:50:16 | FromDiscord | <Rika> 1 is not true and 0 is not false by default |
17:50:23 | FromDiscord | <ghoom> 🤔 |
17:50:30 | FromDiscord | <Dale> Ah yeah, I tried to do `if obj:` and it didn't work |
17:50:37 | FromDiscord | <Rika> unless you convert explicitly I mean |
17:50:42 | FromDiscord | <Dale> Which is kinda annoying, but I get why it's not a thing |
17:50:48 | FromDiscord | <ghoom> In reply to @Dale "Which is kinda annoying,": why |
17:51:13 | FromDiscord | <Dale> Because nullchecks in the form of `if obj:` are really quick to read & write |
17:51:28 | FromDiscord | <Rika> Well value types don’t have a null |
17:51:44 | FromDiscord | <Dale> but from what I can tell null/nil isnot very well liked by nim users |
17:51:49 | FromDiscord | <huantian> meh not really I always get confused when people do that, I haveto check what type `obj` is to see what that means |
17:51:53 | FromDiscord | <Dale> (edit) "isnot" => "is not" |
17:52:44 | FromDiscord | <!Patitotective> `isNil` is much clearer |
17:53:03 | FromDiscord | <ghoom> "nil" reminds me of lua |
17:53:38 | FromDiscord | <ghoom> the first time i ever heard that word is when i started using lua |
17:54:16 | FromDiscord | <Dale> It's basically the same as null, but different from false (in Lua) |
17:54:54 | FromDiscord | <Dale> which is handy, you can store false in tables (can actually store nil but it's convoluted and not really used much) |
17:55:13 | FromDiscord | <ghoom> > (can actually store nil but it's convoluted and not really used much)↵lol |
17:55:27 | FromDiscord | <ghoom> true |
17:55:30 | FromDiscord | <ghoom> (pun intended) |
17:56:03 | FromDiscord | <Tuatarian> Anyone have any experience with Odin? |
17:56:06 | FromDiscord | <Tuatarian> (language) |
17:58:39 | FromDiscord | <Rika> A small small bit |
17:58:43 | FromDiscord | <Rika> I just looked at it |
17:59:38 | FromDiscord | <ghoom> what does a procedure type expression look like? |
18:00:09 | FromDiscord | <huantian> `let a: proc(x: int, y: string): float = ...` |
18:02:02 | FromDiscord | <!Patitotective> i think they meant in odin lol |
18:02:10 | FromDiscord | <!Patitotective> unless thats odin |
18:02:11 | FromDiscord | <!Patitotective> is it? |
18:02:23 | FromDiscord | <Tuatarian> No |
18:02:41 | FromDiscord | <Tuatarian> I think ghoom as asking about nim tho |
18:02:51 | FromDiscord | <ghoom> ye |
18:02:52 | FromDiscord | <Tuatarian> In reply to @huantian "`let a: proc(x: int,": I don't know why but I find this really funny |
18:03:17 | FromDiscord | <Tuatarian> I know super little about nim but it seems similar to nim in some ways but different in others |
18:03:38 | FromDiscord | <Tuatarian> Much more emphasis on manual memory management which I generally like |
18:04:02 | FromDiscord | <Tuatarian> At the same time, that has notable downsides |
18:04:42 | FromDiscord | <!Patitotective> leaks lol |
18:05:08 | FromDiscord | <Tuatarian> I mean, if you accidentally have a cyclic ref in ARC you're leaking anyway |
18:05:42 | FromDiscord | <huantian> that's why you use orc 😛 |
18:05:43 | FromDiscord | <Tuatarian> And (example) I'm not sure how to do something like an arena in nim simply because I basically never use manual allocation |
18:06:17 | FromDiscord | <Tuatarian> Orc is great, no complaints :) |
18:06:53 | FromDiscord | <Tuatarian> How do you actually do a virtual arena in nim? |
18:07:53 | FromDiscord | <huantian> I mean you can just allocate a bunch of memory manually |
18:08:09 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=459A |
18:08:52 | FromDiscord | <lantos> (edit) "https://play.nim-lang.org/#ix=459A" => "https://play.nim-lang.org/#ix=459B" |
18:08:54 | FromDiscord | <Tuatarian> How do you dole out the allocated memory? |
18:09:01 | FromDiscord | <Tuatarian> Also lantos what am I looking at? |
18:09:11 | FromDiscord | <lantos> (edit) "https://play.nim-lang.org/#ix=459B" => "https://play.nim-lang.org/#ix=459C" |
18:09:13 | FromDiscord | <Tuatarian> Mb I missed the edits |
18:11:47 | FromDiscord | <Rika> Can you provide a full running snippet to replicate |
18:11:53 | FromDiscord | <Rika> Including usage |
18:12:07 | FromDiscord | <huantian> In reply to @iWonderAboutTuatara "How do you dole": I don't know how you woulld in other langs so I have no idea 😛 |
18:13:00 | FromDiscord | <huantian> you could probably do the same thing as with other langs |
18:13:13 | FromDiscord | <lantos> sure |
18:14:06 | FromDiscord | <huantian> In reply to @lantos "Is there away to": your generic constraint seems wrong btw, `T: void` means `T` can only be `void` |
18:19:43 | FromDiscord | <lantos> sent a code paste, see https://paste.rs/2CY |
18:20:12 | FromDiscord | <lantos> (edit) "https://play.nim-lang.org/#ix=459J" => "https://play.nim-lang.org/#ix=459I" |
18:23:21 | FromDiscord | <!Patitotective> how do i move an element of a sequence? do i delete it and insert it in other place? |
18:25:30 | FromDiscord | <ghoom> In reply to @Patitotective "how do i move": that's the definition of "move" anyway |
18:25:42 | FromDiscord | <wiga> the https://media.discordapp.net/attachments/371759389889003532/1000106376342814820/unknown.png |
18:26:40 | FromDiscord | <ghoom> In reply to @wiga "the": is `HttpMethod` an enum? |
18:27:13 | FromDiscord | <wiga> i copy pasted from the doc |
18:27:18 | FromDiscord | <wiga> 🤷♂️ |
18:27:44 | FromDiscord | <ghoom> can you show me? |
18:27:56 | FromDiscord | <ghoom> (edit) "show me?" => "link me to it?" |
18:28:05 | FromDiscord | <wiga> https://media.discordapp.net/attachments/371759389889003532/1000106976858091611/unknown.png |
18:28:25 | FromDiscord | <ghoom> yeah it should be `httpMethod` not `HttpMethod` |
18:28:28 | FromDiscord | <ghoom> i think |
18:28:38 | FromDiscord | <wiga> real |
18:28:53 | FromDiscord | <wiga> https://media.discordapp.net/attachments/371759389889003532/1000107178717347882/unknown.png |
18:29:15 | FromDiscord | <wiga> nvm |
18:29:20 | FromDiscord | <demotomohiro> In nim, first character of a word is case sensitive. |
18:29:35 | FromDiscord | <wiga> final boss https://media.discordapp.net/attachments/371759389889003532/1000107354819407922/unknown.png |
18:29:53 | FromDiscord | <huantian> can you show more of the code |
18:30:07 | FromDiscord | <wiga> https://media.discordapp.net/attachments/371759389889003532/1000107489695645706/unknown.png |
18:30:07 | FromDiscord | <ghoom> below |
18:30:10 | FromDiscord | <!"Dialz_†> jonj |
18:30:36 | FromDiscord | <huantian> put a discard after the comment before hit |
18:31:01 | FromDiscord | <ghoom> `discard` is like `pass` in python |
18:31:02 | FromDiscord | <wiga> ty |
18:31:17 | FromDiscord | <wiga> In reply to @ghoom "`discard` is like `pass`": or ; in java |
18:31:18 | FromDiscord | <ghoom> it can substitute statements |
18:31:23 | FromDiscord | <ghoom> ye |
18:31:29 | FromDiscord | <!Patitotective> In reply to @ghoom "that's the definition of": 🧐 |
18:31:36 | FromDiscord | <ghoom> 🐸 |
18:43:48 | FromDiscord | <ghoom> is there a nim personification yet? preferably an anime girl |
18:45:10 | FromDiscord | <demotomohiro> https://github.com/nim-lang/RFCs/issues/104 |
18:45:35 | FromDiscord | <ghoom> oh wow |
18:46:49 | FromDiscord | <ghoom> if nim was an anime girl, it would be 1000% better imo |
18:52:58 | FromDiscord | <gat0r> Needs to be an anime girl. That thing is trash |
18:53:59 | FromDiscord | <ghoom> In reply to @gat0r "Needs to be an": https://tenor.com/view/dap-handshake-dap-me-up-secret-handshake-friends-gif-21759511 |
18:55:47 | FromDiscord | <ghoom> how do i make a method be defined at run-time only if an object case is met? |
19:03:37 | FromDiscord | <scemino> sent a long message, see http://ix.io/459V |
19:04:19 | FromDiscord | <ghoom> In reply to @scemino "Hi I'm <@691628504659394560> ,": doesn't `include` work? |
19:04:52 | FromDiscord | <Prestige> In reply to @ghoom "if nim was an": If our mascot became an anime girl I'd delete all my nim code |
19:05:05 | FromDiscord | <ghoom> In reply to @Avahe "If our mascot became": 😈 |
19:05:22 | FromDiscord | <exelotl> In reply to @gat0r "Needs to be an": wtf don't diss nimi |
19:06:02 | FromDiscord | <exelotl> now the honeybadger... _that_ is trash :P |
19:06:12 | FromDiscord | <ghoom> XD |
19:07:14 | FromDiscord | <ghoom> In reply to @Avahe "If our mascot became": cmon man↵anime and programming go together well these days |
19:07:28 | FromDiscord | <dom96> We should use the donations to commission a Nim manga |
19:07:29 | FromDiscord | <scemino> In reply to @ghoom "doesn't `include` work?": I don't know but there is no issue with `include` ? Do you have an example ? |
19:08:00 | FromDiscord | <dom96> so many new people here, where did you come from? |
19:08:20 | FromDiscord | <ghoom> In reply to @scemino "I don't know but": cuz `include` literally just puts some file's content in another↵so theoretically it A should be able to see B and vice versa |
19:08:24 | FromDiscord | <Prestige> In reply to @ghoom "cmon man anime and": No that's just a dirty lie weebs want you to believe |
19:08:32 | FromDiscord | <ghoom> 😭 |
19:08:40 | FromDiscord | <ghoom> heart attack |
19:08:53 | FromDiscord | <ghoom> (edit) "theoretically it" => "theoretically," |
19:09:15 | FromDiscord | <!Patitotective> In reply to @ghoom "how do i make": you dont lmao |
19:09:24 | FromDiscord | <ghoom> rip |
19:09:42 | FromDiscord | <!Patitotective> actually i dont know↵cant you just `case kind` |
19:10:02 | FromDiscord | <ghoom> In reply to @Patitotective "actually i dont know": i can't define methods that way |
19:10:18 | FromDiscord | <ghoom> i can just declare proc properties |
19:10:20 | FromDiscord | <ghoom> (edit) "i can just declare proc properties ... " added "that way" |
19:10:23 | FromDiscord | <!Patitotective> yea but inside the method it does something if its of a kind and nothing otherwise |
19:10:57 | FromDiscord | <Generic> I don't think having an official Nim-chan would hurt |
19:11:06 | FromDiscord | <ghoom> In reply to @Generic "I don't think having": thank you 😭 |
19:11:13 | FromDiscord | <ghoom> (edit) "😭" => "😭👍" |
19:11:35 | FromDiscord | <ghoom> In reply to @Patitotective "yea but inside the": yea but the method would be defined regardless of the case |
19:11:39 | FromDiscord | <ghoom> (edit) "defined" => "run-time-defined" |
19:11:53 | FromDiscord | <ghoom> that's my only solution |
19:11:55 | FromDiscord | <ghoom> ¯\_(ツ)_/¯ |
19:12:16 | FromDiscord | <Generic> just it'd need to be additionally to another mascot normal people can empathize with |
19:12:33 | FromDiscord | <scemino> In reply to @ghoom "cuz `include` literally just": If B includes A, can I import A in an another file ? or I would have A declared twice ? And if not can I import B somewhere else ? |
19:13:10 | FromDiscord | <ghoom> In reply to @scemino "If B includes A,": just put one of the types in a file then include it in place of where the type was |
19:13:35 | FromDiscord | <!Patitotective> In reply to @ghoom "yea but the method": i dont think you can define procedures at run-time |
19:14:14 | FromDiscord | <Prestige> In reply to @Generic "I don't think having": It would |
19:14:26 | FromDiscord | <ghoom> sent a code paste, see https://play.nim-lang.org/#ix=459X |
19:14:37 | FromDiscord | <!Patitotective> In reply to @Avahe "It would": i agree↵a cute animal would be way better |
19:14:50 | FromDiscord | <ghoom> we need a poll |
19:15:13 | FromDiscord | <!Patitotective> ~~pool cause youre a frog jksdf~~ |
19:15:25 | FromDiscord | <ghoom> 🐸 |
19:15:44 | FromDiscord | <ghoom> insert kermit suicide gif here |
19:16:20 | FromDiscord | <scemino> sent a code paste, see https://play.nim-lang.org/#ix=459Y |
19:16:42 | FromDiscord | <demotomohiro> If you want to add some code at runtime, Nimscripter might help you:↵https://github.com/beef331/nimscripter |
19:17:22 | FromDiscord | <huantian> In reply to @ghoom "doesn't `include` work?": no stop no include bad |
19:17:48 | FromDiscord | <ghoom> In reply to @huantian "no stop no include": why |
19:17:51 | FromDiscord | <scemino> In reply to @huantian "no stop no include": What do you propose ? |
19:18:07 | FromDiscord | <ghoom> squints eyes |
19:18:38 | FromDiscord | <huantian> In reply to @ghoom "why": because you will get things that do things that you don't expect |
19:18:45 | FromDiscord | <huantian> and your code will become harder and harder to read |
19:19:01 | FromDiscord | <huantian> if you have circular dependencies either use a delayed import or combine your files/type definition blocks |
19:20:53 | FromDiscord | <ghoom> what is a delayed import? |
19:23:29 | FromDiscord | <scemino> In reply to @huantian "if you have circular": Same question do you have an example ? |
19:28:17 | FromDiscord | <huantian> how do the objects depend on each other again? |
19:28:46 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=45a3 |
19:29:17 | FromDiscord | <Phil> Count me in on curiosity for "clean" solutions for circular dependencies.↵I have some of those in my database (characters that are members of a specific organizations but also organizations that have a specific character as a leader).↵That leads to circular dependencies in the corresponding norm models.↵My "solution" was to make a private redefinition of the type that omits the problematic field, that suffices for norm. |
19:29:29 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=45a4 |
19:29:34 | FromDiscord | <!Patitotective> ghoom |
19:31:35 | FromDiscord | <scemino> sent a code paste, see https://play.nim-lang.org/#ix=45a7 |
19:32:17 | FromDiscord | <Phil> So a layer wants to hold a ref to the room it is inside of, and room wants to hold references to all layers inside of it? |
19:32:28 | FromDiscord | <huantian> in that case you have to have both definitions in the same `type` block for that to work iirc |
19:32:35 | FromDiscord | <scemino> I have maybe too much circular dependencies like this, but still... |
19:32:50 | FromDiscord | <huantian> I would recommend you make a `types.nim` file that hold this type definition, and write procs that work on them elsewhere |
19:33:34 | FromDiscord | <scemino> I tried this but I had some issues (I don't remember what) |
19:34:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=45a9 |
19:35:00 | FromDiscord | <scemino> yes but I had some issues with methods for these types |
19:35:08 | FromDiscord | <scemino> I will try to find a concrete example |
19:35:23 | FromDiscord | <Phil> Is there ever a clean solution for circular imports btw? |
19:36:09 | FromDiscord | <scemino> In reply to @huantian "I would recommend you": all procs in the same files ? or is it possible to split in several files ? |
19:36:22 | FromDiscord | <huantian> it should be |
19:36:38 | FromDiscord | <huantian> as long as the procs themselves dont' circularly depend on each other |
19:37:07 | FromDiscord | <Phil> Time for layers of proc recursion |
19:37:25 | FromDiscord | <scemino> that's sad it's not easy as `Java`or `C#` |
19:37:53 | FromDiscord | <huantian> In reply to @Isofruit "Is there ever a": I think? |
19:38:15 | FromDiscord | <huantian> I swear there is something |
19:41:08 | FromDiscord | <Phil> sent a long message, see http://ix.io/45ab |
19:41:21 | FromDiscord | <Phil> (edit) "http://ix.io/45ab" => "http://ix.io/45ac" |
19:42:09 | FromDiscord | <Phil> (edit) "http://ix.io/45ac" => "http://ix.io/45ad" |
19:42:19 | FromDiscord | <scemino> sent a code paste, see https://play.nim-lang.org/#ix=45ae |
19:42:37 | FromDiscord | <Phil> Could you throw in the whole code? |
19:42:52 | FromDiscord | <Phil> I see an if statement of a custom proc and a lot of custom types |
19:43:00 | FromDiscord | <Phil> I can't really say much about that |
19:43:16 | FromDiscord | <Kermithos> In reply to @scemino "Another weird problem, if": did u already try to delete the cache? |
19:44:09 | FromDiscord | <Phil> or rather, can you replicate this in a minimal example |
19:44:12 | FromDiscord | <scemino> In reply to @Isofruit "Could you throw in": Yes https://media.discordapp.net/attachments/371759389889003532/1000126134828138587/generaltool.nim |
19:45:51 | FromDiscord | <!Patitotective> In reply to @scemino "Another weird problem, if": imgui 👀 |
19:45:56 | FromDiscord | <Phil> Where does igBegin come from? |
19:47:21 | FromDiscord | <scemino> In reply to @Isofruit "Where does igBegin come": wrapper to cimgui (https://github.com/cimgui/cimgui) |
19:47:53 | FromDiscord | <!Patitotective> are you compiling to c or cpp? |
19:48:17 | FromDiscord | <scemino> cpp |
19:50:28 | FromDiscord | <Phil> ... don't you have to import cimgui somewhere ? |
19:50:44 | FromDiscord | <!Patitotective> yea you should be doing `import imgui` |
19:50:55 | FromDiscord | <!Patitotective> or `nimgl/imgui` |
19:51:05 | FromDiscord | <Phil> disclaimer: Not knowledgeable about c++ usage in nim, I barely have some c usage in nim knowledge |
19:51:30 | FromDiscord | <!Patitotective> well its actually a c wrapper so |
19:51:47 | FromDiscord | <Phil> Just trying to first figure out where you'd get the symbol definition from in the first place, and if that's within cimgui then you'd need to somehow get access to cimgui first I'd think |
19:51:53 | FromDiscord | <scemino> Here is the result https://media.discordapp.net/attachments/371759389889003532/1000128066607132762/engge2.png |
19:52:25 | FromDiscord | <!Patitotective> so it compiles?? |
19:52:35 | FromDiscord | <Phil> Is ↵> import ../../libs/imgui↵Your custom wrapper of cimgui? |
19:52:57 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=45ag |
19:53:47 | FromDiscord | <lantos> (edit) "https://play.nim-lang.org/#ix=45ag" => "https://play.nim-lang.org/#ix=45ah" |
19:53:53 | FromDiscord | <lantos> (edit) "https://play.nim-lang.org/#ix=45ah" => "https://play.nim-lang.org/#ix=45ai" |
19:54:06 | FromDiscord | <scemino> sent a code paste, see https://play.nim-lang.org/#ix=45aj |
19:54:27 | FromDiscord | <Phil> In reply to @lantos "<@259277943275126785> worked it out": Out of curiosity, would this also compile with just T since T itself should be a typedesc? |
19:54:40 | FromDiscord | <Phil> (edit) "In reply to @lantos "<@259277943275126785> worked it out": Out of curiosity, would this also compile with just T ... since" added "instead of T.typedesc" |
19:55:01 | FromDiscord | <lantos> yeah it should be but it wasn't liking it so I threw .typedesc in and it stopped complaining |
19:55:17 | FromDiscord | <scemino> In reply to @Isofruit "Is > import": Yes I had to, because I wanted to use SDL2 also and I didn't find anything with SDL2 and dear imgui in nim. |
19:56:12 | FromDiscord | <Phil> In reply to @scemino "Yes I had to,": Ahhhh so that's how you get the symbol ifBegin defined.↵You imgui module has such a proc. Question, is your igBegin definition generic? |
19:57:58 | FromDiscord | <Phil> I'm asking because if you have a generic and it is never used with a specific type, then the code for a proc that deals with that specific type is never generated |
19:58:40 | FromDiscord | <Phil> And if I'm reading this right an external cpp file is trying to access the proc, am I comprehending that right? |
19:58:42 | * | kenran joined #nim |
19:59:38 | FromDiscord | <scemino> sent a code paste, see https://play.nim-lang.org/#ix=45al |
20:00:59 | FromDiscord | <Phil> I think this might be reaching the very limited extent of my troubleshooting knowledge for that area.↵I can recommend other folks to you, or preparing some small-ish example to post it on the forum.↵Or lantos/Patito have an idea on helping you out |
20:01:45 | FromDiscord | <scemino> In reply to @Isofruit "I think this might": Sounds good thank you, I will share my project on github when it will be more mature. |
20:02:01 | FromDiscord | <!Patitotective> yes, complete code would be useful |
20:04:05 | FromDiscord | <scemino> Last question, are you able to debug nim project ? |
20:04:25 | FromDiscord | <Phil> Define debug? |
20:05:47 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=45am |
20:05:54 | FromDiscord | <scemino> sorry to use a debugger |
20:06:40 | FromDiscord | <scemino> do step in/step out/step over on nim files, watch variables, stack, memory and so on |
20:08:11 | FromDiscord | <demotomohiro> https://internet-of-tomohiro.netlify.app/nim/gdb.en.html↵This might help you to use gdb to debug Nim code. But it is bit old. |
20:08:11 | FromDiscord | <Phil> You can use typical C debuggers it appears:↵https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html#using-code-writestacktrace-code |
20:09:28 | FromDiscord | <Phil> out of curiosity demo, how much of a pain is using GDB and the like? |
20:10:17 | FromDiscord | <Phil> Compared to quick and dirty "echo out fvalue" |
20:10:21 | FromDiscord | <scemino> yes I found this https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html but I wanted to use vscode |
20:11:02 | FromDiscord | <demotomohiro> I usually use echo rather than gdb. |
20:11:04 | FromDiscord | <scemino> I'm using echo and it is really painful |
20:13:25 | FromDiscord | <scemino> run code, modify code to do an echo, run the program, wait to be at the exact moment where I want to reproduce a problem, then I realize that my echo is not enough, I didn't echo all the values needed, and start from the beginning over and over, really painful, sorry but I found that a debugger is really useful. |
20:14:09 | FromDiscord | <Phil> No need to convince me, I write java at work which lives and dies on its debuggers, just never used them in a nim context |
20:14:51 | FromDiscord | <huantian> The vscode extension has instructions on using a debugger |
20:16:24 | FromDiscord | <Phil> > can confirm that debugging native code is possible with this extension (at least Linux GDB)↵Huh |
20:16:33 | FromDiscord | <scemino> In reply to @huantian "The vscode extension has": Which one ? Maybe I don't use the correct one |
20:16:37 | FromDiscord | <Phil> That's from the nimsaem extension |
20:19:51 | FromDiscord | <!Patitotective> i use perf so i can visualize it with https://profiler.firefox.com |
20:21:09 | FromDiscord | <!Patitotective> oh, actually its profile not debug :p |
20:30:51 | FromDiscord | <wiga> i have a little problem, when it makes the request after it sent it, the program idle but in the code its suppose to stop |
20:31:17 | FromDiscord | <wiga> any idea of what's the cause? |
20:31:22 | FromDiscord | <wiga> i use httpclient |
20:32:24 | FromDiscord | <Phil> In reply to @wiga "i have a little": Sounds like you're sending an asynchronous request when you're expecting it to behave like a synchronous one.↵Do you have a small code snippet to show? |
20:33:07 | FromDiscord | <wiga> sent a code paste, see https://play.nim-lang.org/#ix=45aq |
20:33:09 | FromDiscord | <wiga> i dont want to get the response |
20:33:31 | FromDiscord | <wiga> but i cant use it if i dont assign it |
20:34:14 | FromDiscord | <Phil> First things first, because I fear we might be running into language issues here |
20:34:30 | FromDiscord | <wiga> a |
20:34:32 | FromDiscord | <Phil> You're familiar with async vs sync code? |
20:34:40 | FromDiscord | <wiga> uh depends |
20:35:01 | FromDiscord | <wiga> i know when you use async you have to await the thing |
20:35:15 | FromDiscord | <wiga> and sync you dont have to bother |
20:35:17 | FromDiscord | <Phil> Well, you don't have to, but it's an option, but alrighty |
20:35:29 | FromDiscord | <scemino> In reply to @Isofruit "That's from the nimsaem": Oh great it works 👏 |
20:35:47 | FromDiscord | <Phil> I assume the type of client is `HttpClient` ? |
20:35:53 | FromDiscord | <wiga> yes |
20:36:00 | FromDiscord | <wiga> well ig |
20:36:14 | FromDiscord | <wiga> it is yes |
20:37:09 | FromDiscord | <Phil> Check. And the issue is it is moving on pas the line of ` res = client.request("http://localhost:9000/server", httpMethod = HttpPost, body = $body)` even though it hasn't received the response yet? |
20:37:34 | FromDiscord | <Phil> I'm not entirely sure how to interpret the sentence↵> i have a little problem, when it makes the request after it sent it, the program idle but in the code its suppose to stop |
20:37:36 | FromDiscord | <wiga> it sends the request |
20:37:40 | FromDiscord | <wiga> the server get it |
20:37:49 | FromDiscord | <wiga> but it seems to wait for a response |
20:37:57 | FromDiscord | <wiga> but it doesnt send a response |
20:38:04 | FromDiscord | <Phil> Ahhh, and you don't want it to wait for a response? |
20:38:13 | FromDiscord | <wiga> yes |
20:38:18 | FromDiscord | <wiga> exactly |
20:38:39 | FromDiscord | <Phil> So the server doesn't even send back an HTTP200 that the request succeeded? |
20:38:55 | FromDiscord | <wiga> it does by default |
20:39:00 | FromDiscord | <wiga> i use express for backend |
20:39:39 | FromDiscord | <Phil> I know it might be annoying that I'm asking this, I've just never seen a server that doesn't give any response to an HTTP request, you tend to always get one, if there's no content then at least HTTP200 to know that you didn't send the request into the void and nothing happened |
20:40:17 | FromDiscord | <Phil> In reply to @wiga "it does by default": Does "It does by default" here mean that you explicitly removed it? Or that it still does? |
20:40:57 | FromDiscord | <wiga> express sends a 200 by default if the request has been sent without error |
20:41:08 | FromDiscord | <wiga> i can specify it tho |
20:41:44 | FromDiscord | <Phil> That's fine, you stated you didn't care to send anything specific back, then all you need to do is send a response back that "Yes, Server has received request and done stuff as expected". |
20:41:56 | FromDiscord | <Phil> Which is the HTTP200 |
20:42:04 | FromDiscord | <wiga> i tried and it stills idle |
20:42:12 | FromDiscord | <wiga> it doesnt even show the response |
20:42:48 | * | kenran quit (Quit: WeeChat info:version) |
20:43:16 | FromDiscord | <Phil> Could you add some echos to your code to get an idea at which line it gets stuck? |
20:43:32 | FromDiscord | <Phil> Like, you are certain the binary gets stuck on the client.request proc? |
20:44:21 | FromDiscord | <wiga> https://media.discordapp.net/attachments/371759389889003532/1000141273388298360/unknown.png |
20:44:36 | FromDiscord | <wiga> it sent the request |
20:46:05 | FromDiscord | <wiga> is there other http client for sync requests? |
20:46:06 | * | jmdaemon joined #nim |
20:46:13 | FromDiscord | <wiga> or async idk |
20:46:54 | FromDiscord | <Phil> I don't think this is a client issue at first glance. It's just not receiving a response, I'll try to poke at my own backend with an HTTP request with nim and see if it works |
20:47:06 | FromDiscord | <wiga> alr |
20:48:08 | FromDiscord | <wiga> oh it worked |
20:48:23 | FromDiscord | <wiga> i made my backend send "allah" and it worked lmao |
20:48:48 | FromDiscord | <Phil> Check if you previously were actually returning HTTP200 by poking your backend via postman |
20:49:02 | FromDiscord | <wiga> https://media.discordapp.net/attachments/371759389889003532/1000142453438939286/unknown.png |
20:49:15 | FromDiscord | <Phil> Huh, nice |
20:49:22 | FromDiscord | <Phil> And you said you didn't care about the response? |
20:49:44 | FromDiscord | <Phil> If this is time critical, you could have that run async and move on with your actual code without having to wait for the request to complete |
20:50:10 | FromDiscord | <wiga> im gonna see if it makes a difference wait |
20:51:46 | FromDiscord | <wiga> it gets stuck somewhere else now |
20:53:58 | FromDiscord | <wiga> it get stuck on my pinger |
20:54:31 | FromDiscord | <wiga> i forgot a socket.close() 🤦♂️ |
20:55:37 | FromDiscord | <Phil> 😆 Yeh, it's always the little things that get us.↵Btw. you were doing this over websockets? |
20:55:52 | FromDiscord | <Phil> Or is that just expressjs syntax? |
20:56:06 | FromDiscord | <wiga> it generates a random ip, check if a minecraft server is open on it and if yes send the ip on my backend |
20:58:00 | FromDiscord | <ghoom> what's the diff between `uint` and `Natural`? |
20:58:28 | FromDiscord | <!Patitotective> Natural is a range from 0 to infinite↵uint is an actual unsigend integer |
20:58:54 | FromDiscord | <!Patitotective> nim recommends using natural so you dont have to implement all arithmetic stuff with uints |
20:59:04 | FromDiscord | <ghoom> you mean naturals are floats? |
20:59:22 | FromDiscord | <huantian> no naturals are ints with bounds checking |
20:59:30 | FromDiscord | <!Patitotective> `Natural = range[0 .. high(int)]` |
20:59:38 | FromDiscord | <ghoom> but you said infinite lmao |
20:59:48 | FromDiscord | <!Patitotective> ¯\_(ツ)_/¯ |
21:00:09 | FromDiscord | <ghoom> In reply to @Patitotective "`Natural = range[0 ..": but that's literally a uint |
21:00:13 | FromDiscord | <!Patitotective> nope |
21:00:18 | FromDiscord | <!Patitotective> uint takes less memory |
21:00:31 | FromDiscord | <ghoom> 😕 |
21:00:43 | FromDiscord | <!Patitotective> because in ints one bit is used to store the sign |
21:01:07 | FromDiscord | <ghoom> it's still there for uints tho |
21:01:19 | FromDiscord | <ghoom> uints ain't gonna be one bit smaller |
21:01:23 | FromDiscord | <huantian> here's one way to see it |
21:01:27 | FromDiscord | <!Patitotective> but one bit bigger |
21:01:30 | FromDiscord | <huantian> !echo Natural.high + 1 |
21:01:43 | FromDiscord | <huantian> !eval echo Natural.high +1; echo uint64.high + 1 |
21:01:46 | NimBot | Compile failed: /usercode/in.nim(1, 13) Error: type mismatch: got <typedesc[Natural], int literal(1)> |
21:01:56 | FromDiscord | <huantian> excuse mwa |
21:02:00 | FromDiscord | <ghoom> xd |
21:02:10 | FromDiscord | <huantian> oh I forgot a space |
21:02:11 | FromDiscord | <huantian> agh |
21:02:14 | FromDiscord | <!Patitotective> !eval echo Natural.high + 1; echo uint64.high + 1 |
21:02:18 | NimBot | /usercode/in.nim(1) in↵/playground/nim/lib/system/fatal.nim(53) sysFatal↵Error: unhandled exception: over- or underflow [OverflowDefect] |
21:02:30 | FromDiscord | <ghoom> but if the highest value for a natural is `high(int)`, doesnt that mean `uint`s are superior since they can store more? |
21:02:38 | FromDiscord | <huantian> no |
21:02:40 | FromDiscord | <ghoom> (edit) "more?" => "more positives?" |
21:02:41 | FromDiscord | <huantian> !eval echo uint64.high + 1 |
21:02:45 | NimBot | 0 |
21:02:50 | FromDiscord | <huantian> instead of raising an error when it overflows it does that |
21:02:55 | FromDiscord | <huantian> and then breaks your code |
21:03:34 | FromDiscord | <🐒🧠br4n_d0n> Natural has overflow checks to prevent unintended issues unlike uint |
21:03:41 | FromDiscord | <ghoom> ok cool |
21:03:44 | FromDiscord | <ghoom> tamks |
21:03:59 | FromDiscord | <!Patitotective> also using natural you can use every proc that uses int↵without having to cast |
21:04:26 | FromDiscord | <🐒🧠br4n_d0n> Can you elaborate? |
21:04:59 | FromDiscord | <ghoom> In reply to @Patitotective "!eval echo Natural.high +": someone needs to use slash commands |
21:05:09 | FromDiscord | <ghoom> (edit) "use" => "implement" | "implementslash commands ... " added "here" |
21:05:19 | FromDiscord | <huantian> yeah figure out how to get slash commands to work over in irc |
21:05:25 | FromDiscord | <huantian> then we can use slash commands 😛 |
21:05:39 | FromDiscord | <ghoom> irc? |
21:05:42 | FromDiscord | <!Patitotective> i mean↵if i procedure accepts an integer and you want to use it inside your own procedure that only accepts natural numbers you can pass the natural integer directly to the other procedure, meanwhile using unsigned integers require you to cast it to an integer |
21:05:57 | FromDiscord | <🐒🧠br4n_d0n> BTW ghoom, I like your avatar |
21:05:58 | FromDiscord | <!Patitotective> In reply to @ghoom "irc?": yes, discord is connected to irc |
21:06:11 | FromDiscord | <ghoom> In reply to @Patitotective "yes, discord is connected": bruh wtf |
21:06:22 | FromDiscord | <ghoom> y'all are high |
21:06:35 | FromDiscord | <ghoom> XD |
21:07:04 | FromDiscord | <!Patitotective> https://en.wikipedia.org/wiki/Internet_Relay_Chat |
21:07:12 | FromDiscord | <ghoom> i know what irc is |
21:07:28 | FromDiscord | <ghoom> i just don't know why you think discord relies on it |
21:07:32 | FromDiscord | <🐒🧠br4n_d0n> They have bots set to integrate Discord with Matrix and IRC |
21:07:55 | FromDiscord | <Phil> "discord is connected to irc" as in "this discord is connected to irc" |
21:08:03 | FromDiscord | <ghoom> In reply to @Isofruit ""discord is connected to": oooh ok |
21:08:18 | FromDiscord | <!Patitotective> 🧠 |
21:08:23 | FromDiscord | <ghoom> 🤯 |
21:08:32 | FromDiscord | <wiga> whats the equivalent of null? |
21:08:35 | FromDiscord | <!Patitotective> nil |
21:08:43 | FromDiscord | <wiga> https://media.discordapp.net/attachments/371759389889003532/1000147402533126164/unknown.png |
21:08:45 | FromDiscord | <Phil> That's why you'll find regularly people with the "bot" tag posting which sound suspiciously sentient, it's a running gag at this point |
21:08:56 | FromDiscord | <ghoom> In reply to @Patitotective "nil": i think that was a world record |
21:08:56 | FromDiscord | <huantian> `data.isNil` |
21:08:57 | FromDiscord | <!Patitotective> In reply to @wiga "": `data.isNil` |
21:09:27 | FromDiscord | <!Patitotective> In reply to @ghoom "i think that was": yes, i do nothing more but look at this channel cause im stuck with everything i try to do :p |
21:09:49 | FromDiscord | <wiga> what https://media.discordapp.net/attachments/371759389889003532/1000147678899994757/unknown.png |
21:09:54 | FromDiscord | <ghoom> In reply to @Patitotective "yes, i do nothing": 🤝 |
21:10:07 | FromDiscord | <!Patitotective> In reply to @wiga "what": what type is `data` |
21:10:12 | FromDiscord | <huantian> is `data` an `object` or a `ref object`↵(@wiga) |
21:10:12 | FromDiscord | <wiga> string |
21:10:18 | FromDiscord | <huantian> strings are never null |
21:10:20 | FromDiscord | <huantian> they're value types |
21:10:34 | FromDiscord | <!Patitotective> you can `data.len == 0` to check if it's empty |
21:10:35 | FromDiscord | <🐒🧠br4n_d0n> "" |
21:10:46 | FromDiscord | <Phil> In reply to @wiga "string": Are you aware of the difference between ref types and value types? |
21:11:03 | FromDiscord | <wiga> dude i started nim like yesterday |
21:11:17 | FromDiscord | <!Patitotective> you should read the tutorial https://nim-lang.org/docs/tut1.html |
21:11:20 | FromDiscord | <Phil> Wasn't meant accusatory, was more a general question whether I should dive into it |
21:11:43 | FromDiscord | <!Patitotective> and check the manual from time to time https://nim-lang.org/docs/manual.html |
21:11:56 | FromDiscord | <wiga> i always look at the docs |
21:11:58 | FromDiscord | <ghoom> In reply to @Patitotective "and check the manual": our bible |
21:12:00 | FromDiscord | <Phil> In reply to @wiga "dude i started nim": Alrighty, I'll do a quick deep dive about it. Have you written in other languages before? Other languages tend to have similar stuff |
21:12:09 | FromDiscord | <Phil> So I might be able to reference them to make it easier to understand |
21:12:18 | FromDiscord | <!Patitotective> In reply to @ghoom "our bible": our outdated and sometimes incomplete bible, yes |
21:12:46 | FromDiscord | <wiga> In reply to @Isofruit "Alrighty, I'll do a": idk i do nodejs, powershell, a bit of java, vbs(yes its old), html, css, js and other stuff |
21:13:03 | FromDiscord | <wiga> and python |
21:13:06 | FromDiscord | <Phil> In reply to @wiga "idk i do nodejs,": Java! Perfect, so you're familiar with the fact that java calls some types "primitives"? |
21:13:24 | FromDiscord | <ghoom> In reply to @wiga "idk i do nodejs,": > powershell↵🤝 |
21:13:27 | FromDiscord | <Phil> Have you heard of "pass by value" and "Pass by reference" in the context of function calls? |
21:13:33 | FromDiscord | <🐒🧠br4n_d0n> In reply to @Patitotective "our outdated and sometimes": ... it is in serious need of some love and think it needs to use more "plain language" to help beginners. https://en.wikipedia.org/wiki/Plain_language |
21:13:45 | FromDiscord | <wiga> In reply to @Isofruit "Java! Perfect, so you're": "a bit" means i started like 2 days ago and still understand alf of the stuff |
21:13:58 | FromDiscord | <wiga> (edit) "In reply to @Isofruit "Java! Perfect, so you're": "a bit" means i started like 2 days ago and still ... understand" added "dont" |
21:14:02 | FromDiscord | <Phil> Alright, in that case I'll get out some drawio |
21:14:18 | FromDiscord | <Phil> If you use vscode, I highly recommend the drawio extension btw, wonderful for making sketches |
21:14:34 | FromDiscord | <!Patitotective> gimp goes brrr |
21:14:43 | FromDiscord | <Phil> Not with that interface it doesn't |
21:14:47 | FromDiscord | <ghoom> In reply to @Patitotective "gimp goes brrr": laughs in magick |
21:14:52 | FromDiscord | <ghoom> (edit) "laughs" => "laughs" | "magick" => "magick" |
21:14:57 | FromDiscord | <wiga> In reply to @Patitotective "gimp goes brrr": flameshot drawing goes bababoi |
21:15:00 | FromDiscord | <ghoom> (edit) "magick" => "imagemagick" |
21:17:37 | FromDiscord | <!"Dialz_†> Baboi |
21:20:16 | FromDiscord | <wiga> bab |
21:20:42 | FromDiscord | <ghoom> why isn't `Natural` defined as `range[0..high(uint)]`? |
21:21:40 | FromDiscord | <Phil> One sec, drawing image |
21:22:45 | FromDiscord | <!Patitotective> what is he going to draw 👀 |
21:23:12 | FromDiscord | <eyecon> In reply to @wiga "flameshot drawing goes bababoi": Mermaid/PlantUML goes tralala |
21:23:47 | FromDiscord | <ghoom> In reply to @Patitotective "what is he going": nim chan |
21:23:51 | FromDiscord | <!Patitotective> nooo |
21:23:55 | FromDiscord | <ghoom> xd |
21:24:03 | FromDiscord | <ghoom> yes |
21:24:05 | FromDiscord | <ghoom> (edit) "yes" => "yes!!" |
21:24:22 | FromDiscord | <Phil> god... damnit vscode, stop crashing on me when I want to save |
21:24:35 | FromDiscord | <ghoom> 🪦 |
21:24:55 | FromDiscord | <!Patitotective> In reply to @ghoom "why isn't `Natural` defined": because then it would be of type uint, not int |
21:24:59 | FromDiscord | <!Patitotective> and using it would be useless |
21:25:20 | FromDiscord | <ghoom> isn't the range-checking useful enough? |
21:25:42 | FromDiscord | <!Patitotective> a uint cannot be negative |
21:25:52 | FromDiscord | <ghoom> yeah but what's wrong with that? |
21:26:07 | FromDiscord | <ghoom> natural can't be negative either |
21:26:10 | FromDiscord | <Elegantbeef> Nim wants you to default to `int`s |
21:26:21 | FromDiscord | <ghoom> oh |
21:26:38 | FromDiscord | <Elegantbeef> Natural being an alias to uint doesnt solve what it's meant to solve |
21:26:49 | FromDiscord | <Elegantbeef> Natural is supposed to be all natural integer numbers |
21:28:35 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=45aw |
21:29:12 | FromDiscord | <ghoom> i see |
21:29:58 | FromDiscord | <🐒🧠br4n_d0n> I don't understand the need for pushing ints all of the time... IMO I find more than not I'm using non-negative values |
21:30:22 | FromDiscord | <Elegantbeef> The reason is that in nim uints do not do over/underflow checks |
21:30:32 | FromDiscord | <Elegantbeef> And it's much easier to underflow a uint than an int |
21:31:08 | * | krux02 joined #nim |
21:32:04 | FromDiscord | <Elegantbeef> There are arguments for defaulting to both uint and int |
21:34:01 | FromDiscord | <Elegantbeef> It's also not like in most cases a 64bit int doesnt have enough positive values 😄 |
21:34:23 | * | Guest2776 joined #nim |
21:34:42 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=45ax |
21:35:03 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=45ax" => "https://play.nim-lang.org/#ix=45ay" |
21:35:14 | FromDiscord | <Phil> Wait, where is the image |
21:35:16 | FromDiscord | <Phil> God damnit |
21:35:20 | FromDiscord | <Elegantbeef> > var myObj2 = myObj there will now be 2 objects in memory which are copies of one another.↵With the caveat you arent using Orc/Arc 😛 |
21:35:23 | FromDiscord | <Phil> Fine, I'll throw it up on imgur |
21:35:43 | FromDiscord | <Phil> In reply to @Elegantbeef "> var myObj2 =": We're at the point where we're elaborating on what a ref or object type even is, I don't think bringing up orc/arc is useful yet 😛 |
21:35:58 | FromDiscord | <Elegantbeef> Cmon phil it |
21:36:16 | FromDiscord | <Phil> sidenote, the fact I can't post images here to elaborate points is pretty annoying |
21:36:49 | FromDiscord | <Elegantbeef> Why cant you? |
21:36:57 | FromDiscord | <Phil> https://i.imgur.com/eQwEnUE.png |
21:37:16 | Guest2776 | Oh, you're bridged to discord, are you perhaps bridged to xmpp? |
21:37:21 | FromDiscord | <Phil> In reply to @Elegantbeef "Why cant you?": I tried earlier where in the explanation, that should've had an image attached, apparently got insta removed since it never showed up |
21:37:32 | FromDiscord | <Elegantbeef> Your `myRefObj` should be on stack |
21:37:47 | FromDiscord | <Elegantbeef> References are pointers on the stack that point to the heap |
21:38:02 | FromDiscord | <Elegantbeef> Unless of course you've got a ref in heap allocated memory |
21:38:25 | Guest2776 | ref ref... |
21:39:42 | FromDiscord | <Phil> In reply to @Elegantbeef "Your `myRefObj` should be": Fair, the image was more meant to illustrate that 1) the content of ref objects is in heap, the content of value objects is in stack 2) variables of ref objects do not store contents of an object but a pointer to the heap memory. |
21:41:53 | FromDiscord | <Elegantbeef> Hey where would i be without pedantry |
21:44:01 | FromDiscord | <Phil> sent a long message, see http://ix.io/45az |
21:45:35 | FromDiscord | <Phil> Now why is that important?↵You may have noticed that java has this nice thing called "null" and "NullPointerExceptions" |
21:45:41 | FromDiscord | <Phil> In nim that is "nil" |
21:45:56 | * | toluene quit (Read error: Connection reset by peer) |
21:46:11 | FromDiscord | <Phil> That is the concept of "You have a variable that contains a pointer that is empty."↵As in, there is no memory on the heap with anything for you. The variable is empty. |
21:47:06 | * | toluene joined #nim |
21:47:36 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=45aB |
21:47:51 | FromDiscord | <Phil> `a.name == ""` will be true instead of throwing an exception! |
21:47:57 | FromDiscord | <🐒🧠br4n_d0n> https://tenor.com/view/imostergolfra-gif-25274972 |
21:49:49 | FromDiscord | <Phil> Joke not really appreciated, but alright, I'll stop |
21:50:12 | FromDiscord | <wiga> In reply to @Isofruit "`a.name == ""` will": yes |
21:50:22 | FromDiscord | <🐒🧠br4n_d0n> You don't have to stop, I was just joking that it's a lot of text in one go |
21:50:37 | FromDiscord | <wiga> thing is now |
21:50:57 | FromDiscord | <wiga> the socket is not giving up trying to connect even with a 400ms timeout |
21:51:00 | FromDiscord | <Phil> In reply to @wiga "yes": Once you got that value types ALWAYS have a value and can not ever be null, you'll see why you can't check them for nil |
21:51:23 | FromDiscord | <ghoom> why don't ranges accept uints? |
21:51:41 | FromDiscord | <ghoom> (edit) "ranges" => "subranges" |
21:51:44 | FromDiscord | <!Patitotective> they dont? |
21:51:51 | FromDiscord | <ghoom> (edit) "subranges" => "subrange types" |
21:51:59 | FromDiscord | <!Patitotective> !eval echo range[0u..10u] |
21:52:00 | FromDiscord | <ghoom> `range[2..high(uint)]` returns an error |
21:52:04 | NimBot | range 0..10(uint) |
21:52:14 | FromDiscord | <wiga> whats wrong with this https://media.discordapp.net/attachments/371759389889003532/1000158354351603903/unknown.png |
21:52:19 | FromDiscord | <ghoom> oh so i should mark 2 as unsigned |
21:52:30 | FromDiscord | <!Patitotective> yes |
21:52:35 | FromDiscord | <ghoom> me bad |
21:52:36 | FromDiscord | <wiga> it tries to connect but its not timingout |
21:53:13 | FromDiscord | <!Patitotective> btw @wiga you should put `socket.close()` in a `finally` block |
21:53:32 | FromDiscord | <wiga> no idea of what it is 😃 |
21:53:49 | FromDiscord | <!Patitotective> it executes that block of code no matter if it excepts |
21:54:13 | FromDiscord | <wiga> how |
21:54:33 | FromDiscord | <!Patitotective> read this https://nim-lang.org/docs/manual.html#exception-handling |
21:54:34 | FromDiscord | <Phil> In reply to @wiga "no idea of what": Basically, the full construct is not "try except", it's "try except finally". The finally block is just often ommitted since there isn't always something that must be done, no matter if the bit within "try" succeeded or not |
21:55:37 | FromDiscord | <Phil> As for websockets, I haven't used them enough to give much feedback here |
21:57:35 | FromDiscord | <wiga> is there a way to enable a verbose mod? |
21:59:30 | FromDiscord | <wiga> @.luke 🤝 https://media.discordapp.net/attachments/371759389889003532/1000160184217370644/unknown.png |
22:00:02 | FromDiscord | <Elegantbeef> To see why it's erroring you can do `except Exception as e: echo e.msg`↵(@wiga) |
22:00:28 | FromDiscord | <# Luke> In reply to @wiga "<@704106773660827690> 🤝": Lol nice |
22:01:07 | FromDiscord | <wiga> In reply to @Elegantbeef "To see why it's": first i get an error instantly but second is slow https://media.discordapp.net/attachments/371759389889003532/1000160589668167871/unknown.png |
22:03:22 | FromDiscord | <wiga> second got timedout after 1min when its suppose to have a 400ms timeout https://media.discordapp.net/attachments/371759389889003532/1000161155643363378/unknown.png |
22:03:56 | FromDiscord | <🐒🧠br4n_d0n> Is there a way to get the available/total system memory? |
22:07:04 | FromDiscord | <Elegantbeef> That's odd↵(@wiga) |
22:07:49 | FromDiscord | <# Luke> In reply to @wiga "first i get an": Kde? |
22:08:00 | FromDiscord | <wiga> In reply to @ripluke "Kde?": yes |
22:08:01 | FromDiscord | <wiga> sent a code paste, see https://play.nim-lang.org/#ix=45aH |
22:08:12 | FromDiscord | <# Luke> Oh |
22:08:32 | FromDiscord | <wiga> garuda is fast asf |
22:08:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=45aI |
22:08:54 | FromDiscord | <wiga> sent a code paste, see https://play.nim-lang.org/#ix=45aJ |
22:09:09 | FromDiscord | <# Luke> Kde? Fast? Never heard those words in the same sentence lmao 🤣 |
22:09:11 | FromDiscord | <Elegantbeef> It's funny cause it's just `return data[0] != '\255` |
22:09:21 | FromDiscord | <wiga> In reply to @ripluke "Kde? Fast? Never heard": i mean garuda to play games |
22:09:25 | FromDiscord | <Elegantbeef> sorry `'\255'` |
22:09:40 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=45aK |
22:09:47 | FromDiscord | <# Luke> In reply to @wiga "i mean garuda to": That's cuz of the zen kernel lol |
22:09:56 | FromDiscord | <🐒🧠br4n_d0n> sent a code paste, see https://play.nim-lang.org/#ix=45aL |
22:10:26 | FromDiscord | <wiga> In reply to @br4n_d0n "... I'm looking for": check for one with bash and make a if/else with os.platform prbly idk |
22:10:35 | FromDiscord | <Elegantbeef> Stop it |
22:10:42 | FromDiscord | <wiga> if os.platform exists in nim |
22:10:42 | FromDiscord | <Elegantbeef> Dont suggest using shell commands in a program |
22:10:49 | FromDiscord | <wiga> to get memory? |
22:11:15 | FromDiscord | <Elegantbeef> those shell commands typically call apis that are accessible |
22:12:01 | FromDiscord | <🐒🧠br4n_d0n> Beef any suggestions? |
22:12:19 | FromDiscord | <Elegantbeef> Use sysinfo on linux, the windows API on windows and the mac api on mac |
22:12:49 | FromDiscord | <🐒🧠br4n_d0n> 😫 there isn't a Nim builtin for this? |
22:12:55 | FromDiscord | <wiga> basically the same thing but yes |
22:13:09 | FromDiscord | <Elegantbeef> needing to know how much ram a PC has isnt a common operation really |
22:14:12 | FromDiscord | <Elegantbeef> For linux it's just a `sysinfo` call |
22:14:14 | FromDiscord | <wiga> In reply to @Elegantbeef "sorry `'\255'`": it returns either nothing or this https://media.discordapp.net/attachments/371759389889003532/1000163890321166466/2022-07-22_17-17.png |
22:14:31 | FromDiscord | <Elegantbeef> https://github.com/treeform/sysinfo might make you happy brandon |
22:15:02 | FromDiscord | <Elegantbeef> Yea i dont know what it's supposed to do |
22:15:38 | FromDiscord | <wiga> In reply to @Elegantbeef "https://github.com/treeform/sysinfo might make you": it executes shell commands lmfao |
22:15:43 | FromDiscord | <wiga> in some places |
22:16:04 | FromDiscord | <wiga> https://media.discordapp.net/attachments/371759389889003532/1000164354018246656/unknown.png |
22:16:06 | FromDiscord | <Elegantbeef> It really shouldnt |
22:16:51 | FromDiscord | <wiga> it has the memory stuff tho https://media.discordapp.net/attachments/371759389889003532/1000164550873731212/unknown.png |
22:17:04 | FromDiscord | <wiga> btw https://media.discordapp.net/attachments/371759389889003532/1000164606280474686/unknown.png |
22:17:06 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1000164614748766238/image.png |
22:17:24 | FromDiscord | <Elegantbeef> Why it doesnt just use `sysInfo` on linux is beyond me |
22:17:24 | FromDiscord | <wiga> thw whole library is executing shell commands |
22:18:13 | FromDiscord | <Elegantbeef> Or reading linux files instead of using the C apis |
22:18:15 | FromDiscord | <Elegantbeef> Cause fuck me i guess |
22:18:30 | FromDiscord | <wiga> kek |
22:19:01 | FromDiscord | <Elegantbeef> Anyway brandon you can use that api or go wrap the sysinfo and friends for each OS |
22:24:19 | FromDiscord | <🐒🧠br4n_d0n> 🐒 I think I'll go back to smashing rocks... |
22:25:50 | FromDiscord | <🐒🧠br4n_d0n> Though, I agree with you on using things like sysinfo over scripts unless there is a good enough reason to go the other way |
22:26:19 | FromDiscord | <Nimion #ඞ> In reply to @br4n_d0n "🐒 I think": me when I see anything from the C ecosystem |
22:26:25 | FromDiscord | <Nimion #ඞ> (edit) "C" => "C/C++" |
22:27:00 | FromDiscord | <ghoom> why doesn't nim support tabs? |
22:27:24 | FromDiscord | <🐒🧠br4n_d0n> It's a style choice that might be changed in an upcoming update |
22:27:31 | FromDiscord | <ghoom> i hope so |
22:28:00 | FromDiscord | <🐒🧠br4n_d0n> For now, I've mapped my editor to use spaces for Nim files |
22:28:06 | FromDiscord | <ghoom> same |
22:29:59 | FromDiscord | <!Patitotective> In reply to @ghoom "why doesn't nim support": spaces goes bbrrr |
22:29:59 | FromDiscord | <🐒🧠br4n_d0n> @TryAngle what's the creature in your avatar picture? |
22:30:08 | FromDiscord | <Nimion #ඞ> In reply to @br4n_d0n "<@147447489316913152> what's the creature": it's not a creature |
22:30:10 | FromDiscord | <Nimion #ඞ> it's a chad animal |
22:30:14 | FromDiscord | <Nimion #ඞ> Binturong |
22:31:03 | FromDiscord | <Elegantbeef> The reason Nim doesnt use tabs is they're not easily configurable across editors/viewers |
22:31:17 | FromDiscord | <ghoom> In reply to @Patitotective "spaces goes bbrrr": laughs in U+2003 |
22:31:32 | FromDiscord | <🐒🧠br4n_d0n> In reply to @Elegantbeef "The reason Nim doesnt": https://tenor.com/view/this-is-some-bullshit-pissed-off-spongebob-gif-13980660 |
22:31:35 | FromDiscord | <Nimion #ඞ> In reply to @br4n_d0n "<@147447489316913152> what's the creature": https://www.youtube.com/watch?v=ZDz9ELQ4zpo |
22:31:41 | FromDiscord | <Elegantbeef> Araq wanted a single indent character and due to the fact not all places allow easily customizing tab size spaces were chosen |
22:32:00 | FromDiscord | <Nimion #ඞ> In reply to @Elegantbeef "Araq wanted a single": omg I love Araq |
22:32:01 | FromDiscord | <Elegantbeef> And no there isnt any indication of being changed to allow tabs in a coming update |
22:32:07 | FromDiscord | <Nimion #ඞ> whatever else he does good or bad, this is enough |
22:32:18 | FromDiscord | <ghoom> TAB GANG |
22:32:24 | FromDiscord | <ghoom> WHO'S WITH ME? |
22:32:29 | FromDiscord | <huantian> Nobody |
22:32:33 | FromDiscord | <!Patitotective> yes, nobody |
22:32:36 | FromDiscord | <ghoom> fuck |
22:32:43 | FromDiscord | <Elegantbeef> Tabs are superior but it makes sense that in a white space significant language you want a single indent and spaces seemed better |
22:32:44 | FromDiscord | <Nimion #ඞ> this is so annoying in python, opening a file and it has different tab sizes than you have in ur editor |
22:32:56 | FromDiscord | <Elegantbeef> What?↵(@TryAngle) |
22:33:13 | FromDiscord | <Elegantbeef> The entire benefit of tabs is that they're customizable |
22:33:18 | FromDiscord | <Elegantbeef> Like the fuck are you on about |
22:33:28 | FromDiscord | <ghoom> In reply to @Elegantbeef "Like the fuck are": XD |
22:33:31 | FromDiscord | <🐒🧠br4n_d0n> Lol |
22:33:38 | FromDiscord | <!Patitotective> sublime detects the language and sets the tabs/spaces↵doesnt all editors do that? lol |
22:33:48 | FromDiscord | <Elegantbeef> They do |
22:34:06 | FromDiscord | <Nimion #ඞ> have u never opened a haskell or bash or python file and it had turbo random tab spaces? |
22:34:18 | FromDiscord | <🐒🧠br4n_d0n> I'm partial to tabs, but have no loyalty to either side |
22:34:19 | FromDiscord | <Elegantbeef> No i dont write those languages |
22:34:59 | FromDiscord | <Elegantbeef> I mean i see people that horizontally align code so that's enough random spaces |
22:36:10 | FromDiscord | <🐒🧠br4n_d0n> I don't like that Nim uses 2 spaces though as I've run into instances where the indentation becomes a little difficult to tell on a quick glance... I would prefer 4 |
22:36:23 | FromDiscord | <Elegantbeef> Then use 4? |
22:36:29 | FromDiscord | <!Patitotective> you can use the spaces you want↵2 spaces is just a convention |
22:36:37 | FromDiscord | <Elegantbeef> As long as you arent contributing to the stdlib/compiler you can use 120 if you want |
22:52:32 | FromDiscord | <exelotl> you could also try a rainbow indent extension, that makes the indentation a lot easier to read |
22:53:18 | FromDiscord | <ghoom> In reply to @exelotl "you could also try": rainbow? |
22:53:26 | FromDiscord | <ghoom> 🌈 |
22:53:53 | FromDiscord | <exelotl> yeah, like this one: https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow |
22:54:07 | FromDiscord | <ghoom> oh that's cute |
22:54:24 | FromDiscord | <ghoom> i love it 😍 |
22:54:47 | FromDiscord | <exelotl> it was like training wheels for me |
22:55:03 | FromDiscord | <exelotl> eventually it broke in the version of vscode I use |
22:55:09 | FromDiscord | <exelotl> but then I realised I could live without it xD |
22:55:17 | FromDiscord | <Generic> it still works for me? |
22:55:22 | FromDiscord | <ghoom> yeah it's not necessary imo but it's fun |
22:57:43 | FromDiscord | <exelotl> I think it only broke in code-oss |
22:58:18 | FromDiscord | <exelotl> and vscodium |
22:58:47 | FromDiscord | <exelotl> it's been a while since I tried it though so maybe it started working again x) |
23:00:17 | FromDiscord | <Elegantbeef> You can get it to work by downloading an older version and using it |
23:07:41 | FromDiscord | <eyecon> In reply to @exelotl "and vscodium": Current version works in vscodium, I use it |
23:08:09 | FromDiscord | <exelotl> ah, good to know |
23:22:47 | FromDiscord | <ghoom> sent a code paste, see https://play.nim-lang.org/#ix=45aW |
23:23:05 | FromDiscord | <huantian> too bad that looks horrible 😛 |
23:23:16 | FromDiscord | <ghoom> imagine a lot of em |
23:23:27 | FromDiscord | <ghoom> i dont wanna exceed 80 chars |
23:23:33 | FromDiscord | <ghoom> (edit) "i dont wanna exceed 80 chars ... " added "per line" |
23:23:39 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=45aX |
23:23:52 | FromDiscord | <ghoom> imagine if the type is `Option[range[2u..high(uint)]]` |
23:24:00 | FromDiscord | <ghoom> 😭 |
23:26:08 | FromDiscord | <huantian> you can omit the `range` in there btw |
23:26:21 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=45aY |
23:26:54 | FromDiscord | <ghoom> sent a code paste, see https://play.nim-lang.org/#ix=45aZ |
23:26:57 | FromDiscord | <ghoom> shorty lol |
23:27:26 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=45b0 |
23:27:32 | FromDiscord | <ghoom> ye i was gonna do dat |
23:27:46 | FromDiscord | <Prestige> Read it as unnatural |
23:27:52 | FromDiscord | <sOkam!> `type UNaturallyShorty` feels better in the context |
23:27:57 | FromDiscord | <sOkam!> 😄 |
23:28:22 | FromDiscord | <ghoom> and now we're back to long type expressions |
23:28:37 | FromDiscord | <ghoom> XD |
23:35:37 | FromDiscord | <ghoom> what's the diff between `object` and `object of RootObj`? |
23:35:58 | FromDiscord | <!Patitotective> object of RootObj can be inheritable |
23:36:14 | FromDiscord | <ghoom> but why not object? |
23:36:23 | FromDiscord | <huantian> because |
23:36:45 | FromDiscord | <ghoom> he broke |
23:36:51 | FromDiscord | <!Patitotective> yes, because |
23:37:07 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=45b5 |
23:37:23 | FromDiscord | <ghoom> but why is RootObj necessary for inheritance? |
23:37:23 | qwr | i'm not sure, but it looks like plain object is more like simple record type |
23:37:51 | qwr | probably compiler uses it to generate more efficent code |
23:37:51 | FromDiscord | <!Patitotective> In reply to @ghoom "but why is RootObj": yes https://media.discordapp.net/attachments/371759389889003532/1000184934671056926/unknown.png |
23:38:32 | FromDiscord | <ghoom> honestly why not just assume RootObj when the parent is not specified? |
23:38:43 | FromDiscord | <ghoom> 🤔 |
23:38:51 | FromDiscord | <Elegantbeef> Cause they have different semantics |
23:38:55 | FromDiscord | <Elegantbeef> `ref object` has no type information |
23:39:04 | FromDiscord | <Elegantbeef> `object` has no type information |
23:39:13 | FromDiscord | <Elegantbeef> only `object of RootObj` has type information |
23:39:26 | FromDiscord | <ghoom> but whyyy |
23:39:31 | FromDiscord | <ghoom> im gonna cry |
23:39:34 | FromDiscord | <!Patitotective> he just answered... |
23:39:51 | FromDiscord | <ghoom> idk man |
23:39:59 | FromDiscord | <ghoom> frogs are dumb |
23:39:59 | FromDiscord | <Elegantbeef> Cause Nim is a system language and type information adds a pointer and extraneous data only needed if you're doing OOP or dynamic dispatch |
23:40:16 | FromDiscord | <Elegantbeef> Nim is a procedural language with OOP mechanisms it's not an OOP language with procedural mechanisms |
23:40:27 | FromDiscord | <Elegantbeef> `object` in Nim is just a `struct` in most other languages |
23:40:48 | FromDiscord | <ghoom> ah, so if you specify the parent, it now no longer becomes a simple struct |
23:40:54 | qwr | i just tried, any object with {.inheritable.} annotation can be used as parent |
23:41:06 | FromDiscord | <Elegantbeef> Yes it adds type information qwr |
23:41:18 | FromDiscord | <Elegantbeef> It's only really meant for CInterop though |
23:41:22 | FromDiscord | <ghoom> 🐸👍 |
23:41:41 | FromDiscord | <Elegantbeef> You can do `{.pure, inheritable.}` which means when you do `object of Base` it copies the fields and adds no type information |
23:41:47 | FromDiscord | <ghoom> btw can you guys see emoji on irc? |
23:41:53 | FromDiscord | <Elegantbeef> I'm not on irc |
23:42:05 | FromDiscord | <ghoom> where? |
23:42:09 | FromDiscord | <Elegantbeef> Matrix |
23:42:14 | FromDiscord | <ghoom> ah ok |
23:42:17 | FromDiscord | <Elegantbeef> I have full multimedia support here |
23:42:31 | FromDiscord | <ghoom> i think qwr is using irc |
23:42:33 | FromDiscord | <ghoom> no? |
23:42:36 | FromDiscord | <Elegantbeef> Yep |
23:42:54 | FromDiscord | <Elegantbeef> The answer is going to be "only if the emoji is unicode and my font supports it" |
23:43:07 | FromDiscord | <ghoom> fair enough |
23:43:11 | FromDiscord | <Elegantbeef> The matrix bridge actually even handles custom discord emojis |
23:43:21 | FromDiscord | <ghoom> wow |
23:43:34 | FromDiscord | <ghoom> matrix 🤘 |
23:44:34 | qwr | ghoom: yes, these come over to irc as unicode characters (via utf-8) |
23:44:47 | FromDiscord | <!Patitotective> the only thin they dont see are reactions |
23:44:56 | FromDiscord | <Elegantbeef> Custom emojis i assume are just `:name:` |
23:45:00 | FromDiscord | <!Patitotective> (edit) "thin" => "thing" |
23:45:52 | FromDiscord | <Elegantbeef> to be fair though making `= object` equivlent to `{.pure, inheritable.}` actually doesnt seem bad to me |
23:46:07 | FromDiscord | <ghoom> ikr??? |
23:46:27 | FromDiscord | <Elegantbeef> I dont think you do know |
23:47:17 | FromDiscord | <Elegantbeef> The issue is going to be whenever you use low level operations like `copyMem` or similar though |
23:47:31 | FromDiscord | <Elegantbeef> So being able to blindly have a larger type means you lose this data |
23:47:49 | FromDiscord | <Elegantbeef> So there are cases where it makes sense you cannot inherit |
23:50:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=45b8 |
23:50:16 | FromDiscord | <Elegantbeef> That doesnt behave as one expects |
23:51:05 | FromDiscord | <Elegantbeef> this can be resolved by do `proc doThing[T: A](a, b: var T)` but alas it doesnt error which is important to note |