<< 02-02-2021 >>

00:15:26Prestigeirchaxwell: stop watching me! ;)
00:15:39FromDiscord<ElegantBeef> Huh?
00:15:40PrestigeBeef how are your string views coming?
00:15:54FromDiscord<ElegantBeef> Got an rpi pico infront of me, so... uhhh not?
00:15:56irchaxwellPrestige, from Reddit?
00:16:01PrestigeYe
00:16:04irchaxwellhe he
00:16:30PrestigeBeef: oh :P okay
00:16:42PrestigeI really need to work on Nimdow sometime
00:20:26FromDiscord<ElegantBeef> But strviews is ok for most str splitting applications
00:30:18FromDiscord<Zachary Carter> I think that's exactly why Disruptek was kicked / banned / whatever - for saying something that could be taken a certain way, to a newcomer
00:30:26*WilhelmVonWeiner joined #nim
00:31:42FromDiscord<Zachary Carter> and then I think things escalated after he was called out for it
00:35:50FromDiscord<Zachary Carter> it's unfortunate, but he's unable to keep his opinions to himself sometimes, and know when things are or aren't appropriate to type
00:36:26FromDiscord<Zachary Carter> I'm sure if he apologies and makes some behavior changes he'd be welcomed back, but I don't think he wants to anymore. I think he feels like he's been burned or has lost interest, I don't know which.
00:37:05FromDiscord<Zachary Carter> Maybe just taking some time away from Nim is best
00:41:14FromDiscord<konsumlamm> for reference, the quote he was banned for, afaict, was "why do you think it's okay to criticize others when your work is so bad that it drags down an entire language, let alone an irc community", though i doubt that was the sole reason
00:41:57leorizeAraq said it's because he was bullying dom96
00:42:06FromDiscord<ElegantBeef> It's silly for me to want to remake the pico sdk in pure nim isnt it? πŸ˜„
00:42:09Prestigeyeah, he was trashing dom
00:42:19PrestigeNot at all Beef :)
00:42:53FromDiscord<konsumlamm> (that quote was to dom)
00:42:57FromDiscord<ElegantBeef> Considering i know pretty much zero C, quite possibly it is
00:43:04FromDiscord<Zachary Carter> well he was
00:43:18FromDiscord<Zachary Carter> that's what I meant when I said it escalated
00:43:22FromDiscord<ElegantBeef> If dom and disruptek spoke near the same time it was typically disruptek insulting dom
00:43:31FromDiscord<Zachary Carter> I didn't want to call out specific people haha
00:43:32PrestigeC isn't too bad to figure out usually
00:43:49Clonkk[m]At some point, being toxic and disrespectful on a regular basis is a choice.
00:43:49Clonkk[m]My guess is that it was more the straw that broke the camel's back.
00:44:04FromDiscord<Zachary Carter> the camel's back has been broken before
00:44:10Prestigepoor camel
00:44:19FromDiscord<Zachary Carter> this was it being dropped off of a roof through a flaming table
00:44:27FromDiscord<Zachary Carter> and then breaking its back
00:44:44FromDiscord<ElegantBeef> you say that prestige but i'm looking at `#define clocks_hw ((clocks_hw_t const)CLOCKS_BASE)` going ah yes seems to be an immutable pointer to a specific address of type clockshw πŸ˜„
00:44:48Clonkk[m]Some of his work looks really good though so it's a shame he couldn't respect some simple rules and got himself banned
00:45:03FromDiscord<Zachary Carter> eh it's a bit more complicated than that but yeah
00:45:16FromDiscord<Zachary Carter> it is a shame
00:45:24PrestigeLol well most things aren't that bad
00:45:50FromDiscord<ElegantBeef> Well the pico is a micro controller i most stuff is like that(assuming that's to me)
00:45:50PrestigeI had to ask a few Q's about the source of different WMs because some things in c/c++ are weird looking
00:46:19FromDiscord<ElegantBeef> (edit) "Well the pico is a micro controller i ... most" added "assume"
01:02:03*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:02:27*njoseph joined #nim
01:04:59ForumUpdaterBotNew thread by Domino: Stdout.write nor printf work from within threads. Is this a bug or intended behavior?, see https://forum.nim-lang.org/t/7461
01:08:00*FromDiscord quit (Remote host closed the connection)
01:08:16*FromDiscord joined #nim
01:28:19*a_chou joined #nim
01:42:20*NimBot joined #nim
01:48:12*filcuc joined #nim
02:03:49*Tlangir is now known as Tanger
02:08:36*abm quit (Read error: Connection reset by peer)
02:31:53*irchaxwell_ joined #nim
02:33:05*mmohammadi9812 quit (Ping timeout: 240 seconds)
02:33:16*mmohammadi9812 joined #nim
02:33:46*rockcavera quit (Remote host closed the connection)
02:35:31*irchaxwell quit (Ping timeout: 272 seconds)
02:38:21*filcuc quit (Ping timeout: 264 seconds)
02:44:32*krux02 quit (Remote host closed the connection)
02:54:46FromDiscord<exelotl> I see disruptek as one of those fabled "rockstar developers"
02:56:16FromDiscord<exelotl> As in, they do brilliant work but they also act recklessly and make people uncomfortable
02:56:46FromDiscord<Rika> when you say rockstar do you mean the actual word or the company
02:56:58FromDiscord<exelotl> The actual word
02:59:11ForumUpdaterBotNew thread by Halloleo: Objects for "classes" with ref or without?, see https://forum.nim-lang.org/t/7462
03:07:11ForumUpdaterBotNew thread by Halloleo: How to change teh default initialisation for object types, see https://forum.nim-lang.org/t/7463
03:18:46FromDiscord<Avatarfighter> irchaxwell: welcome to Nim btw just saw your reddit post, I hope you enjoy our community for all it offers πŸ˜‰
03:19:00FromDiscord<Avatarfighter> all that it offers
03:20:43FromDiscord<ElegantBeef> Dont welcome them like that they might stay πŸ˜›
03:21:21FromDiscord<Avatarfighter> Psh you gotta invite them to the big family πŸ˜›
03:25:52*a_chou quit (Remote host closed the connection)
03:26:11*a_chou joined #nim
03:29:14leorizeYardanico: IIRC you said you were porting a path library, right?
03:29:30FromDiscord<Yardanico> no, I don't think I said that πŸ€”
03:29:32FromDiscord<Yardanico> what path library?
03:30:00leorizeguess I misremembered
03:30:10*a_chou quit (Client Quit)
03:30:29leorizethe "/path/to/something" kind of path library
03:30:51FromDiscord<Yardanico> hmm, I don't think I ever did anything like that
03:31:13leorizeyea, guess it was someone else
03:52:18FromDiscord<smallgram> sent a code paste, see https://play.nim-lang.org/#ix=2O3u
03:52:32FromDiscord<smallgram> (edit) "https://play.nim-lang.org/#ix=2O3u" => "https://play.nim-lang.org/#ix=2O3v"
03:54:20FromDiscord<ElegantBeef> Do you need to store these in a big collection?
03:54:33FromDiscord<smallgram> No larger than say 10 inputs.
03:54:34FromDiscord<ElegantBeef> (edit) removed "big"
03:54:48FromDiscord<ElegantBeef> My dumb brain wrote big instead of homogenous πŸ˜„
03:55:16FromDiscord<smallgram> I was thinking I would eventually store them in a list or table...
03:55:30FromDiscord<ElegantBeef> Ok so you want the int inputs and float inputs stored together
03:55:33FromDiscord<smallgram> Which would push towards subtypes?
03:55:48FromDiscord<ElegantBeef> Well most nimions dont use OOP for something so simple
03:57:17FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=2O3w
03:57:18FromDiscord<ElegantBeef> Using an object variant
03:57:31FromDiscord<smallgram> Yeah, that was one option I was looking at.
03:57:39FromDiscord<Rika> then you can make a template
03:58:01FromDiscord<smallgram> Seems nice--not experienced with object variants, but look interesting.
03:58:29*muffindrake quit (Ping timeout: 272 seconds)
03:58:35FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2O3x
03:58:39FromDiscord<Rika> then you can plainly use i.value as usual
03:59:37FromDiscord<ElegantBeef> that wont work you dont have a return type on the template
03:59:45FromDiscord<Rika> `:untyped` then
03:59:47FromDiscord<ElegantBeef> Yea
03:59:52FromDiscord<ElegantBeef> Just wanted to make sure it was proper
03:59:52*muffindrake joined #nim
03:59:54FromDiscord<Rika> i keep on forgetting that it defaults to typed and not untyped
04:02:08FromDiscord<ElegantBeef> Although that might not even compile considering if you do `a = i.value` it has a case statement of non similar types
04:02:37FromDiscord<Rika> if a isnt a var
04:02:38FromDiscord<Rika> yes
04:02:47FromDiscord<Rika> i mean, a declaration
04:02:54FromDiscord<Rika> if its a set only
04:05:13FromDiscord<ElegantBeef> I dont think it evaluates properly regardless
04:05:21FromDiscord<Rika> hm, ive used it before and it works
04:05:31FromDiscord<ElegantBeef> You sure you used it with different types?
04:05:32FromDiscord<Rika> prolly due to using generic functions and not setting it to a var
04:05:37FromDiscord<Rika> maybe not
04:06:18FromDiscord<Rika> ive mainly stopped programming like that already so sorry if i forget
04:06:29FromDiscord<Rika> generics are just way too good versus that kinda shit
04:06:43FromDiscord<ElegantBeef> Yea but generics dont allow homgenous collections
04:07:02FromDiscord<ElegantBeef> Cannot put a `seq[float]` and `seq[int]` in a collection together without boxing
04:07:56FromDiscord<Rika> i dont remember the last time i needed to do that though
04:08:04FromDiscord<smallgram> Aside from the collections issue, which isn't too big of a deal in my actual application... I like the idea of just using generic types and functions. However I don't know how to keep a `focus` reference that can point to whatever `Input[T]` object...?
04:08:20FromDiscord<Rika> a ref?
04:08:32FromDiscord<ElegantBeef> or a `lent`
04:08:33FromDiscord<Rika> and Input isnt a generic type in this case
04:08:38FromDiscord<smallgram> Can I have a ref that "stays generic"?
04:08:42FromDiscord<Rika> yes
04:14:07FromDiscord<smallgram> sent a code paste, see https://play.nim-lang.org/#ix=2O3B
04:14:25FromDiscord<Rika> if you do that, you cannot do `seq[Input]`
04:14:35FromDiscord<Rika> youd need to do `seq[Input[int]]`
04:14:37FromDiscord<Rika> or float
04:15:45FromDiscord<smallgram> Right. But the alternative would be the `Input` base type and `IntInput` and `FloatInput` sub-types, right? And then `seq[Input]` could be done...
04:16:01FromDiscord<Rika> or the object variant beef sent
04:16:09FromDiscord<smallgram> Yeah..
04:16:11FromDiscord<ElegantBeef> You have OOP, Generics, or Variants
04:16:32FromDiscord<ElegantBeef> Generics might not work well for this case due to having multiple Ts
04:17:23FromDiscord<smallgram> While on the topic, if I did the generic version and ignored collections for multiple Ts, how do you have a generic `Input[T]` ref that can point to any `Input`?
04:17:36FromDiscord<Rika> you cant either lol
04:17:47FromDiscord<Rika> can only point to the same T i believe
04:18:24FromDiscord<smallgram> Oh okay. Yeah, that's what I was thinking, but then you confused me earlier when you said "yes" to "can I have a ref that "stays generic"" lol
04:18:27FromDiscord<ElegantBeef> Well you can use lower level logic to achieve that
04:18:41FromDiscord<ElegantBeef> `pointer`s do exist, but not recommended
04:18:52FromDiscord<smallgram> Right, was trying to avoid.
04:19:33FromDiscord<ElegantBeef> Variants or OOP will be your best bet, i prefer the former since you dont have to cast
04:19:34FromDiscord<smallgram> That was the first thing that my mind went to from my limited C experience. πŸ™‚
04:20:10FromDiscord<Rika> i meant that to beef
04:21:27FromDiscord<smallgram> on the last line.
04:21:28FromDiscord<smallgram> sent a code paste, see https://play.nim-lang.org/#ix=2O3G
04:23:56FromDiscord<ElegantBeef> Well yea it doesnt
04:24:16FromDiscord<ElegantBeef> Oh wait
04:24:21FromDiscord<smallgram> Yeah, I guess I can't shadow it...
04:24:29FromDiscord<ElegantBeef> You should be able to
04:24:55FromDiscord<Rika> wont it be the same issue of my template
04:24:57FromDiscord<Rika> the type gets lost
04:26:04FromDiscord<smallgram> sent a code paste, see https://play.nim-lang.org/#ix=2O3H
04:26:12FromDiscord<ElegantBeef> In this case it can fall back ot `Input` which is the issue
04:26:15FromDiscord<Rika> line numbers accidentally copied πŸ‘Œ
04:26:17FromDiscord<ElegantBeef> (edit) "ot" => "to"
04:26:32FromDiscord<ElegantBeef> The only type that all of those can fit into is an `Input`
04:26:37FromDiscord<smallgram> Ha, yeah didn't bother to not copy them. lol
04:26:52FromDiscord<Rika> remember to "+y instead of ctrl+shift+c
04:28:22FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2O3J
04:28:26FromDiscord<ElegantBeef> You have to do it like this
04:29:07FromDiscord<ElegantBeef> The typing has to be figured out at compile time so the `var` has to be an Input in your example as it's the only type that can hold all of the return values
04:29:13FromDiscord<ElegantBeef> You could use methods here
04:29:17FromDiscord<ElegantBeef> Depending on what you need
04:32:23FromDiscord<smallgram> Yeah, thanks beef. I was trying to do the type conversion up front, to avoid duplicating a bunch of the proc in two branches.
04:32:46FromDiscord<smallgram> But I was also just looking at methods. Thanks!
04:35:25FromDiscord<smallgram> The brain has become weaker working in Python and JS so much. lol
04:36:37FromDiscord<smallgram> (edit) Yeah, thanks beef. I was trying to do the type conversion up front, to avoid duplicating a bunch of the proc in two branches, but not looking possible.
04:37:29FromDiscord<ElegantBeef> "This is your mind on dynamic typing"
04:38:54FromDiscord<ElegantBeef> There is also https://github.com/Carpall/nobject
04:40:13FromDiscord<ElegantBeef> Not that i encourage the use of dynamic typing, but i cannot stop you if you do use it πŸ˜„
04:50:40*spiderstew_ joined #nim
04:52:19*spiderstew quit (Ping timeout: 272 seconds)
05:19:14*opal quit (Ping timeout: 264 seconds)
05:37:03*opal joined #nim
05:59:18*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
05:59:24*njoseph joined #nim
06:00:00*njoseph quit (Client Quit)
06:00:07*njoseph joined #nim
06:00:07*njoseph quit (Client Quit)
06:00:16*njoseph joined #nim
06:01:03*njoseph quit (Client Quit)
06:01:10*njoseph joined #nim
06:01:28*njoseph quit (Client Quit)
06:01:34*njoseph joined #nim
06:03:06*waleee-cl quit (Quit: Connection closed for inactivity)
06:16:25*narimiran joined #nim
06:24:15*vicfred joined #nim
06:37:30*icebattle quit (Ping timeout: 246 seconds)
07:32:08*caesarsalad quit (Ping timeout: 258 seconds)
07:43:20*couven92 joined #nim
07:53:13*liblq-dev joined #nim
08:02:29*wasted_youth quit (Read error: Connection reset by peer)
08:02:51*leorize quit (Remote host closed the connection)
08:03:16*leorize joined #nim
08:38:31*actuallybatman quit (Ping timeout: 272 seconds)
08:48:46*d10n quit (Quit: why all the #hashtags #lol #hackers #overheard)
08:49:03*d10n joined #nim
08:49:03*d10n quit (Changing host)
08:49:03*d10n joined #nim
08:51:44FromDiscord<djazz> Updated nim from 1.2.6 to 1.4.2 and now I get `Error: internal error: inconsistent environment type` on a line. I think gcsafe or something is messing it up. The error occurs on this line https://github.com/daniel-j/nim-webview/blob/master/examples/demo/demo.nim#L37 and these are the relevant code for the procs called https://github.com/daniel-j/nim-webview/blob/master/src/webview.nim#L167-L190 (eval and return cause it)
08:52:47FromDiscord<djazz> webview has a dispatch function I use, which calls the proc passed on the main gui thread (it is stored in a queue, internally in upstream webview library)
08:53:29*PMunch joined #nim
08:53:43FromDiscord<djazz> This code worked fine before, although it's not a pretty solution...
09:00:03*VijayMarupudi[m] quit (Quit: Idle for 30+ days)
09:05:39*wasted_youth joined #nim
09:15:29*joast quit (Ping timeout: 265 seconds)
09:18:39FromDiscord<mratsim> seems like a regression in closure capture
09:18:57FromDiscord<mratsim> if you now how to clone and build nim from source
09:19:09FromDiscord<mratsim> (with ./build_all.sh script)
09:19:28FromDiscord<mratsim> you can run ./koch temp c <path/to/your/file.nim>
09:19:47FromDiscord<mratsim> that will create a temporary Nim compiler in debug mode with stack traces
09:20:53FromDiscord<mratsim> you can then create an issue with a link to your code (tag the precise commit/permalink by pressing "y"), the project file we need to compile and the stacktrace.
09:21:32FromDiscord<mratsim> if you can reduce the example great but I think this one might be tricky to reduce and with the stacktrace and git bisect we can narrow down the regression
09:26:52*MarderIII joined #nim
09:31:24FromDiscord<djazz> alright
09:32:01FromDiscord<djazz> the example compiles sucessfully with 1.2.8, and fails on 1.4.0
09:32:23FromDiscord<ElegantBeef> Does it fail on devel?
09:32:24FromDiscord<djazz> will take a closer look at it later with a custom nim build
09:52:14*fanta1 joined #nim
10:03:52*MarderIII quit (Ping timeout: 260 seconds)
10:05:45*abm joined #nim
10:11:09*liblq-dev quit (Quit: WeeChat 3.0)
10:11:18*liblq-dev joined #nim
10:19:12FromGitter<Lecale> What's the easiest way to find out your machine name with nim? I've just scoured the os module and totally failed to find something.
10:19:24*qwertfisch quit (Ping timeout: 240 seconds)
10:20:34*qwertfisch joined #nim
10:22:12FromDiscord<mratsim> execProcess("uname -a")
10:22:16FromDiscord<mratsim> or something like that
10:23:44FromGitter<Lecale> oh i'm in the wrong module then :)
10:24:12FromDiscord<haxscramper> https://nim-lang.org/docs/posix.html#getlogin_r%2Ccstring%2Cint
10:26:10FromDiscord<haxscramper> Oh, you need a machine not username - `gethostname` from the same module is probably what you need
10:29:14PMunchAssuming you are on a POSIX system though
10:30:59PMunchHmm, I'm in a bit of a pickle..
10:32:20FromDiscord<ElegantBeef> He turned himself into a pickle. Funniest shit i've ever seen.
10:32:21PMunchI have a procedure that reads from a stream, and that stream was based on a socket
10:32:43PMunchFilled my bath-tub with vinegar, salt, and sugar and pickled myself
10:32:47PMunchI'll never go old!
10:32:59FromDiscord<ElegantBeef> Nor will you grow up
10:33:01PMunchI will be a bit soggy and translucent though..
10:33:49PMunchAnyways
10:33:50FromDiscord<ElegantBeef> What's the issue with the stream?
10:34:00PMunchWell, now I need to perform my stuff async
10:34:25PMunchBecause I want to send as many requests as I can
10:34:33PMunchHmm, I guess I could create a bunch of sockets...
10:34:44PMunchAnd then just readAll
10:35:05PMunchThe problem is that these are DNS messages, so I don't know the size of the message without parsing it
10:35:20PMunchAnd the parser is based on binaryparse and uses a stream
10:36:46FromDiscord<ElegantBeef> Well since async occurs linearly cant you just hold those async procedures hostage with a while loop and a bool, similar to a threading lock?
10:37:50FromDiscord<ElegantBeef> My super dumb idea
10:37:54FromDiscord<ElegantBeef> sent a code paste, see https://paste.rs/xut
10:39:13FromDiscord<ElegantBeef> I obviously dont use async πŸ˜„
10:39:47PMunchHow would that help?
10:40:05PMunchThe problem is that trying to parse a DNS message from the stream is a blocking operation
10:40:23PMunchOr wait, reading from a stream with not enough data is an exception?
10:40:38PMunchI think I've been mixing channels and streams in my head -_-
10:41:29FromDiscord<ElegantBeef> Ah didnt get that as a problem, so thought the solution was just accessing the stream async caused issues
10:41:40FromDiscord<ElegantBeef> I dont async so i shouldnt speak πŸ˜›
10:42:00PMunchDon't do async kids
10:42:24PMunchIt's a gateway paradigm
10:43:09FromDiscord<ElegantBeef> First you async, then you thread, then you use opencl, finally you use cluster computing
10:43:46FromDiscord<GreenFork> good times when CPU only had 1 thread
10:43:57FromDiscord<ElegantBeef> 1 thread no gpu
10:44:04FromDiscord<ElegantBeef> There was only the correct way to program πŸ˜„
10:45:06PMunchAs someone who's done multi-tasking by context switching with assembly, no, no it's not
10:45:19FromDiscord<ElegantBeef> Lol
10:46:06FromDiscord<ElegantBeef> Speaking of context switching, good night πŸ˜„
10:46:44PMunchGood night
10:49:10*FromGitter quit (Remote host closed the connection)
10:49:41PMunchHmm, seems FromGitter went to bed as well..
10:52:31*FromGitter joined #nim
10:59:08FromDiscord<dom96> Async is there to prevent blocking on a read πŸ™‚
11:00:21PMunchWell yes, but the thing reading from the stream isn't async
11:00:26PMunchAnd the stream isn't async..
11:01:07PMunchIt's the classic red/blue async issue
11:01:11PMunchhttps://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
11:03:07FromDiscord<Rika> We have β€œconverter” from async to sync but not reverse
11:03:17FromDiscord<Rika> And I don’t think reverse is easily doable
11:04:06FromGitter<Araq> gah not this color thing again...
11:04:41FromDiscord<Rika> There’s been an article β€œdebunking” it
11:06:52FromDiscord<Rika> https://www.tedinski.com/2018/11/13/function-coloring.html
11:08:03PMunchBrb, reading
11:14:12FromDiscord<Rika> Also do we not have asynchronous streams
11:16:36PMunchOkay done
11:16:52PMunchThat article doesn't really refute any of my issues though..
11:17:08PMunchThe problem isn't "is it impossible to rewrite this to be properly async"
11:17:31PMunchThe problem is "I have existing libraries of two different colours that can't mix"
11:17:49PMunchEven though the underlying types differ, they have different execution models, and I can't mix them
11:18:57PMunchDon't get me wrong, I don't know of another language where this wouldn't be a problem (except perhaps for languages that force everything to be async as a default, but that has another set of issues)
11:35:01FromGitter<Araq> well yes and no
11:35:18FromGitter<Araq> "I can't mix them" is a strong statement, there is always threads and channels
11:35:52FromGitter<Araq> or even interprocess communication
11:36:49FromGitter<Araq> I agree it's annoying though and in an ideal world things worked much like they do in Golang *shrug*
11:37:17FromDiscord<basdk> hi i was wondering if there is any proc or other to sum differents json like this↡{"a":1, "b":2}+{"a":2, "b":3, "c":1}= {"a":3, "b":5, "c":1}?
11:37:38FromDiscord<Rika> no, sounds niche
11:37:40PMunch@Araq, I don't think golang would fix this, would it?
11:38:18PMunchBut yeah, I could jump some hoops and get it working, but I'm trying to load test something so I need it to spew as many DNS requests as fast as possible
11:38:34FromGitter<Araq> why not? there is no async in Golang, there is only 'go fun(a, b, c)' which every library can use or not
11:38:55FromDiscord<Rika> how high is the overhead for that
11:39:19PMunchOh really? Huh, so they have some kind of global async context behind the scenes that all their procedures need to interact with (although hidden from the user)
11:39:29PMunchI guess it makes sense for what Golang tries to be
11:39:49FromDiscord<Rika> no they use greenlets
11:40:45FromGitter<Araq> well 'greenlet' is just a word. the question is can other goroutines run when you call io.write. And afaik they can
11:42:07FromDiscord<Rika> ah i guess greenlets are an "async context" in a way
11:42:12FromGitter<Araq> and yet io.write doesn't produce a Future[], the type system isn't involved, the code looks synchronous / "Blocking"
11:47:26FromDiscord<Clyybber> Araq: Go uses `chan` as a Future type
11:47:53FromGitter<Araq> `write` doesn't return a channel
11:48:09FromGitter<Araq> nor does `read` require a channel
11:48:41FromDiscord<Clyybber> yeah; I mean for the classical 'get future; await it' flow
11:51:42FromGitter<Araq> my favourite paradigm is still threads+locks fwiw
11:53:11PMunchAFAIK a Goroutine will tell the scheduler "hey I'm about to block this thread" before doing so and that triggers it to create a new thread for computations
11:53:23FromDiscord<Clyybber> Araq: Go's io module uses interfaces as a means to be async
11:53:41FromGitter<Araq> one major problem with threads is the stack management overhead but that's a legacy forced upon us by the OS and ABIs, in principle a linked list of call frames makes for a nice stack implementation
11:53:45FromDiscord<Clyybber> if you want to do some streaming thing using goroutines you have to use `chan`
11:53:48PMunchBut that is for OS blocking like file/socket reads
11:54:30FromDiscord<Clyybber> Yeah, weave is a great thread abstraction IMO
11:54:42FromDiscord<Clyybber> or implementation rather
11:54:48PMunchI've yet to play around with Weave
11:55:21PMunchAnd yeah, it's unfortunate that threads are so heavy
11:55:25PMunchComparatively speaking
11:55:37FromGitter<Araq> Clyybber: really? that sucks.
11:55:57FromDiscord<Clyybber> yep
11:57:47*liblq-dev quit (Ping timeout: 258 seconds)
12:00:23*liblq-dev joined #nim
12:04:37FromGitter<Araq> we should use CPS on top of weave then... oh wait that's the plan already
12:05:55*krux02 joined #nim
12:08:20PMunchWhat's the status of CPS by the way?
12:13:44FromGitter<Araq> I don't know
12:16:48*nc-x joined #nim
12:18:27FromDiscord<mratsim> Golang made the choice "C and Go" don't mix well.
12:18:56FromDiscord<mratsim> because they choose fibers/stackful coroutines which have a different calling covnention from C
12:19:19nc-xPMunch: disruptek was waiting for compiler bugs to be fixed
12:19:28FromDiscord<mratsim> (Cilk made the same choice for their runtime in 1995 and it's still state of the art for multithreading, Weave has somewhat less overhead but tht's thin)
12:19:43nc-xso cps is on hiatusΒ  as of now
12:19:54FromDiscord<mratsim> also goroutines are unsuitable for compute/memory bound workloads
12:20:24FromDiscord<mratsim> I need to work on some crypto (like I said 2 weeks ago) but I plan to continue working on CPS.
12:21:02FromDiscord<mratsim> @miran / narimiran: when do you think it's suitable to submit this blog post for publishing? https://github.com/weavers-guild/weave-io/blob/master/blog/multithreading_flavors.md
12:23:46FromGitter<Araq> > disruptek was waiting for compiler bugs to be fixed ⏎ ⏎ yeah well, don't do that. if the CPS transformation is beyond the macro system's capabilities, write it as a compiler transformation
12:24:29FromDiscord<mratsim> I think the hard part is following the types in macros
12:24:32narimiran@mratsim oh, thanks for reminding me! i forgot about it in the mean time, sorry
12:24:56FromDiscord<mratsim> the compiler transformation was done.
12:25:17FromDiscord<mratsim> I'd like to see an example of liftLocals / owner use to create custom closure btw.
12:25:32*rockcavera joined #nim
12:26:22FromDiscord<Goel> Is there any public "Roadmap" for Nim future releases in 2021?
12:26:25FromGitter<Araq> tests/fields/tfields.nim
12:27:44FromDiscord<mratsim> @Goel keep an eye here: https://github.com/nim-lang/RFCs/milestones
12:27:58nc-xGoel: the roadmap is mostly polishing the features of 2020 roadmap
12:28:18nc-xarc/orc, ic, not nil, views
12:28:24FromDiscord<mratsim> 2020 milestones where not fully delivered (IC, nil checking) and there is developer tooling for 2021
12:28:28nc-xand if time permits concepts also i think
12:28:43*joast joined #nim
12:29:11FromDiscord<mratsim> I assume nil checking means statically/formally prover not nil
12:29:16FromDiscord<Goel> I was most concerned about the compiler error handling, since im just starting to learn Nim, one of the most common complains on reddit about Nim is about that
12:29:16FromDiscord<mratsim> proven
12:29:40FromDiscord<mratsim> what kind of error handling?
12:29:47FromGitter<Araq> error messages
12:29:48nc-xmratsim https://nim-lang.github.io/Nim/manual_experimental_strictnotnil.html
12:29:51FromDiscord<mratsim> if you have a link to the thread that would be useful
12:30:42FromDiscord<mratsim> AFAIK @haxscramper is reviewing the errors at the moment
12:30:50FromDiscord<mratsim> not sure if it's about the compiler though
12:31:12FromGitter<Araq> why? it's always the same, people try Nim for the first time and blame the compiler's error messages. When they stay they start to complain about threading, concepts, bugs
12:31:49PMunch@Goel, not sure why people still complain about error messages. They have gotten a lot better
12:32:18FromDiscord<mratsim> If everyone does complain maybe there is something we can improve
12:32:34FromGitter<Araq> error messages can always be improved
12:32:48FromGitter<Araq> and most complains have a nugget of truth to them.
12:32:59FromGitter<Araq> the question is how to prioritize development
12:33:05nc-xthe only thing you need to understand about error messages is that if you get more than 1 error, start with the first one. because some of the others might be a consequence of the first error.
12:33:27nc-xthis is the solution of most error message complaints on reddit or github
12:33:41FromDiscord<mratsim> developing without users is useless.
12:33:52FromDiscord<mratsim> we need a balance
12:34:08FromGitter<Araq> and if Nim is really served well by more users who are language hoppers that cannot find information about `-d:release`
12:34:11FromDiscord<mratsim> making stability and polish a focus of 2021 also means addressing common concerns
12:34:17FromDiscord<Goel> I'm not sure about that, but they was saying that is not as detailed as for example in Rust or Golang, but again, since im new to programming i can't compare it with other languages, for sure it can be improved, but they was not "hating" the Nim compiler for the sake of it
12:34:57FromDiscord<mratsim> Well Rust needs very detailed and clear error messages because it tries to shove complex concepts from the get go
12:35:12FromDiscord<mratsim> while in Nim they are more opt in, you get complex concepts when you try to use them.
12:35:40FromDiscord<mratsim> tbh I prefer Nim error messages to python for example
12:35:58*Tlangir joined #nim
12:36:00FromGitter<Araq> also, Nim is an open source project, things we add to the compiler to make our user's lives easier
12:36:06FromDiscord<mratsim> or Java
12:36:20FromGitter<Araq> can make the Nim compiler itself harder to understand and discourage potential compiler developers
12:36:44Clonkk[m]Java error message is mostly "Null Pointer Exception "πŸ˜›
12:36:45FromGitter<Araq> but that's probably just my crappy way of doing compiler development speaking here.
12:36:58FromDiscord<mratsim> as I said, it's a balance. With more users you have a larger user base to get compiler devs from
12:37:13nc-xwell nim community does have plenty of compiler devs
12:37:24nc-xit is just that most of them work for status
12:37:31FromDiscord<mratsim> but not plenty who have time
12:37:34nc-xyeah
12:38:16*Tanger quit (Ping timeout: 240 seconds)
12:38:42FromGitter<Araq> mratsim: does tests/fields/tfields.nim help?
12:38:55FromGitter<Araq> (yeah, that test name is ridiculous)
12:39:36nc-xwell, getting a large user base is pretty difficult. all the hype is going to rust because microsoft and few other big names have adopted it and are forming their own compiler teams as well...
12:40:34FromDiscord<mratsim> @Clyybber https://github.com/fastfloat/fast_float
12:40:58FromGitter<Araq> we should look for a "decently sized" user base before a "large" one :-)
12:41:24FromDiscord<Clyybber> oh, parsing float into string
12:41:36FromDiscord<Clyybber> thanks @mratsim
12:44:18FromDiscord<Goel> By the way, who crowned Nim? (in the Logo) Was it self-crowned like Napoleon did?
12:44:53Clonkk[m]<FromGitter "<Araq> we should look for a "dec"> :wqaq
12:45:56FromDiscord<Clyybber> @Goel the crown came from heaven :p
12:50:54FromGitter<Araq> Goel: it was me...
12:51:11FromDiscord<Goel> Is it always a best choise (performance wise) to use extensivly iterators over Loops?
12:51:26FromDiscord<konsumlamm> @mratsim btw, what's the relationship between weave-io and asyncdispatch? they're both meant for IO workloads, no?
12:51:33PMunch@Goel, it is based on the old name "Nimrod" who was a king
12:52:12FromDiscord<mratsim> No relation, for now weave-io is a stash for my research on multithreading IO workloads.
12:52:21PMunchWell, he was a king in the bible, I don't think he matches any historical figure
12:52:48FromDiscord<Goel> I'm reading about him on wikipedia, thanks for the hint
12:52:56FromDiscord<mratsim> ultimately, we have CPS as a base layer for resumable functions and people can use resumable functions as a primitive building block for schedulers, be it IO or CPU
12:53:02PMunchBut he's commonly associated with the tower of Babel, which was built by a community who all spoke a perfect world language.
12:53:23PMunchWhich I think is how it links to Nim the programming language (please correct me if I'm wrong)
12:53:26FromDiscord<Yardanico> yes, and "nimble" was initially named babel because of that :)
12:53:29FromDiscord<konsumlamm> the biggest problem with error messages imo is type mismatch errors, so i'm glad hax made https://github.com/nim-lang/RFCs/issues/325
12:54:06nc-xwell error messages don't really need rfcs
12:54:19FromDiscord<mratsim> I think they do
12:54:20FromDiscord<konsumlamm> well, it has one anyway
12:54:22nc-xthey need somebody to work on improving them
12:54:29FromGitter<Araq> nc-x: we can be successful in a world where Rust is hyped. In fact, it can be helpful, just imagine having to wrap code that doesn't lie about data types ("yay, a pointer, can it be NULL? is it actually an array in disguise?")
12:54:36FromDiscord<mratsim> consistency between errors really help
12:55:06FromDiscord<mratsim> @konsumlamm here is my current thinking: https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md
12:55:23nc-xAraq: i like the goals of rust, but not the language itself, that's why i am here :D
12:55:33FromDiscord<mratsim> basically decouple the async transformation/resumable functions from the scheduler.
12:55:57FromDiscord<mratsim> embrace that people will likely need custom schedulers (threadpools, weave, asyncdispatch, multithreaded IO, even MPI)
12:56:11FromDiscord<mratsim> and just give them tool to stop/resume computation anywhere.
12:56:20FromDiscord<mratsim> which would be CPS (aka a "continuation)
12:56:50FromGitter<Araq> nc-x: great. but my point is that maybe we should embrace a rust2nim tool
12:56:54FromDiscord<mratsim> or can even use continuation without any scheduler a.k.a iterators
12:56:55FromDiscord<konsumlamm> i like the goals of rust and the language itself, yet i'm here lol
12:57:06FromDiscord<mratsim> https://github.com/arnetheduck/nbindgen
12:58:14FromGitter<Araq> yeah. like that.
13:03:45PMunchHmm, socket.recv(int.high) causes a SIGSEGV (I'm guessing because it tries to allocate a buffer of int.high size which fails and then tries to write to the null pointer of that allocation)
13:04:00PMunchWhat is the correct way of read as much as you can, don't really care how much?
13:04:57PMunch`recv` docs says: "Reads *up to* size bytes from socket." so I assumed that would work..
13:05:35FromGitter<Araq> we cannot detect OOM reliably on unix because of `fork`
13:05:53PMunchBecause of fork?
13:06:12FromGitter<Araq> yeah, unix needs memory overcommits because of fork
13:07:30FromGitter<Araq> it's full of design bugs like that but it's not from evil M$ so let's never talk about it. Worked well for the last 40 years.
13:09:08PMunchAah, I see
13:10:52*mmohammadi9812 quit (Ping timeout: 265 seconds)
13:11:06PMunchI don't really mind that it crashed though, was pretty easy to realise what went wrong
13:11:10*sacredfr- quit (Quit: ZNC 1.8.2 - https://znc.in)
13:11:22*mmohammadi9812 joined #nim
13:11:30PMunchWell, if you know how a computer works. I guess this is why people don't like some of the Nim error messages.
13:11:33*ryanhowe joined #nim
13:11:39PMunchThey see SIGSEGV and get scared
13:12:01FromGitter<Araq> rightly so, but there is a limit for us, we cannot fix OS bugs.
13:12:06PMunchAnyways, what would be the correct way of getting "some chunk of data" from an async socket?
13:12:46FromGitter<Araq> I don't know, use a buffered socket or look how it's implemented
13:13:10PMunchI mean detecting the SIGSEGV and just outputting some canned message as to what might be your issue could help
13:13:28PMunchEven GCC has "Illegal storage access. (Attempt to read from nil?)"
13:14:01FromGitter<Araq> in general sockets lack the notion of "hey, N bytes have arrived, maybe you want to do something with these", instead every protocol reinvents `content-length`
13:14:37PMunchWait, attempt to read from nil is a Nim message isn't it?
13:15:57qwrimho overcommit shouldn't result in SIGSEGV - instead it causes SIGKILL by kernel oom killer
13:17:14FromGitter<Araq> PMunch: yes, it is
13:17:55PMunchYeah I'm not sure if this is actually overcommit. It seems like it's just the equivalent of `char * myptr = calloc(int.high); myptr[0] = 'h';` and that calloc call fails
13:18:33PMunch@Araq, so we could add some more causes there? Attempting to read from nil is something the user very rarely ends up doing in modern Nim
13:19:23PMunchUsed to be more common when strings and seqs where nil, but something like "Trying to access uninitialised `ref` object or accidentally allocating too much memory?" would probably be a more helpful message
13:20:24PMunchI'm guessing there's no way of knowing what exactly triggered the error? So we can't check whether we actually where trying to do `uninitialised.somefield = 100`
13:20:48FromGitter<Araq> we do try to detect OOM
13:21:33PMunchYeah I know
13:21:53PMunchTBH I still think the underlying issue there is that it fails to allocate memory and then tries to access it
13:24:14qwrmmap or brk can return allocation error to program, but with overcommit they give memory pages with no physical memory assigned, that can result in some process being killed if kernel won't find enough physical memory
13:25:13qwrPMunch: could you debug, what exactly happens and causes the SIGSEGV?
13:25:50PMunchint32.high actually works. Quickly consumes about 2Gb of data and then sits idly by waiting for that buffer to fill up :P
13:26:48PMunchhttp://ix.io/2O6j
13:27:36qwrif calloc() gets very big value as argument, then returning NULL is normal (and the return value should be checked)
13:27:44krux02PMunch: info locals, info args, list
13:28:00FromGitter<Araq> qwr: we don't use `calloc`, we use `mmap`
13:28:19FromGitter<Araq> and yeah, we do check its return value
13:28:37qwrOn error, the value MAP_FAILED (that is, (void *) -1) is returned, and errno is set to indicate the cause of the error.
13:29:27qwrPMunch: could you strace whether there is mmap error?
13:30:46PMunch@krux02, http://ix.io/2O6m
13:32:54PMunchHmm, is that negative number because it tries to allocate a string with len = int.high so it tries to add the size of the len and capacity fields to int.high making it wrap around?
13:33:55krux02that could be the case
13:34:24PMunchInteresting
13:34:33krux02the requested size is already negative
13:34:51PMunchNot in the call to rawNewString
13:35:02FromGitter<Araq> usually arithmetic overflow checks are active in these code path though
13:35:02PMunchIt only goes negative when that calls newObj
13:35:37PMunchI don't have any fancy switches on: nim c --debugger:native loadtester.nim
13:35:42*vicfred quit (Quit: Leaving)
13:35:42PMunchAnd no nim.cfg
13:36:31*nc-x quit (Quit: Connection closed)
13:38:02*vicfred joined #nim
13:41:10PMunchChanging it to int.high-65 makes it error out with "out of memory"
13:41:26PMunchBut now with no kind of error message, which is arguably less helpful..
13:41:47PMunchOr no kind of stack trace rather
13:43:33krux02yea I complained about this type of behavior several times. Catching an error and printing a message and quitting the program is much less helpful than letting it crash.
13:46:11FromGitter<Araq> there is `-d:noSignalHandler` that you can use
13:47:19PMunchThat switch didn't seem to do anything
13:47:37PMunchStill just got the "out of memory" message
13:48:06PMunchI mean I don't mind it telling me that it's out of memory, but having the stack trace as well would be nice..
13:48:09FromGitter<Araq> yeah of course. "out of memory" isn't triggered from a signal handler
13:51:01*mmohammadi9812 quit (Read error: Connection reset by peer)
13:51:28*mmohammadi9812 joined #nim
14:01:59PMunchUhm, I just added rate-limiting by adding a `if queriesPerSecond != 0: await sleepAsync(1000/queriesPerSecond)` and it just quits immediately
14:02:07PMunchIs this a bug in async?
14:03:07FromGitter<Araq> I doubt it, `await sleepAsync` is pretty common
14:03:58PMunchI know, I'm confused
14:04:31narimiranPMunch: should this be `1000 div queriesPerSecond`? or do we have a float version too?
14:04:52narimiranah, we have float version too
14:05:01narimiran`proc sleepAsync*(ms: int | float): owned(Future[void]) =
14:05:01narimiran`
14:05:19FromGitter<Araq> yeah it's bad
14:05:26PMunchYeah sleepAsync has a float version
14:05:30PMunchos.sleep doesn't
14:05:34FromGitter<Araq> why have the 'int' version when it does support floats
14:06:17PMunchAh, nvm..
14:06:22PMunchI was just being a dummy
14:16:36*hmmm joined #nim
14:16:40hmmmhallo!
14:19:26PMunchHi hmmm
14:20:07hmmmMuuunchie
14:20:40hmmmhow is not a fisher going? I am on linux now so I'm eager to try it :3
14:21:10PMunchWell it should work fine :)
14:21:27PMunchHaven't worked a whole lot on it lately
14:21:38hmmmis in beta shape? can I trust all my notifications to it?
14:22:24PMunchDepends how important your notifications are
14:22:35PMunchI wouldn't use it for a cardiac arrest alarm
14:22:49hmmmnot much, I have some api meteo that is comfy and hmm I think that's it lol :D
14:23:05PMunchShould be fie
14:23:07PMunchfine*
14:23:13hmmmgimme link :3
14:23:23PMunchhttps://github.com/PMunch/notifishower
14:23:40hmmmHAHAHAHA
14:23:40PMunchAnd you'll probably need notificatcher as well
14:23:40hmmmthat awesome icon :DDD
14:24:03hmmmmunchie u have gud sense of humor, praise to u
14:24:37PMunchHaha, thanks :P I think it was Zevv who created the showerhead though. Mine didn't look very nice..
14:25:27hmmmam I supposed to nimble install it?
14:26:06PMunchI don't think they're in Nimble
14:26:18PMunchClone the repos and `nimble build`
14:26:33*vicfred quit (Quit: Leaving)
14:26:51ForumUpdaterBotNew post on r/nim by doggertron_: Magic has been done., see https://i.redd.it/djvzqsblq2f61.png
14:26:52hmmmwhat am I supposed to do with dunst? they can work toghether?
14:27:38PMunchNope
14:27:47PMunchDunst catches notifications, same as notificatcher
14:27:52PMunchYou need to disable it
14:27:59PMunchOr uninstall I guess
14:28:09hmmmok
14:28:14hmmmwhere do I get notificatcher
14:29:50PMunchhttps://github.com/PMunch/notificatcher
14:29:55PrestigeI think just disabling it is fine?
14:30:21hmmmzevv pro artist
14:30:22PMunchYeah that should be enough
14:31:06PMunchI mean just `killall dunst && ./notificatcher` should work
14:31:15PMunchBut if notificatcher crashes then dunst will be restarted
14:31:28PMunchWhich might be what you want to be honest :P
14:31:42hmmmok will report to you when it's done, if I don't report back my pc took fire and I'm running for my life
14:31:56*Vladar joined #nim
14:33:46PMunchPfft, it's a shower, how is it going to catch fire!
14:35:03narimiran"not if i catch 'er"?
14:35:06*FromDiscord quit (Remote host closed the connection)
14:35:23*FromDiscord joined #nim
14:35:31PMunchThat sounds a bit, uhm, aggressive
14:35:32hmmmno .tif cache her(e)
14:37:16FromDiscord<Bimbo> Hello everyone, i'm trying to implement the hmac-sha1 algorithm in nim by following the specification and pseudocode from the wikipedia page (https://en.wikipedia.org/wiki/HMAC). Even though i think i got it right it produces wrong results. Any help would be appreciated↡↡code: https://play.nim-lang.org/#ix=2O6H
14:39:44FromDiscord<mratsim> good luck debugging crypto code
14:41:06FromDiscord<Bimbo> sigh. and i'm just begginning to learn crypto by implementing it
14:41:15FromDiscord<mratsim> that's how you learn
14:41:20PrestigePMunch: I need to keep working on Nimdow, been slacking... I want to change how floating windows are handled, but it's going to be a bit of a rewrite :x
14:41:22FromDiscord<Zachary Carter> `$secureHash(outPadKey or $secureHash(inPadKey or message))` well
14:41:25FromDiscord<Zachary Carter> that doesn't jive with
14:41:35FromDiscord<Zachary Carter> `return hash(o_key_pad βˆ₯ hash(i_key_pad βˆ₯ message))`
14:41:36Prestigelooking at how dwm does it, is a bit hacky. But at least it works I guess
14:41:36FromDiscord<Zachary Carter> for one
14:41:38FromDiscord<konsumlamm> when you just say crypto, do you mean cryptography or cryptocurrencies?
14:41:57FromDiscord<Zachary Carter> (edit) "or" => "and" | "or" => "and" | removed "well"
14:41:58FromDiscord<mratsim> yes, in crypto spec || is equivalent to append
14:42:01FromDiscord<Zachary Carter> sorry I fixed my message
14:42:03FromDiscord<mratsim> not binary "or"
14:42:05FromDiscord<Zachary Carter> oh
14:42:08FromDiscord<Zachary Carter> dafuq
14:42:17FromDiscord<mratsim> so "add" is correct
14:42:34FromDiscord<mratsim> @konsumlamm depends on the context, I work in both :p
14:43:46hmmmok the catcher works it's sending stuff
14:43:53hmmmthe fisher is silent
14:43:53FromDiscord<mratsim> std/sha1 has broken interface :/ you shouldn't use `$` it converts to hex
14:44:00hmmmmaybe I need to configure it?
14:44:08PMunchPrestige, how does it work now?
14:45:00PMunchhmmm, probably
14:45:12FromDiscord<Bimbo> Since sha1digest is a seq[uint8] should i convert it manually instead of using `$`?
14:45:41FromDiscord<mratsim> you create your own seq[uint8] and append directly as uint8 inside
14:45:49FromDiscord<mratsim> and only at the end for display you convert to byte
14:46:14PMunchhmmm, did you just do `notificatcher --run notifishower`?
14:46:29PrestigePMunch: atm floating windows are stacked based on how recently they were focused, so if your mouse hovers a floating window, it's brought to the top (you can't click a window to focus it, is the main issue I need to resolve, to change this behavior)
14:46:45PMunchAah
14:46:48PMunchI see
14:46:52FromDiscord<mratsim> @Bimbo if you want to play with a well tested and proper interface for crypto in Nim I suggest you use this file for SHA2: https://github.com/mratsim/constantine/blob/master/constantine/hashes/h_sha256.nim#L214
14:47:06PrestigeEssentially https://github.com/avahe-kellenberger/nimdow/issues/127
14:47:18PMunchDamn 127 issues already, not bad
14:47:23FromDiscord<mratsim> testing vs OpenSSL is here: https://github.com/mratsim/constantine/blob/master/tests/t_hash_sha256_vs_openssl.nim
14:47:37PrestigePMunch: thanks, lol. Only 13 open, mostly by myself iirc
14:47:41FromDiscord<Bimbo> I'll look into it, thanks!
14:47:45FromDiscord<mratsim> it also uses byte instead of uint8
14:48:08FromDiscord<mratsim> I suggest you implement hex<-> string conversion yourself as a learning experience
14:48:35PMunchI guess you should also take into account parent windows
14:48:46PMunchOr TRANSIENT_FOR or whatever it's called in X11 terms
14:49:00PMunchSo a dialog box is never rendered behind its parent
14:49:12Prestigehm true
14:49:13FromDiscord<Bimbo> Will probably do, for the time being i'm trying to learn how HOTP/TOTP works
14:49:30PrestigeI could handle that with out the rewrite
14:49:30FromDiscord<mratsim> otherwise I have them here: https://github.com/mratsim/constantine/blob/master/constantine/io/io_bigints.nim#L309-L408↡↡or you can nimble install stew and use import stew/byteutils
14:49:46FromDiscord<Bimbo> since small projects are ideal for learning i'm making a totp generator for the time being, that's how i stumbled upon hmac_sha1
14:49:50PrestigeI forget why click to focus was going to be a PITA
14:50:02FromDiscord<Bimbo> thanks for the resources
14:59:19PMunchHmm, can I run async stuff in one thread?
14:59:31FromDiscord<konsumlamm> suddenly everyone is starting to follow me on github lol
15:01:25FromGitter<Araq> you're a wizard arry
15:04:40FromDiscord<konsumlamm> are you french now?
15:05:19FromDiscord<inv> Hello, hello,↡↡Can someone please remind how to make optimization by template? Example: https://play.nim-lang.org/#ix=2O6V
15:05:20FromGitter<Araq> no, it was a typo
15:06:01FromDiscord<inv> (edit) "Hello, hello,↡↡Can someone please remind how to make optimization by template? ... Example:" added "- Cannot find example except in experimental, but it does not work."
15:06:47*PMunch quit (Quit: leaving)
15:07:10FromDiscord<Bimbo> how do i convert a byte array to a string correctly, is casting to string a good idea? i tend to avoid it
15:08:28FromDiscord<inv> I remember copyMem helps here
15:09:19FromGitter<Araq> inv: pattern matching against the bracket access won't work anytime soon
15:09:31FromDiscord<Bimbo> oops, for clarification i mean seq[byte] if that makes any difference
15:10:03FromGitter<Araq> Bimbo: casting between seqs and string is so common that even the new runtime supports it out of the box
15:10:19FromGitter<Araq> ideally we would have a builtin for that though
15:11:39FromDiscord<Bimbo> ah i see, that's good
15:13:07FromDiscord<inv> if the problem is in [idx], let me create pattern without it: https://play.nim-lang.org/#ix=2O72 but I see it calls "asc" again
15:13:42*icebattle joined #nim
15:14:51*hmmm quit (Quit: WeeChat 3.0)
15:15:26FromDiscord<inv> I changed template from ``x: openArray`` to ``untyped`` and it works now. yeehoo!
15:17:26FromDiscord<mratsim> byte array to string: https://github.com/status-im/nim-http-utils/blob/5dfbe9ba68e97bce01a41096b764bd5a8d6fb011/httputils.nim#L546-L557
15:18:04FromDiscord<mratsim> casting will cause problem if you interop with C because the original byte array isn't `\0` terminated
15:18:14FromDiscord<mratsim> while Nim strings should be
15:18:24*mbomba joined #nim
15:19:36FromGitter<Araq> very good point but not every string interops with C
15:19:40FromDiscord<Bimbo> It's nim only so i should be safe when casting right?
15:20:13FromDiscord<mratsim> you never know when what you write, especially for protocols, need to interop with C for say IO
15:21:08FromDiscord<mratsim> if you use stdout.write for example I think you will read past the buffer
15:21:27FromDiscord<mratsim> though stdout.write shouldn't be used for crypto because crypto strings can be \0
15:22:08FromDiscord<Bimbo> well yeah that's true. I'll use the proc you referenced.
15:22:31FromDiscord<Bimbo> stdout.write removes the trailing `\0`?
15:22:59FromDiscord<mratsim> it calls libc/glibc underneath that uses C strings
15:23:05FromDiscord<mratsim> and C strings are terminated by \0
15:23:17FromDiscord<mratsim> so if your hashing creates a \0 somewhere
15:23:31FromDiscord<mratsim> it will interrupt printing for C lib πŸ˜‰
15:23:47FromDiscord<mratsim> Nim `echo` is fine
15:24:06FromDiscord<mratsim> but for printing I just use stew/byteutils
15:24:37FromDiscord<mratsim> I recommend you de everything as seq[byte] and only use "toHex" at the end for debugging.
15:24:43FromDiscord<mratsim> (edit) "de" => "do"
15:25:24FromDiscord<mratsim> if you're stuck here is a production-grade hmac implementation: https://github.com/cheatfate/nimcrypto/blob/master/nimcrypto/hmac.nim
15:26:15FromDiscord<mratsim> and here is how to use it to implement HKDF: https://github.com/status-im/nim-blscurve/blob/master/blscurve/eth2_keygen/hkdf.nim
15:26:32FromDiscord<mratsim> Those were reviewed by security auditors
15:26:47FromDiscord<mratsim> and cryptographers
15:28:59FromDiscord<mratsim> if you're still stuck after a couple of hours, ping me, I can help check @Bimbo
15:31:36*hmmm joined #nim
15:33:35FromDiscord<Bimbo> Thanks a lot! will do if i need help. Also on another note before i tried making an otp implementation i searched on https://nimble.directory for hmac/otp libs and found some that were somewhat difficult to understand since i'm a begginner in cryptography.
15:34:17*fanta1 quit (Quit: fanta1)
15:37:15FromDiscord<Bimbo> i could try to contribute libraries for crypto in this area that people could use like python/go has base32/hmac/otp
15:46:12FromDiscord<mratsim> I want to do an OTP app as well because I don't really like google authenticator and authy.
15:46:56FromDiscord<mratsim> but I'm too busy :p
15:47:59FromDiscord<Bimbo> Same here, i'd prefer a cli tool for it, and that's what i'm trying to make right now since i have some time in my hands.
15:48:04FromDiscord<mratsim> Maybe you could have a look at this book: https://web.engr.oregonstate.edu/~rosulekm/crypto/
15:48:15FromDiscord<mratsim> This is a WIP book on crypto for undergraduate student
15:48:21FromDiscord<mratsim> I've heard good review
15:49:30*vicfred joined #nim
15:49:55FromDiscord<Bimbo> I've heard of this book before. Since it's a good opportunity I'll probably give it a read
15:51:46FromDiscord<Zachary Carter> Speaking of books - has anyone ever read https://beginners.re/main.html ?
15:55:22FromDiscord<mratsim> no
15:55:46FromDiscord<mratsim> for understanding assembly I read the hardware manual though (6502, ARM or Intel)
15:58:59FromDiscord<Bimbo> haven't done much assembly nor read books about it except that one uni course i had about RISCV assembly
15:59:35FromDiscord<mratsim> it's strange but low-level crypto requires assembly
15:59:39FromDiscord<mratsim> for both security and speed
15:59:55FromDiscord<Zachary Carter> yeah - I think that might be a bit too hardcore for me @mratsim I need something to fill knowledge gaps
15:59:58FromDiscord<Zachary Carter> maybe this book will be good
16:00:03FromDiscord<mratsim> https://github.com/mratsim/constantine/wiki/Constant-time-arithmetics
16:00:29FromDiscord<mratsim> when you're tired of coding crypto, I've collected fun crypto attacks/vulnerabilities ^
16:01:47FromDiscord<haxscramper> Right now I'm not working on error messages in any way except for maybe thinking it over. There is no shortage of ideas of how they could be made nicer, but what I'm lacking is general understanding of how to actually implement them.
16:02:05FromDiscord<haxscramper> So I'm waiting on `nkError` RFC from @Araq
16:02:16FromDiscord<mratsim> My point is that a single architect is good for errors
16:04:17FromDiscord<haxscramper> The biggest problem is (in general) beating more information out of compiler and making it think more when something is not working. Type mismatch errors are the most notable ones though
16:04:38FromDiscord<Avatarfighter> o7 nice to see you all
16:05:13FromDiscord<Zachary Carter> o/
16:11:37*waleee-cl joined #nim
16:17:36FromDiscord<Clyybber> o/
16:19:35FromDiscord<haxscramper> But if I understand correctly it won't be a priority really until IC is done, and there are still more important things to implement
16:32:06FromDiscord<Clyybber> @mratsim Do you have an example of a proc not working in a generic thats similar to https://github.com/nim-lang/Nim/issues/7632 ?
16:36:02*mmohammadi9812 quit (Remote host closed the connection)
16:36:25*mmohammadi9812 joined #nim
16:36:33*irchaxwell_zzz joined #nim
16:37:30*a_chou joined #nim
16:37:58FromDiscord<Clyybber> ah, managed to repro by reverting the changes
16:41:01*irchaxwell_ quit (Ping timeout: 272 seconds)
16:51:21FromDiscord<Clyybber> Araq: To fix generic symbol resolution: WDYT about attaching the declaration scope to the generic? Then when a generic is instantiated we mix can lookup symbols from both the declaration scope and the instatitation scope.
16:55:06*a_chou quit (Remote host closed the connection)
16:55:23*a_chou joined #nim
16:55:30FromDiscord<konsumlamm> if a parameter `d` is of type `T` (where `T: float32 | float64`), doing `T(d)` should have no effect, right?
16:57:03planetis[m]it might output a warning but afaik not for generics
16:57:39FromGitter<Araq> haxscramper: no need to wait, we already use `nkEmpty` for this purpose
16:58:09*mmohammadi9812 quit (Ping timeout: 264 seconds)
16:59:58FromDiscord<konsumlamm> specifically, this line: https://github.com/nim-lang/Nim/blob/1d1c831efa7f9bfcc739b2d38a3a839187bc39c6/lib/pure/math.nim#L1085
17:01:05FromDiscord<haxscramper> @Araq from what you said earlier I though `nkError` could be a new way of handing errors
17:01:59FromGitter<Araq> sorry, you need nkError indeed
17:02:00planetis[m]lol good catch, it should have been T(RadPerDeg) instead
17:02:23planetis[m]imo
17:02:25FromGitter<Araq> but it's a one line addition plus some plumbing code
17:02:36FromGitter<Araq> I can guide you if you want
17:06:07FromDiscord<konsumlamm> planetis: sounds right
17:06:52*irchaxwell_ joined #nim
17:07:22FromGitter<haxscramper> First I need to finally study compiler implementation instead of just poking at random places. But if you could share your ideas on how `nkError` should be working (in cases of type mismatch, user-defined errors in macros (or however else it might be called)) I could probably take it from there. ⏎ ⏎ I've discussed this with saem in `#internals` yesterday, and for now my general understanding is ⏎ ⏎ > So
17:07:22FromGitter... for example if I have type mismatch, instead of reporting it almost immediately with liMessage it would create nkError with necessary information, like symbols that were considered for overload resolution [https://gitter.im/nim-lang/Nim?at=601986ca0eed905f18897eb0]
17:07:44FromDiscord<Clyybber> @Araq To fix generic symbol resolution: WDYT about attaching the declaration scope to the generic? Then when a generic is instantiated we mix can lookup symbols from both the declaration scope and the instatitation scope.
17:08:28FromGitter<Araq> Clyybber: that was @zah's solution too but we don't have "scope as first class entity" in Nim
17:08:37FromGitter<haxscramper> I could probably figure out plumbing code myself, but I'm more concerned with staying in sync with your current vision how to build error handling on top of `nkError`
17:08:38*mmohammadi9812 joined #nim
17:08:52FromGitter<Araq> only now after my IC refactorings we can define what "scope" should be
17:09:04FromDiscord<Clyybber> Araq: Cool
17:09:13FromGitter<Araq> only now I can estimate the costs
17:09:16*irchaxwell joined #nim
17:09:57FromGitter<Araq> @haxscramper dinner here, will tell you afterwards
17:10:14FromGitter<Araq> but yes, patching liMessage is the general idea
17:11:25*irchaxwell_zzz quit (Ping timeout: 272 seconds)
17:11:47*irchaxwell_zzz joined #nim
17:12:03*irchaxwell_ quit (Ping timeout: 272 seconds)
17:13:23*irchaxwell_ joined #nim
17:14:35*irchaxwell quit (Ping timeout: 272 seconds)
17:17:07*irchaxwell_zzz quit (Ping timeout: 272 seconds)
17:23:27ForumUpdaterBotNew question by Juergen: Nim: work with read-only memory mapped files, see https://stackoverflow.com/questions/66014574/nim-work-with-read-only-memory-mapped-files
17:54:04Oddmongeri have a function which search and return an object, but i's like to return null object when nothing is found
17:54:12Oddmongershould i use a ref ?
17:54:41FromDiscord<Recruit_main707> afaik it doesnt really matter
17:55:13FromDiscord<Recruit_main707> its as unsafe as a pointer if you use nil
17:56:58Oddmongerwhat i mean is i cannot Β« return nil Β» as :Object is expected
17:57:18FromDiscord<InventorMatt> this sounds like something you could use the options module for
17:57:57FromDiscord<zetashift> Options or make a Variant?
17:58:44FromDiscord<Recruit_main707> doesnt Option use refs under the hood
17:58:59leorizeno, Option is a variant object
17:59:04Oddmongeror may be :ref Object , with nil that could be returned ?
17:59:20leorizeuse Option unless you want it to be on the heap
17:59:49Oddmongeri try with nim playground
18:02:51FromDiscord<mratsim> Option has an optimization for ref object which avoids having an extra field
18:02:56FromDiscord<mratsim> but it doesn't use refs
18:10:43Oddmongerwell i was thinking of something like this:
18:10:45Oddmongerhttps://play.nim-lang.org/#ix=2O7Z
18:12:29*tiorock joined #nim
18:12:29*rockcavera is now known as Guest36965
18:12:30*Guest36965 quit (Killed (card.freenode.net (Nickname regained by services)))
18:12:30*tiorock is now known as rockcavera
18:12:36FromDiscord<dom96> hello all
18:12:42FromDiscord<zetashift> Hiya dom
18:14:33*rockcavera quit (Read error: Connection reset by peer)
18:15:00FromDiscord<mratsim> you need either `new result; result[] = foo` or `result = (ref Foo)(); result[] = foo` @Oddmonger
18:15:04*rockcavera joined #nim
18:15:27FromDiscord<mratsim> but using Ref shouldn't be about allowing Nils
18:15:32FromDiscord<mratsim> use options for that
18:15:49FromGitter<timotheecour> @Araq ⏎ ⏎ > Clyybber: that was @zah's solution too but we don't have "scope as first class entity" in Nim ⏎ ⏎ we do, with https://github.com/nim-lang/Nim/pull/11754 [https://gitter.im/nim-lang/Nim?at=601996d5063b6c68d5348924]
18:15:53FromDiscord<mratsim> ref is about modeling unique values that are not copied
18:16:17FromDiscord<mratsim> non-fungible to be precise
18:16:23Oddmongerok i look options then, thank you
18:16:32FromDiscord<mratsim> like you can't replace a person by another, even if they have the same number of arms and legs
18:16:42FromDiscord<mratsim> but you can replace a dollar by another
18:16:59FromDiscord<mratsim> and in programming you can't replace a session by another
18:17:06Oddmongerbecause they have no legs ?
18:17:12*Oddmonger is not sure to understand
18:17:14FromDiscord<mratsim> or a database handle by another.
18:17:21FromDiscord<mratsim> because they are unique
18:17:31Oddmongerah ok with the handle i understand
18:18:28FromDiscord<dom96> So today I learned that my game can be played on a watch. How crazy is that? https://media.discordapp.net/attachments/371759389889003532/806227037647142947/image0.jpg
18:18:54FromDiscord<lqdev> welcome to 2021
18:20:18Oddmongeri wish i had such a watch when i was a kid … or maybe not, i would have waste my time in playing :)
18:21:44Oddmongerhaha i like the sample for options module in the doc, with the needle lost in a haystack
18:22:15FromDiscord<Recruit_main707> cyberpunk music starts playing
18:22:18FromDiscord<IndianGoldSmith> Hi, How to return a named tuple from a proc ?
18:24:12FromGitter<Araq> @timotheecour yeah well. IMO it was a good decision to see how the lazy scope module imports work out before we reify scopes further
18:25:43FromGitter<Araq> you can blame me for being too cautious, I don't mind
18:27:16*mmohammadi9812 quit (Ping timeout: 240 seconds)
18:27:50*mmohammadi9812 joined #nim
18:31:05*haxscram` joined #nim
18:31:08FromGitter<timotheecour> FWIW I’ve implemented in a private branch a lazy import scheme where symbols are just populated in a symbol table but not semchecked until used, which allows cyclic imports and faster compilation, it was working at the time but that branch would need to be revived.
18:31:36*haxscram` quit (Remote host closed the connection)
18:32:00*haxscram` joined #nim
18:32:20FromGitter<Araq> cyclic imports are still hell for me regarding IC
18:32:24*haxscram` left #nim (#nim)
18:32:36FromGitter<Araq> I think I figured it out but we'll see about that
18:33:05FromGitter<Araq> lazy sem'checking is not correct, it's crucial that you sem'check the proc *header* independently from the proc body
18:33:39FromDiscord<mratsim> @dom96 there is a Facebook team just for you: https://facebookresearch.github.io/CompilerGym/getting_started.html
18:33:57FromGitter<Araq> once you do that, the design is quite decent but needs to nail down cases like
18:33:59FromGitter<timotheecour> but if the symbol isn’t used, there is no inconsistency in not semchecking proc header
18:33:59FromDiscord<mratsim> optimizing compiler "Gym" to train optimizations πŸ˜‰
18:34:13FromGitter<Araq> proc p(a: typeof(q)); proc q(b: typeof(p))
18:34:59FromGitter<Araq> and that's an easy case.
18:35:13FromGitter<timotheecour> but if no code uses `p`, which does it matter?
18:35:27FromDiscord<Recruit_main707> @IndianGoldSmith like this: `proc divmod(a, b: int): tuple[res, remainder: int] =`
18:35:28FromGitter<Araq> you also need to specify how polyfills can work: ⏎ ⏎ ```when not declared(foo): proc foo ...``` [https://gitter.im/nim-lang/Nim?at=60199b70a0246860dc28b3c2]
18:36:29FromGitter<Araq> > but if no code uses `p`, which does it matter? ⏎ well it's an illegal recursion either way, no matter if used or not
18:37:06FromGitter<haxscramper> @Araq I'm ready to hear your ideas on `nkError` when you have time
18:37:07FromGitter<timotheecour> `declared(foo)` doesnt’ require semchecking `foo`, it only requires knowing that `foo` is in scope
18:37:18FromDiscord<dom96> @mratsim epic, don't think I have the AI chops for it though
18:37:49FromDiscord<mratsim> meh, RL can be learned
18:37:57FromDiscord<mratsim> I don't think it's harder than learning how to program
18:38:02FromDiscord<mratsim> it all begin with a CartPole
18:38:05*rockcavera quit (Ping timeout: 265 seconds)
18:38:17FromDiscord<mratsim> https://gym.openai.com/
18:38:19FromGitter<Araq> @haxscramper I'm preparing a PR instead
18:38:23FromGitter<timotheecour> > illegal recursion either way, ⏎ ⏎ I’m not checking against illegal recursion, such errors would be caught on 1st use; that’s crucial to make the lazy scheme indeed lazy, efficient, and cyclic
18:39:02FromDiscord<Clyybber> @timotheecour I think it's best if that happened behind the scenes
18:39:45FromDiscord<Clyybber> So that every generic has an attached scope of its declaration context
18:40:03FromDiscord<IndianGoldSmith> @Recruit_main707 Thank you for the reply
18:40:22*a_chou quit (Ping timeout: 256 seconds)
18:40:40stefantalpalaruI'm trying to cross-compile from Linux to Windows, and I need different path separators at compile time and at runtime. Did anyone solve this problem?
18:40:53FromGitter<Araq> well I'm only bringing up examples that an RFC should address. There are phase ordering problems. These plague D's implementation or have plagued it. We should be as clear as possible how it works. I do mind hiding everything as "implementation details"
18:43:05FromGitter<Araq> stefantalpalaru: x.replace("\\", "/")
18:44:51FromDiscord<Recruit_main707> \ also works in windows, what happens if you use a raw string (`r""`)
18:48:56*rockcavera joined #nim
18:52:38*a_chou joined #nim
18:53:42*rockcavera quit (Ping timeout: 258 seconds)
18:59:50FromDiscord<Bimbo> @mratsim (sorry for the ping) Thanks for the tips and resources, i managed to get it working but i had to modify the assertions in the `toString` proc i got from nim-http-utils as it couldn't parse the whole string otherwise. This is probably an error on my part but i'm not sure yet.↡↡Code: https://play.nim-lang.org/#ix=2O8i
19:00:06FromDiscord<Bimbo> (edit) "string" => "byte seq"
19:00:39FromDiscord<mratsim> the assertions seem correct
19:00:47FromDiscord<mratsim> maybe mine were wrong I don't see the difference
19:00:51FromDiscord<dom96> @mratsim did you have any notes on cancellation from your research into CPS/async?
19:00:58FromDiscord<dom96> (edit) "did" => "do"
19:01:20FromDiscord<mratsim> like Rust, don't run a continuation and your code is cancelled
19:01:28FromDiscord<dom96> The context is https://github.com/nim-lang/Nim/pull/16769
19:01:41FromDiscord<dom96> I want to learn more so I'm not reviewing this blindly
19:01:57FromDiscord<mratsim> if there are resources to free, like Go it's cooperative, you need a channel after sync point that the routine will check to know if it should give up
19:02:30FromDiscord<mratsim> best resource on Async cancllation i found is here: https://github.com/weavers-guild/weave-io/blob/master/research/async_await_cancellation_rust_matthias247.md
19:02:50FromDiscord<mratsim> https://gist.github.com/Matthias247/ffc0f189742abf6aa41a226fe07398a8
19:02:56FromDiscord<dom96> nice, thanks
19:03:15FromDiscord<mratsim> Note that it's for Rust readiness model so current async doesnt have the same challenges
19:03:54FromDiscord<mratsim> but basically, anything beyond cooperative cancellation will create difficulties
19:04:21FromDiscord<mratsim> and I think the best way forward is having nice syntax sugar to create an async proc with a channel to communicate a cancellation token if needed
19:04:22FromDiscord<dom96> would love your thoughts on that PR as well if you have the time
19:07:13FromDiscord<mratsim> My main question is: suppose I have a handle to some special resource (database, socker, GPU memory, file). I cancel a future read.
19:07:23FromDiscord<mratsim> What happens with this PR?
19:07:30FromDiscord<mratsim> (edit) "socker," => "socket,"
19:08:13*hmmm quit (Quit: WeeChat 2.8)
19:10:28FromDiscord<inv> question: As soon as I move my optimization template template t{first asc x} - it stops to work. Why?
19:10:45FromDiscord<inv> (edit) "question: As soon as I move my optimization template template t{first asc x} ... -" added "into module"
19:11:43FromDiscord<dom96> @mratsim good question, I'm not 100% sure but I think it depends on what platform you're on. On Windows the read operation won't get cancelled, on everything else it will but some of it may have already partially completed.
19:12:00FromGitter<Araq> @haxscramper https://github.com/nim-lang/Nim/pull/16915/files
19:13:51FromDiscord<mratsim> It's mostly what do we do with the resource that the future was managing, if they had a finalizer, we're good, but in many cases the application might have some kind of ceremony even just logging "shutting down". And we need some way to tell the API to do that ceremony
19:13:55FromDiscord<dom96> To be fair, this PR seems to be more about just making sure if you have a chain of futures, and they're all waiting on a future that is next in the chain, that if the last in the chain is cancelled that the whole chain gets cancelled
19:13:59FromDiscord<mratsim> it can be a channel or a cancellation callback
19:14:07FromDiscord<mratsim> I see
19:14:38FromDiscord<mratsim> then that's OK, but cancellation in general is 80% design, 20% tech
19:15:09FromDiscord<mratsim> note: I didn't implement cancellation, neither in Weave, nor in an async framework so I might be wrong.
19:15:19FromDiscord<mratsim> but that's what I'm concluding from my research
19:19:55FromGitter<Araq> @haxscramper and then you need to replace `liMessage` etc calls with `errorhandling.newError`
19:21:10FromGitter<Araq> my sempass2.nim addition will pick up the errors
19:21:26FromDiscord<Goel> So Nim uses 'Nil' for my understanding, but is that the same as 'Null' in C and C++?
19:21:45FromDiscord<lqdev> yes.
19:22:47FromGitter<haxscramper> @Araq got it. Now more specific use-case: for example I have failed type mismatch for a node: when `semOverloadedCall` fails (after all re-tries) it is now calling `notFoundError` which collects all necessary signatures and then passes everything to `localError()`. With new style I instead should replace the failed call with `nkError()` - how exactly all type mismatches would be reported in the end then? E.g. I just
19:22:47FromGitter... don't exactly follow where do I need to store all information about particular error that happened
19:23:05FromDiscord<Goel> Why a different name though? If they are the same thing, i don't understand
19:23:47leorizenim has a writh's language heritage, and the name `nil` is used in those
19:23:52leorizethat would be my guess
19:23:54FromGitter<haxscramper> Because for better diagnostics I think I need to have access to all scopes/identifiers, original node with error etc.
19:26:54FromDiscord<mratsim> With nil we can say that Nim has no null pointers :p
19:28:41FromDiscord<haxscramper> gitter -> discord messages are not fully transferred (works in IRC though)
19:29:57*icebattle quit (Ping timeout: 264 seconds)
19:33:11*irchaxwell_zzz joined #nim
19:37:02*opal quit (Remote host closed the connection)
19:37:05*irchaxwell_ quit (Ping timeout: 272 seconds)
19:37:41*opal joined #nim
19:37:56*tane joined #nim
19:45:45*mmohammadi9812 quit (Ping timeout: 240 seconds)
19:48:35FromGitter<haxscramper> The same goes for all other errors - things like effect annotation tracking, field assigns etc. - IIUC they have different contexts that are important to provide good messages.
19:51:26*mmohammadi9812 joined #nim
19:52:27saemHax: one option for storing the info is in the error node, or hanging off of it, but I'm not sure that's a great way to do it with packed AST. I'd personally try the change and see how painful it is and what the results imply. It presently makes sense as a ill formed AST is still useful if that's what the state of a module is presently, for intermediate states that nimsuggest and friends encounter.
19:54:18FromGitter<haxscramper> My original idea was to patch `liMessage` with separate 'error object' that has all necessary references, but does not modify AST itself
19:55:13FromGitter<haxscramper> With `nkError` I can just store new `ErrorDescription` in AST (variant object for different error kinds/contexts)
19:56:25*hmmm joined #nim
19:56:30FromGitter<haxscramper> But basically the goal is to have zero context/information loss between `semOverloadedCall` and `errorToString`
19:56:40saemThe latter sounds better but I'm out on a limb. As the AST is what "everything" works on.
19:57:19FromGitter<haxscramper> And then in `errorToString` I can just plug in all my diagnostic smartness
19:58:15saemTying it to the pass context or anything like that seems off because where it occurs and when you report are plenty far apart.
19:58:30*icebattle joined #nim
19:59:19FromGitter<haxscramper> As I understand now there are only two options - deal with error immediately (and maybe ignore almost all context as it is done now)
19:59:27FromGitter<haxscramper> Or deal it somewhere else while passing context
20:00:00*icebattle quit (Client Quit)
20:00:44saemMy instinct and I can't think of anything to the contrary not recall conversations suggesting otherwise is: nkError AST node, old busted AST under it and error information too.
20:03:45*wgetch joined #nim
20:04:10FromGitter<haxscramper> This is close enough to what I'm suggesting, isn't it? "and error information too." is basically `ErrorDescription`. Maybe it wasn't clear, but I wanted to do something like `of nkError: description: ErrorDescription` - additional branch in `TNode`
20:04:26FromGitter<haxscramper> And old node can be added too of course
20:09:29saemThat works, I don't remember if there is much consequence to adding another variant vs say a flag. But another option would be error node has first son as the old tree and the rest of the sons as details nodes, marked with a flag. That could ask be silly and a later refactor.
20:09:47saems/ask/all
20:10:28saemI don't have a great intuition about performance (mostly memory) in this case.
20:11:26saemYour approach sounds good and this could be sorted in a PR.
20:12:51FromGitter<haxscramper> I have absolutely no idea how to shove all information that I need into "detail nodes" - for example type mismatch: I can put all candidates into sons, no problem. But how do I know type mismatch actually happened? Or what scope it was in - I want to show MCS-related errors
20:13:44FromGitter<haxscramper> Or mutability annotations - if I have high level of confidence that type mismatch is caused by var annotation
20:15:09FromDiscord<inv> Can I ask about type inference for lambdas or it is immediate ban here? πŸ™‚
20:16:06FromDiscord<inv> I heard about some kind of new type-system in the future, but not so sure about it
20:17:00saemHax variant seems much better
20:17:44FromGitter<haxscramper> Thoug at the second though it might work as a starting solution
20:19:19FromGitter<haxscramper> Since I will be basically running my own semcheck again to score all candidates
20:19:46FromDiscord<haxscramper> IIRC There is a limited type inference for lambdas in form of `any`
20:20:08FromDiscord<haxscramper> No, there are not plans to change type system AFAIK now or ever
20:20:25FromGitter<krux02> haxscramper: what exactly do you want to do?
20:20:32FromGitter<krux02> own semantic checking?
20:21:08FromDiscord<inv> Do you mean typeinfo? Could you please explain how it goes into lambdas? I would like to avoid some typed in lambdas
20:21:25FromGitter<haxscramper> https://github.com/nim-lang/RFCs/issues/325 - Scored type mismatch listing
20:21:34FromGitter<haxscramper> @krux02 ^
20:21:45saemScoring candidates is already done isn't it? I might be remembering bits of scoring from suggest vs overload resolution
20:22:36saemOh, maybe it's a matter of leveraging that info/analysis again or faulty memory on my part
20:22:47FromGitter<haxscramper> I don't think it is done now
20:23:01FromGitter<haxscramper> Maybe it is, but so badly it is barely noticeable
20:24:11FromGitter<haxscramper> And yes, it is about re-using mismatch information for better error messages (like "first argument is mutable, make your variable declared <here> a `var` (currently declared as `let`)"
20:27:37*hmmm quit (Quit: WeeChat 3.0)
20:30:31FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2O8Z
20:31:00FromDiscord<haxscramper> I also realized `nkError` could be used to make `expandMacros` work even with failed semcheck
20:31:11FromDiscord<inv> But the issue is open - do you mean I can expect it will change in the future?
20:31:26FromDiscord<haxscramper> Which is an absolute game changer for usability of it
20:31:37FromDiscord<haxscramper> What issue?
20:31:53FromDiscord<inv> RFCs/issues/325
20:31:55FromDiscord<konsumlamm> it uses `auto`, not `any` afaik
20:32:37FromDiscord<inv> I thought the same
20:33:31FromDiscord<haxscramper> Maybe they are interchangeable for this use case - https://nim-lang.org/docs/manual.html#types-auto-type "For parameters it currently creates implicitly generic routines:"
20:35:08FromDiscord<haxscramper> It is not really related to type system/`auto`/`any`
20:35:38*letto quit (Quit: Konversation terminated!)
20:35:56FromDiscord<inv> auto works perfect, but lambdas want types for params also
20:36:12FromDiscord<mratsim> Is there even a use-case for Any?
20:36:31FromDiscord<mratsim> it requires RTTI so is incompatible with --gc:arc no?
20:37:39*letto joined #nim
20:39:38FromDiscord<inv> Cannot make it work with any, or auto or generic: https://play.nim-lang.org/#ix=2O90
20:40:18FromDiscord<inv> And I did not expect it work, but a bit unclear will RFC 325 change it somehow or not
20:41:02FromDiscord<haxscramper> No it won't
20:41:54*NimBot joined #nim
20:42:29FromDiscord<haxscramper> It is strictly concerned with improving representation of type mismatch errors under current implementation of the type system.
20:48:49*Prestige quit (Quit: Prestige)
20:49:15*Prestige joined #nim
20:54:59FromDiscord<haxscramper> I just imagined how cool it would be to just use `expandMacros` on something like https://play.nim-lang.org/#ix=2O95 and immediately see which generated node produces error
20:57:04FromDiscord<Clyybber> saem, @haxscramper scoring is done for nimsuggest only
20:57:35FromDiscord<Clyybber> But it should be relatively easy to do it in call mismatch messages too
20:57:48FromDiscord<Clyybber> We already sort these for easier testing
20:57:48FromGitter<timotheecour> @mratsim ⏎ ⏎ > *<FromDiscord>* <mratsim> Is there even a use-case for Any? ⏎ ⏎ see https://github.com/nim-lang/RFCs/issues/281, looks like it’s uninamously going the way of the dodo [https://gitter.im/nim-lang/Nim?at=6019bccb32e01b4f716e53f5]
20:59:12FromDiscord<mratsim> voted as well
21:10:09FromGitter<Araq> @haxscramper I'll patch 'notFound' so that you can see how it works
21:12:09*liblq-dev quit (Ping timeout: 246 seconds)
21:18:30*i_use_arch_btw[m joined #nim
21:18:43FromDiscord<brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=2O9g
21:19:15FromGitter<Araq> in general you use the nkError's children to encode whatever you need to encode much like PNode would be a JsonNode
21:22:35FromDiscord<Recruit_main707> @brainproxy use parenthesis?
21:23:11FromDiscord<Recruit_main707> Unless you want they actual proc
21:25:53FromDiscord<brainproxy> yes, actual proc
21:26:08FromDiscord<brainproxy> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2O9l
21:26:21*hmmm joined #nim
21:30:11FromDiscord<zidsal> I'm writing a unit test that asserts an exception is thrown. Is ther a way for my to capture the exception using the expect macro so I can check the msg e.t.c is what I expect
21:35:12*rockcavera joined #nim
21:35:45leorizeAraq: can I make a converter so that only non-mutating functions can operate on the type?
21:35:57leorizeie. I'm making a special string type that doesn't contain certain characters
21:37:14leorizeit should be compatible with read-only string operations
21:38:20FromDiscord<konsumlamm> i'd be happy if someone could take a look at my PR: https://github.com/nim-lang/Nim/pull/16820
21:47:44FromDiscord<mratsim> Need dialisis
21:48:03FromDiscord<mratsim> (edit) "dialisis" => "dialysis"
21:48:43FromDiscord<konsumlamm> ?
21:51:05FromDiscord<mratsim> sugar -> dialysis
21:51:13*tane quit (Quit: Leaving)
21:52:59FromDiscord<konsumlamm> is that just a joke?
21:55:29*a_chou quit (Quit: a_chou)
21:59:08FromDiscord<mratsim> yes
22:02:22*evbo quit (Quit: Leaving)
22:06:50FromDiscord<konsumlamm> good
22:06:56FromDiscord<konsumlamm> feel free to review it anyway :p
22:09:54FromDiscord<rev> How to echo a value in Nim?
22:10:04FromDiscord<rev> (edit) "How to echo a value ... in" added "of something"
22:11:01FromDiscord<Avatarfighter> I highly recommend checking out the tutorial @rev <https://nim-lang.org/docs/tut1.html>
22:11:28FromDiscord<Avatarfighter> `echo` is the keyword you are looking for and the tutorial goes over it, its pretty complete and should answer a lot of questions
22:13:04FromDiscord<Avatarfighter> So if you have a variable named `variable` you can do `echo variable` or `echo $variable`. As you may have noticed I added the `$` in front of the variable, it acts as ni
22:13:08FromDiscord<Avatarfighter> (edit) "ni" => "Nim's toString"
22:13:33FromDiscord<Avatarfighter> If the object you are trying to echo doesn't have a `$` proc you will have to implement one.
22:13:53FromDiscord<Avatarfighter> (edit) "So if you have a variable named `variable` you can do `echo variable` or `echo $variable`. As you may have noticed I added the `$` in front of the variable, it acts as Nim's toString ... " added "method"
22:26:56*narimiran quit (Ping timeout: 240 seconds)
22:46:39*opal quit (Ping timeout: 268 seconds)
22:49:05*opal joined #nim
22:50:51*Vladar quit (Quit: Leaving)
22:50:57*abm quit (Quit: Leaving)
22:51:16*abm joined #nim
22:53:37leorizeAPI review request :) https://github.com/alaviss/nim-sys/pull/5
22:54:24leorizejust hoping that this looks sane and I don't open any cans of worms :p
22:54:29FromDiscord<mratsim> Strings 2, tainted strings strike back
22:54:52leorizetainted string is dumb, all strings are tainted :)
22:55:00FromDiscord<mratsim> static set, wow, even i didn't dare.
22:55:45FromDiscord<Recruit_main707> wtf happened to :disruptek:
22:55:57FromDiscord<Avatarfighter> mood
22:56:07FromDiscord<Recruit_main707> The emotes too?
22:56:15FromDiscord<Avatarfighter> yeah everything I think
22:56:23FromDiscord<Avatarfighter> I'm sad about the emote though that was pure humor
22:56:55FromDiscord<Avatarfighter> but its not like the emote added anything so I can't blame the removal of it
22:57:39FromDiscord<Recruit_main707> So its a permaban
22:57:47FromDiscord<Avatarfighter> I believe so
22:59:28leorizemratsim: treading in crazy territory :) it does compile though
23:00:36FromDiscord<mratsim> and @Araq was asking me just yesterday what I was using static enums for
23:00:52FromDiscord<mratsim> it might compile because I opened the path πŸ˜‰ https://github.com/nim-lang/Nim/issues/11142
23:01:19FromDiscord<mratsim> I tried to have static BigInt
23:03:15leorizeall thanks to you for testing all the weird stuff
23:21:03*abm quit (Quit: Leaving)
23:40:58FromDiscord<konsumlamm> with testament, when no targets are specified, does it test all targets? or only c?
23:42:26FromGitter<timotheecour> c
23:42:46FromGitter<timotheecour> or cpp depending on NIM_COMPILE_TO_CPP
23:42:56FromDiscord<konsumlamm> there you are xd
23:43:39FromGitter<timotheecour> (refs https://github.com/nim-lang/Nim/pull/16820#issuecomment-772087369)
23:43:46*zedeus quit (Quit: zedeus)
23:44:10FromDiscord<konsumlamm> the testament docs (i could find) at https://nim-lang.github.io/Nim/testament.html say "Run tests for specified targets (default: all)", so i assumed that by default all targets are run
23:44:56*mmohammadi9812 quit (Ping timeout: 240 seconds)
23:45:45FromGitter<timotheecour> PR welcome to make docs reflect reality
23:46:36FromDiscord<konsumlamm> regarding the inject bug: what exactly did you try?
23:47:45FromDiscord<konsumlamm> when i put the `dump` tests (with `inject`) in the big `main` template, just like the other tests, it gives me a bunch of "undeclared variable" errors
23:47:55*mmohammadi9812 joined #nim
23:48:23FromDiscord<konsumlamm> for every time another variable with the same name is used
23:48:46*hmmm quit (Quit: WeeChat 3.0)
23:49:15*rockcavera quit (Remote host closed the connection)
23:52:11*krux02 quit (Quit: Leaving)
23:54:30FromGitter<timotheecour> see https://github.com/nim-lang/Nim/pull/16919
23:54:31FromDiscord<konsumlamm> @timotheecour
23:54:44FromDiscord<konsumlamm> lol, i pinged you the exact moment you responded
23:54:57FromGitter<timotheecour> :)
23:55:15FromGitter<timotheecour> we can merge your PR as is then continue with https://github.com/nim-lang/Nim/pull/16919
23:55:52FromDiscord<konsumlamm> so, what about the inject stuff?
23:56:25FromGitter<timotheecour> what does it give with https://github.com/nim-lang/Nim/pull/16919 ? it works for me
23:56:57*mbomba quit (Quit: WeeChat 3.0)
23:57:14FromDiscord<konsumlamm> lemme see