<< 15-04-2021 >>

00:01:56*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:02:17*njoseph joined #nim
00:25:11*nekits07 joined #nim
00:26:55FromDiscord<Sabena Sema> https://github.com/nim-lang/fusion/blob/fb1655420a91c9ad0d0141c657b6d468ed276b4e/src/fusion/btreetables.nim#L851
00:27:04FromDiscord<Sabena Sema> what's that `<//>` syntax?
00:41:30FromDiscord<Yardanico> In reply to @Sabena Sema "what's that `<//>` syntax?": it does nothing right now, initially it was used as a way to specify owned refs in a backwards compatible way so that older nim versions could compile the same code
00:42:14FromDiscord<Sabena Sema> huh, but fusion's unique pointers don't seem to define `=sink`
00:42:26FromDiscord<Yardanico> ?
00:43:16FromDiscord<Yardanico> owned refs were a part of the newruntime, but it didn't go that far, instead arc/orc were developed
00:43:16FromDiscord<Yardanico> https://nim-lang.org/araq/ownedrefs.html
00:45:40FromDiscord<Yardanico> In reply to @Sabena Sema "huh, but fusion's unique": also smartptrs is going to be added to stdlib, so check code in https://github.com/nim-lang/Nim/pull/17333 instead of fusion for it
00:46:18FromDiscord<Yardanico> and =sink is compiler-provided by default - https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks-eqsink-hook
00:46:41FromDiscord<Yardanico> http://nim-lang.github.io/Nim/destructors.html "When not provided the compiler is using a combination of =destroy and copyMem instead. "
00:56:18FromDiscord<Sabena Sema> Except you can't call destroy after moving from a unique ptr
00:56:32FromDiscord<Sabena Sema> Bagh Ill figure it out later
01:03:46*Tlangir joined #nim
01:23:06FromDiscord<Avatarfighter> What does the smartptrs package do/what is a use case ?
02:31:26*layers joined #nim
02:31:46*layers quit (Client Quit)
02:54:08*thomasross quit (Remote host closed the connection)
03:10:05*spiderstew joined #nim
03:11:25*spiderstew_ quit (Ping timeout: 250 seconds)
03:59:12*letto quit (Quit: Konversation terminated!)
04:01:10*rockcavera quit (Remote host closed the connection)
04:01:11*letto joined #nim
04:19:31*Gustavo6046 quit (Ping timeout: 260 seconds)
05:02:46*narimiran joined #nim
05:07:50saemHmm, so `--path:.` is not implied if you don't specify path. Huh
05:33:47*haxscramper joined #nim
05:45:17*inamannerofspeak joined #nim
05:47:53ForumUpdaterBotNew thread by Bpr: Interesting post from D forum, see https://forum.nim-lang.org/t/7791
06:00:57FromDiscord<TennisBowling> In reply to @haxscramper "You can show code": https://play.nim-lang.org/#ix=2W8D
06:05:38FromDiscord<haxscramper> https://wandbox.org/permlink/ExyAy7Fi9kPDIj0c
06:05:53FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#procedures <
06:06:07FromDiscord<haxscramper> I think someone linked that already, but manual has example on how to define procedure with return type
06:38:04*johnnynitwits quit (Quit: Bridge terminating on SIGTERM)
06:38:04*threenp quit (Quit: Bridge terminating on SIGTERM)
06:48:52*inamannerofspeak quit (Ping timeout: 252 seconds)
07:05:43*vicfred quit (Quit: Leaving)
07:08:37*skelett quit (Quit: WeeChat 2.9)
07:19:06FromDiscord<mattrb> Can someone explain what's going on here? https://play.nim-lang.org/#ix=2W8P
07:21:12*natrys joined #nim
07:23:50*johnnynitwits joined #nim
07:23:55*threenp joined #nim
07:30:05ForumUpdaterBotNew thread by Mikkom: Fastest method for writing and loading cached binary object data to file, see https://forum.nim-lang.org/t/7792
07:31:51FromDiscord<ElegantBeef> @mattrb based off this seems unsigned bit shift returns the value if it goes out of bit bounds https://play.nim-lang.org/#ix=2W8U
07:33:47FromDiscord<mattrb> Hmm but why? I don't see that documented anywhere, and it doesn't seem like that's what the compiler emits? https://github.com/nim-lang/Nim/blob/devel/compiler/ccgexprs.nim#L633
07:33:50FromDiscord<mattrb> I could also be misreading
07:36:09FromDiscord<ElegantBeef> Seems that's just what C does
07:36:35*haxscramper quit (Remote host closed the connection)
07:36:51FromDiscord<ElegantBeef> If you shift over the size of the type it returns the value it seems
07:37:02*haxscramper joined #nim
07:39:22FromDiscord<ElegantBeef> Since it's a direct wrap to C we get that odd behaviour
07:41:27FromDiscord<mattrb> It doesn't do it with 8-bit ints though? https://play.nim-lang.org/#ix=2W8Y
07:41:38FromDiscord<mattrb> (edit) "8-bit ints" => "uint8s"
07:45:33FromDiscord<ElegantBeef> Cause it doesnt happen in C either
07:46:13FromDiscord<ElegantBeef> https://onlinegdb.com/rJqrJuH8d
07:49:39*neceve joined #nim
07:51:57FromDiscord<ElegantBeef> Yea it's certainly odd C behaviour https://onlinegdb.com/SyZW9gOBUu
07:52:06*PMunch joined #nim
07:52:14FromDiscord<ElegantBeef> My suggestion is to do https://play.nim-lang.org/#ix=2W8Z
07:52:47FromDiscord<mattrb> Unless `b` is 0
07:52:52FromDiscord<mattrb> But yeah I think I'll have to do that
07:52:53FromDiscord<mattrb> Thanks
07:52:56FromDiscord<mattrb> C sucks lol
07:53:06FromDiscord<ElegantBeef> Indeed
07:53:25FromDiscord<ElegantBeef> But now for you to do your part and document that oddity 😄
07:54:20FromDiscord<ElegantBeef> Though i do agree that the shift ops should return 0 in this case
07:55:20FromDiscord<Rika> this behavior shouldnt carry into nim tho should it
07:55:49FromDiscord<ElegantBeef> Certainly not that's quite unintuitive
07:56:50FromDiscord<mattrb> Yeah if this was just a documentation change I'd happy add it to the docs, but I feel like Nim should override the C behavior here
07:57:08FromDiscord<ElegantBeef> Well time for an RFC i imagine
07:57:32FromDiscord<mattrb> I can likely get to it this weekend if it's not picked up prior to then
07:59:00FromDiscord<Rika> inb4 cant add, breaking change
07:59:05FromDiscord<ElegantBeef> lol
07:59:12FromDiscord<ElegantBeef> I mean it's not difficult to change
07:59:40FromDiscord<ElegantBeef> Dont even have to change the generated C, just make the `shr` a `shrImpl` and then `shr` calls it
08:00:01FromDiscord<ElegantBeef> > However, do note that a shift operand value which is either a negative number or is greater than or equal to the total number of bits in this value results in undefined behavior. For example, when shifting a 32 bit unsigned integer, a shift amount of 32 or higher would be undefined.
08:00:07FromDiscord<ElegantBeef> Ah so it is UB
08:00:13FromDiscord<ElegantBeef> Fuck i love C!
08:00:21FromDiscord<mattrb> Yeah I just found basically the same thing lol
08:00:29*haxscramper quit (Remote host closed the connection)
08:00:31FromDiscord<mattrb> https://en.cppreference.com/w/c/language/operator_arithmetic#Shift_operators↵> The behavior is undefined if rhs is negative or is greater or equal the number of bits in the promoted lhs.
08:00:48FromDiscord<Rika> nice
08:00:51FromDiscord<ElegantBeef> So yea certainly needs addressed, having UB is just silly
08:00:55*haxscramper joined #nim
08:01:00FromDiscord<Rika> just divide by 2 ez
08:01:07FromDiscord<ElegantBeef> lol
08:01:16FromDiscord<mattrb> I imagine this would also affect `shl`
08:01:24FromDiscord<Rika> i dont think it does actually lol
08:01:32FromDiscord<Rika> maybe check
08:01:43FromDiscord<ElegantBeef> If you shit more than 32 bits left it should be zero regardless what was there
08:01:49FromDiscord<ElegantBeef> inb4 it wraps around
08:01:57FromDiscord<Rika> shit lmao
08:02:08FromDiscord<ElegantBeef> !eval echo 0xffu32 shl 32
08:02:15NimBot0
08:02:19FromDiscord<ElegantBeef> Wehew
08:03:09FromDiscord<mattrb> Phew
08:03:14FromDiscord<Rika> lmao
08:03:23FromDiscord<Rika> yall i love c so much :DDDDDDDDDDDD
08:03:42FromDiscord<mattrb> The docs I linked above seem to imply that the behavior for both `<<` and `>>` out of range is undefined, so I think we just lucked into that one being 0 lol
08:03:49FromDiscord<ElegantBeef> Ah
08:03:56FromDiscord<mattrb> Nim should define implementations for both imo
08:04:17FromDiscord<ElegantBeef> Yea proper shifting that's done properly
08:04:42FromDiscord<Rika> inb4 it actually is just a for loop and dividing/multiplying
08:05:55FromDiscord<clyybber> Theres an open PR which addresses this
08:06:06FromDiscord<clyybber> AFAIRC
08:06:32FromDiscord<ElegantBeef> As far as internet relay chat?
08:07:34FromDiscord<clyybber> lol I meant as far as i remember correctly but i just realized that i mixed two things there
08:07:40FromDiscord<clyybber> <https://github.com/nim-lang/Nim/pull/11555>
08:08:22FromDiscord<Rika> lmao IIRC and AFAIR
08:08:49FromDiscord<Rika> AFAIIRC, as far as if i recall correctly
08:08:50FromDiscord<Rika> xd
08:14:13ForumUpdaterBotNew thread by Halloleo: How do I get the fields/attributes of an object type at run time?, see https://forum.nim-lang.org/t/7793
08:16:14FromDiscord<Rika> oh man here we go again
08:16:47FromDiscord<Rika> oh okay its more okay than i thought
08:16:51FromDiscord<spkinguy1> sent a long message, see http://ix.io/2W97
08:16:53FromDiscord<Rika> In reply to @spkinguy1 "guys which one of": low?
08:17:04FromDiscord<Rika> as in which i like least?
08:17:07FromDiscord<Rika> oh
08:17:09FromDiscord<spkinguy1> (edit) "http://ix.io/2W97" => "http://ix.io/2W98"
08:17:11FromDiscord<Rika> low level huh
08:17:18FromDiscord<Rika> id say zig
08:17:46FromDiscord<spkinguy1> In reply to @Rika "id say zig": u know most of them ?
08:17:51FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2W99
08:18:57FromDiscord<clyybber> In reply to @mattrb "Looks like this PR": Yeah, the PR will guarantee wrap around
08:19:44FromDiscord<Rika> In reply to @spkinguy1 "u know most of": to a small extent at least, from what ive seen
08:22:34FromDiscord<mattrb> I don't follow the logic for forcing the wraparound. If we're defining the undefined C behavior, I feel like we'd want to instead make all of those return 0?
08:23:20*inamannerofspeak joined #nim
08:25:48FromDiscord<Rika> maybe new operators if wrap is desired? wshl wshr?
08:26:06*PMunch quit (Ping timeout: 240 seconds)
08:26:38FromDiscord<mattrb> I'm having flashbacks to when Araq reviewed the `ashr` PR :cringeharold:
08:26:49FromDiscord<mattrb> (I wasn't around at the time, but read the discussion there :p)
08:29:16*PMunch joined #nim
08:29:38PMunchGoing to stream again today, around 5PM UTC as last time
08:29:40PMunchImplementing I²C to communicate between the two halves
08:29:46PMunchDid some preliminary testing to just blink an LED over the port expander with the libraries for Arduino, and it took a bit over 3000 bytes, a solid 33% larger than the entire keyboard firmware so far. So this might get interesting
08:37:29FromDiscord<mattrb> In reply to @mattrb "I don't follow the": Also, I feel like without a defined implementation, this is going to have different behavior on different architectures. (I'm just making an assumption, but I know that arm shifts out of range result in 0). Leaving this up to undefined behavior in C definitely isn't the way to go, and I'd argue that making shifts out of range return 0 is the way people would _expect_ this to work
08:40:09FromDiscord<ElegantBeef> Yea this `if toShift >= sizeOf(a) 4: 0 else: a shr toShift` seems like it'd be fine to my tired mind
08:41:12FromDiscord<ElegantBeef> i mean ` 8` ofc
08:53:25*arecaceae quit (Remote host closed the connection)
08:53:44*arecaceae joined #nim
08:56:41*Tlangir quit (Quit: Leaving)
09:10:01FromDiscord<clyybber> I'm worried about the performance impact
09:12:28FromDiscord<ElegantBeef> Yea i was worried aswell, only thing i could think of is make `shl/shr` the C versions and `<<`/`>>` the "safe" versions but that seems ugly considering the other ops
09:12:51PMunchAre you messing with shifting?
09:13:12FromDiscord<ElegantBeef> Nah just talking about how borked shifting is due to using C's directly
09:13:55FromDiscord<clyybber> I wonder how zig or crystal do it
09:14:37PMunchProbably the same, unless they get really poor performance on some architectures
09:15:15PMunchI mean the differences in shifting is just down to how the low level instructions work on different architectures isn't it?
09:15:17FromDiscord<ElegantBeef> Suppose we could have ah `-d:nimUseFastShifts` 😄
09:15:24FromDiscord<ElegantBeef> (edit) "ah" => "a"
09:15:27FromDiscord<clyybber> In reply to @PMunch "I mean the differences": yeah
09:16:04FromDiscord<mattrb> In reply to @Clyybber "I wonder how zig": Shifts out of range on crystal result in 0
09:16:26FromDiscord<mattrb> I know because I’m porting my Crystal gba emulator to Nim and this is a new bug for me 😆
09:16:30PMunchI guess it could be a compile-time thing so the behaviour we want isn't wrapped, but platforms that are wrapped could show an error with a hint to use -d:nimUseFastShifts
09:16:38PMunchOr -d:nimUseNativeShifts
09:16:56FromDiscord<clyybber> In reply to @mattrb "I know because I’m": ah, I suspected that :D
09:17:21PMunchWhat architecture are you on where that doesn't happen anyways?
09:19:13FromDiscord<clyybber> <https://github.com/crystal-lang/crystal/issues/305>
09:20:03FromDiscord<clyybber> seems like they split it into seperate ops
09:21:33FromDiscord<ElegantBeef> So seems my suggestion isnt terrible, just odd that the new ops would be the safe ones i guess
09:21:48FromDiscord<clyybber> I think a global switch is a bad idea
09:22:17FromDiscord<ElegantBeef> I mean the `shl` and `<<`
09:22:18saemLess switches plz. :)
09:22:28FromDiscord<ElegantBeef> I was joking with the global switch
09:22:31FromDiscord<clyybber> oh :D
09:22:32PMunchI don't think this is really needed..
09:22:55PMunchIf anyone actually needs to have a safe version of shl that sacrifices performance let them create a small template..
09:23:47FromDiscord<clyybber> I guess we could also just declare it illegal behaviour, instead of undefined; then debug mode could have an assertion there; and when you need the wraparound/zero-out behaviour, DIY
09:24:28FromDiscord<mattrb> In reply to @Clyybber "seems like they split": https://github.com/crystal-lang/crystal/blob/dd40a2442fa186add8a82b74edb14a90aa1dae05/src/int.cr#L203↵↵Haha amusing. I was literally just looking at this code earlier for another reason. I had a bug in my emulator because I assumed crystal shifts were logical even on signed numbers, but they’re arithmetic
09:24:53Clonkk[m]Is there an easy way to specify that ``Complex[Complex32]`` should return ``Complex32`` at compile-time (i.e. usable in generics) ?
09:24:58FromDiscord<ElegantBeef> Yea the worst part was there was no "there'll be dragons" message
09:25:10saemIt could be a check one turns off?
09:25:17*lritter joined #nim
09:25:28Clonkk[m]I have an input ``T: SomeFloat|Complex`` that should return ``Complex[T]`` basically.
09:28:01FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=2W9y
09:30:16FromDiscord<ElegantBeef> iterating ranges annoyingly requires `min, max`
09:30:44FromDiscord<clyybber> use countdown yeah, `..` is countup
09:37:26*clyybber joined #nim
09:41:54narimiranNim 1.4.6 and 1.2.12 are out!! https://nim-lang.org/blog/2021/04/15/versions-146-and-1212-released.html
09:43:35narimiranThere were no complaints during the release candidate phase. (But I'm sure somebody will find some issue 2 seconds after we announce the releases to the broader audience :D)
09:44:35giaco__to go from 4 chars long string to uint32, is mystr.toHex.parseHexInt.uint32 the way to go?
09:45:02giaco__it is a bytestring, obviously
09:46:47FromDiscord<ElegantBeef> `cast[uint32](myStr[0])`
09:48:06PMunchHmm, I'm trying to spit this out from a macro, but it throws an internal error: http://ix.io/2W9E
09:48:06liblq-devwell not really
09:48:15PMunchError: internal error: getTypeDescAux(tyAnything)
09:48:21liblq-dev@ElegantBeef this will only get the first byte of the string
09:48:35liblq-dev`cast[ptr uint32](myStr[0].unsafeAddr)[]`
09:48:38liblq-devis the right solution
09:49:34liblq-devgiaco__: ^
09:51:10PMunchSpotted one error, trying to use `auto` in the emit
09:51:31PMunchNow I have a different error :)
09:53:50*krux02 joined #nim
09:55:51giaco__liblq-dev: thanks. Will the result of that cast be refcounted as the string or will live on the stack?
09:56:12liblq-devit will get copied out of the string
09:56:32giaco__thanks
09:56:40liblq-devthat expression is equivalent to `*((uint32_t *)&myStr[0])` in C
09:57:32giaco__I wish I had more C experience before diving into nim, but I'm slowly catching up :P
10:00:18*haxscramper quit (Remote host closed the connection)
10:00:43*haxscramper joined #nim
10:01:20liblq-devso basically what this does is the following: 1. it takes the memory address of the first character in the string, 2. it reinterprets that address's type from a char pointer to a uint32 pointer, 3. it dereferences that pointer, which essentially means: it reads the memory at the address the pointer is pointing to
10:02:37*haxscramper quit (Read error: Connection reset by peer)
10:03:08*haxscramper joined #nim
10:03:48*haxscramper quit (Remote host closed the connection)
10:05:29FromDiscord<Clonkk> sent a code paste, see https://play.nim-lang.org/#ix=2W9M
10:08:08giaco__liblq-dev: and for the other way around, to go from uint32 to bytestring, is there something better than "myuint.toHex.parseHexStr" ?
10:08:30ForumUpdaterBotNew thread by Miran: Versions 1.4.6 and 1.2.12 released, see https://forum.nim-lang.org/t/7794
10:08:42liblq-devwell that ain't gonna do what you want anyways so
10:08:47liblq-devgoing the other way 'round is a bit harder
10:09:02liblq-devyou can turn your uint32 into a cstring
10:09:14giaco__no? I'm using it and it seems working so far
10:09:24liblq-devdefine "bytestring"
10:09:30PMunchCan I convert an object to an array of bytes on compile-time? I'm guessing no
10:09:50giaco__a string with same sizeof the original thing and with 1:1 bytes
10:10:53liblq-devPMunch: frosty?
10:11:12PMunchNo thanks I prefer regular corn flakes
10:11:16PMunchCould you pass the milk though?
10:11:55PMunchHmm, Frosty looks like it might be able to do it
10:16:58giaco__am I wrong?
10:21:12FromDiscord<sealmove> is there a way to expand a list to arguments similar to Python's `` prefix?
10:22:32ForumUpdaterBotNew thread by Pietroppeter: Lost thread? (Fastest method for writing and loading cached binary object data to file), see https://forum.nim-lang.org/t/7795
10:23:04liblq-devgiaco__: excuse my lack of response but i'm having a lesson right now so i can't really respond in real time
10:23:17liblq-devand nim playground seems to be down.
10:24:25giaco__absolutely no need to excuse, thanks for the feedback!
10:25:26PMunchHmm, rebooted the playground, let's see if that works
10:26:11*liblq-dev < https://matrix.org/_matrix/media/r0/download/matrix.org/EVAGOgwOAlqNfaLqGBBffMls/message.txt >
10:26:16liblq-devgiaco__: ^
10:27:12liblq-devresults in "DCBA" being written to stdout, because little endian
10:30:05giaco__thanks! but I wonder if toHex.parseHexStr is more or less conveniente. I should write some tests
10:31:48giaco__side question: doing "0x41424344u32" or doing "0x41424344.uint32" is the same thing, or the second one implies a conversion?
10:36:31liblq-devit's the same thing
10:36:45liblq-devtoHex.parseHexStr is slower
10:37:07liblq-devbecause you first convert the string to a hex representation, and then back to a normal string
10:37:14liblq-devhere you just directly operate on bytes
10:42:42giaco__I've run some -d:danger benchmarks over the two versions with benchy. You're right, the cast version is faster but not so much. Over 1_000_000 operations the cast version has an average time of 36ms, 40ms for the toHex.parseHexStr
10:43:52giaco__liblq-dev: this is the benchmark http://ix.io/2Wa3
10:45:12giaco__also the cast version lacks the endianess fix, that could slow it down
10:47:36liblq-devyou're discarding the result
10:47:50liblq-devso the compiler optimizes your computation away
10:48:01giaco__oh
10:48:04giaco__^^"
10:50:11liblq-devunfortunately i don't have a good solution to that as benchy's `keep` doesn't always work
10:51:13giaco__yeah I'm moving keep here and there but the benchmarks are not changing
10:51:52liblq-devi tried to writeFile the string but then that adds also the cost of reallocating the intermediary string, and syscalls and such
10:51:57liblq-devso it's not a fair benchmark
10:52:19liblq-devbut it gives me 51.830 ms for unsafe vs 70.025 for "safe"
10:54:19*Vladar joined #nim
10:55:27liblq-devjuggling bits with shl has a similar outcome
11:01:38giaco__how do you fix byte endianess with shl? Don't you need rotate for that?
11:02:15PMunchWell, with careful bitmasking you should be able to
11:03:19PMunch((myUint16 and 0xff00) shr 8) or ((myUint16 and 0xff) shl 8)
11:03:21PMunchSomething like that
11:04:00giaco__yeah, but with uint64 is like playing hanoi tower :D
11:04:33PMunchWell, it's just more of the same
11:06:30PMunch((myUint32 and 0xff000000) shr 26) or ((myUint32 and 0x00ff0000) shr 8) or ((myUint32 and 0x0000ff00) shl 8) or ((myUint32 and 0x000000ff) shl 26)
11:06:36PMunchThat's for 32 bit
11:07:19liblq-devwoah pmunch
11:07:26liblq-devdidn't you get your bits mixed up?
11:07:32PMunchDid I?
11:07:36liblq-devwhere'd you get 26 from?
11:07:45PMunch32 - 8?
11:08:03giaco__24 :P
11:08:11PMunchOh, woops :P
11:08:24PMunchI was looking at that thinking it looked wrong
11:08:32liblq-devthat's 24 bumbo
11:08:56PMunchI'm a computer scientist, not a mathematician :P
11:09:21FromDiscord<Rika> computer science is highly linked to mathematics
11:09:31giaco__btw I got the point. I also see there's a module for that https://nim-lang.org/docs/endians.html
11:09:48PMunchOh yeah, you shouldn't actually do it that way in real code :P
11:09:54liblq-devhere's how i (wouldn't) do it
11:09:55liblq-devreason: it's better to append bytes to an existing string buffer rather than allocate a new string each time you want to convert
11:10:14*liblq-dev < https://matrix.org/_matrix/media/r0/download/matrix.org/QxZfHIFXDQeesElBXmjldHxV/message.txt >
11:10:42liblq-devalso, isp is being unkind
11:10:56PMunch@Rika, I was just joking. But having been sat in front of a computer since I was a kid I haven't really had much use for doing math in my head
11:11:06giaco__I'm quite puzzled with your initial solution liblq-dev, what doas swap the endianess?
11:11:08PMunchIt's literally a big glorified calculator :P
11:11:40liblq-devgiaco__: in the first one? nothing
11:11:47liblq-devit stores the number in native endianness
11:12:06liblq-devon little endian that's reverse of how hex literals are written
11:12:27giaco__but it comes out swapped compared to what mystr.toHex.parseHexStr produces
11:12:42liblq-devthat's how it should be
11:12:50liblq-devtoHex converts the number to a string
11:12:56liblq-devrather than bytes
11:13:10liblq-dev0x41424344 is stored as 44 43 42 41 in memory on little endian architectures
11:13:48liblq-devand my first solution is literally just copying bytes around
11:13:49liblq-devthat's why it's endian dependent
11:14:16liblq-devtoHex will convert your int to a hex number, rather than bytes represented as hex
11:14:25liblq-devso the initial order of 41424344 is preserved
11:14:43PMunchHmm, I wonder what the performance of `let x = cast[array[4, uint8]](myUint32); return cast[uint32]([x[3], x[2], x[1], x[0]])` would be
11:15:04giaco__got it. Thanks for your patience. I'm just dealing for the first time with memcopy and endianess, and I'm quite scratching my head
11:15:27liblq-devyou'll understand it in due time
11:18:01giaco__back to the roots! https://developer.ibm.com/articles/au-endianc/#end
11:23:30giaco__ok I got the point! Article says that endianess doesn't matter with c-style strings, so is just the uint32 layed in little-endian in my x86 memory and the copyMem is just reading it as-is
11:29:15giaco__ok, so now I need to understand how to properly write the "toStringUsafe" in a endian independent way
11:30:15giaco__where I need to swap bytes for ints larger than 8 on little-endian machines before copyMem into the string
11:32:13liblq-devor just don't use copymem and use my solution above
11:32:34liblq-devwhich always orders the bytes in little endian order
11:32:37*narimiran quit (Quit: leaving)
11:36:24giaco__liblq-dev: but if I run your shr based solutions, would it work on big-endian architectures? There char(x and 0xff) would be the lsb so result[3]. I might be wrong, still wiring my head around this
11:38:22giaco__or nim ints are always little endian no matter the undelying memory when not dealing with casts and other unsafe stuff?
11:38:41liblq-devit will work no matter the architecture
11:38:47liblq-devbecause shl works the same no matter the endianness
11:41:27giaco__but "x and 0xff" would pick the LSB or MSB of the int depending on the arch endianess, or not?
11:49:34liblq-devno
11:49:42liblq-devbit operations don't care about endianness
11:49:52liblq-devbecause it wouldn't make much sense
11:50:19liblq-devthey operate on the int as a whole, not individual bytes
11:56:31giaco__that makes things easier. Thanks agains. I know I must look noob on this, but I've been working with high level languages all my life and now I have to unlearn to learn
11:56:59liblq-devthat's fine
12:07:42giaco__liblq-dev: I'm not quite sure of anything. Still reversed with shr and bitmask solution not http://ix.io/2Was
12:07:55giaco__omit last "not"
12:08:03liblq-devbecause i'm saving it in little endian
12:08:11liblq-devbut it'll be little endian no matter what
12:08:23liblq-devyou can change it to big endian by reversing the indices
12:08:32liblq-devin toStringUnsafe
12:11:11PMunchWell shit.. I tried to update and restart the playground.. Now I can't log back in
12:24:26giaco__liblq-dev: my fault, did it with pen and paper and it is cristal clear now. Thanks for your patience again
12:24:39liblq-devnp
12:26:46giaco__and also proper benchy now shows it is 3 times faster than toHex.parseHexStr, and also no unsafe stuff. great
12:32:12giaco__with arc and -d:danger is almost 5 times faster
12:47:18*rockcavera joined #nim
13:07:24*NimBot joined #nim
13:09:17*hsh quit ()
13:32:32*hsh joined #nim
13:32:56FromDiscord<madman> this proc is not available on the NimScript/js target; usage of 'existsOrCreateDir' is an {.error.}
13:33:37FromDiscord<madman> how to change nimscript target? 🤔
13:34:24PMunchWhat do you mean change NimScript target?
13:34:43*haxscramper joined #nim
13:35:32FromDiscord<madman> sorry, why cant i use the os module in NimScript
13:37:11PMunchBecause it's built around system calls that aren't available in the VM
13:37:26PMunchThere are a couple options though IIRC
13:37:31PMunchWhat exactly are you trying to do?
13:37:51FromDiscord<madman> oh i see
13:38:04FromDiscord<madman> nothing just trying to create a dir if it doesnt exist
13:38:25FromDiscord<madman> maybe i should just use Nim and execute it from nimscript
13:38:44PMunchI mean it depends on what your actual use-case here is
13:39:55FromDiscord<madman> im building cross platform executables on win mac linux, i just want to create this directory and use it as outdir
13:42:01PMunchAh I see, you might be able to use this: https://nim-lang.org/docs/nimscript.html#mkDir%2Cstring
13:42:12PMunchAlong with `dirExists`
13:43:03FromDiscord<madman> oh why thank you
13:43:39FromDiscord<madman> can we give nimscript command line args?
13:44:09PMunchYup
13:44:36FromDiscord<madman> oh cool
13:55:10Amun_Rais there a way to get specific cause of "can have side effects" error?
14:00:39*rockcavera quit (Remote host closed the connection)
14:03:45giaco__liblq-dev: there's one last thing I need to fix: I'm using the proc you suggested to turn a bytestring into an int "proc toInt*[T:SomeInteger](x: string): T = cast[ptr T](x[0].unsafeAddr)[]", and it correctly turns the byte array into the corresponding little-endian memory layout of the int (result.toHex prints the string backwards). What's the correct way to fix this?
14:04:49*PMunch quit (Quit: leaving)
14:09:26liblq-devso using the cast method, you're actually reinterpreting the bytes in the string as if they were an int of native endianness
14:09:42liblq-devgiaco__: i suppose you're working with big endian data here?
14:12:02*birdspider joined #nim
14:12:32*liblq-dev < https://matrix.org/_matrix/media/r0/download/matrix.org/NAkcXCZcDzJOZrIqgUSrECNx/message.txt >
14:12:41liblq-devthis would be the proc then
14:12:47liblq-devalbeit it's quite inefficient
14:12:58liblq-devchanging the string to an openArray[char] would help
14:13:52liblq-devas a string is implicitly convertible to that, plus you can actually slice a string using toOpenArray and that allows you to read from a specific offset in the string without making any copies or allocations
14:15:00giaco__I would see some advantage only if I could slice it backwards, or not?
14:21:45FromDiscord<haxscramper> In reply to @Amun_Ra "is there a way": No, currently it is not possible to get the actual source of the side effect
14:21:47*birdspider quit (Quit: Leaving)
14:24:26*birdspider joined #nim
14:31:12*rockcavera joined #nim
14:37:08*inamannerofspeak quit (Ping timeout: 246 seconds)
14:38:02*Gustavo6046 joined #nim
14:48:01stefantalpalaruHow do I override `cmp()` for a specific custom type? By redefining it directly, or do I need to define `==` and `<` instead?
14:49:13FromDiscord<Rika> you can redefine it directly if the original cmp function is a generic
14:49:26stefantalpalaruIt is: https://nim-lang.org/docs/system.html#cmp%2CT%2CT
14:50:19FromDiscord<konsumlamm> ye, just overload it with a more specific type, functions using `cmp` will use the the most specific overload
14:51:13stefantalpalaruThanks.
14:51:43FromDiscord<konsumlamm> although afaik most functions use `==` and `<` directly (which are not defined in terms of `cmp`), so it's better to overload those
14:52:42*haxscramper quit (Remote host closed the connection)
14:53:08*haxscramper joined #nim
14:53:15*haxscram` joined #nim
15:01:12FromDiscord<konsumlamm> @Tavon the difference to the range type (which is assume you mean by "every other aspect of the language") is that there, the bounds are always known at compile time (as opposed to only sometimes) and it's even more rare to have the type depend on some flags
15:05:43FromDiscord<Tavon> Yeah. Maybe only we could apply the check only on fully static set's ranges, to be 100% sure it's a mistake
15:06:07FromDiscord<Tavon> (edit) removed "only"
15:15:59FromDiscord<zetashift> Is there a way to see some more detailed information about compilation, e.g. time to compile of each file? I'm compiling a simple project with gdnim and it takes up to 1 minute for a full cold compile and I'm wondering what takes so long
15:20:36*inamannerofspeak joined #nim
15:23:47FromDiscord<DuckKing89> Hi, I tried to run my first nim program after installing it, but my mac terminal couldn't recognize the command 'nim'
15:25:16FromDiscord<DuckKing89> I created a directory .nimble/bin in my user folder for all the nim files, but maybe I wasn't supposed to do that
15:26:45FromDiscord<DuckKing89> the installation seemed to run smoothly in my terminal though...
15:27:34FromDiscord<haxscramper> Did you add `~/.nimble/bin` to your `$PATH`? Choosenim installer shows this message at the end of installation if I remember correctly.
15:27:58*birdspider left #nim ("Leaving")
15:31:02FromDiscord<DuckKing89> Ok I will do some research, I don't even know what $PATH means, even though I've seen it a couple of times. I'm not a very experienced programmer, dabbled in Objective-C, before trying Python for some months and now nim 🙂
15:33:22FromDiscord<DuckKing89> Ok, I did echo $PATH and this came up "/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin"
15:42:53FromDiscord<haxscramper> I'm not exactly sure how it is done on Mac, but you probably need to add something like `export PATH="$HOME/.nimble/bin:$PATH"` to `~/.bashrc`
15:43:45*Vladar quit (Remote host closed the connection)
15:56:40FromDiscord<TennisBowling> In reply to @haxscramper "I think someone linked": thanks! finally got it
16:04:21ForumUpdaterBotNew thread by Quokka70: Migrating from v 1.0: "raise effects differ", see https://forum.nim-lang.org/t/7796
16:10:40*beshr joined #nim
16:19:29*inamannerofspeak quit (Ping timeout: 265 seconds)
16:21:38*inamannerofspeak joined #nim
16:38:15*zedeus quit (Ping timeout: 260 seconds)
16:38:33FromDiscord<mlokis> what is up with all these bots sending messages for ppl?
16:40:39leorize[m]this channel is bridged to irc
16:40:56leorize[m]the bots you see are people in different platforms
16:41:03*zedeus joined #nim
16:41:23FromDiscord<Yardanico> In reply to @mlokis "what is up with": they are real people, and if you mean ForumUpdaterBot - it's a bot that posts new posts/threads/questions/packages etc from the forum/reddit/stackoverflow/nimble
16:41:53FromDiscord<mlokis> In reply to @Yardanico "they are real people,": yes i get that but why do they use bot user
16:42:14FromDiscord<Yardanico> they're not "using" that
16:42:23FromDiscord<Yardanico> Discord always shows all messages sent through webhooks as "bot"
16:42:42FromDiscord<mlokis> oh i see that answer i wos looking for
16:43:07FromDiscord<Yardanico> the bridge is https://github.com/Yardanico/ircord
16:43:33FromDiscord<mlokis> its not really casual thing
16:44:15FromDiscord<mlokis> In reply to @Yardanico "the bridge is https://github.com/Yardanico/ircord": now i see why
16:45:14FromDiscord<mlokis> just nobody knows about nim, how annoying
16:46:27FromDiscord<Yardanico> ???
16:55:08*shmorgle joined #nim
16:55:57FromDiscord<mlokis> i mean considering how powerful the language is, there is very small community around it, browser sometimes associates nim with something else. It probably makes difference when there is company behind a language, compared to... volunteers i guess
17:00:05*conkker quit (Quit: The Lounge - https://thelounge.chat)
17:00:23*hnicke joined #nim
17:03:39*vicfred joined #nim
17:04:45*conkker joined #nim
17:09:36*hsh quit ()
17:12:07*hnicke is now known as hnicke2
17:12:13*hnicke2 is now known as hnicke
17:12:35*hsh joined #nim
17:14:56*hnicke quit (Quit: Connection closed)
17:15:22*hnicke joined #nim
17:20:29FromDiscord<Hi02Hi> well despite rust having companies backing it, there is a game with the name rust. i think the browser associated nim with something else because there is a game called nim as well
17:21:11*PMunch joined #nim
17:21:29FromDiscord<IDF(ardek66)> there are atleast two other significant things called nim, and search engines dont really favour names of short length
17:22:45FromDiscord<Yardanico> New Indented Modula
17:24:03FromDiscord<Hi02Hi> In reply to @ClassyIDF "there are atleast two": c ends up being so short its unique
17:24:18FromDiscord<IDF(ardek66)> thats true
17:25:44FromDiscord<Yardanico> In reply to @mlokis "i mean considering how": it also depends on the data collected by a search engine about you :)
17:26:02FromDiscord<Yardanico> if it knows that you like programming topics, it's more likely to give you nim (the language) over nim (the game)
17:26:57PMunchMy biggest issue there is the IBM thing called Nim
17:27:02FromDiscord<mlokis> In reply to @Yardanico "if it knows that": yes i search almost only programming topics
17:27:06PMunchIt's computer related so Google seems to struggle in telling them apart..
17:27:29FromDiscord<IDF(ardek66)> yeah when i started learning nim i ended up reading a good part of the ibm nim thing until i realised they are totally different
17:27:32PMunchBut the Nim game tends to go away after a while of searching for Nim the language related stuff
17:27:41FromDiscord<Yardanico> true
17:28:14PMunchStream is live now by the way (sorry for the delay), today I'm doing I²C :D
17:28:22PMunchhttps://www.twitch.tv/pmunche
17:31:02FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2Wcl
17:31:29FromDiscord<IDF(ardek66)> why new
17:31:38FromDiscord<Yardanico> In reply to @jtiai "Trying to make some": you can't do "new result"
17:31:43FromDiscord<Yardanico> and don't need to, since it's not a ref type
17:31:48FromDiscord<Yardanico> just remove that line
17:32:15FromDiscord<Yardanico> also you should probably rename the proc from newSomeType to initSomeType :)
17:32:30FromDiscord<Yardanico> that's the nim "convention" - heap allocating types are created with newX, stack - initX
17:33:12FromDiscord<jtiai> stackoverflow bit me again 🙂 (note to myself: remember how crappy SO is)
17:33:37FromDiscord<jtiai> How do I know when things go to stack and when heap?
17:34:19FromDiscord<Yardanico> if you're dealing with strings/seqs/ref/new something then it's probably on heap
17:34:44FromDiscord<jtiai> well there will be seq.
17:35:15FromDiscord<jtiai> okay now I did get "no generic parameters allowed for SomeType"...
17:38:09ForumUpdaterBotNew question by Joshua Cohen: Cube not appearing in OpenGL, see https://stackoverflow.com/questions/67113403/cube-not-appearing-in-opengl
17:38:31FromDiscord<Yardanico> In reply to @jtiai "okay now I did": what's your SomeType definition?
17:39:58FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2Wco
17:42:15FromDiscord<Yardanico> and what's the full error?
17:42:53FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2Wcp
17:42:58FromDiscord<dk> the code you posted compiles
17:43:31FromDiscord<jtiai> Ah bummer. Different file 😄
17:46:03FromDiscord<jtiai> What's the difference between func and proc? I seem to use both without any knowledge is there a difference or not...
17:47:27FromDiscord<Yardanico> func is a proc with a {.noSideEffect.} pragma
17:47:37FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#pragmas-nosideeffect-pragma
17:49:51hnickehey! maybe someone can help me out: https://forum.nim-lang.org/t/7798
17:50:42ForumUpdaterBotNew thread by Hnicke: Generic type parameters and inheritance, see https://forum.nim-lang.org/t/7798
17:51:22FromDiscord<Yardanico> I'm not sure, but I don't think that generics works with inheritance like that
17:59:05*Vladar joined #nim
18:00:29FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2Wcy
18:00:48FromDiscord<Yardanico> again
18:01:01FromDiscord<Yardanico> it explicitly that it got seq[Memory] and ref Memory
18:01:06FromDiscord<Yardanico> Memory and ref Memory are two different types
18:01:15FromDiscord<Yardanico> you're trying to add ref Memory to Memory
18:01:19FromDiscord<jtiai> I tried to ref Memory but no change..
18:01:33FromDiscord<jtiai> (edit) "I tried to ... refchange" added "change" | "change.." => "change in error.."
18:02:13FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2Wcz
18:02:26FromDiscord<Yardanico> did you have programming experience apart from nim?
18:02:34FromDiscord<jtiai> 37 years.
18:02:36FromDiscord<Solitude> bus should be var
18:02:44FromDiscord<jtiai> But bus is var...
18:02:53FromDiscord<Solitude> then its doomed
18:03:17FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WcB
18:03:55FromDiscord<Solitude> kinda hard to deduce whats your problem by fishing for 1 line snippets from you
18:04:52FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WcC
18:05:16FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WcD
18:05:37FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WcE
18:05:49FromDiscord<Solitude> sent a code paste, see https://play.nim-lang.org/#ix=2WcF
18:06:12FromDiscord<Solitude> https://nim-lang.org/docs/manual.html#procedures-var-parameters
18:06:50FromDiscord<jtiai> so I need to put var in front of everything?
18:07:03FromDiscord<Solitude> you need to put var in front of things you want to mutate
18:07:06FromDiscord<jtiai> And if it's not var it's something like let/const
18:07:59FromDiscord<0000> 37 years of experience in what? logo motion?
18:08:56FromDiscord<jtiai> various basic, various assembers, pascal, c/c++, mdl, smallworld magik, and lately python.
18:09:04FromDiscord<jtiai> https://nim-lang.org/docs/tut1.html#the-var-statement
18:09:36FromDiscord<jtiai> But that tutorial says I can put vars with indentation...
18:09:48FromDiscord<jtiai> like in my code. is tutorial wrong?
18:09:58FromDiscord<Yardanico> no, it's not wrong
18:10:09*lritter quit (Quit: Leaving)
18:10:12FromDiscord<Yardanico> it's just simplified so that _beginners_ can understand normal vars
18:10:19FromDiscord<Yardanico> you got a link to the manual explaining var in procedures
18:10:36FromDiscord<jtiai> I'm quite beginner of Nim.
18:10:46FromDiscord<Yardanico> in Nim all value types are immutable when passed to procedures/funcs (like in any other native language), you have to specify `var` if you want to modify the original
18:10:49FromDiscord<jtiai> I don't understand why tutorial doesn't work with my code.
18:11:24FromDiscord<jtiai> so its not about my variable definitions but my funcs/procs?
18:11:29FromDiscord<jtiai> and their arguments
18:11:35FromDiscord<Solitude> https://nim-lang.org/docs/manual.html#procedures-var-parameters
18:12:38FromDiscord<Yardanico> right now with your code `connectMemory` _copies_ Bus and all of its contents (including the seq of Memory, since seqs and strings are value types too)
18:12:40FromDiscord<Yardanico> same for connectIO
18:12:49FromDiscord<Yardanico> same for write/read
18:12:56FromDiscord<jtiai> so parameter by value. Right.
18:13:02FromDiscord<Yardanico> because it's a value type
18:14:50FromDiscord<jtiai> What's the convention for naming parameters that do conflict with built ins?
18:15:48FromDiscord<Yardanico> for example?
18:15:48FromDiscord<Solitude> naming them something else?
18:16:05FromDiscord<Solitude> if it has same name as keyword, pretty sure you can still use it
18:16:10FromDiscord<Yardanico> yes, just with stropping
18:16:19FromDiscord<Yardanico> and for things like `len` or similar in most cases it'll work anyway
18:17:12FromDiscord<Yardanico> but don't do that
18:17:12FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2WcK
18:18:34FromDiscord<jtiai> probably nim doesn't like my `addr` parameter name...
18:19:11*natrys quit (Ping timeout: 240 seconds)
18:20:03FromDiscord<Yardanico> that's a keyword
18:20:21FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#lexical-analysis-identifiers-amp-keywords
18:20:24FromDiscord<Yardanico> lists all keywords
18:30:59*natrys joined #nim
18:44:40FromDiscord<dom96> PMunch: you around? playground is down
18:44:49PMunchI know, but I can't SSH into it..
18:45:38PMunchOh wait, now it does
18:46:23PMunchHmm, it appears to be running
18:46:46PMunchBut it's updating the images (probably prompted by the 1.4.6 version) and cleaning up all the old ones takes a while..
18:47:15PMunchIt should be back to normal in a while, I hope
18:47:22PMunchI'll check on it when I'm done streaming
18:47:26PMunch@dom96 ^
18:49:49FromDiscord<mlokis> doesn't stackowerflow recognize nim in markup
18:49:57FromDiscord<Yardanico> it doesn't
18:51:10FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WcS
18:53:04FromDiscord<sealmove> well, is it it declared? :p
18:53:45FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WcU
18:54:09FromDiscord<mlokis> nim does not even have a tag on overflow, jeez
18:54:37FromDiscord<mlokis> i have to get that reputation and create it,
18:55:57FromDiscord<Yardanico> In reply to @mlokis "nim does not even": it does lol
18:56:16FromDiscord<mlokis> how is it called?
18:56:25FromDiscord<mlokis> Nim?
18:56:33FromDiscord<Yardanico> or is this just mass hallucination https://media.discordapp.net/attachments/371759389889003532/832328557518389328/unknown.png
18:56:35FromDiscord<Yardanico> @mlokis nim-lang
18:56:42FromDiscord<Yardanico> https://stackoverflow.com/questions/tagged/nim-lang
18:56:45FromDiscord<mlokis> i see
18:57:07FromDiscord<Yardanico> but it's rarely used for Nim
18:57:19FromDiscord<Yardanico> since you're more likely to get an answer here or on the forum
18:58:24ForumUpdaterBotNew question by Jakub D&#243;ka: How to pass multiple code-blocks to template in nim?, see https://stackoverflow.com/questions/67114529/how-to-pass-multiple-code-blocks-to-template-in-nim
18:58:32FromDiscord<Yardanico> @mlokis are you Jakub^?
18:58:35*inamannerofspeak quit (Ping timeout: 246 seconds)
18:58:38FromDiscord<mlokis> yea i hed an idea to add some q&a for things that were paifull to figure out
18:58:45FromDiscord<Yardanico> but isn't that not allowed on SO
18:58:57FromDiscord<Yardanico> oh, apparently it is, okay
18:59:11FromDiscord<mlokis> yea they explicitly support it
18:59:23FromDiscord<Yardanico> i can spam hundreds of questions then if I wanted to :)
18:59:50FromDiscord<mlokis> even that can help if you give answers
19:07:32FromDiscord<sealmove> is the author of nimpy active here?
19:08:33FromDiscord<Solitude> barely, you have more chance catching him on forum
19:09:37FromDiscord<sealmove> Ok. I am having trouble with it because a py library I am loading uses overloaded operators which are not exposed to Nim.
19:09:47FromDiscord<sealmove> Or if they are, I don't know how to use them.
19:10:22FromDiscord<Yardanico> can you show a simple example for me to test?
19:10:33FromDiscord<Yardanico> i'm goot at bruteforcing solutions for things like that
19:10:49FromDiscord<sealmove> thanks! let me try
19:11:00FromDiscord<Yardanico> In reply to @รєคɭ๓๏שє "thanks! let me try": https://github.com/yglukhov/nimpy/issues/151
19:11:09FromDiscord<Yardanico> there's an example
19:11:31FromDiscord<sealmove> oh, hmm, this might work
19:12:54FromDiscord<sealmove> wow!!! it works!
19:14:14FromDiscord<sealmove> thanks so much Yarda
19:15:25FromDiscord<sealmove> now the last thing I'd like to find a workaround for, is finding an equivalent of `` expansion
19:16:56FromDiscord<Yardanico> you mean args and/or kwargs?
19:17:13FromDiscord<Yardanico> @sealmove
19:17:16FromDiscord<Yardanico> and from which side to which
19:18:05FromDiscord<Yardanico> because there's https://github.com/yglukhov/nimpy/blob/master/tests/tnimfrompy.py#L10 https://github.com/yglukhov/nimpy/blob/master/tests/nimfrompy.nim#L12
19:18:28FromDiscord<sealmove> `` instead of ``?
19:22:10FromDiscord<sealmove> um, I am noob in Python so not sure if it's args/kwargs. there is a method in python that accepts varargs, and I have the arguments i want to pass to it in an array. so instead of writing `theMethod(arr[0], arr[1], ...)` I want to expand them, because they are too many. In Python examples this is done like: `theMethod(arr)`.
19:22:26FromDiscord<sealmove> (edit) "an array." => "a seq."
19:27:07*inamannerofspeak joined #nim
19:27:30*hsh quit ()
19:29:22FromDiscord<sealmove> In reply to @Yardanico "and from which side": from python to nim (in nim module)
19:32:27*inamannerofspeak quit (Ping timeout: 268 seconds)
19:35:16*justsomeguy joined #nim
19:35:46*inamannerofspeak joined #nim
19:35:47*hnicke quit (Quit: Connection closed)
19:39:02FromDiscord<sealmove> hmm nevermind, it seems to work now without using any operators for expanding the seq
19:39:10FromDiscord<sealmove> that's nice
19:45:17*rolha joined #nim
19:51:41FromDiscord<Mustache Man> are there other great books on Nim besides Nim In Action?
19:54:06FromDiscord<zetashift> Not really a book but I really liked: https://xmonader.github.io/nimdays/ as a follow up to NIA
19:54:06FromDiscord<Yardanico> there are no other "real" nim books (with ISBN and stuff)
19:54:20FromDiscord<Yardanico> there's http://ssalewski.de/nimprogramming.html
19:54:39FromDiscord<Yardanico> which focuses a bit more on the CS side of the things
19:54:49FromDiscord<Mustache Man> awesome, thank you both
19:55:08FromDiscord<Yardanico> generally check out https://nim-lang.org/documentation.html
20:03:34FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2Wdr
20:04:19FromDiscord<sealmove> because this is not how you construc tobjects
20:04:34FromDiscord<Yardanico> In reply to @jtiai "if I have constructor:": nim doesn't have "constructors"
20:04:40FromDiscord<Yardanico> newMemory is just a proc, and should be called as such
20:04:48FromDiscord<Yardanico> var ram = newMemory(...)
20:05:58FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2Wds
20:06:04FromDiscord<Yardanico> Memory
20:06:06FromDiscord<Yardanico> not newMemory :)
20:06:10FromDiscord<sealmove> (edit) "https://play.nim-lang.org/#ix=2Wds" => "https://play.nim-lang.org/#ix=2Wdt"
20:06:14FromDiscord<Yardanico> but he wants to use a his own proc in this case
20:06:17FromDiscord<Yardanico> (edit) removed "a"
20:06:26FromDiscord<sealmove> yeah, it's a common pattern in Nim
20:07:25FromDiscord<jtiai> makes sense because there is no actual oop either.
20:07:58FromDiscord<Yardanico> depends on what you mean by OOP
20:08:04FromDiscord<Yardanico> nim has inheritance and methods
20:10:08FromDiscord<jtiai> Sorry meant class based oop. (just happen to call it oop because it's been my dayjob last 25 years... 🙂 )
20:11:00*inamannerofspeak quit (Ping timeout: 265 seconds)
20:11:09*haxscram` left #nim ("ERC (IRC client for Emacs 27.2)")
20:13:57*hsh joined #nim
20:14:38FromDiscord<zetashift> @haxscramper how is haxorg coming along? I was thinking about making a small org file viewer with fidget as a weekend, is there any low hanging fruit I can help with?
20:14:39*hsh quit (Client Quit)
20:19:11FromDiscord<zetashift> @jtiai Nim has " minimal" OOP support, fancy stuff can be implemented by macros: http://www.cross-code.com/en/home
20:19:17FromDiscord<haxscramper> In reply to @zetashift "<@!608382355454951435> how is haxorg": No, there are really no blockers except for lack of time. I'm considering rewriting parser implementation to use proper lexer, but everything else is pretty straightforward so you can just test it and report found bugs (or even try to fix them). That is for org-mode parser stuff
20:19:18FromDiscord<zetashift> https://github.com/bluenote10/oop_utils
20:19:23FromDiscord<zetashift> (edit) "macros: http://www.cross-code.com/en/home" => "macros"
20:19:50FromDiscord<haxscramper> I can already generate org-mode tree together with all drawers, headers etc. https://media.discordapp.net/attachments/371759389889003532/832349516438831134/unknown.png
20:19:50FromDiscord<Yardanico> oh, github updated previews
20:19:59FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2Wdw
20:20:12FromDiscord<zetashift> In reply to @Yardanico "oh, github updated previews": I didn't even notice, pretty cool
20:20:14FromDiscord<Yardanico> In reply to @jtiai "when I try to": you need to export the field if you're using it from a different file
20:20:21FromDiscord<Yardanico> all symbols/fields are private by default
20:20:37FromDiscord<jtiai> Good point. Forgot the asterisk.
20:20:39FromDiscord<zetashift> In reply to @haxscramper "No, there are really": I'll try to help whereever possible!
20:21:26FromDiscord<haxscramper> In reply to @haxscramper "I can already generate": But I got my attention evenly spread across haxorg/haxdoc/hcparse/hmisc(minor fixes) so I probably need to focus on the thing more and push it to some logical v0.1
20:21:38FromDiscord<zetashift> There is also : https://github.com/gagbo/tree-sitter-org which might be interesting to look at
20:21:49FromDiscord<jtiai> Finally my cpu emulation basics is coming together.
20:21:57FromDiscord<zetashift> In reply to @haxscramper "But I got my": I get that, thanks for your time 😄
20:25:57FromDiscord<haxscramper> In reply to @zetashift "There is also :": Yes, I've seen it (along with basically every other org-mode parser in existence), but most of them are only targeted at supporting subset of org-mode, and don't really try to improve it (like you can't have full words for priority cookies, only single `[#C]`aracter, or lack of good old `#hashtags`). Also no attention to embedded source code evaluation and support for external tools usually
20:28:07FromDiscord<zetashift> Those are very hard problems to solve, no?
20:28:16FromDiscord<haxscramper> No, they are trivial
20:29:40FromDiscord<jtiai> Can I cast `var foo = Foo()` to `ref Foo` somehow?
20:29:53FromDiscord<haxscramper> In reply to @zetashift "Those are very hard": This gets a little more involved when I add single lexer (that is why I'm still considering whether this has to be done or not), but overall this is just https://github.com/haxscramper/haxorg/blob/17b05663a430c37a931bf8a7bf7e49a895be34e9/src/haxorg/parser.nim#L728
20:30:05FromDiscord<Yardanico> In reply to @jtiai "Can I cast `var": you're trying to do it the wrong way
20:30:12FromDiscord<Yardanico> if you want a ref type, you can just do var foo = new Foo()
20:30:13FromDiscord<Yardanico> if Foo is a type
20:30:44FromDiscord<jtiai> That's what I thought too.
20:30:53FromDiscord<zetashift> In reply to @haxscramper "This gets a little": ah I see
20:30:57FromDiscord<Yardanico> you have some really weird ref/non-ref mixing in your code @jtiai
20:31:04FromDiscord<Yardanico> not sure why
20:31:08FromDiscord<dom96> PMunch: according to Cloudflare it's been like this since 11am
20:31:22FromDiscord<jtiai> Because it has evolved over last few days.
20:31:27FromDiscord<dom96> anyway, why does rebuilding the images just freeze it?
20:31:31FromDiscord<jtiai> And based mostly on my knowledge how to do that in C(++)
20:32:30FromDiscord<haxscramper> In reply to @zetashift "<@!608382355454951435> how is haxorg": Though for it is probably won't be ready for "org file viewer" unless you just need the AST for org-mode. If that is the case it is available already (though I found out I need to push the new version because of some broken dependencies)
20:35:14FromDiscord<zetashift> From the AST I can just decide what to render right?
20:35:36FromDiscord<jtiai> Also I do have less than 20 hours experience with nim so gets a while to be proficient.
20:37:14FromDiscord<Yardanico> In reply to @jtiai "Also I do have": sorry for such an impolite question, but I'm just curious - how old are you?
20:39:04FromDiscord<jtiai> Only 46 :)
20:40:33FromDiscord<haxscramper> In reply to @zetashift "From the AST I": Correct. There is a "raw" AST https://github.com/haxscramper/haxorg/blob/master/src/haxorg/ast.nim which only contains document structure (mostly implemented, only bugs & missing features should be added) and "semchecked" AST that is still mostly in design stage (https://github.com/haxscramper/haxorg/blob/master/src/haxorg/semorg.nim). I'm still considering some smaller implementation details
20:41:08FromDiscord<haxscramper> > only bugs & missing features should be added↵only bugs should be fixed & missing features added
20:41:18FromDiscord<zetashift> In reply to @haxscramper "Correct. There is a": Sweet a lot seems done already
20:48:07PMunch@dom96, sorry just got done streaming
20:48:21PMunchIt's been buggy for a couple of days now
20:49:07PMunchStarted two days ago I think, then I upgraded it and it worked for a while until the new release came out I guess..
20:49:38PMunchRebuilding the image shouldn't freeze it. But docker prune seems to lock up all docker activity until it is done
20:50:02PMunchAnd docker isn't very good at cleaning up all these small containers that the playground is creating, so when it's starting to clean it takes a while
20:53:11FromDiscord<zetashift> In reply to @jtiai "Also I do have": I mapped C#/Python semantics to Nim a lot when I started, try to let it go a bit then things become clear
20:55:05FromDiscord<zetashift> Also I found this also very enlightening: https://peterme.net/nim-types-originally-a-reddit-reply.html
21:02:21FromDiscord<jtiai> I just try to apply all my expertise I have. And it helps because when I started programming there wasn't websites... :) those came much later.
21:18:04FromDiscord<ElegantBeef> Prestige have you got nimscripter working for your bot, dont recall if you told me the progression?
21:22:32FromDiscord<clyybber> @timotheecour Are you still on gitter mostly? We have a #nim-internals channel on IRC/Discord; it's not briged to gitter right now (maybe it should, but gitter seems dying)?
21:22:37*haxscramper quit (Remote host closed the connection)
21:22:39FromDiscord<clyybber> (edit) "dying)?" => "dying)"
21:26:35Prestige@ElegantBeef sorry haven't gotten to it, been busy. Might be trying it out soon
21:38:16*inamannerofspeak joined #nim
21:40:38PMunch@dom96, I seem to have broken it completely now. Disabled the docker and cron services so it wouldn't get stuck in the update script. Then I rebooted, but now it doesn't seem to come back online..
22:06:51*inamannerofspeak left #nim (#nim)
22:09:29*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
22:10:25*pbb joined #nim
22:15:04*Vladar quit (Quit: Leaving)
22:37:25*clyybber quit (Quit: WeeChat 3.1)
22:55:26kinkinkijkinhmm, is there a way to make a seq the length of another quickly?
22:55:41kinkinkijkinwithout just iterating .add() in a loop
22:57:42FromDiscord<ElegantBeef> `seq.setLen`
23:00:01kinkinkijkinthx
23:00:23*audiophile joined #nim
23:00:46audiophilehi anyone know if a package exists for wrapping anki? like the spaced repetition thingy
23:00:51audiophilenimble search says no
23:27:24PMunchUgh, I need to get some sleep before work tomorrow. The playground is still rebuilding the containers, so it won't be back online until tomorrow
23:27:33*PMunch quit (Quit: leaving)
23:43:43*abm joined #nim
23:48:35FromDiscord<Sabena Sema> does the `static T` = `static[T]` syntax only work with `static`?
23:53:11*natrys quit (Ping timeout: 240 seconds)
23:53:38*natrys joined #nim
23:53:48*natrys quit (Client Quit)
23:54:11federico3https://www.reddit.com/r/embedded/comments/mr9uxx/highlevel_language_for_embedded_systems_that_is/