<< 18-11-2021 >>

00:11:13FromDiscord<treeform> I don't think so, open an issue with small repro case and I'll fix it.
00:12:40FromDiscord<sealmove> when you compile with the `outDir` switch, are relative paths in imports resolved based on that dir, or are they resolved based on `$PWD`?
00:13:50FromDiscord<Elegantbeef> outDir should be based off your current work directory
00:14:12FromDiscord<sealmove> ? if it's the same then what's the point of the switch alltogether?
00:14:31FromDiscord<Elegantbeef> to change the output directory?
00:14:37FromDiscord<sealmove> oh
00:14:49FromDiscord<sealmove> change _to_ the output dir?
00:14:55FromDiscord<Elegantbeef> you can have a `configs.nim` with `--outputdir:"bin/"`
00:15:04FromDiscord<Elegantbeef> `outDir`\
00:15:29FromDiscord<Elegantbeef> `--outdir:DIRset the path where the output file will be written`
00:16:14FromDiscord<sealmove> i know that the executable is placed in `outdir`, but if you have an import with a relative path, will it be relative to `outdir`?
00:16:27FromDiscord<Elegantbeef> No
00:16:55FromDiscord<sealmove> are you 100% sure? :)
00:16:59FromDiscord<Elegantbeef> having imports depend on outDir would wreak havoc on reproducable builds
00:17:17FromDiscord<Elegantbeef> Why would outDir change the imports, that's just hell
00:19:19FromDiscord<sealmove> I didn't say it should. Just trying to understand my program
00:21:31FromDiscord<sealmove> Thanks Elegantbeef
01:13:10*krux02 quit (Remote host closed the connection)
01:15:42*Colt quit (Quit: Leaving)
01:15:57*Colt joined #nim
01:32:38*vicfred quit (Quit: Leaving)
02:05:44FromDiscord<Jakraes> Hey guys, quick question, how do I open txt files with nim?
02:06:53rockcaverajakraes see std/streams
02:07:58FromDiscord<Jakraes> Thanks!
02:08:04rockcavera=)
02:21:57FromDiscord<deech> sent a code paste, see https://play.nim-lang.org/#ix=3FjB
02:22:16FromDiscord<Elegantbeef> Cause it's a constant
02:23:34FromDiscord<deech> Is there any documentation on `lent` outside of `destructors.rst`?
02:24:07FromDiscord<Elegantbeef> It's just a mutable reference so everything that applies to `var` applies to it
02:24:17FromDiscord<Elegantbeef> immutable\
02:24:52FromDiscord<Elegantbeef> Just like `var T` presently it does copy on assignment and all that jazz, but if you dont store it will not copy
02:28:50FromDiscord<Elegantbeef> I know not overly helpful, but i dont think there are any other docs on the matter
02:34:40FromDiscord<deech> Then what's the advantage to returning a `lent T` instead of `T` since neither can be passed to a `var T` argument.
02:35:16FromDiscord<Elegantbeef> `lent` is borrowed always
02:35:39FromDiscord<deech> So it just avoids a copy?
02:36:01FromDiscord<Elegantbeef> Yes, plus when views become standard you'll be able to get save views
02:36:06FromDiscord<Elegantbeef> safe views\
02:36:39FromDiscord<deech> Why are they unsafe now?
02:36:47FromDiscord<deech> BTW thanks for answering my questions.
02:37:44FromDiscord<Elegantbeef> Well views are experimental is what i mean, presently without them you have to use pointers to get views and manually ensure they dont outlive the place of borrowing
02:38:14FromDiscord<deech> Ah, ok, so if you enable `{experimental: views.}` you do get safe views?
02:38:25FromDiscord<Elegantbeef> the thing is with lent annotations copies wont be made unless it's needed with viewtypes when they become standard
02:38:32FromDiscord<Elegantbeef> Yea they should be safe
02:38:37FromDiscord<impbox [ftsf]> experimentally safe
02:38:58FromDiscord<deech> I caught that nuance thanks. πŸ™‚
02:40:23FromDiscord<Elegantbeef> lent is much like openarray, in that smart usage can make code faster πŸ˜›
02:41:18FromDiscord<impbox [ftsf]> can idiotic usage code make slower?
02:41:36FromDiscord<Elegantbeef> Not really since Nim knows to copy when it needs to
02:41:41FromDiscord<impbox [ftsf]> win
02:42:16FromDiscord<Elegantbeef> Like `proc doThing(s: SomeObj): lent SomeOtherObj = s.field` will only copy when you do `var a = someObj.doThing()` and things like it
02:42:33FromDiscord<Elegantbeef> but if you do `echo someObj.doThing()` it'll be borrowed
02:43:22FromDiscord<Elegantbeef> Nim's move semantics and borrowing is quite nice, but the caveat is that there is no way of barring copies in a limited capacity, say you have a hotpath you never want to copy and want `sink` to actually sink, you're up shit creek
02:43:56FromDiscord<Elegantbeef> You either make everything under a specific scope incapable of copying on sink, or you manually ensure copies dont happen
02:44:45FromDiscord<Elegantbeef> https://github.com/nim-lang/RFCs/issues/432 RFC that talks about that
02:45:02FromDiscord<deech> How does copy do the right thing when `SomeOtherObj` is an object with a `ptr` field?
02:46:14FromDiscord<Elegantbeef> so you're saying like `lent ptr int`?
02:47:00FromDiscord<deech> Like `type O = object; p: ptr int; proc f():lent O = ...`
02:47:49FromDiscord<Elegantbeef> Well it'd copy the ptr in that case, which is of course dangerous, but in the future with view types it'd be a borrowed immutable view
02:48:26FromDiscord<Elegantbeef> Cause `lent T` will have the same semantics as `strictFuncs` in that any mutation to the object would be a compile time error afaik
02:49:09FromDiscord<Elegantbeef> I suppose i could be wrong about this stuff, i'm a lowly numpty afterall πŸ˜€
02:54:24*redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
02:55:02*neurocyte0132889 quit (Ping timeout: 268 seconds)
02:55:16*redj joined #nim
02:59:03*redj quit (Client Quit)
03:00:15*redj joined #nim
03:43:20FromDiscord<Jakraes> Another question, is there a library that allows nim to create image files?
03:46:21FromDiscord<impbox [ftsf]> I use nimPNG for loading and saving PNGs
03:46:46FromDiscord<impbox [ftsf]> stb_image is pretty easy to use
03:47:35FromDiscord<Jakraes> Sounds great, I'll try it out, thanks!
03:48:12FromDiscord<impbox [ftsf]> stb_image is a wrapped c header library, can do a bunch of formats, nimPNG just does PNG but is pure nim
03:49:31FromDiscord<Jakraes> I think nimPNG is probably the best for what I'm trying to make, just wanna keep it really simple
04:06:02*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
04:11:45*arkurious quit (Quit: Leaving)
04:18:26*rockcavera quit (Remote host closed the connection)
05:40:12FromDiscord<Yardanico> In reply to @Jakraes "I think nimPNG is": For more complex stuff there's pixie
05:40:22FromDiscord<Yardanico> It has a lot of features
06:27:18*mst quit (Ping timeout: 260 seconds)
06:54:16FromDiscord<treeform> Yes pixie can also read and write png files.
06:54:54FromDiscord<treeform> Here are some speed numbers: https://discord.com/channels/371759389889003530/706542664643772436/794660369741905930
06:55:38FromDiscord<treeform> Like nimPNG pixie has a pure nim png reader/writer.
07:20:24*krux02 joined #nim
07:37:49NimEventerNew thread by Kobi: MetaCall, see https://forum.nim-lang.org/t/8635
07:43:26*neurocyte0132889 joined #nim
07:43:26*neurocyte0132889 quit (Changing host)
07:43:26*neurocyte0132889 joined #nim
08:11:51*advesperacit joined #nim
08:20:14*krux02 quit (Remote host closed the connection)
08:39:05*Vladar joined #nim
08:56:57FromDiscord<ynfle (ynfle)> Why are object fields in a TypeDef Ident not Sym?
08:57:45*PMunch joined #nim
08:58:36FromDiscord<Elegantbeef> What's the macro?
08:58:41FromDiscord<Elegantbeef> Is it a typed or untyped macro?
09:01:01PMunch@Elegantbeef, tried to tell him yesterday :P https://irclogs.nim-lang.org/17-11-2021.html#20:34:06
09:01:28FromDiscord<Elegantbeef> It could be typed data, but if it's a typedef the syms arent bound since they'd point to nothing
09:03:28FromDiscord<Elegantbeef> For instance https://play.nim-lang.org/#ix=3FkE
09:13:13FromDiscord<ynfle (ynfle)> @Pmunch The gitter bridge was broken so I didn't see the reply. Either way it was typed
09:13:29PMunchAh, that's a bummer
09:13:44PMunchHmm, then I guess ElegantBeef has the correct answer
09:13:59FromDiscord<ynfle (ynfle)> @beef what do you mean by point to nothing?
09:14:33FromDiscord<Elegantbeef> Well what'd the symbols access when you wrote them
09:14:40FromDiscord<Elegantbeef> There isnt anything instantiated to reference
09:15:00FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3FkH for the better comparison of AST
09:17:28FromDiscord<ynfle (ynfle)> Makes sense
09:17:31FromDiscord<ynfle (ynfle)> I think
09:18:39FromDiscord<Elegantbeef> What are you trying to do?
09:28:07NimEventerNew thread by Planetis: Always confused with float conversions, see https://forum.nim-lang.org/t/8636
09:30:03FromDiscord<ynfle (ynfle)> Lots of stuff, but I was just curious. I wast using a modified version of `macrotuils.forNode` that doesn't modify the value so it can work on typed ASTs to gather all the types that are use in the code that are defined in the current module. For some reason it didn't visit the field of an object or tuple
09:31:01FromDiscord<Elegantbeef> Ah i was more asking the overall goal if that is a blocker πŸ˜€
09:31:30FromDiscord<ynfle (ynfle)> Just trying to figure out why they weren't visited
09:32:27FromDiscord<Elegantbeef> Ah then i guess you have the answer πŸ˜€
09:41:11PMunchynfle_(ynfle), if you make modifications to macroutils please share them :)
09:41:49FromDiscord<ynfle (ynfle)> With pleasure.
09:41:50FromDiscord<Rika> Is it bound by license
09:42:32FromDiscord<ynfle (ynfle)> There isn't any license
09:42:55FromDiscord<Elegantbeef> Well shit
09:43:03PMunchThere is
09:43:05PMunchIt's MIT
09:43:35PMunchhttps://github.com/PMunch/macroutils/blob/master/macroutils.nimble#L6
09:43:41FromDiscord<ynfle (ynfle)> @Pmunch what should I call it? It is a modified version of forNode that doesn't modified the AST
09:44:03FromDiscord<ynfle (ynfle)> Sneaky for not putting it in the repo
09:44:17PMunchI just keep forgetting..
09:44:34PMunchI give them MIT when Nimble asks me and I don't think about it again
09:45:02FromDiscord<ynfle (ynfle)> All good
09:45:59PMunchHmm, what to call it is tricky
09:46:23FromDiscord<ynfle (ynfle)> I called it forNodeImut
09:46:24PMunchCan you inspect the action argument and just not modify the tree if it doesn't return anything?
09:46:33PMunchThat way they can both be called forNode
09:46:54FromDiscord<ynfle (ynfle)> Let me see
09:47:01FromDiscord<ynfle (ynfle)> I can just over load I think
09:47:16PMunchOh yeah, it takes a proc as an argument. So you should be able to just add an overload
09:47:58PMunchPlease make forNodePos also work like this if you don't mind :)
09:47:59*xet7 quit (Quit: Leaving)
09:48:31FromDiscord<Elegantbeef> Wow pmunch getting free labour and will make millions off of it!
09:49:11PMunchHaha, millions with my MIT licensed work :P
09:49:57PMunchI mean I do make a couple bucks a year off-of GitHub sponsorships. I think it's like $40 or something
09:50:17FromDiscord<Elegantbeef> Damn disruptek paying those bills πŸ˜›
09:55:10PMunchHuh, apparently I've calculated all wrong, I actually get a nice little sum. About a beer a month
10:14:18NimEventerNew thread by Wiltzutm: Energy efficiency, see https://forum.nim-lang.org/t/8637
10:21:19FromDiscord<Stuffe> How do you check if an integer has an enum value associated with it? Like `if 5 in my_directions: ...`
10:21:37FromDiscord<Stuffe> That one doesn't work of course. Do I have to use try/catch?
10:21:44FromDiscord<Elegantbeef> Are the enums sequentially stored?
10:21:55FromDiscord<Stuffe> right now yes
10:22:14FromDiscord<Stuffe> ah you are thinking of using my_directions.high?
10:22:26FromDiscord<Elegantbeef> `if x in MyEnum.low.ord .. MyEnum.high.ord`
10:23:14FromDiscord<Stuffe> ok thank you, I was hoping to use this enum as IDs, so would rather not commit to no holes
10:23:52FromDiscord<Stuffe> I mean I don't want to be able to store these enum integers and never rearrange even if one of the enum fields are deleted
10:24:01FromDiscord<Stuffe> (edit) removed "don't"
10:24:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FkX
10:24:34FromDiscord<Elegantbeef> I personally despise holey enums
10:24:43FromDiscord<Stuffe> I see
10:25:40FromDiscord<Stuffe> well in general I would rather keep things simple as well, but sometimes reality complicates things
10:27:01FromDiscord<Elegantbeef> Well it's less about simple imo, just that they suckkkkkkk πŸ˜€
10:28:06FromDiscord<Stuffe> well explicitly keeping track of key value pars has other downsides
10:28:29FromDiscord<Stuffe> I could see myself doing that sometimes
10:28:48FromDiscord<Stuffe> but I think its less readable
10:29:37FromDiscord<Elegantbeef> Anyway for holey read this forum post and choose your favourite https://forum.nim-lang.org/t/8188
10:31:11FromDiscord<Stuffe> oh god. Why isn't there an easy check like `if x in my_enum:`
10:31:30FromDiscord<Elegantbeef> Cause holey enums suck πŸ˜€
10:32:02FromDiscord<Elegantbeef> Joke aside, https://forum.nim-lang.org/t/8188#52705 has the basis for that
10:32:27FromDiscord<Elegantbeef> and now `enumAsSet` isnt needed since `setUtils` now exists
10:33:21FromDiscord<Elegantbeef> It's still pretty bad so i guess time for a PR to enum utils πŸ˜‰
11:10:50*fputs quit (Remote host closed the connection)
11:11:42*fputs joined #nim
11:19:15FromDiscord<haxscramper> You can overload 'contains' for enum typedesc↡(@Stuffe)
11:20:02FromDiscord<haxscramper> `proc [E: enum](Enum type: typedesc[E], value: int): bool`
11:21:57FromDiscord<Stuffe> I see
11:23:53FromDiscord<Stuffe> Really contiguous enums and non contiguous enums should be 2 different things completely in my opinion and simple things like this should be in the standard lib
11:52:13PMunchHmm, is there a way to use Nim types in GDB?
11:52:52PMunchI need to cast a generic pointer to a Nim type, and currently I use the obfuscated name, but it would be nice to not have to check the C file to find those names every time
11:55:24FromDiscord<Yardanico> In reply to @PMunch "Hmm, is there a": https://github.com/nim-lang/Nim/blob/devel/tools/nim-gdb.py should work
11:55:50FromDiscord<Yardanico> but it's not perfect
11:58:20PMunchHmm, nim-gdb is installed in .nimble. But it doesn't work because it requires /home/peter/.nimble/tools/nim-gdb.py which isn't installed :P
11:59:11*neurocyte0132889 quit (Ping timeout: 250 seconds)
12:05:41PMunchHmm, it wasn't able to do casting to types though..
12:05:57PMunch`print *(tyObject_ModuleQueryData__mgCg2qkWiF7TTb2pRsGCMQ*)qstate.minfo[1]`
12:06:01PMunchThis is what I'm doing now
12:06:01*supakeen quit (Quit: WeeChat 3.3)
12:06:25PMunchTo print the `qstate.minfo[1]` field as a `ptr ModuleQueryData`
12:06:32*supakeen joined #nim
12:19:27FromDiscord<gingerBill> sent a code paste, see https://play.nim-lang.org/#ix=3Fln
12:19:47*rockcavera joined #nim
12:19:47*rockcavera quit (Changing host)
12:19:47*rockcavera joined #nim
12:19:58FromDiscord<haxscramper> no, there is no flag toggle function
12:20:04FromDiscord<Yardanico> there is in stdlib
12:20:12FromDiscord<haxscramper> oh, there is now
12:20:12FromDiscord<Yardanico> https://nim-lang.github.io/Nim/setutils.html#%5B%5D%3D%2Cset%5BT%5D%2CT%2Cbool
12:20:28FromDiscord<Yardanico> In reply to @gingerBill "For bitsets in Nim,": hi, are you improving a wasm4 nim version or something? :P
12:20:31FromDiscord<gingerBill> Okay, so bit sets allow for indexing with that overload.
12:20:35FromDiscord<gingerBill> In reply to @Yardanico "hi, are you improving": No.
12:20:35*Vladar quit (Quit: Leaving)
12:20:51FromDiscord<Yardanico> just generally interested in Nim? it's nice to see creators of other languages here though :)
12:21:17FromDiscord<gingerBill> I used to be on this Discord and for some reason I wasn't any more. I also make sure to research as many languages as I can.
12:21:22FromDiscord<Yardanico> oh, okay
12:22:08FromDiscord<gingerBill> So does Nim not also overload `[]`?
12:22:31FromDiscord<Rika> You can make it overload that
12:22:37FromDiscord<gingerBill> So the answer is no
12:22:54FromDiscord<Rika> I mean if that’s what you interpret it as then sure
12:23:04FromDiscord<gingerBill> Seems really bizarre that std/setutils only overloads `[]=` and not `[]`
12:23:15FromDiscord<Rika> Huh
12:23:24FromDiscord<Rika> I’ll look wait
12:23:35FromDiscord<Rika> Huh
12:23:44FromDiscord<Yardanico> In reply to @gingerBill "Seems really bizarre that": yeah it's a bit weird
12:23:47FromDiscord<Rika> It’s a pretty new module so
12:23:48FromDiscord<Rika> I don’t know
12:23:54FromDiscord<Yardanico> yeah, it's fair to make a feature request
12:25:30FromDiscord<Yardanico> In reply to @gingerBill "Seems really bizarre that": ahh right i understand what you're asking for
12:25:41FromDiscord<Yardanico> nim has a `contains` defined for sets
12:25:43FromDiscord<Yardanico> so you can do
12:25:51FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Flo
12:25:57FromDiscord<gingerBill> The other reason I find it a little weird is that it seems to be treating a set as if its an array of packed booleans _semantically_ whilst its normal behaviour is to use `x in y` rather than `y[x]`
12:26:42FromDiscord<Rika> So what should it be instead of []=?
12:26:44FromDiscord<Yardanico> In reply to @gingerBill "The other reason I": well I can't think of a simpler syntax for conditional inclusion
12:26:47FromDiscord<gingerBill> (edit) "rather than" => "and now the new "
12:26:52FromDiscord<Rika> .toggle()?
12:27:00FromDiscord<Rika> Or I don’t know I’m just asking
12:27:02FromDiscord<gingerBill> There is a reason I'm asking this question πŸ˜›
12:27:36FromDiscord<gingerBill> Because in the past, if you wanted to do this in Pascal variants, you had to make wrapper procedures for each of them
12:27:39FromDiscord<Rika> Well I feel like []= was just chosen because of lack of better syntax
12:27:45FromDiscord<Yardanico> In reply to @gingerBill "Because in the past,": interesting
12:27:55FromDiscord<Yardanico> Nim is pascal-influenced quite a lot, but it's better to treat it as a separate language
12:27:59FromDiscord<gingerBill> And it was a procedure call rather than an operator
12:28:10FromDiscord<gingerBill> In reply to @Yardanico "Nim is pascal-influenced quite": I understand that very well
12:28:25FromDiscord<Yardanico> default set operations are described here https://nim-lang.org/docs/manual.html#types-set-type
12:28:31FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/910869072231686184/unknown.png
12:28:51FromDiscord<gingerBill> I should be clear, I'm looking to see if Nim has solved this problem before and how because both Nim and Odin have bit set types which we both nicked from Pascal.
12:29:22FromDiscord<gingerBill> And it looks like Nim's current approach is just hacking it in, for the lack of a better word.
12:31:42FromDiscord<Rika> Hacking how
12:31:47FromDiscord<Rika> What’s the hack in this case
12:32:07FromDiscord<gingerBill> Only overloading `[]=` is a hack/bodge
12:32:30FromDiscord<Yardanico> In reply to @Rika "Hacking how": How []= for toggling a set is overloaded but to check the presence of an element in a set you use `contains`
12:32:39FromDiscord<Rika> I see
12:32:44FromDiscord<Rika> It’s half assed I guess yeah
12:32:47FromDiscord<Yardanico> well, i don't know if adding `[]` which aliases to `contains` to setutils would be a good idea or not
12:33:20FromDiscord<Rika> My messages are sending late because I live in the middle of fucking nowhere so just a disclaimer
12:33:51FromDiscord<Rika> In reply to @Yardanico "well, i don't know": The better idea IMO is to rename []= I guess
12:33:59FromDiscord<gingerBill> Well this is a design problem. I'm not a huge fan of the idea of allowing `[]` on bit sets because they are not arrays. If it was than `[]=` is a logical conclusion of that logic. But it is the `[]` that is question.
12:34:33FromDiscord<gingerBill> So it does look like the solution to the problem is to just make a helper procedure to do the same thing similar to `incl` and `excl`
12:34:39FromDiscord<Yardanico> In reply to @Rika "The better idea IMO": the PR was in https://github.com/nim-lang/Nim/pull/17272
12:34:56FromDiscord<Rika> In reply to @gingerBill "So it does look": Wonder what it should be named though
12:35:14FromDiscord<Yardanico> apparently it was []= because D, swift and C++ have the same way
12:35:25FromDiscord<Yardanico> but yes there were arguments against that syntax
12:35:33FromDiscord<Rika> Mask?
12:35:33FromDiscord<Rika> Actually doesn’t sound too bad, I believe that bitops module uses the same name
12:35:33FromDiscord<gingerBill> `std::bitset` in C++ allows `[]` access and thus makes sense
12:35:48FromDiscord<Rika> Again my messages are sending way late
12:35:50FromDiscord<Rika> Goodness
12:35:51FromDiscord<gingerBill> It's more of a "put bit" like operation but that is a poor name
12:35:54FromDiscord<Yardanico> In reply to @gingerBill "`std::bitset` in C++ allows": yeah, you're right, it's weird that []= was added but not [] :)
12:39:45FromDiscord<eyecon> I think I'm having a brain/reading comprehension fart: how do I specify that a .nim file is always to be compiled with `-d:ssl`? There was a pragma for that, I thought, but I can't find it atm
12:41:08FromDiscord<Yardanico> In reply to @eyecon "I think I'm having": just add -d:ssl to yourfile.nim.cfg
12:41:10FromDiscord<Rika> No pragma here, please use the Nim config file
12:41:17FromDiscord<Yardanico> or switch("define", "ssl") if you prefer to use .nims
12:41:39FromDiscord<Rika> In reply to @Yardanico "just add -d:ssl to": Needs to be --define:ssl I believe
12:41:43FromDiscord<Rika> Unless that has changed
12:41:47FromDiscord<eyecon> Ah, thanks
12:42:00FromDiscord<Yardanico> @gingerBill feel free to comment on https://github.com/nim-lang/Nim/issues/19163, i just quickly made it
12:42:05FromDiscord<eyecon> In reply to @Rika "Needs to be --define:ssl": `-d:ssl` seems to work for me
12:42:12FromDiscord<Yardanico> In reply to @Rika "Needs to be --define:ssl": no
12:42:22FromDiscord<Yardanico> .cfg files have the same argument format as the nim compiler
12:42:29FromDiscord<Yardanico> so both -d and --define work
12:42:38FromDiscord<Rika> Huh okay
12:44:12arkanoidis there a table that keeps columns of different types? I need to operate on data like pandas. I could surely add a layer over arraymancer dataframes, but seems an overkill
12:45:02FromDiscord<Yardanico> @arkanoid I think it'd be better if you ask in #nim-science as well
12:45:10FromDiscord<Yardanico> that channel is focused on stuff like this
12:46:08arkanoidtoo many people there! :P
12:46:19FromDiscord<Yardanico> πŸ€”
12:55:07FromDiscord<vindaar> Just because there isn't a lot of active discussion going on there lately, doesn't mean we aren't there to answer questions πŸ˜‰β†΅(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
13:06:13FromDiscord<Fish-Face> I am going to give a short (15m) talk to some co-workers about Nim, just to introduce it. The main point will be "it has nice syntax but it's faster than python". Anyone got some ideas of good - and simple - things to cover or use as examples will making that point? I was wondering about a simple example that makes use of macros.
13:07:41FromDiscord<Rika> Personally would recommend not going too hard on macros, people tend to dislike it even if irrationally
13:08:17FromDiscord<Fish-Face> hmm interesting
13:09:55FromDiscord<xflywind> https://github.com/nim-lang/website/blob/master/jekyll/_posts/2021-10-19-version-160-released.md#why-use-nim
13:27:56FromDiscord<Yardanico> In reply to @Fish-Face "I am going to": See https://forum.nim-lang.org/t/8503 for example too
13:28:28FromDiscord<Yardanico> Also don't forget to mention https://github.com/yglukhov/nimpy as a point about smaller ecosystem
13:28:37FromDiscord<Yardanico> Tell them that they can reuse Python modules :)
13:28:56FromDiscord<Yardanico> But of course no performance benefit if heavy calculations are done in this module
13:29:06FromDiscord<Yardanico> (edit) "this module" => "Python modules"
13:30:12arkanoidI think I've just found a single project where I will use all nim backends at the same time
13:30:19FromDiscord<Yardanico> All?
13:30:34FromDiscord<Yardanico> C, C++, Objective C, JS?
13:30:48arkanoiddamn, I forgot about ObjectiveC
13:30:51arkanoidso not all
13:30:54*neurocyte0132889 joined #nim
13:30:54*neurocyte0132889 quit (Changing host)
13:30:54*neurocyte0132889 joined #nim
13:30:56FromDiscord<Yardanico> :)
13:31:01arkanoid:)
13:32:09FromDiscord<Rika> Objective C is the most neglected backend (though it’s not the least polished) ngl
13:39:12arkanoidI've was an ObjectiveC programmer during the iPhone 1,2 era
13:39:39arkanoidlanguage was ok, but xcode and apple docs were incredible
13:39:42FromDiscord<Rika> Wow that’s a while back
13:39:55FromDiscord<Rika> Apple docs are no longer incredible xd
13:40:14arkanoidwell yeah everything was simple there
13:40:26arkanoidnow it's same hell as android, but I thing android aged better
13:40:30arkanoid*think
13:40:47FromDiscord<Rika> Yeah afaik Apple really neglected documentation
13:41:40arkanoidI've stopped using Apple stuff when I realized it shifted from professional tools for developers to stuff for hipsters
13:43:08*Colt quit (Quit: Leaving)
13:44:14arkanoidI have to setup the environment for a frontend/backend app made in nim. I'm not sure what's the best way to split the two. Two independent nimble projects, or a larger one with custom nimble tasks? I prefer the second one, as here what shines is the shared logic, but I'm not sure
13:44:49FromDiscord<Rika> Ah this problem again haha
13:44:55FromDiscord<Rika> I remember someone asking this before
13:45:32FromDiscord<Rika> I believe if you’re gonna publish this later you should do two packages
13:45:40FromDiscord<Rika> If not then I guess whichever you think is best
13:52:24*advesperacit quit (Ping timeout: 268 seconds)
13:52:32*advesperacit_ joined #nim
13:56:41*arkurious joined #nim
14:22:11FromDiscord<hmmm> rika it's time for you to get to Tokyo. Incredibly speedy internet there I hear πŸ‘˜
14:24:28FromDiscord<tandy> is the objective c backend even documented?↡(@Yardanico)
14:45:42FromDiscord<Rika> In reply to @hmmm "rika it's time for": Haha I can’t
14:45:50FromDiscord<Rika> Expensive to live there
14:46:17FromDiscord<Rika> I’d prolly have rent that’s 4x my current rent if I did
15:12:04*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
15:13:45arkanoidand now let's see if antivirus will trigger rust toolchain too https://kerkour.com/rust-crate-backdoor/
15:14:12arkanoidI guess not, thanks to https://www.rust-lang.org/sponsors
15:15:15*neurocyte0132889 joined #nim
15:15:15*neurocyte0132889 quit (Changing host)
15:15:15*neurocyte0132889 joined #nim
15:17:56*lumo_e joined #nim
15:42:34*vicecea quit (Remote host closed the connection)
15:43:05*vicecea joined #nim
15:53:15PMuncharkanoid, I guess a three way split might be a good solution
15:53:36arkanoidyes
15:53:38PMunchCommon logic in one module, server logic in another, and client logic in a third
16:04:09*pch quit (Read error: Connection reset by peer)
16:04:15*pch joined #nim
16:09:19FromDiscord<retkid> what does <type>
16:09:20FromDiscord<retkid> (edit) "what does <type> ... " added "mean"
16:16:48PMunchWhat a type means?
16:20:58FromDiscord<retkid> <> signifies the type is immutable
16:24:08*nixfreaknim[m] quit (K-Lined)
16:24:15*happycorsair[m] quit (K-Lined)
16:26:04NimEventerNew post on r/nim by GeroSchorsch: How to enforce functional programming in nim?, see https://reddit.com/r/nim/comments/qwtff3/how_to_enforce_functional_programming_in_nim/
16:35:29*ormiret quit (Ping timeout: 264 seconds)
16:36:41*euantorano quit (Ping timeout: 264 seconds)
16:36:42*happycorsair[m] joined #nim
16:37:44*cornfeedhobo quit (Ping timeout: 246 seconds)
16:38:35*krux02 joined #nim
16:39:33*robertmeta quit (Ping timeout: 250 seconds)
16:40:02*LyndsySimon quit (Read error: Connection reset by peer)
16:41:34*ormiret joined #nim
16:41:56*krux02 quit (Remote host closed the connection)
16:42:30*krux02 joined #nim
16:42:51*LyndsySimon joined #nim
16:43:19*robertmeta joined #nim
16:51:01*euantorano joined #nim
16:55:42*cornfeedhobo joined #nim
17:01:26*nixfreaknim[m] joined #nim
17:01:33*nixfreaknim[m] quit (Quit: Client limit exceeded: 20000)
17:05:37NimEventerNew thread by Serge: Nim stopped working on my Mac M1 : string.h missing (problem with homebrew or Xtools)?, see https://forum.nim-lang.org/t/8638
17:06:17*nixfreaknim[m] joined #nim
17:12:19FromDiscord<π™§π™šπ™’> could anyone help me w/ an issue im having while trying to write a x11 wm
17:12:56FromDiscord<π™§π™šπ™’> sent a code paste, see https://play.nim-lang.org/#ix=3FmL
17:13:00*lumo_e quit (Ping timeout: 265 seconds)
17:13:12FromDiscord<π™§π™šπ™’> sent a code paste, see https://play.nim-lang.org/#ix=3FmM
17:13:19FromDiscord<π™§π™šπ™’> saying im getting a type mismatch?
17:14:59FromDiscord<π™§π™šπ™’> https://pastebin.com/zbNbqBgC↡this is my nim code i put it here bc it was kinda spammy
17:15:46FromDiscord<π™§π™šπ™’> i just wanna check if the table contains a `KeyMapping` object
17:29:16FromDiscord<π™§π™šπ™’> can anyone help me w/ why this isnt working?
17:34:31FromDiscord<konsumlamm> In reply to @π™§π™šπ™’ "https://pastebin.com/zbNbqBgC this is my": that doesn't seem to be your `whim.nim`, there is no `in` in line 60
17:35:12FromDiscord<noow> it's on line 55
17:35:12FromDiscord<π™§π™šπ™’> that is it
17:35:19FromDiscord<π™§π™šπ™’> sent a code paste, see https://play.nim-lang.org/#ix=3FmT
17:35:27FromDiscord<π™§π™šπ™’> so it works if i make the key of the map a tuple, but not an object
17:35:41FromDiscord<π™§π™šπ™’> any idea how to fix that
17:35:56PMunchUse `hasKey` from the tables module?
17:36:08PMunchNot sure if `in` is supported on a Table
17:36:27PMunchAah, apparently it's supposed to
17:36:28PMunchHmm
17:36:33FromDiscord<noow> In reply to @PMunch "Not sure if `in`": doesn't the compiler resolve it to HasKey correctly, according to the error log
17:36:35FromDiscord<π™§π™šπ™’> In reply to @PMunch "Use `hasKey` from the": tried that
17:36:37FromDiscord<π™§π™šπ™’> it doesnt work
17:36:41FromDiscord<π™§π™šπ™’> same error
17:37:07FromDiscord<π™§π™šπ™’> yet as soon as i change it from key of KeyMapping to key of (char, cuint)
17:37:09FromDiscord<π™§π™šπ™’> it works?
17:37:10FromDiscord<noow> by the way, your KeyMapping is a ref object, and you're calling an initializer every time you get a key object, I doubt you will ever do a correct lookup if my understanding of nim semantics is correct
17:37:32FromDiscord<noow> I would not use "ref" for KeyMapping
17:37:39PMunchDitto
17:37:48PMunchI would use a normal object for KeyMapping
17:38:06FromDiscord<π™§π™šπ™’> hm ok
17:38:19PMunchI think the problem is that you don't have a `hash` proc for `KeyMapping`, Nim seems to try and create one for you but fails
17:38:26PMunchA normal object should work
17:38:44FromDiscord<noow> since calling the initializer on a ref object will create a new instance, and when you create a table with ref object as the key, you will be actually indexing by the specific instance, not the contents
17:39:00FromDiscord<noow> since it will use its pointer as a key by default
17:39:01PMunchCool that more people are doing Window managers in Nim :)
17:39:12FromDiscord<noow> (edit) "since it will use its pointer as a key by default ... " added "(unless im wrong)"
17:39:37FromDiscord<noow> In reply to @PMunch "I think the problem": oh wait maybe that's what is causing the compiler error
17:39:45FromDiscord<noow> if yes ignore my last sentence
17:39:50FromDiscord<π™§π™šπ™’> i removed the ref and i think it works but lemem try and compile
17:39:57FromDiscord<π™§π™šπ™’> yeah that fixed it
17:40:12FromDiscord<π™§π™šπ™’> any reason why>?
17:40:13FromDiscord<noow> oh then PMunch is right and ignore me
17:42:29PMunch@noow, that is what's causing the error. But I think the reason why Nim won't create a hash proc for you is because of the ref/instance issue you mentioned
17:42:30FromDiscord<π™§π™šπ™’> nim reminds me of ada or haskell tbh
17:42:45PMunchThis is a minimal example with the full error message by the way: http://ix.io/3FmU
17:43:02PMunchA bit more obvious that you need a `hash` procedure
17:43:18FromDiscord<π™§π™šπ™’> ah
17:43:25FromDiscord<π™§π™šπ™’> and i assume bc its a reference type it panics?
17:43:28FromDiscord<noow> so, defining the hash procedure makes the error disappear?
17:44:06PMunchYup
17:44:24PMunchYes it's because it's a reference type
17:44:44FromDiscord<noow> In reply to @π™§π™šπ™’ "and i assume bc": yes, it's ambiguous whether you want to index by the contents or the specific instance of the object
17:44:52PMunchThe thing is that when you have a reference type, its ambiguous if the key is the data in the object, or the reference itself
17:44:59PMunchHaha, exactly
17:45:19FromDiscord<noow> i think most languages would just assume you want to reference by the pointer value of the reference
17:45:32FromDiscord<noow> unless the hash is defined
17:47:05PMunchIt's easy enough to write a hash procedure which does that
17:49:08PMunchYou also need to supply a `==` procedure though
17:49:15PMunchBecause of how tables work
17:51:55PMunchIf you run this example and look at the output it might be a bit more clear what's going on: https://play.nim-lang.org/#ix=3FmV
17:52:53PMunchThere you can see that I still use a ref object as a key, but I implement `hash` and `==` to work on the underlying objects
17:53:20PMunchAnd running them you can see when they are called
17:53:49PMunchA Table in Nim is what's called a hash table
17:54:18PMunchIt is essentially backed by a seq[seq[tuple(key, value)]]
17:54:59PMunchOh wait, it's actually just a seq[tuple(key, value)]
17:55:20FromDiscord<noow> by the way what's the fastest way of initializing objects that are ref, but the type is not ref
17:55:35PMunchWhat do you mean?
17:56:36FromDiscord<noow> sent a code paste, see https://play.nim-lang.org/#ix=3FmX
17:56:42PMunchAnyways, imagine the underlying sequence is 10 elements long. We insert one element by hashing the key (turning it into a number by some clever algorithm) and then putting it in position `hash(key) mod 10` in our sequence
17:56:43FromDiscord<noow> (yes this also needs a hash function defined btw)
17:57:34PMunchBut since this will cause collisions if two hashes mod 10 yields the same number it needs to actually store and compare the keys as well.
17:58:01PMunchWell, technically it only needs to compare the hashes to be reasonably sure
17:58:26FromDiscord<noow> i wonder how often do hash collisions occur and break critical systems
17:58:45PMunchHmm, I'd say it's pretty rare
18:00:00FromDiscord<noow> is it too expensive to also compare the values
18:00:22PMunchI think you can do: var a = new(MyObject)
18:00:30PMunchWell, depends on your key
18:00:38PMunchNim seems to compare the actual keys
18:00:55FromDiscord<noow> oh wait i meant the keys
18:01:00FromDiscord<noow> compare the actual keys
18:01:24PMunchYeah, that's what I read it as :P
18:01:33PMunchObviously you wouldn't know the value already
18:02:15FromDiscord<noow> about the shorthand, so no short hand for the whole thing, including the code and modifiers? 😦
18:02:41FromDiscord<noow> i guess i can always define a template
18:03:18PMunchYeah..
18:03:37PMunchOr just define a type `MyObjectRef = ref MyObject`
18:04:32PMunchLike so: https://play.nim-lang.org/#ix=3Fn4
18:07:25FromDiscord<haxscramper> TIL i learned we have a proper logs of all nim rooms after bridging to matrix https://view.matrix.org/?query=%23nim
18:16:13*elph joined #nim
18:18:29*lumo_e joined #nim
18:29:00*vicecea quit (Remote host closed the connection)
18:29:35*vicecea joined #nim
18:53:44*terminalpusher joined #nim
19:00:11*lumo_e quit (Remote host closed the connection)
19:00:24NimEventerNew thread by Serge: What is the directory assumed for C include files and C libraries location for Him?, see https://forum.nim-lang.org/t/8639
19:02:30FromDiscord<dom96> In reply to @haxscramper "TIL i learned we": cool, too bad there is no trivial way to go back to a certain date
19:08:06*xet7 joined #nim
20:08:51*src joined #nim
20:21:05FromDiscord<hmmm> what's our brypt like reference lib?
20:21:13FromDiscord<hmmm> bcrypt
20:21:54FromDiscord<hmmm> I found easybcrypt from a dude with a spiffy anime avatar so I'm strongly considering it πŸ€”
20:23:15FromDiscord<hmmm> it is known that people that favor anime avatars are supreme coders πŸ‘‘
20:32:16*terminalpusher quit (Remote host closed the connection)
20:32:38*terminalpusher joined #nim
20:48:22*terminalpusher quit (Remote host closed the connection)
20:49:23FromDiscord<NullCode1337> yes
20:49:35FromDiscord<NullCode1337> except i don't have an anime avatar
20:49:39FromDiscord<NullCode1337> so I'm not supreme :(
21:00:38FromDiscord<hmmm> reporting back from the trenches: 1) "easybcrypt" doesn't run the first line given in the tutorial, it was made 8 years ago and the spiffy anime author doesn't list it anymore on his github b) "bcrypt" crash and burns at the tutorial stage too. 8year old too. c) nimcrypt, fresh as a flower, 20 day old lib, works as advertised no fuss
21:01:21FromDiscord<hmmm> we should clean some result from nimble.directory, or just order them by date
21:02:22*vicfred joined #nim
21:05:30PMunch@hmmm, aaw I'm not a supreme coder :(
21:19:11FromDiscord<NullCode1337> In reply to @hmmm "we should clean some": order from date good ide
21:19:13FromDiscord<NullCode1337> (edit) "ide" => "ideq"
21:19:17FromDiscord<NullCode1337> (edit) "ideq" => "idea"
21:19:27FromDiscord<NullCode1337> In reply to @PMunch "<@887269570765791243>, aaw I'm not": ikr :(
21:19:44FromDiscord<ynfle (ynfle)> Date of what?
21:20:12FromDiscord<NullCode1337> when the nimble package was last updated
21:20:30FromDiscord<NullCode1337> https://github.com/nim-lang/nimble/issues/944
21:20:38FromDiscord<NullCode1337> nobody cared about this issue
21:20:39FromDiscord<NullCode1337> bruh
21:20:56NimEventerNew thread by Matkuki: Pygments Nim lexer update?, see https://forum.nim-lang.org/t/8640
21:28:23*src_ joined #nim
21:31:18*src_ quit (Client Quit)
21:31:31*src_ joined #nim
21:31:48*src quit (Ping timeout: 256 seconds)
21:54:45FromDiscord<hmmm> Error: unhandled exception: Unsupported algorithm [Defect]
21:54:48FromDiscord<hmmm> hmm?
21:54:54FromDiscord<hmmm> what is this πŸ€”
21:55:23PMunchYou're trying to do something unsupported
21:55:39FromDiscord<hmmm> hmmmmmmmmm
21:56:02FromDiscord<Elegantbeef> I've never seen a plain defect raised before πŸ˜€
21:59:15PMunchLazy person not creating a custom exception :P
21:59:21PMunchWell, maybe they didn't need one
22:01:57FromDiscord<hmmm> found the Defect
22:02:14FromDiscord<hmmm> why these kind of errors aren't even remotely close to the issue at hand?
22:03:37FromDiscord<hmmm> if I had SpaceX money I would fund someone to fix type errors too. Like a) do not spam me 200 lines of garbage and b) tell me exactly what is happening
22:03:49FromDiscord<Elegantbeef> Well that's what i try to fix
22:03:53FromDiscord<hmmm> DUDE
22:03:58FromDiscord<hmmm> :nim1:
22:04:02FromDiscord<hmmm> good luck my man
22:04:15FromDiscord<Elegantbeef> But what's the issue here?
22:04:32FromDiscord<hmmm> the issue was the author forgot to add a $ in his tutorial examples lol
22:07:02*src_ quit (Quit: Leaving)
22:11:20FromDiscord<machineko> Hey guys can someone share working debbuger config files for vscode (preferable using CodeLLDB)?
22:15:40FromDiscord<Elegantbeef> https://github.com/saem/vscode-nim#debugging
22:21:23*src joined #nim
22:33:38*advesperacit_ quit (Quit: advesperacit_)
22:33:43*PMunch quit (Quit: leaving)
22:52:50FromDiscord<wizardlink> Good evening! What constant should I be looking for to check on compile time whether it's a debug or release build?
22:53:27FromDiscord<wizardlink> Looked around in the docs but couldn't easily find it, nor found it here so I'm starting to doubt there is.
22:53:28FromDiscord<wizardlink> :NPCSteampunkerSweat:
22:53:30FromDiscord<Elegantbeef> `when defined(debug)` or `when defined(release)`
22:53:47FromDiscord<wizardlink> I see, is that documented by the way?
22:53:51FromDiscord<wizardlink> So I know where to look for next time.
22:53:53FromDiscord<Elegantbeef> you can also just do `const isRelease = defined(release)` then do `when isRelease`
22:54:40FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html#compiler-usage-compileminustime-symbols
22:55:31FromDiscord<wizardlink> ~~Alright, the `-d` flag makes more sense now.~~
22:55:39FromDiscord<wizardlink> Quite new to the language, so this was confusing.
22:55:46FromDiscord<wizardlink> Thank you for the help! Cheers.
22:55:54FromDiscord<wizardlink> <a:a_karenWave:550042627878289423>
22:56:06FromDiscord<Elegantbeef> No problem
23:04:10*stkrdknmibalz quit (Ping timeout: 256 seconds)
23:37:42FromDiscord<sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=3FoV
23:37:55FromDiscord<sharpcdf> also just tried discarding it instead of sending it to a var
23:39:24FromDiscord<sharpcdf> (edit) "https://play.nim-lang.org/#ix=3FoV" => "https://play.nim-lang.org/#ix=3FoW"
23:39:30FromDiscord<sealmove> I think you need to configure buffering or something
23:40:15FromDiscord<sharpcdf> In reply to @รєคɭ๓๏שє "I think you need": how would i do that
23:40:53FromDiscord<sharpcdf> wait nevermind, it was just an error lol
23:40:59FromDiscord<sharpcdf> forgot to compile with ssl
23:41:18*qwr joined #nim
23:41:49FromDiscord<sealmove> setStdIoUnbuffered()
23:41:53NimEventerNew thread by Icedquinn: TLS protocol negociation (TLS-ALPN), see https://forum.nim-lang.org/t/8641
23:42:56FromDiscord<sealmove> Is there a hack for having a variable that can hold any type at runtime?
23:46:01FromDiscord<Elegantbeef> You can look at union for a subset, but nim is not dynamically typed so `pointer` is probably the only way
23:54:52FromDiscord<sharpcdf> how can i find html through its id? (like `findAll` but id instead of element)
23:55:46FromDiscord<Elegantbeef> Iterate over all nodes checking if `yourNode.attr("id") != ""`
23:56:08FromDiscord<sharpcdf> alright, thanks
23:56:20FromDiscord<Elegantbeef> I think there is a better query library