<< 18-01-2023 >>

00:14:22*jmdaemon joined #nim
00:17:42FromDiscord<Leftbones> sent a code paste, see https://play.nim-lang.org/#ix=4lxL
00:18:17FromDiscord<Leftbones> Even if they're both valid, I prefer to follow the coding standards (as long as they're not obnoxious, looking at you C#)
00:18:40FromDiscord<Leftbones> (edit) "C#)" => "any language that tells me open brackets should be on a new line)"
00:18:53FromDiscord<Leftbones> (edit) "any" => "any" | "line)" => "line)"
00:19:27FromDiscord<leorize> the modern version of that is to write your code in nim
00:19:56FromDiscord<leorize> re\: this
00:20:16FromDiscord<Elegantbeef> I personally do the latter left
00:20:27FromDiscord<Elegantbeef> Easier to add new types to
00:20:43FromDiscord<Leftbones> That's what I see on nim-by-example and other references and docs, so I assumed that was the recommended styling
00:20:53FromDiscord<Leftbones> And yeah, adding new types under the same `type` declaration is great
00:21:32FromDiscord<Leftbones> In reply to @leorize "the modern version of": Agreed, I'm a hobby/passion programmer, I don't get paid to do it, so I write in whatever language I like writing, and for the past few days I've really been vibing with Nim
00:21:38FromDiscord<Elegantbeef> Plus you never have an issue with cyclical types
00:21:58FromDiscord<Elegantbeef> Oh shit i'm doing this, but still not getting paid! 😛
00:22:28FromDiscord<leorize> just work for status, duh
00:22:57FromDiscord<Leftbones> Will they hire someone who has no formal programming experience or training
00:22:59FromDiscord<leorize> surely the ethereum market won't crash overnight
00:23:11FromDiscord<Leftbones> Surely not, crypto is known for being stable
00:23:20FromDiscord<Elegantbeef> You're FTXing me
00:25:36FromDiscord<leorize> fwiw this is the case for most of nim devs, and they got hired so...↔(@Leftbones)
00:26:07FromDiscord<Elegantbeef> It's quite odd how many Nim programmers are self taught
00:26:11FromDiscord<Leftbones> I suppose there aren't many people with professional Nim experience at this point, and I'm not sure formal Nim education exists yet
00:26:30FromDiscord<Leftbones> Tbh I hope the industry continues to shift towards acceptance of self-taught programmers
00:26:55FromDiscord<leorize> I mean, do they not? as long as you have things to back you up
00:27:26FromDiscord<Leftbones> Yeah it just felt like for a long time, the only thing that matters is the piece of paper saying you know what you're doing (even if you don't, but you paid for the paper)
00:27:28FromDiscord<Elegantbeef> "acceptance of self-taught programmers" many big companies were founded by these
00:28:09FromDiscord<Elegantbeef> This is why i discredit leo here, he paid for his pretend knowledge 😛
00:28:41FromDiscord<leorize> yep, throwing money into the pit for a paper of questionable value here
00:28:41FromDiscord<Leftbones> I remember reading that before Python was as popular as it is now, someone said hiring Python devs was like a cheat code for getting good programmers since they chose to write in a language they were passionate about, maybe that'll be what Nim is
00:29:09FromDiscord<Elegantbeef> That's the case for some Nim programmers, but i've seen some code
00:29:10FromDiscord<Leftbones> In reply to @leorize "yep, throwing money into": gold star, you done did it⭐
00:29:17FromDiscord<Leftbones> (edit) "it⭐" => "it ⭐"
00:34:59FromDiscord<auxym> In reply to @Leftbones "I remember reading that": I've read people say that about clojure on HN recently
00:36:02FromDiscord<Leftbones> In reply to @auxym "I've read people say": Probably applies to a lot of the more "niche" languages, there's plenty of them haha
01:32:08*argonica joined #nim
02:38:58*jmdaemon quit (Ping timeout: 256 seconds)
03:48:38FromDiscord<Rika> In reply to @Leftbones "Wait, is the proper": Not standardised, I believe a good amount of people use one or the other
04:06:36*azimut_ joined #nim
04:07:14*azimut quit (Remote host closed the connection)
04:18:04FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4lyq
04:26:01FromDiscord<Elegantbeef> Cannot say much i dont use pattern matching\\
04:35:13FromDiscord<sOkam!> @Rika I saw you mentioned in the fusion/matching doc page. Do you know what this code is doing, and if its possible to do it without fusion/matching?
04:36:41FromDiscord<sOkam!> I understand its matching tree types, and when the tree matches then it returns the tree in a different order↔but i'm not understanding what the @a, @x, @b, etc etc its supposed to be doing
04:43:21FromDiscord<Elegantbeef> Capturing the values
04:46:25FromDiscord<sOkam!> capturing the values as in creating a variable that contains the contents of that thing?
04:46:41FromDiscord<Elegantbeef> Think `@` is mutable capture
04:46:44FromDiscord<sOkam!> if so, how is it possible that the order is different, but it matches?
04:49:10FromDiscord<sOkam!> In reply to @Elegantbeef "Think `@` is mutable": what does that mean in practice?
04:49:19FromDiscord<Elegantbeef> the `|` i assume
04:49:33FromDiscord<Elegantbeef> `x = y` would assign the field that `x` matches
04:49:36FromDiscord<Rika> I never would have thought that I would be pinged for help because of the quote on matching
04:50:23FromDiscord<Rika> In reply to @sOkam! "I understand its matching": It binds and sets a variable named that in the position it is in on the pattern
04:50:53FromDiscord<sOkam!> what do you mean bind/
04:50:59FromDiscord<sOkam!> (edit) "bind/" => "bind?"
04:51:17FromDiscord<Rika> Not in the Nim sense but in the general sense
04:52:04FromDiscord<Rika> Like if the value matches the pattern, whatever value is in the place of the @name is placed in a variable named name
04:52:19FromDiscord<sOkam!> i see. is it possible to do this without matching?
04:52:26*genpaku quit (Remote host closed the connection)
04:52:27FromDiscord<Rika> No
04:52:28FromDiscord<Elegantbeef> Of course
04:52:35FromDiscord<Rika> I mean yeah but no
04:52:37FromDiscord<sOkam!> even if it takes 100 lines of code
04:52:42FromDiscord<Elegantbeef> Pattern matching is just a syntax sugar on the if statements
04:52:44FromDiscord<Rika> It’s possible but do you really want to
04:52:49FromDiscord<Elegantbeef> Expand macros shows it's possible
04:53:05FromDiscord<Rika> I don’t really understand the “is it possible” anyway
04:53:11FromDiscord<Rika> In what constraints
04:53:31FromDiscord<sOkam!> In reply to @Rika "It’s possible but do": well, i want to implement an rbtree, and i don't want to rely on fusion/matching and/or GC'ed features. so i guess answer would be yeah
04:54:02FromDiscord<Rika> Why are people so averse to dependencies
04:54:05FromDiscord<sOkam!> In reply to @Rika "In what constraints": standard nim syntax, without experimental things
04:54:22*arkurious quit (Quit: Leaving)
04:54:28FromDiscord<Rika> In reply to @sOkam! "standard nim syntax,": It’s possible, it just won’t be pattern matching.
04:54:43FromDiscord<sOkam!> In reply to @Rika "Why are people so": im not. this is a toy project that uses gc:none specifically. i don't mind experimental things or dependencies usually. its just for this project only
04:54:44FromDiscord<Elegantbeef> look at C implementations of RBTree
04:54:46FromDiscord<Elegantbeef> Implement that
04:54:49FromDiscord<Rika> I mean, unless you implement it of course which most likely will be more work than necessary
04:55:09FromDiscord<sOkam!> In reply to @Elegantbeef "look at C implementations": there is only cpp on the site, and its template hell
04:55:43FromDiscord<Rika> In what site
04:56:00FromDiscord<sOkam!> https://rosettacode.org/wiki/Algebraic_data_types#Nim
04:56:43*genpaku joined #nim
04:57:16FromDiscord<Rika> You have a bit of work to do this in a no GC environment
04:57:18FromDiscord<Rika> And why?
04:57:43FromDiscord<sOkam!> learning/toy project
04:59:09FromDiscord<Rika> Okay
04:59:10FromDiscord<Rika> Well
04:59:42FromDiscord<Rika> This will be unsafe, no way around that just saying
05:00:41FromDiscord<Rika> Hmm
05:01:26FromDiscord<Rika> I think it’s gonna look vastly uglier with no matching lol
05:01:34FromDiscord<sOkam!> i bet
05:01:54FromDiscord<Girvo> Simplest way of zeroing/clearing/emptying an `array[T, byte]`?
05:02:05FromDiscord<Girvo> memset I guess? lol
05:02:29FromDiscord<sOkam!> there is zeroMem, but there might be a safer way
05:02:41FromDiscord<Rika> arr = default(arr) ↔Idk lol
05:02:51FromDiscord<Girvo> zeroMem thats what I was looking for yeah
05:03:20*azimut_ quit (Ping timeout: 255 seconds)
05:03:26FromDiscord<Girvo> Unsafe is fine I'm deep in in-place algorithms in embedded firmware đŸ„Č
05:03:43FromDiscord<Girvo> (And I have the length check anyway for this)
05:11:18FromDiscord<Girvo> Oh good now I need to shift/delete the first 4 bytes of this array haha
05:23:03FromDiscord<Elegantbeef> `reset` exists aswell
05:23:59FromDiscord<Girvo> Oh nice
06:04:41*rockcavera quit (Remote host closed the connection)
06:42:37*kenran joined #nim
06:44:43*kenran quit (Remote host closed the connection)
07:24:38FromDiscord<Scalpi> Where to put asterisk to make "import" public? Or is there some other syntax for this? Why not just use "pub" like in zig?↔I tried to write public at the beginning of the line and I get Error: invalid indentation... as an error.
07:24:54FromDiscord<pyryrin> What are "multimethods"?
07:25:51FromDiscord<pyryrin> In reply to @Scalpi "Where to put asterisk": `export` keyword
07:26:45FromDiscord<Elegantbeef> Export after symbol
07:26:50FromDiscord<Elegantbeef> `proc myProc(...) =...`
07:27:38FromDiscord<Elegantbeef> Oh i misread yea `export my module`
07:27:58FromDiscord<Elegantbeef> Multimethods are deprecated but they use type information of multiple parameters to dispatch
07:28:10FromDiscord<Elegantbeef> It's ludicrous for following code
07:28:22FromDiscord<pyryrin> Oh
07:30:51FromDiscord<Scalpi> sent a code paste, see https://paste.rs/Xwa
07:32:24FromDiscord<Scalpi> sent a code paste, see https://play.nim-lang.org/#ix=4lyP
07:32:54FromDiscord<Scalpi> sent a code paste, see https://play.nim-lang.org/#ix=4lyQ
07:32:56FromDiscord<Scalpi> (edit) "https://play.nim-lang.org/#ix=4lyP" => "https://paste.rs/2m6"
07:33:18FromDiscord<Scalpi> no one variant 😩
07:42:53FromDiscord<Rika> import a↔export a
07:43:03FromDiscord<Rika> import a as b↔export b
07:43:22FromDiscord<Rika> @Scalpi
07:44:52FromDiscord<pyolyokh> <https://nim-lang.org/docs/manual.html#modules-export-statement>
08:01:36*jjido joined #nim
08:03:24FromDiscord<Scalpi> In reply to @Rika "import a export a": but this not "public"
08:04:18FromDiscord<Elegantbeef> Nim doesnt have "public"
08:04:20FromDiscord<Elegantbeef> It has exported and not exported
08:04:23FromDiscord<Elegantbeef> What does "public" mean to you
08:04:55FromDiscord<Scalpi> in file lib.nim: Warning: imported and not used: m↔in file main: Error: undeclared identifier: 'm'
08:06:24FromDiscord<Scalpi> sent a code paste, see https://play.nim-lang.org/#ix=4lyY
08:06:52FromDiscord<Elegantbeef> Whatever you're doing is not how anything in Nim is written
08:07:29FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/s5T
08:07:33*termer_ joined #nim
08:09:09*termer quit (Ping timeout: 256 seconds)
08:09:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lz1
08:15:04FromDiscord<ShalokShalom> @Elegantbeef#0000 you learned programming with C#?
08:15:11FromDiscord<Elegantbeef> Yes
08:15:25FromDiscord<Scalpi> sent a code paste, see https://play.nim-lang.org/#ix=4lz4
08:16:13FromDiscord<pyolyokh> you'll need to create a structure explicitly.
08:16:47FromDiscord<Rika> In reply to @Scalpi "thanks ... can I": You don’t need the constant, it’ll just be like that as is
08:16:59FromDiscord<Elegantbeef> Nim modules are not like Zig modules
08:17:16FromDiscord<Elegantbeef> Importing a module gives you first class access to all of it's exported symbols
08:17:30FromDiscord<Elegantbeef> @ShalokShalom\: was there a follow up?
08:17:40FromDiscord<Elegantbeef> Or are you just stalking my git repos 😄
08:17:58FromDiscord<pyolyokh> nah, you can do a lot of this, it's just a lot of work for no gain except that you'll have written some Nim code without ever giving Nim a chance
08:18:25FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lz5
08:19:49FromDiscord<Rika> You don’t even need the nil import, either way would work
08:19:58FromDiscord<Rika> The nil import enforces, but it’s valid without
08:20:04FromDiscord<pyolyokh> without nil, `doit()` would work, which is what Scalpi's trying to avoid
08:20:13FromDiscord<Scalpi> In reply to @Rika "You don’t need the": but then, if the names match, the compiler will explicitly ask me to specify a specific path ...
08:20:14FromDiscord<Rika> Yes, but I assumed they didn’t want to avoid it
08:20:32FromDiscord<Rika> In reply to @Scalpi "but then, if the": Then you can disambiguate with just putting it
08:20:35FromDiscord<pyolyokh> In reply to @Scalpi "but then, if the": Nim isn't Python and doesn't have Python's problems
08:21:17FromDiscord<Rika> Procedures can be disambiguated by name and arguments
08:21:17FromDiscord<pyolyokh> if your modules are meaningful they're going to be filled with procs that operate on different types anyway
08:22:10FromDiscord<Elegantbeef> Yea the response "Dont pretend this is X language" is very much my response
08:22:43FromDiscord<Elegantbeef> Nim has plenty of mechanisms to disambiguate and when an ambiguity error comes up you can easily disambiguate
08:23:10FromDiscord<ShalokShalom> In reply to @Elegantbeef "<@208199869301522432>\: was there a": I was simply interested about the background of yours
08:23:35FromDiscord<Elegantbeef> It's non existent
08:23:36FromDiscord<ShalokShalom> And you once told me, C# is the only other language you know
08:24:22FromDiscord<Scalpi> In reply to @Elegantbeef "Nim has plenty of": I would not like to eliminate ambiguity errors, just declare once what exactly I need and use ... now I found the alias command but have not yet found its documentation ... maybe this is what I need, or maybe not ... still understand and understand...
08:24:49FromDiscord<Elegantbeef> Nim code doesnt really "declare exactly what i need and use"
08:25:25FromDiscord<Elegantbeef> you can using `from x import y` and `export y` but for most code that's far and few inbetween
08:25:49FromDiscord<Scalpi> In reply to @Elegantbeef "Nim code doesnt really": Indeed? why then errors like "discard not specified"
08:25:59FromDiscord<Elegantbeef> What?
08:26:21FromDiscord<Elegantbeef> I've never seen a "discard not specified" in my life
08:26:51FromDiscord<Rika> Nim does not allow for values to be left unused implicitly
08:27:04FromDiscord<Rika> Unless you make it do so, of course
08:27:07FromDiscord<Elegantbeef> Oh you mean "why does one have to explicitly discard"
08:27:31FromDiscord<Elegantbeef> It's cause everything can be an expression in Nim which means you enforce discarding to not make it ambiguous
08:27:34FromDiscord<Rika> In reply to @Scalpi "I would not like": I have never seen this alias command
08:28:02FromDiscord<pyolyokh> the other question, of how to make `foo` expand to `baz.bar.foo`, is a template.
08:28:10FromDiscord<pyolyokh> (edit) "the other question, of how to make `foo` expand to `baz.bar.foo`, is ... a" added "answered with"
08:28:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lz9
08:29:41*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz
)
08:30:10FromDiscord<Scalpi> In reply to @Rika "I have never seen": because it doesn't exist. I saw it in github nim and it looks like it was just a suggestion for inclusion in the language...
08:30:14FromDiscord<pyolyokh> implicit discards cause problems. Nim's module (lack of) namespacing doesn't. Languages evolve to address complaints with the language.
08:31:01FromDiscord<Rika> I think there are some readability problems with lack of name spacing but I don’t think they’re too much
08:31:37FromDiscord<Elegantbeef> There is some, but there's also readability issues with `myThing::myOtherThing::myOthererThing.myOtherFIeld` 😛
08:31:48FromDiscord<pyolyokh> yeah, I slightly prefer go's way of it, but it's not a big deal.
08:32:25FromDiscord<pyolyokh> and go still requires tooling like 'goimport' to be tolerable
08:32:48FromDiscord<Elegantbeef> Go also does compiler directives with `///`
08:33:07FromDiscord<Elegantbeef> Whoops `//`
08:33:39FromDiscord<pyolyokh> yeah, it's a very silly language, but it works. That it's obnoxiously designed while having good tooling and basically working is part of why I'm not that sympathetic to minor design complaints with Nim.
08:33:40FromDiscord<Rika> Comments
08:33:41FromDiscord<Rika> With comments
08:38:36FromDiscord<Scalpi> sent a code paste, see https://play.nim-lang.org/#ix=4lza
08:38:52FromDiscord<Elegantbeef> Cause the parser is very bad at detecting bad code
08:40:02FromDiscord<pyolyokh> it punishes slightly-wrong Nim with bad errors. It very slowly gets better. The only effective cure is to learn the language
08:40:23FromDiscord<Rika> What’s the code you put
08:40:57FromDiscord<Scalpi> sent a code paste, see https://play.nim-lang.org/#ix=
08:41:15FromDiscord<Scalpi> my bad ^)
08:48:11FromDiscord<ShalokShalom> One of the core issues with Nim for me
08:48:29FromDiscord<ShalokShalom> Bad error messages
08:50:44FromDiscord<ShalokShalom> @pyolyokh I guess tooling also suffers under this
09:20:42FromDiscord<pyryrin> How do I detect if its compiling to javascript inside code
09:21:45FromDiscord<Elegantbeef> `when defined(js)`
10:15:14*argonica quit (Remote host closed the connection)
10:39:15Amun-Rahow to convert specific integer to pointer?
10:44:11Amun-Raah, I was casting to "pointer"
 ;>
10:50:59Amun-Ra(it's for FFI)
11:06:41FromDiscord<demotomohiro> !eval let x = 1234.cint; echo cast[int](cast[ptr float](x.int))
11:06:48NimBot1234
11:10:08*PMunch joined #nim
11:44:43*xet7 quit (Remote host closed the connection)
11:47:00*PMunch quit (Quit: Leaving)
11:52:53*PMunch joined #nim
12:05:47Amun-RaI had a brain fart and wrote cast[pointer] instead of pointer to specific type
12:10:49FromDiscord<Arouzing> I wonder what protections the bot has in place.
12:15:43*PMunch quit (Quit: Leaving)
12:33:52*PMunch joined #nim
12:44:52*PMunch quit (Quit: Leaving)
12:56:16*xet7 joined #nim
12:58:09*PMunch joined #nim
13:17:35FromDiscord<jmgomez> In reply to @ShalokShalom "Bad error messages": I dont feel like that's an area that needs improvement relatively to other areas like tooling in general or bugs on the type system. They can be better for sure, but they are more and less at the level of C++ (or even better)
13:21:39FromDiscord<Anpanman> sent a long message, see http://ix.io/4lA6
13:24:57PMunchAny reason why you want to statically compile against them?
13:26:30*jjido joined #nim
13:27:56*argonica joined #nim
13:32:27FromDiscord<Anpanman> I'm learning Nim by making an agent in the mythic framework, single exe (or dll or what have you) is all that makes sense for it really
13:32:34FromDiscord<Anpanman> (Mythic is a C2 framework)
13:33:08FromDiscord<enthus1ast> @Anpanman\: another option is to use puppy
13:33:17FromDiscord<enthus1ast> this uses the os for http calls
13:33:22FromDiscord<Rika> In reply to @BigSlugga "(Mythic is a C2": "Do you have the slightest idea how little that narrows it down?"
13:33:30FromDiscord<Rika> In reply to @enthus1ast "<@352968094404313089>\: another option is": they mentioned it
13:33:32FromDiscord<Rika> they want async
13:33:37FromDiscord<Anpanman> Oh I mentioned that 🙂
13:33:44FromDiscord<enthus1ast> ok
13:34:15FromDiscord<enthus1ast> would be much simpler though
13:34:34FromDiscord<Anpanman> lol yes it would
13:36:53FromDiscord<enthus1ast> and when you use this for development https://teskalabs.com/blog/openssl-binary-distribution-for-developers-static-library
13:36:59FromDiscord<enthus1ast> and later build it yourself properly
13:37:00FromDiscord<enthus1ast> ?
13:38:42FromDiscord<Anpanman> hmm i'll take a look, that might be what i have to do
13:39:15*rockcavera joined #nim
13:39:36FromDiscord<enthus1ast> since you're hacking anyway, there is another more hacky solution
13:40:08FromDiscord<enthus1ast> https://github.com/khchen/memlib
13:40:20FromDiscord<enthus1ast> but no idea if this works out of the box with ssl
13:41:00FromDiscord<Anpanman> Not sure but looks pretty cool! Already using their winim library 🙂
13:43:32*argonica quit (Remote host closed the connection)
13:44:19*argonica joined #nim
13:57:17*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz
)
13:58:15FromDiscord<fabricio> idk if anyone has asked this before but has anyone benchmarked programs compiled with the nim c compiler and nlvm to compare the performance?
14:01:04*argonica quit (Remote host closed the connection)
14:02:23*argonica joined #nim
14:05:05FromDiscord<pyryrin> does nim sometimes turn off dead code elimination or something? because in lot of c library wrappers source code there is explicitly `{.deadCodeElim: on.}`
14:05:50FromDiscord<ringabout> In reply to @pyryrin "does nim sometimes turn": `{.deadCodeElim: on.}` is always on.
14:06:04FromDiscord<pyryrin> so why would they explicitly say it
14:06:34FromDiscord<ringabout> You may blame c2nim for using deprecated `{.deadCodeElim: on.}`.
14:06:46FromDiscord<ringabout> But I have fixed it.
14:07:23FromDiscord<pyryrin> its in the official sdl2 and everything
14:07:30FromDiscord<pyryrin> (edit) removed "and everything"
14:08:33FromDiscord<ringabout> In reply to @pyryrin "its in the official": Yeah, because these C wrappers use c2nim
14:08:43FromDiscord<ringabout> See https://github.com/nim-lang/c2nim/pull/236
14:08:58FromDiscord<ringabout> In reply to @pyryrin "its in the official": PR is welcome to remove the statement.
14:14:33FromDiscord<ringabout> https://cs.github.com/?scopeName=All+repos&scope=&q=%7B.deadCodeElim%3A+on.%7D++language%3Anim
14:14:51FromDiscord<ringabout> All of them should be removed.
14:15:58FromDiscord<ringabout> I will add a warning for the `{.deadCodeElim: on.}` statement,
14:25:27*arkurious joined #nim
14:26:15FromDiscord<Mitja Felicijan> Do any of you know about a good IMAP library for Nim?
14:40:44FromDiscord<enthus1ast> Mitja Felicijan\: idk if there is a lib already, but the core of the imap protocol is quite simple to implement
14:41:55FromDiscord<enthus1ast> Have done some imap basic for a spam analysis experiment
14:45:00FromDiscord<Mitja Felicijan> I would probably need to do this with sockets right?
14:59:25*argonica quit (Remote host closed the connection)
15:01:15*argonica joined #nim
15:01:26*argonica quit (Remote host closed the connection)
15:02:32FromDiscord<voidwalker> @mitja https://github.com/search?q=language%3Anim+imap&type=repositories and https://nimble.directory/pkg/imap
15:04:15*argonica joined #nim
15:05:50FromDiscord<Mitja Felicijan> Lovely! I should have checked Github lol 🙂 Thank you!↔(@voidwalker)
15:13:40*PMunch quit (Quit: Leaving)
15:18:47*azimut joined #nim
15:22:25FromDiscord<⚶ Zeno> how can i get string out of float ?↔↔0.546544 to "0.546544" for example
15:22:37FromDiscord<enthus1ast> $0.1337
15:22:46FromDiscord<⚶ Zeno> i completely forgot about $
15:22:47FromDiscord<⚶ Zeno> thanks
15:23:04FromDiscord<enthus1ast> yes
15:32:09*argonica quit (Quit: Leaving)
15:32:35*argonica joined #nim
15:33:17FromDiscord<Scalpi> In reply to @enthus1ast "<@352968094404313089>\: another option is": terrible barking at the entrance. Seriously?
15:38:57FromDiscord<sOkam!> In reply to @⚶ Zeno "how can i get": reverse is also possible with parseFloat
15:39:24FromDiscord<⚶ Zeno> In reply to @sOkam! "reverse is also": i see, thanks
15:41:36*jmdaemon joined #nim
15:42:04*argonica quit (Remote host closed the connection)
15:42:48FromDiscord<Jessa> what's the non-deprecated version of `readLines`
15:43:41FromDiscord<Rika> "Deprecated: use readLines with two arguments"
15:43:55FromDiscord<djazz> readBetweenTheLines
15:44:03FromDiscord<djazz> 😉
15:44:08FromDiscord<Rika> if you want to read the whole file its `readFile`, passing the filename
15:44:34FromDiscord<Jessa> In reply to @Rika "if you want to": whole file just without trailing newlines
15:45:15FromDiscord<Rika> there is the iterator `lines` https://nim-lang.org/docs/io.html#lines.i%2CFile
15:45:22FromDiscord<Rika> takes either a File or a filename string
15:46:17FromDiscord<Jessa> idk what i did different, but now `lines` works for some reason↔whereas before it gave some weird error
15:46:20FromDiscord<Jessa> ¯\_(ツ)_/¯
15:46:29FromDiscord<Jessa> In reply to @Rika "takes either a File": thanks for actually helping and not just sending shade
15:46:34FromDiscord<fabricio> sent a code paste, see https://play.nim-lang.org/#ix=4lAL
15:47:06FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4lAM
15:59:29*jmdaemon quit (Ping timeout: 256 seconds)
15:59:57*jmdaemon joined #nim
16:06:22FromDiscord<Recruit_main707> why so mad lol
16:06:29*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
16:07:18*jmdaemon joined #nim
16:39:42*jmdaemon quit (Ping timeout: 272 seconds)
16:48:20*jmdaemon joined #nim
17:14:23FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4lB8
17:16:05FromDiscord<sOkam!> i guess its the same question as:↔- how to get time in seconds in float64, based on a duration?
17:16:07FromDiscord<pyolyokh> use one of the inMicroseconds, inSeconds procs, and convert from int64 to float
17:16:33FromDiscord<sOkam!> In reply to @pyolyokh "use one of the": inseconds is int. it would destroy precision
17:16:52FromDiscord<pyolyokh> inSeconds would give you second precision. There are other procs
17:17:09FromDiscord<pyolyokh> int64 is more precise than float64
17:17:10FromDiscord<sOkam!> yeah, but if i want to get seconds as float, that's what I'm not grasping how to do
17:17:23FromDiscord<pyolyokh> inSeconds is an example. There are other procs.
17:17:32FromDiscord<sOkam!> i know there are other procs
17:17:39FromDiscord<sOkam!> im saying that i don't get how to use them
17:17:47FromDiscord<pyolyokh> they work the same way as inSeconds
17:17:49FromDiscord<sOkam!> it must be really stupid dum question, but i always struggle with those
17:18:11FromDiscord<sOkam!> In reply to @pyolyokh "they work the same": except they are all ints
17:18:22FromDiscord<sOkam!> and I'm trying to get seconds as float
17:18:24FromDiscord<pyolyokh> int64 is more precise than float64
17:19:01FromDiscord<sOkam!> man, but i need delta as 0.25s to multiply to a vector to get from velocity per frame to velocity per second
17:19:14FromDiscord<sOkam!> I would just use the int, but i need to multiply with a vector to interpolate and integrate
17:19:33FromDiscord<pyolyokh> right, so convert int64 to float64 to do that math
17:19:41FromDiscord<pyolyokh> in the units that work for you
17:19:59FromDiscord<sOkam!> except inseconds destroys precision
17:20:24FromDiscord<pyolyokh> then don't use that one
17:20:30FromDiscord<sOkam!> i feel this is one of those stupid things that must be in front of my damn face, and i never see them 🙈
17:20:33FromDiscord<pyolyokh> there are other procs!
17:20:44FromDiscord<sOkam!> but those other procs don't give seconds!
17:20:53FromDiscord<sOkam!> the question is basically how to convert
17:21:02FromDiscord<pyolyokh> OK, suppose you have 5000 milliseconds
17:21:04FromDiscord<pyolyokh> how many seconds is that?
17:21:24FromDiscord<sOkam!> 1/5000 ?
17:22:06FromDiscord<sOkam!> actually, nope. see, i'm dumb with these simple things 😔
17:22:15FromDiscord<ezquerra> Is there a target date for the official release of nim v2.0?
17:22:38FromDiscord<treeform> I also would like to know
17:23:38FromDiscord<sOkam!> 5000 / (msec in a second) i guess?
17:23:55FromDiscord<pyolyokh> yeah
17:24:36FromDiscord<sOkam!> would it be better to do the math with nanoseconds, to not lose too much precision?
17:25:32FromDiscord<pyolyokh> do algebra with units, where x/x=1. If you take an amount and divide it by an equivalent amount, you get 1. Multiplying an amount by 1 leaves you with the same amount. 1000 milliseconds = 1 second, so 1000ms/1s and 1s/1000ms are both ratios that you can multiply by a number to get that same number back, because you're multiplying it by 1.
17:26:30FromDiscord<pyolyokh> take 5000ms 1s/1000ms, that's (50001mss)/(1000ms), treating the units as factors as. So you can cancel them out. ms/ms = 1. It simplifies to 5000s/1000
17:26:42FromDiscord<pyolyokh> (edit) "as." => "as well."
17:27:43FromDiscord<pyolyokh> In reply to @sOkam! "would it be better": yeah. strictly speaking a Duration has >64bits of information, because it's an int64 of seconds + nanoseconds, but if you're making a game you're probably not going to want to wake a year before display updates
17:28:26FromDiscord<pyolyokh> just use whichever toThatUnit proc works for you, math it back to floating point seconds
17:28:34FromDiscord<sOkam!> kk
17:39:48FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4lBm
17:40:17FromDiscord<sOkam!> i can divide an int64 by an int literal, but not i64 by i64
17:42:33FromDiscord<ShalokShalom> In reply to @jmgomez "I dont feel like": Comparison to Elm...
17:42:43FromDiscord<ShalokShalom> Or Rust 😛
17:43:09FromDiscord<ShalokShalom> Lots of languages have much better error messages and I think particularly new programmers stuble over this
17:44:11FromDiscord<pyolyokh> sent a code paste, see https://paste.rs/dyo
17:44:30*jmdaemon quit (Ping timeout: 256 seconds)
17:44:37FromDiscord<sOkam!> In reply to @pyolyokh "you have the duration.toSomeUnit": what float? i don't follow
17:44:46FromDiscord<jmgomez> In reply to @ShalokShalom "Comparison to Elm...": Yeah, that's why I said relatively to other parts of the lang that needs more attention
17:45:07FromDiscord<pyolyokh> `d1.toMillisevconds.float64 / 1000.0` for example
17:45:26FromDiscord<sOkam!> In reply to @pyolyokh "`d1.toMillisevconds.float64 / 1000.0` for": but im trying to divide one duration by another
17:46:28FromDiscord<pyolyokh> you should probably get floats first before what you're doing with that
17:46:39FromDiscord<pyolyokh> for one reason, there isn't a / implemented for Duration
17:47:09FromDiscord<pyolyokh> but anyway `d1.inNanoseconds.float64 / d2.inNanoseconds.float64`
17:47:13FromDiscord<sOkam!> yeah, because the result is going to be unit/dependent
17:47:36FromDiscord<sOkam!> In reply to @pyolyokh "but anyway `d1.inNanoseconds.float64 /": is f64 able to contain the whole nanosecond range?
17:47:40FromDiscord<sOkam!> that's why i wasn't doing that
17:47:55FromDiscord<sOkam!> i thought that it might break it
17:48:22FromDiscord<pyolyokh> a Duration 128 bits so to get a number from it at all you need to start with the ranges you're going to be working in
17:48:31FromDiscord<pyolyokh> (edit) "a Duration ... 128" added "is"
17:49:32FromDiscord<sOkam!> i understand the idea, but i don't know how to do it correctly in practice
17:49:55FromDiscord<sOkam!> i know i can just cast the nanoseconds to float, my worry if that's going to break the numbers or something
17:50:26FromDiscord<sOkam!> (edit) "i know i can just cast the nanoseconds to float, my worry ... if" added "is"
17:54:26FromDiscord<pyolyokh> int64.high of nanoseconds is about 292 years, if I'm doing this right
17:54:37FromDiscord<pyolyokh> `cast[Duration]((0, int64.high)).inNanoseconds.float / (1e9 3600 24 365.25)`
17:55:15FromDiscord<pyolyokh> int32.high is still almost 7 years
17:55:25FromDiscord<pyolyokh> nah wait I definitely did that one wrong
17:56:19FromDiscord<sOkam!> In reply to @pyolyokh "int64.high of nanoseconds is": yeah, but i know that f64 can only contain about 8y or something. hence my worry
17:57:23FromDiscord<pyolyokh> eh, float representation's weird. It's not as simple as counting the non-exponent bits.
17:57:24FromDiscord<cow> it'll just lose accuracy after 8 years 😂
17:57:49FromDiscord<cow> but if you know how accurate you'll have your data it's probably not a good idea to use floats
17:57:50FromDiscord<pyolyokh> floats gradually have gaps in representation, so that f+1==f
17:58:30FromDiscord<cow> yeah that's another thing if you increment continuously
18:00:52FromDiscord<pyolyokh> `cast[Duration]((0, int32.high.int64)).inNanoseconds.float / 1e9` there that's the way to do it. 32 bits is enough for 2.1s
18:02:07FromDiscord<sOkam!> In reply to @pyolyokh "`cast[Duration]((0, int32.high.int64)).inNanosecond": why passing through i32, and f32?
18:03:29FromDiscord<pyolyokh> I wanted 32 bits and int32.high is convenient. 1e9's a float.
18:10:45FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lBy
18:12:00FromDiscord<sOkam!> i don't think i understand 1% of that, or how to apply it. but sounds interesting
18:16:05*crem joined #nim
18:23:38FromDiscord<pyolyokh> if there's some kind of lesson there it's that, since I'm not using any of these numbers, I am not stressing them much at all. You should stress the numbers to the extent that you're using them.
18:24:19FromDiscord<pyolyokh> especially as if there was a float64-returning proc in times.nim it would just do .toMilliseconds and divide by 1000.0 or similar
18:50:14FromDiscord<treeform> stealth Nim post https://news.ycombinator.com/item?id=34427864
19:00:31*jjido joined #nim
19:03:43FromDiscord<qb> `typedef lm_byte_t lm_bytearr_t;` could I wrap this as `lm_bytearr_t = openArray[byte]` assuming that lm_byte_t is `byte`?
19:06:42FromDiscord<qb> nvm
19:48:48*TakinOver joined #nim
19:56:46*argonica joined #nim
20:01:07FromDiscord<michaelb.eth> In reply to @treeform "stealth Nim post https://news.ycombinator.com/item?": Always happy to see Nim/-related posts on the top page of HN.↔↔In this case, the main argument of the article linked to from HN is a bit undercooked, but it includes a decent write up of the author’s early experiences with Nim
20:01:44FromDiscord<michaelb.eth> (edit) "In reply to @treeform "stealth Nim post https://news.ycombinator.com/item?": Always happy to see Nim/-related posts on the top page of HN.↔↔In this case, the main argument of the article linked to from HN is a bit undercooked, but it ... includes" added "also"
20:02:22*argonica quit (Quit: Leaving)
20:02:24FromDiscord<IsaacPaul> I feel like most tools should 'phone home' especially crash reports. Hi
20:02:26FromDiscord<IsaacPaul> (edit) removed "Hi"
20:02:40FromDiscord<IsaacPaul> (edit) "I feel like most tools should 'phone home' especially ... crash" added "when it's"
20:05:14*argonica joined #nim
20:09:20FromDiscord<Leftbones> Does Nim not agree with the M1 macs or is vscode screwing with my environment again? https://media.discordapp.net/attachments/371759389889003532/1065362274707054592/image.png
20:10:39FromDiscord<Leftbones> It should be noted that this works fine on Windows, I wasn't expecting to see different results on my macbook
20:12:56FromDiscord<ygol55> Hello. If I want to run a GUI aplication programmed with Nim, and then run a code from another language, could I do that?
20:13:20FromDiscord<ygol55> I mean, If I'm running graphs on this application, can I do that using another language?
20:13:31FromDiscord<ygol55> I just want to run this from another language
20:14:34FromDiscord<ygol55> I guess there's a way to deal with that with JSON, right?
20:14:40FromDiscord<ygol55> To combine two langauges
20:14:44FromDiscord<ygol55> If I'm correct
20:19:10FromDiscord<hotdog> In reply to @ygol55 "Hello. If I want": What is the other language?
20:19:16FromDiscord<ygol55> Julia
20:19:25FromDiscord<ygol55> The Julia programming language
20:19:58FromDiscord<ygol55> I just want to create a graph, but I wanted to also learn doing GUI aplications in Nim
20:20:11FromDiscord<ygol55> So I thought this is possible
20:20:34FromDiscord<hotdog> In reply to @ygol55 "Julia": Perhaps look at https://github.com/Clonkk/nimjl
20:21:10FromDiscord<hotdog> In reply to @ygol55 "So I thought this": Yep should be possible
20:21:14FromDiscord<ygol55> And there's such bridging for most of the language
20:21:35FromDiscord<hotdog> In reply to @ygol55 "And there's such bridging": What do you mean?
20:22:22FromDiscord<Leftbones> In reply to @Leftbones "Does Nim not agree": GCC doesn't have conio.h, lovely
20:22:23FromDiscord<ygol55> Meaning, there could be such same link for C#, c++, python and so on?
20:22:52FromDiscord<ygol55> In reply to @hotdog "What do you mean?": And also, I just need to install that and include this in the main file?
20:23:08FromDiscord<ygol55> How do I use this github project?
20:23:44FromDiscord<hotdog> In reply to @ygol55 "Meaning, there could be": Yes there are ways of linking between nim and a lot of languages, depending on what you want to do
20:23:55FromDiscord<ygol55> Okay
20:24:04FromDiscord<hotdog> In reply to @ygol55 "And also, I just": I’ve not actually used the library I’m afraid, I just remembered seeing it before
20:28:55FromDiscord<michaelb.eth> if the Julia program will be running in a long-lived process separate from the Nim process, maybe you include a JSON-RPC server in the Julia code and a JSON-RPC client in the Nim code
20:40:32FromDiscord<IsaacPaul> In reply to @Leftbones "Does Nim not agree": You might be using x64 nim?
20:41:09FromDiscord<Leftbones> In reply to @IsaacPaul "You might be using": Oh that is very likely, I took the lazy route and installed it from Brew
20:41:17FromDiscord<Leftbones> I'll have to check that out later
20:41:43FromDiscord<IsaacPaul> In reply to @Leftbones "Oh that is very": brew is also probably outdated too
20:41:58FromDiscord<IsaacPaul> (edit) "In reply to @Leftbones "Oh that is very": ... brew" added "nim package in"
20:49:06*uics joined #nim
20:49:37*krux02 joined #nim
20:49:38*uics left #nim (#nim)
20:53:02FromDiscord<deech> Why does `RangeDefect` not produce a stack trace?
20:56:31*argonica quit (Quit: Leaving)
21:04:36*xet7 quit (Quit: Leaving)
21:09:52Amun-Rait does
21:11:44*krux02 quit (Remote host closed the connection)
21:13:56Amun-Rahave you set -d=danger on?
21:14:54FromDiscord<deech> I don't have a minimal example off hand but I'm using `Natural` in my project and if that throws all I get is a `RangeDefect` . I have `-d:release` but I don't think that implies `-d:danger`?
21:15:22*krux02 joined #nim
21:15:43Amun-Rano
21:17:42Amun-Ra-d=release requires setting --stackTrace=on
21:27:41FromDiscord<michaelb.eth> fwiw, I usually have (among other things) the following in my projects' `config.nims`
21:27:51FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4lCd
21:28:17Amun-Raspeaking of nims, how can one include another nims file?
21:28:47Amun-Ramy config.nims has 8.8KB ;)
21:29:11FromDiscord<michaelb.eth> that's a pretty big config, what are you doing in there?
21:29:16FromDiscord<michaelb.eth> just curious
21:29:18FromDiscord<leorize> you can use `import`
21:29:29FromDiscord<leorize> rename the other file to `.nim` and you can `import`
21:30:56Amun-Rahmm, it works
21:30:59Amun-Rathanks
21:31:26Amun-Ramichaelb.eth: settings flags for various crosscompilers, settings many hints on
21:31:31*argonica joined #nim
21:57:11*krux02 quit (Remote host closed the connection)
22:09:12termer_Is startProcess in osproc blocking? In other words, does it block the thread until the OS launches the process?
22:09:19*termer_ quit (Quit: ZNC 1.7.5+deb4 - https://znc.in)
22:09:48*termer joined #nim
22:11:40termerI know I can use peek for the status code and streams, but I want to know whether I can also launch the process without blocking the thread. Currently I'm launching a thread that then starts the process and uses blocking I/O for the streams to get data, but if it's possible for me to launch the process without blocking, I can wrap everything in
22:11:40termerasync pragmas and be just fine
22:12:40FromDiscord<Elegantbeef> It likely calls fork on \nix, so it'll block until that call yes
22:12:55termerwhat a shame
22:13:09termerBut thanks for the answer
22:13:15FromDiscord<leorize> it does block until the program is started
22:13:56FromDiscord<leorize> the only way to launch programs without blocking is to do it in a thread
22:15:33termerthat's what I figured. I guess it's an OS problem more than an implementation problem
22:21:49*krux02 joined #nim
22:21:57*Phytolizer joined #nim
22:22:11*Phytolizer quit (Remote host closed the connection)
23:05:50FromDiscord<sOkam!> what do you guys recommend for profiling a nim app?
23:06:29FromDiscord<sOkam!> an opengl game engine, to be specific
23:13:08FromDiscord<treeform> In reply to @sOkam! "an opengl game engine,": if you have NV GPU, https://developer.nvidia.com/nsight-graphics is really good.
23:13:47FromDiscord<treeform> if you are on windows or linux this I made this for quick and easy things: https://github.com/treeform/hottie/
23:14:22FromDiscord<treeform> If you have Intel GPU this is also great: https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html#gs.n0ldf3
23:15:18FromDiscord<treeform> I wish there was a good GUI open source profiler that worked on windows/mac/linux.... though I am still waiting.
23:17:03FromDiscord<treeform> my other library: https://github.com/treeform/benchy is also related
23:29:34FromDiscord<sOkam!> In reply to @treeform "if you are on": i only knew about benchy, and thought it wasn't what i was searching for. will take a look, tyty ✍
23:40:33FromDiscord<Saint> sent a code paste, see https://play.nim-lang.org/#ix=4lCw
23:40:37FromDiscord<Saint> (edit) "sent" => "How do I add" | "code paste, see https://play.nim-lang.org/#ix=4lCw" => "callback using `then`"
23:41:17*argonica quit (Remote host closed the connection)
23:42:15*argonica joined #nim
23:42:37FromDiscord<Elegantbeef> You make a proc that takes the result of your future
23:42:47FromDiscord<Elegantbeef> https://nim-lang.org/docs/asyncjs.html#then%2CFuture%5BT%5D%2Cproc%2COnReject
23:45:52FromDiscord<Saint> Oh is then only for asyncjs?
23:45:57FromDiscord<Elegantbeef> Yes
23:46:05FromDiscord<Saint> Oh okay I'm not trying to use asyncjs
23:46:13FromDiscord<Saint> I saw then in the docs for asyncdispatch
23:47:07FromDiscord<Saint> Is there a way for me to poll the length of a sequence which is supposed to be filled by callbacks from async procs, and when the length of the sequence is a certain number then the callback the future is returned?
23:47:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lCx
23:49:20FromDiscord<Elegantbeef> Dont quite understand what you're asking
23:50:20FromDiscord<Saint> Gotcha with the callback thing
23:50:29FromDiscord<Saint> Aren't you supposed to use addCallback?
23:51:08FromDiscord<Elegantbeef> No clue, i dont really use async
23:51:10FromDiscord<Saint> In reply to @Elegantbeef "Dont quite understand what": I want to fire off a bunch of async procs, and each of these procs will add data to a global sequence. I want to watch this sequence and once it is filled up then something executes, does that make sense?
23:52:14FromDiscord<Elegantbeef> instead of using a raw seq i'd suggest using a custom seq type, that has a callback on fill so then you dont need to watch it from inside async code
23:54:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lCy
23:54:46FromDiscord<Elegantbeef> Due to\ 😛
23:59:01FromDiscord<Saint> Interesting! Thanks
23:59:19FromDiscord<Saint> But how do I get it to like poll
23:59:22FromDiscord<Saint> Or like watch for the size