<< 15-11-2021 >>

00:00:12*tk quit (Quit: Well, this is unexpected.)
00:00:19FromDiscord<andi-> Ok, with readData my tests pass.
00:00:37*tk joined #nim
00:08:39FromDiscord<evoalg> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=3F1s for instance": noob question time again ... I was looking at your https://play.nim-lang.org/#ix=3F1s and I'm wondering why unsafeaddr is used ... and what's Idx?
00:09:32FromDiscord<Elegantbeef> Unsafeaddr is used since `a` is passed as immutable, `Idx` is the index generic, and `T` the type generic
00:10:06FromDiscord<Elegantbeef> Remember in Nim unlike other languages arrays have a size type attached to them so `var a: array[10,int] = default(array[3, int])` is an error
00:11:18FromDiscord<Elegantbeef> `unsafeaddr` is just a way to be slightly more clear about overcoming immutable references, but there is an RFC to remove it since it implies `addr` is safe
00:11:46FromDiscord<evoalg> lol true it does!
00:12:33FromDiscord<evoalg> `addr` is a pointer? ... and not a safe pointer like a ref?
00:13:01FromDiscord<Elegantbeef> Yep `addr` can be a pointer to any addressable value
00:13:19FromDiscord<Elegantbeef> For it to be safe you need to know a few things about what you're doing
00:14:11FromDiscord<Elegantbeef> If the object is on the stack and you keep the address the address should not outlive the object. If it's a ptr to a managed type you should not mutate that type.
00:16:05FromDiscord<evoalg> and with a ref I can mutate and it'll handle it fine?
00:29:10FromDiscord<Elegantbeef> Yea cause the object will not be destroyed whilst you hold onto a reference
00:29:15FromDiscord<Elegantbeef> Example time!
00:33:56FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F1F
00:34:01FromDiscord<Elegantbeef> Not a great example but meh
00:41:58FromDiscord<Elegantbeef> It atleast shows the issue with a pointer to a sequences value, the latter part is pretty pointless i guess
00:42:09FromDiscord<Elegantbeef> Since if they were `ptr int` it'd be the same
00:47:42FromDiscord<evoalg> I'm trying to understand the 2nd part ... lemme stare at it for a bit longer
00:48:20FromDiscord<Elegantbeef> It's just using reference ints instead of normal ints which means there are nim managed pointers instead of integers stored in the sequence
00:48:55FromDiscord<Elegantbeef> do `echo c.repr` after it was added and you'll see what it's doing
00:55:20FromDiscord<evoalg> I went back to look at the first part ... you take the address of a[0] because a.address is a pointer to a pointer by the looks, yea I seem to remember that containers names are pointers
00:56:04FromDiscord<Elegantbeef> Not always the case but close enough
00:56:56FromDiscord<evoalg> hehehe
00:58:20FromDiscord<evoalg> btw I really like how you can explain things at my level, it makes for a great teacher
00:59:50FromDiscord<Elegantbeef> Excuse me whilst i find a textbook and tell you "If you havent read this, i cannot help you" to get the full teacher experience
01:01:57FromDiscord<evoalg> lol exactly 😉
01:03:39FromDiscord<evoalg> That `c.add:` you do with the multi lines, I didn't know you could do that ... it looks similar syntax to a `collect:` ... here's me thinking it was a collect thing and not actual nim syntax
01:03:51FromDiscord<Elegantbeef> Yep it's for all calls
01:03:58FromDiscord<Elegantbeef> It's quite nifty
01:04:18FromDiscord<impbox [ftsf]> what?
01:04:20FromDiscord<impbox [ftsf]> i never knew this
01:04:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3F1J
01:05:00FromDiscord<Elegantbeef> forgot to call `invokeProcs()` 😛
01:08:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3F1K
01:17:09FromDiscord<evoalg> I finally understand your addr code snippet after starting at it for 45 mins (and playing with lots of repr's) ... I'm so slow .. thank you ElegantBeef. I'm not going to try and understand that obfuscation you just posted though 😉
01:17:42FromDiscord<Elegantbeef> That above code is just a odd syntax for anonymous procedures 😀
01:18:02FromDiscord<Elegantbeef> it's the same as `addProc proc (a, b: int) = echo a b`
01:37:36*krux02 quit (Remote host closed the connection)
02:30:22*vicecea quit (Remote host closed the connection)
02:30:52*vicecea joined #nim
02:56:53FromDiscord<evoalg> I can't seem to use `var` or `let` in collect ... https://play.nim-lang.org/#ix=3F1Z
02:58:32FromDiscord<Elegantbeef> Why even use collect here?
02:59:06FromDiscord<evoalg> I was doing something more complicated with a for loop, but I just wanted a simple example to show
02:59:15FromDiscord<Elegantbeef> Ah
02:59:32FromDiscord<evoalg> I can put a more realistic one
03:00:49*Guest9 joined #nim
03:02:32FromDiscord<Elegantbeef> Ah the issue is the way the collect macro works
03:03:11FromDiscord<Elegantbeef> It redeclares the variables in the expression, which causes an issue
03:04:51FromDiscord<evoalg> ok ... it could be argued that if it get's complicated enough to declare vars, use a proc ... that makes sense to me
03:05:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3F26
03:06:04FromDiscord<Elegantbeef> Using a template instead of a variable declaration cause we're barbarians 😀
03:07:56FromDiscord<evoalg> whoa ... but seriously should I use that way or a proc?
03:08:07FromDiscord<Elegantbeef> Probably a proc
03:08:24FromDiscord<Elegantbeef> You could also write collect manually
03:08:30FromDiscord<evoalg> I guess you were hinting that using a templet there is barbaric
03:08:35FromDiscord<evoalg> oh?
03:08:41FromDiscord<evoalg> oh right yes
03:08:42*Guest9 quit (Quit: Client closed)
03:09:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3F27
03:09:24FromDiscord<Elegantbeef> Not as nice as collect but it's what collect does internally
03:09:32FromDiscord<evoalg> oh!
03:10:36FromDiscord<evoalg> my more "realistic" eg: https://play.nim-lang.org/#ix=3F24
03:10:49FromDiscord<evoalg> I can put that in a proc instead
03:10:54FromDiscord<Elegantbeef> Yep
03:11:00FromDiscord<Elegantbeef> I love me some scanf 😀
03:11:21FromDiscord<evoalg> that's because you haven't fallen in love with regex's yet
03:11:30FromDiscord<Elegantbeef> Never!
03:11:47FromDiscord<Elegantbeef> I really love scanf since it captures variables, and the tuple variant i wrote is even nicer
03:12:08FromDiscord<evoalg> hehe ... oh tuple variant?
03:12:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3F29
03:13:20FromDiscord<Elegantbeef> Yea there is a scantuple which does the same thing as scanf but returns a tuple
03:14:05FromDiscord<evoalg> that is nicer!
03:16:08FromDiscord<evoalg> regex's were so easy in Perl, but the symbols aren't user-friendly, Python's regex are just "ok", but nim's are more painful
03:17:06FromDiscord<evoalg> several completing regex modules, each incomplete, each difficult to use
03:17:50FromDiscord<evoalg> but I do like scanf 🙂
03:18:52FromDiscord<Elegantbeef> I dont generally deal with arbitrary text, it's generally text that follows a simple pattern and i want the values from it in a specific format, so regex makes me do more work than scanf/PEGs
03:24:02FromDiscord<evoalg> PEGs ?
03:30:10FromDiscord<Elegantbeef> Patterns and grammars for instance https://github.com/zevv/npeg
03:51:35*Yardanico quit (Changing host)
03:51:36*Yardanico joined #nim
03:52:13*Yardanico quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
03:52:28*Yardanico joined #nim
03:53:27FromDiscord<Yardanico> restarting the discord-irc bridge because of some stuff
03:53:33*FromDiscord quit (Remote host closed the connection)
03:53:46*FromDiscord joined #nim
03:53:58Yardanico123
03:54:01FromDiscord<Yardanico> done
04:06:02*supakeen quit (Quit: WeeChat 3.3)
04:06:32*supakeen joined #nim
04:13:03*vicfred quit (Quit: Leaving)
04:37:33FromDiscord<huantian> In reply to @Elegantbeef "Patterns and grammars for": looking at the first code snippet reminds me of haskell shivers 😛
04:38:40FromDiscord<Rika> Haskell was fun
04:38:51FromDiscord<Rika> The speed deficits I get from using it is not lol
04:40:57FromDiscord<impbox [ftsf]> your speed or the code's speed?
04:41:50FromDiscord<impbox [ftsf]> I've never tried haskell, a lot of my old coworkers loved it
04:48:34FromDiscord<Rika> The code speed
04:48:42FromDiscord<Rika> I was fine coding in it
04:49:01FromDiscord<Rika> Speed dies if you don’t do some things specifically
04:49:15FromDiscord<Rika> Because the optimiser can’t catch some stuff
04:49:19FromDiscord<impbox [ftsf]> ahh ok
05:07:37*sagax joined #nim
06:58:39*ozzz quit (*.net *.split)
06:58:50*ozzz joined #nim
07:04:22*averell quit (*.net *.split)
07:04:38*averell joined #nim
07:11:27*PMunch joined #nim
07:18:26*sagax quit (Read error: Connection reset by peer)
07:34:43*sagax joined #nim
08:09:47*pro joined #nim
08:43:41*neurocyte0132889 joined #nim
08:43:42*neurocyte0132889 quit (Changing host)
08:43:42*neurocyte0132889 joined #nim
08:56:07*neurocyte0132889 quit (Read error: Connection reset by peer)
08:56:47*neurocyte0132889 joined #nim
08:56:47*neurocyte0132889 quit (Changing host)
08:56:47*neurocyte0132889 joined #nim
09:18:19*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
10:41:25*u0_a185 joined #nim
10:50:19*neurocyte0132889 joined #nim
10:50:19*neurocyte0132889 quit (Changing host)
10:50:19*neurocyte0132889 joined #nim
10:52:48*stephane joined #nim
10:54:09*stephane is now known as Gintru
10:54:23*Gintru feel lonely
10:54:30Gintru*feels
10:56:05*Gintru quit (Client Quit)
11:09:11*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
11:12:02*neurocyte0132889 joined #nim
11:12:02*neurocyte0132889 quit (Changing host)
11:12:02*neurocyte0132889 joined #nim
11:14:45*Gintru joined #nim
11:15:13*Gintru test
11:16:28FromDiscord<Rika> We didn’t receive your test message can you send it again
11:19:31Gintrua
11:19:50GintruRika / No. nn, sorry it is a test for me
11:20:17GintruRika / I evaluate an IRC client
11:21:42GintruI should go elswhere, I didn't figure out it could be such a mess (server, user list…) I leave
11:21:59GintruByE / OuT O o .
11:22:03*Gintru quit (Quit: That's it for today)
11:23:39FromDiscord<Rika> I was making a joke
11:32:34*stephane joined #nim
11:46:13*u0_a185 quit (Read error: Connection reset by peer)
11:46:29*u0_a185 joined #nim
11:53:03*stephane quit (Quit: stephane)
12:05:41*Gintru joined #nim
12:06:02*supakeen quit (Quit: WeeChat 3.3)
12:06:32*supakeen joined #nim
12:07:00*Gintru /knock
12:08:55*Gintru thinking pidgin power but absconsness
12:09:25Gintrusystemdsucks: o really ?
12:09:44PMunchAm I missing a lot of chat here?
12:09:58GintruPMunch: I don't think so
12:10:04PMunchAh right :P
12:10:13PMunchI thought you replied to systemdsucks
12:10:19GintruPMunch: maybe at 4pm it is more talkative
12:10:31PMunchIt's usually quite a bit more active than this
12:10:43PMunchI guess Monday is taking it's toll on people :P
12:11:05PMunchThis community is fairly heavily Europe-based, so a lot of people are also at work/school
12:11:40GintruPMunch: I didn't think about that
12:12:30FromDiscord<dom96> I'm off work today o/
12:12:42PMunchHooray!
12:12:47PMunchWell, unless you're sick..
12:12:58Gintrudom96: /smile/
12:13:11Gintrudom96: congrat
12:13:30*Gintru left #nim (#nim)
12:13:54*Gintru joined #nim
12:14:09*Gintru reconnected
12:15:34FromDiscord<dom96> Nah, not sick, just decided to take this Monday off to rest
12:17:51GintruByE / OuT O o .
12:17:58*Gintru quit (Quit: Leaving.)
12:41:46FromDiscord<evoalg> @dom96 as new nim versions keep rolling out, do you think your book will need updating at some stage? I have nothing specific in mind, I'm just curious as to your thoughts about it?
12:42:28FromDiscord<dom96> sure, could always use an update. Question is when will be the right time. Probably after 2.0 tbh
12:42:44FromDiscord<evoalg> that makes sense, yep
12:42:47FromDiscord<dom96> (also who knows if Manning is even interested in a 2nd edition)
12:42:53FromDiscord<dom96> so no guarantees
12:42:57FromDiscord<evoalg> true
12:43:10FromDiscord<evoalg> I don't know much about that side of things
12:43:16FromDiscord<dom96> that said, it repayed the book advance so afaik that's considered a success in the book world 🙂
12:43:40FromDiscord<evoalg> Nice!
12:44:20FromDiscord<dom96> (edit) "repayed" => "repaid"
12:45:13PMunchThat is indeed a good sign
12:45:22FromDiscord<Rika> congrats
12:49:17*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
12:50:04*neurocyte0132889 joined #nim
12:50:04*neurocyte0132889 quit (Changing host)
12:50:04*neurocyte0132889 joined #nim
12:51:25FromDiscord<dom96> thanks 🙂
12:52:34FromDiscord<dom96> Speaking of which, Manning books are on sale now in case you want to take advantage of the deal (not just for my book): https://www.manning.com/?utm_source=niminaction&utm_medium=affiliate&utm_campaign=ebook&pbook_sale_11_15_21&a_aid=niminaction&a_bid=417b1389
12:58:33NimEventerNew thread by Dom96: Evolving the moderation of the Nim communities, see https://forum.nim-lang.org/t/8629
13:02:07*kayabaNerve_ joined #nim
13:03:19FromDiscord<evoalg> @dom96 cheers - I bought your book just now
13:03:39FromDiscord<dom96> Ooh, amazing, thank you!
13:05:11*kayabaNerve quit (Ping timeout: 264 seconds)
13:42:13NimEventerNew post on r/nim by SamLovesNotion: How to compile to modern JS?, see https://reddit.com/r/nim/comments/qugoik/how_to_compile_to_modern_js/
13:46:52*pro quit (Read error: Connection reset by peer)
14:30:04*arkurious joined #nim
14:38:46NimEventerNew thread by Miran: Zen of Nim, see https://forum.nim-lang.org/t/8630
14:44:49*xet7 quit (Remote host closed the connection)
14:45:33*xet7 joined #nim
15:08:52FromDiscord<pietroppeter> I might have posted about Zen of Nim on the orange site, but you are not hearing it from me 😉
15:10:29PMunchWink wink nudge nudge ay, say no more, say no more
15:11:31PMunchOh hey everyone, look at this cool article I found about Nim: https://news.ycombinator.com/item?id=29228230
15:11:53FromDiscord<pietroppeter> oh noooo! 😛
15:12:07PMunchWait, does that trigger the ban as well?
15:13:11FromDiscord<pietroppeter> I think so. As far as I know, the suggestion would be not to upvote after reaching from that link, do an organic search in HN
15:25:56PMunchAh, damn it..
15:27:15FromDiscord<pietroppeter> no worries, I have very low expectations on HN success anyway. let's see how it goes... 🙂
15:30:39FromDiscord<Rika> hn would probably just bash it again
15:30:48FromDiscord<Rika> repetitive argument #128946?
15:45:07FromDiscord<Zoom> It's only natural for the critics to be vocal. If you like something, telling about that each time there's a chance can be a bit off-putting. Answering to a constructive critique in a civilized and honest manner is paramount, though.↵(@Rika)
15:47:16FromDiscord<ajusa> In reply to @Zoom "It's only natural for": iirc every time Nim comes up on HN folks bash two things:↵1. whitespace sensitive↵2. case/underscore/style insensitivity
15:47:50FromDiscord<ajusa> and those are core to the language, so it's pretty difficult to answer to that criticism. All folks can provide are anecdotes of how those make the language better
15:51:41FromDiscord<Zoom> You can't really do anything with it besides repeating your points over and over again as it's really the core distinction of the language. It's the same with Rust always getting bashed for being "hard" by people who never saw a proper type in their lives.
15:52:03FromDiscord<Rika> the core issue for 2. is that they think too much choice would be bad because "the junior is gonna fuck up the uniformity of the codebase" which isnt an issue of the design but an issue of tooling
15:52:32FromDiscord<Rika> isnt rust properly difficult not for the typing but for the lifetimes?
15:53:06FromDiscord<ajusa> Yeah man Rust is the least productive language I've ever used just because of how much it yells at me for borrow/lifetimes
15:53:19FromDiscord<ajusa> (edit) "Yeah man" => "Yeah,"
15:54:01FromDiscord<Zoom> Lifetimes are kind of a natural extension to the type system.↵Dunno, I like it very much and I liked being shouted at by a compiler. Though, my experience is limited of course.↵(@Rika)
15:54:06FromDiscord<Rika> imo: choice is always better than no choice because you can always restrict choice but you cant unrestrict no choice
15:54:30FromDiscord<Rika> i like being shouted at for fucking up a type (literally unsafe)
15:54:47FromDiscord<Rika> i dont like it when its lifetimes (just fucking copy or whatever, and warn instead)
15:55:00FromDiscord<Zoom> I tend to think the same way, but you can't really argue that maintaining order and following standards in the presence of multitude of choices requires resources.↵(@Rika)
15:55:13FromDiscord<Rika> that is true
15:55:30FromDiscord<Rika> its not something to argue about because there is nothing dubious
15:56:46FromDiscord<Zoom> I mean this (economy or resources) is obviously a priority in the industry, over both the user experience and dev experience.
16:33:15FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3F4R
16:33:20*neurocyte0132889 quit (Ping timeout: 265 seconds)
16:33:25*Onionhammer quit (Quit: The Lounge - https://thelounge.chat)
16:33:44*Onionhammer joined #nim
17:37:41NimEventerNew thread by Exelotl: Forbidden-by-default effects?, see https://forum.nim-lang.org/t/8631
17:38:55*neurocyte0132889 joined #nim
17:38:55*neurocyte0132889 quit (Changing host)
17:38:55*neurocyte0132889 joined #nim
17:43:22*neurocyte0132889 quit (Read error: Connection reset by peer)
17:43:59*neurocyte0132889 joined #nim
17:43:59*neurocyte0132889 quit (Changing host)
17:43:59*neurocyte0132889 joined #nim
18:10:27*u0_a185 quit (Quit: WeeChat 3.0.1)
18:14:19*PMunch quit (Quit: leaving)
18:39:51NimEventerNew thread by Mantielero: Question about memory management with bindings, see https://forum.nim-lang.org/t/8632
18:43:34FromDiscord<hmmm> yo nimbros, is moveFile("dest") the official way to move a file to a subdir? (if it seems like a stupid question it's because it probably is)
18:55:09*krux02_ joined #nim
19:08:09FromDiscord<IsaacPaul> It's part of the standard library so I would say yes.. However, be sure to handle OSError because its not uncommon for it to raised
19:10:11FromDiscord<IsaacPaul> dest can be anything including a subdir
19:10:26FromDiscord<hmmm> hmm I'd like to get an OSError, the current situation is that the program happily compiles and then the file gets moved to the void I guess because I'm pretty sure it's not going to "dest" lol 🤔
19:11:17FromDiscord<IsaacPaul> does dest include the file name?
19:12:23FromDiscord<hmmm> nope it's like moveFile("thingy.json", "/subdir")
19:13:16FromDiscord<hmmm> I tried checking the current working directory but it seems correct, so I have no idea where my good old friend thingy.json goes to
19:13:20FromDiscord<IsaacPaul> yea you need full paths
19:13:27FromDiscord<hmmm> oh noes
19:13:29FromDiscord<hmmm> I hate them
19:13:48FromDiscord<hmmm> why do I need them
19:14:08FromDiscord<IsaacPaul> there is no context as where the file is
19:14:33FromDiscord<hmmm> I mean there is! We are working in the current working directory so the programs knows where subdir is
19:14:38FromDiscord<Rika> cwd isnt used "automatically" in nim afaik
19:15:32FromDiscord<hmmm> I'm lazy it should work without full paths
19:15:49FromDiscord<hmmm> I bet python works with relative paths 🧐
19:15:56FromDiscord<IsaacPaul> you can always write the way you like it
19:15:59FromDiscord<IsaacPaul> lol
19:31:08FromDiscord<hmmm> hmmm
19:43:28FromDiscord<hmmm> it worked with this monstrosity: moveFile("thingy.json", getCurrentDir() & "\\subdir\\thingy.json")
19:44:33FromDiscord<Yardanico> you can use / from os btw
19:44:41FromDiscord<hmmm> oh?
19:44:50FromDiscord<hmmm> what is /from os
19:45:04FromDiscord<Yardanico> it will concat components of the path with the OS's dir separator
19:45:21FromDiscord<Yardanico> getCurrentDir() / "subdir" / "thingy.json"
19:45:47FromDiscord<hmmm> oh
19:45:50FromDiscord<hmmm> I'll try
19:46:03FromDiscord<Yardanico> In reply to @hmmm "what is /from os": It's literally `/` from the `os` module, not `/from` :)
19:47:08FromDiscord<hmmm> it worked
19:48:35FromDiscord<hmmm> it's still pretty ugly, is there a reason our std/os doesn't do the heavy lifting and leave us with a pretty synthax?
19:52:33tkare sequences lazy?
19:53:05tkwhen you do things like toSeq(1..10).map(x => x * w).filter(x => x mod 6 != 0)
19:56:52tklike if I do toSeq(file.lines).map(x => parseInt(x)).foldl(a + b) will it read the entire file in first?
19:57:43tk(well, except parseInt doesn't work like that but you get the picture)
19:58:57FromDiscord<IsaacPaul> In reply to @hmmm "it worked with this": oh I guess it does use cwd lol
19:59:13FromDiscord<hmmm> really?
19:59:30FromDiscord<IsaacPaul> your first parameter is "thingy.json" without specifying the cwd
19:59:44FromDiscord<hmmm> YEA
20:00:11FromDiscord<hmmm> the reason you are called isaac is because you are genius like newton :nim1:
20:00:28FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3F5v
20:00:29FromDiscord<hmmm> I'll try
20:00:36FromDiscord<IsaacPaul> (edit) "https://play.nim-lang.org/#ix=3F5v" => "https://play.nim-lang.org/#ix=3F5w"
20:00:47FromDiscord<IsaacPaul> (edit) "https://play.nim-lang.org/#ix=3F5w" => "https://play.nim-lang.org/#ix=3F5x"
20:02:24FromDiscord<hmmm> oi it worked
20:02:28FromDiscord<IsaacPaul> oh cool
20:02:28FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3F5y
20:03:04FromDiscord<hmmm> damn now I should rewind and go back to what I was doing wrong to why it didn't work before
20:03:20FromDiscord<IsaacPaul> You used / in the beginning of the dest name
20:03:21FromDiscord<hmmm> I'm happy our trusty std/os knows about rel paths 🥳
20:03:30FromDiscord<IsaacPaul> which means you're starting from the root of the filesystem
20:03:39FromDiscord<hmmm> oh ok
20:04:42FromDiscord<hmmm> isaac saved the day, that's why he was crowned king of england :nim1:
20:09:03FromDiscord<Schelz> Hi, I try to compile a file as 32bit dll but I get error at compiling (only when try to compile with --cpu:i386), what do I do wrong ?
20:09:42FromDiscord<IsaacPaul> show us the parameters used to compile and the error
20:09:46FromDiscord<Yardanico> In reply to @Schelz "Hi, I try to": can you show the full error as shown by the compiler?
20:09:52FromDiscord<Yardanico> and what's your OS/C compiler?
20:10:10FromDiscord<Schelz> I use this to compile https://media.discordapp.net/attachments/371759389889003532/909898092785074266/unknown.png
20:10:18FromDiscord<Yardanico> yes, I mean the full error
20:10:28FromDiscord<Schelz> https://media.discordapp.net/attachments/371759389889003532/909898164570583070/unknown.png
20:10:43FromDiscord<Yardanico> oh, this means that your C compiler is in "64-bit" mode but you're feeding it 32-bit code
20:10:46FromDiscord<Yardanico> what's your C compiler?
20:10:56FromDiscord<Yardanico> also update to nim 1.6 :)
20:11:17FromDiscord<Yardanico> if it's mingw, you can fix that error (usually) by passing `--passC:-m32 --passL:-m32` in addition to the flags you've already passed
20:12:00FromDiscord<Schelz> In reply to @Yardanico "what's your C compiler?": mingw yes
20:12:08FromDiscord<IsaacPaul> In reply to @tk "when you do things": If takes an iterator as an input and outputs an iterator then you can assume its lazy
20:12:17FromDiscord<IsaacPaul> pretty safely assume its lazy
20:12:38FromDiscord<Schelz> And if I add --passC:-m32 --passL:-m3 I still need to add --cpu:i386 ?
20:12:39tkand what about functions taking iterators, does the lazyness persist there?
20:12:41FromDiscord<Yardanico> yes
20:12:43FromDiscord<Yardanico> @Schelz
20:13:16FromDiscord<Yardanico> @Schelz basically --cpu:i386 tells Nim to compile Nim code to C in 32-bit mode, so `int`, `uint` and some other types are 32bit
20:13:25tkor rather, is it possible to make it work through a function somehow
20:13:28FromDiscord<Yardanico> and -m32 is needed for mignw to understand that you want to make a 32-bit binary, not a 64-bit one
20:13:32FromDiscord<Schelz> now I get this https://media.discordapp.net/attachments/371759389889003532/909898934661570630/unknown.png
20:13:33FromDiscord<Yardanico> because it supports both 32-bit and 64-bit usually
20:13:33tkor only with templates?
20:14:27FromDiscord<Yardanico> In reply to @Schelz "now I get this": try removing the passL argument
20:14:36FromDiscord<Yardanico> not sure if the mingw bundled with nim has 32-bit support, but it should
20:14:37FromDiscord<IsaacPaul> yea template vs proc makes no difference in this case.
20:14:59FromDiscord<Schelz> https://media.discordapp.net/attachments/371759389889003532/909899301126303764/unknown.png
20:15:14FromDiscord<Schelz> without --passL
20:15:59FromDiscord<Solitude> In reply to @tk "like if I do": it will read entire file. thats what toSeq does. eagerly collects result of an iterator.
20:16:47FromDiscord<Yardanico> In reply to @tk "like if I do": you might be interested in https://github.com/zero-functional/zero-functional if you want to use functional style chaining for seqs and stuff with more performance than sequtils :)
20:17:00tkFromDiscord: is there any way to make that thing work without first reading the entire file into ram?
20:17:33FromDiscord<IsaacPaul> In reply to @Solitude "it will read entire": Oh whoops, I looked at the docs and thought I saw a iterator return value 😂 I need my coffee. I'mma stop answering questions today
20:17:33FromDiscord<Solitude> yes, write a for-loop
20:17:39FromDiscord<Yardanico> @tk btw, FromDiscord is a bridge bot , you should reply like "@Nickname" where nickname is what's in the brackets
20:17:54Yardanico^ so here FromDiscord is a bot and @Yardanico is my discord account
20:18:00Yardanicoif you ping with @ users on discord will see your ping
20:18:10tkThat would be very difficult since that's not what IRC uses and I have a lot of muscle memory built up.
20:18:41Yardanicowell, it has to work that way because to ping on discord you must "resolve" the username into an actual user :)
20:18:53Yardanicono problems though, but keep it in mind if you want to ping someone who might not be online
20:20:29FromDiscord<Yardanico> In reply to @tk "FromDiscord: is there any": there's also https://nim-lang.org/docs/sugar.html#collect.m%2Cuntyped%2Cuntyped although it allows you to write in an imperative style with loops, not in a functional one
20:20:49FromDiscord<Yardanico> ah, it won't really work for stuff like foldl though
20:21:39tkSo the zero-functional thing looks neat, does it follow semver?
20:21:51FromDiscord<Yardanico> don't know about that one, sorry
20:21:55FromDiscord<IsaacPaul> In reply to @Yardanico "you might be interested": 😮 I didn't realize seqUtils was so inefficient
20:22:09FromDiscord<Yardanico> In reply to @IsaacPaul "😮 I didn't realize": well that's quite obvious because it's implemented as simple templates
20:22:19FromDiscord<Yardanico> so if you chain multiple of them you'll have multiple temporary sequences
20:23:19FromDiscord<Yardanico> anyone posted zen of nim to HN yet?
20:23:35FromDiscord<IsaacPaul> Yea it's been there for a little bit
20:23:42FromDiscord<Yardanico> ah right found it
20:23:57FromDiscord<IsaacPaul> In reply to @PMunch "Oh hey everyone, look": ^
20:24:07FromDiscord<Yardanico> yeah, it won't get into top though
20:24:16FromDiscord<Yardanico> also upvotes from direct links are not counted by HN :)
20:24:31FromDiscord<Yardanico> so that's why you usually search the post yourself on the website and upvote
20:28:08FromDiscord<Rika> In reply to @tk "are sequences lazy?": no
20:28:16FromDiscord<Rika> In reply to @tk "like if I do": yes
20:28:55FromDiscord<Rika> In reply to @IsaacPaul "If takes an iterator": toSeq reads the whole iterator
20:30:18FromDiscord<Rika> In reply to @tk "So the zero-functional thing": you can semi-safely assume libraries conform to semver
20:30:27FromDiscord<Rika> but that's kinda a whole can o worms so
20:36:06FromDiscord<IsaacPaul> In reply to @Rika "toSeq reads the whole": I assumed map, fold, ect all took and outputted an iterator xD
20:36:23FromDiscord<IsaacPaul> which honestly makes the most sense to me
20:37:48tkI wonder what it would take to create a non-template-based lazy "pipe" library or something
20:38:09FromDiscord<IsaacPaul> https://github.com/def-/nim-iterutils like this?
20:39:05tkI guess
20:39:09tkI think this looks about right
20:39:35FromDiscord<Rika> In reply to @IsaacPaul "I assumed map, fold,": it could make sense yes
20:39:56FromDiscord<Rika> In reply to @tk "I wonder what it": you can make your own by returning closure iterators
20:40:09FromDiscord<Rika> theyre p.much ad hoc laziness
20:40:26FromDiscord<Rika> like, thunks are basically single-yield closure iterators
20:41:05tkthunks?
20:41:13FromDiscord<Rika> uh
20:41:15FromDiscord<Rika> lazy values
20:41:25tkI didn't realise you could return iterators, or that they could be closures
20:41:26FromDiscord<Rika> theyre called thunks from what i know
20:41:38FromDiscord<Rika> https://en.wikipedia.org/wiki/Thunk
20:42:20tkah, I've written code like this a million times but never knew what it was called
20:42:26FromDiscord<Rika> you can return closure iterators only, inline iterators are, well, inlined
20:42:32tkAlso, I've heard of thunks before but never associated them to this
20:42:50tkinteresting
20:42:57FromDiscord<Rika> thunks can also be first class functions, but those are less fun
20:43:21FromDiscord<Rika> if you need lazy single-values, first class functions. if you need lazy containers, closure iterators
20:43:47FromDiscord<Yardanico> apparently with https://zen.su/posts/amalgamating-nim-programs/ compiling with `--gc:arc -d:useMalloc --os:any -d:posix -d:noSignalHandler --panics:on -d:danger` the total C code size is under 1K lines, and most of that is just copypaste from normal C stdlib headers
20:43:56FromDiscord<Yardanico> need to update the article a bit though
20:50:09FromDiscord<Yardanico> https://gist.github.com/Yardanico/bd66fe0599a0db0a43965467cfebd75f
20:50:27FromDiscord<Yardanico> that's the resulting C code from all those flags for `echo "Hello, world!"` :)
20:51:00*beshr quit (Remote host closed the connection)
20:58:55FromDiscord<Yardanico> after removing cruft that's already in the C lib it's 450 loc :))
21:04:36*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
21:18:26nisstyredoes anyone here use https://github.com/elcritch/nesper ? I tried it yesterday and got GCC errors when I tried to build the example :(
21:18:35nisstyreesp-idf worked fine though
21:18:58nisstyremight file an issue but I'm not sure if it's maintained actively anymore
21:19:11nisstyreor maybe I need a different compiler
21:19:21tkokay, I have one more question, I don't understand what is happening here: http://ix.io/3F5W - this code when executed with foo containing the lines 1, 2, and 3 will print 6 and then 0
21:20:14tksince I am "calling" the iterator every time in sum I would have expected it to re-open the file
21:20:29tknow coincidentally, this is actualy the behaviour I wanted, but not the one I expected
21:22:31tkLike I would have expected that putting f in the scope of numfile_iterator instead of it would have achieved this result
21:22:33FromDiscord<Yardanico> In reply to @tk "since I am "calling"": it's a closure iterator, so it remembers its state which means it'll only open the file once
21:23:02tkbut then if you have a to-level closure iterator will it also remember its state?
21:23:06tklet me check
21:23:15FromDiscord<Yardanico> if it's a closure iterator - yes, of course
21:23:29FromDiscord<Yardanico> if it's a normal iterator - no, because normal iterators are always inlined
21:24:57FromDiscord<Elegantbeef> Is this where i shill my `asClosure` macro? 😛
21:25:16FromDiscord<Yardanico> write a `asGoodCode` macro please
21:26:27FromDiscord<Elegantbeef> The only way to write good code is to not write code at all
21:26:28tkhttps://play.nim-lang.org/ - okay, so in this case it doesn't do the same thing
21:26:30tker
21:26:35tklet me actually paste a link to something
21:26:35FromDiscord<Elegantbeef> So the `asGoodCode` would just `quit(1)`
21:26:45tkhttps://play.nim-lang.org/#ix=3F5Z - there
21:26:46FromDiscord<Yardanico> In reply to @Elegantbeef "So the `asGoodCode` would": but 1 is a bad exit code!
21:27:02FromDiscord<Yardanico> @tk in this case you're not using the same closure iterator
21:27:03FromDiscord<Elegantbeef> Exactly
21:27:21FromDiscord<Yardanico> in your previous example it was one closure iterator because you instantiated it with ` let it = numfile_iterator("foo")`
21:27:27tkYardanico: how so?
21:27:34FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F60
21:27:42FromDiscord<Elegantbeef> `it` instantiates a new iterator
21:27:47nisstyretk: in your example I would expect it to exhaust the iterator the first time
21:27:58FromDiscord<Elegantbeef> It's not global it's stored with that instantiation of the iterator
21:28:21FromDiscord<Yardanico> @nisstyre no, it passes a fresh instantiated iterator each time to sum_it so it'll output 6 each time
21:28:22tkthat is unusual, where is this behaviour that mentioning a closure iterator "instantiates" it documented?
21:28:37tkand coincidentally, why doesn't "mentioning" the variable also do the same thing?
21:28:51nisstyreYardanico: yeah it's probably a bias coming from python land
21:28:53FromDiscord<Yardanico> because you're not "mentioning" the variable
21:28:58FromDiscord<Yardanico> you're mentioning the iterator itself
21:29:00nisstyreI think the Nim way is better
21:29:35tkokay so what is the type of an iterator before it is assigned to an "iterator" typed variable (or returned as an "iterator" typed result?)
21:29:44tkdoes it have some special different type?
21:30:02FromDiscord<Yardanico> no, it's the same, but you're instantiating a new iterator each time you reference it
21:30:22FromDiscord<Elegantbeef> "Mentioning" the variable behaves differently since the state is attached to `a`
21:30:28tkright but as I said, in that case I don't get why referencing the reference doesn't do the same thing
21:30:41FromDiscord<Elegantbeef> `var a = it` instantiates the environment(state) and a pointer to iterator
21:30:43FromDiscord<Yardanico> because you're saving the state in a variable then
21:30:50tkright, so the type IS different
21:30:58FromDiscord<Yardanico> no?
21:31:00FromDiscord<Elegantbeef> No the type is the same
21:31:03FromDiscord<Elegantbeef> The value is different
21:31:10tkhow can something of the same type behave differently in two identical contexts?
21:31:14FromDiscord<Yardanico> ???
21:31:34FromDiscord<Elegantbeef> Cause you're making an Lvalue inside `sumIt` vs passing an LValue in
21:31:55nisstyreI think maybe the confusion is over closures, not iterators...
21:32:06nisstyref is part of the closure state
21:32:07FromDiscord<Elegantbeef> when you do `sumIt(it)` i instantiates a new environment and makes an lvalue to pass to the procedure, so after the call is done there is no leaked state
21:32:18FromDiscord<Elegantbeef> You seem to want a globalized state for every closure iterator
21:32:28tkI don't _want_ anything
21:32:33tkI am simply trying to understand the behaviour
21:32:42FromDiscord<Yardanico> well, we already explained it I think
21:33:41FromDiscord<Elegantbeef> Closures need to store the state(where they are and data they're capturing), and the pointer to the procedure, as such when you do `it` that information is instantiated, when not assigned to a variable it's only used temporarily, when assigned to a variable it's persistent with that variable
21:34:14FromDiscord<Yardanico> also, take a look at this @tk https://play.nim-lang.org/#ix=3F64
21:34:32FromDiscord<Yardanico> should it behave the same in both cases?
21:34:34nisstyreElegantbeef: traditionally it's all the free variables that go into the closure environment
21:34:47nisstyrebut it's not clear here IMO
21:34:59nisstyreit's slightly different from the traditional closure in e.g. lisp
21:35:13tkthe type of a is _different_ from the type of getVal
21:35:17FromDiscord<Elegantbeef> Yea think my `asClosure` makes it a bit less silly 😀
21:35:30FromDiscord<Yardanico> In reply to @tk "the type of a": no
21:35:30FromDiscord<Elegantbeef> No they're not, they're both Data
21:35:43tkHow is an un-called function "Data"?
21:35:46tkit's a func
21:35:49FromDiscord<Yardanico> it is a called function though
21:36:07FromDiscord<Elegantbeef> https://github.com/beef331/slicerator/blob/master/tests/test1.nim#L57-L84 doesnt have any confusion of "what's caputed" 😛
21:36:09FromDiscord<Yardanico> and with closure iterators you instantiate it by mentioning it without a call
21:36:23tkright, so what's the type of the thing you mention?
21:36:29FromDiscord<Yardanico> In reply to @tk "right, so what's the": which one?
21:36:30nisstyrewhat is asClosure supposed to do?
21:36:45FromDiscord<Elegantbeef> As closure takes an inline iterator and converts it to a closure
21:36:47tkif you mention "it" in a vacuum, without "instantiating it" what is its type?
21:36:54nisstyreah interesting
21:36:59FromDiscord<Yardanico> In reply to @tk "if you mention "it"": the type of the iterator itself
21:37:04FromDiscord<Yardanico> nim has `typeof`
21:37:04FromDiscord<Elegantbeef> `iterator() {.closure.}`
21:37:09FromDiscord<Yardanico> just do `echo typeof(myVar)`
21:37:16tkright, but if I do typeof(it) it will just instantiate it before passing it to typeof no?
21:37:29FromDiscord<Elegantbeef> No typeof is compiile time only
21:37:45FromDiscord<Elegantbeef> It types the expression, it doesnt do any instantiating
21:37:50tkokay, so in this case I get the same type
21:38:11FromDiscord<Elegantbeef> It looks at the expression and goes "hey this is the symbol of `myVar` which is `iterator() {.closure.}`
21:38:36*Lord_Nightmare joined #nim
21:38:46tkso my point is, if they're symbols of the same type, why are they treated differently, what distinguishes them?
21:39:08FromDiscord<Elegantbeef> One is stored in a variable
21:39:14FromDiscord<Elegantbeef> So state persists
21:39:41tkthis is unusual, so a thing stored in a variable is distinct from the same thing as-such ?
21:39:48tkas in, it's treated differently?
21:40:08nisstyreI'm guessing (but would be curious to know exactly how) that the compiler does some sort of "lambda lifting" type thing where it gets a set of all the variables in the closure function body
21:40:13FromDiscord<Elegantbeef> The only odd thing here is that `it` instantiates a value at runtime
21:40:13nisstyreand then adds them to a struct or something
21:40:42FromDiscord<Elegantbeef> You're right nisstyre
21:40:43FromDiscord<Elegantbeef> https://nim-lang.org/docs/intern.html#code-generation-for-closures
21:40:46tkokay, so then I guess my next question is, is it possible to avoid instantiating `it` ?
21:40:52FromDiscord<Elegantbeef> This is more of "how stuff works" at a lower level, but might help tk
21:40:53tkand pass `it` as-such?
21:40:57nisstyrethanks for the link
21:41:21tklet's say I wanted to create a function which returns an un-instantiated closure iterator
21:41:28tkwhich I can then instantiate as many times as I want
21:41:44FromDiscord<Elegantbeef> Isnt that what you already have
21:41:54tkwell no, not with numfile_iterator
21:42:06FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/hck
21:42:39tkI don't understand
21:43:34FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F68 doesnt this just work?
21:43:34tkalso, if this is the case, why do iterators require () in for loops? or can I do it without the () ?
21:43:47tkThat's not he code I wanted to make work :p
21:43:53tkI sent it earlier, let me re-send it
21:43:58tkhttp://ix.io/3F5W
21:44:00FromDiscord<Elegantbeef> But doesnt the same logic apply?
21:44:03tkno
21:44:18tkunles... you are suggesting I take it OUT of the function
21:44:23tkI guess that makes sense
21:45:26tkhmm... no, that doesn't work
21:45:33tkI can't pass it arguments then
21:47:55FromDiscord<Elegantbeef> perhaps https://play.nim-lang.org/#ix=3F69
21:48:08FromDiscord<Elegantbeef> instead of passing in `it` in the calls down there you could pass `numFile`
21:48:19tkI would say that this is not elegant
21:48:23FromDiscord<Elegantbeef> The thing to note is closures without that factory require manually passing state every time
21:48:34tkI don't want the function which receives the iterator to have to care about knowing what to call the iterator with
21:48:39FromDiscord<Elegantbeef> You're right, that's why i'd suggest using `asClosure`
21:48:49FromDiscord<Elegantbeef> Write an inline iterator, then do `asClosure(yourInlineIterator)`
21:49:09tklet's see
21:49:27tkwhere is asClosure documented?
21:49:45FromDiscord<Yardanico> it's made by Elegantbeef :)
21:49:49FromDiscord<Elegantbeef> It's apart of my slicerator package, not in stdlib
21:49:52tkoh
21:50:37tkand... where would I find that?
21:50:46FromDiscord<Yardanico> beef linked it above - https://github.com/beef331/slicerator
21:50:49tkah
21:50:55FromDiscord<Elegantbeef> https://github.com/beef331/slicerator
21:51:12FromDiscord<Elegantbeef> It's not properly documented but there are examples in `tests/test1`
21:51:27tkone moment
21:52:01FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F6a but yea it'd look like this
21:52:24tkcan I put parentheses around the string? or at least a space in front of it?
21:52:26FromDiscord<Elegantbeef> Using it a lot would probably make compile time atrocious since i dont cache iterators yet though i probably should
21:52:46FromDiscord<Elegantbeef> Of course that's just one method of calling with a string
21:52:51tkdo I have to call asClosure twice if I want to process the same file twice?
21:53:35FromDiscord<Elegantbeef> Hmm i havent used iterators much, so i dont know if there is a way to reset an iterator
21:53:54nisstyrewhy can't you just use a non-closure iterator
21:54:04tkbecause I can't pass it to the function
21:54:10nisstyreconvert to seq?
21:54:14FromDiscord<Elegantbeef> They could use a non closure one if they made their `sum` a template and used `iterable[T]`
21:54:25nisstyreyeah or that
21:54:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3F6c
21:55:02tkin any case, the goal was just to avoid having to pass the filename twice
21:55:05FromDiscord<Elegantbeef> That'd accept both closure and inlines
21:55:19tkI basically want something which generates an iterator which I can repeatedly iterate over to access the same file
21:56:16tkor heck, it would be okay if I had a partial... hmm... maybe another layer of functions will solve this problem
21:56:18tklet me try something
21:58:16FromDiscord<Elegantbeef> I might be able to make a reset macro/template
21:58:58tkokay, now I'm even more lost as to why THIS doesn't work...
21:59:02tklet me make a code snippet
22:00:18tkhttp://ix.io/3F6e - what am I misunderstanding here?
22:00:59tkI would have expected the closure returned by numfile_iterator to return a fresh instance of the iterator every time it's called
22:01:54tkwow
22:02:17nisstyreprobably it shares the same environment
22:02:20tkI got an unhandled exception in ccgtypes.nim, let me try in the latest nim
22:02:23nisstyreor maybe not, idk
22:03:10tkI should have found this bug on my other computer
22:03:23tkthen I wouldn't have to wait minutes for a build
22:05:27tkthe only problem is that ccgtypes.nim is in the ccg part of nim which I completely failed to follow the last time I tried to debug a nim compiler issue.
22:05:40tkthe only other nim bug I have looked at was in the standard library which was much easier to figure out
22:05:47FromDiscord<Elegantbeef> Yea cgen is very obtuse
22:06:01FromDiscord<Elegantbeef> The only stuff i can reasonably follow is sem stuffs
22:06:49FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F6i well reset is implemented, no clue if that helps you any
22:08:45tkI actually found the compiler bug while writing a nim function to convert camelCase into snake_case (in a way which ensures that the identifiers still match) with the intention of installing that function inside nimls so that I got snake_case tab completion. As part of my test suite I was using nim_ident_normalize and found that it was broken for empty inputs. At the end of the day I managed to
22:08:47tksuccessfuly hack nimls to return snake case everywhere.
22:08:58tk(... still compiling ...)
22:09:27FromDiscord<Yardanico> In reply to @tk "I actually found the": there is a nim function like taht btw
22:09:32FromDiscord<Yardanico> (edit) "taht" => "that"
22:09:44tkthere's a nim function to do the opposite IIRC
22:09:53tknot to go from camel to snake case
22:10:07FromDiscord<Yardanico> ah right didn't see you want snake_case
22:10:14tkof course
22:10:17tkit's the superior choice
22:10:24FromDiscord<Elegantbeef> It's ok yard you dont expect people to program wrong
22:10:25tkas well as 3 space indent
22:10:32FromDiscord<Yardanico> yeah yeah :)
22:10:47FromDiscord<Yardanico> @tk take a look at https://github.com/Yardanico/nuglifier too, it's the superior choice too
22:10:54FromDiscord<Yardanico> https://forum.nim-lang.org/t/6497
22:11:02FromDiscord<Yardanico> https://raw.githubusercontent.com/Yardanico/nuglifier/master/example_output/example_case.nim example output (compiles and runs)
22:11:11tkseems awful
22:11:22FromDiscord<Yardanico> almost as bad as 3-space idents /s
22:11:42tkI personally struggle to read camelCase and find 2 space indent incredibly difficult to follow so nim being agnostic on these issues means I can happily use it.
22:11:49FromDiscord<Yardanico> yeah that's fine
22:11:59FromDiscord<Elegantbeef> It's always odd to see people follow star a package i link and have 0 clue who the fuck they are 😀
22:12:00tkaha! the compilation has finished!
22:12:05FromDiscord<Elegantbeef> Lurkers all around me
22:13:32tkokay, I have a bona-fide compiler bug, now to check if anyone else has reported it and if not, make a minimal reproducer, report it and then try (and probably fail) to fix it
22:14:22FromDiscord<Elegantbeef> If you get a min repro i can try to help you debug/fix it
22:14:41FromDiscord<Elegantbeef> I'm not overly competent on the cgen side like i said, tend to stick to semantics
22:45:41FromDiscord<Zoom> Actually, tk makes a good point. It's not obvious how to make an iterator factory in vanilla Nim.
22:45:56FromDiscord<Zoom> At least to me it isn't
22:49:56FromDiscord<evoalg> I was reading that Zen of Nim article and I realized that I tend to program in a very unstructured way, with lots of returns in a proc, and lots of continues & breaks in a loop, and I'm already in love with doing that lol ... it gives me flexibility and power, and also saves on indenting in loops, but yea I guess I'm not letting the compiler reason about my code, and yea I admit I tend to think of returns as a "goto"
22:50:21tkElegantbeef: it's fine, I'll try alone for a while, I like doing things like this
22:57:43FromDiscord<Elegantbeef> Yea this is why i think something like `asClosure` and `rest` need to be more first class
22:58:14FromDiscord<Elegantbeef> And yea evo Nim gives a ton of functionality to get away from typical silly code you see in other language
22:58:19FromDiscord<Elegantbeef> reset\ of course
22:59:06FromDiscord<Elegantbeef> Like you dont need to declare a result variable, you dont need to use return in most procedures between `break` named blocks and result
23:00:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3F6s
23:01:37FromDiscord<evoalg> my initial reaction is to save a line by doing `return true` under the if
23:01:46FromDiscord<Yardanico> lol
23:02:10FromDiscord<Elegantbeef> That's up to you of course
23:02:16FromDiscord<evoalg> I know I'm bad
23:02:27FromDiscord<Elegantbeef> Nah it's preference
23:02:31tkcan someone remind me what I need to invoke koch with to get it to compile and run a program with a freshly compiled nim?
23:02:46FromDiscord<Elegantbeef> `./koch temp c ./yourprogram.nim`
23:02:48tkthanks
23:02:49krux02_./koch temp c -r myfile
23:03:15FromDiscord<Elegantbeef> Krux waits in the shadows to strike!
23:03:19FromDiscord<Zoom> If my nesting gets out of hand it usually means it's time to separate a subroutine.An early return for a rare condition is fine, but if you rely on this and have many, maybe you should flip your perspective\: Write a function and think about it from the end to the beginning. What conditions should you satisfy on returning a desired result? Then untangle the concept into more specific steps. Hope it makes sense.↵(@evoalg)
23:03:39FromDiscord<Elegantbeef> Yea early returns I've grown to dislike
23:03:56FromDiscord<Elegantbeef> Though nim's standard 2 indentation hides nested ifs
23:04:12FromDiscord<Elegantbeef> "It's not that deep it's only 10 characters in"
23:07:29FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F6y
23:07:39FromDiscord<Elegantbeef> I hate everything you stand for 😛
23:09:05FromDiscord<Yardanico> In reply to @Zoom "Nah. That's the proper": pls stop trolling thanx
23:09:20FromDiscord<Elegantbeef> You're not my real mom!
23:10:57tkokay, well, I have no idea
23:11:34FromDiscord<Zoom> I stand by the opinion we really should be able to write some form of `iterable[T]` instead of an openArray in my example and not have to make `contains` a template.
23:11:54FromDiscord<Elegantbeef> Well i agree zoom, so who're you arguing with
23:12:08FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3F6C
23:12:22FromDiscord<Elegantbeef> It's also dumb you cannot implictly pass an open array to an `iterable[T]`
23:12:28FromDiscord<evoalg> with nots of nesting, this can greatly save indentations for me
23:12:53FromDiscord<Elegantbeef> It's really up to you on that one, i prefer `if not item.isBad` since it shows the logic flow and not the anti-logic flow
23:13:10FromDiscord<Zoom> With the heavens, it seems. I don't like the fact those issues make me repeat the same things every time I start going to this channel.
23:13:47FromDiscord<Elegantbeef> It's the same idea, but one explicitly states intent, the other requires reasoning it from the code
23:14:20FromDiscord<evoalg> ok ... I'm giving nim a good go, because one of the reasons is that it will improve my sloppy coding in general 😉
23:14:30FromDiscord<Elegantbeef> I looked at it Zoom and iterable was intentionally made as such, and thanks to implict conversions failing when you do `iterable[int] or openArray[int]` they're ptetty much useless
23:14:38FromDiscord<Elegantbeef> pretty\
23:15:10FromDiscord<Elegantbeef> In my view they have a good goal, but have failed miserably to meet the mark
23:16:37FromDiscord<Elegantbeef> There is this RFC that remedies them a bit, but still not ideal they need to be in a template https://github.com/nim-lang/RFCs/issues/397
23:19:14*sagax quit (Excess Flood)
23:21:44FromDiscord<Elegantbeef> I'd also argue that `var a = someThing.items` should be implictly converted to a closure
23:22:16FromDiscord<Elegantbeef> But i guess that's what we have `asClosure` for now 😛
23:27:58FromDiscord<evoalg> to use asClosure, I just have to remember to use the `()` with the variable right? Second question, I can't use it to turn toSeq into an iterator right?
23:28:17FromDiscord<Elegantbeef> Nope `toSeq` isnt an iterator
23:28:45FromDiscord<Elegantbeef> I mean you can but it doesnt make any sense as it's just `yourCollection.yourIterator`
23:28:59FromDiscord<Elegantbeef> You shouldnt need the `()`
23:29:15FromDiscord<Elegantbeef> Sadly `reset` only works if called in the declaration scope
23:30:26FromDiscord<sealmove> hey can't I use the `nim` command to compile many files at once?
23:30:58FromDiscord<Elegantbeef> It compiles the source module and all of it's dependancies, i dont think you can do multiple files at once
23:31:05FromDiscord<Elegantbeef> multiple source modules\
23:32:10FromDiscord<sealmove> yeah I see :
23:32:14FromDiscord<sealmove> (edit) ":" => ":|"
23:32:24FromDiscord<Yardanico> any reason you want that?
23:35:38FromDiscord<sealmove> ok I'll try to explain
23:36:20FromDiscord<sealmove> in my project i generate nim source code programmatically (with Scala)
23:36:34FromDiscord<sealmove> and I need to test if the generated nim source files can compile
23:36:48FromDiscord<sealmove> and distinguish which ones do compile and which don't
23:37:11FromDiscord<sealmove> the other members have written a tool in ruby to do this. it's somewhat language-agnostic
23:37:18FromDiscord<sealmove> so I am trying to make a subclass for nim
23:37:21FromDiscord<Yardanico> i mean, why not just call nim separately for each file? the thing is - how would you expect it to behave with multiple files?
23:37:32FromDiscord<Yardanico> because in most languages passing multiple files to a compiler means compiling them together
23:38:23FromDiscord<Yardanico> it's a valid usecase, but for me it feels like that feature will add more complexity without any big gain (since you can just call nim multiple times)
23:38:33FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=3F6D
23:38:33FromDiscord<Yardanico> nim also has --compileOnly to check if the _nim_ code compiles
23:38:49FromDiscord<sealmove> yes I wanted to ask about this
23:39:01FromDiscord<sealmove> what does it mean?
23:39:05FromDiscord<Yardanico> https://nim-lang.org/docs/nimc.html
23:39:09FromDiscord<Yardanico> "compile Nim files only; do not assemble or link"
23:39:21FromDiscord<Yardanico> nim has a lot of useful flags, give that page a read :)
23:39:25FromDiscord<sealmove> very good, this will be very useful
23:51:38FromDiscord<sealmove> btw Yardanico fun fact...
23:51:55FromDiscord<sealmove> the only reason I must do this is because Travis CI now charges based on time used
23:52:05FromDiscord<sealmove> https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing
23:52:16FromDiscord<sealmove> you probably know already
23:52:58FromDiscord<sealmove> currently I am using `testify` which is a crap tool I wrote some years ago https://github.com/sealmove/testify
23:54:25FromDiscord<sealmove> I don't know if using their ruby tool instead of `testify` will make a difference, but at least I'll follow their convention and remove `testify` as an extra dependency
23:55:32FromDiscord<sealmove> here is the _does-it-build? tool_ https://github.com/kaitai-io/kaitai_struct_tests/tree/master/builder