<< 22-03-2021 >>

00:06:58*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
00:07:19*krux02 quit (Remote host closed the connection)
00:12:32*ehmry joined #nim
00:25:22FromDiscord<Gary M> I find it bizarre but otherwise really useful that mingw compiled static libs in `.a` format link for windows executables just like a `.lib` would
00:25:46FromDiscord<Gary M> because that's like, linux GCC lib format
00:27:16*tane quit (Quit: Leaving)
00:43:00FromDiscord<jfmonty2> I've got two types, both objects. The outer type has an array of the inner type. The inner type has a sequence of values. When I try to loop through the outer object's array and apply a mutation to each sequence, I get `expression is immutable, not var`. But the outer object was declared with `var`. How can I get a mutable access to the inner type's field?
00:43:03FromDiscord<jfmonty2> Example is here: https://play.nim-lang.org/#ix=2THq
00:44:40FromDiscord<ElegantBeef> Nim's default iterator is `items` which is immutable you need to do `.mitems` to get the mutable references
00:45:48FromDiscord<jfmonty2> ahh
00:47:46Benjamin[m]2<PMunch "Apart from this thing I guess:ht"> I think a Golden Eagle would be a good mascot.
00:48:02Benjamin[m]2* I think a Golden Eagle would be a good mascot.
00:48:02Benjamin[m]2"Golden Eagles possess astonishing speed and maneuverability for their size, and are one of the fastest, nimblest raptors in North America. Diving from great heights, these eagles have been clocked at close to 200 miles per hour."
00:48:02Benjamin[m]2Plus, it's called a "King Eagle" in several languages.
01:20:44*vicfred quit (Quit: Leaving)
01:26:09*vicfred joined #nim
01:39:26*aeverr quit (Remote host closed the connection)
01:39:52*aeverr joined #nim
01:52:27*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:52:45*njoseph joined #nim
02:19:40FromDiscord<sealmove> why don't we have a `newJsonNode` proc, overloaded with `int`, `string`, etc?
02:26:33FromDiscord<ElegantBeef> Well there is the `%` operator
02:32:13*Tanger joined #nim
02:39:08*wasted_youth2 quit (Quit: Leaving)
03:04:49FromDiscord<jfmonty2> How does one early-exit an iterator? `return` doesn't seem to work, nor does `break`
03:12:22FromDiscord<Gary M> it should work, what are you doing?
03:21:05FromDiscord<Yardanico> old nimforum (didn't take long to fix removed deprecated stuff so it compiles again) https://media.discordapp.net/attachments/371759389889003532/823395832849236008/unknown.png
03:21:33FromDiscord<sealmove> how to configure where testament puts nimcache and testresults?
03:23:35FromDiscord<Yardanico> @jfmonty2 can you show the code?
03:24:25FromDiscord<Yardanico> and you can't use `return` in inline iterators anyway
03:24:32FromDiscord<Yardanico> since they're inlined :P
03:25:08FromDiscord<jfmonty2> sure, here's my iterator: https://play.nim-lang.org/#ix=2THX
03:25:48FromDiscord<jfmonty2> I didn't explicitly inline it, but is it perhaps implicit?
03:25:49FromDiscord<jfmonty2> (probably not since this gets called upwards of 100M times)
03:25:50FromDiscord<jfmonty2> oh I guess that doesn't really matter though
03:26:04FromDiscord<Yardanico> @jfmonty2 I mean that default nim "iterators" are _always_ inlined
03:26:10FromDiscord<Yardanico> the code itself replaces the for loop
03:26:10FromDiscord<jfmonty2> ah
03:26:26FromDiscord<Yardanico> how do you call your iterator?
03:26:35FromDiscord<jfmonty2> This one is being called from another iterator
03:26:43FromDiscord<Yardanico> i mean with what arguments so I can test it :P
03:26:54FromDiscord<jfmonty2> oh πŸ˜› sure, just do like `digits(1, 3, 3)`
03:27:06FromDiscord<jfmonty2> it will give you all 3-digit combinations of 1, 2, and 3
03:28:00FromDiscord<Yardanico> oh, nice, although you can make implement the same with algorithm.nextPermutation
03:28:00FromDiscord<jfmonty2> if it weren't erroring that is
03:28:25FromDiscord<jfmonty2> Doesn't that enforce uniqueness or something?
03:28:26FromDiscord<Yardanico> easy solution would be to remove "return" and just add an else branch
03:28:34FromDiscord<jfmonty2> oh duh πŸ˜„ yeah that would work wouldn't it
03:29:00FromDiscord<Yardanico> yeah something like that
03:29:02FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2THY
03:30:46FromDiscord<Yardanico> @jfmonty2 and so you know, this is how the iterator gets inlined (this also includes new runtime-specific destroys and try: finally: blocks, you can ignore those)
03:30:46FromDiscord<jfmonty2> yeah, `algorithm.nextPermutation` doesn't appear to work with repeated values unfortunately
03:30:56FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2THZ
03:30:59FromDiscord<Yardanico> the for loop is rewritten to this :)
03:31:04FromDiscord<jfmonty2> oof
03:31:10FromDiscord<Yardanico> well there's nothing bad about it
03:31:10FromDiscord<jfmonty2> yeah I'll have to uh, come back to that one.
03:31:22FromDiscord<jfmonty2> I'm just glad I have the compiler to do it for me πŸ˜„
03:31:31FromDiscord<Yardanico> but yeah if you call it too much in many different places, your binary size might grow
03:32:55FromDiscord<sealmove> is there a way to configure testament's defaults instead of specifying them in `discard` section in each and every file?
03:33:11FromDiscord<Yardanico> @sealmove honestly not sure, it's still pretty early in EU so I'd recommend you to ask on the forum
03:33:19FromDiscord<Yardanico> @jfmonty2 so basically when you call inline iterators in a for loop, the for loop's body gets rewritten with the inline iterator, and "yield"s get rewritten into whatever body you have inside the for loop
03:33:42FromDiscord<jfmonty2> right, that makes sense
03:34:07FromDiscord<jfmonty2> I can see how it works conceptually, it's just reading the raw unroll that's a little intimidating at first
03:34:11FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TI0
03:34:18FromDiscord<Yardanico> well you don't need to read it :P
03:34:37FromDiscord<jfmonty2> exactly, if we had to read all the code generated by all of our various compilers we'd still be in the 60s
03:34:48FromDiscord<Yardanico> --expandArc just shows your code after a lot of compiler transformations (including new runtime specific ones for destructors and stuff)
03:35:07FromDiscord<jfmonty2> I can see that being useful for debugging now and then
03:53:41FromDiscord<ElegantBeef> I really shouldnt have stumbled on timothee's github page talking about cmdline generator stuff πŸ˜„
03:53:43FromDiscord<ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/823404042499784734/unknown.png
04:05:04*spiderstew_ joined #nim
04:06:38*spiderstew quit (Ping timeout: 264 seconds)
04:21:21*waleee-cl quit (Quit: Connection closed for inactivity)
05:17:51FromDiscord<j-james> Out of curiosity, why aren't all symbols exported by default?
05:18:12FromDiscord<ElegantBeef> Cause that gives 0 access control
05:18:29FromDiscord<ElegantBeef> Which means you cannot hide any of the underlying logic from users and protect yourself
05:19:39FromDiscord<j-james> Well, I meant why is the default that all symbols are hidden and `` is a public marker
05:19:53FromDiscord<j-james> As opposed to all public and `` functioning as a private marker
05:20:40FromDiscord<ElegantBeef> Coming from C# it's "proper" to me πŸ˜›
05:20:49FromDiscord<ElegantBeef> So idk why would you default to publiic
05:20:52FromDiscord<ElegantBeef> Seems like it should be opt in
05:21:28FromDiscord<j-james> maybe I'm too used to the pseudo-public stuff Java does by default
05:21:46FromDiscord<ElegantBeef> Private by default means you dont ever accidentally expose code, you have to intentionally do it
05:39:55*lritter joined #nim
05:44:28*narimiran joined #nim
05:51:51saemBeef what was that weird generic parameter bug you ran into or found in the issue tracker a few nights ago?
06:10:29FromDiscord<ElegantBeef> The the typeclass confusing the explicit generics, gotta find it for you πŸ˜„
06:10:44saemπŸ™‡β€β™‚οΈ
06:11:02FromDiscord<ElegantBeef> 'ere https://github.com/nim-lang/Nim/issues/17212
06:13:37saemTime to see if I fixed this or anything else. πŸ˜…
06:13:47saemor you know, made it worse.
06:17:31*mbomba joined #nim
06:17:47saemanother Canadian
06:19:14FromDiscord<ElegantBeef> Who is?
06:19:34saemIRC message, your probably don't see it in discord.
06:19:50FromDiscord<ElegantBeef> Ah
06:20:00FromDiscord<ElegantBeef> Thought i was going crazy
06:20:11saemCould still be, just unrelated.
06:20:46Yardanicoyeah, showing all IRC join/leave mesages in Discord would be a bit too much :P
06:21:04saemReally would be.
06:23:00FromDiscord<ElegantBeef> Would really confuse the people that thing the irc bridge is a bot
06:23:12FromDiscord<ElegantBeef> think even
06:24:18saemhah, I've never used methods in Nim -- except to write tests for nimsuggest.
06:24:37Yardanicob-b-but OOP!11111
06:24:41saemLoL
06:25:02saemI mean, runtime dispatch is super useful for sure.
06:25:15saemI guess if you have a big pile of it, for reasons, then I get why.
06:25:41Yardanicowith things like https://github.com/yglukhov/iface I don't think that there are too many places where you really need methods :P
06:25:46saemBut most of the time I don't and where I do it's like... one function pointer and good enough.
06:26:17Yardanicoyeah, e.g. the streams module is just "raw" interfaces with proc pointers
06:26:48saemYeah, methods in a very conceptual sense are great in some cases, but as the very specific dispatch scheme/mechanism, I'm not sure. An yeah, iface is pretty cool -- though I don't know the edges well.
06:27:40saemStreams are where I think concepts (I know, I know) might obviate even that?
06:28:13*mbomba quit (Quit: WeeChat 3.1)
06:28:15FromDiscord<ElegantBeef> What's the "i know i know" about?
06:28:34saemsome people have feelings about it, I'm pre-forgiving myself.
06:28:51Yardanicosaem: yeah, I think that even generics/concepts should work for implementing the streams module
06:28:59Yardanicomaybe it wasn't done because streams module was made a long time ago
06:29:20saemPartially, also it's advantageous when you want to swap that stuff out at runtime, use cases and all that.
06:29:40Yardanicoyeah
06:34:59saemIt'd be hella difficult, but being able to take a single set of types (library author), then being able to specify having them somewhere on compile-run-time spectrum (library user) with the dispatch/RTTI being traded off appropriately would be slick.
06:39:55saemhuh, that's weird, why wouldn't semMethodPrototype look at the return type.
07:36:00saemholy crap.. I fixed the bug.
07:36:48FromDiscord<ElegantBeef> Holy bug man robin!
07:37:15FromDiscord<ElegantBeef> Congrats, keep this up and the issue count might go down πŸ˜›
07:38:55saemspoke too soon. :D
07:39:52saemThough, i might know where it is now.
07:43:42*fredrikhr joined #nim
08:03:49*PMunch joined #nim
08:15:39*PMunch quit (Quit: leaving)
08:21:44*PMunch joined #nim
08:57:12PMunchHmm, I can't put an array of unsigned integers in my main procedure without getting the Error: system module needs: nimErrorFlag error..
08:58:20saemπŸ€” that sounds like my badπŸ˜“
08:58:41PMunchYour bad?
08:58:46PMunchWhat did you do? :P
08:59:13saemIt's late here, I can't get into that now.
08:59:20saem:D
08:59:46PMunchI get the same error from 1.4.0 and up, can't test earlier versions as I use a for loop macro
09:00:08PMunchOh, with devel it works
09:00:40saemOh ... then the opposite of my bad, perhaps. But only half credit.
09:01:18saemFor a teeny example I can look at on pay ground?
09:01:22saemGot
09:02:11saemIt's probably a good candidate to become a regular test case from the sounds of it.
09:02:20*Tanger quit (Remote host closed the connection)
09:04:45*krux02 joined #nim
09:05:55PMunchWell this is running on the Teensy, so it has a long nim.cfg in order to make that to work
09:06:17PMunchBut it's this project: https://github.com/PMunch/badger/blob/master/badger.nim
09:06:37PMunchIf you try to move rowKeys and colKeys into the `main` procedure it will give that error.
09:07:13saemExcept devel?
09:08:03PMunchYeah on devel it works
09:08:10ForumUpdaterBotNew post on r/nim by bitbrist: nim safety in comparision to c, zig and rust, see https://reddit.com/r/nim/comments/maj1lz/nim_safety_in_comparision_to_c_zig_and_rust/
09:09:00saemHmm, so that would trigger compile time, I wonder if that's what it's tripping up on.
09:09:11PMunchIt doesn't do what I hoped it would, but it doesn't trigger that error
09:09:37saemOh, what's it so wrong?
09:10:00PMunchWell I was trying to save data memory, the teensy doesn't have a lot of that
09:11:04saemOh, so works as intended but the impact is not what you wanted?
09:11:10PMunchYes
09:11:13PMunchOn devel
09:11:40PMunchIt seems to create them as globals still, and then copy them into variables on runtime
09:11:49PMunchThis means that Nim needs to add in error handling features
09:11:56PMunchWhich is where that error was coming from
09:14:54saemAh, so not failing where it shouldn't but the semantic _might_ be off
09:24:40PMunchWell it failed because it was missing something, but that seems to have been fixed.
09:24:49PMunchAnd I was just wrong in my assumption
09:37:01*timdorohin joined #nim
09:41:22PMunchHmm, anyone good with nm here?
09:48:27FromDiscord<Gary M> is there any way to do implicit object creation like `(1, 2.0f)` instead of `myType(myInt: 1, myFloat:2.0f)`
09:48:58FromDiscord<Gary M> specifically if you already have a value that is of that type
09:49:21FromDiscord<Gary M> `var ofMyType: MyType()`
09:49:32FromDiscord<Gary M> (edit) "MyType()`" => "MyType` πŸ˜›"
09:49:46FromDiscord<Rika> not that i know of, use a tuple if really needed
09:50:02FromDiscord<Gary M> can't
09:50:04FromDiscord<Rika> thats fragile imo
09:50:26FromDiscord<Gary M> what's fragile about it?
09:50:35FromDiscord<Rika> use a proc `proc myType(x, y: T): MyType` or so
09:51:18FromDiscord<Gary M> but why does this have to be necessary?
09:51:40FromDiscord<Gary M> what is fragile about implicit object initialization?
09:51:42FromDiscord<Rika> i dont know the reason, maybe a core dev would know better
10:15:06FromDiscord<Gary M> does `high` on a seq only return the index or will it return the value
10:16:50FromDiscord<mratsim> the index
10:17:07FromDiscord<mratsim> use s[^1] or s[s.high] if you want the value
10:17:18FromDiscord<Gary M> ah okay ^1 was what I wanted
10:17:29FromDiscord<Gary M> why is it not ^0
10:17:47FromDiscord<Gary M> like reversed 0 index or whatever
10:23:57FromDiscord<Rika> woah first time ive gotten a SIGILL on nim
10:24:50FromDiscord<nuc> Hi guys is there any nim based data format akin to Json? For example using indendation instead of brackets πŸ˜„
10:25:08PMunch@Rika, how'd you manage that :P
10:25:13FromDiscord<Rika> i dont know
10:25:14FromDiscord<nuc> For example Rust has RON https://docs.rs/ron/0.6.2/ron/
10:25:29FromDiscord<nuc> So I wonder if anybody invented something for nim πŸ˜„
10:26:05PMunch@nuc, not really. Since Nim is so flexible you can use pretty much any format and make it feel native, so most people just use an established format
10:26:14PMunchWhy reinvent the wheel if you don't have to
10:27:55FromDiscord<nuc> Well becasue I don't know of any indendation based data format apart from yaml...
10:27:59FromDiscord<Rika> i see, div by 0 somehow
10:28:02FromDiscord<nuc> (edit) "becasue" => "because"
10:28:24FromDiscord<nuc> (edit) "Well because I don't know of any ... indendation" added "good"
10:29:57PMunch@nuc, TOML?
10:30:01*tane joined #nim
10:31:30FromDiscord<nuc> I am looking for a homoiconic data format
10:36:32*Vladar joined #nim
10:37:32FromDiscord<nuc> @PMunch none of the mentioned data format is based of the nim syntax
10:37:42FromDiscord<nuc> (edit) "format" => "formats" | "of" => "off"
10:37:55FromDiscord<Rika> In reply to @PMunch "@nuc, not really. Since": did you see this?
10:38:16FromDiscord<nuc> @Rika Yes, I was not asking for judgement calls.
10:38:20FromDiscord<Rika> then no
10:38:23FromDiscord<Rika> there is nothing
10:38:30FromDiscord<Rika> unless you're willing to use nimscript
10:38:47PMunchNimScript would work fine
10:38:59PMunchYou could make your own DSL based format
10:39:09PMunchBut if you're doing that, why not just use inline JSON?
10:40:24FromDiscord<nuc> I was inspried by https://altscript.com/?page_id=16 and thought it might be a cool idea for nim :))
10:40:25PMunchI mean we are able to do things like this: https://play.nim-lang.org/#ix=2TIW
10:40:46FromDiscord<nuc> and https://altscript.com/?page_id=62
10:40:49PMunchJust typing JSON directly into your Nim file, so in that way JSON is already Nim syntax :P
10:51:30FromDiscord<Solitude> In reply to @Gary M "why is it not": len - n
10:59:52PMunch@juancarlospaco, one comment on my video from yesterday, asking to increase the font size :P
11:44:42PMunchTrying to reply to a topic on Reddit, does this look about right? https://uploads.peterme.net/nimsafe.html
11:48:02FromDiscord<Gary M> you forgot checked C πŸ˜‰
11:48:15PMunchChecked C?
11:48:38FromDiscord<Gary M> also are these correctly formatted https://media.discordapp.net/attachments/371759389889003532/823523559149142066/unknown.png
11:48:41PMunchIt's a reply to this: https://scattered-thoughts.net/writing/how-safe-is-zig/
11:49:00PMunchUhm, that is weird
11:49:25FromDiscord<Gary M> it's on Edge, chromium based
11:49:45PMunchThat should've been fixed now
11:49:56PMunchWas missing a meta tag to set the character set to UTF8
11:50:06PMunchLooks like FF does that by default
11:50:18FromDiscord<Gary M> > Checked C adds static and dynamic checking to C to detect or prevent common programming errors such as buffer overruns and out-of-bounds memory accesses
11:50:38FromDiscord<Gary M> not that it's extremely relevant, but it's tangential
11:50:48PMunchAh right
11:50:54PMunchI was just adding the two Nim columns
11:50:59PMunchThe C column is from the original
11:51:05FromDiscord<Gary M> yeah now the nim columns are missing πŸ˜„
11:51:05FromDiscord<mratsim> drNim
11:51:16FromDiscord<mratsim> compile-time bound checks
11:52:15FromDiscord<exelotl> I'm unsure about this bit - is Nim really better than Zig at avoiding these or is it just trying to make Nim look good? :P https://media.discordapp.net/attachments/371759389889003532/823524472371806238/unknown.png
11:52:29FromDiscord<flywind> btw we have https://github.com/nim-lang/RFCs/issues/244 data races is possible to be prevented at compile time.
11:52:38FromDiscord<flywind> (edit) "is" => "are"
11:53:17PMunch@Gary M, the Nim columns are missing?
11:53:51FromDiscord<Gary M> wait one sec
11:53:54PMunch@mratsim, since he doesn't include external checking tools for C I tried to stay comparative
11:53:58FromDiscord<Gary M> was the wrong link
11:53:59FromDiscord<exelotl> (I have no idea how big of a problem use-after-free and such is in Zig)
11:54:05FromDiscord<Gary M> everything is correct now Mr Munch
11:54:21FromDiscord<konsumlamm> In reply to @exelotl "I'm unsure about this": i mean, in Nim these usually don't happen in the first place, because you use GC
11:54:28PMunch@exelotl, no idea what Zig does, but those things aren't really something you'd run into on Nim unless you where doing manual memory management
11:54:29FromDiscord<konsumlamm> and in Zig rhere is no GC
11:54:44FromDiscord<konsumlamm> and Zig is not fully memory safe either
11:55:15FromDiscord<exelotl> if manual alloc/free are commonplace in all Zig code then sure we can say Nim is better x)
11:55:15FromDiscord<Gary M> isn't Zig mostly C anyways
11:55:42FromDiscord<Gary M> and the zig compiler is just clang with caching?
11:55:55FromDiscord<konsumlamm> umm no
11:56:09FromDiscord<konsumlamm> C doesn't have powerful CTFE last i checked
11:56:50FromDiscord<Gary M> I mean yes zig is transpiling to C and doing CT checks?
11:57:09FromDiscord<konsumlamm> CT calculations too
11:57:19FromDiscord<konsumlamm> like Nim can
11:57:46FromDiscord<konsumlamm> and through the comptime stuff Zig also gets generics more or less
11:58:07FromDiscord<konsumlamm> and i don't think the C standard library has a focus on allocators
11:58:26FromDiscord<konsumlamm> ~~or even exists in a meaningful way in the first place~~
11:58:28FromDiscord<Gary M> I'm saying that zig is a lot closer to C than nim is to C πŸ˜›
11:58:38FromDiscord<konsumlamm> that is correct
11:58:42PMunchAddad a note about the `Isolated` thing
11:59:12PMunchDoes it otherwise look good to people?
11:59:22PMunchI'm not over-promising anything here?
11:59:40FromDiscord<Gary M> I'm not knowledgeable enough to say one way or the other.
12:03:36FromDiscord<konsumlamm> hmm, looks right do me, though i'm not exactly sure what's meant by "type confusion"
12:04:54FromDiscord<konsumlamm> also, null pointer dereference for Rust is mostly compile time, since references can't be null, so you usually use an option type, where you're forced to check for "null" before dereferencing...
12:07:16PMunch@konsumlamm, type confusion is casting types to something it's not I believe
12:07:51FromDiscord<konsumlamm> hmm, idk what the "only when using tagged unions" comment is supposed to mean then, sounds like the author doesn't understand tagged unions
12:08:52PMunchTagged unions are the same as our case types right?
12:09:58*sacredfrog quit (Quit: ZNC 1.8.2 - https://znc.in)
12:10:40*sacredfrog joined #nim
12:10:42FromDiscord<konsumlamm> basically ye
12:11:12FromDiscord<konsumlamm> but the kind is not exposed directly
12:11:59timdorohinhow would somebody implement delta-objects in nim?
12:13:30PMunchtimdorohin, delta-objects?
12:14:50timdorohinin C i've implemented them once, and they was something like pointer to base object, bitfield for listing overrided members+uint8 VLA from which i can read said members data
12:18:37PMunchAnd what do they do?
12:19:12PMunchResponded to the Zig thing here by the way: https://www.reddit.com/r/nim/comments/maj1lz/nim_safety_in_comparision_to_c_zig_and_rust/
12:21:29timdorohinIsn't it obvious? They usually used for holding incremental changes efficiently
12:22:21*NimBot joined #nim
12:22:37PMunchAh so you want to track the differences made to an object?
12:24:27PMunchI mean you can do the same thing you did in C a pointer (or better yet a reference) to an object, then a set[] of the edited fields, and a sequence of new data
12:27:41timdorohinPMunch: i know, question is: how i can make this nim-ideomatically?
12:29:13timdorohin macro-magically generating object type derived from base object and creating getters/setters for all fields?
12:30:59FromDiscord<mratsim> you use getTypeImpl to copy the base type fields
12:34:08ForumUpdaterBotNew thread by Mantielero: Winim - onenote, see https://forum.nim-lang.org/t/7677
12:34:24timdorohinmratsim: i'm not really asking for _how_ it should work internally, more for what interface it should have
12:35:29timdorohingetters/setters for every field? overloaded `.` and `.=`?
12:39:24timdorohinor should it not pretend to be compatible with base object and implement something like getField(enum field): Field where field object would contain info like was it overrided or not and so on
12:47:23PMunchDepends on what you want really
12:47:35PMunchI'd create templates for each field I think
12:58:29FromDiscord<mratsim> same, if you're within a macros creating template is cheap
12:58:41FromDiscord<mratsim> the `.` and `.=` creates weird error otherwise.
13:00:16*xet7 quit (Quit: Leaving)
13:01:44*xet7 joined #nim
13:16:38*narimiran quit (Quit: leaving)
13:17:45*narimiran joined #nim
13:25:01FromDiscord<konsumlamm> @flywind what is `std/tasks` about? is there any RFC or similar for it?
13:29:06*JustASlacker joined #nim
13:35:16FromDiscord<flywind> no, but it is half of new threadpool implementation. You can think of it as reimplementing `spawn` with macros.
13:53:29FromDiscord<konsumlamm> ah, interesting
14:10:17ozzzlibfcgi works finally...
14:13:02ozzzonly smth wrong with FCGX_GetParam, looks like it modifies smth in memory
14:13:47FromDiscord<exelotl> In reply to @PMunch "I'd create templates for": Oh yeah I'm using dot operators in my code and should really be doing this instead
14:15:15PMunch@exelotl, two ways to do it, each with pros and cons I guess
14:17:50FromDiscord<exelotl> Yeah, I think the main con is that dot operators result in some very unclear error messages
14:19:47FromDiscord<exelotl> I have a proc that acts on a type which has dot operators enabled. I delete the proc, but its still being called somewhere. I get errors about dot operator resolution instead of the attempt to call a nonexistent proc.
14:20:30FromDiscord<exelotl> (edit) "I have a proc that acts on a type which has dot operators enabled. I delete the proc, but its still being called somewhere. I get errors about ... dotis" added "whatever the" | "resolution" => "is trying to do"
14:21:12FromDiscord<Yardanico> You can annotate it as error/deprecated to see where it is being called
14:21:24FromDiscord<Yardanico> I mean the proc itself
14:21:34FromDiscord<exelotl> Yeah true
14:23:30FromDiscord<hamidb80> sent a code paste, see https://paste.rs/Fn1
14:24:20FromDiscord<InventorMatt> if you need to mutate the value like return a value from a table that you want to change
14:24:58FromDiscord<Yardanico> Yep, exactly
14:25:22FromDiscord<Yardanico> You can also return `lent T` but this is a much newer thing
14:25:41FromDiscord<Yardanico> (it's an immutable view into T, avoids copies)
14:29:15FromDiscord<hamidb80> In reply to @InventorMatt "if you need to": and that table must not defined in the proc scope
14:29:46FromDiscord<Yardanico> ?
14:29:47FromDiscord<Yardanico> Of course
14:30:10FromDiscord<Yardanico> Because otherwise you'll violate memory safety and return a pointer to a location on local stack
14:30:16FromDiscord<hamidb80> because it escapes its stack frame
14:30:23FromDiscord<Yardanico> If it's a ref it should work though
14:30:33FromDiscord<Yardanico> (not sure)
14:30:41FromDiscord<hamidb80> anyway
14:32:24FromDiscord<hamidb80> when should I use `ref type` instead of `type`?↡for e.g. `TableRef` vs `Table`
14:33:14FromDiscord<Yardanico> when you need ref semantics - shared ownership, something like that :)
14:33:54FromDiscord<hamidb80> do you suggest any articles about it?
14:34:21FromDiscord<Yardanico> There have been quite a lot of forum threads about this
14:34:22FromDiscord<Yardanico> https://forum.nim-lang.org/t/1207
14:34:50FromDiscord<Yardanico> https://forum.nim-lang.org/t/7218
14:35:02Oddmongerhow can i get number of elements in an enum ? sizeof returns 1, whatever number of elements defined
14:36:42FromDiscord<Yardanico> Also you might want to give https://zevv.nl/nim-memory/ a read
14:36:42Oddmongerit's for initializing an array which will have the size of the number of arguments of the enum
14:37:24FromDiscord<Yardanico> You can just use the enum itself to index the array
14:37:34*JustASlacker quit (Ping timeout: 256 seconds)
14:38:09Oddmongerthe last element, you mean ?
14:38:52FromDiscord<Yardanico> I mean https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features#using-enums-as-array-indexes
14:38:52FromDiscord<Solitude> `array[Enum, int]`
14:39:58*vicfred quit (Quit: Leaving)
14:40:05Oddmongerah nice
14:40:08Oddmongerthank you
14:40:12FromDiscord<Yardanico> But if you really want to, you can get the length for most normal enums (without holes) with MyEnum.high - MyEnum.low
14:40:47FromDiscord<InventorMatt> is something like this https://play.nim-lang.org/#ix=2TKc going to be possible with the new views?
14:41:09FromDiscord<Solitude> In reply to @Yardanico "But if you really": MyEnum.high.ord - MyEnum.low.ord
14:41:11FromDiscord<Yardanico> Sorry, forgot ord
14:41:23*vicfred joined #nim
14:41:33FromDiscord<Yardanico> In reply to @InventorMatt "is something like this": What does this do?
14:41:56FromDiscord<Yardanico> Ah, if you mean mutable views, then yes, I think
14:42:33FromDiscord<Yardanico> But I don't think that it works now
14:42:35FromDiscord<Yardanico> https://nim-lang.org/docs/manual_experimental.html#view-types
14:42:36FromDiscord<InventorMatt> like I have a bunch of variables that i want to then iterate through but i don't want to initially keep them in a seq
14:42:52FromDiscord<InventorMatt> and mutate them while iterating
14:43:48FromDiscord<Yardanico> You can do it with a macro in that case, no?
14:45:12FromDiscord<InventorMatt> I was just wondering if there was a way without macros. I've done easily with raw pointers in nim before so i was just curious if views would allow an easier way to do it
14:46:02FromDiscord<Yardanico> Yeah, they eventually should
14:46:02FromDiscord<aryn> how would you determine which OS a nim app is running on? similar to python's os.name
14:46:50liblq-devhostOs
14:47:01FromDiscord<aryn> ah cheers
14:47:01liblq-devhttps://nim-lang.org/docs/system.html#hostOS
14:47:14FromDiscord<Yardanico> that's a compile time thing because you're compiling for one OS anyway
14:47:22FromDiscord<Yardanico> To get the exact version you might need other APIs though
14:47:24FromDiscord<aryn> oh true, yeah
14:47:44FromDiscord<Aiz> sent a code paste, see https://play.nim-lang.org/#ix=2TKe
14:47:49liblq-devstill useful if you need to print it out or check what OS you're compiling for with `when`
14:47:54FromDiscord<aryn> although i could recompile to windows and it would change?
14:48:09liblq-devyeah
14:48:09FromDiscord<aryn> so i could make an app which is cross platform by checking that?
14:48:27FromDiscord<aryn> alright, cool
14:48:59liblq-devthere's also `defined(windows)`, `defined(macosx)`, `defined(posix)`, `defined(linux)` and the like but i don't remember each and every one of them
14:49:03FromDiscord<Yardanico> You can have different code at compile time depending on the OS, and hostOS is optimal
14:49:08FromDiscord<Yardanico> Optional
14:49:17FromDiscord<Yardanico> Yeah the defines
14:49:30FromDiscord<aryn> yea i saw those defined things in source, but wasnt sure how they worked
14:50:25FromDiscord<Yardanico> There's nothing complicated about those, it's just checking whether a symbol has been defined
14:50:34FromDiscord<Yardanico> Compiler defines a lot of symbols you could check for
14:50:58liblq-devyou can make your own too, by passing `-d:something` during compilation
14:51:03liblq-devand then you can check `defined(something)`
14:51:20FromDiscord<aryn> yea that was what i was confused about. the symbols arent defined in file, but makes sense if they're done by the compile
14:51:20FromDiscord<aryn> (edit) "compile" => "compilee"
14:51:21FromDiscord<aryn> (edit) "compilee" => "compiler"
14:52:23FromDiscord<aryn> alright thanks, everything's working as intended now
15:01:06FromDiscord<Lefl> sent a code paste, see https://paste.rs/Fjr
15:02:00FromDiscord<Yardanico> can you show the full error?
15:02:22FromDiscord<Lefl> That is the full error
15:02:36FromDiscord<Yardanico> @Lefl it's supposed to be var r
15:02:48FromDiscord<Yardanico> You need to mutate the random state so it needs to be mutable
15:02:53FromDiscord<Lefl> Aah
15:02:56FromDiscord<Lefl> Thank you very much
15:03:02FromDiscord<Yardanico> In reply to @Lefl "That is the full": The compiler provides a more complete context
15:03:08FromDiscord<Lefl> Oh I see
15:13:39*PMunch quit (Quit: leaving)
15:20:27ForumUpdaterBotNew thread by HJarausch: Location of nimdoc.css ?, see https://forum.nim-lang.org/t/7679
15:22:27ForumUpdaterBotNew thread by HJarausch: RunnableExamples need random - what can I do?, see https://forum.nim-lang.org/t/7680
15:25:31reversem3Is it possible to create a relative large size program using only functional paradigm for nim? Using only the sequtils for closures, filter, map ... and I know there is more but right now that is what I'm up to
15:26:03reversem3 * Is it possible to create a relative large size program using only functional paradigm for nim? Using only the sequtils for closures, filter, map ... and I know there is more but right now that is what I'm up to in the manual.
15:26:27ForumUpdaterBotNew thread by HJarausch: I'd like to make a tiny contribution to stats.nim - how to?, see https://forum.nim-lang.org/t/7681
15:26:46reversem3Also would this only include function instead of proc because of no side effects?
15:26:54FromDiscord<mratsim> In reply to @reversem3 "Is it possible to": Sure, do yourself a favor and use https://github.com/vegansk/nimfp and https://github.com/nigredo-tori/classy
15:27:16FromDiscord<mratsim> you can't write useful programs without side-effects
15:27:41FromDiscord<mratsim> unless you hardcode everything and your program has no inputs.
15:27:54reversem3ok I know about the fp libraries but I would like to just learn how do it via just what nim has.
15:28:19FromDiscord<Yardanico> @oprypin gitter bridge seems to be down again :(
15:28:48reversem3I like elixir and thats functional and works great , but its not nim
15:28:56FromDiscord<Yardanico> gitter is a wasteland now https://media.discordapp.net/attachments/371759389889003532/823579002190299136/unknown.png
15:28:57FromDiscord<mratsim> I solved a couple of project euler problems in a fully functional way https://github.com/mratsim/nim-project-euler/blob/master/src/lib/functional.nim
15:29:21reversem3very cool
15:30:18FromDiscord<mratsim> note, that is probably my very first nim code
15:30:23reversem3this is great comments
15:30:24reversem3proc takeWhile*[T](iter: iterator(): T, cond: proc(x: T):bool): iterator(): T =
15:30:24reversem3 ## .. code-block:: Nim
15:30:24reversem3 ## takeWhile(1;2;3;4, proc(x: int): bool = x < 4) -> 1;2;3
15:30:45FromDiscord<mratsim> so it's before I understood Nim, and it might not be idiomatic
15:31:25FromDiscord<mratsim> or even {.closure.} vs {.nimcall.} it seems
15:32:51reversem3ok , hey you gave me something so I thank you
15:33:51reversem3paradigms for nim is like having a blank canvas , you can do pretty much whatever you want
15:34:02FromDiscord<Yardanico> i just don't get it - how rosettacode, being such a popular resource, has such bad infrastructure/software?
15:34:19FromDiscord<Yardanico> there has been an attempt to fork it and make a github repo but it failed (no activity whatsoever)
15:34:57*asdflkj quit (Ping timeout: 260 seconds)
15:37:28FromDiscord<mratsim> it's popular but at one point when you have the skill to improve on Rosetta you graduated from needing it.
15:37:34FromDiscord<Yardanico> XD
15:37:45FromDiscord<Yardanico> it still might help other people but contributing is really horrible
15:39:20*asdflkj joined #nim
15:39:42FromDiscord<Yardanico> and the fact that it uses some outdated PHP software for highlighting which hasn't been updated since 2017
15:39:57FromDiscord<Yardanico> GeSHi
15:40:26FromDiscord<Yardanico> oh actually it's been updated in oct 2019 sorry
15:46:30ForumUpdaterBotNew thread by HJarausch: Generics overload - which one is selected?, see https://forum.nim-lang.org/t/7682
15:46:45FromDiscord<Yardanico> HJarausch creating too much forum threads
16:02:34FromDiscord<Goel> Probably is not necessary, since Nim / Learn page have of resources, but maybe we can have Nimlings too (based on RUstlings and Ziglings) "Welcome to Ziglings! This project contains a series of tiny broken programs. By fixing them, you'll learn how to read and write Rust/Zig/Nim code."
16:02:45FromDiscord<Goel> (edit) "" => "a lot"
16:04:38FromDiscord<Yardanico> there's already someone doing that
16:04:54FromDiscord<Yardanico> https://github.com/sergiotapia/nimlings
16:11:28*sixtyten joined #nim
16:15:13*vicfred quit (Quit: Leaving)
16:16:59*vicfred joined #nim
16:19:19*haxscramper joined #nim
16:26:42reversem3Yep this is fun https://github.com/sergiotapia/nimlings
16:29:04reversem3Thanks Yardanico
16:43:18*fredrikhr quit (Ping timeout: 265 seconds)
16:46:44*waleee-cl joined #nim
16:57:34*fredrikhr joined #nim
17:00:05*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
17:00:37FromDiscord<haxscramper> I need to start several processes at once, and repeatedly launch new when an old one finishes so that number of concurrently running processes is kept at 10. When process finished it has to report some results to main launcher. What would be the best way to do this using standard library?
17:01:42ozzzwhy it appear: type mismatch: got <Thread[system.void], proc (){.closure, gcsafe, locks: 0.}>
17:01:44ozzz&
17:01:57FromDiscord<haxscramper> I suppose it can be done with async, but I'm not exactly sure how, so if someone has an example it would really appreciate it
17:02:14ozzzproc declared as proc worker() {.thread.} =
17:03:59ozzzafk..
17:10:11FromDiscord<haxscramper> Also wrap this all in iterator, so when new process from process pool finished, I would get its results immediately.
17:14:21FromDiscord<Gary M> C/C++ Macros are the worst
17:14:52FromDiscord<Gary M> `IRenderDevice_CreateShader(pDevice, &ShaderCI, &pVS);` this looks like innocent enough C code as an extern for C++ code
17:15:01FromDiscord<Gary M> but they're sneaky. That shit is a macro
17:15:21FromDiscord<Gary M> `(pDevice)->pVtbl->RenderDevice.CreateShader((IRenderDevice)(pDevice), &ShaderCI, &pVS);` is the actual expanded value
17:16:07FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2TLm
17:16:18FromDiscord<Gary M> stdint sounds like C++
17:16:34FromDiscord<Gary M> try compiling with the c++ backend
17:17:07FromDiscord<Gary M> or I guess it would be i586-elf-g++, if that's a thing
17:17:21FromDiscord<Gary M> if not, try passing the proper c++ and std args to it
17:17:23FromDiscord<jtiai> I won't have include files anyway since I'm cross compiling...
17:17:36FromDiscord<Gary M> well it's looking for a standard lib header πŸ˜›
17:17:43FromDiscord<Gary M> that's just going to be an include
17:18:03FromDiscord<Gary M> https://media.discordapp.net/attachments/371759389889003532/823606462940577813/unknown.png
17:18:54FromDiscord<Gary M> if your code relies on either a C or C++ stdlib header and you're not going to provide it, it just won't compile.. that should be obvious
17:19:37FromDiscord<jtiai> My code doesn't.
17:19:44FromDiscord<jtiai> It comes from nim somewhere.
17:20:21FromDiscord<jtiai> `--os:standalone --gc:none` I use those flags for nim.
17:20:22FromDiscord<Gary M> well your compiler isn't including the libs necessary for nim to compile then
17:20:28FromDiscord<jtiai> There are no libs.
17:20:33FromDiscord<Gary M> I know8
17:20:38FromDiscord<Gary M> (edit) "know8" => "know"
17:21:04FromDiscord<jtiai> Nim shouldn't be expecting anything since at least I try to tell that it's bare metal system.
17:23:43FromDiscord<mratsim> It should expect a working C / C++ toolchain
17:24:29FromDiscord<jtiai> I have one.
17:25:00FromDiscord<jtiai> At least I think I do (for bare metal x86 system)
17:26:31FromDiscord<jtiai> I'm trying things like this: https://github.com/watzon/JackOS or https://github.com/mikra01/nimkernel_ext or https://github.com/dom96/nimkernel
17:28:30FromDiscord<Gary M> in nimkernel he's linking ` direShell CC, "-T linker.ld -o main.bin -ffreestanding -O2 -nostdlib boot.o nimcache/main.o nimcache/stdlib_system.o nimcache/stdlib_unsigned.o nimcache/ioutils.o"`
17:28:53FromDiscord<Gary M> so there's your hint πŸ˜„
17:28:56watzonOh hello there lol
17:29:40*Gustavo6046 joined #nim
17:35:10FromDiscord<jtiai> In reply to @Gary M "in nimkernel he's linking": But I'm not getting the object files yet...
17:36:25FromDiscord<Gary M> You might have to pass the flags like -nostdlib to the linker... You could replicate his setup with nake or do it with nimble tasks
17:37:43FromDiscord<jtiai> Right. Thanks pointing out since now I see that -nostdlib is missing from compilation output...
17:37:56FromDiscord<jtiai> I knew that here are smart people πŸ˜„
17:38:08FromDiscord<Gary M> Also, did you check your Nimcache directory for the build artifacts?
17:38:27FromDiscord<Gary M> If it's only failing on linking you might still have the object files
17:38:58FromDiscord<Gary M> Also no no I'm not smart
17:40:42FromDiscord<jtiai> Custom build dir, -nostdlib is there but still nim tries to include stdint.h
17:41:13FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2TLq
17:45:01FromDiscord<Gary M> Are you doing that with passL
17:46:49*blackpawn_ joined #nim
17:47:35*blackpawn quit (Ping timeout: 265 seconds)
17:47:36FromDiscord<jtiai> no?
17:47:59FromDiscord<jtiai> IOW, I've no clue what "passL" is.
17:49:37*lritter quit (Ping timeout: 256 seconds)
17:50:18*blackpawn joined #nim
17:51:44*blackpawn_ quit (Ping timeout: 265 seconds)
17:57:00FromDiscord<Gary M> https://nim-lang.org/docs/nimc.html
17:57:22FromDiscord<Gary M> "pass an option to the linker"
18:05:46reversem3so passed nimlings
18:06:00reversem3is the deep dive referring to the manual?
18:06:19reversem3Covers the 80% of Nim you'll see the majority of the time.
18:06:19reversem3If you need to learn the other 20%, we'll provide good sources to dive deep.
18:17:50*JustASlacker joined #nim
18:18:22FromDiscord<jtiai> In reply to @Gary M ""pass an option to": Not using that. Though I think my build is stuck at compilation phase.
18:25:16ozzzGuys, seems I miss something, I created proc proc worker() {.thread.} =, but createThread(thr[i], worker) raises err: Error: type mismatch: got <Thread[system.void], proc (){.closure, gcsafe, locks: 0.}>
18:25:39ozzzthr defined as: thr: array[10, Thread[void]]
18:26:12ozzzwhat may cause this?
18:29:03FromDiscord<haxscramper> You have `{.closure.}` annotation on procedure, while https://nim-lang.org/docs/threads.html#createThread%2CThread%5Bvoid%5D%2Cproc%29 requires `{.nimcall, thread.}`
18:29:40FromDiscord<haxscramper> Maybe this is the reason. If you create `worker` in local context it is most likely a closure
18:29:57FromDiscord<haxscramper> Try to annotate it with `{.nimcall.}` explicitly - it will error out if you capture something
18:32:12reversem3so reading the style guide and if you use the std lib you should first reference the std lib?
18:32:13reversem3Standard library imports should be prefixed with std/, like std/os, std/[strutils, sequtils], etc.
18:32:33*vicfred quit (Quit: Leaving)
18:32:36reversem3so if I want to use strformat I should use std/strformat ?
18:32:49reversem3not just import strformat ?
18:33:10ozzzhaxscramper, thanks, I will try now
18:33:46FromDiscord<haxscramper> In reply to @reversem3 "so reading the style": Yes, it is recommended to do `std/` for all new code
18:34:54reversem3ok didn't know what
18:35:01reversem3 * ok didn't know that
18:35:36*icebattle joined #nim
18:41:50*casaca quit (Ping timeout: 272 seconds)
18:43:40FromDiscord<haxscramper> Is it possible to create `seq[Future]` and await for its completion, and then add new future to that list? This is still related to my previous question, but I think I can just try and keep several `sleep()` procs at the same time and then introduce processes
18:46:40FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2TLT
18:49:55FromDiscord<haxscramper> @jtiai do you have it in `--includepath` for the C compiler?
18:50:38FromDiscord<haxscramper> Try running compilation with `--passC:-v` to show include paths (if this gcc toolchain supports it)
18:50:53FromDiscord<jtiai> No. There are no headers because I'm compiling for bare metal...
18:51:14FromDiscord<haxscramper> I doubt it matters what you are compiling to
18:51:45FromDiscord<haxscramper> If your code includes something then header must be present, or you are working with single big C file
18:52:11FromDiscord<haxscramper> And nim might use some convenience C typedefs from `stdint.h` anyway
18:53:24FromDiscord<jtiai> That's not how cross compilation works.
18:54:06FromDiscord<TurtleP> Hey β€” so I’m wondering how I can simply read a file and change its binary data. Specifically data on this page: <https://www.3dbrew.org/wiki/SMDH> for example
18:55:12FromDiscord<haxscramper> In reply to @TurtleP "Hey β€” so I’m": I think you can read a file as a string (nim string is a sequence of bytes), change some values and write it back.
18:56:03FromDiscord<haxscramper> So `var icon = readFile("file.ico"); icon[0] = char(0x40); writeFile("file.ico", icon);`
18:56:47*Gustavo6046 quit (Ping timeout: 260 seconds)
18:56:53FromDiscord<haxscramper> I suppose
18:57:03*Gustavo6046 joined #nim
18:57:07FromDiscord<Yardanico> You can also try to use file streams
18:57:08*Gustavo6046 quit (Remote host closed the connection)
18:57:19FromDiscord<Yardanico> Not sure how easy it would be to modify existing data though
18:57:51*conkker joined #nim
18:58:03*Gustavo6046 joined #nim
18:59:15FromDiscord<haxscramper> In reply to @haxscramper "I need to start": @DefinitelyNotYardanico Do you have any pointers for using async with processes? Or just launching and awaiting multiple procs at once?
18:59:56*JustASlacker quit (Ping timeout: 256 seconds)
19:01:47FromDiscord<Yardanico> In reply to @haxscramper "I need to start": Not sure, maybe you can try https://nim-lang.org/docs/osproc.html#execProcesses%2CopenArray%5Bstring%5D%2Cproc%28int%29%2Cproc%28int%2CProcess%29 ?
19:02:31FromDiscord<lbart> https://benhoyt.com/writings/count-words/ not bad for nim πŸ˜‰
19:06:13FromDiscord<haxscramper> In reply to @Yardanico "Not sure, maybe you": Yes, but I was hoping I could use async somehow to do this (because I also need to get all execution results, not just highest exit code for one process), instead of just copying part of this implementation and rewriting it for my needs
19:06:33FromDiscord<Yardanico> In reply to @haxscramper "Yes, but I was": But this proc has a callback, no?
19:06:39FromDiscord<Yardanico> So maybe you can get the output stream
19:08:57FromDiscord<TurtleP> In reply to @haxscramper "So `var icon =": Hm are there ways to substring? In python I could read it in as binary and then just do str[start:end]
19:09:09FromDiscord<haxscramper> In reply to @Yardanico "So maybe you can": I need to yield results immediately as they occur instead of waiting for all at once. But I guess implementing this with async is either impossible, or at least too hard (because right now it looks like I would need to use some lower-level details of async, which are basically undocumented, except for some brief description of the procs)
19:09:30FromDiscord<haxscramper> But I might be wrong
19:09:36FromDiscord<Yardanico> In reply to @TurtleP "Hm are there ways": It depends on what you want to do, yes you can get a substring or modify a substring
19:10:49FromDiscord<TurtleP> Alright
19:33:13FromDiscord<jtiai> Hmm... I think I'm getting why my cross compilation fails. Looks like nim checks certain patterns, like is compiler C99/C11 and makes few decisions in `nimbase.h`. So what would be correct way to resolve it? Provide custom stdint.h? Some flag that says my system doesn't have one?
19:35:25ForumUpdaterBotNew thread by Vitreo12: Manually initializing exception handling, see https://forum.nim-lang.org/t/7683
19:48:13ozzzhaxscramper, Seems nested function cannot be processed
19:49:01ozzzsame code works outside funct.
19:56:52*Gustavo6046 quit (Ping timeout: 260 seconds)
19:58:07FromDiscord<haxscramper> Have you tried using `.nimcall.` explicitly?
19:59:16ozzzyes, proc worker() {.thread, nimcall.} =
20:00:02ozzztype mismatch: got <Thread[system.void], proc (){.closure, gcsafe, locks: 0.}>
20:02:41FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2TMr
20:02:54*Gustavo6046 joined #nim
20:05:54FromDiscord<haxscramper> In reply to @ozzz "yes, proc worker()": That is quite strange, because .nimcall. and .closure. are mutually exclusive. https://nim-lang.org/docs/manual.html#types-procedural-type. so explicit annotation was supposed to solve this. Moving procedure declaration to to top-level makes it .nimcall. automatically (because all external variables it might reference are global, so nothing no capture)
20:07:15ozzzFromDiscord, thanks for explanation. I need to find another way how solve it
20:17:54FromDiscord<jtiai> @haxscramper managed to resolve it. Bug was actually in my nim.cfg: `--passc:"-w -I$lib -ffreestanding -O2 -Wall -Wextra -nostdlib ` $lib is empty so -I took -ffreestanging as a paremeter. You can guess the rest... πŸ˜„
20:21:47*FromGitter joined #nim
20:22:40FromDiscord<haxscramper> https://media.discordapp.net/attachments/371759389889003532/823652919059808256/unknown.png
20:25:34FromDiscord<jtiai> Darn I've a winner feeling! πŸ₯³
20:26:19FromDiscord<Yardanico> In reply to @haxscramper "": Cursed
20:28:19FromDiscord<jtiai> Thank you for @Gary M and you too @haxscramper . Pushed me to right direction... Now I can write completely useless operating system.
20:31:58*casaca joined #nim
20:32:55ozzzhaxscramper, I found issue, it was global constant which I forgot to define in threadProc
20:40:23FromDiscord<jfmonty2> sent a code paste, see https://play.nim-lang.org/#ix=2TN0
20:41:17FromDiscord<jfmonty2> It seems like the per-function percentages are how much of the total runtime was spent in that stack frame, hence `main` being 100% since it wraps the entire program, but if it's spending 46% of the time in `comparisons.nim` then why is this entry only `1.67%`?
20:42:18*abm joined #nim
20:46:31*haxscramper quit (Remote host closed the connection)
20:46:53*haxscramper joined #nim
20:48:54*haxscramper quit (Remote host closed the connection)
20:49:49*PMunch joined #nim
20:56:21*narimiran quit (Ping timeout: 264 seconds)
20:57:39ForumUpdaterBotNew post on r/nim by Alh4zr3d: Stupid, beginner question about the compiler commands..., see https://reddit.com/r/nim/comments/maxqwl/stupid_beginner_question_about_the_compiler/
21:03:38FromDiscord<clyybber> In reply to @haxscramper "": https://media.discordapp.net/attachments/371759389889003532/823663230504534046/52qcyc.png
21:07:40FromDiscord<Yardanico> separators
21:08:06FromDiscord<Yardanico> separator aah
21:15:05FromDiscord<sealmove> not nim related but I have an `int64` and an `int32` and I want to encode them in a fixed-length string? is there something better/shorter than printing `a.toHex(16) & b.toHex(8)`?
21:21:02FromDiscord<Yardanico> @sealmove you can always pad them with zeroes I guess? And still have them in base10
21:21:06PMunchDidn't this use to cast an error? https://play.nim-lang.org/#ix=2TNb
21:22:22PMunchHmm, it did up until 1.0.2 and 1.2.0
21:22:37PMunchThat's a weird thing to remove in a patch update to 1.0
21:23:05FromDiscord<sealmove> In reply to @Yardanico "<@173424250319929344> you can always": oh hmm, will it be shorter?
21:23:38FromDiscord<sealmove> i mean in worst case senario base 10 should be longer than base 16, so if i want fixed length it must be longer...
21:28:37timdorohinsealmove: base64?
21:31:25FromDiscord<sealmove> how do you convert an integer to base64 though?
21:32:49*jjido joined #nim
21:33:33FromDiscord<sealmove> I guess I'll have to write my own code for this. nim's module `base64` is only for encoding strings, which is natural.
21:34:01timdorohinsealmove: import base64
21:34:09timdorohinsealmove: u r wrong
21:34:26timdorohinbase64 function definition -> proc encode[T: SomeInteger | char]
21:34:59FromDiscord<sealmove> but it's for openArray
21:35:00timdorohinsee SomeInteger?
21:35:10timdorohinand?
21:35:26FromDiscord<sealmove> hmm
21:36:16timdorohin[some-int] would work imo
21:36:48PMunchSo no one knows where the range check for type conversions went?
21:37:41FromDiscord<sealmove> In reply to @timdorohin "[some-int] would work imo": i guess it works, thanks ;)
21:37:57*JustASlacker joined #nim
21:38:16FromDiscord<sealmove> In reply to @PMunch "So no one knows": are you sure it's not intentional?
21:38:40PMunchIt might be, still a bit dubious that it was removed in 1.0.2 but present int 1.0.0
21:39:02FromDiscord<sealmove> indeed
21:40:24FromDiscord<sealmove> In reply to @timdorohin "[some-int] would work imo": ok but... I want to be able to get the integers back
21:41:03FromDiscord<sealmove> do I need to cast the string that decode returns?
21:42:33PMunchWhat exactly is it that you're trying to achieve here?
21:44:19*JustASlacker quit (Quit: Leaving)
21:45:23FromDiscord<sealmove> i want to encode 2 integers in fixed-length string, and I want this string to be as small as possible
21:45:35PMunchDefine string
21:45:45FromDiscord<sealmove> printable chars
21:46:00PMunchDefine printable chars
21:46:06FromDiscord<sealmove> (no spaces, tabs, new lines, etc)
21:46:08PMunchAnd define short
21:46:15FromDiscord<sealmove> ideally ascii
21:46:20PMunchAh
21:46:34FromDiscord<sealmove> well shorter than printing them as hex :P
21:48:07FromDiscord<sealmove> base64 sounds a like a good idea, but the nim `base64` module can't help me I think.
21:48:33PMunchWell it can, but it'll be a bit clumsy to use
21:48:52FromDiscord<sealmove> i am ok with it being clumsy
21:48:54PMunchShortest number system you can make with all printable characters would be base 93 I think
21:49:17FromDiscord<sealmove> ohh :oo
21:49:42FromDiscord<sealmove> interesting
21:50:15FromDiscord<sealmove> maybe I'll make a module for this
21:55:38FromDiscord<zidsal> I `dumpTree` the following code `Color(70)` out of interest why is the `Call` wrapped in a statement list I'm presuming this is optional as there is only node?
21:56:11FromDiscord<ElegantBeef> it's probably optional but it's usually safe to do
21:57:01PMunchIt's just because you gave it a statement list
21:57:06PMunchCompare the output of these two: https://play.nim-lang.org/#ix=2TNn
21:57:34FromDiscord<zidsal> oh ofc, putting in a block would turn it into a statement list thanks guys
22:03:42*conkker quit (Quit: The Lounge - https://thelounge.chat)
22:04:47*conkker joined #nim
22:07:15*Vladar quit (Quit: Leaving)
22:09:47*conkker quit (Quit: The Lounge - https://thelounge.chat)
22:10:06*conkker joined #nim
22:27:16*PMunch quit (Quit: leaving)
23:03:01FromDiscord<Hi02Hi> In reply to @PMunch "Shortest number system you": !eval echo "1234567890!@#$%^&()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~-_=+[]{}|;:'\"<>,./?".len
23:07:48FromDiscord<dom96> ouch, looks like NimBot needs to parse the Discord relay's "In reply to ...:" prefix :/
23:08:02FromDiscord<dom96> (https://irclogs.nim-lang.org/22-03-2021.html#23:03:01)
23:08:06FromDiscord<dom96> !eval echo "1234567890!@#$%^&()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~-_=+[]{}|;:'"<>,./?".len
23:08:07NimBotCompile failed: /usercode/in.nim(1, 96) Error: expression expected, but found ','
23:09:53FromDiscord<Hi02Hi> oops. accidentaly left in a stray "
23:10:01FromDiscord<Hi02Hi> !eval echo "1234567890!@#$%^&()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~-_=+[]{}|;:'\"<>,./?".len
23:10:06NimBot93
23:26:34*jess quit (Quit: K-Lined)
23:27:39*j joined #nim
23:32:15FromDiscord<Yardanico> !eval echo len '1'..'?'
23:32:17NimBot15
23:33:14FromDiscord<Yardanico> !eval echo len '!'..'~'
23:33:17NimBot94
23:37:21*tane quit (Quit: Leaving)
23:37:58*vicfred joined #nim
23:49:26FromDiscord<Seedofarson> Bro
23:49:40FromDiscord<Seedofarson> I lost my Server/VPS
23:49:43FromDiscord<Seedofarson> And my development folder
23:49:45FromDiscord<Seedofarson> I’m sad
23:50:10FromDiscord<Seedofarson> !eval import httpclient
23:50:13NimBot<no output>
23:50:23FromDiscord<Seedofarson> !eval ↡import httpclient
23:50:24NimBotCompile failed: /usercode/in.nim(1, 1) Error: undeclared identifier: '↡import'
23:58:12FromDiscord<dom96> not using git?