<< 11-04-2020 >>

00:01:13FromDiscord<KingDarBoja> By the way, to perform comparison between objects, I assume `==` isn't enough, right?
00:02:19leorize[m]`==` is more than enough
00:02:44leorize[m]though feel free to implement your own if you require custom logic
00:02:58leorize[m]note that for `ref object`, you gotta do `x[] == y[]``
00:03:06leorize[m] * note that for `ref object`, you gotta do `x[] == y[]`
00:04:37FromDiscord<KingDarBoja> Ahhhh
00:08:54FromDiscord<KingDarBoja> Tried on the example and failed lol
00:09:10FromDiscord<KingDarBoja> Sorry to ask you but can you show me how on the example? 🙈
00:14:17leorize[m]https://play.nim-lang.org/#ix=2hwL
00:14:26leorize[m]this is one of those cases where you need a custom `==`
00:16:22leorize[m]https://play.nim-lang.org/#ix=2hwL
00:16:32leorize[m] * https://play.nim-lang.org/#ix=2hwM
00:16:41leorize[m]this also works
00:17:08leorize[m]it depends on whether `ref` was a good choice to be fair :P
00:17:14FromDiscord<KingDarBoja> Checking both right now
00:20:49FromDiscord<KingDarBoja> You are right... thinking about the ref choice was smart or not 😆
00:21:58FromDiscord<KingDarBoja> I think I made the choice because of this
00:22:03*FromDiscord <KingDarBoja> Ref objects should be used whenever inheritance is used. It isn't strictly necessary, but with non-ref objects assignments such as let person: Person = Student(id: 123) will truncate subclass fields.
00:22:11FromDiscord<KingDarBoja> https://nim-lang.org/docs/tut2.html#object-oriented-programming-inheritance
00:22:51leorizethen maybe you gotta rethink if inheritance was the way to go :)
00:23:43FromDiscord<KingDarBoja> But I remember on my notes this
00:24:02FromDiscord<KingDarBoja> _regular objects cannot be nil_ by libq-dev
00:25:38leorizethen you remember that Option[T] exist
00:25:57FromDiscord<KingDarBoja> Yeah
00:26:07FromDiscord<KingDarBoja> Need to rethink a bit
00:26:08leorizedon't choose `ref` if all you want is `nil`
00:26:36FromDiscord<KingDarBoja> The downside is having to provide the argument as some(T) on my proc call
00:26:58FromDiscord<KingDarBoja> But ofc Option saves me from having to make multiple proc for Union Types
00:27:01leorizeor you can have an overload with T and one without
00:27:35FromDiscord<KingDarBoja> I was speaking of things like `seq[T] or T` but yeah, overload
00:27:45FromDiscord<KingDarBoja> I saved the conversation we had last night 😄
00:28:45FromDiscord<KingDarBoja> But also, if multiple params requires Union Types = more overload calls = more headache
00:30:02leorizemaybe you're not looking at the right angle
00:30:35FromDiscord<KingDarBoja> Maybe I am not, remember I am a newbie at Nim coming from Python background trying to do a Nim port of some Python lib
00:30:36FromDiscord<KingDarBoja> 🙈
00:30:58leorizepython tempts you into `ref` because that's the only thing python has :p
00:31:01FromDiscord<KingDarBoja> Once again, apologies if I am asking too much
00:31:29FromDiscord<KingDarBoja> My first crash from common OOP into Nim was the inheritance for the AST
00:31:47FromDiscord<KingDarBoja> as some derived types (child classes) had the same name but different type
00:31:56FromDiscord<KingDarBoja> And ofc, the case kind approach doesn't allow that
00:32:04leorizeasking that's kinda the point of this channel
00:32:10FromDiscord<KingDarBoja> Had to go into old inheritance
00:32:45FromDiscord<KingDarBoja> And ended up with this
00:32:53FromDiscord<KingDarBoja> https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L86
00:33:59FromDiscord<KingDarBoja> Which is used on the Parser
00:36:13FromDiscord<KingDarBoja> Variount, awr1, libd-dev, Yardanico, Rika-sensei have been solving my questions but ofc the Python chip is stuck on my mind lol
00:37:37leorize[m]does the Nim-style NimNode not work here?
00:38:10leorize[m]oh, you want the same ident to have different meaning
00:38:33leorize[m]that's equal to setting up a maze for yourself
00:38:38FromDiscord<KingDarBoja> By ident you mean an prop?
00:38:47leorize[m]yea
00:38:49FromDiscord<KingDarBoja> Prop = class member
00:39:37leorize[m]same name different meaning is usually not something I'd consider "readable"
00:40:43FromDiscord<KingDarBoja> Yeah, that's what I get for porting things the same way as the source code lol
00:41:30leorizebe a bit more creative
00:41:41leorizea variant type is perfect for this use case :)
00:42:06*NimBot joined #nim
00:44:19FromDiscord<Avatarfighter> Don't mean to bother but how would one convert an int to its byte representation? I'm only finding stuff on going from bytes -> int but nothing for the other way.
00:44:50leorizeint is it's byte representation :)
00:44:59FromDiscord<Avatarfighter> o
00:45:17leorizeor if you want the boring way: `cast[array[sizeof(int), byte](int)`
00:46:05FromDiscord<KingDarBoja> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
00:47:14leorize@Avatarfighter: maybe you actually have to cast the address, I'm not sure :p
00:47:31leorizebut that's basically how it's done
00:48:08FromDiscord<__ibrahim__> how can the same nim code work on mac but give errors on windows? could it be the compiler differences?
00:48:21leorizedepends on the error
00:48:23FromDiscord<Avatarfighter> welp I've found a little bug https://dsh.re/937b2
00:48:35FromDiscord<Avatarfighter> or rather unexpected output
00:50:03*korakon joined #nim
00:50:30FromDiscord<Avatarfighter> hm idek what that is it has like all the method names in my binary near the bottom
00:51:16leorizedid you just `cat` your own binary?
00:51:34*Tyresc quit (Quit: WeeChat 2.7-dev)
00:51:36FromDiscord<Avatarfighter> i did not lma
00:52:07FromDiscord<Avatarfighter> https://dsh.re/e1cdf
00:52:15FromDiscord<Avatarfighter> just messing around atm
00:57:06FromDiscord<KingDarBoja> Hey leo, by using object variants, the `ref` is needed for the base Node?
00:58:19leorizeno, but yes
00:58:35*FromDiscord <KingDarBoja> Explain sensei
00:59:22leorizeyes because you're going to reference the type within itself
00:59:32leorizeno because it's not a requirement of object variants
01:02:38FromDiscord<KingDarBoja> Okay, let's do this, gonna see if that will send to trash 2 days of porting lol
01:02:48*FromDiscord <KingDarBoja> insert call of duty sound
01:04:25leorize@Avatarfighter: lol you don't simply cast that into a `string`
01:04:29leorizeuse `$` instead lol
01:05:16leorizeactually `repr` is better since it can display blank characters
01:14:09FromDiscord<KingDarBoja> Mate and what happens if I want to provide one of the main Node kind (lookin at the example) to a child indent?
01:14:35FromDiscord<KingDarBoja> i.e. `nkAdd` has leftOp: anotherNodeKind ?
01:14:57*chemist69 quit (Ping timeout: 260 seconds)
01:15:30FromDiscord<Avatarfighter> Leorize ik I'm just messing to see if I can get a int into its binary representation lol
01:16:51*zacharycarter joined #nim
01:16:58*chemist69 joined #nim
01:34:34*lritter quit (Ping timeout: 258 seconds)
01:35:07*lritter joined #nim
01:48:57FromDiscord<Avatarfighter> Welp I got what I was looking for its less that I was trying to get my int into its binary representation but rather I was trying to write big endian into a StringStream which is basically an impossible task with the current streams lib but I understand why since that lib doesn't say its meant for binary data
01:54:58FromDiscord<KingDarBoja> https://github.com/nim-lang/RFCs/issues/19
01:55:54leorize[m]@Avatarfighter: it's... possible?
01:57:23FromDiscord<Avatarfighter> leorize: Yeah it's possible I just was doing it the exact opposite way of what was easy to do
01:57:34leorize[m]lol
01:58:33FromDiscord<Avatarfighter> leorize do you mind telling me if this is the best route to write big endian by any chance hahah 😄 https://dsh.re/357d3
01:59:23leorizelol no
01:59:29leorizeyou already messed it up
02:00:22*dddddd quit (Ping timeout: 256 seconds)
02:00:42FromDiscord<Avatarfighter> I swear im not this bad at nim I've never used these libraries before and I'm in unknown waters haha
02:00:44leorizenote that the two pointers passed to bigEndian must not be of the same one :P
02:00:53FromDiscord<Avatarfighter> but it works though?
02:01:22leorizefor when you're on an architecture where the compiler implements the intrinsic, yes
02:01:30FromDiscord<Avatarfighter> ah
02:01:41leorizebut the generic implementation straight up copy between the two pointers lol
02:01:51FromDiscord<Avatarfighter> hahah ok
02:04:01FromDiscord<Avatarfighter> So I should add another var to hold the number im passing in like so: https://dsh.re/5c369 ?
02:05:48*lritter quit (Quit: Leaving)
02:06:14FromDiscord<Avatarfighter> the reason why I don't want to pass a var into the proc instead is bc I still need the int i pass into my proc for later
02:06:32FromDiscord<KingDarBoja> I just finished reading this entire issue
02:06:33FromDiscord<KingDarBoja> https://github.com/nim-lang/Nim/issues/6638
02:07:16FromDiscord<KingDarBoja> And just made a quick change by removing ref of all my object types (base and derived) to see how it works the `==` operator
02:07:49FromDiscord<KingDarBoja> But damn, can't use `nil` for my object so any usage of `isNil` breaks my code lol
02:19:44FromDiscord<KingDarBoja> Going yeet with custom `==` for my ref objects xD
02:20:33*zacharycarter quit (Ping timeout: 265 seconds)
02:28:27*muffindrake quit (Ping timeout: 260 seconds)
02:30:36*muffindrake joined #nim
02:31:01leorizeAvatarfighter: sure that doesn't look bad
02:38:13FromDiscord<Avatarfighter> Cool thanks for the help leorize 😄
03:00:12*Zectbumo quit (Remote host closed the connection)
03:21:47*korakon quit (Remote host closed the connection)
03:38:59*waleee-cl quit (Quit: Connection closed for inactivity)
03:59:37FromDiscord<KingDarBoja> I just noticed `unindent` removes any whitespace character for every line in a string on Nim whereas Python textwrap.dedent does search for the common leading whitespace and removes it.
04:00:11FromDiscord<KingDarBoja> So the Nim version will keep any triple string quotes aligned on the same column whereas Python will keep the indentation
04:00:30*Hexeratops quit (Read error: Connection reset by peer)
04:06:01*supakeen quit (Quit: WeeChat 1.9.1)
04:06:25*Zectbumo joined #nim
04:06:28FromDiscord<Rika> what
04:06:41*supakeen joined #nim
04:06:44FromDiscord<KingDarBoja> A picture will show u
04:07:50FromDiscord<KingDarBoja> https://imgur.com/sOq9zLt
04:08:05FromDiscord<KingDarBoja> Left side, Python, right side Nim
04:08:15FromDiscord<KingDarBoja> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#string-ops
04:10:08FromDiscord<Rika> unindent(2)
04:10:21FromDiscord<Rika> pass in a number, it will do that much whitespace
04:10:47FromDiscord<Rika> if you dont, itll do all whitespace possible
04:10:49FromDiscord<Varriount> Araq: Why can't iterators be forward-declared?
04:11:55FromDiscord<KingDarBoja> Nope, it should be dynamic Rika
04:12:05FromDiscord<KingDarBoja> I mean, detect the common indentation and remove that only
04:12:18*FromDiscord <KingDarBoja> unless I calculate it myself
04:12:38FromDiscord<KingDarBoja> Need to look at textwrap.dedent to see how they do it
04:13:50FromDiscord<Rika> `Nope, it should be dynamic Rika` well i mean
04:13:54FromDiscord<Rika> its not what it does
04:14:39FromDiscord<Rika> the cost of it being dynamic would prolly be much more expensive than what it does right now
04:15:04FromDiscord<KingDarBoja> Yeah, don't get me wrong, I know what you mean 😄
04:21:52ryukopostinghttps://chromaengine.gitlab.io/ABOUT.html
04:22:05ryukopostingcoming soon to a git repo near you
04:28:02FromDiscord<Rika> ryukoposting: i have an idea, make it a goal to "be able to run DDLC" on that platform (of course after translation from python/renpy to nim/chroma)
04:28:23FromDiscord<Rika> because i think ddlc has some interesting renpy usage, not too sure
04:30:09ryukopostingoh it could easily do DDLC
04:30:32ryukopostingIt could do 95% of DDLC in its current state lmao, I'm not even done with the beta release yet
04:31:04ryukopostingidk if DDLC's creator would like it if I literally copied his game though
04:47:31FromDiscord<Rika> i mean dont post it of course
04:47:37FromDiscord<Rika> use it as an internal test haha
05:26:35*chemist69 quit (Ping timeout: 246 seconds)
05:27:10*rockcavera quit (Remote host closed the connection)
05:27:48*chemist69 joined #nim
05:51:00*thomasross quit (Ping timeout: 256 seconds)
06:06:28*ljoonal joined #nim
06:43:27*solitudesf joined #nim
07:00:00*gmpreussner quit (Quit: kthxbye)
07:04:37*gmpreussner joined #nim
07:05:18*opal quit (Ping timeout: 240 seconds)
07:06:45*opal joined #nim
07:11:30*lritter joined #nim
07:26:17*moerm joined #nim
07:26:28moermHello, everyone
07:40:09*solitudesf- joined #nim
07:42:43*solitudesf quit (Ping timeout: 250 seconds)
07:49:12*rokups joined #nim
07:53:24*moerm quit (Quit: Leaving)
07:53:52*solitudesf- is now known as solitudesf
08:05:10*dwdv joined #nim
08:12:03*leorize quit (Ping timeout: 240 seconds)
08:27:00*xcm quit (Remote host closed the connection)
08:29:44*xcm joined #nim
08:44:18FromDiscord<Gary M> Hello
08:49:37PrestigeAnyone here using nimlsp? For some reason the build is failing for me with nimble install nimlsp
08:49:58Prestigehttps://0x0.st/iSgd.txt
08:50:17PrestigeNim version 1.2.0 [Linux: amd64]
08:50:19*neceve joined #nim
08:56:58Prestigehm I think I may have gotten it to install but don't know how to search for installed packages
08:58:42FromDiscord<Recruit_main707> Has someone tried to run autoWIG on the produced Nim code?
09:03:55solitudesfPrestige, `nimble list -i`
09:04:11Prestigeah thank you. It seems it did fail to install
09:05:16solitudesfyou can add --debug flag, to also show compiler output
09:06:14Prestigehttps://0x0.st/iSEs.txt
09:06:40Prestige Error: cannot open file: /usr/nimsuggest/nimsuggest.nim - hmm
09:07:03solitudesfyes, it need nimsuggest source, which distros dont package
09:07:08solitudesfyou need to clone nim repo
09:07:27solitudesfand use -d:nimsuggestpath:<path to nimsuggest> flag
09:08:00PrestigeThanks I'll give that a shot
09:08:52solitudesfyou can pass flags to compiler with `nimble install` using `-p/--passNim`
09:12:26PrestigeI attempt giving it the directory of nimsuggest and also the nimsuggest.nimble file: https://0x0.st/iSEK.txt
09:12:37Prestiges/attempt/attempted
09:13:24solitudesfnimble install nimlsp -p:-d:nimblesuggestpath:/home/avahe/programming/nim/nimsuggest/
09:13:37solitudesfwait
09:13:43solitudesfits nimsuggestpath not nimblesuggest
09:13:44solitudesfcmon man
09:13:55solitudesfnimble --debug install nimlsp -d:nimsuggestpath:/home/avahe/programming/nim/nimsuggest/nimsuggest.nimble
09:14:11solitudesfnimble install nimlsp -p:-d:nimsuggestpath:/home/avahe/programming/nim/nimsuggest/
09:14:14solitudesf3rd time the charm
09:14:45*moerm joined #nim
09:15:01moermHello, again
09:15:13*xcm quit (Remote host closed the connection)
09:15:34Prestigehi moerm
09:15:45Prestigewoo thanks solitudesf
09:17:21*xcm joined #nim
09:22:22*neceve quit (Ping timeout: 256 seconds)
09:33:51FromDiscord<danielo515> Hello everybody. I was wondering what is the best way to iterate a sequence from certain index, or if it is better to create a new sequence from it?
09:33:59*krux02 joined #nim
09:34:34Yardanicothere are slices
09:34:57Yardanicohttps://play.nim-lang.org/#ix=2hzt
09:35:18Yardanicohttps://nim-lang.org/docs/tut1.html#advanced-types-slices
09:35:57FromDiscord<Varriount> @danielo515 If you want efficiency, use a `for` loop on a range `x..y`, and grab the element using the loop variable.
09:38:11FromDiscord<danielo515> Yes, I want efficiency, but not at the cost of readability 😄.
09:38:11FromDiscord<danielo515> What I want is, to iterate the seq from certain index (than can be achieved with the range starting at the index, nice) and stop when the sequence is exhausted or certain condition is met
09:38:53Prestigeniche question, does anyone have nim editing set up with coc-nvim?
09:39:34FromDiscord<danielo515> @prestige, no I don't but I know one vim "distribution" that has it set up, it's on a docker container so you can try it
09:40:02FromDiscord<Gary M> Hey guys, so I'm curious about the proper steps towards wrapping a C++ library with nim. I've read a few sparse things in the docs but overall I'm not clear on how to actually write a wrapper.
09:40:16Prestigewith coc-nvim? That'd be cool if I could see how they have it set up danielo515
09:41:17FromDiscord<danielo515> yep, it is called vindi
09:41:32FromDiscord<danielo515> https://github.com/D-Nice/vindi
09:42:03FromDiscord<danielo515> Here is the init.vim
09:42:04FromDiscord<danielo515> https://github.com/D-Nice/vindi/blob/master/etc/init/.config/nvim/init.vim
09:42:33moermHave a nice day all
09:42:38*moerm quit (Quit: Leaving)
09:42:54PrestigeLooks like they are actually using other nim plugins maybe
09:44:19Prestigeoh maybe not, they are registering nimlsp in coc-settings.json
09:44:34Prestigemaybe my nim setup just isn't proper
09:45:02Prestigewhen attempting to run nimlsp, I get "Unable to find "config/nim.cfg" in "/usr". Supply the Nim project folder by adding it as an argument."
09:45:27PrestigeI can supply it a config and it doesn't complain (from a terminal), but I'm getting no lsp features in the editor
09:48:39Prestigeah yep. 'Error: cannot open '/home/avahe/.config/nim/lib/system.nim'
09:50:43FromDiscord<danielo515> @Prestige, this VIM distro is on a docker container. Maybe you can run it, see if it fits your expectations and then investigate it's folder structure
09:51:26PrestigeIt appears my distro just didn't package nim in the way nimlsp expects, so I'm going to create some directories and symlink the config file
09:51:36Yardanicojust use choosenim :P
09:52:27Prestigedidn't know that existed, looks good
09:53:57PrestigeBut I did get it working with a single symlink so I'm happy for now
09:57:09FromDiscord<danielo515> mmm, is there a way to iterate a sequence of custom types?
09:57:41FromDiscord<danielo515> This is telling me there is no match for my sequence type:
09:57:41FromDiscord<danielo515>
09:57:41FromDiscord<danielo515> ```
09:57:41FromDiscord<danielo515> proc printFile(file:FileInfo, belowFiles: Slice[FileInfo]) =
09:57:41FromDiscord<danielo515> for f in belowFiles:
09:57:42FromDiscord<danielo515> ```
10:05:29FromGitter<alehander92> guys
10:05:38FromGitter<alehander92> i got my solid code book
10:05:45FromGitter<alehander92> starting to read books
10:05:50FromGitter<alehander92> about stuff
10:06:31FromGitter<alehander92> posts are awesome, didnt expect such a good delivery+service
10:07:32*planetis[m] joined #nim
10:08:46solitudesf@danielo515 Slice is not a sequence, its just a range
10:08:57PrestigeHave syntax highlighting, autocomplete, docs and everything in vim now. This is so awesome
10:10:52*xet7 quit (Quit: Leaving)
10:11:49planetis[m]i bought "classical computer science problems in python" in february but it got lost but thankfully manning will sent me another
10:17:58*Zectbumo quit (Remote host closed the connection)
10:18:35FromDiscord<danielo515> > @danielo515 Slice is not a sequence, its just a range
10:18:35FromDiscord<danielo515> Oh, so I can not iterate it then?
10:18:42Yardanicoyou can, but you need a seq
10:19:06YardanicobelowFiles should be seq[FileInfo] and you should pass it as a sequence
10:23:42*xet7 joined #nim
10:24:28*lritter quit (Quit: Leaving)
10:28:34FromDiscord<danielo515> My intention was to pass a sub-seq of the original and iterate it, but I think that may be to inneficcient
10:28:41FromDiscord<danielo515> I better pass the idx and the entire seq
10:28:55Yardanicoif you want to pass " sub-seq" you need to use a seq type anyway
10:29:01YardanicoSlice of a sequence returns a sequence
10:29:27Yardanico!eval echo @[1, 2, 4, 5][2..^1]
10:29:30NimBot@[4, 5]
10:29:31FromDiscord<danielo515> How do I slice a sequence?
10:29:34FromDiscord<danielo515> that's what I tried
10:30:04FromDiscord<danielo515> And I thought that created a slice. I may be wrong though
10:30:05FromDiscord<danielo515> By the way, how can I create a sequence with certain size and filled with one repeated value?
10:30:38YardanicoThere's "fill" in algorithm module
10:30:47Yardanicoand certain size - either newSeq or newSeqOfCap
10:30:57planetis[m]newSeqWith
10:31:02Yardanicooh
10:31:11Yardanicofrom sequtils
10:31:55FromDiscord<danielo515> newSeqWith is exactly what I was looking for
10:32:14FromDiscord<danielo515> Thanks
10:32:29FromDiscord<danielo515> I was looking for on the nim tutorial, and in seqUtils and I didn't found it
10:32:30FromDiscord<danielo515> my bad
10:39:23*dddddd joined #nim
10:39:51FromDiscord<danielo515> Is there an equivalent for arrays?
10:39:57Yardanicoarrays :)
10:40:09Yardanicohttps://nim-lang.org/docs/tut1.html#advanced-types-arrays
10:41:21Yardanicoarrays in nim are fixed-length (you can't change their length at runtime)
10:44:50FromDiscord<danielo515> yep, I tried to create an array and the compiler yelled at me
10:44:57FromDiscord<danielo515> I'll stick with seq then
10:46:31Yardanicothe simplest way to create an array is "let a = [1, 2, 3]"
10:52:19FromDiscord<danielo515> Thanks again
10:52:43FromDiscord<danielo515> Why other sequences has a len prop but this one does not?
10:52:44FromDiscord<danielo515> ```
10:52:44FromDiscord<danielo515> let depth = path.parentDirs.len
10:52:44FromDiscord<danielo515> ```
10:52:53Yardanicobecause parentDirs isn't a sequence
10:53:01Yardanicoit's an iterator
10:53:05Yardanicohttps://nim-lang.org/docs/os.html#parentDirs.i%2Cstring
10:54:06Yardanicoyou can either process its values in a for loop or do "let data = toSeq(path.parentDirs)"
10:54:13Yardanicoand use data.len where you need
10:54:16YardanicotoSeq is from sequtils
10:56:57FromDiscord<danielo515> I already have seqUtils imported
10:57:19FromDiscord<danielo515> I was doing this:
10:57:19FromDiscord<danielo515> ```
10:57:19FromDiscord<danielo515> var depth = 0
10:57:20FromDiscord<danielo515> for f in path.parentDirs: depth += 1
10:57:20FromDiscord<danielo515> ```
10:57:23FromDiscord<danielo515> But is kinda ugly
10:58:43FromDiscord<danielo515> Wow, I got an unexpected behavior
10:59:03FromDiscord<danielo515> I changed that to
10:59:03FromDiscord<danielo515> ```
10:59:03FromDiscord<danielo515> let depth = toSeq(path.parentDir).len
10:59:03FromDiscord<danielo515> ```
10:59:03FromGitter<faulander> good morning guys. if i get a Error: invalid indentation but there's clearly no indentation problem, what might be the error?
10:59:17FromDiscord<danielo515> And depth goes from 2,3 etc to 2, 11, 15...
10:59:19Yardanicoalso @danielo515 can you please not use ``` ? in IRC we see it as 3 lines
10:59:31Yardanico@faulander can you show the code example?
10:59:35FromDiscord<danielo515> Ok, how should I do it then?
10:59:46Yardanicojust like "let depth = toSeq(path.parentDir).len" or use paste services :P
11:00:01Yardanico@faulander or maybe you forgot to place some symbol like : or = somewhere
11:00:19FromGitter<faulander> for pattern in unWantedDirNames: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e91a342cc370f0b07d91310]
11:00:34FromGitter<faulander> ok, indentation is lost here
11:00:42FromGitter<Yardanico> that's not corrent nim anyway
11:00:50Yardanico" dir[:posUnwantedDirName+1]" I assume you wanted a slice?
11:01:40FromGitter<faulander> yes, true
11:01:58Yardanicoif you want to have this slice in nim do dir[0..posUnwantedDirName+1]
11:02:02FromGitter<faulander> from the beginning to the start of th match
11:02:04Yardaniconim slices are different from python slices
11:02:24Yardanicooh, or dir[0..posUnwantedDirName]
11:02:55FromGitter<faulander> (https://files.gitter.im/nim-lang/Nim/p4kh/image.png)
11:02:55FromGitter<faulander> (https://files.gitter.im/nim-lang/Nim/p4kh/image.png)
11:03:13FromGitter<faulander> aaaah, i need to learn to read first!
11:03:24Yardanicoxddd
11:03:59FromGitter<faulander> haha, i was happy that it's the same as in python ... the error is VERY missleading though
11:05:11Yardanicowell I hope you understand that Nim has much less common in Python than it seems at first :)
11:05:25Yardanicoand yeah, error could've been better
11:05:45FromGitter<faulander> yes, that's why i chose to consult the notes ... i just didn't read that the code example was for python, not nim.
11:06:05dom96What a lovely and sunny quarantine Easter weekend we have going on here, how's everybody doing?
11:06:41FromGitter<faulander> being in quarantine sucks ... but: Less clothing to wash, shorter way to work, more time for learning nim ... you continue.
11:08:08FromGitter<faulander> less possibility to waste cash, not needing to look at the face of the most unwanted employee, GOOD coffee, being able to vape ... i am an optimist and find good parts of almost any situation ;)
11:10:51dom96Nice, definitely a lot of silver linings :)
11:11:09FromDiscord<eliezedeck> Hey guys, when trying to `koch temp c ...`, I get an error saying `Error: system module needs: echoBinSafe` if I add `echo` something in `sysstr.nim`
11:11:15FromDiscord<eliezedeck> how can I solved this?
11:11:16dom96I guess us programmers, who are typically not very social anyway don't find it as tough as most people
11:11:30Yardanicovery true for me :P
11:11:58dom96eliezedeck: importc printf and use it instead
11:12:34FromDiscord<eliezedeck> ok, thanks
11:13:08FromDiscord<eliezedeck> I'm still curious as to why is it this way?
11:15:54*Vladar joined #nim
11:19:39FromDiscord<danielo515> I am playing with walkDirRec... and by default it only yields files, if I add a yieldFilter like `yieldFilter={ pcDir, pcFile }` then it yields all the folders, then all the files. Isn't a way to yield everything as it is traversed?
11:19:55FromDiscord<danielo515> like folder a, file a1, folder b, file b1, file b2
11:28:29FromGitter<faulander> for dir in walkDirRec(sourceDir, yieldFilter={pcDir}): #traverse all dirs in source path ⏎ for file in walkDirRec(dir, yieldFilter={pcFile}): # traverse all files in dir
11:29:52FromGitter<faulander> just use nested for loops, that's what i did anyway.
11:31:20FromGitter<faulander> another file related question to the pros here. i cannot find a renameDir proc ... is really moveDir the only option?
11:32:22Yardanicoit does the same
11:32:33FromGitter<faulander> speedwise not, or?
11:32:38Yardanicono, the same
11:32:46Yardanicowhen you MOVE the directory the FS doesn't actually copy any data
11:33:00Yardanicoit just changes the "place" where it's stored
11:33:04FromGitter<faulander> ok, perfect. thanks
11:33:54FromGitter<faulander> @dom96
11:34:22FromGitter<faulander> unfortunatelly i am not a programmer by profession, i am head of support and after project management. i code as a hobby.
11:34:23dom96??
11:38:11kungtotteI drive a septic tank truck for a living and spend my spare time in front of the computer, so aside from having to keep my distance at stores and not being able to go some places with my kid because they're closed, my life is identical during social distancing compared to before it.
11:38:44kungtotteI'd say it's even better in some regards because now I don't have to do some things I'd rather not, like go to my cousin's birthday party or his wedding :P
11:39:29FromGitter<faulander> i miss my family and friends. that's the only downside for me.
11:53:57FromDiscord<danielo515> > <FromGitter> <faulander> just use nested for loops, that's what i did anyway.
11:53:57FromDiscord<danielo515> @gitterirc
11:53:58FromDiscord<danielo515> In other languages I just use recursion. But since there is already a recursive for traverse I wanted to take advantage of. I can't use nested for loops because I want all directories and all files recursively, so I need to know when I "enter" a nested folder. I guess the best bet is to get all the folders rec, then list each folder for its contents
12:01:22go|dfish@danielo515 https://github.com/nim-lang/Nim/tree/version-1-2/lib/pure/os.nim#L2129
12:01:54go|dfishthat's the code for walkDirRec - don't think there is a way to get it to do what you want with how it's implemented
12:02:19FromGitter<alehander92> use recursion
12:02:36FromGitter<alehander92> kungtotte well birthdays can be fun
12:06:02*supakeen quit (Quit: WeeChat 1.9.1)
12:06:41*supakeen joined #nim
12:14:25*Guest86017 quit (Ping timeout: 250 seconds)
12:16:07*dadada joined #nim
12:16:38*dadada is now known as Guest93459
12:20:40FromDiscord<danielo515> Tha KS for the reference
12:21:33FromGitter<faulander> can i do something like that? ⏎ proc test(s:string, posStart:int = 0, posEnd:int = len(s)): string =
12:22:49YardanicoI think there was an issue and PR for that, but it wasn't merged, but let me find it
12:24:35Yardanicooh actually it works
12:24:35FromGitter<faulander> otherwise i set it to 0 and right after the declaration to len(s) - or is there a better way?
12:24:44Yardanicoyour code will work just fine
12:24:51Yardanicoalso you don't need to specify the type when you have a default value
12:24:59FromGitter<faulander> i got an error ... but maybe it's again because of something else :D
12:25:31Yardanicoproc test(s: string, posStart = 0, posEnd = len(s)): string = stuff
12:25:36Yardanicohttps://play.nim-lang.org/#ix=2hAq
12:27:02FromGitter<faulander> if i set the default to nil i don't have to set a type either?
12:27:06FromGitter<faulander> and thanks for the demo code
12:27:16Yardanicoyou have to set the type if you use "nil"
12:27:24Yardanicobut "nil" can only be used for ref types anyway
12:27:40FromGitter<faulander> how would i use optional arguments then?
12:27:52Yardanicoset a default value?
12:28:00FromGitter<faulander> just with an empty default value?
12:28:08FromGitter<faulander> ah, sure. makes sense :)
12:28:31FromGitter<faulander> i am such a newb :)
12:29:44FromGitter<faulander> i have to use the "*" for procs which should be useable after import. does it have any negative side effects, if i use the star on all procs right off the start?
12:30:23Yardanicowell the worst is that your proc might clash with some procedure from other module (since nim imports the whole module namespace by default), but it's really rare
12:30:38Yardanicoand programmer can fix it by specifying what to import from a module, or what NOT to import
12:32:38FromGitter<faulander> yes, i thought that. thanks.
12:33:00FromGitter<faulander> one more question. An empty string doesn't evaluate to false, is there a reason behin it?
12:34:18Yardanicowdym "evaluate to false"
12:34:25Yardanicoyou can't really convert a string to a boolean
12:34:39Yardaniconim is not python :)
12:36:16FromDiscord<Rika> hey, you can
12:36:18FromGitter<faulander> yes i know. but since i am coming from python, i am used to that behaviour and wonder why some decisions have been made. i don't have a problem to write if s == "" instead of if not s, but pythons clearer here
12:36:23FromDiscord<Rika> `string != ""`
12:36:24FromDiscord<Rika> easy
12:36:28FromGitter<sealmove> guys, is there a way to make this work: https://play.nim-lang.org/#ix=2hAu ?
12:36:39FromDiscord<Rika> it
12:36:41FromDiscord<Rika> oops
12:36:44FromDiscord<Rika> premature enter key
12:36:50Yardanico*cough*
12:37:10FromDiscord<Rika> it's only clearer because most people think that "when strings are empty, theyre false"
12:37:14FromDiscord<Recruit_main707> sealmove, let the a variable be of type A instead of ref RootObj
12:37:16FromDiscord<Rika> but that is a baseless assumption
12:37:43FromGitter<sealmove> Recruit_main707: I want to achieve polymorphism on fields
12:38:20FromGitter<sealmove> I know it's possible on procs with "method", but is it possible on fields? I expected it to work by default since inheritance is used
12:38:32FromGitter<faulander> Rika, you are of course right: empty isn't false.
12:38:43FromDiscord<Rika> https://play.nim-lang.org/#ix=2hAw
12:39:05FromDiscord<Rika> sealmove: ref RootObj isnt a valid class to use
12:39:16FromDiscord<Rika> RootObj is abstract AFAIK
12:39:41FromGitter<sealmove> ok, but your example makes no sense
12:39:53FromGitter<sealmove> I need x to be declared under B, not A
12:39:53FromDiscord<Rika> faulander: thats exactly why there's no truthiness here, what do you consider true and false is dependent on the person
12:40:13FromDiscord<Rika> sealmove: change it to B
12:40:14FromDiscord<Rika> still works
12:40:16FromGitter<sealmove> https://play.nim-lang.org/#ix=2hAy
12:40:28FromDiscord<Rika> huh?
12:40:32FromDiscord<Rika> that makes no sense
12:40:40FromGitter<sealmove> yeah
12:40:44FromDiscord<Rika> the one you sent
12:40:47FromDiscord<Rika> makes no sense
12:41:07FromDiscord<Rika> i mean the code, not the result
12:41:15FromDiscord<Rika> the result makes sense given the code
12:41:35FromDiscord<Rika> think this: not all As have an x, but all Bs do
12:41:46FromDiscord<Rika> not all subtypes of A have an x either
12:41:50FromDiscord<Rika> which is why that fails
12:41:59FromDiscord<Rika> okay
12:42:02FromDiscord<Rika> i understand what you want now
12:42:21FromDiscord<Rika> `<sealmove> I know it's possible on procs with "method", but is it possible on fields? I expected it to work by default since inheritance is used` its not
12:42:59FromGitter<sealmove> I see
12:43:27FromDiscord<Rika> i dont see why it would be added either
12:43:41FromDiscord<Rika> faulander: you good?
12:45:30FromGitter<sealmove> So with method both the supertype and subtype should have the method implemented, while with fields it's different because supertype and subtype can't even have a field with the same name. I see now.
12:47:27*pbb quit (Ping timeout: 265 seconds)
12:48:17*CcxCZ joined #nim
12:55:30*ChanServ quit (shutting down)
12:55:41FromDiscord<danielo515> Is it possible to call `result.add` more than once in the same proc?
12:55:41FromDiscord<Rika> sealmove: if you think about it, what are you supposed to change when it comes to "dynamic dispatch" fields? values are assigned on instantiation, types are types and must be the same even on methods, names must be the same for it to even work
12:55:53FromDiscord<Rika> @danielo515 i dont see why you can't
12:56:06FromDiscord<Rika> result isnt return, using result doesnt end the proc
12:56:25FromDiscord<danielo515> mmm, then the problem should be something else
12:56:56FromDiscord<Rika> mind showing the proc?
12:56:57FromDiscord<danielo515> Oh, walkDir fails silently if the folder does not exist or can not be reached
12:57:04FromDiscord<Rika> silently?
12:57:13FromDiscord<danielo515> Well, maybe not fails, but just returns an empty iterator
12:57:58Yardanicohttps://github.com/nim-lang/Nim/pull/13642
12:58:27Yardanicouse checkDir argument for walkDir
12:58:42Yardanicowith checkDir = true it'll raise an error if directory is not found
13:03:31FromDiscord<Rika> @danielo515 ^
13:03:52Yardanicoit needs to be documented though, it's documented in removeDir but not in walkDir
13:05:43*pbb joined #nim
13:06:10FromDiscord<danielo515> Oh, thanls for the ref
13:07:22FromGitter<faulander> i don't understand the unittest module
13:07:35Yardanicowdym?
13:07:41FromDiscord<danielo515> It is a pitty that walk dir rec does not yields both files and directories. I'll have to handle recursion myself, and because I need to know the number of files on each dir I'll have to convert iterators to sequences. Unless there is a way to know when an item is the last on an iterator
13:08:13FromDiscord<__ibrahim__> quick question, (sorry, don't mean to interrupt): is the Nim in Action book up to date?
13:08:24FromGitter<sealmove> eh, argument passing doesn't work either
13:08:26Yardanicoyes, the code in it will work with current Nim version
13:08:26FromDiscord<Rika> @__ibrahim__ not really, but its not that out of date
13:08:42FromDiscord<Rika> sealmove: wdym?
13:08:53YardanicoWell it might not explain some new features which appeared in Nim after it got released, but the code there will still work and it's a part of a test suite
13:09:12FromDiscord<__ibrahim__> cool, i reckon it's good for a nim noob?
13:09:28FromDiscord<Rika> deffo
13:09:35FromDiscord<Rika> @danielo515 wdym it doesnt do both?
13:09:43Yardanicowell yeah, but it assumes that you're not really new to programming :)
13:10:08YardanicoYou might want to read https://narimiran.github.io/nim-basics/ if you're a programmer newbie (but even if you're not it's still worth reading to learn Nim stuff)
13:10:31FromDiscord<__ibrahim__> fascinating! thank you very much guys! yes i have some experience with C++ JS and Py
13:10:42FromDiscord<Rika> then the book is good
13:10:55FromDiscord<Rika> ~~i'd suggest the one on manning because of livebook~~
13:11:01Yardanico?
13:11:22FromDiscord<__ibrahim__> that narimiran link looks nice, thanks Yardanico
13:11:24FromDiscord<Rika> https://www.manning.com/livebook-program
13:11:30*nsf joined #nim
13:11:32FromDiscord<Rika> this thing
13:11:36YardanicoNim basics is still worth reading if you want a relatively quick start for Nim, Nim in Action of course has much more content
13:11:44Yardanico@Rika https://narimiran.github.io/nim-basics/ is in the browser too
13:12:19FromDiscord<__ibrahim__> i got the nim in action pdf from manning, time to dig in! wish me luck 😸
13:12:21FromGitter<sealmove> hmm seems to work after all: https://play.nim-lang.org/#ix=2hAG ⏎ something else must be going on in my code
13:12:55FromDiscord<Rika> i dont see why that shouldnt work
13:13:05Yardanico"seems to work" Rika
13:14:12FromDiscord<Rika> that implies it shouldnt does it not?
13:14:19Yardanicothat implies that it works
13:14:39Yardanico"seems to work" is like "I'm not sure why, but it works" :D
13:15:40FromDiscord<Rika> "it works, but i dont know why" -> i dont know why may imply it shouldnt work
13:15:48FromDiscord<Rika> thats what i thijnk
13:15:49Yardanicono
13:15:51FromDiscord<Rika> anyway
13:15:53FromDiscord<Rika> lets not
13:15:55FromDiscord<Rika> lmao
13:16:00FromDiscord<Rika> this is useless
13:16:12Yardanicoyou just sent 4 separate messages for saying "let's not discuss this further"
13:16:14FromGitter<sealmove> also another thing. I observed differences between castA (myVar) and A(myVar)
13:16:31FromGitter<sealmove> `cast[A](myVar)` *
13:16:55Yardanicowell cast shouldn't really be used unless you're dealing with FFI or raw pointers
13:16:56FromDiscord<Rika> yardanico: and is there a problem with that?
13:17:09*pbb quit (Remote host closed the connection)
13:18:21FromDiscord<danielo515> > @danielo515 wdym it doesnt do both?
13:18:22FromDiscord<danielo515> @Rika
13:18:22FromDiscord<danielo515> Can do both, but not in the correct order. If you provide a filter saying yield folders and yield files it will firsr yield ald folders and then al files, but that is not useful for my particular case (and probably for any)
13:18:44Yardanicowhy not yield files and split them to get the directory they're in?
13:18:50YardanicosplitPath
13:19:29FromDiscord<Rika> well, order is not predictable for most walkxxx procs no?
13:19:42Yardanicowell I don't understand what danielo515 wants to do :)
13:19:47FromDiscord<Rika> me neither
13:19:59FromDiscord<Rika> what is the "correct order"
13:20:25FromGitter<sealmove> my code works with cast[] and not normal type conversion
13:20:31FromGitter<sealmove> no idea why
13:20:32Yardanicowell that's not okay :D
13:20:37Yardanicocast reinterprets memory
13:20:45Yardanicoit is unsafe
13:20:49FromDiscord<Rika> scary stuff you got there
13:21:44FromGitter<sealmove> I have something like `let root = if root == nil: cast[A](this) else: root`
13:22:07FromGitter<sealmove> (`this` is actually `result`)
13:24:48FromGitter<sealmove> It feels like I am trying to reinvent inheritance
13:25:33planetis[m]hi sealmove, how's quarantine?
13:27:30FromGitter<sealmove> Hey, very good for me. Gives me time to study :> and also do open source
13:27:32FromGitter<sealmove> You?
13:28:40planetis[m]same couldn't be better lol
13:29:10planetis[m]online classes ftw
13:30:22planetis[m]yesterday i went for a bath and someone called the police!!
13:30:33FromGitter<sealmove> yeah, I am erasmus and took classes from both home and outdoors university
13:30:54planetis[m]are you home or abroad?
13:30:57FromGitter<sealmove> huh? and said what?
13:31:08FromGitter<sealmove> abroad, in Krakow
13:31:35planetis[m]oh, and you didn't return why?
13:31:48FromGitter<sealmove> why would I return?
13:32:13planetis[m]i dunno...
13:32:24planetis[m]the idiots in charge here banned swimming
13:32:48planetis[m]but all other sports are allowed
13:33:12planetis[m]that have no teams that is
13:33:31FromGitter<sealmove> so you went "for a bath" in sea :D
13:33:47planetis[m]i left though so i didn't pay a fine
13:34:13supakeenFor a second here I thought you took a bath in your own home and the police broke down the door to tell you you're only allowed the shower.
13:34:23FromGitter<sealmove> I thought the same supakeen
13:34:26planetis[m]lol
13:34:34supakeenWould've been both way worse and way funnier.
13:35:21supakeenFor what it's worth I think most people are trying to do the best they can even if sometimes a bit misguided :)
13:35:21*pbb joined #nim
13:35:24FromGitter<sealmove> Do you usually swim in April though?
13:35:32supakeenIt's acceptable in a rapidly evolving situation.
13:35:40FromGitter<sealmove> btw are you in Greece or Cyprus? Forgot.
13:35:54FromGitter<alehander92> ohh sealmove i now
13:35:58FromGitter<alehander92> hmm no
13:36:03FromGitter<alehander92> i remember stefanos82
13:36:11planetis[m]greece and water is fine, if you mean that
13:36:29FromGitter<alehander92> we're neigbhours
13:36:33FromGitter<alehander92> which part of greece
13:36:39planetis[m]yes!
13:36:44FromGitter<sealmove> @alehander92 right, I confused the nicknames
13:37:10planetis[m]i live in thessaloniki and have visited bulgaria twice
13:37:28FromGitter<alehander92> i love thessaloniki
13:37:38FromGitter<alehander92> from what i've heard about it
13:37:41FromGitter<alehander92> but i've actually never been yet :D
13:37:49FromGitter<alehander92> i've been to athens and naxos and volos
13:38:11planetis[m]sandanski is great for vacations
13:38:37FromGitter<alehander92> oh i lived in blagoevgrad for my childhood
13:38:47FromGitter<alehander92> the whole region is pretty nice and friendly
13:38:57FromGitter<alehander92> but i think i haven't been in sandanski as well :D :D :D
13:41:25planetis[m]did they banned swimming in bulgaria?
13:45:32FromGitter<alehander92> no idea
13:45:36FromGitter<alehander92> they banned going to parks
13:45:53FromGitter<alehander92> and common playgrounds
13:46:07FromGitter<alehander92> so i guess swimming might be stopped, but not sure
13:46:10planetis[m]same
13:46:30FromGitter<alehander92> they would require us to
13:46:39planetis[m]all swimming pools are drowned
13:46:45FromGitter<alehander92> put masks on
13:46:49FromGitter<alehander92> from tomorrow!
13:47:36FromGitter<alehander92> or scarfs or stuff
13:47:45FromDiscord<danielo515> > <Yardanico> well I don't understand what danielo515 wants to do :)
13:47:45FromDiscord<danielo515> @gitterirc
13:47:45FromDiscord<danielo515> > me neither
13:47:45FromDiscord<danielo515> @Rika
13:47:45FromDiscord<danielo515> I'm building a ls-tree progam in several languages as a KATA, and now I'm just doing it in nim.
13:47:48FromDiscord<danielo515> I only need to print each file and each folder once, if I have to split to get the parent dir, then I'll get as many parent dirs as files inside each dir.
13:47:49FromGitter<alehander92> now the weather is amazing btw
13:48:05FromDiscord<danielo515> In any case, I already have a quite short recursive algorithm that I'm quite happy with
13:48:16FromGitter<alehander92> yeah simple short recursion is great
13:48:18Yardanico@danielo515 well why? you can just iterate over all files recursively and get folder with splitPath
13:48:27planetis[m]you can still go walk around the house right?
13:49:14FromGitter<alehander92> well yeah, i actually went to another neigbourhood
13:49:16FromGitter<alehander92> just now
13:49:30FromGitter<alehander92> but i do this rarely
13:49:36FromGitter<alehander92> i stay inside most of the time
13:50:00FromGitter<alehander92> but walking outside is not forbidden, just frowned upon, parks and stuff are forbidden
13:50:34FromGitter<alehander92> we also have like "border" checks with police on the entrances of many cities
13:50:42FromDiscord<danielo515> > <Yardanico> @danielo515 well why? you can just iterate over all files recursively and get folder with splitPath
13:50:42FromDiscord<danielo515> @gitterirc It's not that simple (albeit it looks it is). I need to store the folder tree on a structure, so I can post-process it. So in order to save a folder I need to save it just on the first appearance. Not to mention that, if a folder contain no files it will not be listed. But, nevermind, I already have what I want and it's quite simple
13:50:56planetis[m]its the same here
13:51:03FromDiscord<danielo515> It's 4 lines
13:51:04FromDiscord<danielo515> proc traverse_dir(dir:string, depth=0): seq[FileInfo] =
13:51:04FromDiscord<danielo515> for kind, path in walkDir(dir):
13:51:05FromDiscord<danielo515> result.add FileInfo(name:path.splitPath.tail, depth:depth)
13:51:05FromDiscord<danielo515> if kind == pcDir:
13:51:05FromDiscord<danielo515> result = result.concat traverse_dir(path, depth+1
13:51:08Yardanicopls don't paste in discord :P
13:51:11Yardanicoand don't use quote
13:51:20FromGitter<alehander92> don't you need to send sm-ses planetis[m]
13:51:33planetis[m]sure
13:51:37Yardanicoalmost no one reads channel description in discord :( "PLEASE don't use multi-line messages or code snippets (use some paste service instead)."
13:51:41*liblq-dev joined #nim
13:51:57FromGitter<alehander92> we don't have the sms -es thing
13:52:04FromGitter<alehander92> only declarations if you go out of the city
13:52:12Yardanicowe have the SMS thing in some regions in Russia, and police checks between cities too
13:52:22FromDiscord<danielo515> Well, it is quite easy to miss
13:52:23Yardaniconot all, but in some cities for sure
13:52:46FromDiscord<danielo515> On other places you have to read on the welcome channel before you can write on any other channel
13:53:03FromGitter<alehander92> danielo515 use walkDir
13:53:03Yardanicowell that needs a yet another bot :P
13:53:34FromGitter<alehander92> no walkDirRec
13:53:55FromGitter<alehander92> from os.nim
13:54:03Yardanicoyeah I think walkDirRec should just work for ls-tree structure, idk why it doesn't work for danielo515
13:54:36FromGitter<alehander92> danielo515 ah that's a good trick, we might need to add the welcome channel reading too
13:55:07FromDiscord<Rika> `almost no one reads channel description in discord` tbh, channel descriptions are really secluded in this damned program
13:55:15FromDiscord<Rika> is secluded the right word
13:55:17FromDiscord<Rika> no clue
13:55:19Yardanicofor me it's a web page :)
13:55:25FromDiscord<Rika> either way
13:55:31FromDiscord<Rika> theyre both web pages really
13:55:43FromDiscord<Rika> the program one is a glorified web browser anyway
13:58:03FromDiscord<danielo515> > <Yardanico> yeah I think walkDirRec should just work for ls-tree structure, idk why it doesn't work for danielo515
13:58:03FromDiscord<danielo515> @gitterirc I already explained why. The correct thing to use is walk Dir and handle recursion yourself
14:02:40FromDiscord<Rika> why???
14:06:49*pbb quit (Quit: No Ping reply in 210 seconds.)
14:09:26FromGitter<alehander92> you can pass a filter
14:09:42FromGitter<alehander92> but maybe a very custom behavior might require custom code
14:09:48FromGitter<alehander92> and also its good to exercise
14:10:29FromGitter<alehander92> ah i see
14:11:07*pbb joined #nim
14:12:48FromGitter<alehander92> yeah it does work like that
14:12:51FromGitter<alehander92> because it uses a stack
14:13:29*Guest93459 is now known as dadada
14:13:40FromGitter<alehander92> yeah one needs to write a custom one for that thing
14:14:22dadadahi, so there may be a way to use Qt with Nim that works now, but I can't confirm it yet, I just don't see why this wouldn't work, although it relies on playing a trick
14:14:45Yardanicocompiling Nim to C and then using it in a stub C++ project ?
14:15:15dadada1) we already have gobject introspection support for Nim, which enables us to use Gtk and the like with no issues
14:15:20dadadaYardanico: better IMO
14:15:26Yardanicowell I'm waiting
14:16:07dadada2) there's gobject introspection (kind of a bridge I think) project for Qt, that enables to use Qt with python/lisp and the like that already have gobject introspection support
14:16:33dadada3) as you noticed from 1) Nim also has gobject introspection support, so 2) should also work with Nim at least in theory
14:16:54Yardanicobut how it provides access to Qt features?
14:17:00dadada4) the ugly thing with this solution is, you need gtk for this to work, which is an odd dependency for Qt project
14:17:10Yardanicoyou mean https://github.com/mrosset/giqt ?
14:17:16dadadaYardanico: yes, that's it!
14:17:27*zacharycarter joined #nim
14:17:28dadadalook at this example for python https://github.com/mrosset/giqt/blob/master/examples/hello.py.in
14:18:00dadadathe first 4/5 lines of python are gtk/gi related, the rest looks like normal Qt code would
14:18:10Yardanicoseems like you'll have to wrap all types manually for each Qt type though
14:18:14Yardanicosee https://github.com/mrosset/giqt/blob/master/application/qt-button.cpp
14:18:21Yardanicoor https://github.com/mrosset/giqt/blob/master/application/qt-web-view.cpp
14:18:21dadadathere's even a lambda in there to connect the button click with
14:18:36Yardaniconot a lot of code but you'll need to write it for every Qt type and function
14:18:40Yardanicoto fully cover Qt :P
14:18:58Yardanicoalso the project is GPLv3
14:19:04FromDiscord<Rika> oh man, GPL
14:19:06FromDiscord<Rika> rest in peace
14:19:21dadadaI'm mostly interested in FOSS projects, so this isn'
14:19:38dadadat a big drawback at least for me, but I think this kind of out of the box thinking is always nice to see
14:19:41*Hexeratops joined #nim
14:19:42Yardanicowell I just don't like people who always use GPLv3 even for stuff like libraries :)
14:19:55Yardanicoit makes sense sometimes, but not in this case for example
14:19:57dadadaYardanico: for libraries I tend to agree
14:20:15dadadaYardanico: most UIs you'll write will be applications, not libraries
14:20:37Yardanicodadada: the "giqt" is technically a library so if you use it in your application it'll also need to be open sourced
14:20:56dadadaYardanico: I know that, man
14:21:19FromDiscord<danielo515> What's the go to for desktop apps on nim?
14:21:24dadadaas I said, almost everything that I'm going to develop will end up FOSS, and for applications I'm more than ok with GPL
14:21:36Yardanico@danielo515 the most complete one is "gintro" gtk bindings for nim
14:21:44Yardanicohttps://github.com/StefanSalewski/gintro
14:21:46Yardanicoit's really nice
14:21:49*zacharycarter quit (Ping timeout: 250 seconds)
14:23:02dadadaYardanico: you're right though, those "bindings" aren't complete, I got overly excited there for a moment
14:30:05*waleee-cl joined #nim
14:40:20*zacharycarter joined #nim
14:51:09zacharycarterif I'm building a shared library to consume in some C code, do I need to set the define `useNimRtl` when I'm building the shared library?
14:51:17zacharycarterthat's only if I'm using the shared library in another Nim project right?
14:55:27*Minimisthupper joined #nim
14:57:49FromGitter<kennymalac> Hello, I am getting a type error creating a table of seq of tables as value
14:57:55FromGitter<kennymalac> let outTable = newTable[string, seq[Table[string, string]]]
14:58:06FromGitter<kennymalac> home/kenster/Company/COVID-19-Dashboard/csvparser/src/csvparser.nim(14, 26) Error: expression 'newTable' has no type (or is ambiguous)
14:58:18Yardanicoyou forgot ()
14:58:34FromGitter<kennymalac> oh lol, thanks
14:58:44Yardanicoalso there's a difference between Table and TableRef
14:58:51Yardanicowith newTable you create a TableRef, with initTable - Table
15:01:01FromGitter<kennymalac> good to know
15:04:44FromDiscord<flywind> Hello, I try to use `testament`. It's fine to use `testament r single_file`. But when I use `testament all`, I got some errors. I have to use `testament cat /` as a work-around.
15:04:57FromDiscord<flywind> https://play.nim-lang.org/#ix=2hBr
15:05:38krux02flywind you can run a single test in testament
15:06:47krux02for example: testament/testament run tests/misc/tsizeof.nim
15:08:26krux02flywind: do you use testament in your own project?
15:08:33FromDiscord<flywind> I use testament in CI, if one test fails, others won't test?
15:08:47Yardanicothey will get tested
15:09:05krux02I personally don't recommend to use testament. It is highly specialized to test Nim.
15:09:35krux02It might have useful functionality, but it might be better to copy them in your own testing framework and shave off everything that you don't want from testament.
15:10:16*Minimisthupper quit (Ping timeout: 240 seconds)
15:10:18FromDiscord<flywind> I use `testament cat /` to test all files, it seems fine.
15:10:49krux02If that works for you, then do it.
15:12:31*zacharycarter quit (Ping timeout: 260 seconds)
15:16:42krux02for file in $(find ./tests -iname '*.nim' -type f -print); do echo nim c -r $file; done
15:17:21krux02not sure why you would want a dependency like testament for that functionality.
15:18:19*pbb quit (Remote host closed the connection)
15:19:19FromDiscord<flywind> because of unittest's note? Instead of unittest.nim, please consider to use the testament tool which offers process isolation for your tests.
15:19:20FromDiscord<flywind> https://nim-lang.org/docs/unittest.html
15:26:30krux02flywind: Well I am/was a developer on Nim. I remember a discussion with Araq about making testament public. I told him not to do it because it is highly specialized in to test the compiler and the implementation might chage anytime if the tests are refactored. He just ignored my advica and made testament public.
15:26:47*xcm quit (Remote host closed the connection)
15:27:22krux02Now we have a testing tool that that is recommended for people to use, but if they actually use it, they get burned.
15:27:30krux02sorry that you see it.
15:29:01krux02You can now decide to ditch my atvice as well. Or you can listen to the advice of Araq (the founder of Nim). Or you can decide to ditch Nim alltogether because it has problems like this.
15:29:06*xcm joined #nim
15:30:00dadadadon't ditch Nim
15:31:09FromDiscord<flywind> Thanks @krux02.I will think about it.😄
15:32:35FromGitter<alehander92> @krux02 i also thought `testament` shouldn't try to take `unittest`'s place
15:32:50FromGitter<alehander92> but this attitude sucks, man
15:33:21krux02alehander92: do you mean my attitude?
15:34:00krux02flywind: you are welcome.
15:35:31krux02I highly recommend trying out Nim as an iteresting language to observe, because it really has the most powerful macro system That I am aware of. But it does have many problems as well.
15:35:51companion_cubewhat's your list of top problems krux02 ?
15:36:06FromGitter<zetashift> sweet: https://github.com/Pebaz/nimporter/releases/tag/v1.0.0
15:36:18FromGitter<alehander92> well, it's a bit like the opposition party in a parlament :D "if i become elected i will make this and this"
15:36:23FromGitter<alehander92> like, i completely get you
15:36:33FromGitter<alehander92> but its like, politics
15:36:42krux02Well, I guess it is a death by a thousand cuts problem. Nim doesn't have this one fundamental flaw that will make the language ultimatively fail.
15:37:17krux02It is more this attitude in the development of careless inclusion of feauters by developers who can't maintain their contributions anymore nor did they finish up their contribution.
15:37:29dadadakrux02, one reason why someone might get the impression that you might have a bad attitude might be the following comment of you. "I remember a discussion with Araq about making testament public. I told him not to do it because it is highly specialized in to test the compiler and the implementation might chage anytime if the tests are refactored. He just ignored my advica and made testament public. why do you
15:37:30shashlickIf you dive into the compiler code, it might feel that way but as a user I don't at all
15:37:35dadadathink Araq ignored your advice? When someone doesn't follow your advice, do you really think that implies he ignored you? Wouldn't you assume a guy like Araq is smart enough to evaluate the positions of others (including yours) and then come to his own?
15:37:48krux02There are many half way implemented feautures in Nim that you can stumble upon that just don't work. And nobody is responsible to fix them.
15:37:51shashlickFact is that it's a large code base and will have young and old code
15:37:57shashlickThat doesn't make it bad
15:37:58dadadakrux02: also its a bit rich to call the creator of nim a contributor :-)
15:38:06shashlickIt makes it like any other code base
15:38:14krux02dadada, I am not.
15:38:22shashlickI don't know why people think things should be perfect, there is no such thing
15:38:22krux02What I am talking about is hot code reloading.
15:38:27FromGitter<alehander92> krux02 i think that you and Araq maybe have different design philophies about software development/project maintenance etc
15:38:41krux02It is half way implemented. It works for some cases. It has problems, but nobody is resposible to fix them.
15:39:06FromGitter<alehander92> like, after all, you have som good points, he has some good points, but its his project, so one cant really argue he has to do X or Y
15:39:08krux02So there is no point in trying it out and reporting bugs about it, because nobody is going to fix them. Nobody who contributes understands that codebase.
15:39:46krux02Its just a blob of code unmaintained that makes the Nim code harder to read. It makes it harder to fix bugs because hot code reloading may not break.
15:40:05krux02And it lures people into disappointment who are excited to try out hot code reloading.
15:40:32krux02If it doesn't work, don't recommend it. Declare it as experimental.
15:40:53dadadaI do think you're making valid points here krux02
15:41:03krux02I am also frustrated by the premature release of Version 1.0
15:41:29dadadasome projects have a status matrix of different features that are in planning, work in progress, beta, stable etc., I'd like to see something like that for Nim
15:41:49krux02dadada: That is a good idea.
15:42:07companion_cubewhat's missing from 1.0? arc, not nil?
15:42:19krux02There should also be a feature combination matrix.
15:42:28dadadathis would help new contributors to know where they should focus their efforts, and it would also help maintainers to organize, it would help new users, to know which features they can rely on and which they can't
15:42:43planetis[m]https://github.com/nim-lang/RFCs/milestone/1there is
15:42:45planetis[m]sorry https://github.com/nim-lang/RFCs/milestone/1
15:42:57krux02does hot code reloading work with generics? does hot code reloading work with js backend? etc
15:42:59shashlickThere should be a lot of things and a lot of things should be removed as well - in general - in the world
15:43:22dadadaplanetis[m]: while that is something, it contains far less information than a matrix would
15:43:31krux02does inheritance work with generics, you get it. A full matrix of all features and how well they perform with each other.
15:43:35shashlickRedirect your frustration into contributions else nothing will change
15:43:45dadada(where matrix is a fancy word for a table :-) )
15:43:46shashlickBut don't expect everything to change
15:44:15krux02shashlick, I did my contributions. Code refactoring. Deletion of dead code.
15:44:23FromGitter<alehander92> krux02 however i dont see a big problem: X% of your ideas would be accepted and Y% would not
15:44:38FromGitter<alehander92> the same as timothee, and when he complained, this annoyed you a lot
15:44:43FromGitter<alehander92> and now you are complaining
15:44:45shashlickYou cannot contribute what is not welcome
15:44:45krux02The reaction from Araq was: I didn't ask for this. This is just a matter of taste. I don't want to review this, closing
15:44:51FromGitter<alehander92> that's what seems strange to me
15:45:26planetis[m]my PRs got rejected mostly and its okay. they weren't that good
15:45:28krux02to be fair about timothee, I hated his contributions a lot. But recently I really appreciate them.
15:45:54companion_cubeis timothee the one who wrote the comparisons with D?
15:46:01dadadaalehander92: as far as krux02 complaints about missing documentation for features and their current status, as well as their planned future directions, I'm all with him
15:46:19shashlickYou have to work within the boundaries, going outside is not productive
15:46:20krux02I don't like his naming scheme I also disagree often with his solutions, but his error and problem detection qualification is great.
15:46:36shashlickYou have to learn how to invite people outside
15:46:48shashlickAnd some people might never come out
15:47:08shashlickWhile other times you might need to realize it's not a good spot in the first place
15:47:36shashlickPoint is to do what's healthy, you cannot always be successful, that's not how the world works
15:49:08dadadakrux02: I think the 1.0 was important to put Nim on the map for a lot of people, I'm not sure if I'd be using a non 1.0 language, it's purely psychological, but we're psychological animals like it or hate it, and in times where people are used to version numbers like chrome 80, 1.0 doesn't mean the same as it used to mean anyway, I think a 1.0 after more than a decade of development time is well justified
15:49:30*pbb joined #nim
15:49:40shashlickMost importantly, you are sharing all this because you care about Nim and that's what everyone should focus on
15:49:48krux02dadada, well after the feature cutting phase, yes.
15:49:57krux02But Nim didn't have a feature cutting phase.
15:50:10krux02Yes I do care about Nim.
15:50:18krux02I have projects depend on it.
15:50:21companion_cubedadada: 1.0 for a lang is not the same as for a browser
15:50:36companion_cubea language is something you invest a lot of work in, imho, so you want to work to keep being relevant
15:51:00krux02The Go language is a language that did it correct.
15:51:16krux02To be fair, Go has the advantage of a big company behind it.
15:51:28krux02So they can keep it internal until it is ready to be frozen.
15:51:41shashlickI'll recommend building a case to kill one specific thing, build consensus and a full plan to deprecate and eventually remove
15:51:52shashlickAnd provide an alternative
15:51:53FromDiscord<Recruit_main707> and not an small company, but google
15:52:01companion_cubego is ridiculously limited though, krux02
15:52:03FromDiscord<Recruit_main707> not any*
15:52:06dadadacompanion_cube: we can play with words all day if you want to, it's important that you got what I meant, I can turn your words around with the simple fact that browser development (especially engines) is a lot of work as well, and browser developers for sure want to be relevant, let's stop such silly word play
15:52:12shashlickJust creating PR's won't work, even with your best friend
15:52:31companion_cubedadada: I mean, to the users…
15:53:59FromDiscord<danielo515> Is there a shorthand for accessing the last item of a seq? Like seq[^1] or something like that?
15:54:38shashlickSome things are cultural too, some are very conservative and disciplined while others are more liberal and okay with imperfections and fixing as you go
15:54:50shashlickNever release until it's perfect
15:55:05companion_cubea good recipe for never releasing
15:55:13shashlickHave to see how the community operates
15:55:41shashlickThere is a middle ground but it's a life long journey to maintain it
15:55:48*hax-scramper quit (Read error: Connection reset by peer)
15:56:20shashlickI'm totally for venting and frustration but at the end, it should be productive
15:56:21*hax-scramper joined #nim
15:56:36companion_cubekrux02: Go also doesn't move fast enough, 'generics' is a joke word for it now
15:56:48krux02companion_cube, go is ridiculously limited yes, but they cut out everything they didn't need. And then they stick to it.
15:56:55dadadacompanion_cube: I get what you mean, and still think 1.x+ is well justified, C++ compilers had countless issues in the 90s, it didn't make me think of the language as a beta (non 1.0) language, the release of 1.0 was important to draw people like me in the community, all it did for me was to signal a certain level of stability that I could rely on
15:57:34krux02companion_cube, It was a design decision for go not not require generics. So I understand that it isn't coming. They really don't want it to be part of the language.
15:57:38krux02And that is by design.
15:57:45krux02Putting it into the language is resignation.
15:58:35dadadaI'm impressed with the quality libraries the go community has developed, it's really sad that this happened solely because of the weight google has, imagine Nim with that number and quality of libraries
15:58:45*ksandvik joined #nim
15:58:50companion_cubekrux02: not putting them was stubbornness, rather, I think
15:58:55companion_cubeoh well
15:59:05krux02dadada, no this didn't happen because of the weight of google.
15:59:21dadadaie. goldmark looks like a markdown parser I'd love to use, but it's for go :-(
15:59:48krux02Go grew, because it was an easy to pick up language that lets you write fast and memory efficient applicaitons quickly
16:00:04krux02the language was designed with tooling in mind
16:00:08dadadakrux02: don't even try to argue against the special role google had in go's development and the many internal users at google who also cross-pollinate with the FOSS community?
16:00:25FromGitter<alehander92> ok krux02 but after all go has its own philosophu
16:00:32*rockcavera joined #nim
16:00:32FromGitter<alehander92> its like going in the go community
16:00:38companion_cubego got a lot of attention because of who created it
16:00:39FromGitter<alehander92> and telling "guys haskell did all of this right"
16:00:42krux02I did use go for a long time.
16:00:45FromGitter<alehander92> well .. then use haskell
16:00:51dadadakrux02: yeah, and which company wanted a programming language that was easy to pick up and with good tooling and paid for its development, by paying its developers? :-)
16:00:53krux02It really is a good language with almot no friction.
16:01:18FromGitter<alehander92> i respect their philosophy but i wouldn't want to use this language
16:01:23FromGitter<alehander92> and i've used it as well
16:01:25companion_cubekrux02: depends on your taste
16:01:30companion_cube"friction" is relative
16:01:39krux02no friction is not relative.
16:01:53FromGitter<alehander92> after all that's why people use different languages
16:02:02dadadaI kind of like go, but I'd never prefer it over Nim given a choice
16:02:50companion_cubekrux02: ok. to me Go is so badly designed I can't use it, but if you mean friction from the tooling, ok
16:03:03FromDiscord<danielo515> I work with go on a daily basis and I wish it were nim...
16:03:24krux02I really do like Go. I really like its minimalist design. Something I did not expect from a company like google.
16:03:40krux02It is just that its minimalism doesn't cut my use cases for it.
16:03:42dadadasomeone needs to come up with a way to easily wrap go libs for Nim, pretty please! :-)
16:04:01krux02I would live in a world where I would not need my metaprogramming requirements. I would be so happy to develop in Go.
16:04:14dadadaso I can use stuff like this without reinventing the wheel https://github.com/yuin/goldmark
16:04:18krux02I am am just not in that world where the corneds the Go language cut apply for me.
16:04:40companion_cubehave you seen Zig?
16:05:15krux02yes I've seen it.
16:05:22krux02I didn't use it.
16:05:39krux02Didn't use it, but read about its design.
16:05:56krux02But I have my opinion about it. And similar to Go, it doesn't cut for me.
16:06:14krux02Nim does cut, but with a constantly broken knife.
16:07:17companion_cubethere's no perfect language, so it's a question of finding the one that fits you the least badly
16:07:31companion_cube(I wish there were languages closer to my tastes, tbh, but nope)
16:07:48FromDiscord<Rika> Krux, I hope you're the whetstone then
16:07:55blackbeard420one thing i love about go over nim is the goroutines. makes it way easier then using nim with asynchttpserver when you have long running background tasks
16:08:08*Trustable joined #nim
16:10:31dadadablackbeard420: https://github.com/stefantalpalaru/golib-nim "Nim language bindings for golib - a library that (ab)uses gccgo to bring Go's channels and goroutines to the rest of the world."
16:11:41dadadaI haven't tested/used this, the dependency on golib is strange to say the least
16:11:59*pbb quit (Ping timeout: 246 seconds)
16:13:27blackbeard420its not even necessarily the goroutines. its just painful using asynchttpserver with threads for background tasks (it works just doesnt feel to clean)
16:13:28companion_cubekrux02: you could also fork nim and cleanup ;)
16:14:09*pbb joined #nim
16:17:35*fputs joined #nim
16:17:40FromDiscord<Rika> I'd use the fork if it meant more big fixing :P
16:17:43FromDiscord<Rika> Bug
16:18:05dadadaI think (wo)manpower is the answer to a lot of woes, so we'd need to be picked up by say a game company or significant FOSS project, and soon a lot of things would improve. I'm fascinated with watching the commit log of vscode every other day, the number of commits may not be indicative of their quality, yet if you also look at the changelogs, it becomes clear that this project moves at a staggering pace, so
16:18:11dadadaone of the main concerns for Nim people should really be how do we get Nim to be thought of as relevant in the programming language space, so that our number of developers increases. I still want to write a Nim-learning application, maybe that'll help a little?!
16:18:15FromDiscord<Rika> Also lemme get this straight, go routines are basically green threads?
16:19:22companion_cubesomething like that
16:20:33FromDiscord<Rika> So a green threading library in nim would be great is all?
16:20:51FromDiscord<Rika> Hmm, I've also been thirsting for something like that
16:21:02companion_cubeisn't async/await the alternative for that?
16:22:15FromDiscord<Recruit_main707> ok... so i am trying to make some seamingless interop from nim to python, and its a good time to start using macros for it, so that means im gonna fill this chat with stupid questions! :D
16:22:48FromDiscord<Recruit_main707> lets start with, how can i know the return type of a proc passed to a template/macro?
16:23:40FromGitter<alehander92> is it `typed` macro
16:23:43FromGitter<alehander92> argument*
16:24:03FromGitter<alehander92> you can also generate code which checks that on compile time if untyped
16:24:14*flaviu quit (Quit: Leaving)
16:24:42FromDiscord<Recruit_main707> lets say its typed for now
16:25:04FromDiscord<Recruit_main707> (which i think it will be anyway)
16:25:32*ksandvik quit (Quit: WeeChat 2.8)
16:26:11companion_cubeare you talking about nimpy?
16:27:06FromDiscord<Rika> cube, it is, but I've had some conceptual understanding issues with it
16:27:12FromDiscord<Rika> Also, it is time for me to sleep
16:28:19FromDiscord<Recruit_main707> cube: no, i know about nimpy, it is really good, but i want something different
16:28:26*nsf quit (Quit: WeeChat 2.8)
16:43:33*fputs quit (Quit: WeeChat 2.8)
16:46:09*Vladar quit (Quit: Leaving)
16:46:33*zacharycarter joined #nim
16:55:39stefantalpalaruGoroutines are MxN green threads with a very efficient scheduler that uses multiple CPU cores and implements work stealing. Implementing something like this from scratch is not trivial.
16:56:57stefantalpalaruThis C library has a couple o schedulers that are MxN: https://github.com/Qthreads/qthreads
16:58:56companion_cuberust has a bunch of schedulers like that too (like tokio)
16:59:49stefantalpalaruQthreads is used by the Chapel language: https://www.osti.gov/servlets/purl/1458180
17:00:17stefantalpalaruSo it's old and battle-tested.
17:03:56*SebastianM joined #nim
17:14:43*pbb quit (Ping timeout: 265 seconds)
17:14:48*pbb_ joined #nim
17:17:31*abm joined #nim
17:23:10*abm quit (Quit: Leaving)
17:25:35*NimBot joined #nim
17:27:04*SebastianM quit (Quit: leaving)
17:29:22*waleee-cl quit (Quit: Connection closed for inactivity)
17:30:07krux02dadada: Regarding (wo)manpower. I don't think this is true here. In over ten years, a language can get done even with just a few contributors. The problems is focus on the right battles to fight.
17:31:02*krux02 quit (Remote host closed the connection)
17:32:01*krux02 joined #nim
17:38:49*rokups quit (Quit: Connection closed for inactivity)
17:40:27FromGitter<alehander92> krux02 however if you interview 10 contributors, you'll get 10 lists of things which are "right battles"
17:40:32*pbb_ quit (Ping timeout: 246 seconds)
17:41:15FromGitter<alehander92> recruit sorry, you can use `getType` or `getTypeImpl` iirc
17:41:38FromGitter<alehander92> and access them similarly to nim node
17:44:04FromDiscord<Recruit_main707> ok, thanks
17:46:25krux02alehander92: `getType`, `getTypeInst`, `getTypeImpl` is one of those things that are just bad in nim and should be fixed.
17:47:32krux02getType is something that was "deprecaded" years ago and was replaced by `getTypeInst` and `getTypeImpl`.
17:48:08krux02but getTypeImpl doesn't properly work because sometimes you get some typedec node instead of the actual type implemenation.
17:49:45FromGitter<alehander92> i'd expect `getType` to do stuff like this and `getTypeImpl` to always get me the implementation
17:49:50FromGitter<alehander92> if i go only by naming
17:53:05FromDiscord<Recruit_main707> so, `getTypeImpl` will give me the return type of the function, right? `getTypeInst` i guess it will give you the "full type" (ie: `proc(arg: x): y`)
17:54:14FromGitter<sealmove> `myString == ""` is the same as `myString.len == 0` right?
17:55:21FromGitter<alehander92> no no, `getType` family of functions can get you the "full type"
17:55:32FromGitter<alehander92> and then you need to find in it the return type etc
17:55:59FromDiscord<Recruit_main707> getTypeImpl.returnType ?
17:56:08FromGitter<alehander92> no no no
17:56:13FromGitter<alehander92> they are just nim nodes
17:56:25FromGitter<alehander92> with nnkNameTy (e.g. nnkObjectTy)
17:56:27FromGitter<alehander92> kinds
17:56:38FromGitter<alehander92> so you can use `.treerepr` on the "types"
17:56:48FromGitter<alehander92> and see how to access the children
17:56:49FromDiscord<Recruit_main707> is there a list of all this nodes?
17:57:13FromGitter<alehander92> in `lib/core/macros.nim`
17:57:17FromGitter<alehander92> not sure about the manual
17:57:41FromGitter<alehander92> but i'd recommend to just echo `treeRepr` results of getType<Something> functions
17:57:47FromGitter<alehander92> to get a feel
17:57:52FromDiscord<Recruit_main707> ok, thanks
17:58:31FromGitter<alehander92> no problem!
17:58:56FromGitter<alehander92> @sealmove logically yeah, not sure if it's optimized to the same code
18:14:37FromGitter<alehander92> okk
18:17:22*lritter joined #nim
18:22:56*nsf joined #nim
18:24:36zacharycarterI'm trying to build a shared library with Nim that's getting loaded as a plugin in a C app, and then procs defined in the Nim shared lib are getting called
18:25:07zacharycarterI keep running into EXC_BAD_ACCESS errors - am I compiling the Nim shared library correctly?
18:25:28zacharycarter`nim c --noMain --app:lib -o:libtest.dylib test.nim` ?
18:27:39zacharycarterseems to have something to do with the GC when I try to call `echo repr` on the parameter passed in
18:28:09krux02hehe
18:28:17krux02I guess it has something to do with RTI
18:28:20krux02runtime type information
18:28:38krux02the shared lib can't see the RTI from the types passed in.
18:29:01zacharycarterI'm getting EXC_BAD_ACCESS errors even when I try to echo an int32
18:29:07zacharycarterlet me check the backtrace on that error
18:29:36krux02you get an error on `echo 123'i32` or you get an error on `echo repr(123'i32)`?
18:30:56zacharycarterI got the one error when I tried to `echo repr` a pointer passed into the Nim proc from C
18:31:09zacharycarterI get another error when I simply try to `echo` an int32 passed into the Nim proc from C
18:31:53zacharycarterthat backtrace includes calls to `prepareForInteriorPointerChecking` and then lowGauge`
18:32:04zacharycarterthe crash occurs in `lowGauge`
18:32:15krux02call you say host and client? it is more clear to me if you use those terms.
18:32:25krux02I don't really know if you mean host when you say "from C"
18:32:49zacharycarterthe procedure is getting called from the C application
18:33:05zacharycarterthe application written in C is loading the Nim shared library with dlopen I guess
18:33:15zacharycarterI'm guessing it's because Nim'
18:33:24FromGitter<sealmove> I want to make a convertor that converts all none-option types to option types
18:33:26zacharycarters collecting memory
18:33:47FromGitter<sealmove> but `converter toOption*[T](x: T): Option[T] = some(x)` doesn't work because `T` includes Option types.
18:33:49zacharycartermaybe it doesn't happen with gc:arc let me try that
18:34:08FromGitter<sealmove> what type restrictions can I apply?
18:34:12krux02sealmove: that one could be fixed with
18:34:32zacharycarteryeah it works fine with gc arc heh
18:34:33krux02toOption*[T: not Option](x: T): Option[T] = some(x)
18:34:38krux02I would approve such a patch
18:34:44FromGitter<sealmove> wow this works?
18:35:03krux02yes
18:35:14FromGitter<sealmove> wow I love Nim
18:35:19krux02well it enforces that T does not include Option
18:35:53krux02Nim has a lot of great features. And also in many ways the right features.
18:38:04krux02zacharycarter, good thing that Nim finally has a real option to turn off the GC.
18:38:06FromGitter<sealmove> hmm, I still get "type mismatch: got <uint8> but expected 'Option[system.int]'", but maybe something else is interfering
18:38:32FromGitter<sealmove> aaah I know why, because uint8 is different from int
18:38:43zacharycarterkrux02: yes I agree
18:40:17krux02sealmove: yes uint8 is a different type than int.
18:40:45FromGitter<sealmove> and chaining converters (fortunately) doesn't work
18:50:45FromGitter<alehander92> <3
18:50:47FromGitter<alehander92> ops
19:00:36*xcm quit (Remote host closed the connection)
19:08:33*xcm joined #nim
19:14:36*Zectbumo joined #nim
19:30:18*krux02 quit (Remote host closed the connection)
19:36:02*xet7 quit (Read error: Connection reset by peer)
19:37:11*waleee-cl joined #nim
19:37:56*xet7 joined #nim
19:42:54*xcm quit (Remote host closed the connection)
19:42:55*zacharycarter quit (Ping timeout: 250 seconds)
19:48:00*xcm joined #nim
20:04:59*leorize joined #nim
20:11:21*xcm quit (Remote host closed the connection)
20:14:54*xcm joined #nim
20:15:12FromDiscord<danielo515> Is the default compilation good for release? It runs quite well. If I add -d=release the first execution takes a lot, like half minute or more
20:16:43FromDiscord<konsumlamm> release does optimiations, so ofc it'll be slower
20:16:51FromDiscord<konsumlamm> but the executable will be faster
20:16:56*xet7 quit (Quit: Leaving)
20:17:15*xet7 joined #nim
20:18:58FromDiscord<danielo515> Sorry, when I say slow I mean the generated executable
20:19:19*liblq-dev quit (Quit: WeeChat 2.7.1)
20:19:22FromDiscord<danielo515> The first execution of the generated executable is very slow, it can even reach a minute
20:19:35FromDiscord<danielo515> While, usually, it takes under half a second
20:20:50leorizeare you on windows?
20:21:10*hpyc9 is now known as HIPOINTAF
20:21:17*HIPOINTAF is now known as hpyc9
20:27:11FromDiscord<danielo515> Macos
20:29:56FromDiscord<queersorceress> what do you mean by "it runs slow"?
20:32:16FromDiscord<Avatarfighter> I believe @danielo515 means the building of the release executable but I could be wrong
20:32:35FromDiscord<Avatarfighter> I'm probably wrong actually
20:40:08FromDiscord<danielo515> Compile, get file.exe, execute file.exe, takes a minute. Execute file.exe again, runs in under a second
20:40:12FromDiscord<danielo515> Hope that clarifies
20:40:34FromDiscord<danielo515> I used exe extension to make it clear, doesn't mean anything special
20:41:02FromDiscord<danielo515> And that only happens when I compile with optimizations
20:44:41FromDiscord<queersorceress> things don't just magically go faster after a first run unless you are doing something on the filesystem or something
20:47:26FromDiscord<konsumlamm> caching?
20:47:34FromDiscord<Avatarfighter> @danielo515 does the first run include compiling the program ?
20:50:32FromDiscord<mratsim> if building is slow it's usually the antivirus
20:52:33FromDiscord<danielo515> > @danielo515 does the first run include compiling the program ?
20:52:33FromDiscord<danielo515> @Avatarfighter nope, they are two separate steps
20:53:06FromGitter<awr1> hello all
20:53:09FromDiscord<danielo515> > things don't just magically go faster after a first run unless you are doing something on the filesystem or something
20:53:09FromDiscord<danielo515> @queersorceress well, that's why I would expect, but my only interaction with the fs is listing dir contents
20:53:25FromDiscord<danielo515> > things don't just magically go faster after a first run unless you are doing something on the filesystem or something
20:53:26FromDiscord<danielo515> @queersorceress well, that's what I would expect, but my only interaction with the fs is listing dir contents
20:54:14*octetta quit (Quit: My Mac Pro has gone to sleep. ZZZzzz…)
20:54:37FromDiscord<danielo515> > caching?
20:54:37FromDiscord<danielo515> @konsumlamm unless the compiler injects some kind of caching, I'm not caching anything
20:55:52FromDiscord<konsumlamm> youre not, but your CPU might
20:55:53FromDiscord<queersorceress> can you do a pastebin or something of the commands you are running and the timing benchmarks of how long execution is taking so we have something to work with?
21:07:48*krux02 joined #nim
21:12:01*zacharycarter joined #nim
21:13:07*drewr quit (Ping timeout: 260 seconds)
21:14:25FromDiscord<danielo515> Sure, but I'm not on my computer RN
21:14:38FromDiscord<danielo515> Give me a sec
21:15:57FromDiscord<danielo515> This is the folder
21:16:00FromDiscord<danielo515> https://github.com/danielo515/explore-new-languages/tree/7e26a817278b3fff383fed92c802cb147ec0f182/ls-tree/nim_tree
21:16:13FromDiscord<danielo515> The build.sh is the normal build
21:16:38FromDiscord<danielo515> In order to make it slow at first run I just add `-d=release` or `--opt=speed`
21:17:07FromDiscord<danielo515> Then you just run the generated executable. You can compare the normal build (the one on build.sh) with the optimized one
21:20:06*thomasross joined #nim
21:23:11solitudesfhmm, release build runs slower than debug for me. about 30%. danger runs fast, as expected.
21:27:12solitudesfnvm, i guess my nimchache was to blame
21:28:23nisstyreIt would be nice if https://nim-lang.org/docs/rationals.html could work with a type other than `int` for multiplication, e.g. BigInt, to avoid overflowing
21:30:05*drewr joined #nim
21:30:24krux02solitudesf, danger is the old release
21:30:36solitudesfi know
21:32:00solitudesfactually, its because of lto. when i compile with lto performance goes to shit. yikes.
21:36:08*solitudesf quit (Remote host closed the connection)
21:36:31*solitudesf joined #nim
21:40:37krux02what is lto?
21:40:49zacharycarterlink time optimization?
21:40:54zacharycarterI think it's mostly useful for reducing binary size
21:41:18krux02no
21:41:30zacharycarteroh
21:41:35krux02link time optimization is actually inlining a lot of functions
21:41:44*nsf quit (Quit: WeeChat 2.8)
21:41:52zacharycarterah
21:42:05krux02you know C, compilation units don't know functions of other compilation units
21:42:14krux02in other words inlining can't be done.
21:42:22krux02only after linking
21:42:30*solitudesf quit (Ping timeout: 265 seconds)
21:43:08krux02That probably is also very expensive, because many optimizations can only be done after inlining has already been applied.
21:52:04*zacharycarter quit (Ping timeout: 256 seconds)
21:52:25dadadathere's a new link time opimizer called propeller, that was developed by google, it's claimed to require less resources than bolt from facebook
21:52:31dadadaoptimizer
21:53:10shashlickCan you add default values for importc procs?
21:53:10dadadahttps://github.com/google/llvm-propeller/blob/plo-dev/Propeller_RFC.pdf
22:08:01dadadas/link time optimizer/post link optimizer
22:10:42dadadawhen you need to eke out those additional 2% of perfomance
22:11:18PrestigeReading the first tutorial about integers - 'Lossless Automatic type conversion is performed in expressions where different kinds of integer types are used' Does this mean and int8 could become an int16 dynamically if its value becomes too big?
22:13:48PrestigeAlso I don't see it mentioning what `int` defaults to, like int32 uint64 etc
22:19:15dadadaPrestige: I assume that ints default to int32 on 32bit systems and int64 on 64bit systems, just like you would expect from C
22:19:44Prestigemakes sense, just default to the word size
22:20:29dadadaso you're starting with Nim?
22:20:45PrestigeYeah, set up my ide last night and just reading through the tutorials atm
22:20:58dadadagreat, may I recommend https://play.nim-lang.org/
22:21:31dadadathis is the place where even nimheads go to play around with Nim features and ideas
22:21:35Prestigeah that's pretty neat
22:21:56PrestigeI'm ultimately wanting to rewrite the window manager I'm using in nim
22:22:07dadadawhat window manager?
22:22:08Prestigegoing to be a fun ride
22:22:12Prestigedwm
22:22:31dadadaPMunch (not here?) is also writing a window manager (tiling one I think) in NIm
22:23:19dadadathis tutorial gives a nice overview: https://totallywearingpants.com/posts/nim-language-highlights/
22:23:37PrestigeSweet, thanks - I saw https://github.com/minimalwm/minimal recently as well
22:23:49PrestigeNot sure if it's the same wm but I'll be referencing it
22:24:11*Guest85 joined #nim
22:24:44dadadaPrestige: get familiar with macros as soon as possible, they're Nim's killer feature I'd say
22:25:16dadadawhich ide that you setup?
22:25:37Prestigeneovim as an lsp client
22:25:57PrestigeI'm going to read through the first two tutorials then start checking out how to work with x11
22:26:43*opal quit (Ping timeout: 240 seconds)
22:28:51*opal joined #nim
22:30:00Prestigewow macros are neat
22:30:25Prestigedadada: what are you using nim to build?
22:30:47dadadaPrestige: what I'm doing with Nim?
22:30:51PrestigeYeah
22:31:56dadadastarted to develop a small library of helper macros/templates/procs that I later want to use for creating actual Nim applications
22:33:02PrestigeI saw the rust rewrite of the gnu coreutils, thought that could be fun to try out. But maybe after the wm
22:33:04dadadastill a learner about Nim, too, my journey began this year
22:35:34*Guest85 quit (Quit: My Mac Pro has gone to sleep. ZZZzzz…)
22:40:11*leorize quit (Remote host closed the connection)
22:40:42*leorize joined #nim
22:45:16federico3any good example of using the dom module?
22:46:24shashlickgosh nimgrep --filenames is still broken since https://github.com/nim-lang/Nim/pull/12779
22:50:10dadadais github's c-blake also in IRC?
23:00:50*Tyresc joined #nim
23:01:02shashlickusually active on github
23:03:52FromDiscord<KingDarBoja> Hi all
23:04:16PrestigeHello KingDarBoja
23:04:59leorizeare you also an user of nim.nvim? :)
23:05:38PrestigeWell I'm using zah/nim.vim and coc-nvim
23:06:01*xcm quit (Read error: Connection reset by peer)
23:06:09leorizeyou should move to nim.nvim if you are using neovim :)
23:06:16leorizeI'm totally not advertising my own plugin :P
23:06:57FromDiscord<KingDarBoja> dadada: I am somewhat newbie too on Nim, so welcome to the community 😄
23:07:08FromDiscord<KingDarBoja> By the way, Rika or leorize, you there?
23:07:42Prestigeleorize: looks neat, but I'm trying to route all my lsp servers through coc-nvim
23:08:32leorizenim.nvim don't use lsp though :P
23:08:36FromDiscord<KingDarBoja> Hey leorize, was looking at the source code of textwrap.dedent on Python
23:08:37FromDiscord<KingDarBoja> https://repl.it/repls/SoggyFabulousPhysics
23:08:50FromDiscord<KingDarBoja> Basically it is what it does (copy paste)
23:08:56Prestigeleorize: yeah that's why I didn't pick it up
23:09:33FromDiscord<KingDarBoja> I did the same on Nim because wasn't satisfied by the result of undedent (which is supposed to be the equivalent)
23:10:10leorize[m]Prestige: your choice then :) though you might wanna import the indenter I got in nim.nvim
23:10:14*xcm joined #nim
23:10:46PrestigeThanks, I'll be sure to check it out if my intenting solution doesn't work well
23:10:52Prestigeindenting*
23:11:08FromDiscord<KingDarBoja> https://play.nim-lang.org/#ix=2hFn
23:11:29FromDiscord<KingDarBoja> Got *almost* same behaviour but looks like the final step (the regex sub) didn't work as I expected
23:12:40leorizewell it's called unindent and not dedent for a reason :p
23:12:56leorizewe don't have same proc
23:13:05FromDiscord<KingDarBoja> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#string-ops
23:13:20FromDiscord<KingDarBoja> Well this "tutorial" does compare it as its equivalent
23:13:27FromDiscord<KingDarBoja> And yeah, it almost do the same
23:13:59shashlick@leorize: do you think one could use the procs exposed in macros on compiler PNodes?
23:14:05FromDiscord<KingDarBoja> Anyway, the point is, not sure why the final regex is eating the "}"
23:14:33leorize[m]shashlick: I don't think so
23:14:41leorize[m]the procs in macros are strictly compile-time
23:15:27shashlickwhy couldn't they work at runtime? probably cause they are macros i guess
23:16:13FromDiscord<KingDarBoja> I tested on regex.io and seems to be correct the regex `(?m)^` whereas the margin are two whitespace chars
23:16:27FromDiscord<KingDarBoja> But on Nim, it looks like margin isn't any whitespace lol
23:16:31shashlickof course, i think nim might have even more advanced procs to work on the AST within the compiler than what's exposed via macros
23:17:03FromDiscord<KingDarBoja> In fact, margin val on nim has the "}"
23:18:07leorizethis algo is super slow
23:18:16leorizewhat exactly does this proc do?
23:18:47leorizecan't it just find the shallowest indent then use it as the common?
23:18:51leorizethe logic seems weird
23:19:13FromDiscord<KingDarBoja> Just copy pasta from Python implementation 🙈
23:19:41FromDiscord<KingDarBoja> Was testing it to see how it works
23:19:48FromDiscord<KingDarBoja> But expected same result
23:34:51leorizeI think I know what's wrong
23:35:03leorizeI'll try to clean up your solution as well
23:38:07FromDiscord<KingDarBoja> ❤️
23:46:05FromDiscord<Avatarfighter> Hello everyone 😄
23:46:47FromDiscord<KingDarBoja> Hi avatar!
23:46:48leorize[m]@KingDarBoja: https://play.nim-lang.org/#ix=2hFB
23:47:30leorize[m]I also reduced the amount of modules used
23:47:47leorize[m]the algo is slightly faster than python's (since I don't use zip)
23:49:26FromDiscord<KingDarBoja> I see there is no longer the whitespace_only_re
23:49:49*Trustable quit (Remote host closed the connection)
23:50:00FromDiscord<KingDarBoja> and also curious about the loop, I see you used high (which gets the max index of the array)
23:50:27FromDiscord<KingDarBoja> Does `0 .. min` is the correct way? the whitespace is optional?
23:50:30leorizeyea, your strip handled that proc function :P
23:51:39leorizeyep, the algo does this: compare each character in margin and indent and cut off margin if indent contain a character different from what's in margin
23:52:49FromDiscord<KingDarBoja> I see
23:52:56FromDiscord<KingDarBoja> Btw, didn't about the global pragma
23:53:01FromDiscord<KingDarBoja> Could you explain? 🙈
23:53:42leorize[m]it means that the value is stored in the global scope
23:53:56leorize[m]meaning that it will persist between proc calls
23:54:19leorize[m]I use it since we only need to compile that regex once
23:54:36leorize[m]it's similar to putting the let outside of the proc
23:54:46FromDiscord<KingDarBoja> CLEVER
23:54:48leorize[m]just different in the sense that you won't consume an identifier :)
23:54:59leorize[m](in the outer scope)
23:55:36FromDiscord<KingDarBoja> Added to my notes
23:56:39FromDiscord<KingDarBoja> Man, I love you, thanks!
23:57:27FromDiscord<KingDarBoja> I added a note on the proc doc to thank you 😄
23:57:51FromDiscord<KingDarBoja> By the way -> Does 0 .. min is the correct way? the whitespace is optional?
23:58:08leorizeyep
23:58:22FromDiscord<KingDarBoja> Ok ok
23:58:23leorizezip() will cut off the larger container
23:58:44leorizeso this is the same algo, just without spending time making a seq