00:01:13 | FromDiscord | <KingDarBoja> By the way, to perform comparison between objects, I assume `==` isn't enough, right? |
00:02:19 | leorize[m] | `==` is more than enough |
00:02:44 | leorize[m] | though feel free to implement your own if you require custom logic |
00:02:58 | leorize[m] | note that for `ref object`, you gotta do `x[] == y[]`` |
00:03:06 | leorize[m] | * note that for `ref object`, you gotta do `x[] == y[]` |
00:04:37 | FromDiscord | <KingDarBoja> Ahhhh |
00:08:54 | FromDiscord | <KingDarBoja> Tried on the example and failed lol |
00:09:10 | FromDiscord | <KingDarBoja> Sorry to ask you but can you show me how on the example? 🙈 |
00:14:17 | leorize[m] | https://play.nim-lang.org/#ix=2hwL |
00:14:26 | leorize[m] | this is one of those cases where you need a custom `==` |
00:16:22 | leorize[m] | https://play.nim-lang.org/#ix=2hwL |
00:16:32 | leorize[m] | * https://play.nim-lang.org/#ix=2hwM |
00:16:41 | leorize[m] | this also works |
00:17:08 | leorize[m] | it depends on whether `ref` was a good choice to be fair :P |
00:17:14 | FromDiscord | <KingDarBoja> Checking both right now |
00:20:49 | FromDiscord | <KingDarBoja> You are right... thinking about the ref choice was smart or not 😆 |
00:21:58 | FromDiscord | <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:11 | FromDiscord | <KingDarBoja> https://nim-lang.org/docs/tut2.html#object-oriented-programming-inheritance |
00:22:51 | leorize | then maybe you gotta rethink if inheritance was the way to go :) |
00:23:43 | FromDiscord | <KingDarBoja> But I remember on my notes this |
00:24:02 | FromDiscord | <KingDarBoja> _regular objects cannot be nil_ by libq-dev |
00:25:38 | leorize | then you remember that Option[T] exist |
00:25:57 | FromDiscord | <KingDarBoja> Yeah |
00:26:07 | FromDiscord | <KingDarBoja> Need to rethink a bit |
00:26:08 | leorize | don't choose `ref` if all you want is `nil` |
00:26:36 | FromDiscord | <KingDarBoja> The downside is having to provide the argument as some(T) on my proc call |
00:26:58 | FromDiscord | <KingDarBoja> But ofc Option saves me from having to make multiple proc for Union Types |
00:27:01 | leorize | or you can have an overload with T and one without |
00:27:35 | FromDiscord | <KingDarBoja> I was speaking of things like `seq[T] or T` but yeah, overload |
00:27:45 | FromDiscord | <KingDarBoja> I saved the conversation we had last night 😄 |
00:28:45 | FromDiscord | <KingDarBoja> But also, if multiple params requires Union Types = more overload calls = more headache |
00:30:02 | leorize | maybe you're not looking at the right angle |
00:30:35 | FromDiscord | <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:36 | FromDiscord | <KingDarBoja> 🙈 |
00:30:58 | leorize | python tempts you into `ref` because that's the only thing python has :p |
00:31:01 | FromDiscord | <KingDarBoja> Once again, apologies if I am asking too much |
00:31:29 | FromDiscord | <KingDarBoja> My first crash from common OOP into Nim was the inheritance for the AST |
00:31:47 | FromDiscord | <KingDarBoja> as some derived types (child classes) had the same name but different type |
00:31:56 | FromDiscord | <KingDarBoja> And ofc, the case kind approach doesn't allow that |
00:32:04 | leorize | asking that's kinda the point of this channel |
00:32:10 | FromDiscord | <KingDarBoja> Had to go into old inheritance |
00:32:45 | FromDiscord | <KingDarBoja> And ended up with this |
00:32:53 | FromDiscord | <KingDarBoja> https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L86 |
00:33:59 | FromDiscord | <KingDarBoja> Which is used on the Parser |
00:36:13 | FromDiscord | <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:37 | leorize[m] | does the Nim-style NimNode not work here? |
00:38:10 | leorize[m] | oh, you want the same ident to have different meaning |
00:38:33 | leorize[m] | that's equal to setting up a maze for yourself |
00:38:38 | FromDiscord | <KingDarBoja> By ident you mean an prop? |
00:38:47 | leorize[m] | yea |
00:38:49 | FromDiscord | <KingDarBoja> Prop = class member |
00:39:37 | leorize[m] | same name different meaning is usually not something I'd consider "readable" |
00:40:43 | FromDiscord | <KingDarBoja> Yeah, that's what I get for porting things the same way as the source code lol |
00:41:30 | leorize | be a bit more creative |
00:41:41 | leorize | a variant type is perfect for this use case :) |
00:42:06 | * | NimBot joined #nim |
00:44:19 | FromDiscord | <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:50 | leorize | int is it's byte representation :) |
00:44:59 | FromDiscord | <Avatarfighter> o |
00:45:17 | leorize | or if you want the boring way: `cast[array[sizeof(int), byte](int)` |
00:46:05 | FromDiscord | <KingDarBoja> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants |
00:47:14 | leorize | @Avatarfighter: maybe you actually have to cast the address, I'm not sure :p |
00:47:31 | leorize | but that's basically how it's done |
00:48:08 | FromDiscord | <__ibrahim__> how can the same nim code work on mac but give errors on windows? could it be the compiler differences? |
00:48:21 | leorize | depends on the error |
00:48:23 | FromDiscord | <Avatarfighter> welp I've found a little bug https://dsh.re/937b2 |
00:48:35 | FromDiscord | <Avatarfighter> or rather unexpected output |
00:50:03 | * | korakon joined #nim |
00:50:30 | FromDiscord | <Avatarfighter> hm idek what that is it has like all the method names in my binary near the bottom |
00:51:16 | leorize | did you just `cat` your own binary? |
00:51:34 | * | Tyresc quit (Quit: WeeChat 2.7-dev) |
00:51:36 | FromDiscord | <Avatarfighter> i did not lma |
00:52:07 | FromDiscord | <Avatarfighter> https://dsh.re/e1cdf |
00:52:15 | FromDiscord | <Avatarfighter> just messing around atm |
00:57:06 | FromDiscord | <KingDarBoja> Hey leo, by using object variants, the `ref` is needed for the base Node? |
00:58:19 | leorize | no, but yes |
00:58:35 | * | FromDiscord <KingDarBoja> Explain sensei |
00:59:22 | leorize | yes because you're going to reference the type within itself |
00:59:32 | leorize | no because it's not a requirement of object variants |
01:02:38 | FromDiscord | <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:25 | leorize | @Avatarfighter: lol you don't simply cast that into a `string` |
01:04:29 | leorize | use `$` instead lol |
01:05:16 | leorize | actually `repr` is better since it can display blank characters |
01:14:09 | FromDiscord | <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:35 | FromDiscord | <KingDarBoja> i.e. `nkAdd` has leftOp: anotherNodeKind ? |
01:14:57 | * | chemist69 quit (Ping timeout: 260 seconds) |
01:15:30 | FromDiscord | <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:57 | FromDiscord | <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:58 | FromDiscord | <KingDarBoja> https://github.com/nim-lang/RFCs/issues/19 |
01:55:54 | leorize[m] | @Avatarfighter: it's... possible? |
01:57:23 | FromDiscord | <Avatarfighter> leorize: Yeah it's possible I just was doing it the exact opposite way of what was easy to do |
01:57:34 | leorize[m] | lol |
01:58:33 | FromDiscord | <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:23 | leorize | lol no |
01:59:29 | leorize | you already messed it up |
02:00:22 | * | dddddd quit (Ping timeout: 256 seconds) |
02:00:42 | FromDiscord | <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:44 | leorize | note that the two pointers passed to bigEndian must not be of the same one :P |
02:00:53 | FromDiscord | <Avatarfighter> but it works though? |
02:01:22 | leorize | for when you're on an architecture where the compiler implements the intrinsic, yes |
02:01:30 | FromDiscord | <Avatarfighter> ah |
02:01:41 | leorize | but the generic implementation straight up copy between the two pointers lol |
02:01:51 | FromDiscord | <Avatarfighter> hahah ok |
02:04:01 | FromDiscord | <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:14 | FromDiscord | <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:32 | FromDiscord | <KingDarBoja> I just finished reading this entire issue |
02:06:33 | FromDiscord | <KingDarBoja> https://github.com/nim-lang/Nim/issues/6638 |
02:07:16 | FromDiscord | <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:49 | FromDiscord | <KingDarBoja> But damn, can't use `nil` for my object so any usage of `isNil` breaks my code lol |
02:19:44 | FromDiscord | <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:01 | leorize | Avatarfighter: sure that doesn't look bad |
02:38:13 | FromDiscord | <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:37 | FromDiscord | <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:11 | FromDiscord | <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:28 | FromDiscord | <Rika> what |
04:06:41 | * | supakeen joined #nim |
04:06:44 | FromDiscord | <KingDarBoja> A picture will show u |
04:07:50 | FromDiscord | <KingDarBoja> https://imgur.com/sOq9zLt |
04:08:05 | FromDiscord | <KingDarBoja> Left side, Python, right side Nim |
04:08:15 | FromDiscord | <KingDarBoja> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#string-ops |
04:10:08 | FromDiscord | <Rika> unindent(2) |
04:10:21 | FromDiscord | <Rika> pass in a number, it will do that much whitespace |
04:10:47 | FromDiscord | <Rika> if you dont, itll do all whitespace possible |
04:10:49 | FromDiscord | <Varriount> Araq: Why can't iterators be forward-declared? |
04:11:55 | FromDiscord | <KingDarBoja> Nope, it should be dynamic Rika |
04:12:05 | FromDiscord | <KingDarBoja> I mean, detect the common indentation and remove that only |
04:12:18 | * | FromDiscord <KingDarBoja> unless I calculate it myself |
04:12:38 | FromDiscord | <KingDarBoja> Need to look at textwrap.dedent to see how they do it |
04:13:50 | FromDiscord | <Rika> `Nope, it should be dynamic Rika` well i mean |
04:13:54 | FromDiscord | <Rika> its not what it does |
04:14:39 | FromDiscord | <Rika> the cost of it being dynamic would prolly be much more expensive than what it does right now |
04:15:04 | FromDiscord | <KingDarBoja> Yeah, don't get me wrong, I know what you mean 😄 |
04:21:52 | ryukoposting | https://chromaengine.gitlab.io/ABOUT.html |
04:22:05 | ryukoposting | coming soon to a git repo near you |
04:28:02 | FromDiscord | <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:23 | FromDiscord | <Rika> because i think ddlc has some interesting renpy usage, not too sure |
04:30:09 | ryukoposting | oh it could easily do DDLC |
04:30:32 | ryukoposting | It could do 95% of DDLC in its current state lmao, I'm not even done with the beta release yet |
04:31:04 | ryukoposting | idk if DDLC's creator would like it if I literally copied his game though |
04:47:31 | FromDiscord | <Rika> i mean dont post it of course |
04:47:37 | FromDiscord | <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:28 | moerm | Hello, 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:18 | FromDiscord | <Gary M> Hello |
08:49:37 | Prestige | Anyone here using nimlsp? For some reason the build is failing for me with nimble install nimlsp |
08:49:58 | Prestige | https://0x0.st/iSgd.txt |
08:50:17 | Prestige | Nim version 1.2.0 [Linux: amd64] |
08:50:19 | * | neceve joined #nim |
08:56:58 | Prestige | hm I think I may have gotten it to install but don't know how to search for installed packages |
08:58:42 | FromDiscord | <Recruit_main707> Has someone tried to run autoWIG on the produced Nim code? |
09:03:55 | solitudesf | Prestige, `nimble list -i` |
09:04:11 | Prestige | ah thank you. It seems it did fail to install |
09:05:16 | solitudesf | you can add --debug flag, to also show compiler output |
09:06:14 | Prestige | https://0x0.st/iSEs.txt |
09:06:40 | Prestige | Error: cannot open file: /usr/nimsuggest/nimsuggest.nim - hmm |
09:07:03 | solitudesf | yes, it need nimsuggest source, which distros dont package |
09:07:08 | solitudesf | you need to clone nim repo |
09:07:27 | solitudesf | and use -d:nimsuggestpath:<path to nimsuggest> flag |
09:08:00 | Prestige | Thanks I'll give that a shot |
09:08:52 | solitudesf | you can pass flags to compiler with `nimble install` using `-p/--passNim` |
09:12:26 | Prestige | I attempt giving it the directory of nimsuggest and also the nimsuggest.nimble file: https://0x0.st/iSEK.txt |
09:12:37 | Prestige | s/attempt/attempted |
09:13:24 | solitudesf | nimble install nimlsp -p:-d:nimblesuggestpath:/home/avahe/programming/nim/nimsuggest/ |
09:13:37 | solitudesf | wait |
09:13:43 | solitudesf | its nimsuggestpath not nimblesuggest |
09:13:44 | solitudesf | cmon man |
09:13:55 | solitudesf | nimble --debug install nimlsp -d:nimsuggestpath:/home/avahe/programming/nim/nimsuggest/nimsuggest.nimble |
09:14:11 | solitudesf | nimble install nimlsp -p:-d:nimsuggestpath:/home/avahe/programming/nim/nimsuggest/ |
09:14:14 | solitudesf | 3rd time the charm |
09:14:45 | * | moerm joined #nim |
09:15:01 | moerm | Hello, again |
09:15:13 | * | xcm quit (Remote host closed the connection) |
09:15:34 | Prestige | hi moerm |
09:15:45 | Prestige | woo thanks solitudesf |
09:17:21 | * | xcm joined #nim |
09:22:22 | * | neceve quit (Ping timeout: 256 seconds) |
09:33:51 | FromDiscord | <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:34 | Yardanico | there are slices |
09:34:57 | Yardanico | https://play.nim-lang.org/#ix=2hzt |
09:35:18 | Yardanico | https://nim-lang.org/docs/tut1.html#advanced-types-slices |
09:35:57 | FromDiscord | <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:11 | FromDiscord | <danielo515> Yes, I want efficiency, but not at the cost of readability 😄. |
09:38:11 | FromDiscord | <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:53 | Prestige | niche question, does anyone have nim editing set up with coc-nvim? |
09:39:34 | FromDiscord | <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:02 | FromDiscord | <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:16 | Prestige | with coc-nvim? That'd be cool if I could see how they have it set up danielo515 |
09:41:17 | FromDiscord | <danielo515> yep, it is called vindi |
09:41:32 | FromDiscord | <danielo515> https://github.com/D-Nice/vindi |
09:42:03 | FromDiscord | <danielo515> Here is the init.vim |
09:42:04 | FromDiscord | <danielo515> https://github.com/D-Nice/vindi/blob/master/etc/init/.config/nvim/init.vim |
09:42:33 | moerm | Have a nice day all |
09:42:38 | * | moerm quit (Quit: Leaving) |
09:42:54 | Prestige | Looks like they are actually using other nim plugins maybe |
09:44:19 | Prestige | oh maybe not, they are registering nimlsp in coc-settings.json |
09:44:34 | Prestige | maybe my nim setup just isn't proper |
09:45:02 | Prestige | when 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:27 | Prestige | I 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:39 | Prestige | ah yep. 'Error: cannot open '/home/avahe/.config/nim/lib/system.nim' |
09:50:43 | FromDiscord | <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:26 | Prestige | It 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:36 | Yardanico | just use choosenim :P |
09:52:27 | Prestige | didn't know that existed, looks good |
09:53:57 | Prestige | But I did get it working with a single symlink so I'm happy for now |
09:57:09 | FromDiscord | <danielo515> mmm, is there a way to iterate a sequence of custom types? |
09:57:41 | FromDiscord | <danielo515> This is telling me there is no match for my sequence type: |
09:57:41 | FromDiscord | <danielo515> |
09:57:41 | FromDiscord | <danielo515> ``` |
09:57:41 | FromDiscord | <danielo515> proc printFile(file:FileInfo, belowFiles: Slice[FileInfo]) = |
09:57:41 | FromDiscord | <danielo515> for f in belowFiles: |
09:57:42 | FromDiscord | <danielo515> ``` |
10:05:29 | FromGitter | <alehander92> guys |
10:05:38 | FromGitter | <alehander92> i got my solid code book |
10:05:45 | FromGitter | <alehander92> starting to read books |
10:05:50 | FromGitter | <alehander92> about stuff |
10:06:31 | FromGitter | <alehander92> posts are awesome, didnt expect such a good delivery+service |
10:07:32 | * | planetis[m] joined #nim |
10:08:46 | solitudesf | @danielo515 Slice is not a sequence, its just a range |
10:08:57 | Prestige | Have syntax highlighting, autocomplete, docs and everything in vim now. This is so awesome |
10:10:52 | * | xet7 quit (Quit: Leaving) |
10:11:49 | planetis[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:35 | FromDiscord | <danielo515> > @danielo515 Slice is not a sequence, its just a range |
10:18:35 | FromDiscord | <danielo515> Oh, so I can not iterate it then? |
10:18:42 | Yardanico | you can, but you need a seq |
10:19:06 | Yardanico | belowFiles 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:34 | FromDiscord | <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:41 | FromDiscord | <danielo515> I better pass the idx and the entire seq |
10:28:55 | Yardanico | if you want to pass " sub-seq" you need to use a seq type anyway |
10:29:01 | Yardanico | Slice of a sequence returns a sequence |
10:29:27 | Yardanico | !eval echo @[1, 2, 4, 5][2..^1] |
10:29:30 | NimBot | @[4, 5] |
10:29:31 | FromDiscord | <danielo515> How do I slice a sequence? |
10:29:34 | FromDiscord | <danielo515> that's what I tried |
10:30:04 | FromDiscord | <danielo515> And I thought that created a slice. I may be wrong though |
10:30:05 | FromDiscord | <danielo515> By the way, how can I create a sequence with certain size and filled with one repeated value? |
10:30:38 | Yardanico | There's "fill" in algorithm module |
10:30:47 | Yardanico | and certain size - either newSeq or newSeqOfCap |
10:30:57 | planetis[m] | newSeqWith |
10:31:02 | Yardanico | oh |
10:31:11 | Yardanico | from sequtils |
10:31:55 | FromDiscord | <danielo515> newSeqWith is exactly what I was looking for |
10:32:14 | FromDiscord | <danielo515> Thanks |
10:32:29 | FromDiscord | <danielo515> I was looking for on the nim tutorial, and in seqUtils and I didn't found it |
10:32:30 | FromDiscord | <danielo515> my bad |
10:39:23 | * | dddddd joined #nim |
10:39:51 | FromDiscord | <danielo515> Is there an equivalent for arrays? |
10:39:57 | Yardanico | arrays :) |
10:40:09 | Yardanico | https://nim-lang.org/docs/tut1.html#advanced-types-arrays |
10:41:21 | Yardanico | arrays in nim are fixed-length (you can't change their length at runtime) |
10:44:50 | FromDiscord | <danielo515> yep, I tried to create an array and the compiler yelled at me |
10:44:57 | FromDiscord | <danielo515> I'll stick with seq then |
10:46:31 | Yardanico | the simplest way to create an array is "let a = [1, 2, 3]" |
10:52:19 | FromDiscord | <danielo515> Thanks again |
10:52:43 | FromDiscord | <danielo515> Why other sequences has a len prop but this one does not? |
10:52:44 | FromDiscord | <danielo515> ``` |
10:52:44 | FromDiscord | <danielo515> let depth = path.parentDirs.len |
10:52:44 | FromDiscord | <danielo515> ``` |
10:52:53 | Yardanico | because parentDirs isn't a sequence |
10:53:01 | Yardanico | it's an iterator |
10:53:05 | Yardanico | https://nim-lang.org/docs/os.html#parentDirs.i%2Cstring |
10:54:06 | Yardanico | you can either process its values in a for loop or do "let data = toSeq(path.parentDirs)" |
10:54:13 | Yardanico | and use data.len where you need |
10:54:16 | Yardanico | toSeq is from sequtils |
10:56:57 | FromDiscord | <danielo515> I already have seqUtils imported |
10:57:19 | FromDiscord | <danielo515> I was doing this: |
10:57:19 | FromDiscord | <danielo515> ``` |
10:57:19 | FromDiscord | <danielo515> var depth = 0 |
10:57:20 | FromDiscord | <danielo515> for f in path.parentDirs: depth += 1 |
10:57:20 | FromDiscord | <danielo515> ``` |
10:57:23 | FromDiscord | <danielo515> But is kinda ugly |
10:58:43 | FromDiscord | <danielo515> Wow, I got an unexpected behavior |
10:59:03 | FromDiscord | <danielo515> I changed that to |
10:59:03 | FromDiscord | <danielo515> ``` |
10:59:03 | FromDiscord | <danielo515> let depth = toSeq(path.parentDir).len |
10:59:03 | FromDiscord | <danielo515> ``` |
10:59:03 | FromGitter | <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:17 | FromDiscord | <danielo515> And depth goes from 2,3 etc to 2, 11, 15... |
10:59:19 | Yardanico | also @danielo515 can you please not use ``` ? in IRC we see it as 3 lines |
10:59:31 | Yardanico | @faulander can you show the code example? |
10:59:35 | FromDiscord | <danielo515> Ok, how should I do it then? |
10:59:46 | Yardanico | just like "let depth = toSeq(path.parentDir).len" or use paste services :P |
11:00:01 | Yardanico | @faulander or maybe you forgot to place some symbol like : or = somewhere |
11:00:19 | FromGitter | <faulander> for pattern in unWantedDirNames: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e91a342cc370f0b07d91310] |
11:00:34 | FromGitter | <faulander> ok, indentation is lost here |
11:00:42 | FromGitter | <Yardanico> that's not corrent nim anyway |
11:00:50 | Yardanico | " dir[:posUnwantedDirName+1]" I assume you wanted a slice? |
11:01:40 | FromGitter | <faulander> yes, true |
11:01:58 | Yardanico | if you want to have this slice in nim do dir[0..posUnwantedDirName+1] |
11:02:02 | FromGitter | <faulander> from the beginning to the start of th match |
11:02:04 | Yardanico | nim slices are different from python slices |
11:02:24 | Yardanico | oh, or dir[0..posUnwantedDirName] |
11:02:55 | FromGitter | <faulander> (https://files.gitter.im/nim-lang/Nim/p4kh/image.png) |
11:02:55 | FromGitter | <faulander> (https://files.gitter.im/nim-lang/Nim/p4kh/image.png) |
11:03:13 | FromGitter | <faulander> aaaah, i need to learn to read first! |
11:03:24 | Yardanico | xddd |
11:03:59 | FromGitter | <faulander> haha, i was happy that it's the same as in python ... the error is VERY missleading though |
11:05:11 | Yardanico | well I hope you understand that Nim has much less common in Python than it seems at first :) |
11:05:25 | Yardanico | and yeah, error could've been better |
11:05:45 | FromGitter | <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:05 | dom96 | What a lovely and sunny quarantine Easter weekend we have going on here, how's everybody doing? |
11:06:41 | FromGitter | <faulander> being in quarantine sucks ... but: Less clothing to wash, shorter way to work, more time for learning nim ... you continue. |
11:08:08 | FromGitter | <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:51 | dom96 | Nice, definitely a lot of silver linings :) |
11:11:09 | FromDiscord | <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:15 | FromDiscord | <eliezedeck> how can I solved this? |
11:11:16 | dom96 | I guess us programmers, who are typically not very social anyway don't find it as tough as most people |
11:11:30 | Yardanico | very true for me :P |
11:11:58 | dom96 | eliezedeck: importc printf and use it instead |
11:12:34 | FromDiscord | <eliezedeck> ok, thanks |
11:13:08 | FromDiscord | <eliezedeck> I'm still curious as to why is it this way? |
11:15:54 | * | Vladar joined #nim |
11:19:39 | FromDiscord | <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:55 | FromDiscord | <danielo515> like folder a, file a1, folder b, file b1, file b2 |
11:28:29 | FromGitter | <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:52 | FromGitter | <faulander> just use nested for loops, that's what i did anyway. |
11:31:20 | FromGitter | <faulander> another file related question to the pros here. i cannot find a renameDir proc ... is really moveDir the only option? |
11:32:22 | Yardanico | it does the same |
11:32:33 | FromGitter | <faulander> speedwise not, or? |
11:32:38 | Yardanico | no, the same |
11:32:46 | Yardanico | when you MOVE the directory the FS doesn't actually copy any data |
11:33:00 | Yardanico | it just changes the "place" where it's stored |
11:33:04 | FromGitter | <faulander> ok, perfect. thanks |
11:33:54 | FromGitter | <faulander> @dom96 |
11:34:22 | FromGitter | <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:23 | dom96 | ?? |
11:38:11 | kungtotte | I 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:44 | kungtotte | I'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:29 | FromGitter | <faulander> i miss my family and friends. that's the only downside for me. |
11:53:57 | FromDiscord | <danielo515> > <FromGitter> <faulander> just use nested for loops, that's what i did anyway. |
11:53:57 | FromDiscord | <danielo515> @gitterirc |
11:53:58 | FromDiscord | <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:22 | go|dfish | @danielo515 https://github.com/nim-lang/Nim/tree/version-1-2/lib/pure/os.nim#L2129 |
12:01:54 | go|dfish | that'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:19 | FromGitter | <alehander92> use recursion |
12:02:36 | FromGitter | <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:40 | FromDiscord | <danielo515> Tha KS for the reference |
12:21:33 | FromGitter | <faulander> can i do something like that? ⏎ proc test(s:string, posStart:int = 0, posEnd:int = len(s)): string = |
12:22:49 | Yardanico | I think there was an issue and PR for that, but it wasn't merged, but let me find it |
12:24:35 | Yardanico | oh actually it works |
12:24:35 | FromGitter | <faulander> otherwise i set it to 0 and right after the declaration to len(s) - or is there a better way? |
12:24:44 | Yardanico | your code will work just fine |
12:24:51 | Yardanico | also you don't need to specify the type when you have a default value |
12:24:59 | FromGitter | <faulander> i got an error ... but maybe it's again because of something else :D |
12:25:31 | Yardanico | proc test(s: string, posStart = 0, posEnd = len(s)): string = stuff |
12:25:36 | Yardanico | https://play.nim-lang.org/#ix=2hAq |
12:27:02 | FromGitter | <faulander> if i set the default to nil i don't have to set a type either? |
12:27:06 | FromGitter | <faulander> and thanks for the demo code |
12:27:16 | Yardanico | you have to set the type if you use "nil" |
12:27:24 | Yardanico | but "nil" can only be used for ref types anyway |
12:27:40 | FromGitter | <faulander> how would i use optional arguments then? |
12:27:52 | Yardanico | set a default value? |
12:28:00 | FromGitter | <faulander> just with an empty default value? |
12:28:08 | FromGitter | <faulander> ah, sure. makes sense :) |
12:28:31 | FromGitter | <faulander> i am such a newb :) |
12:29:44 | FromGitter | <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:23 | Yardanico | well 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:38 | Yardanico | and programmer can fix it by specifying what to import from a module, or what NOT to import |
12:32:38 | FromGitter | <faulander> yes, i thought that. thanks. |
12:33:00 | FromGitter | <faulander> one more question. An empty string doesn't evaluate to false, is there a reason behin it? |
12:34:18 | Yardanico | wdym "evaluate to false" |
12:34:25 | Yardanico | you can't really convert a string to a boolean |
12:34:39 | Yardanico | nim is not python :) |
12:36:16 | FromDiscord | <Rika> hey, you can |
12:36:18 | FromGitter | <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:23 | FromDiscord | <Rika> `string != ""` |
12:36:24 | FromDiscord | <Rika> easy |
12:36:28 | FromGitter | <sealmove> guys, is there a way to make this work: https://play.nim-lang.org/#ix=2hAu ? |
12:36:39 | FromDiscord | <Rika> it |
12:36:41 | FromDiscord | <Rika> oops |
12:36:44 | FromDiscord | <Rika> premature enter key |
12:36:50 | Yardanico | *cough* |
12:37:10 | FromDiscord | <Rika> it's only clearer because most people think that "when strings are empty, theyre false" |
12:37:14 | FromDiscord | <Recruit_main707> sealmove, let the a variable be of type A instead of ref RootObj |
12:37:16 | FromDiscord | <Rika> but that is a baseless assumption |
12:37:43 | FromGitter | <sealmove> Recruit_main707: I want to achieve polymorphism on fields |
12:38:20 | FromGitter | <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:32 | FromGitter | <faulander> Rika, you are of course right: empty isn't false. |
12:38:43 | FromDiscord | <Rika> https://play.nim-lang.org/#ix=2hAw |
12:39:05 | FromDiscord | <Rika> sealmove: ref RootObj isnt a valid class to use |
12:39:16 | FromDiscord | <Rika> RootObj is abstract AFAIK |
12:39:41 | FromGitter | <sealmove> ok, but your example makes no sense |
12:39:53 | FromGitter | <sealmove> I need x to be declared under B, not A |
12:39:53 | FromDiscord | <Rika> faulander: thats exactly why there's no truthiness here, what do you consider true and false is dependent on the person |
12:40:13 | FromDiscord | <Rika> sealmove: change it to B |
12:40:14 | FromDiscord | <Rika> still works |
12:40:16 | FromGitter | <sealmove> https://play.nim-lang.org/#ix=2hAy |
12:40:28 | FromDiscord | <Rika> huh? |
12:40:32 | FromDiscord | <Rika> that makes no sense |
12:40:40 | FromGitter | <sealmove> yeah |
12:40:44 | FromDiscord | <Rika> the one you sent |
12:40:47 | FromDiscord | <Rika> makes no sense |
12:41:07 | FromDiscord | <Rika> i mean the code, not the result |
12:41:15 | FromDiscord | <Rika> the result makes sense given the code |
12:41:35 | FromDiscord | <Rika> think this: not all As have an x, but all Bs do |
12:41:46 | FromDiscord | <Rika> not all subtypes of A have an x either |
12:41:50 | FromDiscord | <Rika> which is why that fails |
12:41:59 | FromDiscord | <Rika> okay |
12:42:02 | FromDiscord | <Rika> i understand what you want now |
12:42:21 | FromDiscord | <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:59 | FromGitter | <sealmove> I see |
12:43:27 | FromDiscord | <Rika> i dont see why it would be added either |
12:43:41 | FromDiscord | <Rika> faulander: you good? |
12:45:30 | FromGitter | <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:41 | FromDiscord | <danielo515> Is it possible to call `result.add` more than once in the same proc? |
12:55:41 | FromDiscord | <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:53 | FromDiscord | <Rika> @danielo515 i dont see why you can't |
12:56:06 | FromDiscord | <Rika> result isnt return, using result doesnt end the proc |
12:56:25 | FromDiscord | <danielo515> mmm, then the problem should be something else |
12:56:56 | FromDiscord | <Rika> mind showing the proc? |
12:56:57 | FromDiscord | <danielo515> Oh, walkDir fails silently if the folder does not exist or can not be reached |
12:57:04 | FromDiscord | <Rika> silently? |
12:57:13 | FromDiscord | <danielo515> Well, maybe not fails, but just returns an empty iterator |
12:57:58 | Yardanico | https://github.com/nim-lang/Nim/pull/13642 |
12:58:27 | Yardanico | use checkDir argument for walkDir |
12:58:42 | Yardanico | with checkDir = true it'll raise an error if directory is not found |
13:03:31 | FromDiscord | <Rika> @danielo515 ^ |
13:03:52 | Yardanico | it needs to be documented though, it's documented in removeDir but not in walkDir |
13:05:43 | * | pbb joined #nim |
13:06:10 | FromDiscord | <danielo515> Oh, thanls for the ref |
13:07:22 | FromGitter | <faulander> i don't understand the unittest module |
13:07:35 | Yardanico | wdym? |
13:07:41 | FromDiscord | <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:13 | FromDiscord | <__ibrahim__> quick question, (sorry, don't mean to interrupt): is the Nim in Action book up to date? |
13:08:24 | FromGitter | <sealmove> eh, argument passing doesn't work either |
13:08:26 | Yardanico | yes, the code in it will work with current Nim version |
13:08:26 | FromDiscord | <Rika> @__ibrahim__ not really, but its not that out of date |
13:08:42 | FromDiscord | <Rika> sealmove: wdym? |
13:08:53 | Yardanico | Well 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:12 | FromDiscord | <__ibrahim__> cool, i reckon it's good for a nim noob? |
13:09:28 | FromDiscord | <Rika> deffo |
13:09:35 | FromDiscord | <Rika> @danielo515 wdym it doesnt do both? |
13:09:43 | Yardanico | well yeah, but it assumes that you're not really new to programming :) |
13:10:08 | Yardanico | You 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:31 | FromDiscord | <__ibrahim__> fascinating! thank you very much guys! yes i have some experience with C++ JS and Py |
13:10:42 | FromDiscord | <Rika> then the book is good |
13:10:55 | FromDiscord | <Rika> ~~i'd suggest the one on manning because of livebook~~ |
13:11:01 | Yardanico | ? |
13:11:22 | FromDiscord | <__ibrahim__> that narimiran link looks nice, thanks Yardanico |
13:11:24 | FromDiscord | <Rika> https://www.manning.com/livebook-program |
13:11:30 | * | nsf joined #nim |
13:11:32 | FromDiscord | <Rika> this thing |
13:11:36 | Yardanico | Nim 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:44 | Yardanico | @Rika https://narimiran.github.io/nim-basics/ is in the browser too |
13:12:19 | FromDiscord | <__ibrahim__> i got the nim in action pdf from manning, time to dig in! wish me luck 😸 |
13:12:21 | FromGitter | <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:55 | FromDiscord | <Rika> i dont see why that shouldnt work |
13:13:05 | Yardanico | "seems to work" Rika |
13:14:12 | FromDiscord | <Rika> that implies it shouldnt does it not? |
13:14:19 | Yardanico | that implies that it works |
13:14:39 | Yardanico | "seems to work" is like "I'm not sure why, but it works" :D |
13:15:40 | FromDiscord | <Rika> "it works, but i dont know why" -> i dont know why may imply it shouldnt work |
13:15:48 | FromDiscord | <Rika> thats what i thijnk |
13:15:49 | Yardanico | no |
13:15:51 | FromDiscord | <Rika> anyway |
13:15:53 | FromDiscord | <Rika> lets not |
13:15:55 | FromDiscord | <Rika> lmao |
13:16:00 | FromDiscord | <Rika> this is useless |
13:16:12 | Yardanico | you just sent 4 separate messages for saying "let's not discuss this further" |
13:16:14 | FromGitter | <sealmove> also another thing. I observed differences between castA (myVar) and A(myVar) |
13:16:31 | FromGitter | <sealmove> `cast[A](myVar)` * |
13:16:55 | Yardanico | well cast shouldn't really be used unless you're dealing with FFI or raw pointers |
13:16:56 | FromDiscord | <Rika> yardanico: and is there a problem with that? |
13:17:09 | * | pbb quit (Remote host closed the connection) |
13:18:21 | FromDiscord | <danielo515> > @danielo515 wdym it doesnt do both? |
13:18:22 | FromDiscord | <danielo515> @Rika |
13:18:22 | FromDiscord | <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:44 | Yardanico | why not yield files and split them to get the directory they're in? |
13:18:50 | Yardanico | splitPath |
13:19:29 | FromDiscord | <Rika> well, order is not predictable for most walkxxx procs no? |
13:19:42 | Yardanico | well I don't understand what danielo515 wants to do :) |
13:19:47 | FromDiscord | <Rika> me neither |
13:19:59 | FromDiscord | <Rika> what is the "correct order" |
13:20:25 | FromGitter | <sealmove> my code works with cast[] and not normal type conversion |
13:20:31 | FromGitter | <sealmove> no idea why |
13:20:32 | Yardanico | well that's not okay :D |
13:20:37 | Yardanico | cast reinterprets memory |
13:20:45 | Yardanico | it is unsafe |
13:20:49 | FromDiscord | <Rika> scary stuff you got there |
13:21:44 | FromGitter | <sealmove> I have something like `let root = if root == nil: cast[A](this) else: root` |
13:22:07 | FromGitter | <sealmove> (`this` is actually `result`) |
13:24:48 | FromGitter | <sealmove> It feels like I am trying to reinvent inheritance |
13:25:33 | planetis[m] | hi sealmove, how's quarantine? |
13:27:30 | FromGitter | <sealmove> Hey, very good for me. Gives me time to study :> and also do open source |
13:27:32 | FromGitter | <sealmove> You? |
13:28:40 | planetis[m] | same couldn't be better lol |
13:29:10 | planetis[m] | online classes ftw |
13:30:22 | planetis[m] | yesterday i went for a bath and someone called the police!! |
13:30:33 | FromGitter | <sealmove> yeah, I am erasmus and took classes from both home and outdoors university |
13:30:54 | planetis[m] | are you home or abroad? |
13:30:57 | FromGitter | <sealmove> huh? and said what? |
13:31:08 | FromGitter | <sealmove> abroad, in Krakow |
13:31:35 | planetis[m] | oh, and you didn't return why? |
13:31:48 | FromGitter | <sealmove> why would I return? |
13:32:13 | planetis[m] | i dunno... |
13:32:24 | planetis[m] | the idiots in charge here banned swimming |
13:32:48 | planetis[m] | but all other sports are allowed |
13:33:12 | planetis[m] | that have no teams that is |
13:33:31 | FromGitter | <sealmove> so you went "for a bath" in sea :D |
13:33:47 | planetis[m] | i left though so i didn't pay a fine |
13:34:13 | supakeen | For 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:23 | FromGitter | <sealmove> I thought the same supakeen |
13:34:26 | planetis[m] | lol |
13:34:34 | supakeen | Would've been both way worse and way funnier. |
13:35:21 | supakeen | For 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:24 | FromGitter | <sealmove> Do you usually swim in April though? |
13:35:32 | supakeen | It's acceptable in a rapidly evolving situation. |
13:35:40 | FromGitter | <sealmove> btw are you in Greece or Cyprus? Forgot. |
13:35:54 | FromGitter | <alehander92> ohh sealmove i now |
13:35:58 | FromGitter | <alehander92> hmm no |
13:36:03 | FromGitter | <alehander92> i remember stefanos82 |
13:36:11 | planetis[m] | greece and water is fine, if you mean that |
13:36:29 | FromGitter | <alehander92> we're neigbhours |
13:36:33 | FromGitter | <alehander92> which part of greece |
13:36:39 | planetis[m] | yes! |
13:36:44 | FromGitter | <sealmove> @alehander92 right, I confused the nicknames |
13:37:10 | planetis[m] | i live in thessaloniki and have visited bulgaria twice |
13:37:28 | FromGitter | <alehander92> i love thessaloniki |
13:37:38 | FromGitter | <alehander92> from what i've heard about it |
13:37:41 | FromGitter | <alehander92> but i've actually never been yet :D |
13:37:49 | FromGitter | <alehander92> i've been to athens and naxos and volos |
13:38:11 | planetis[m] | sandanski is great for vacations |
13:38:37 | FromGitter | <alehander92> oh i lived in blagoevgrad for my childhood |
13:38:47 | FromGitter | <alehander92> the whole region is pretty nice and friendly |
13:38:57 | FromGitter | <alehander92> but i think i haven't been in sandanski as well :D :D :D |
13:41:25 | planetis[m] | did they banned swimming in bulgaria? |
13:45:32 | FromGitter | <alehander92> no idea |
13:45:36 | FromGitter | <alehander92> they banned going to parks |
13:45:53 | FromGitter | <alehander92> and common playgrounds |
13:46:07 | FromGitter | <alehander92> so i guess swimming might be stopped, but not sure |
13:46:10 | planetis[m] | same |
13:46:30 | FromGitter | <alehander92> they would require us to |
13:46:39 | planetis[m] | all swimming pools are drowned |
13:46:45 | FromGitter | <alehander92> put masks on |
13:46:49 | FromGitter | <alehander92> from tomorrow! |
13:47:36 | FromGitter | <alehander92> or scarfs or stuff |
13:47:45 | FromDiscord | <danielo515> > <Yardanico> well I don't understand what danielo515 wants to do :) |
13:47:45 | FromDiscord | <danielo515> @gitterirc |
13:47:45 | FromDiscord | <danielo515> > me neither |
13:47:45 | FromDiscord | <danielo515> @Rika |
13:47:45 | FromDiscord | <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:48 | FromDiscord | <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:49 | FromGitter | <alehander92> now the weather is amazing btw |
13:48:05 | FromDiscord | <danielo515> In any case, I already have a quite short recursive algorithm that I'm quite happy with |
13:48:16 | FromGitter | <alehander92> yeah simple short recursion is great |
13:48:18 | Yardanico | @danielo515 well why? you can just iterate over all files recursively and get folder with splitPath |
13:48:27 | planetis[m] | you can still go walk around the house right? |
13:49:14 | FromGitter | <alehander92> well yeah, i actually went to another neigbourhood |
13:49:16 | FromGitter | <alehander92> just now |
13:49:30 | FromGitter | <alehander92> but i do this rarely |
13:49:36 | FromGitter | <alehander92> i stay inside most of the time |
13:50:00 | FromGitter | <alehander92> but walking outside is not forbidden, just frowned upon, parks and stuff are forbidden |
13:50:34 | FromGitter | <alehander92> we also have like "border" checks with police on the entrances of many cities |
13:50:42 | FromDiscord | <danielo515> > <Yardanico> @danielo515 well why? you can just iterate over all files recursively and get folder with splitPath |
13:50:42 | FromDiscord | <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:56 | planetis[m] | its the same here |
13:51:03 | FromDiscord | <danielo515> It's 4 lines |
13:51:04 | FromDiscord | <danielo515> proc traverse_dir(dir:string, depth=0): seq[FileInfo] = |
13:51:04 | FromDiscord | <danielo515> for kind, path in walkDir(dir): |
13:51:05 | FromDiscord | <danielo515> result.add FileInfo(name:path.splitPath.tail, depth:depth) |
13:51:05 | FromDiscord | <danielo515> if kind == pcDir: |
13:51:05 | FromDiscord | <danielo515> result = result.concat traverse_dir(path, depth+1 |
13:51:08 | Yardanico | pls don't paste in discord :P |
13:51:11 | Yardanico | and don't use quote |
13:51:20 | FromGitter | <alehander92> don't you need to send sm-ses planetis[m] |
13:51:33 | planetis[m] | sure |
13:51:37 | Yardanico | almost 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:57 | FromGitter | <alehander92> we don't have the sms -es thing |
13:52:04 | FromGitter | <alehander92> only declarations if you go out of the city |
13:52:12 | Yardanico | we have the SMS thing in some regions in Russia, and police checks between cities too |
13:52:22 | FromDiscord | <danielo515> Well, it is quite easy to miss |
13:52:23 | Yardanico | not all, but in some cities for sure |
13:52:46 | FromDiscord | <danielo515> On other places you have to read on the welcome channel before you can write on any other channel |
13:53:03 | FromGitter | <alehander92> danielo515 use walkDir |
13:53:03 | Yardanico | well that needs a yet another bot :P |
13:53:34 | FromGitter | <alehander92> no walkDirRec |
13:53:55 | FromGitter | <alehander92> from os.nim |
13:54:03 | Yardanico | yeah I think walkDirRec should just work for ls-tree structure, idk why it doesn't work for danielo515 |
13:54:36 | FromGitter | <alehander92> danielo515 ah that's a good trick, we might need to add the welcome channel reading too |
13:55:07 | FromDiscord | <Rika> `almost no one reads channel description in discord` tbh, channel descriptions are really secluded in this damned program |
13:55:15 | FromDiscord | <Rika> is secluded the right word |
13:55:17 | FromDiscord | <Rika> no clue |
13:55:19 | Yardanico | for me it's a web page :) |
13:55:25 | FromDiscord | <Rika> either way |
13:55:31 | FromDiscord | <Rika> theyre both web pages really |
13:55:43 | FromDiscord | <Rika> the program one is a glorified web browser anyway |
13:58:03 | FromDiscord | <danielo515> > <Yardanico> yeah I think walkDirRec should just work for ls-tree structure, idk why it doesn't work for danielo515 |
13:58:03 | FromDiscord | <danielo515> @gitterirc I already explained why. The correct thing to use is walk Dir and handle recursion yourself |
14:02:40 | FromDiscord | <Rika> why??? |
14:06:49 | * | pbb quit (Quit: No Ping reply in 210 seconds.) |
14:09:26 | FromGitter | <alehander92> you can pass a filter |
14:09:42 | FromGitter | <alehander92> but maybe a very custom behavior might require custom code |
14:09:48 | FromGitter | <alehander92> and also its good to exercise |
14:10:29 | FromGitter | <alehander92> ah i see |
14:11:07 | * | pbb joined #nim |
14:12:48 | FromGitter | <alehander92> yeah it does work like that |
14:12:51 | FromGitter | <alehander92> because it uses a stack |
14:13:29 | * | Guest93459 is now known as dadada |
14:13:40 | FromGitter | <alehander92> yeah one needs to write a custom one for that thing |
14:14:22 | dadada | hi, 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:45 | Yardanico | compiling Nim to C and then using it in a stub C++ project ? |
14:15:15 | dadada | 1) we already have gobject introspection support for Nim, which enables us to use Gtk and the like with no issues |
14:15:20 | dadada | Yardanico: better IMO |
14:15:26 | Yardanico | well I'm waiting |
14:16:07 | dadada | 2) 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:33 | dadada | 3) as you noticed from 1) Nim also has gobject introspection support, so 2) should also work with Nim at least in theory |
14:16:54 | Yardanico | but how it provides access to Qt features? |
14:17:00 | dadada | 4) the ugly thing with this solution is, you need gtk for this to work, which is an odd dependency for Qt project |
14:17:10 | Yardanico | you mean https://github.com/mrosset/giqt ? |
14:17:16 | dadada | Yardanico: yes, that's it! |
14:17:27 | * | zacharycarter joined #nim |
14:17:28 | dadada | look at this example for python https://github.com/mrosset/giqt/blob/master/examples/hello.py.in |
14:18:00 | dadada | the first 4/5 lines of python are gtk/gi related, the rest looks like normal Qt code would |
14:18:10 | Yardanico | seems like you'll have to wrap all types manually for each Qt type though |
14:18:14 | Yardanico | see https://github.com/mrosset/giqt/blob/master/application/qt-button.cpp |
14:18:21 | Yardanico | or https://github.com/mrosset/giqt/blob/master/application/qt-web-view.cpp |
14:18:21 | dadada | there's even a lambda in there to connect the button click with |
14:18:36 | Yardanico | not a lot of code but you'll need to write it for every Qt type and function |
14:18:40 | Yardanico | to fully cover Qt :P |
14:18:58 | Yardanico | also the project is GPLv3 |
14:19:04 | FromDiscord | <Rika> oh man, GPL |
14:19:06 | FromDiscord | <Rika> rest in peace |
14:19:21 | dadada | I'm mostly interested in FOSS projects, so this isn' |
14:19:38 | dadada | t 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:42 | Yardanico | well I just don't like people who always use GPLv3 even for stuff like libraries :) |
14:19:55 | Yardanico | it makes sense sometimes, but not in this case for example |
14:19:57 | dadada | Yardanico: for libraries I tend to agree |
14:20:15 | dadada | Yardanico: most UIs you'll write will be applications, not libraries |
14:20:37 | Yardanico | dadada: the "giqt" is technically a library so if you use it in your application it'll also need to be open sourced |
14:20:56 | dadada | Yardanico: I know that, man |
14:21:19 | FromDiscord | <danielo515> What's the go to for desktop apps on nim? |
14:21:24 | dadada | as 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:36 | Yardanico | @danielo515 the most complete one is "gintro" gtk bindings for nim |
14:21:44 | Yardanico | https://github.com/StefanSalewski/gintro |
14:21:46 | Yardanico | it's really nice |
14:21:49 | * | zacharycarter quit (Ping timeout: 250 seconds) |
14:23:02 | dadada | Yardanico: 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:09 | zacharycarter | if 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:17 | zacharycarter | that's only if I'm using the shared library in another Nim project right? |
14:55:27 | * | Minimisthupper joined #nim |
14:57:49 | FromGitter | <kennymalac> Hello, I am getting a type error creating a table of seq of tables as value |
14:57:55 | FromGitter | <kennymalac> let outTable = newTable[string, seq[Table[string, string]]] |
14:58:06 | FromGitter | <kennymalac> home/kenster/Company/COVID-19-Dashboard/csvparser/src/csvparser.nim(14, 26) Error: expression 'newTable' has no type (or is ambiguous) |
14:58:18 | Yardanico | you forgot () |
14:58:34 | FromGitter | <kennymalac> oh lol, thanks |
14:58:44 | Yardanico | also there's a difference between Table and TableRef |
14:58:51 | Yardanico | with newTable you create a TableRef, with initTable - Table |
15:01:01 | FromGitter | <kennymalac> good to know |
15:04:44 | FromDiscord | <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:57 | FromDiscord | <flywind> https://play.nim-lang.org/#ix=2hBr |
15:05:38 | krux02 | flywind you can run a single test in testament |
15:06:47 | krux02 | for example: testament/testament run tests/misc/tsizeof.nim |
15:08:26 | krux02 | flywind: do you use testament in your own project? |
15:08:33 | FromDiscord | <flywind> I use testament in CI, if one test fails, others won't test? |
15:08:47 | Yardanico | they will get tested |
15:09:05 | krux02 | I personally don't recommend to use testament. It is highly specialized to test Nim. |
15:09:35 | krux02 | It 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:18 | FromDiscord | <flywind> I use `testament cat /` to test all files, it seems fine. |
15:10:49 | krux02 | If that works for you, then do it. |
15:12:31 | * | zacharycarter quit (Ping timeout: 260 seconds) |
15:16:42 | krux02 | for file in $(find ./tests -iname '*.nim' -type f -print); do echo nim c -r $file; done |
15:17:21 | krux02 | not sure why you would want a dependency like testament for that functionality. |
15:18:19 | * | pbb quit (Remote host closed the connection) |
15:19:19 | FromDiscord | <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:20 | FromDiscord | <flywind> https://nim-lang.org/docs/unittest.html |
15:26:30 | krux02 | flywind: 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:22 | krux02 | Now we have a testing tool that that is recommended for people to use, but if they actually use it, they get burned. |
15:27:30 | krux02 | sorry that you see it. |
15:29:01 | krux02 | You 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:00 | dadada | don't ditch Nim |
15:31:09 | FromDiscord | <flywind> Thanks @krux02.I will think about it.😄 |
15:32:35 | FromGitter | <alehander92> @krux02 i also thought `testament` shouldn't try to take `unittest`'s place |
15:32:50 | FromGitter | <alehander92> but this attitude sucks, man |
15:33:21 | krux02 | alehander92: do you mean my attitude? |
15:34:00 | krux02 | flywind: you are welcome. |
15:35:31 | krux02 | I 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:51 | companion_cube | what's your list of top problems krux02 ? |
15:36:06 | FromGitter | <zetashift> sweet: https://github.com/Pebaz/nimporter/releases/tag/v1.0.0 |
15:36:18 | FromGitter | <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:23 | FromGitter | <alehander92> like, i completely get you |
15:36:33 | FromGitter | <alehander92> but its like, politics |
15:36:42 | krux02 | Well, 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:17 | krux02 | It 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:29 | dadada | krux02, 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:30 | shashlick | If you dive into the compiler code, it might feel that way but as a user I don't at all |
15:37:35 | dadada | think 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:48 | krux02 | There 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:51 | shashlick | Fact is that it's a large code base and will have young and old code |
15:37:57 | shashlick | That doesn't make it bad |
15:37:58 | dadada | krux02: also its a bit rich to call the creator of nim a contributor :-) |
15:38:06 | shashlick | It makes it like any other code base |
15:38:14 | krux02 | dadada, I am not. |
15:38:22 | shashlick | I don't know why people think things should be perfect, there is no such thing |
15:38:22 | krux02 | What I am talking about is hot code reloading. |
15:38:27 | FromGitter | <alehander92> krux02 i think that you and Araq maybe have different design philophies about software development/project maintenance etc |
15:38:41 | krux02 | It is half way implemented. It works for some cases. It has problems, but nobody is resposible to fix them. |
15:39:06 | FromGitter | <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:08 | krux02 | So 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:46 | krux02 | Its 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:05 | krux02 | And it lures people into disappointment who are excited to try out hot code reloading. |
15:40:32 | krux02 | If it doesn't work, don't recommend it. Declare it as experimental. |
15:40:53 | dadada | I do think you're making valid points here krux02 |
15:41:03 | krux02 | I am also frustrated by the premature release of Version 1.0 |
15:41:29 | dadada | some 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:49 | krux02 | dadada: That is a good idea. |
15:42:07 | companion_cube | what's missing from 1.0? arc, not nil? |
15:42:19 | krux02 | There should also be a feature combination matrix. |
15:42:28 | dadada | this 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:43 | planetis[m] | https://github.com/nim-lang/RFCs/milestone/1there is |
15:42:45 | planetis[m] | sorry https://github.com/nim-lang/RFCs/milestone/1 |
15:42:57 | krux02 | does hot code reloading work with generics? does hot code reloading work with js backend? etc |
15:42:59 | shashlick | There should be a lot of things and a lot of things should be removed as well - in general - in the world |
15:43:22 | dadada | planetis[m]: while that is something, it contains far less information than a matrix would |
15:43:31 | krux02 | does inheritance work with generics, you get it. A full matrix of all features and how well they perform with each other. |
15:43:35 | shashlick | Redirect your frustration into contributions else nothing will change |
15:43:45 | dadada | (where matrix is a fancy word for a table :-) ) |
15:43:46 | shashlick | But don't expect everything to change |
15:44:15 | krux02 | shashlick, I did my contributions. Code refactoring. Deletion of dead code. |
15:44:23 | FromGitter | <alehander92> krux02 however i dont see a big problem: X% of your ideas would be accepted and Y% would not |
15:44:38 | FromGitter | <alehander92> the same as timothee, and when he complained, this annoyed you a lot |
15:44:43 | FromGitter | <alehander92> and now you are complaining |
15:44:45 | shashlick | You cannot contribute what is not welcome |
15:44:45 | krux02 | The 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:51 | FromGitter | <alehander92> that's what seems strange to me |
15:45:26 | planetis[m] | my PRs got rejected mostly and its okay. they weren't that good |
15:45:28 | krux02 | to be fair about timothee, I hated his contributions a lot. But recently I really appreciate them. |
15:45:54 | companion_cube | is timothee the one who wrote the comparisons with D? |
15:46:01 | dadada | alehander92: 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:19 | shashlick | You have to work within the boundaries, going outside is not productive |
15:46:20 | krux02 | I don't like his naming scheme I also disagree often with his solutions, but his error and problem detection qualification is great. |
15:46:36 | shashlick | You have to learn how to invite people outside |
15:46:48 | shashlick | And some people might never come out |
15:47:08 | shashlick | While other times you might need to realize it's not a good spot in the first place |
15:47:36 | shashlick | Point is to do what's healthy, you cannot always be successful, that's not how the world works |
15:49:08 | dadada | krux02: 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:40 | shashlick | Most importantly, you are sharing all this because you care about Nim and that's what everyone should focus on |
15:49:48 | krux02 | dadada, well after the feature cutting phase, yes. |
15:49:57 | krux02 | But Nim didn't have a feature cutting phase. |
15:50:10 | krux02 | Yes I do care about Nim. |
15:50:18 | krux02 | I have projects depend on it. |
15:50:21 | companion_cube | dadada: 1.0 for a lang is not the same as for a browser |
15:50:36 | companion_cube | a language is something you invest a lot of work in, imho, so you want to work to keep being relevant |
15:51:00 | krux02 | The Go language is a language that did it correct. |
15:51:16 | krux02 | To be fair, Go has the advantage of a big company behind it. |
15:51:28 | krux02 | So they can keep it internal until it is ready to be frozen. |
15:51:41 | shashlick | I'll recommend building a case to kill one specific thing, build consensus and a full plan to deprecate and eventually remove |
15:51:52 | shashlick | And provide an alternative |
15:51:53 | FromDiscord | <Recruit_main707> and not an small company, but google |
15:52:01 | companion_cube | go is ridiculously limited though, krux02 |
15:52:03 | FromDiscord | <Recruit_main707> not any* |
15:52:06 | dadada | companion_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:12 | shashlick | Just creating PR's won't work, even with your best friend |
15:52:31 | companion_cube | dadada: I mean, to the users… |
15:53:59 | FromDiscord | <danielo515> Is there a shorthand for accessing the last item of a seq? Like seq[^1] or something like that? |
15:54:38 | shashlick | Some 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:50 | shashlick | Never release until it's perfect |
15:55:05 | companion_cube | a good recipe for never releasing |
15:55:13 | shashlick | Have to see how the community operates |
15:55:41 | shashlick | There 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:20 | shashlick | I'm totally for venting and frustration but at the end, it should be productive |
15:56:21 | * | hax-scramper joined #nim |
15:56:36 | companion_cube | krux02: Go also doesn't move fast enough, 'generics' is a joke word for it now |
15:56:48 | krux02 | companion_cube, go is ridiculously limited yes, but they cut out everything they didn't need. And then they stick to it. |
15:56:55 | dadada | companion_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:34 | krux02 | companion_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:38 | krux02 | And that is by design. |
15:57:45 | krux02 | Putting it into the language is resignation. |
15:58:35 | dadada | I'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:50 | companion_cube | krux02: not putting them was stubbornness, rather, I think |
15:58:55 | companion_cube | oh well |
15:59:05 | krux02 | dadada, no this didn't happen because of the weight of google. |
15:59:21 | dadada | ie. goldmark looks like a markdown parser I'd love to use, but it's for go :-( |
15:59:48 | krux02 | Go grew, because it was an easy to pick up language that lets you write fast and memory efficient applicaitons quickly |
16:00:04 | krux02 | the language was designed with tooling in mind |
16:00:08 | dadada | krux02: 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:25 | FromGitter | <alehander92> ok krux02 but after all go has its own philosophu |
16:00:32 | * | rockcavera joined #nim |
16:00:32 | FromGitter | <alehander92> its like going in the go community |
16:00:38 | companion_cube | go got a lot of attention because of who created it |
16:00:39 | FromGitter | <alehander92> and telling "guys haskell did all of this right" |
16:00:42 | krux02 | I did use go for a long time. |
16:00:45 | FromGitter | <alehander92> well .. then use haskell |
16:00:51 | dadada | krux02: 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:53 | krux02 | It really is a good language with almot no friction. |
16:01:18 | FromGitter | <alehander92> i respect their philosophy but i wouldn't want to use this language |
16:01:23 | FromGitter | <alehander92> and i've used it as well |
16:01:25 | companion_cube | krux02: depends on your taste |
16:01:30 | companion_cube | "friction" is relative |
16:01:39 | krux02 | no friction is not relative. |
16:01:53 | FromGitter | <alehander92> after all that's why people use different languages |
16:02:02 | dadada | I kind of like go, but I'd never prefer it over Nim given a choice |
16:02:50 | companion_cube | krux02: ok. to me Go is so badly designed I can't use it, but if you mean friction from the tooling, ok |
16:03:03 | FromDiscord | <danielo515> I work with go on a daily basis and I wish it were nim... |
16:03:24 | krux02 | I really do like Go. I really like its minimalist design. Something I did not expect from a company like google. |
16:03:40 | krux02 | It is just that its minimalism doesn't cut my use cases for it. |
16:03:42 | dadada | someone needs to come up with a way to easily wrap go libs for Nim, pretty please! :-) |
16:04:01 | krux02 | I would live in a world where I would not need my metaprogramming requirements. I would be so happy to develop in Go. |
16:04:14 | dadada | so I can use stuff like this without reinventing the wheel https://github.com/yuin/goldmark |
16:04:18 | krux02 | I am am just not in that world where the corneds the Go language cut apply for me. |
16:04:40 | companion_cube | have you seen Zig? |
16:05:15 | krux02 | yes I've seen it. |
16:05:22 | krux02 | I didn't use it. |
16:05:39 | krux02 | Didn't use it, but read about its design. |
16:05:56 | krux02 | But I have my opinion about it. And similar to Go, it doesn't cut for me. |
16:06:14 | krux02 | Nim does cut, but with a constantly broken knife. |
16:07:17 | companion_cube | there's no perfect language, so it's a question of finding the one that fits you the least badly |
16:07:31 | companion_cube | (I wish there were languages closer to my tastes, tbh, but nope) |
16:07:48 | FromDiscord | <Rika> Krux, I hope you're the whetstone then |
16:07:55 | blackbeard420 | one 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:31 | dadada | blackbeard420: 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:41 | dadada | I 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:27 | blackbeard420 | its not even necessarily the goroutines. its just painful using asynchttpserver with threads for background tasks (it works just doesnt feel to clean) |
16:13:28 | companion_cube | krux02: you could also fork nim and cleanup ;) |
16:14:09 | * | pbb joined #nim |
16:17:35 | * | fputs joined #nim |
16:17:40 | FromDiscord | <Rika> I'd use the fork if it meant more big fixing :P |
16:17:43 | FromDiscord | <Rika> Bug |
16:18:05 | dadada | I 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:11 | dadada | one 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:15 | FromDiscord | <Rika> Also lemme get this straight, go routines are basically green threads? |
16:19:22 | companion_cube | something like that |
16:20:33 | FromDiscord | <Rika> So a green threading library in nim would be great is all? |
16:20:51 | FromDiscord | <Rika> Hmm, I've also been thirsting for something like that |
16:21:02 | companion_cube | isn't async/await the alternative for that? |
16:22:15 | FromDiscord | <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:48 | FromDiscord | <Recruit_main707> lets start with, how can i know the return type of a proc passed to a template/macro? |
16:23:40 | FromGitter | <alehander92> is it `typed` macro |
16:23:43 | FromGitter | <alehander92> argument* |
16:24:03 | FromGitter | <alehander92> you can also generate code which checks that on compile time if untyped |
16:24:14 | * | flaviu quit (Quit: Leaving) |
16:24:42 | FromDiscord | <Recruit_main707> lets say its typed for now |
16:25:04 | FromDiscord | <Recruit_main707> (which i think it will be anyway) |
16:25:32 | * | ksandvik quit (Quit: WeeChat 2.8) |
16:26:11 | companion_cube | are you talking about nimpy? |
16:27:06 | FromDiscord | <Rika> cube, it is, but I've had some conceptual understanding issues with it |
16:27:12 | FromDiscord | <Rika> Also, it is time for me to sleep |
16:28:19 | FromDiscord | <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:39 | stefantalpalaru | Goroutines 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:57 | stefantalpalaru | This C library has a couple o schedulers that are MxN: https://github.com/Qthreads/qthreads |
16:58:56 | companion_cube | rust has a bunch of schedulers like that too (like tokio) |
16:59:49 | stefantalpalaru | Qthreads is used by the Chapel language: https://www.osti.gov/servlets/purl/1458180 |
17:00:17 | stefantalpalaru | So 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:07 | krux02 | dadada: 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:27 | FromGitter | <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:15 | FromGitter | <alehander92> recruit sorry, you can use `getType` or `getTypeImpl` iirc |
17:41:38 | FromGitter | <alehander92> and access them similarly to nim node |
17:44:04 | FromDiscord | <Recruit_main707> ok, thanks |
17:46:25 | krux02 | alehander92: `getType`, `getTypeInst`, `getTypeImpl` is one of those things that are just bad in nim and should be fixed. |
17:47:32 | krux02 | getType is something that was "deprecaded" years ago and was replaced by `getTypeInst` and `getTypeImpl`. |
17:48:08 | krux02 | but getTypeImpl doesn't properly work because sometimes you get some typedec node instead of the actual type implemenation. |
17:49:45 | FromGitter | <alehander92> i'd expect `getType` to do stuff like this and `getTypeImpl` to always get me the implementation |
17:49:50 | FromGitter | <alehander92> if i go only by naming |
17:53:05 | FromDiscord | <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:14 | FromGitter | <sealmove> `myString == ""` is the same as `myString.len == 0` right? |
17:55:21 | FromGitter | <alehander92> no no, `getType` family of functions can get you the "full type" |
17:55:32 | FromGitter | <alehander92> and then you need to find in it the return type etc |
17:55:59 | FromDiscord | <Recruit_main707> getTypeImpl.returnType ? |
17:56:08 | FromGitter | <alehander92> no no no |
17:56:13 | FromGitter | <alehander92> they are just nim nodes |
17:56:25 | FromGitter | <alehander92> with nnkNameTy (e.g. nnkObjectTy) |
17:56:27 | FromGitter | <alehander92> kinds |
17:56:38 | FromGitter | <alehander92> so you can use `.treerepr` on the "types" |
17:56:48 | FromGitter | <alehander92> and see how to access the children |
17:56:49 | FromDiscord | <Recruit_main707> is there a list of all this nodes? |
17:57:13 | FromGitter | <alehander92> in `lib/core/macros.nim` |
17:57:17 | FromGitter | <alehander92> not sure about the manual |
17:57:41 | FromGitter | <alehander92> but i'd recommend to just echo `treeRepr` results of getType<Something> functions |
17:57:47 | FromGitter | <alehander92> to get a feel |
17:57:52 | FromDiscord | <Recruit_main707> ok, thanks |
17:58:31 | FromGitter | <alehander92> no problem! |
17:58:56 | FromGitter | <alehander92> @sealmove logically yeah, not sure if it's optimized to the same code |
18:14:37 | FromGitter | <alehander92> okk |
18:17:22 | * | lritter joined #nim |
18:22:56 | * | nsf joined #nim |
18:24:36 | zacharycarter | I'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:07 | zacharycarter | I keep running into EXC_BAD_ACCESS errors - am I compiling the Nim shared library correctly? |
18:25:28 | zacharycarter | `nim c --noMain --app:lib -o:libtest.dylib test.nim` ? |
18:27:39 | zacharycarter | seems to have something to do with the GC when I try to call `echo repr` on the parameter passed in |
18:28:09 | krux02 | hehe |
18:28:17 | krux02 | I guess it has something to do with RTI |
18:28:20 | krux02 | runtime type information |
18:28:38 | krux02 | the shared lib can't see the RTI from the types passed in. |
18:29:01 | zacharycarter | I'm getting EXC_BAD_ACCESS errors even when I try to echo an int32 |
18:29:07 | zacharycarter | let me check the backtrace on that error |
18:29:36 | krux02 | you get an error on `echo 123'i32` or you get an error on `echo repr(123'i32)`? |
18:30:56 | zacharycarter | I got the one error when I tried to `echo repr` a pointer passed into the Nim proc from C |
18:31:09 | zacharycarter | I get another error when I simply try to `echo` an int32 passed into the Nim proc from C |
18:31:53 | zacharycarter | that backtrace includes calls to `prepareForInteriorPointerChecking` and then lowGauge` |
18:32:04 | zacharycarter | the crash occurs in `lowGauge` |
18:32:15 | krux02 | call you say host and client? it is more clear to me if you use those terms. |
18:32:25 | krux02 | I don't really know if you mean host when you say "from C" |
18:32:49 | zacharycarter | the procedure is getting called from the C application |
18:33:05 | zacharycarter | the application written in C is loading the Nim shared library with dlopen I guess |
18:33:15 | zacharycarter | I'm guessing it's because Nim' |
18:33:24 | FromGitter | <sealmove> I want to make a convertor that converts all none-option types to option types |
18:33:26 | zacharycarter | s collecting memory |
18:33:47 | FromGitter | <sealmove> but `converter toOption*[T](x: T): Option[T] = some(x)` doesn't work because `T` includes Option types. |
18:33:49 | zacharycarter | maybe it doesn't happen with gc:arc let me try that |
18:34:08 | FromGitter | <sealmove> what type restrictions can I apply? |
18:34:12 | krux02 | sealmove: that one could be fixed with |
18:34:32 | zacharycarter | yeah it works fine with gc arc heh |
18:34:33 | krux02 | toOption*[T: not Option](x: T): Option[T] = some(x) |
18:34:38 | krux02 | I would approve such a patch |
18:34:44 | FromGitter | <sealmove> wow this works? |
18:35:03 | krux02 | yes |
18:35:14 | FromGitter | <sealmove> wow I love Nim |
18:35:19 | krux02 | well it enforces that T does not include Option |
18:35:53 | krux02 | Nim has a lot of great features. And also in many ways the right features. |
18:38:04 | krux02 | zacharycarter, good thing that Nim finally has a real option to turn off the GC. |
18:38:06 | FromGitter | <sealmove> hmm, I still get "type mismatch: got <uint8> but expected 'Option[system.int]'", but maybe something else is interfering |
18:38:32 | FromGitter | <sealmove> aaah I know why, because uint8 is different from int |
18:38:43 | zacharycarter | krux02: yes I agree |
18:40:17 | krux02 | sealmove: yes uint8 is a different type than int. |
18:40:45 | FromGitter | <sealmove> and chaining converters (fortunately) doesn't work |
18:50:45 | FromGitter | <alehander92> <3 |
18:50:47 | FromGitter | <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:12 | FromDiscord | <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:43 | FromDiscord | <konsumlamm> release does optimiations, so ofc it'll be slower |
20:16:51 | FromDiscord | <konsumlamm> but the executable will be faster |
20:16:56 | * | xet7 quit (Quit: Leaving) |
20:17:15 | * | xet7 joined #nim |
20:18:58 | FromDiscord | <danielo515> Sorry, when I say slow I mean the generated executable |
20:19:19 | * | liblq-dev quit (Quit: WeeChat 2.7.1) |
20:19:22 | FromDiscord | <danielo515> The first execution of the generated executable is very slow, it can even reach a minute |
20:19:35 | FromDiscord | <danielo515> While, usually, it takes under half a second |
20:20:50 | leorize | are you on windows? |
20:21:10 | * | hpyc9 is now known as HIPOINTAF |
20:21:17 | * | HIPOINTAF is now known as hpyc9 |
20:27:11 | FromDiscord | <danielo515> Macos |
20:29:56 | FromDiscord | <queersorceress> what do you mean by "it runs slow"? |
20:32:16 | FromDiscord | <Avatarfighter> I believe @danielo515 means the building of the release executable but I could be wrong |
20:32:35 | FromDiscord | <Avatarfighter> I'm probably wrong actually |
20:40:08 | FromDiscord | <danielo515> Compile, get file.exe, execute file.exe, takes a minute. Execute file.exe again, runs in under a second |
20:40:12 | FromDiscord | <danielo515> Hope that clarifies |
20:40:34 | FromDiscord | <danielo515> I used exe extension to make it clear, doesn't mean anything special |
20:41:02 | FromDiscord | <danielo515> And that only happens when I compile with optimizations |
20:44:41 | FromDiscord | <queersorceress> things don't just magically go faster after a first run unless you are doing something on the filesystem or something |
20:47:26 | FromDiscord | <konsumlamm> caching? |
20:47:34 | FromDiscord | <Avatarfighter> @danielo515 does the first run include compiling the program ? |
20:50:32 | FromDiscord | <mratsim> if building is slow it's usually the antivirus |
20:52:33 | FromDiscord | <danielo515> > @danielo515 does the first run include compiling the program ? |
20:52:33 | FromDiscord | <danielo515> @Avatarfighter nope, they are two separate steps |
20:53:06 | FromGitter | <awr1> hello all |
20:53:09 | FromDiscord | <danielo515> > things don't just magically go faster after a first run unless you are doing something on the filesystem or something |
20:53:09 | FromDiscord | <danielo515> @queersorceress well, that's why I would expect, but my only interaction with the fs is listing dir contents |
20:53:25 | FromDiscord | <danielo515> > things don't just magically go faster after a first run unless you are doing something on the filesystem or something |
20:53:26 | FromDiscord | <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:37 | FromDiscord | <danielo515> > caching? |
20:54:37 | FromDiscord | <danielo515> @konsumlamm unless the compiler injects some kind of caching, I'm not caching anything |
20:55:52 | FromDiscord | <konsumlamm> youre not, but your CPU might |
20:55:53 | FromDiscord | <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:25 | FromDiscord | <danielo515> Sure, but I'm not on my computer RN |
21:14:38 | FromDiscord | <danielo515> Give me a sec |
21:15:57 | FromDiscord | <danielo515> This is the folder |
21:16:00 | FromDiscord | <danielo515> https://github.com/danielo515/explore-new-languages/tree/7e26a817278b3fff383fed92c802cb147ec0f182/ls-tree/nim_tree |
21:16:13 | FromDiscord | <danielo515> The build.sh is the normal build |
21:16:38 | FromDiscord | <danielo515> In order to make it slow at first run I just add `-d=release` or `--opt=speed` |
21:17:07 | FromDiscord | <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:11 | solitudesf | hmm, release build runs slower than debug for me. about 30%. danger runs fast, as expected. |
21:27:12 | solitudesf | nvm, i guess my nimchache was to blame |
21:28:23 | nisstyre | It 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:24 | krux02 | solitudesf, danger is the old release |
21:30:36 | solitudesf | i know |
21:32:00 | solitudesf | actually, 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:37 | krux02 | what is lto? |
21:40:49 | zacharycarter | link time optimization? |
21:40:54 | zacharycarter | I think it's mostly useful for reducing binary size |
21:41:18 | krux02 | no |
21:41:30 | zacharycarter | oh |
21:41:35 | krux02 | link time optimization is actually inlining a lot of functions |
21:41:44 | * | nsf quit (Quit: WeeChat 2.8) |
21:41:52 | zacharycarter | ah |
21:42:05 | krux02 | you know C, compilation units don't know functions of other compilation units |
21:42:14 | krux02 | in other words inlining can't be done. |
21:42:22 | krux02 | only after linking |
21:42:30 | * | solitudesf quit (Ping timeout: 265 seconds) |
21:43:08 | krux02 | That 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:25 | dadada | there'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:31 | dadada | optimizer |
21:53:10 | shashlick | Can you add default values for importc procs? |
21:53:10 | dadada | https://github.com/google/llvm-propeller/blob/plo-dev/Propeller_RFC.pdf |
22:08:01 | dadada | s/link time optimizer/post link optimizer |
22:10:42 | dadada | when you need to eke out those additional 2% of perfomance |
22:11:18 | Prestige | Reading 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:48 | Prestige | Also I don't see it mentioning what `int` defaults to, like int32 uint64 etc |
22:19:15 | dadada | Prestige: I assume that ints default to int32 on 32bit systems and int64 on 64bit systems, just like you would expect from C |
22:19:44 | Prestige | makes sense, just default to the word size |
22:20:29 | dadada | so you're starting with Nim? |
22:20:45 | Prestige | Yeah, set up my ide last night and just reading through the tutorials atm |
22:20:58 | dadada | great, may I recommend https://play.nim-lang.org/ |
22:21:31 | dadada | this is the place where even nimheads go to play around with Nim features and ideas |
22:21:35 | Prestige | ah that's pretty neat |
22:21:56 | Prestige | I'm ultimately wanting to rewrite the window manager I'm using in nim |
22:22:07 | dadada | what window manager? |
22:22:08 | Prestige | going to be a fun ride |
22:22:12 | Prestige | dwm |
22:22:31 | dadada | PMunch (not here?) is also writing a window manager (tiling one I think) in NIm |
22:23:19 | dadada | this tutorial gives a nice overview: https://totallywearingpants.com/posts/nim-language-highlights/ |
22:23:37 | Prestige | Sweet, thanks - I saw https://github.com/minimalwm/minimal recently as well |
22:23:49 | Prestige | Not sure if it's the same wm but I'll be referencing it |
22:24:11 | * | Guest85 joined #nim |
22:24:44 | dadada | Prestige: get familiar with macros as soon as possible, they're Nim's killer feature I'd say |
22:25:16 | dadada | which ide that you setup? |
22:25:37 | Prestige | neovim as an lsp client |
22:25:57 | Prestige | I'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:00 | Prestige | wow macros are neat |
22:30:25 | Prestige | dadada: what are you using nim to build? |
22:30:47 | dadada | Prestige: what I'm doing with Nim? |
22:30:51 | Prestige | Yeah |
22:31:56 | dadada | started to develop a small library of helper macros/templates/procs that I later want to use for creating actual Nim applications |
22:33:02 | Prestige | I saw the rust rewrite of the gnu coreutils, thought that could be fun to try out. But maybe after the wm |
22:33:04 | dadada | still 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:16 | federico3 | any good example of using the dom module? |
22:46:24 | shashlick | gosh nimgrep --filenames is still broken since https://github.com/nim-lang/Nim/pull/12779 |
22:50:10 | dadada | is github's c-blake also in IRC? |
23:00:50 | * | Tyresc joined #nim |
23:01:02 | shashlick | usually active on github |
23:03:52 | FromDiscord | <KingDarBoja> Hi all |
23:04:16 | Prestige | Hello KingDarBoja |
23:04:59 | leorize | are you also an user of nim.nvim? :) |
23:05:38 | Prestige | Well I'm using zah/nim.vim and coc-nvim |
23:06:01 | * | xcm quit (Read error: Connection reset by peer) |
23:06:09 | leorize | you should move to nim.nvim if you are using neovim :) |
23:06:16 | leorize | I'm totally not advertising my own plugin :P |
23:06:57 | FromDiscord | <KingDarBoja> dadada: I am somewhat newbie too on Nim, so welcome to the community 😄 |
23:07:08 | FromDiscord | <KingDarBoja> By the way, Rika or leorize, you there? |
23:07:42 | Prestige | leorize: looks neat, but I'm trying to route all my lsp servers through coc-nvim |
23:08:32 | leorize | nim.nvim don't use lsp though :P |
23:08:36 | FromDiscord | <KingDarBoja> Hey leorize, was looking at the source code of textwrap.dedent on Python |
23:08:37 | FromDiscord | <KingDarBoja> https://repl.it/repls/SoggyFabulousPhysics |
23:08:50 | FromDiscord | <KingDarBoja> Basically it is what it does (copy paste) |
23:08:56 | Prestige | leorize: yeah that's why I didn't pick it up |
23:09:33 | FromDiscord | <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:10 | leorize[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:46 | Prestige | Thanks, I'll be sure to check it out if my intenting solution doesn't work well |
23:10:52 | Prestige | indenting* |
23:11:08 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hFn |
23:11:29 | FromDiscord | <KingDarBoja> Got *almost* same behaviour but looks like the final step (the regex sub) didn't work as I expected |
23:12:40 | leorize | well it's called unindent and not dedent for a reason :p |
23:12:56 | leorize | we don't have same proc |
23:13:05 | FromDiscord | <KingDarBoja> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#string-ops |
23:13:20 | FromDiscord | <KingDarBoja> Well this "tutorial" does compare it as its equivalent |
23:13:27 | FromDiscord | <KingDarBoja> And yeah, it almost do the same |
23:13:59 | shashlick | @leorize: do you think one could use the procs exposed in macros on compiler PNodes? |
23:14:05 | FromDiscord | <KingDarBoja> Anyway, the point is, not sure why the final regex is eating the "}" |
23:14:33 | leorize[m] | shashlick: I don't think so |
23:14:41 | leorize[m] | the procs in macros are strictly compile-time |
23:15:27 | shashlick | why couldn't they work at runtime? probably cause they are macros i guess |
23:16:13 | FromDiscord | <KingDarBoja> I tested on regex.io and seems to be correct the regex `(?m)^` whereas the margin are two whitespace chars |
23:16:27 | FromDiscord | <KingDarBoja> But on Nim, it looks like margin isn't any whitespace lol |
23:16:31 | shashlick | of 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:03 | FromDiscord | <KingDarBoja> In fact, margin val on nim has the "}" |
23:18:07 | leorize | this algo is super slow |
23:18:16 | leorize | what exactly does this proc do? |
23:18:47 | leorize | can't it just find the shallowest indent then use it as the common? |
23:18:51 | leorize | the logic seems weird |
23:19:13 | FromDiscord | <KingDarBoja> Just copy pasta from Python implementation 🙈 |
23:19:41 | FromDiscord | <KingDarBoja> Was testing it to see how it works |
23:19:48 | FromDiscord | <KingDarBoja> But expected same result |
23:34:51 | leorize | I think I know what's wrong |
23:35:03 | leorize | I'll try to clean up your solution as well |
23:38:07 | FromDiscord | <KingDarBoja> ❤️ |
23:46:05 | FromDiscord | <Avatarfighter> Hello everyone 😄 |
23:46:47 | FromDiscord | <KingDarBoja> Hi avatar! |
23:46:48 | leorize[m] | @KingDarBoja: https://play.nim-lang.org/#ix=2hFB |
23:47:30 | leorize[m] | I also reduced the amount of modules used |
23:47:47 | leorize[m] | the algo is slightly faster than python's (since I don't use zip) |
23:49:26 | FromDiscord | <KingDarBoja> I see there is no longer the whitespace_only_re |
23:49:49 | * | Trustable quit (Remote host closed the connection) |
23:50:00 | FromDiscord | <KingDarBoja> and also curious about the loop, I see you used high (which gets the max index of the array) |
23:50:27 | FromDiscord | <KingDarBoja> Does `0 .. min` is the correct way? the whitespace is optional? |
23:50:30 | leorize | yea, your strip handled that proc function :P |
23:51:39 | leorize | yep, 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:49 | FromDiscord | <KingDarBoja> I see |
23:52:56 | FromDiscord | <KingDarBoja> Btw, didn't about the global pragma |
23:53:01 | FromDiscord | <KingDarBoja> Could you explain? 🙈 |
23:53:42 | leorize[m] | it means that the value is stored in the global scope |
23:53:56 | leorize[m] | meaning that it will persist between proc calls |
23:54:19 | leorize[m] | I use it since we only need to compile that regex once |
23:54:36 | leorize[m] | it's similar to putting the let outside of the proc |
23:54:46 | FromDiscord | <KingDarBoja> CLEVER |
23:54:48 | leorize[m] | just different in the sense that you won't consume an identifier :) |
23:54:59 | leorize[m] | (in the outer scope) |
23:55:36 | FromDiscord | <KingDarBoja> Added to my notes |
23:56:39 | FromDiscord | <KingDarBoja> Man, I love you, thanks! |
23:57:27 | FromDiscord | <KingDarBoja> I added a note on the proc doc to thank you 😄 |
23:57:51 | FromDiscord | <KingDarBoja> By the way -> Does 0 .. min is the correct way? the whitespace is optional? |
23:58:08 | leorize | yep |
23:58:22 | FromDiscord | <KingDarBoja> Ok ok |
23:58:23 | leorize | zip() will cut off the larger container |
23:58:44 | leorize | so this is the same algo, just without spending time making a seq |