<< 09-06-2021 >>

00:03:14*jcara27 joined #nim
00:03:46*jcara27 quit (Remote host closed the connection)
00:25:01*ZoomZoomZoom quit (Ping timeout: 272 seconds)
00:37:35*gambpang17 joined #nim
00:37:36*gambpang17 quit (Remote host closed the connection)
00:40:04*xet7 quit (Remote host closed the connection)
01:05:09*xet7 joined #nim
01:37:42*arkurious quit (Quit: Leaving)
02:02:16FromDiscord<Rika> It is answered in the asynchronous dispatch module documentation
02:02:45FromDiscord<Rika> https://nim-lang.org/docs/asyncdispatch.html#asynchronous-procedures-handling-exceptions
02:26:16FromDiscord<brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=3phH
02:26:42FromDiscord<brainproxy> (edit) "https://play.nim-lang.org/#ix=3phH" => "https://play.nim-lang.org/#ix=3phI"
02:28:39FromDiscord<Rika> You can check with treeRepr in the macros module
02:29:37FromDiscord<Rika> I mean dumpTree I think
02:30:39FromDiscord<Rika> PtrTy↡ BracketExpr↡ Ident "Atomic"↡ Ident "bool"
02:34:36FromDiscord<brainproxy> nice
03:04:55*clemens3 quit (Ping timeout: 268 seconds)
03:13:16FromDiscord<codic> does posix.onSignal use the double pipe thing? because heap allocations usually work but are "unsafe" so you shouldn't do them in a regular signal handler, instead you can use the double pipe trick
03:13:24FromDiscord<codic> I have no idea wtf handle_signal that it calls is, I can't find any docs on it
03:24:06*clemens3 joined #nim
03:46:49*spiderstew_ joined #nim
03:49:35*spiderstew quit (Ping timeout: 272 seconds)
03:53:25FromGitter<bung87> @haxscramper does hnimast can parse a module call the module proc ?
03:58:57FromDiscord<lamersc.com> Does nim support Apple M1?
03:59:45FromDiscord<ElegantBeef> I believe it does
04:09:49FromDiscord<Rainbow Asteroids> does the Apple M1 have a C compiler?
04:15:05FromDiscord<Rika> Clang?
04:16:50*johnwayne123[m|g joined #nim
04:16:54*johnwayne123[m|g quit (Remote host closed the connection)
04:19:07FromDiscord<flywind> In reply to @lamersc.com "Does nim support Apple": > Just like our devel branch, v1.4.8 is built using csources_v1, which means you can use it on Apple M1 chips.
04:19:18FromDiscord<flywind> https://forum.nim-lang.org/t/8031
04:20:24FromDiscord<haxscramper> In reply to @bung87 "<@608382355454951435> does hnimast can": Not sure what doe you mean by that. `module.procName()`?
04:23:00FromDiscord<haxscramper> And in what context? (Object parsing, nimble configuration, or something else)
04:26:45*narimiran joined #nim
04:29:54FromGitter<bung87> @haxscramper I want use a module that module path is runtime determined , so am wonder how to call that module'proc
04:31:35FromDiscord<haxscramper> You can't use runtime module paths
04:32:03FromDiscord<haxscramper> Jim is statically typed, so at best you can embed nimscript compile generates string.
04:32:12FromDiscord<haxscramper> (edit) "Jim" => "Nim"
04:32:15FromDiscord<Rainbow Asteroids> what about a dynamic library, where you export to C ABI?
04:32:17FromDiscord<ElegantBeef> We all see the jim
04:32:28FromDiscord<haxscramper> Yeah, I'm on the phone right now
04:32:35FromDiscord<Rainbow Asteroids> you gotta add Nim to your autocorrect, lol
04:33:01FromDiscord<ElegantBeef> What about a dynamic library, module import path isnt runtime based
04:34:43FromGitter<bung87> ok, so I need collected all procs that need export and compile it to dynlib
04:34:46FromDiscord<Rika> In reply to @haxscramper "Nim is statically typed,": Jim
04:34:49FromDiscord<Rika> Hehe
04:35:26FromDiscord<Rainbow Asteroids> maybe i misintpereted the question. if the path of the module is determined at runtime, wouldn't you need a dynamic library?
04:35:28FromDiscord<haxscramper> In reply to @Rika "Jim": r/contagiouslaughter material
04:35:59FromDiscord<haxscramper> In reply to @Rainbow Asteroids "maybe i misintpereted the": No, module path is a part of syntax, do even dynamic library can't fix that
04:36:16FromDiscord<ElegantBeef> Yea modules do not exist at runtime, so there is no module path there
04:36:58FromDiscord<haxscramper> Dynamic library would allow you to substitute different implementation of the compiled C procedure for example, but when you write nim you would still have to import procs from somewhere.
04:37:38FromGitter<bung87> dyn lib is easy solution, I get it.
04:54:12*rockcavera quit (Ping timeout: 245 seconds)
04:59:05*ThoMe29 joined #nim
04:59:15*ThoMe29 quit (Remote host closed the connection)
04:59:16FromGitter<bung87> the proc I want export need any extro pragma that be visible in dynlib ?
05:20:46*IonutVan_28 joined #nim
05:21:15*IonutVan_28 quit (Remote host closed the connection)
05:35:59FromGitter<bung87> found in document.
05:41:10*pg_docbot10 joined #nim
05:41:21*pg_docbot10 quit (Remote host closed the connection)
05:53:33*bernard_f6bvp[m| joined #nim
05:53:49*bernard_f6bvp[m| quit (Remote host closed the connection)
06:57:09*anthis_ joined #nim
06:57:35*anthis_ quit (Remote host closed the connection)
07:11:39*PMunch joined #nim
07:24:34*sunwind joined #nim
07:25:04*sunwind quit (Remote host closed the connection)
07:34:06*threenp quit (Quit: Bridge terminating on SIGTERM)
07:34:07*johnnynitwits quit (Quit: Bridge terminating on SIGTERM)
07:35:10*threenp joined #nim
07:35:10*johnnynitwits joined #nim
07:35:26*smj joined #nim
07:35:26*smj quit (Read error: Connection reset by peer)
08:23:23FromDiscord<Varriount> Araq: I was reading this[0], and found the concept of canonicalization interesting. Does the Nim compiler do anything like that?↡[0] https://www.npopov.com/2021/06/02/Design-issues-in-LLVM-IR.html
08:39:10*Vladar joined #nim
08:55:05*Guest25073 joined #nim
08:55:15*Guest25073 quit (Remote host closed the connection)
09:00:13*cheer[m] quit (Quit: Idle for 30+ days)
09:10:08ozzzPMunch: hello! I found your PCAP parser library. Could you please tell, can it reassemble tcp session?
09:18:49PMunchWell, not by itself
09:18:58PMunchIt just parses the pcap format into Nim objects
09:22:04*juns joined #nim
09:22:16*juns quit (Remote host closed the connection)
09:24:21ozzzPMunch: gotcha, then I need to create reassembler by myself
09:41:24planetis[m]why the base64 decode https://play.nim-lang.org/#ix=3pjV doesn't compile when I changed string to openarray[char]?
09:41:33planetis[m]is it a template bug?
09:43:38PMunchUhm, where do you define a?
09:44:40planetis[m]its defined inside the inputchar template
09:44:55planetis[m]but ouputchar uses it
09:45:34planetis[m]btw I did basic fuzzing tests on base64 https://github.com/planetis-m/libfuzzer/tree/master/examples/base64
09:45:43planetis[m]and haven't found any bug
09:45:49planetis[m]so thats the good news
09:48:01*threenp quit (Quit: Bridge terminating on SIGTERM)
09:48:02*johnnynitwits quit (Quit: Bridge terminating on SIGTERM)
09:49:15*johnnynitwits joined #nim
09:49:15*threenp joined #nim
09:50:52PMunchWhere in inputChar? I can't see it
09:51:22planetis[m]line 40
09:52:27planetis[m]i moved it after inputindex bc i was getting undeclared identifier as well
09:53:19PMunchOoh sorry, I read that wrong :P
09:56:21PMunchHmm, that is really weird indeed
10:05:10FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3pk3
10:05:16FromDiscord<impbox [ftsf]> any idea what this means and how to handle it?
10:05:40planetis[m]nvm life is good, last few days I have found more bugs than wrote any code
10:05:46FromDiscord<impbox [ftsf]> first request works after starting the client, but often subsequent attempts trigger it
10:09:53FromDiscord<haxscramper> In reply to @Varriount "Araq: I was reading": On discord it is `@Araq`, colon version pings IRC user
10:12:41PMunchBoth versions ping IRC users
10:12:58PMunchWe get pinged as long as our names are mentioned
10:13:27PMunchplanetis[m], did you figure it out?
10:15:43PMunch@impbox, are you trying to fix the Nim IRC bots?
10:15:51PMunchSo we can move to Libera
10:17:44planetis[m]nope i have no idea how to rewrite it, in order to work
10:18:11planetis[m]i hope we move to matrix and dump irc altogether
10:19:48FromDiscord<impbox [ftsf]> nah, making a discord bot for my game's leaderboards
10:19:58FromDiscord<impbox [ftsf]> it works great but dies after getting that error a lot
10:20:03FromDiscord<impbox [ftsf]> usually when i'm not around
10:20:10*barm joined #nim
10:20:26PMunchplanetis[m], I've wanted to use Matrix, but it's convoluted to join..
10:20:33PMunchAnd I'd have to find a new client..
10:20:49*barm quit (Remote host closed the connection)
10:20:56PMunchThat's the thing I like about IRC, the extremely low bar of entry (don't even need to register anywhere)
10:21:24PMunchAaah, that's cool @impox!
10:21:54planetis[m]then stay on top of it, so it behaves
10:22:57planetis[m]well how about all the spammers? they dont have to register either
10:23:23PMunch@impbox, have you seen this: https://github.com/nim-lang/Nim/issues/7316
10:23:39PMunchplanetis[m], better to have the occasional spammers than to not have any users
10:24:21PMunchIRC is really nice because you can just link to a web-chat and make it possible for anyone to ask for help even without registering
10:24:41PMunchThat's how I started using it
10:25:15PMunchInstalled a Linux distro and it had a "Get help" button which just launched an IRC client that auto-joined the distros IRC channel
10:26:22FromDiscord<impbox [ftsf]> @PMunch yeah, i saw that, but not much info on the cause or how to solve it
10:26:34FromDiscord<impbox [ftsf]> and i'm only dealing with a single connection
10:26:47FromDiscord<impbox [ftsf]> well very few connections
10:27:21PMunchI'm pretty sure it's just the socket that fails or some other network error. You might be fine catching it and just retrying or something
10:31:11FromDiscord<impbox [ftsf]> hmm it's happening in async land, i'm not sure where i can catch it except at top level
10:31:44PMunchOh wait, it's inside async..
10:31:52PMunchYeah that might be tricky..
10:31:59FromDiscord<impbox [ftsf]> actually... it's in httpclient
10:32:18FromDiscord<impbox [ftsf]> my bot makes an API request when it receives a command, maybe it's the API request failing
10:35:47FromDiscord<impbox [ftsf]> thanks for rubberducking
10:36:16FromDiscord<Rika> quack
10:36:39PMunchI actually have a silly little project I want to do re rubber ducks
10:37:18PMunchA small rubber duck that you can put in your cup of coffee and it notifies you when your cup is cold enough to drink
10:38:15FromDiscord<Rika> what if i dont drink coffee
10:38:22*martin_sto[m|gr] joined #nim
10:38:34*martin_sto[m|gr] quit (Remote host closed the connection)
10:38:36PMunchIt can also measure tea
10:38:49FromDiscord<Rainbow Asteroids> maybe it warns if your cup of water becomes too warm πŸ€”
10:39:10PMunchBut realistically the Venn diagram of developers and non-coffee drinkers gotta be vanishingly small :P
10:39:21PMunchHmm, it could
10:39:46PMunchCurrently I'm investigating running it off-of the heat in the cup using a Peltier element though
10:39:59PMunchAnd that wouldn't work with cold water going warm
10:40:12FromDiscord<Rainbow Asteroids> In reply to @PMunch "But realistically the Venn": im special ☺️
10:40:35FromDiscord<Rainbow Asteroids> is the heat difference that great?
10:41:00FromDiscord<Rika> i dont drink anything for the morning; i drink cola in the evening
10:41:03PMunchThat's what I'm trying to gauge
10:41:45PMunchThe problem is that the duck needs to stay water-tight, but it felt like adding Qi-charging, a battery pack, and all that jazz was a bit overkill :P
10:42:01PMunch@Rika, Cola is soo bad for you though..
10:42:11FromDiscord<Rika> mhm and coffee isnt
10:42:12FromDiscord<Rainbow Asteroids> but it tastes soo cood
10:42:16FromDiscord<Rainbow Asteroids> (edit) "cood" => "good"
10:42:28FromDiscord<Rika> you've convinced me 😐
10:43:40PMunchCoffee at least doesn't have a huge amount of sugar and acids messing up your teeth and giving you a lot of empty calories
10:44:24PMunchSure high doses of caffeine and cholesterol (depending on how you brew it, I do filter coffee so this isn't much of a concern) isn't great either
10:45:25ormiretcan run little stirling engines off a mug of coffee, could possibly do something with one of them to get notification at a certain temp (or harvest the energy to run electronics to beep) https://smile.amazon.co.uk/Temperature-Stirling-Engine-Motor-Education/dp/B071G7SXVX
10:47:32FromDiscord<Rainbow Asteroids> if only we could run the world off those stirling engines that run off body heat
10:49:49*drmpeg joined #nim
10:50:10*drmpeg quit (Remote host closed the connection)
10:54:08FromDiscord<Rika> In reply to @PMunch "Coffee at least doesn't": that doesnt make it any better, in my opinion
10:54:21FromDiscord<Rika> coffee still stains your teeth
10:54:56ForumUpdaterBotNew question by LemongrabThree: Nim: Proc Default Argument Has to Be Used (or Discarded); for a function call use (), see https://stackoverflow.com/questions/67902767/nim-proc-default-argument-has-to-be-used-or-discarded-for-a-function-call-us
11:02:28PMunchEh, that doesn't bother me too much
11:09:08*Arrrrrrrr joined #nim
11:10:47PMunchHmm, there are a couple of low-cost option to Qi that takes up much smaller space
11:11:50PMunchLike this thing: https://www.aliexpress.com/item/4000153676589.html
11:13:01*Vladar quit (Remote host closed the connection)
11:19:28*lritter joined #nim
11:21:31*richvdh[m]1 joined #nim
11:22:05*richvdh[m]1 quit (Remote host closed the connection)
11:27:50*Vladar joined #nim
11:35:38*ldlework quit (Quit: co'o ro do)
11:37:38*ldlework joined #nim
11:43:26*Exagone313 joined #nim
11:44:19*Exagone313 quit (Remote host closed the connection)
12:07:22FromDiscord<haxscramper> PR for nim 1.4.8 was merged to compiler explorer
12:11:02planetis[m]nice, does it support annotated assembly?
12:15:05*arkurious joined #nim
12:24:13*Vladar quit (Remote host closed the connection)
12:29:44*Vladar joined #nim
12:44:19*markmcclain joined #nim
12:44:52*markmcclain quit (Remote host closed the connection)
12:47:50ForumUpdaterBotNew thread by Slangmgh: An simple nrpl for nim, see https://forum.nim-lang.org/t/8102
12:50:05*Arrrrrrrr quit (Quit: Arrrrrrrr)
13:28:31*Vladar quit (Remote host closed the connection)
13:30:47*LDerJim13 joined #nim
13:31:14*LDerJim13 quit (Remote host closed the connection)
13:39:15*rockcavera joined #nim
13:40:55*AkioKio-t25 joined #nim
13:40:57*AkioKio-t25 quit (Remote host closed the connection)
13:44:02*trly joined #nim
13:44:26*trly quit (Remote host closed the connection)
14:02:23*d10n quit (Quit: why all the #hashtags #lol #hackers #overheard)
14:06:39*d10n joined #nim
14:06:39*d10n quit (Changing host)
14:06:39*d10n joined #nim
14:14:20*PMunch quit (Quit: leaving)
14:39:26*Afootpluto4 joined #nim
14:39:44*Afootpluto4 quit (Remote host closed the connection)
14:39:55*tane joined #nim
14:47:46*Guest44391 joined #nim
14:47:51*Guest44391 quit (Remote host closed the connection)
15:06:02*Guest20474 joined #nim
15:06:30*Guest20474 quit (Remote host closed the connection)
15:08:45*takfarines12[m|g joined #nim
15:09:22*takfarines12[m|g quit (Remote host closed the connection)
15:10:54FromDiscord<dom96> In reply to @PMunch "But realistically the Venn": Another non-coffee drinker here, I bet the it's not as small as you think πŸ˜›
15:12:26FromDiscord<treeform> In reply to @dom96 "Another non-coffee drinker here,": I don't like coffee too.
15:13:38FromDiscord<dom96> yes! Non-coffee drinkers might just be the majority
15:18:40*fputs joined #nim
15:20:11FromDiscord<ajusa> > sample size of 3
15:21:38FromDiscord<treeform> I doubt it, looking through stats on google (USA only I think) 75-80% of the people like coffee and like 60% drink it everyday. But many people like cream/milk flavored coffee rather then "coffee" itself. Nim community is bigger in EU, it looks like Scandinavia drinks way way more coffee then USA. If I where to put my finger on it I would guess that you will find ~5% don't like coffee and ~20% don't drink it often.
15:22:17FromDiscord<treeform> We should put that on our next Nim pool.
15:22:25FromDiscord<treeform> (edit) "pool." => "pole."
15:26:52FromDiscord<Gary M> Nim doesn't have pointer arithmetic outside of casting to ptr UncheckedArray[T] right
15:27:27FromDiscord<treeform> In reply to @Gary M "Nim doesn't have pointer": Not really but you can write one in like 10 lines of nim code.
15:27:41FromDiscord<Gary M> one what
15:27:49FromDiscord<treeform> pointer arithmetic
15:27:57FromDiscord<treeform> define + [] - for poitners
15:28:03FromDiscord<treeform> (edit) "poitners" => "pointers"
15:28:03FromDiscord<Gary M> ah right.
15:28:18FromDiscord<Gary M> The issue is I'm allocating multiple types within a single alloc0 right
15:28:42FromDiscord<Gary M> so I have to offset lenOfA then lenOfB etc for each array
15:29:11FromDiscord<Gary M> so the pointer arithmetic has to be a little more manual πŸ˜„
15:29:44FromDiscord<treeform> yeah so you allocate the block, cast the pointer to uint64 or some thing, do your math, cast it to the type you need?
15:30:32FromDiscord<treeform> I was doing that exact thing yesterday... it works.
15:31:29FromDiscord<Gary M> I'll figure it out πŸ˜„ I was just hoping there was maybe some pointer arithmetic thing I was missing.
15:32:45FromDiscord<treeform> In first year of Nim defined + [] - for pointers, in second year of nim I mostly used UncheckedArray, now i just cast uint64 here and there...
15:32:53FromDiscord<treeform> (edit) "In first year of Nim ... defined" added "I"
15:33:17FromDiscord<Gary M> I'm not following the casting the uint64 bit
15:33:24FromDiscord<Gary M> (edit) "the" => "to"
15:37:25FromDiscord<treeform> In reply to @Gary M "I'm not following the": https://play.nim-lang.org/#ix=3pmu
15:37:35FromGitter<kaushalmodi> Gary M: Try `nimble install ptr_math`
15:37:57FromGitter<kaushalmodi> https://kaushalmodi.github.io/ptr_math/
15:39:17FromDiscord<treeform> Yeah I had a similar thing: https://github.com/kaushalmodi/ptr_math/blob/main/src/ptr_math.nim I bet if you remove the comments, examples and tests its like 10 lines of code.
15:39:43FromDiscord<treeform> I just do `cast[uint64](dataPtr) + 4` now days
15:40:02FromDiscord<Gary M> the uint64 trick is pretty cool, I'll experiment more with that πŸ˜„
15:41:10FromDiscord<treeform> Maybe casting to int is better as its will support 32 bit platforms.
15:41:28FromDiscord<treeform> I don't have a good way tot test 32bit platforms though
15:42:54FromDiscord<Gary M> I can't think of any modern 32 bit targets πŸ˜„
15:43:15FromDiscord<treeform> WASM
15:44:37FromDiscord<Gary M> Fair.
15:45:01FromDiscord<Gary M> Pretty unfortunate that web games all but died with flash save for the occasional itch demo
15:45:40FromDiscord<Gary M> html5 and webgl is more than capable but the community isn't there at all like it was when sites like newgrounds and kongregate were at their peak
15:46:19FromDiscord<treeform> Many of the .io games have millions of players I would not dismiss that.
15:46:36FromDiscord<Gary M> another fair point πŸ˜„
15:47:02FromDiscord<Gary M> Just quite different than Flash, still.
15:47:15FromDiscord<treeform> I made a webgame but I had more luck getting my game out there on steam (I just used electron).
15:47:30FromDiscord<treeform> I will probably not make a webgame again.
15:47:40FromDiscord<Gary M> a lot of that style of free/freemium games moved to mobile
15:48:00FromDiscord<treeform> But still many people played the webgame part because they where in school or only had chromebooks.
15:48:21FromDiscord<treeform> (edit) "where" => "were"
15:51:17*NimBot joined #nim
15:54:15FromDiscord<treeform> kaushalmodi, I did not know about ByteAddress and +% that's cool.
15:55:16FromDiscord<Gary M> wait what is `+%`
15:56:09FromDiscord<Gary M> > Treats x and y as unsigned and adds them.
15:56:12FromDiscord<Gary M> well that's pretty cool
15:58:12FromDiscord<Gary M> the tricky part now will be making these tightly packed arrays resizable πŸ˜„
15:58:55FromGitter<kaushalmodi> treeform: Credit for that goes to https://forum.nim-lang.org/t/1188#7366 ⏎ ⏎ I just packaged that code and made it more ergonomic (templates -> proc) and beginner-friendly (examples and docs)
15:59:30FromDiscord<Gary M> however the constraint here is that each allocated array of types is the same length
16:01:19FromDiscord<treeform> In reply to @Gary M "I can't think of": Maybe this looks cleaner: https://play.nim-lang.org/#ix=3pmC
16:02:07FromDiscord<Gary M> Yeah, I'm using ByteAddress and +% now, seems more proper
16:05:28FromGitter<kaushalmodi> Gary M: Why not make your code generic and let `sizeof(T)` figure out your offset jumps
16:05:33FromDiscord<treeform> kaushalmodi, I like the way the original forum post kept it in a "danger" block sort of.
16:05:37FromGitter<kaushalmodi> I see that you are doing manual calcs in your code
16:06:00FromGitter<kaushalmodi> > kept it in a "danger" block sort of. ⏎ ⏎ I had it that way originally, until I realized that that block did nothing
16:06:38FromDiscord<treeform> I like that its for me to basically go here is the "crazy" section
16:06:38FromGitter<kaushalmodi> the templates defined inside that original `ptrMath` template got leaked out to the global namespace, until the internal templates got embedded inside `block:`
16:06:51FromDiscord<treeform> oh they would leak?
16:07:11FromGitter<kaushalmodi> it not "leak" technically.. it's how templates work
16:07:34FromGitter<kaushalmodi> stuff inside templates is equivalent to copy-pasting that stuff manually, like C macros
16:07:55FromDiscord<treeform> yeah
16:08:00FromGitter<kaushalmodi> you can contain that using `block:` but that prevented runnableExamples and docs to run within 😁
16:08:24FromGitter<kaushalmodi> I thought that I was anyways running the "leaked" version for a long time and nothing hurt, so I got rid of that template nesting
16:09:10FromGitter<kaushalmodi> I have documented the issues with nested template approach here: https://github.com/kaushalmodi/ptr_math/issues/1
16:09:46FromDiscord<treeform> So some thing like this will not work? https://play.nim-lang.org/#ix=3pmM
16:10:44FromGitter<kaushalmodi> In your example, the ptr =, -, etc will now work outside the dragons: block too :D
16:11:12*rockcavera quit (Remote host closed the connection)
16:12:35FromGitter<kaushalmodi> the main thing that triggered me to remove that API was that I could not have ptrMath: block appear twice in the same scope. Because the first call, already defined the inner templates in the main scope
16:12:37FromDiscord<treeform> it appears not to work outside the dragon block: https://play.nim-lang.org/#ix=3pmO
16:12:58FromGitter<kaushalmodi> ah, because you have `block:`
16:13:29FromDiscord<treeform> yeah that fixes, but prevents locals from leaking
16:13:36FromDiscord<treeform> which one would like
16:13:36FromGitter<kaushalmodi> As I mentioned earlier, I disliked block: as I could not have runnableExamples in the inner templates (you know, I love docs quite too much)
16:14:20FromGitter<kaushalmodi> also I realized that have `+` etc in global scope did not hurt anything.. it was leaking in the outer scope for a while as I did not have block: originally
16:15:22FromGitter<kaushalmodi> If there's a real need for localized declarations of ptr math procs, I can always add those templates back.
16:17:02*Len[m]2 joined #nim
16:17:18FromDiscord<treeform> I see, yeah, I think your solution is probably best one, given the constraints.
16:17:40FromDiscord<treeform> I would change them to inline functions or back to templates to make them faster.
16:17:55FromDiscord<treeform> function overhead is slow, inline functions are slower them templates for some reason.
16:18:06FromGitter<kaushalmodi> > I would change them to inline functions ⏎ ⏎ I didn't even consider that. I will give that a try
16:18:41FromDiscord<treeform> Or back to templates, templates are faster then inline functions
16:18:47FromGitter<kaushalmodi> > function overhead is slow, inline functions are slower them templates for some reason. ⏎ ⏎ Oh really? I went through converting all templates to procs because I have been reading that you should read procs if possible
16:19:00FromGitter<kaushalmodi> *write procs
16:19:12FromGitter<kaushalmodi> heh, not sure how write got typoed as read
16:19:16FromDiscord<treeform> I think that is true, unless you benchmark it to not be the case
16:19:23FromDiscord<Gary M> I actually brought up that issue about template speed, I believe heh
16:19:30FromDiscord<Gary M> or rather, inlined proc speed
16:19:37FromDiscord<treeform> Do you have a ticket, i would watch
16:19:50FromDiscord<Gary M> even with opt:speed and danger builds, though it gets a lot closer
16:19:54FromDiscord<Gary M> No I don't.
16:20:10FromDiscord<Gary M> I figure I might also be incorrect with my reasoning somewhere.
16:20:21FromDiscord<treeform> To me its very strange that inline proc is slower them template, feel like its a bug/optimization nim compiler can make.
16:20:23*nixnet08 joined #nim
16:21:35FromDiscord<treeform> kaushalmodi, is there a reason you did not include `pointer` type?
16:22:17FromDiscord<Gary M> I'll have to run some benchmarks again to sure, but I know at the very least that debug builds without either opt:speed or lto, (can't remember which caused it to perform proper inlining) can give you such extremely abysmal performance even for debug builds because of it.
16:22:28FromDiscord<treeform> kaushalmodi, should adding p + 1 (move p by 4 byte) if p is ptr[uint32] ?
16:22:45FromDiscord<Gary M> Beef suggested it was an issue with my specific environment that the `--opt:speed` flag wasn't on by default
16:22:56FromGitter<kaushalmodi> treeform: ⏎ ⏎ > is there a reason you did not include pointer type? ⏎ ⏎ No, I didn't need it so far [https://gitter.im/nim-lang/Nim?at=60c0eae019b46c60b179f286]
16:23:04FromDiscord<treeform> I feel like p + 1 should move it by 1 byte, and p[1] should do the 4 byte thing?
16:23:07FromDiscord<treeform> thoughts?
16:23:14*nixnet08 quit (Client Quit)
16:23:51FromGitter<kaushalmodi> > I feel like p + 1 should move it by 1 byte, and p[1] should do the 4 byte thing? ⏎ ⏎ that would need one to remember to think which is which. The current is consistent
16:24:02FromGitter<kaushalmodi> You can do byte extraction by mask anding?
16:25:05*Len[m]2 left #nim (#nim)
16:25:31FromGitter<kaushalmodi> May be you can have p + 1 move by a byte by first casting to byte ptr type?
16:25:33FromDiscord<treeform> I feel like there are pros and cons here. The p + 1 moves by 1 byte makes pointers feel more C like, number like. While p + 1 moves by 4 makes it more consistent hmm...
16:26:11FromDiscord<Gary M> I thought C style pointer arith was `p + 1 = p + sizeof(T) + 1`
16:26:23FromDiscord<Gary M> not p + 1 byte
16:26:37FromDiscord<Gary M> (edit) "+" => ""
16:26:58FromGitter<kaushalmodi> treeform, Gary M: issues and PR's are welcome. I have started documenting on https://github.com/kaushalmodi/ptr_math/issues
16:27:04FromGitter<kaushalmodi> Need to sign off now, thanks
16:27:11FromDiscord<treeform> bye
16:27:25FromDiscord<Gary M> > Incrementing a pointer increases the stored address by the size of its type.
16:27:38FromDiscord<Gary M> so incrementing by a single byte would be non-standard if anything?
16:29:25*adbraun[m|gr] joined #nim
16:30:01*adbraun[m|gr] quit (Remote host closed the connection)
16:31:12FromDiscord<treeform> I think you are right. I just good too used to my uint64 thing πŸ™‚
16:31:45FromDiscord<treeform> I just tried ti with a C program and that's exactly how it works. when i=0, i + 1 makes i = 4.
16:31:53FromDiscord<Gary M> I've been dipping my toes into the macro stuff recently and I'm really liking some of the hacky things I can do with it haha
16:36:12*rockcavera joined #nim
16:37:08*AciD` joined #nim
16:37:48*AciD` quit (Remote host closed the connection)
16:53:04*sz0 joined #nim
16:56:38planetis[m]guys I need opinions, my in place init functions look like `initMyType`. Is it better if I shorten them to just `init`? The nep1 doc doesn't mention anything about it.
16:56:46FromDiscord<Rika> no
16:56:50FromDiscord<Rika> oh, in place?
16:58:32FromDiscord<Rika> i would
16:58:50FromDiscord<Rika> personally do what you said (`init`)
17:12:04planetis[m]ok thanks
17:12:30*ZoomZoomZoom joined #nim
17:14:20FromDiscord<Bung> I like initMyType or MyType.init
17:29:04*fredy12 joined #nim
17:29:38*fredy12 quit (Remote host closed the connection)
17:29:44planetis[m]i am used to initMyType being the one recomended (i think i read it in Nim in action) but in this case I think just `init` is better
17:31:04planetis[m]There is init in sets. `var s: HashSet; init s`
17:32:34planetis[m]however locks chose the long names `initLock L` and I am building on Locks...
17:33:22planetis[m]yeah I am totally nitpicking. I will leave it as is and do something better :)
17:33:55*Ozzyboshi234 joined #nim
17:34:32*Ozzyboshi234 quit (Remote host closed the connection)
17:40:54FromDiscord<Alea> does float != float64 by default? https://media.discordapp.net/attachments/371759389889003532/852240854276898876/unknown.png
17:41:32FromDiscord<codic> no
17:41:37FromDiscord<codic> the type of input is set to flot
17:41:38FromDiscord<codic> (edit) "flot" => "float"
17:41:41FromDiscord<codic> but you passed it an array
17:41:47FromDiscord<codic> (edit) "but you passed it an array ... " added "of floats, not a single float"
17:43:42FromGitter<kaushalmodi> Alea: See if this helps you (or confuses you) more :) I have done a similar analysis for int* types when I was understanding this: https://scripter.co/notes/nim/#int-types
17:43:48FromGitter<kaushalmodi> The same applies to float* types
17:44:48FromGitter<kaushalmodi> Relevant bit from there ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=60c0fe1002f6ee5b91e3130b]
17:46:00*narimiran quit (Ping timeout: 240 seconds)
17:46:26FromDiscord<Alea> In reply to @codic "but you passed it": so what should it be?
17:46:32FromDiscord<Alea> because the same syntax works for ints
17:46:58FromDiscord<Alea> wait nvm
17:47:11*SteveMarathon[m] joined #nim
17:48:16FromGitter<kaushalmodi> heh, nvm from me too.. I just looked at your "does float != float64" message
17:48:32FromGitter<kaushalmodi> turns out you were assigning an array to a float
17:48:51FromDiscord<Alea> I can't see a float equivalent to IntArray
17:48:56FromDiscord<Alea> so not sure how to define it
17:49:30FromGitter<kaushalmodi> > I can't see a float equivalent to IntArray ⏎ ⏎ What do you mean? What's an IntArray?
17:49:57FromDiscord<Alea> I was looking at this in the manual https://media.discordapp.net/attachments/371759389889003532/852243134067114014/unknown.png
17:50:04FromDiscord<Alea> but I just noticed that that's a custom type
17:50:39FromDiscord<Alea> so this should be it then
17:50:42FromDiscord<Alea> sent a code paste, see https://play.nim-lang.org/#ix=
17:50:47FromGitter<kaushalmodi> Nim has type inference, so you can just do ⏎ ⏎ ```let ⏎ input = [1.0, 2.0, 3.0]``` [https://gitter.im/nim-lang/Nim?at=60c0ff77ae78084ee73096e0]
17:51:23FromGitter<kaushalmodi> > sent a code paste ⏎ ⏎ That link doesn't show code to me
17:52:37FromDiscord<haxscramper> If you want to be super-explicit, you can also do `[1.float64, 2, 3]` I think
17:52:47FromDiscord<haxscramper> !eval echo typeof [1.float, 2, 3]
17:52:49NimBotarray[0..2, float]
17:52:58FromGitter<kaushalmodi> Alea: See https://play.nim-lang.org/#ix=3pnx
17:52:59FromDiscord<haxscramper> !eval echo typeof [1.float64, 2, 3]
17:53:01NimBotarray[0..2, float64]
17:54:59FromDiscord<Alea> alright a bit better grasp on this, thanks everyone
17:57:35*icey27 joined #nim
17:57:35*icey27 quit (Remote host closed the connection)
17:57:41ForumUpdaterBotNew thread by Codic12: Safe signal handling, see https://forum.nim-lang.org/t/8103
17:58:19FromDiscord<System64 ~ Flandre Scarlet> I still have problems with my GameMusicEmu lib, can someone help me please?
18:00:06reversem3what should I be looking at <stdlib> if I want to search in thousands of files and compare them and pattern match to 1 file ?
18:02:06*wschlich joined #nim
18:02:13*wschlich quit (Remote host closed the connection)
18:06:48ZoomZoomZoomHey, what does this line mean: "Only the release define (-d:release) cannot be set in NimScripts."?
18:07:09ZoomZoomZoomFrom https://nim-lang.org/docs/nims.html
18:08:16ZoomZoomZoomJust checked and setting release or danger defines works fine in config.nims, bot for `nimble build` and `nim c`
18:09:19FromGitter<kaushalmodi> > Just checked and setting release or danger defines works fine in config.nims, bot for nimble build and nim c ⏎ ⏎ That was fixed recently in devel
18:10:32FromDiscord<haxscramper> In reply to @reversem3 "what should I be": you want to compare files for equality and then pattern match (I assume by parsing content)?
18:10:43FromGitter<kaushalmodi> ZoomZoomZoom: https://github.com/nim-lang/Nim/commit/df429fa28772e077faa30dd6e3a701abf48c7669
18:12:14ZoomZoomZoomAh, great. Just stumbled upon this line and was afraid I'd recommended config.nims and said you can set any mode in it when it wasn't in fact so. So I'm in the clear :)
18:12:47ZoomZoomZoomThanks @kaushalmodi
18:12:59reversem3<FromDiscord "<haxscramper> In reply to @rever"> Correct in the end I want to be able to take a file and compare it to multiple files in a directory
18:13:00FromGitter<kaushalmodi> np, yay, 1 more config.nims fan :)
18:16:02FromDiscord<haxscramper> In reply to @reversem3 "<FromDiscord "<haxscramper> In reply": You can md5 hash a file using something like this, https://play.nim-lang.org/#ix=3pnH
18:16:36FromDiscord<haxscramper> The code is not mine - someone in the telegram chat asked a similar question, so I basically just copied relevant part
18:17:12FromDiscord<haxscramper> Though they mentioned this solution is slower compared to even python, so more optimized version (for example that does not read whole file at once via `readAll()`) can be used
18:17:52FromDiscord<haxscramper> There is also a https://nim-lang.org/docs/sha1.html#secureHashFile%2Cstring which might be better suited for computing file hashes
18:17:57reversem3<FromDiscord "<haxscramper> In reply to @rever"> No I mean kind of what grep can do , by comparing the lines in a file to another file then writing out to screen. I want to take a file and compare the strings in the file and find a match in a directory of thousands of files.
18:18:45reversem3does that make sense?
18:19:15FromDiscord<haxscramper> Just read file and compare lies to a pattern? `for file in walkDir(...): for line in lines(file): if line == pattern`
18:19:47FromDiscord<haxscramper> It would be slow as optimized versions like `rg/grep` use clever heuristics to speed things up
18:19:49reversem3ok so os/walkDir is that it
18:20:15reversem3yeah that is true
18:40:44FromGitter<kaushalmodi> treeform: Things become messy (readability goes out the window) when you deal with `pointer` instead of `ptr` :) ⏎ ⏎ Is this what you wanted? https://github.com/kaushalmodi/ptr_math/pull/5/files
18:42:03FromDiscord<treeform> Well usually when I deal with pointers its because my data is mixed types.
18:42:20FromDiscord<treeform> If its a flat array I just use UncheckedArray
18:42:26FromDiscord<treeform> (edit) "If its a flat array ... I" added "of a known"
18:42:40FromDiscord<treeform> (edit) "If its a flat array of a known ... I" added "type"
18:43:02FromDiscord<treeform> but yes your code appears to do what I wanted
18:43:54*dqi14 joined #nim
18:44:26*dqi14 quit (Remote host closed the connection)
18:49:07*tiorock joined #nim
18:49:07*tiorock quit (Changing host)
18:49:07*tiorock joined #nim
18:49:07*rockcavera is now known as Guest52282
18:49:08*Guest52282 quit (Killed (datapacket.freenode.net (Nickname regained by services)))
18:49:08*tiorock is now known as rockcavera
19:05:44*mrpi29 joined #nim
19:06:13*mrpi29 quit (Remote host closed the connection)
19:08:55FromGitter<kaushalmodi> Cool, that PR is deployed now
19:14:12FromDiscord<treeform> I don't know though if the typed pointer functions are any better then using UncheckedArray?
19:34:54*pk004 joined #nim
19:35:07*pk004 quit (Killed (Sigyn (Spam is off topic on freenode.)))
19:38:48*ZoomZoomZoom quit (Ping timeout: 240 seconds)
19:41:30*BrianKanhofer[m| joined #nim
19:42:07*BrianKanhofer[m| quit (Remote host closed the connection)
19:46:49*narimiran joined #nim
19:57:02ForumUpdaterBotNew Nimble package! whois - A simple and free whois client, see https://gitea.com/Thisago/whois.nim
20:06:11*sz0 quit (Quit: Connection closed for inactivity)
20:17:47FromDiscord<Randall> sent a code paste, see https://play.nim-lang.org/#ix=3poi
20:18:29FromDiscord<ElegantBeef> Not premade, you could write a case statement macro to do it though
20:20:49FromDiscord<Randall> sent a code paste, see https://play.nim-lang.org/#ix=3pok
20:22:00FromDiscord<ElegantBeef> Assuming your rune is a single character yes, but then why are you even using rune
20:23:38FromDiscord<Randall> HTML5 parser. Tokenizer should handle codepoints, but most checks (e.g. is current char '<') are just single byte chars.
20:24:37FromDiscord<Randall> Is casting a rune to char the same as just taking the first byte of the rune? In that case this could be safe to do
20:28:25FromDiscord<ElegantBeef> No clue
20:29:18*tane quit (Quit: Leaving)
20:32:47*narimiran quit (Ping timeout: 272 seconds)
20:57:03FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3poy
20:57:15FromDiscord<treeform> Rune is a uint32 so should be fast to check.
21:27:52*D_ quit (Ping timeout: 258 seconds)
21:28:56*letto quit (Read error: Connection reset by peer)
21:29:29*letto joined #nim
21:29:42*D_ joined #nim
21:43:32*Jjp137 quit (Read error: Connection reset by peer)
21:44:24*Jjp137 joined #nim
21:48:31*lritter quit (Quit: Leaving)
21:58:47*DerRaiden19 joined #nim
21:59:16*DerRaiden19 quit (Remote host closed the connection)
22:16:51*dgb quit (Quit: WeeChat 2.7.1)
22:22:50*ZoomZoomZoom joined #nim
22:37:07*D_ quit (Ping timeout: 245 seconds)
22:38:30*D_ joined #nim
22:49:54*nonara_ joined #nim
22:50:30*nonara_ quit (Remote host closed the connection)
23:16:03*e21fyk[m|gr] joined #nim
23:16:19*e21fyk[m|gr] quit (Remote host closed the connection)
23:34:31*wirew0rm1 joined #nim
23:35:00*wirew0rm1 quit (Remote host closed the connection)
23:43:57FromDiscord<ElegantBeef> Well i thought porting hottie to linux would've been relatively easy but it seems the rip it gives is not in the range of addresses so it never outputs a useful stack πŸ˜„