<< 28-02-2021 >>

00:03:55*PMunch quit (Quit: leaving)
00:23:43*NimBot joined #nim
00:41:26FromDiscord<XxDiCaprioxX> is there a way to parse the digit a char contains? like, there is the proc `char.isDigit()`, but is there a way to access the exact digit a char is
00:44:42*Sembei quit (Quit: WeeChat 3.0)
00:52:33FromDiscord<XxDiCaprioxX> nevermind
00:57:42FromDiscord<XxDiCaprioxX> Is there in iterator similar to `string.mitems()` that doesn't require the string to be a `var string` but can also be immutable?
00:59:04FromDiscord<ElegantBeef> you mean `string.items`?
01:00:46FromDiscord<XxDiCaprioxX> Oh
01:00:55FromDiscord<XxDiCaprioxX> How didn't I see that in the docs
01:01:06FromDiscord<XxDiCaprioxX> That's awkward. But thanks
01:01:18FromDiscord<ElegantBeef> btw did you know `for x in y` will automagically get `y.items`
01:01:49FromDiscord<XxDiCaprioxX> Oh really? So I can say `for char in string`? Cool!
01:02:46*grobe0ba quit (Quit: ZNC 1.7.5 - https://znc.in)
01:03:29FromDiscord<ElegantBeef> Yep
01:10:21FromDiscord<Anonymous Poet> whats the recommended way to do stdio tests in nim?
01:10:30FromDiscord<Anonymous Poet> it seems like most things suggest using nimble?
01:11:18FromDiscord<ElegantBeef> You can checkout the `unittest` module in the stdlib
01:11:39FromDiscord<ElegantBeef> `nimble test` just runs all files inside `tests/` that start with "t"
01:12:06FromDiscord<Anonymous Poet> unless im blind, the docs for that dont have anything on io :/
01:12:33FromDiscord<ElegantBeef> I dont know what you mean
01:12:59FromDiscord<Anonymous Poet> im writing a lambda expr evaluator
01:13:08FromDiscord<Anonymous Poet> it needs to take values from stdin, or write to stdout
01:13:24FromDiscord<ElegantBeef> I mean shouldnt it just take a string and return a string?
01:13:30FromDiscord<Anonymous Poet> sadly no :/
01:13:42*krux02 quit (Remote host closed the connection)
01:13:57FromDiscord<Anonymous Poet> in addition to that, it needs to have side effects
01:14:19FromDiscord<Anonymous Poet> i can restructure my code to do it properly, but i need to end up rewriting it (as is now) in another language, so id rather not
01:14:41FromDiscord<ElegantBeef> Well i dont have a clue
01:15:18FromDiscord<Anonymous Poet> tragic
01:22:06*grobe0ba joined #nim
01:23:55*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:24:15*njoseph joined #nim
01:29:40FromDiscord<Rika> IO will be an effect, no way past that unless you want to go unsafe route
01:30:27FromDiscord<Rika> Do you need to test input and output? Can’t you emulate that instead
01:30:57FromDiscord<Anonymous Poet> i decided to just do it right and pass in the io
01:31:18FromDiscord<Anonymous Poet> i was going to use streams but not sure if thats actually correct
01:31:31FromDiscord<Anonymous Poet> since `stdin` and `stdout` are typed as Files
01:33:19FromDiscord<Rika> They also have stream versions I believe
01:33:41FromDiscord<Rika> Underneath they are file descriptors so a lot of things can encapsulate them
01:34:15FromDiscord<Anonymous Poet> yeah, i was worried what would happen if i did something like `ioIn: Stream = newFileStream(stdin)`
01:34:33FromDiscord<Anonymous Poet> because i was calling the function with the default multiple times, but everything seems good
01:36:04*Fish-Face quit (Ping timeout: 240 seconds)
01:41:36*vicfred quit (Ping timeout: 265 seconds)
01:50:53FromDiscord<Pixtum> is there way to call a proc before you give it's definition in a file?
01:51:38FromDiscord<Pixtum> kinda like how in C you can define a functions type name & params but have the actual implementation later in the file
01:57:19*fredrikhr quit (Quit: Client Disconnecting)
02:00:10FromDiscord<konsumlamm> ye, you can do a forward declaration
02:00:35FromDiscord<Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=2R8T
02:00:37FromDiscord<Yardanico> yep :)
02:00:41FromDiscord<Pixtum> cool thanks
02:00:45FromDiscord<Hi02Hi> np
02:42:51FromDiscord<Pixtum> does forward declaration not work in nimscript files?
03:00:27FromDiscord<Hi02Hi> never tried it
03:18:59*theelous3 quit (Read error: Connection reset by peer)
03:27:19FromDiscord<Hi02Hi> tried the example above, it worked, can you show code?
03:28:51*muffindrake quit (Ping timeout: 272 seconds)
03:30:12*muffindrake joined #nim
03:39:37*Gustavo6046 quit (Ping timeout: 272 seconds)
03:42:10*asdflkj quit (Ping timeout: 276 seconds)
03:44:54FromDiscord<treeform> Is there a way to make lib set the `-d:ssl` flag? I want to `import mylib` and it just sets the `-d:ssl` flag from my lib's `config.nims` so that users of my lib do not have to know about it?
03:53:27FromDiscord<Yardanico> @treeform sadly no, the best you could do is to error out if -d:ssl is not defined
04:17:36FromDiscord<juan_carlos> `switch("define", "ssl")` ?.
04:25:37FromDiscord<Rika> Only works in Nim script I believe
04:27:36*spiderstew_ joined #nim
04:29:57*spiderstew quit (Ping timeout: 264 seconds)
04:35:15PrestigeIs there an int version of Inf and NegInf?
04:36:23FromDiscord<juan_carlos> I hope not.
04:37:08FromDiscord<juan_carlos> Theres no NegInf, is -Inf in Nim.
04:37:23FromDiscord<ElegantBeef> `int.low` and `int.high` 😛
04:37:26FromDiscord<ElegantBeef> Int's dont have infinity
04:38:23PrestigeNegInf exists btw
04:39:22FromDiscord<Rika> -Inf != NegInf I believe...
04:39:29PrestigeBeef thanks for reminding me about int.low
05:13:57FromDiscord<PizzaFox> does nim have a way to format a number to a string like `123,456,789`?
05:19:34PrestigeHm I feel like there should be, but I'm not finding anything in the docs
05:20:59FromDiscord<PizzaFox> yeah i see some stuff in `strformat` for aligning numbers but nothing of the pretty printing sort
05:21:05FromDiscord<Rika> $? Or do you mean more specifically with commas
05:21:10FromDiscord<PizzaFox> with commas
05:21:41FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2R9Y
05:21:58FromDiscord<Rika> https://nim-lang.org/docs/strutils.html#insertSep%2Cstring%2Cchar%2Cint
05:22:35FromDiscord<PizzaFox> oh nice
05:23:02PrestigeNice
05:23:15FromDiscord<PizzaFox> ok new question
05:23:52FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2R9Z
05:24:59FromDiscord<InventorMatt> you can overload a proc so that one has no parameters and the other one has a boolean in your case for the parameter
05:25:08FromDiscord<PizzaFox> yeah
05:25:23FromDiscord<PizzaFox> can i enforce that the parameter is never `false` at compile time?
05:26:17FromDiscord<InventorMatt> if you have is as a static bool then you can have a when statement that errors out is set to false
05:26:44FromDiscord<ElegantBeef> you can do it in a single procedure, but it's weird 😄
05:27:18FromDiscord<PizzaFox> i am coming from my beloved typescript
05:27:27FromDiscord<PizzaFox> where i can just write
05:27:32FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=2Ra2
05:27:34FromDiscord<PizzaFox> `param: true`
05:27:45FromDiscord<PizzaFox> In reply to @ElegantBeef "```nim proc myFn(a: static": this is cursed
05:27:46FromDiscord<ElegantBeef> The single proc weirdness
05:27:48FromDiscord<PizzaFox> i'm just going to have
05:27:51FromDiscord<PizzaFox> `myFn`
05:28:02FromDiscord<PizzaFox> `myFnFormatted`
05:28:11FromDiscord<PizzaFox> er
05:28:12FromDiscord<ElegantBeef> I'm tried and didnt use the proper variable in the when 😄
05:28:17FromDiscord<ElegantBeef> (edit) "tried" => "tired"
05:28:36FromDiscord<PizzaFox> In reply to @InventorMatt "you can overload a": i'll do this and just have an `assert` that param is `false`
05:28:44FromDiscord<XeroOl> just make it so that `myFn(formatted = false)` does the same thing as `myFn()`
05:28:54FromDiscord<XeroOl> if you want to just have an optional argument
05:29:03FromDiscord<PizzaFox> yeah
05:29:08FromDiscord<PizzaFox> well
05:29:12FromDiscord<PizzaFox> then the return types wouldn't be valid
05:29:31FromDiscord<XeroOl> then two procs is probably the way to go
05:29:49FromDiscord<XeroOl> dynamic return types like that may be okay in typescript, but in nim, it's a bit cursed
05:30:04FromDiscord<XeroOl> (edit) "a bit" => "~~a bit~~ very"
05:30:10FromDiscord<PizzaFox> yeah
05:30:24FromDiscord<PizzaFox> tbh this is just me wanting the compiler to do more than is reasonable sometimes
05:30:37FromDiscord<XeroOl> you can overload if you want
05:30:40FromDiscord<PizzaFox> overload sounds good
05:31:07FromDiscord<XeroOl> sent a code paste, see https://paste.rs/Op2
05:31:10FromDiscord<XeroOl> (edit)
05:31:37FromDiscord<XeroOl> this only makes sense if there are actually different parameters that you need for each version
05:31:37FromDiscord<ElegantBeef> Well it's a static bool, so it's known at compile time what's going to happen
05:32:09FromDiscord<XeroOl> if you actually want them to take the same parameters, it's better to have two functions than to have overloaded functions with a hacky optional argument thing
05:50:01FromDiscord<PizzaFox> if the param is `false` it returns type `A`↵if the param is `true` it returns type `B`
05:51:04FromDiscord<Rika> In reply to @ElegantBeef "```nim proc myFn(a: static": i dont see how this is cursed ngl
05:51:08FromDiscord<ElegantBeef> Me either
05:51:44FromDiscord<ElegantBeef> It's known at compile time and you specify either explicitly or implictly through omission
05:52:09FromDiscord<ElegantBeef> It's sorta like saying inferred generics are cursed 😄
05:55:21FromDiscord<PizzaFox> the auto typing
05:55:40FromDiscord<PizzaFox> compiler features that are slightly advanced
05:56:43FromDiscord<Rika> not reallyh
05:56:44FromDiscord<ElegantBeef> I mean it's just "figure out the type for me"
05:57:05FromDiscord<Rika> i dont think you can represent that without auto tho
05:57:24FromDiscord<ElegantBeef> Nope dont think you can
05:57:27FromDiscord<treeform> In reply to @Yardanico "<@107140179025735680> sadly no, the": thanks!
05:57:35FromDiscord<ElegantBeef> oh actually
05:57:42FromDiscord<ElegantBeef> you can do `int or float32`
05:57:48FromDiscord<Rika> ya sure?
05:57:52FromDiscord<ElegantBeef> Just tested
05:58:06FromDiscord<Rika> ok
05:58:49FromDiscord<ElegantBeef> So is this less cursed pizza? `proc myFn(a: static bool = false): int or float32 =`
06:01:09FromDiscord<PizzaFox> uh
06:01:48FromDiscord<PizzaFox> sent a code paste, see https://paste.rs/ZOK
06:02:04FromDiscord<ElegantBeef> That doesnt really change anything 😄
06:02:19FromDiscord<PizzaFox> wouldn't i have to write code to check if the result is A or B
06:02:51FromDiscord<ElegantBeef> The code i showed earlier worked with the above name change
06:03:01FromDiscord<ElegantBeef> It returns a single value
06:03:23FromDiscord<ElegantBeef> When passing true it returned a int, otherwise a float32
06:05:32FromDiscord<ElegantBeef> In your case you could probably just say `Stats` as the type itself has the limitation
06:07:51FromDiscord<ElegantBeef> I was wrong
06:07:59FromDiscord<ElegantBeef> But here is an example https://play.nim-lang.org/#ix=2Rab
06:09:55FromDiscord<ElegantBeef> It works the exact same as your double proc idea, but has no "what if you pass the wrong value"
06:10:32FromDiscord<PizzaFox> is there any downside to your solution
06:10:48FromDiscord<PizzaFox> it seems good
06:11:40FromDiscord<ElegantBeef> I mean you're getting a intialized version of the type you want, not any possible down sides afaik
06:14:23FromDiscord<hamidb80> does minGW-32 makes problem on 64bit windows?
06:14:57FromDiscord<hamidb80> nim can't compile some of external libraries
06:15:46FromDiscord<hamidb80> https://media.discordapp.net/attachments/371759389889003532/815467257102598144/unknown.png
07:01:49FromDiscord<dponyatov> Is Nim lang suitable for persistent object database engine development, that works over Intel's `libpmem` persistent layer over NVRAM/SSD storage?
07:02:25FromDiscord<Rika> if its doable in C it should be doable in Nim
07:03:42*waleee-cl quit (Quit: Connection closed for inactivity)
07:03:48FromDiscord<dponyatov> What scares me there is garbage collection over persistent memory is critical to faults in its algorithm, as NVRAM will not be cleared on process restart, and any memory leakage or dangling references will corrupt the whole data volume.
07:04:53FromDiscord<dponyatov> As I know, Nim authors are mad about GC hacking, so are any experiments were done on moving Nim to a huge virtual memory image works over libpmem?
07:05:21FromDiscord<dponyatov> https://pmem.io/
07:07:33FromDiscord<ElegantBeef> It kills a majority of the stdlib but you could do manual memory management
07:07:44FromDiscord<dponyatov> I can point on the GemStone/S64 system, which runs Smalltalk runtime in huge virtual memory, so for the user and programmer, the system looks like a huge image of RAM, something about 10Tb RAM for an object store.
07:08:56FromDiscord<dponyatov> (edit) "I can point on the GemStone/S64 system, which runs Smalltalk runtime in huge virtual memory, so for the user and programmer, the system looks like a huge image of RAM, something about 10Tb RAM for an object store. ... " added "Maybe Nim runtime can be run in a such way? Some sort of live object database with its internal language mixes data with processing code."
07:43:03FromDiscord<hamidb80> In reply to @hamidb80 "": i think i should build mingw-w64 by myself 😕
07:54:07*haxscramper joined #nim
08:07:12*krux02 joined #nim
08:11:03FromDiscord<PizzaFox> sent a code paste, see https://paste.rs/AFe
08:13:52FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2Rav
08:32:25FromDiscord<hamidb80> In reply to @hamidb80 "": does anyone have idea why `handleapi.h` is missing?
08:32:32FromDiscord<hamidb80> (edit) "In reply to @hamidb80 "": does anyone have ... idea" added "any"
08:33:20FromDiscord<haxscramper> Ii is not in `includepath` maybe? `--passC:-I<director-with-handleapi.h>`
08:33:51FromDiscord<hamidb80> In reply to @haxscramper "Ii is not in": no
08:33:53FromDiscord<haxscramper> Or `--passC:-v` if you are using GCC/clang to make it compile in verbose mode - it will also show al directories
08:37:23FromDiscord<hamidb80> `handleapi.h` is missing
08:37:41FromDiscord<hamidb80> i can't find it in mingw directory
08:38:02FromDiscord<hamidb80> (edit) "mingw" => "`mingw`"
08:39:00FromDiscord<hamidb80> it must be in `mingw/include`
08:42:23FromDiscord<hamidb80> do you think it's better to build `mingw` by myself?
08:54:51FromDiscord<PizzaFox> nim compiler says my custom exception doesn't have a `body` field https://zws.im/󠁯󠁰󠁹󠁸󠁫󠁯󠁭↵but it does, which i can verify from logging https://zws.im/󠁥󠁿󠁦󠁢󠁢󠁬󠁯
08:56:26FromDiscord<haxscramper> > nim compiler says ↵But your code runs correctly? Y just showed `repr` output
08:56:42FromDiscord<PizzaFox> the second screenshot is the output of `repr(exception`
08:56:43FromDiscord<PizzaFox> (edit) "`repr(exception`" => "`repr(exception)`"
08:56:45FromDiscord<Rika> that's nimsuggest saying so
08:56:48FromDiscord<Rika> not the nim compiler
08:56:53FromDiscord<PizzaFox> it's also the nim compiler
08:56:57FromDiscord<PizzaFox> Error: undeclared field: 'body'
08:57:22FromDiscord<haxscramper> Does your code compile or not? nimsuggest might error out sometimes
08:57:26FromDiscord<PizzaFox> it doesn't compile
08:57:40FromDiscord<Rika> what is `echo typeof exception` and `echo exception of CustomException`?
08:57:45FromDiscord<Rika> eh
08:57:51FromDiscord<Rika> whats the code then
08:57:55FromDiscord<ElegantBeef> Did you change your ApiException to a `ref object of HttpRequestError`?
08:58:17FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2RaB
08:58:28FromDiscord<Rika> ref
08:58:30FromDiscord<Rika> needs to be a ref
08:58:49FromDiscord<ElegantBeef> Inheritance should always use ref unless you wear protection and know how to do it
08:59:08FromDiscord<PizzaFox> man what
08:59:20FromDiscord<ElegantBeef> `type ApiException = ref object of HttpRequestError`
08:59:39FromDiscord<ElegantBeef> Inheritance should always use `ref` unless you know what you're doing
08:59:39FromDiscord<PizzaFox> Error: raised object of type ref ApiException does not inherit from Exception
08:59:41FromDiscord<PizzaFox> sad!
09:00:20FromDiscord<ElegantBeef> Well the issue is it's making a ref due to you not properly handling it 😄
09:00:48FromDiscord<PizzaFox> let me review nim exceptions docs
09:01:02FromDiscord<ElegantBeef> Wait... errors dont inherit using ref
09:01:09FromDiscord<ElegantBeef> Weird.... behaviour
09:01:11FromDiscord<PizzaFox> fantastic https://zws.im/󠁸󠁴󠁹‍‍󠁷‍
09:02:48FromDiscord<PizzaFox> so what am i supposed to do here
09:02:57FromDiscord<PizzaFox> i just want to attach some metadata to the exception
09:03:25*krux02` joined #nim
09:05:30FromDiscord<haxscramper> idk, https://play.nim-lang.org/#ix=2RaE
09:06:01FromDiscord<haxscramper> `ApiException = ref object of HttpRequestError`, `raise ApiException()` worked perfectly fine
09:07:30FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2RaI
09:08:17FromDiscord<Rika> try exporting body
09:08:28FromDiscord<PizzaFox> good idea
09:08:37FromDiscord<PizzaFox> same compiler error
09:09:02FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2RaJ
09:09:34FromDiscord<haxscramper> Can you just give full code via playground instead of type definition and random pieces
09:09:46FromDiscord<PizzaFox> yeah let me make a full snippet
09:09:57FromDiscord<ElegantBeef> Whenever i put puzzles together i always pin the tail on the head
09:11:35FromDiscord<PizzaFox> https://play.nim-lang.org/#ix=2RaK
09:12:34FromDiscord<ElegantBeef> ref to a ref
09:13:01FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2RaL
09:13:24FromDiscord<PizzaFox> idk what a ref even is 🤷‍♂️
09:13:36FromDiscord<ElegantBeef> it's a managed pointer
09:13:42FromDiscord<ElegantBeef> a reference
09:14:03FromDiscord<ElegantBeef> you had a pointer pointing to a pointer
09:14:27FromDiscord<PizzaFox> nice
09:15:11FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2RaM
09:15:18FromDiscord<ElegantBeef> For constructors you use `:`
09:15:45FromDiscord<PizzaFox> a
09:15:49FromDiscord<PizzaFox> (edit) "https://play.nim-lang.org/#ix=2RaM" => "https://play.nim-lang.org/#ix=2RaN"
09:17:00FromDiscord<PizzaFox> nimsuggest loses again
09:17:11*blackpawn_ joined #nim
09:17:33FromDiscord<PizzaFox> nice it works
09:17:37FromDiscord<PizzaFox> thanks @ElegantBeef @haxscramper
09:18:27*blackpawn quit (Ping timeout: 272 seconds)
09:18:55FromDiscord<haxscramper> Ye. Just minor nitpicking - [i think] it is usually better to send working example at once, even if it is not particularly minimized
09:19:01FromDiscord<ElegantBeef> I wonder if all the errors couldnt be upgraded to `ref`s, simply cause you can only raise refs, so i imagine all of them have a redundant `new` somewhere
09:19:36FromDiscord<haxscramper> Working == I can run it and get the same errorr as you
09:19:51FromDiscord<ElegantBeef> A small reproducible example 😄
09:20:01FromDiscord<PizzaFox> yeah idk why i didn't do that initially lol
09:20:12FromDiscord<PizzaFox> i'm usually better at this
09:23:41*haxscramper quit (Remote host closed the connection)
10:05:55*carkh quit (Read error: Connection reset by peer)
10:18:56FromDiscord<Kiloneie> 230 views on thursday, 359 right now on last video, sharing works 😛
10:32:27*fosred joined #nim
10:36:40FromDiscord<PizzaFox> anyone know of a nim or C library that does something like asciichart https://github.com/kroitor/asciichart
10:37:07FromDiscord<PizzaFox> trying to turn a list of timestamps into a pretty line chart
10:38:19*fosred quit (Quit: Leaving)
11:08:27*tane joined #nim
11:11:04FromDiscord<haxscramper> IIRC no, but it should not be particularly difficult to write using seq[seq[Rune]] that you use as a canvas for drawing
11:11:18FromDiscord<Unaimend> So is there some place where copying semantics and stuff like that is explained
11:12:57FromDiscord<Unaimend> so for example if I want to create a sequence on the heap and return a reference to it from a function, how would I do that
11:15:43*haxscramper joined #nim
11:16:05FromDiscord<Unaimend> Or even better a list of all usefull nim documents to become proficient in the language 🙂
11:16:09FromDiscord<haxscramper> You use `s: ref seq[T]`, then create s with `new(s)` and then assign something to it, like `s[] = @[1,2,3]`
11:16:44FromDiscord<haxscramper> In reply to @Unaimend "Or even better a": There is a manual of course, but I'm not sure if there is a concise list with all memory-related things
11:16:55FromDiscord<Unaimend> And the return type of the function would be `ref seq[T]` ?
11:17:01FromDiscord<haxscramper> correct
11:18:20FromDiscord<haxscramper> `seq` and `string` have value semantics, (even though their content is allocated on heap), so in order to get reference semantics you'd need to do something like that
11:19:49FromDiscord<Unaimend> thx 🙂
11:37:38FromDiscord<haxscramper> To perform actual copy of the sequence you probably need to assign between dereferenced versions: `s2[] = s1[]`, which would use value semantics
11:44:57FromDiscord<Unaimend> Thx again, Is there also some kind move, like in c++, in nim?
11:45:22FromDiscord<Unaimend> Not that I need it at the moment, reference are perfect for my use case
11:47:00FromDiscord<Unaimend> Reading through all of those documents [1] at the moment, I hope that after that I dont have to ask that much basic questions as before 🙂↵[1] https://nim-lang.github.io/Nim/
11:47:49*Tlanger quit (Remote host closed the connection)
11:48:03FromDiscord<haxscramper> https://nim-lang.github.io/Nim/destructors.html#lifetimeminustracking-hooks-eqsink-hook
11:51:03FromDiscord<haxscramper> In reply to @Unaimend "Reading through all of": Actually it is really weird that netiher destructors [1], nor experimental features [2] are not linked from the documentation overview page↵[1] https://nim-lang.github.io/Nim/destructors.html↵[2] https://nim-lang.github.io/Nim/manual_experimental.html
11:52:46FromDiscord<Unaimend> Yes, I think it would make sense to add those links there
12:06:45FromDiscord<Yardanico> @Unaimend there is one
12:07:39FromDiscord<Unaimend> https://nim-lang.github.io/Nim/ on this page?
12:07:44FromDiscord<Unaimend> Am I blind?
12:08:05FromDiscord<Yardanico> https://github.com/KeepCoolWithCoolidge/asciigraph a direct port
12:08:15FromDiscord<Yardanico> Oh sorry it was @PizzaFox
12:09:07FromDiscord<Unaimend> No problem 😂
12:10:00FromDiscord<PizzaFox> In reply to @Yardanico "https://github.com/KeepCoolWithCoolidge/asciigraph ": hm
12:32:49FromDiscord<PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2Rbw
12:34:48FromDiscord<Yardanico> $maximum
12:35:16FromDiscord<PizzaFox> tell that to the asciigraph author
12:35:48FromDiscord<Yardanico> you can easily change that yourself
12:35:55FromDiscord<Yardanico> Last commit in that repo was in 2019
12:36:03FromDiscord<Yardanico> and it's under 50 lines of code
12:36:11FromDiscord<Yardanico> So you can just copy the entire package in your project and fix it
12:36:20FromDiscord<PizzaFox> 122 sloc but ok
12:39:19FromDiscord<PizzaFox> awesome nice good https://zws.im/󠁲󠁵󠁯󠁬󠁷󠁥󠁲
12:39:44FromDiscord<PizzaFox> btw the lines that weren't compiling? they were just random lines formatting strings without assigning to a variable or anything
12:39:51FromDiscord<PizzaFox> good library imo
12:41:48FromDiscord<Yardanico> Honestly not sure why you are complaining :)
12:42:01FromDiscord<PizzaFox> i expect people to write me high quality libraries!
12:42:02FromDiscord<PizzaFox> for free!
12:42:05FromDiscord<Yardanico> It's not a lot of code anyway, easy to fix manually
12:53:55*xet7 quit (Quit: Leaving)
13:26:12FromDiscord<Yardanico> @PizzaFox they are not random lines by the way
13:26:33FromDiscord<Yardanico> they were using this proc from strformat (0.19.0) https://media.discordapp.net/attachments/371759389889003532/815575664693608498/unknown.png
13:26:43FromDiscord<Yardanico> right now it's https://nim-lang.org/docs/strformat.html#formatValue%2Cstring%2CSomeFloat%2Cstring and the order of args changed a bit
13:27:18ForumUpdaterBotNew thread by HJarausch: Nim can be so difficult to understand, see https://forum.nim-lang.org/t/7566
13:28:26FromDiscord<Yardanico> fixed these quite easily - https://gist.github.com/Yardanico/0888bf78c87d4c9cab2dab3f96be077b
13:28:41ForumUpdaterBotNew post on r/nim by Karyo_Ten: Multithreading flavors: Choosing the right scheduler for the right job, see https://reddit.com/r/nim/comments/lug1jk/multithreading_flavors_choosing_the_right/
13:28:42FromDiscord<Yardanico> needed to change 3 lines
13:43:25*^Q-Master^ quit (Ping timeout: 276 seconds)
13:47:26*Gustavo6046 joined #nim
14:00:07FromDiscord<Yardanico> i guess I should take over asciigraph (first I'll check if the author will accept a PR though)
14:01:04*PMunch joined #nim
14:05:26FromDiscord<Yardanico> I'll be streaming some random Nim again in Music voice channel (on discord)
14:06:14*Q-Master joined #nim
14:09:03PMunchWhy do we have a Nim music channel?
14:09:24FromDiscord<mratsim> we do?
14:09:35PMunchApparently *shrug*
14:10:06FromDiscord<Yardanico> I self-host some music bot which allows to play music in discord vc :P
14:10:18FromDiscord<Yardanico> it's just a voice channel at the bottom of the server list
14:10:25FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/815586708577714206/unknown.png
14:16:23FromDiscord<mratsim> Pulseaudio evolved!
14:16:51FromDiscord<Yardanico> @PizzaFox https://github.com/Yardanico/asciigraph
14:18:28FromDiscord<Yardanico> https://github.com/KeepCoolWithCoolidge/asciigraph/pull/3
14:19:33*rokups joined #nim
14:28:56FromDiscord<Yardanico> how come I didn't know about https://nim-lang.org/docs/system.html#newSeq%2Cseq%5BT%5D%2CNatural
14:29:19FromDiscord<Yardanico> newSeq(var seq[T], len: Natural) so that you can do "result.newSeq(size)" in procs instead of "result = newSeq[type](size)"
14:33:39FromDiscord<Unaimend> is there no reverse function for strings?
14:34:09FromDiscord<Yardanico> there's a generic one in algorithm
14:34:18FromDiscord<Yardanico> but it will only work correctly if your string is ascii
14:34:35FromDiscord<Yardanico> https://nim-lang.org/docs/algorithm.html#reverse%2CopenArray%5BT%5D
14:34:41FromDiscord<Yardanico> for unicode use https://nim-lang.org/docs/unicode.html#reversed%2Cstring
14:34:50FromDiscord<Unaimend> In reply to @Yardanico "but it will only": ascii strings best strings
14:35:02FromDiscord<Unaimend> utf is heresy
14:35:13FromDiscord<Unaimend> (edit) "utf" => "unicode"
14:35:18FromDiscord<Yardanico> non-native english speakers don't agree with you :P
14:35:29FromDiscord<Unaimend> I am german 🙂
14:35:38FromDiscord<Yardanico> your alphabet is at least mostly latin
14:35:44FromDiscord<Unaimend> true
14:35:46FromDiscord<Yardanico> i am russian, situation is worse for us with ascii :)
14:37:10FromDiscord<Unaimend> Yeah, I am so glad that I never had to put up with non-ascii stufff
14:38:09FromDiscord<Unaimend> In german i just ignore Ä,Ö,Ü
14:39:01FromDiscord<Unaimend> We can just write ae, oe or ue instead of ä,ö,ü , respectively
14:43:45FromDiscord<Roundlay> Anyone seen any FizzBuzz one liners in Nim?
14:44:22FromDiscord<Yardanico> yes
14:44:30FromDiscord<Yardanico> i submitted one to code.golf
14:44:36FromDiscord<Yardanico> you can probably make it even shorter though
14:44:49FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Rc3
14:45:17FromDiscord<Yardanico> https://code.golf/scores/fizz-buzz/nim/bytes
14:45:41FromDiscord<Roundlay> Woah, thank you!
14:45:54FromDiscord<Yardanico> the record here is 64 chars but idk how they managed to do it
14:55:09FromDiscord<mratsim> I have one using neural networks as well: https://github.com/mratsim/Arraymancer/blob/master/examples/ex04_fizzbuzz_interview_cheatsheet.nim 😄
15:06:18FromDiscord<Yardanico> honestly sometimes I think that people on codegolf who have #1 for nim entries cheated in some way :P
15:06:47FromDiscord<Yardanico> like 42chars for "Write a program to print all the leap years from the year 1800 up to and including 2400."
15:11:52FromDiscord<mratsim> either you use while or countup but yeah 42 is short
15:12:34FromDiscord<Yardanico> mine is 57 but its cheaty
15:12:36FromDiscord<Yardanico> `import times;for x in 1801..2400:(if x.isleapyear:echo x)` :P
15:12:51FromDiscord<zetashift> In reply to @Yardanico "```nim for n in": my eyes are hurting, so it must be a great codegolf
15:13:05FromDiscord<Yardanico> I just took mratsim's solution from the forum and improved it a bit :D
15:13:29FromDiscord<Yardanico> or for example quine
15:13:34FromDiscord<Yardanico> the #1 quine for nim is 55 chars
15:13:36FromDiscord<Yardanico> HOW?!?!
15:29:54FromDiscord<mratsim> Ugh, writing RFCs/specs is so complex.
15:44:19*superbia joined #nim
15:48:02saemMorning
15:50:06FromDiscord<DARTHVADER NAXXX> Morning
15:54:43*Q-Master quit (Ping timeout: 276 seconds)
15:55:41*abm joined #nim
15:55:42superbiamorning
15:58:00FromDiscord<Yardanico> evening
16:00:40*Vladar joined #nim
16:09:36FromDiscord<Yardanico> will be doing some random stuff at twitch.tv/yardanico (it'll probably be boring, be advised)
16:10:12saemLess boring than what I do. :D
16:29:17*Q-Master joined #nim
16:31:19FromDiscord<Yardanico> built docs in pdf with ./koch pdf (seems to work contrary to https://github.com/nim-lang/Nim/issues/12266 )
16:31:28FromDiscord<Yardanico> for today's devel
16:31:31FromDiscord<Yardanico> https://files.catbox.moe/0u7i5x.pdf manual
16:31:34FromDiscord<Yardanico> https://files.catbox.moe/litwy9.pdf lib
16:31:37FromDiscord<Yardanico> https://files.catbox.moe/dmnf7k.pdf tut1
16:31:39FromDiscord<Yardanico> https://files.catbox.moe/08pbhw.pdf tut2
16:31:42FromDiscord<Yardanico> https://files.catbox.moe/8is2er.pdf tut3
16:31:45FromDiscord<Yardanico> https://files.catbox.moe/0v9web.pdf nimc
16:31:48FromDiscord<Yardanico> https://files.catbox.moe/9fr1k6.pdf niminst
16:31:50FromDiscord<Yardanico> https://files.catbox.moe/z34328.pdf gc
16:32:14FromDiscord<Yardanico> manual is 108 pages long
16:34:09*Q-Master quit (Ping timeout: 264 seconds)
16:35:26saemIs that everything or just the language and the single HTML page most people know?
16:37:52FromDiscord<Yardanico> its the html
16:37:57FromDiscord<Yardanico> i mean it's pdf
16:38:02FromDiscord<Yardanico> but its the same as going to manual in the docs
16:38:55saemah, really does make sense to generate a single page as now and also a multi-page variety.
16:40:52saemtext search over that is already troublesome.
16:42:17saemmratsim which rfc are you writing?
17:15:35*teasea quit (Quit: teasea)
17:18:26*teasea joined #nim
17:19:49FromDiscord<mratsim> @saem a RFC on threadpool on channels API
17:20:40*audiofile joined #nim
17:20:57FromDiscord<mratsim> also defining common vocabulary to talk about multithreading libraries, as in defined but left unspecified like: executors, schedulers, tasks, closures, continuations
17:21:21FromDiscord<mratsim> threadpools AND channels
17:21:32saemYeah, there is a lot to build up that doesn't otherwise exist.
17:24:09FromDiscord<mratsim> actually executors, schedulers, tasks and closures already exist. But they are not defined.
17:24:28FromDiscord<mratsim> And they exist for both async/await and within threadpools or Weave
17:25:22audiofilecan someone explain what `roll` should be like in this definition? http://vpaste.net/J3z9K?bg=dark&nu
17:25:56audiofileI thought the first param to array type was length but here it's a range?
17:26:17FromDiscord<mratsim> The idea is just to build a common understanding of what they are. So that in the future it's easier to define either how they are implemented (if it's a type that we want inteperable) or what API they should provide (if it's an opaque type/API that is just manipulated as a blockbox).
17:26:26FromDiscord<mratsim> interoperable
17:27:25audiofiletest
17:28:23*waleee-cl joined #nim
17:31:53FromDiscord<InventorMatt> audiofile: nim converts the integer for the first value of the array implicitly into a range of 0..N so in this example they are just explicitly creating the range
17:41:30FromDiscord<Unaimend> In reply to @mratsim "The idea is just": Sounds like a ton work
17:42:54FromDiscord<Unaimend> (edit) "In reply to @mratsim "The idea is just": Sounds like a ton ... work" added "of"
17:43:57FromDiscord<mratsim> sent a long message, see http://ix.io/2Rde
17:44:34FromDiscord<mratsim> So there is no more research to do, it's putting thoughts together in unambiguous way.
17:44:55FromDiscord<Unaimend> Which is still pretty hard I would say
17:45:20*Q-Master joined #nim
17:46:07FromDiscord<qb> How could I convert a type to a string? Should `fmt` even fail there? https://play.nim-lang.org/#ix=2Rdf
17:46:13FromDiscord<mratsim> The main issue is that you have things like concurrency vs parallelism, what is a closure, what's a task, what's a job, what's a dispatcher, what's a scheduler, what's a thread, a fiber, an executor that you need to clear up.
17:46:26*vicfred joined #nim
17:46:41FromDiscord<Unaimend> yeah good definitions a hard to come by
17:47:18FromDiscord<mratsim> A thread for example is pretty hard to define.
17:48:29FromDiscord<Unaimend> In reply to @qb "How could I convert": sent a long message, see http://ix.io/2Rdi
17:49:05FromDiscord<Unaimend> In reply to @qb "How could I convert": https://play.nim-lang.org/#ix=2Rdj
17:49:17FromDiscord<qb> thanks
17:49:38FromDiscord<Unaimend> 🙂 no problem
17:49:39federico3@mratsim add the upcoming vectorial cpu instructions to that
17:50:31FromDiscord<mratsim> vector CPU instructions to do what?
17:50:47FromDiscord<mratsim> hard to define you mean?
17:51:22FromDiscord<Unaimend> so how do your guys implement tests for your packages, just with `isMainModule` in the specific source file??
17:51:46FromDiscord<mratsim> like this: https://github.com/mratsim/constantine/tree/master/tests
17:52:10FromDiscord<Unaimend> and then use testament?
17:52:13FromDiscord<mratsim> isMainModule only for internal sanity checks on private implementations.
17:52:15FromDiscord<mratsim> No
17:52:52FromDiscord<mratsim> Either I assemble everything in an overarching all_tests.nim if the tests dont take too much time
17:53:42FromDiscord<mratsim> or I collect them in a "to_exec.txt" file https://github.com/mratsim/constantine/blob/master/constantine.nimble#L222
17:53:53federico3@mratsim vector instructions that encourage CPUs to move closer to GPUs - adding complexity to the conversation
17:54:00FromDiscord<mratsim> and then call GNU parallel (or any other parallel stuff on it).
17:54:10FromDiscord<mratsim> @federico3, that seems unrelated.
17:54:13FromDiscord<Unaimend> so why does the nim doc advise to not use unittest.nim?
17:56:05FromDiscord<mratsim> sent a long message, see http://ix.io/2Rdm
17:57:48audiofilethanks InventorMatt, makes sense
17:58:13FromDiscord<Unaimend> sent a code paste, see https://play.nim-lang.org/#ix=2Rdn
17:58:39*JustASlacker joined #nim
17:58:47FromDiscord<mratsim> yes, with proper indentation 😉
17:58:55FromDiscord<Unaimend> kk, thx
18:24:56FromDiscord<hamidb80> hey everyone
18:25:46FromDiscord<hamidb80> i reinstalled my `minwg` and missing header files problem solved
18:25:49FromDiscord<hamidb80> but ..
18:25:51FromDiscord<hamidb80> https://media.discordapp.net/attachments/371759389889003532/815650993122705488/unknown.png
18:26:19FromDiscord<hamidb80> any idea?
18:28:08FromDiscord<hamidb80> https://media.discordapp.net/attachments/371759389889003532/815651565264044032/unknown.png
18:29:03FromDiscord<haxscramper> In reply to @Unaimend "so why does the": sent a code paste, see https://play.nim-lang.org/#ix=2Rdx
18:29:51FromDiscord<mratsim> that rules with a `t` is meh
18:30:18FromDiscord<mratsim> it's okay for it to be a convention, but there shouldn't be a special rule to look for it, it's like magic.
18:30:28FromDiscord<haxscramper> Yeah, but it does the job for simple cases, so I guess it is fine probably
18:30:28FromDiscord<mratsim> just have people create a test task.
18:31:09FromDiscord<mratsim> juste have a "nimble init" task that does the test task skeleton as well.
18:31:15FromDiscord<mratsim> (edit) "task" => "command"
18:31:28*audiophile joined #nim
18:31:32FromDiscord<mratsim> you need a single file only for very very simple libraries.
18:31:56FromDiscord<mratsim> People start testing when they graduate from Hello World and AOC types of programs.
18:31:57FromDiscord<Unaimend> Anybody else had the problem that the nvim syntax highligting died for one buffer even after nvim restart? https://media.discordapp.net/attachments/371759389889003532/815652524248924160/2021-02-28-193052_1919x1022_scrot.png
18:32:52audiophilewhat's the recommended way of handling configuration (like an api key by enduser) in nim?
18:33:03audiophiledon't need anything too complex
18:33:10audiophileis good old .ini okay?
18:34:55*audiofile quit (Ping timeout: 240 seconds)
18:34:57FromDiscord<Yardanico> we have `parsecfg` for ini
18:34:58*audiophile is now known as audiofile
18:35:04FromDiscord<Yardanico> I personally prefer TOML :)
18:36:18FromDiscord<hamidb80> is there any example using redis[or any other message broker] with jester?
18:36:25FromDiscord<hamidb80> (edit) "broker]" => "brokers]"
18:37:22FromDiscord<hamidb80> i'm confused, how can I use more than one async thing? 😕
18:38:05FromDiscord<バロザード> https://gitlab.com/lbartoletti/fpn
18:38:11FromDiscord<バロザード> does anyone know who made thsi library
18:38:26FromDiscord<Yardanico> yes
18:38:30FromDiscord<Yardanico> lbartoletti :P
18:38:33FromDiscord<Yardanico> I
18:38:38FromDiscord<Yardanico> 've seen him around in here
18:38:42FromDiscord<Yardanico> https://github.com/lbartoletti
18:38:59FromDiscord<バロザード> aigh i need to talk to him about his library
18:39:05FromDiscord<バロザード> id like to use it lol\
18:39:30FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/815654424596840458/unknown.png
18:39:37FromDiscord<hamidb80> In reply to @hamidb80 "i'm confused, how can": ?
18:39:41FromDiscord<Yardanico> I guess you can try DMing him on twitter
18:39:41FromDiscord<Yardanico> https://twitter.com/lo_bartoletti
18:40:10FromDiscord<Yardanico> @hamidb80 what do you exactly mean?
18:40:46FromDiscord<バロザード> his twitter doesnt have dms
18:41:04FromDiscord<Yardanico> he does
18:41:17FromDiscord<バロザード> he seems to exist in the irc place tho
18:41:23FromDiscord<バロザード> so i guess i just wait
18:41:42FromDiscord<Yardanico> he should always be around in freebsd irc chans
18:41:48FromDiscord<バロザード> ah k
18:41:55FromDiscord<バロザード> god i hate irc but its for science
18:42:07FromDiscord<Yardanico> its quite easy
18:42:11FromDiscord<Yardanico> lemme check if he's on freenode chans
18:42:20FromDiscord<Yardanico> yeah he is
18:42:27FromDiscord<Yardanico> he's in here too
18:42:36Yardanicolbart the guy above wants to talk with you :)
18:42:49Yardanicoabot your fpn lib
18:42:54Yardanicoabout*
18:44:01FromDiscord<hamidb80> In reply to @Yardanico "<@!745944009918251010> what do you": sent a long message, see http://ix.io/2RdB
18:44:14FromDiscord<hamidb80> (edit) "http://ix.io/2RdB" => "http://ix.io/2RdC"
18:45:11FromDiscord<Yardanico> I don't really get what do you mean by "async loop". you can run as many async procs as you want if you use asyncCheck which starts the future in the background and continues
18:45:19FromDiscord<Yardanico> I'd be more comfortable with a concrete code example :)
18:46:39FromDiscord<mratsim> In reply to @hamidb80 "imagine we have 2": https://tenor.com/view/dbz-dragonball-fusion-gif-4929472
18:46:46FromDiscord<mratsim> sorry, couldn't help it.
18:49:43audiofilehttp://vpaste.net/frmka?bg=dark&nu here, are the typedefs independent or does userid and language come under the SomeClass ?
18:50:08audiofileI assume if they were independent, then the class object would also be on a new line right
18:50:28FromDiscord<Yardanico> they both come under SomeClass
18:50:33audiofilethanks
18:50:43FromDiscord<Yardanico> it's based on the indentation levels - fields are indented inside of SomeClass so they are inside
18:50:51audiofiletype
18:50:51audiofile SomeClass* = object
18:50:51audiofile userid: string
18:50:51audiofile language: string
18:51:00Yardanicothis won't compile
18:51:18Yardanicobecause you can't declare types with ":"
18:51:46audiofileah right mb
18:52:22audiofileso this is valid and it works http://vpaste.net/GFaKv?bg=dark&nu
18:52:24audiofilehmm interesting
18:52:34FromDiscord<Yardanico> yes because you can declare types like that
18:52:43audiofilegot it, ty for clarifying
18:52:45FromDiscord<Yardanico> it's pretty logical I think, nim is an indentation-sensitive language
18:53:06FromDiscord<Yardanico> and you can alias types like that easily
18:53:12audiofileyes, it is, it's just that I'm not so familiar with nim :)
18:53:35audiofiletype\nMyInt = int like that?
18:53:54Yardanicoyes
18:54:07Yardanicoin this case MyInt is just an alternative naming for int
18:54:21Yardanicoyou can also create distinct types https://nim-lang.org/docs/manual.html#types-distinct-type
18:55:06FromDiscord<dom96> huh, didn't even notice Nim on the HN front page 4 days ago
18:56:40audiofilewow, that's cool! so that's a new level of type safety
18:56:42nisstyreHello, when I try compiling this example from the asynchttpserver docs, I get a compiler error https://play.nim-lang.org/#ix=2RdK
18:56:44nisstyrewhat's going on?
18:56:52nisstyrethe type of acceptRequest is wrong I guess
18:57:02audiofiledom96 nim has generally favourable reception on hn so that's good anyway
18:57:17FromDiscord<hamidb80> hn?
18:57:18nisstyrethis is with nim 1.4.2
18:57:42FromDiscord<hamidb80> what is HN?
18:57:58FromDiscord<Yardanico> hackernews
18:58:06FromDiscord<Yardanico> https://news.ycombinator.com/
18:58:16FromDiscord<Yardanico> @nisstyre the devel has a fixed example https://nim-lang.github.io/Nim/asynchttpserver.html
18:58:23FromDiscord<Yardanico> althoug if defined(nimAsyncHttpServerEnableTest): should be removed IMO
18:58:32nisstyreYardanico: thanks
18:58:45FromDiscord<Yardanico> it's really confusing for people who will read the example
19:03:53krux02My PRs on github are marked as stale by the stale bot https://github.com/nim-lang/Nim/pull/13277
19:04:02krux02and I can't do anything about it, as I've been blocked
19:04:05krux02wohoo
19:09:00FromDiscord<mratsim> In reply to @dom96 "huh, didn't even notice": what article? Nim 1.4.4?
19:10:39audiofilewhy is tables not part of standard library or like a type imported by default?
19:10:59audiofilegenuinely curious
19:11:03FromDiscord<Yardanico> it's a part of the standard library
19:11:16audiofilei mean like not imported by default if that makes sense
19:11:21audiofilei have to `import tables` to use it
19:11:24FromDiscord<Yardanico> yes
19:11:28FromDiscord<Solitude> why should anything be import by default?
19:11:30FromDiscord<Solitude> just import it
19:11:31audiofileyes but why
19:11:48audiofilehm ok
19:12:28*valorzard joined #nim
19:12:44valorzardhello
19:12:49FromDiscord<dom96> In reply to @mratsim "what article? Nim 1.4.4?": yep
19:12:50FromDiscord<バロザード> oh cool
19:12:57FromDiscord<バロザード> i can exist in both worlds
19:12:59FromDiscord<バロザード> thats freaky
19:13:15valorzardim the japanese letters guy
19:13:50FromDiscord<バロザード> seeing myself getting repeated is kinda freaky
19:14:01valorzardit feels like im talking to myself
19:14:40liblq-devalmost as if you had schizophrenia, or something.
19:14:57valorzardlooool
19:14:59liblq-devwelcome to IRC land, friend. quite comfy here, isn't it?
19:15:09valorzardno, i perfer discord. This is still pretty cool tho
19:15:21valorzardim mostly here to chase after a certain someone
19:15:32audiofileis there any way to create hashmap from string to any type?
19:15:32liblq-devgood luck in finding them
19:15:36FromDiscord<mratsim> There are converters in `fusion` :/ https://github.com/nim-lang/fusion/blob/master/src/fusion/smartptrs.nim#L100-L103
19:16:19liblq-devaudiofile: there is, but trying to do that is usually a bad idea. what are you trying to do?
19:16:25FromDiscord<mratsim> In reply to @audiofile "is there any way": you need your "any" type to be type erased. Either via inheritance or via object variant.
19:17:49audiofileok that sounds complicated, nothing that can't be stored in a string liblq-dev
19:18:08audiofileso hashmaps in nim are like c and not like python
19:18:14liblq-devin c++, rather
19:18:21audiofileah yes
19:18:23liblq-devbecause C doesn't have generics
19:18:38audiofileis this for better hashmap performance?
19:18:38liblq-devwhat are you trying to do, though?
19:18:58audiofilejust store commandline flags in a hashmap and some of them are numbers so I wanted to mix numbers and strings
19:18:59liblq-devno, it's a type system thing.
19:19:04liblq-devah.
19:19:14liblq-devwell you can parseInt wherever necessary
19:19:16audiofilei can always use string and typecast
19:19:20audiofileyeah that
19:19:23audiofilety
19:19:27liblq-devor, you can create an object variant. give me a second
19:21:46liblq-devaudiofile: https://play.nim-lang.org/#ix=2RdT
19:26:54audiofilehmm I dont quite grok that example so I'll take your word for it
19:27:13FromDiscord<Unaimend> so if if compare to refs of seq[seq[int], will nim compare the addresses or the values?
19:27:45FromDiscord<mratsim> code?
19:27:52FromDiscord<mratsim> ref seq have ref semantics so yes
19:28:03FromDiscord<mratsim> seq[seq[T]] have value semantics so no
19:28:42FromDiscord<Unaimend> In reply to @mratsim "code?": `type Matrix = ref seq[seq[int]] ` so this is my type
19:29:08FromDiscord<mratsim> address will be compared
19:29:50FromDiscord<Unaimend> but i should be able to just use the dereference operator to compare the values, shouldnt I?
19:30:36FromDiscord<Yardanico> yes
19:31:04FromDiscord<Unaimend> In reply to @mratsim "address will be compared": I always forget that you have to use []
19:31:16FromDiscord<Unaimend> because in c++ you just have to deref pointers
19:31:33FromDiscord<mratsim> a ref is a pointer
19:31:51FromDiscord<Unaimend> yeah under the hood
19:32:28FromDiscord<Unaimend> but int test(int ptr) is not the same as int test(int& ref), i.e. it will behave differently
19:35:23superbiawould I gain any performance if I transfer my python OpenCV code to nim ?
19:36:31FromDiscord<InventorMatt> if you use a lot of foor loops then yes
19:36:33FromDiscord<Yardanico> it depends on how much of your processing is done in python
19:37:00FromDiscord<Yardanico> if you just do opencv calls most of the time without any algorithms in python - I doubt that you'll get much performance gain
19:37:07superbiayup, that is the case
19:38:23FromDiscord<バロザード> well since searching for my mystery man isnt working
19:38:37FromDiscord<バロザード> does anyone know how i could go around setting thsi library up?
19:38:53*rokups quit (Quit: Connection closed for inactivity)
19:39:34FromDiscord<バロザード> https://gitlab.com/lbartoletti/fpn
19:40:26FromDiscord<InventorMatt> is there an error when nimble installing it?
19:40:31FromDiscord<mratsim> `nimble install fpn` ?
19:40:35FromDiscord<バロザード> ah k
19:40:37audiofilei cannot initialize properties in an object right? I want to do something like this http://vpaste.net/rCgDl?bg=dark&nu
19:40:54FromDiscord<バロザード> tho, i wonder how i could make my own fixed point type
19:41:12FromDiscord<mratsim> no, it's being discussed
19:41:20FromDiscord<mratsim> @audiofile ^
19:41:42audiofileohhh ok, any workaround for that until that is resolved? :)
19:42:02FromDiscord<mratsim> In reply to @バロザード "tho, i wonder how": you use uint as a base and arbitrary choose a bit position to be your decimal point.
19:42:25FromDiscord<mratsim> In reply to @audiofile "ohhh ok, any workaround": use an init/nea function with efault value
19:42:32FromDiscord<mratsim> init/new
19:42:49audiofileum like a constructor?
19:43:03FromDiscord<mratsim> yes
19:46:30FromDiscord<バロザード> im looking at thsi code and im not seeing where the actual types get made
19:46:48FromDiscord<バロザード> the main thing im seeing is a function called fracbits, which seems to split a number into high and low
19:46:57FromDiscord<バロザード> but that method isnt actually defiend anywhere
19:47:10FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/815671449363677184/unknown.png
19:47:19FromDiscord<Yardanico> `type FixedPoint = fixedPoint8 | fixedPoint16 | fixedPoint32 | fixedPoint64;`
19:47:58FromDiscord<バロザード> yeah nothats whats im talking about
19:48:03FromDiscord<バロザード> what does fracBits do?
19:48:04FromDiscord<バロザード> it doesnt say
19:48:23FromDiscord<Yardanico> wdym "what does fracBits do"?
19:48:28FromDiscord<Yardanico> it's a static parameter of the type
19:48:33FromDiscord<Yardanico> amount of bits for the fraction part I guess
19:48:48FromDiscord<バロザード> ohhh
19:48:51FromDiscord<mratsim> This explains how to implement fixed points: https://homepage.divms.uiowa.edu/~jones/bcd/divide.html#fixed
19:49:59FromDiscord<バロザード> hmmmmm i still dont really get it tho, where is fracBits set? when genQType is called, it takes the name and the already used types
19:50:11FromDiscord<バロザード> but when thats called, it doesnt take fracbits
19:50:23FromDiscord<Yardanico> when the type is instantiated
19:50:33FromDiscord<バロザード> oh wait i think i understand
19:51:02FromDiscord<バロザード> the floats are hardcoded to be split in half to be converted to fixed point i think
19:51:36audiofileim still unable to find out how to create constructor with new/init. any links?
19:51:51FromDiscord<Yardanico> there's no such thing as "constructor" in Nim
19:52:01FromDiscord<Yardanico> you can just make a proc on your own that'll be named like `newFoo` or `initFoo`
19:52:02FromDiscord<Yardanico> that'
19:52:09FromDiscord<Yardanico> s kind of the convention
19:52:21audiofileoh and how does it get called - automatically when an object is created?
19:52:23FromDiscord<Yardanico> newFoo for reference types (ref object), initFoo for value types (object)
19:52:25FromDiscord<Yardanico> no
19:52:27FromDiscord<Yardanico> you call it manually
19:52:39FromDiscord<Yardanico> as I said it's just a convention, nim doesn't call constructors for you automatically
19:53:01FromDiscord<Yardanico> that said, nim initializes all fields to zero by default and you can use object construction syntax
19:53:18audiofileoh, so what's the recommended way to call it? like where do I call it? I don't want the user to have to call something like obj.initObj
19:54:03JustASlackervar myObj = initMyObj(foo, bar)
19:54:27audiofileso initMyObj wraps around the type MyObj?
19:54:42JustASlackerit returns an instance of that object
19:54:46FromDiscord<Yardanico> wdym "wraps around"? it returns an object of the type MyObj
19:54:50JustASlackerlike factory pattern
19:55:20FromDiscord<Yardanico> it's just a convention, you can have a proc `initFoo` that returns an object of type `Bar` :P
19:58:21JustASlackerjust made my first .nimble file
19:58:23JustASlackerfun
19:58:41audiofilehere is my confusion: https://play.nim-lang.org/#ix=2Re6 like how do I bind 'opt' to the SomeClass object
19:58:57audiofileI hope I'm doing the init thing right
20:00:15audiofileL#3 is what I want to do but cannot do now
20:00:45audiofileit's like class member variables being initialized (from python)
20:02:31FromDiscord<Yardanico> you can't just "bind" it
20:02:39FromDiscord<Yardanico> you have to declare a field `opt` in your `SomeClass`
20:02:42FromDiscord<Yardanico> nim is a static language
20:03:23FromDiscord<バロザード> sent a code paste, see https://play.nim-lang.org/#ix=2Rec
20:03:33FromDiscord<Yardanico> what type is a.data?
20:03:55FromDiscord<Yardanico> ah I see
20:04:07FromDiscord<バロザード> its a bunch of different ints
20:04:23FromDiscord<バロザード> ill also have to replace all of the unit tests to test some stuff out, which will also be annoying
20:04:26FromDiscord<Yardanico> high(typeof(a.data))
20:04:30FromDiscord<バロザード> ooo ok
20:04:39FromDiscord<Unaimend> In reply to @audiofile "I hope I'm doing": https://play.nim-lang.org/#ix=2Re6
20:04:43FromDiscord<Yardanico> also this code can be shortened if you want
20:04:54FromDiscord<Yardanico> result.data = if isSafeAbs(a): abs(a.data) else: high(typeof(a.data))
20:05:19audiofileUnaimend, it's the same paste?
20:05:45FromDiscord<Unaimend> In reply to @audiofile "<@287576619718279178>, it's the same": upsi, waita sec
20:06:36FromDiscord<Unaimend> In reply to @audiofile "<@287576619718279178>, it's the same": https://play.nim-lang.org/#ix=2Ref
20:06:51FromDiscord<Yardanico> @Unaimend this can be shortened, you don't need to make a copy here :)
20:06:53audiofileurl still looks the same
20:07:00audiofileoh nvm
20:07:34FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Reg
20:07:37FromDiscord<Unaimend> In reply to @Yardanico "<@!287576619718279178> this can be": True
20:07:52FromDiscord<Unaimend> Thats even nicer
20:14:48audiofilethanks Unaimend, that makese sense now
20:14:56FromDiscord<バロザード> ugh i tried to fix the deprecated stuff, but it led to a bunch of weird bugs so ill revert for now
20:16:12*kenran joined #nim
20:17:30audiofileis there any shorthand notation for assigning values to member variables like the 'sc.<var> = something'
20:17:45audiofileassuming my initSomeClass(**kwargs)
20:18:06*xet7 joined #nim
20:25:36*JustASlacker quit (Ping timeout: 240 seconds)
20:31:21*kenran quit (Remote host closed the connection)
20:31:38*kenran joined #nim
20:36:37FromDiscord<Unaimend> In reply to @audiofile "is there any shorthand": not exactly sure what you mean, could you give an example
20:37:07FromDiscord<ElegantBeef> I believe they're after `std/with`
20:37:16FromDiscord<Kiloneie> Should i put my last video into the , this month with/in nim ?
20:38:46FromDiscord<ElegantBeef> Like i said just go ahead, if anyone dislikes the inclusion it can be removed
20:39:08FromDiscord<Kiloneie> Okay, so i open up a new issue ? i can't think straight today...
20:39:14FromDiscord<ElegantBeef> Yep
20:39:57audiofileUnaimend, something like this https://play.nim-lang.org/#ix=2Rek
20:40:27FromDiscord<ElegantBeef> How about this audiofile? https://github.com/beef331/constructor
20:42:06FromDiscord<Unaimend> In reply to @audiofile "<@287576619718279178>, something like this": Maybe one could come up with template/macro sulotion, but I did not work with those at all
20:44:37FromDiscord<Unaimend> In reply to @audiofile "assuming my initSomeClass(**kwargs)": so you basically would like to unpack a table/dictionary in to your object?
20:45:00audiofileyes
20:45:27audiofileElegantBeef, that is interesting but I was hoping for a smaller solution without a library because this is just a one-time thing
20:45:29audiofilethanks tho
20:49:06FromDiscord<Unaimend> In reply to @audiofile "yes": Sry, dont know any way atm
20:49:14FromDiscord<Unaimend> (edit) "way" => "solution"
20:53:14audiofileokay nw
20:53:29audiofileI guess that's the reason for the library ha
21:08:46audiofilehttp://vpaste.net/O8XUd?bg=dark&nu can someone tell me why this is wrong?
21:08:57audiofileI'm trying to assign n only if it's greater than 100
21:09:08FromDiscord<Yardanico> then you should have if outside
21:09:19FromDiscord<Yardanico> if n > 100: obj.opt["n"] = n
21:11:02audiofileI'm guessing it's not possible to make it a one-liner?
21:11:10audiofilebecause I tried that first and still got an error
21:11:36audiofileoh nvm my bad have to typecast
21:13:04*valorzard quit (Quit: Connection closed)
21:15:02*haxscramper quit (Remote host closed the connection)
21:16:03FromDiscord<hamidb80> uh
21:16:58FromDiscord<hamidb80> In reply to @audiofile "I'm trying to assign": it's not ruby
21:17:20audiofileidk ruby so what you say is lost on me
21:19:53FromGitter<ynfle> @audiofile, you have to put and `else` branch if you are going to assign a value. Like ⏎ ⏎ ```thisVar = if n > 100: n else: 100``` [https://gitter.im/nim-lang/Nim?at=603c08f8e5f1d949d46e3749]
21:20:23audiofileoh if it's on a single line I can't omit the else branch?
21:20:30FromDiscord<hamidb80> In reply to @audiofile "oh if it's on": https://play.nim-lang.org/#ix=2Reu
21:21:19FromDiscord<hamidb80> is that what you want?
21:21:35audiofilewithout the else is it possible?
21:21:45FromDiscord<hamidb80> In reply to @audiofile "without the else is": i dont think so
21:21:50audiofilehmm ok thanks!
21:22:08audiofileis there no thing like some noop? like just to fill in the else-branch then
21:22:29FromGitter<ynfle> @audiofile, what would the value be if the condition isn't true?
21:22:37audiofilenot assigned
21:23:06FromGitter<ynfle> What use would that be? You'd be reading from nil?
21:23:48FromDiscord<Yardanico> @audiofile that's the thing
21:23:52FromDiscord<Yardanico> nim is fully statically typed
21:23:59FromDiscord<Yardanico> so if you're assigning you have to ALWAYS know the value
21:24:25FromDiscord<Yardanico> that's why `a.b = if n > 100: n` is not possible but `if n > 100: a.b = n` is
21:24:40FromDiscord<Solitude> In reply to @audiofile "is there no thing": it wouldnt be an expression then
21:25:07FromDiscord<Rika> yall ive a question; are there any plans to allow for operators to be async?
21:25:22FromDiscord<Rika> kinda strange question i know
21:25:26FromDiscord<Yardanico> uhh
21:25:30FromDiscord<Yardanico> what does that mean
21:25:41FromDiscord<Rika> you can do `await a[i] = x` or so
21:25:41FromDiscord<hamidb80> a +await= a
21:25:44FromDiscord<Rika> very strange i know
21:25:53audiofileYardanico I tried `if n > 100: a.b=n` but get `complex statement requires indentation`
21:26:02FromDiscord<Yardanico> you need newline or parenthesis
21:26:26FromDiscord<Rika> not the same.
21:26:27FromDiscord<hamidb80> In reply to @Rika "you can do `await": sent a code paste, see https://play.nim-lang.org/#ix=2Rew
21:26:29FromDiscord<hamidb80> In reply to @hamidb80 "```nim a[i] =await ": ?!
21:26:39FromDiscord<Rika> i want `[]=` to be awaited, not `x`
21:27:13FromDiscord<Rika> though that does beg the question how would `await a[x]` work huh
21:28:06FromDiscord<hamidb80> In reply to @Rika "though that does beg": right
21:29:11FromDiscord<Rika> actually no that would work
21:29:29FromDiscord<Rika> as long as a doesnt contain a Future as well, then that would need the funkiest shit `await await a[x]`
21:32:05FromDiscord<Rika> let me actually test if what i said doesnt work, i only recall it not working
21:34:34FromDiscord<Rika> yup doesnt work for setting
21:46:45FromDiscord<dom96> pretty sure we wouldn't want that to work actually lol
22:00:20FromDiscord<Rika> why so?
22:05:12*kenran quit (Quit: leaving)
22:09:49*eternaldelta quit (Quit: WeeChat 2.8)
22:12:44*lritter joined #nim
22:13:45*PMunch quit (Quit: leaving)
22:20:33*vicfred quit (Quit: Leaving)
22:26:38*asdflkj joined #nim
22:26:41FromDiscord<mratsim> @saem, here you go, only task parallelism/threadpools specified for now and @Unaimend and also all interested in revamping Nim threadpool: https://github.com/mratsim/weave/blob/master/rfcs/multithreading_apis.md↵↵Have to specify channels now and then do some relecture and edits
22:27:12saemOh damn
22:27:45saemIs this the spiritual successor of CPS?
22:28:18saemOr rather, requires it/it's hiding in there?
22:29:11FromDiscord<mratsim> No it's different
22:29:20saemyup, skimmed it and got to non-goals
22:30:04FromDiscord<mratsim> CPS is a low-level construct that would allow to create scheduler/executor agnostic tasks (among other things).
22:30:12FromDiscord<mratsim> This is a user-facing API.
22:30:38FromDiscord<mratsim> CPS would help async/iterators/task/multithreading library authors
22:31:17FromDiscord<mratsim> while this would help parallel library authors and users, in particular it should guide the rewrite of Nim threadpool.
22:31:32saemYeah, I'm more interested in CPS and my interesting in the APIs are as long as they don't have some silly expectations that tie one's hands when implementing the lower level fundamental bits like CPS.
22:31:50saems/interesting/interest
22:32:31FromDiscord<mratsim> I need to reboot the CPS implementation
22:32:55FromDiscord<mratsim> My current thinking for CPS APi is this: https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md
22:33:01saemBut I know you're very sounds fundamentals/algebra driven so that's already reassuring
22:33:39FromDiscord<mratsim> but I need to implement some "user" programs using it to make sure it's usable and there is no hidden gotcha.
22:34:08saemOf course, it can be as beautiful as it wants, but needs to solve a "real thing"
22:34:23FromDiscord<Unaimend> In reply to @mratsim "but I need to": Astute readers will think, what’s the difference with a closure? Should this be `Astute readers will think, what’s the difference to a closure?` in the blogpost
22:38:26FromDiscord<mratsim> sent a long message, see http://ix.io/2ReX
22:39:27FromDiscord<mratsim> Names subject to bikeshedding, but those are mostly for library authors so it's fine having them somewhat long.
22:39:48FromDiscord<mratsim> going to sleep now.
22:40:02*tane quit (Quit: Leaving)
22:42:06saemnite
22:44:08audiofilewhat's wrong with this format specifier? https://play.nim-lang.org/#ix=2ReZ
22:44:28*gpanders quit (Ping timeout: 268 seconds)
22:45:04FromDiscord<Yardanico> it's wrong :)
22:45:09FromDiscord<Yardanico> $# if you don't want to specify the number
22:45:11FromDiscord<Yardanico> its in the docs
22:45:13*gpanders joined #nim
22:45:29FromDiscord<Yardanico> "The notation $# can be used to refer to the next substitution variable"
22:45:48FromDiscord<Yardanico> https://nim-lang.org/docs/strutils.html#%25%2Cstring%2CopenArray%5Bstring%5D. You should also look at strformat module https://nim-lang.org/docs/strformat.html
22:46:02audiofileooof good catch
22:52:56*superbia quit (Quit: WeeChat 3.0)
23:08:52audiofilethanks, strformat looks more like what I'm used to
23:09:00audiofilehttp://vpaste.net/eakLx?bg=dark&nu is this a valid way of sending a file over a socket
23:12:44*oprypin quit (Quit: Bye)
23:12:52*oprypin joined #nim
23:14:16FromDiscord<Yardanico> not at all
23:14:23FromDiscord<Yardanico> socket.send(fp.readAll()) is more like it
23:14:38FromDiscord<Yardanico> or you can also to read and send in chunks so you don't have to hold the whole file content in memory
23:16:57audiofileohh ok!
23:16:59audiofilethanks
23:18:27audiofilein https://play.nim-lang.org/#ix=2Rf7, the $ for converting to string gets evaluated last, right?
23:18:35FromGitter<ynfle> Or just use `readFile`, no opening and closing files
23:18:53audiofileoh lemme look that up >_>
23:19:29FromGitter<ynfle> @audiofile, Ya. but you can use brackets for precedence
23:19:55FromGitter<ynfle> https://play.nim-lang.org/#ix=2Rfa
23:20:05FromGitter<ynfle> @audiofile ☝️
23:20:07audiofileconvert($abc, destEncoding="UTF-8")?
23:20:18audiofileooooh
23:20:22FromGitter<ynfle> Or that
23:20:23FromDiscord<Yardanico> $ binds stronger than parenthesis
23:20:25FromDiscord<Yardanico> or dot access
23:20:36audiofilehighest precedence?
23:20:43FromDiscord<Yardanico> no I'm wrong
23:20:48FromGitter<ynfle> I'd recomment putting the `echo` in the front so it's obvious what you're trying to do
23:20:54audiofilenot doubting you, just curious :/
23:20:57FromDiscord<Yardanico> but "Unary operators always bind stronger than any binary operator: $a + b is ($a) + b and not $(a + b)."
23:21:01FromDiscord<Yardanico> I wasn't sarcastic
23:21:06FromDiscord<Yardanico> I actually said "I'm wrong" :P
23:21:17audiofileohhh lmao mb
23:21:37audiofileyes ynfle but ever since I discovered nim can do that it's easy to write as I think
23:21:37FromGitter<ynfle> @Yardanico https://play.nim-lang.org/#ix=2Rfb
23:21:45FromGitter<ynfle> Ok
23:21:46audiofilelike chaining together methods
23:22:02FromGitter<ynfle> But if you put it in front, it's obvious what you are doing
23:22:05FromGitter<ynfle> Trying to print
23:22:08audiofileindeed
23:22:14FromGitter<ynfle> As apposed to trying to process something
23:25:47*vicfred joined #nim
23:27:02audiofilefor encodings.convert, the default value for desEncoding is "UTF-8", right?
23:27:11audiofilethe docs have that as a value
23:27:22audiofilenot sure if that function signature is an example or default value
23:29:10FromDiscord<Yardanico> it's not
23:29:15FromDiscord<Yardanico> it's the actual default value
23:29:25audiofileok nice
23:29:31FromDiscord<Yardanico> nim doc generator works on actual nim code so it's all from actual signatures
23:40:18audiofilewow
23:40:22audiofilethat's so meta
23:40:41audiofileif your docs dont compile that means your code is wrong? O_o
23:43:54FromDiscord<Rika> Pretty much
23:44:18FromDiscord<Rika> You can also have tests that are run on docs creation and shown in the docs
23:49:03FromGitter<ynfle> https://nim-lang.org/docs/system.html#runnableExamples%2Cstring%2Cuntyped
23:51:55*Prestige quit (Quit: Prestige)
23:54:09*Prestige joined #nim
23:54:09FromDiscord<brainproxy> is there an annotation I can use to overcome the compiler failing with `Error: closure in spawn environment is not allowed`.↵↵The thing that's in closure is known by me to always have been allocated on the shared heap, and on the other side of the spawn I know to deallocate just once.