<< 07-02-2021 >>

00:03:02*wasted_youth quit (Ping timeout: 264 seconds)
00:03:50*wasted_youth2 joined #nim
00:13:05FromDiscord<no name fits> Can I just convert a TaintedString or am I supposed to do validation? I'm still new, so not sure
00:16:08saemunless you pass in a flag to the compiler TaintedString is just an alias for string
00:16:27FromDiscord<no name fits> Alright, thanks. I understood as much from the documentation 🙂
00:31:25audiophilehmm thanks guyus, that was also an interesting discussion on where this sort of code would go if it were to be included with nim
00:41:35*krux02 quit (Remote host closed the connection)
00:47:14*Productive2 quit (Ping timeout: 265 seconds)
00:58:00FromDiscord<flywind> https://github.com/nim-lang/Nim/pull/15423/files
01:01:18saemYeah, that one. 😄
01:02:20FromDiscord<konsumlamm> TaintedString has been deprecated (https://github.com/nim-lang/RFCs/issues/24)
01:11:43*actuallybatman joined #nim
01:15:52FromDiscord<no name fits> Oh thanks
01:17:06FromDiscord<no name fits> sent a code paste, see https://paste.rs/3Pt
01:18:43FromDiscord<no name fits> I basically just need a zero pointer
01:18:59FromDiscord<ElegantBeef> `cast[pointer](0)` might work
01:19:13FromDiscord<ElegantBeef> Idk i dont do translation of C 😄
01:19:57FromDiscord<ElegantBeef> The above will work if the result of `(void) 0` is a pointer with all bits off
01:20:04FromDiscord<no name fits> Right
01:20:28FromDiscord<no name fits> yeah I'm trying to translate some C books to Nim, so I can get some people I know to start using Nim
01:20:43FromDiscord<no name fits> Everyone I know is using C#, Java or C++ for graphics
01:21:17FromDiscord<ElegantBeef> Ah, i came from C#, and it was rather easy, although i dont tend to do low level stuff, so that helps 😄
01:23:09FromDiscord<no name fits> yeah I've done C# and C++. It's just hard to get people I know to try new langs
01:24:46FromDiscord<no name fits> Well, seems it builds. I'll be back if it didn't work afterall. Thanks a bunch
01:38:38*zedeus joined #nim
01:53:31*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:53:53*njoseph joined #nim
01:56:04*Gustavo6046 is now known as TotallyNotGus
01:56:39*TotallyNotGus is now known as Gustavo6046
02:22:08*NimBot joined #nim
02:24:24*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
02:30:48*Gustavo6046 joined #nim
02:31:40*GreaseMonkey joined #nim
02:49:18*robertmeta joined #nim
04:07:43*Tanger quit (Remote host closed the connection)
04:14:16FromDiscord<mrgaturus> nil also works
04:23:31FromDiscord<mrgaturus> but yes, i used that you said, is about an offset but is a pointer type due to compatibility with -crappy- older GL versions. Please avoid tutorials that use immediate mode functions https://media.discordapp.net/attachments/371759389889003532/807828865808072704/unknown.png
04:50:01*spiderstew_ joined #nim
04:50:57*spiderstew quit (Ping timeout: 264 seconds)
05:04:51*letto quit (Quit: Konversation terminated!)
05:37:15*audiophile quit (Quit: Default Quit Message)
06:06:42FromDiscord<Stuffe> Is it possible to have 2 object types which both have the other object type on one of their fields?
06:07:17FromDiscord<Stuffe> So "type a" has a field of "type b" and vice versa
06:08:30FromDiscord<ElegantBeef> Yes
06:10:44FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2OB2 seems you need to use ref objects though
06:10:50FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual.html#pragmas-acyclic-pragma
06:10:54FromDiscord<ElegantBeef> Shows another method
06:11:55FromDiscord<Stuffe> Ah ok thank you
06:13:00FromDiscord<Stuffe> didn't think of declaring both under the same "type block"
06:13:13FromDiscord<Stuffe> Looks like you can just make one of the fields ref also: https://play.nim-lang.org/#ix=2OB4
06:13:19FromDiscord<Stuffe> which is what I need 🙂
06:18:32FromDiscord<ElegantBeef> Yea type blocks are good for that
06:19:44FromDiscord<ElegantBeef> Afaik order in a block doesnt matter so as long as all your types are defined in it it'll work
08:10:18*waleee-cl quit (Quit: Connection closed for inactivity)
08:11:03*sixtyten joined #nim
08:47:51*PMunch joined #nim
08:50:55*haxscramper joined #nim
09:00:05*Kurre[m] quit (Quit: Idle for 30+ days)
09:25:33*krux02 joined #nim
09:41:43*superbia joined #nim
09:46:35*Productive2 joined #nim
09:56:10*Productive2 quit (Quit: Leaving)
10:14:57*vicfred quit (Quit: Leaving)
10:17:40*tane joined #nim
10:24:51*superbia quit (Quit: WeeChat 3.0)
10:58:27FromDiscord<Stuffe> If I change the length of a sequence by using "setLen", it doesn't change the capacity, right?
10:59:33FromDiscord<Stuffe> I have a loop where a fix amount of items are always added to a sequence. I wonder if I can truncate the sequence with setLen and use .add to fill it up without allocating new memory
11:02:27*xet7 joined #nim
11:07:01FromDiscord<haxscramper> Yes, it shouldn't change capacity
11:15:09FromDiscord<Stuffe> ok great
12:07:13FromDiscord<Slyris> Hello, is it possible to have default value for object in nim ?
12:07:37FromDiscord<Solitude> no, it isnt
12:07:38FromDiscord<Slyris> sent a code paste, see https://play.nim-lang.org/#ix=2OC5
12:11:15FromDiscord<haxscramper> Common way is to define constructor procs, like `initRedisCfg(): auto = RedisCfg(host: "localhost")`
12:23:26*liblq-dev joined #nim
12:23:35FromDiscord<Slyris> ok ty for the explanation
12:37:25*xet7 quit (Remote host closed the connection)
12:48:41*letto joined #nim
13:19:00FromDiscord<lzoz> Hello! Nim newbie here, I am quite proud of my very first library written in Nim https://github.com/lzoz/nauthy
13:23:51FromDiscord<Recruit_main707> it looks very nice, specially for a first project, 4 spaces though >.>
13:26:26FromDiscord<lzoz> thank u. what do you mean by 4 spaces?
13:27:56FromDiscord<lqdev> indent width
13:28:15FromDiscord<lzoz> ah, ok
13:39:25*abm joined #nim
14:09:50PMunch@lzoz, generally Nim uses 2 spaces for indents
14:10:19PMunchFriendly reminder that my FOSDEM Nim talk is coming up, please tune in to ask any questions you might have :)
14:10:27PMunchhttps://fosdem.org/2021/schedule/event/nimdsl/
14:10:37*fredrikhr joined #nim
14:11:37*vicfred joined #nim
14:13:23*xet7 joined #nim
14:14:41*xet7 quit (Remote host closed the connection)
14:18:54*drdee joined #nim
14:38:04ForumUpdaterBotNew post on r/nim by PMunch: Optimising for Humans - Nim presentation at FOSDEM '21, see https://fosdem.org/2021/schedule/event/nimdsl/
14:44:16*Vladar joined #nim
14:44:59*drdee quit (Quit: Leaving)
14:59:19FromDiscord<Casey.McMahon> sent a code paste, see https://paste.rs/rx5
15:02:23FromDiscord<Rika> resetGame needs to look like `proc resetGame(ev: Event)` at the start
15:02:27FromDiscord<Rika> and not empty ()
15:05:57FromDiscord<Rika> ah wait
15:06:26FromDiscord<Rika> not line 4
15:06:29FromDiscord<Rika> 48
15:06:31FromDiscord<Rika> the issue is in line 59
15:07:08FromDiscord<Casey.McMahon> Sorry, I realized that now. I was having problems with the first eventListner and didn't realize I had somehow cleared the error
15:30:05FromDiscord<Casey.McMahon> I am now stuck on line 64, the for loop. In the original JS, it is looping through a div with each <p> being an element (from what I gather). Not sure how I would do that in nim.
15:35:23FromDiscord<Rika> what's the issue on that line?
15:35:40FromDiscord<Rika> and do you mind showing the original js for that part?
15:37:22FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2ODE
15:37:50FromDiscord<Rika> ...i think
15:38:00FromDiscord<Rika> i dont know what the textContent part should be as i dont use the js backend
15:38:58FromDiscord<Casey.McMahon> that seems to work, thanks. I had just taken out the for loop and reset each 'element' individually. I have put it back in.
15:44:46FromDiscord<Casey.McMahon> It works! Thank you. https://media.discordapp.net/attachments/371759389889003532/808000306775982130/guessingGame.png
15:45:15FromDiscord<Rika> 👌
15:45:22FromDiscord<Rika> congrats
15:47:18FromDiscord<Casey.McMahon> That's really cool!
15:51:19*fredrikhr quit (Quit: Client Disconnecting)
15:56:45ForumUpdaterBotNew thread by Clavismax: Invalid Indentation (newbie), see https://forum.nim-lang.org/t/7483
15:59:42FromDiscord<Casey.McMahon> Well, it dosen't work perfectly... got some debugging to do.
16:12:41FromDiscord<Casey.McMahon> how does rand() work when compiling to JS? The numbers are random, but if I refresh the page, I will get the same sequence of random numbers. For example, game 1 the answer is 52. Start new game and the answer is 56, and so on. Refresh the page and the first game guess is 52 again...
16:13:26planetis[m]call randomize
16:13:28FromDiscord<Casey.McMahon> How can I get the intended randomness on each refresh?
16:13:39FromDiscord<Casey.McMahon> ah thanks, I'll try that
16:15:39FromDiscord<Casey.McMahon> ah, thanks!
16:24:54PMunchSix minutes to the Nim talk!
16:26:05planetis[m]awesome!
16:26:25planetis[m]is it live or recorded?
16:27:28PMunchVideo is recorded, but then there's a live Q&A afterwards
16:27:34planetis[m]did others do nim talks as well?
16:27:54*waleee-cl joined #nim
16:28:12PMunchNone that I know of
16:28:19planetis[m]great im watching
16:28:53PMunchYou can also join the chat on Matrix
16:29:52planetis[m]which one?
16:30:41planetis[m]fosdem i guess
16:31:16PMunchhttps://chat.fosdem.org/#/room/#declarative.minimalistic:fosdem.org
16:38:25federico3PMunch: nice slide layout
16:38:45PMunchThanks, I'm happy to share it. It's a LibreOffice Impress thing
16:38:56PMunchHmm, got the question "How hard is to port nim to a new target cpu?"
16:39:03PMunchAnyone got anything to contribute to that?
16:39:21federico3PMunch: plus more tooling and experimenting to overlay yourself on it and point at things with your fingers
16:39:47PMunchAh, yes that is OBS with a green-screen
16:55:29*a_chou joined #nim
16:59:53FromDiscord<Ardek> nice talk
17:00:38FromDiscord<Recruit_main707> any url to share the vod?
17:16:29PMunch@Ardek, thanks :)
17:16:50PMunch@Recruit_main707, FOSDEM will upload it. But in the meantime you can watch it at https://uploads.peterme.net/OptimisingForHumans.mp4
17:17:03PMunch(Please don't crash my server by sharing that link too much though :P)
17:20:39FromDiscord<Recruit_main707> 10-15 ppl at best
17:20:45FromDiscord<Recruit_main707> is that fine?
17:21:04*jjido quit (Quit: Connection closed for inactivity)
17:22:06PMunchYeah sure
17:22:25PMunchWorst case scenario I'll just delete the file
17:22:31PMunchAnd upload it to YouTube myself
17:26:41*natrys joined #nim
17:28:10FromDiscord<Stuffe> im watching the talk now, really good
17:29:00PMunchThanks :)
17:43:25FromDiscord<Rika> whats it about? other than "nim"
17:44:05FromDiscord<Recruit_main707> compile time 0 cost abstractions on microcontrollers
17:45:29PMunchWell look who's been paying attention! :P
17:49:29FromDiscord<haxscramper> How does compilation of the standalone nim file know where to look up for `import`? It just goes over default locations like `~/.nimble/pkgs` and adds everything?
17:50:11FromDiscord<Stuffe> I feel like human readability is so underrated in language design. I just rewrote 5k lines of very complex rust code that I was swearing and when I wrote into Nim because I couldn't understand it anymore
17:50:45FromDiscord<Stuffe> And not only am I not scared to change anything anymore, I now think its all beautiful. And I actually enjoyed writing it
17:51:21FromDiscord<Stuffe> and its now 3.5k lines
17:51:59FromDiscord<haxscramper> Good thing about nim is that there are some clearly opinionated design decisions, that if used correctly can really increase code clarity
17:52:03PMunchYeah, Nim is really good at making code readable
17:52:06PMunchIf you do it right
17:52:14PMunchYou can make stuff way worse if you try :P
17:52:19FromDiscord<Solitude> i think thats related https://github.com/nim-lang/Nim/blob/57bd64582ceee697dc4f079baf6a4e6137ff45b4/compiler/nimblecmd.nim#L130
17:53:24*sixtyten quit (Ping timeout: 256 seconds)
17:53:55FromDiscord<Stuffe> I only wish more emphasis was put on error messages though, it's the only feedback you get from the compiler
17:54:43FromDiscord<Recruit_main707> yep, error messages could be better
17:55:05FromDiscord<Recruit_main707> specially a few of them that are not descriptive enough
17:55:52FromDiscord<haxscramper> 'type expected'
17:56:33FromDiscord<haxscramper> But RFCs 323-325 focus on that
17:57:25FromDiscord<haxscramper> But overall "immediate convenience" is very low indeed when it comes to tooling
17:57:49FromDiscord<Stuffe> it would be neat if an error instead of had a line and a char would have a range instead, and then color code it
17:58:45FromDiscord<Stuffe> anyway, im just complaining about something people built for free in their free time
18:02:23FromDiscord<haxscramper> Close but looks like that's not it. From what I can tell this is for `--nimblepath` handling, and you'd need to explicitly pass directory
18:02:56FromDiscord<haxscramper> I guess I can just manually iterate over `~/.nimble` and add everything
18:03:17FromDiscord<haxscramper> But this might mess up things with multiple library versions.
18:04:00FromDiscord<haxscramper> So I might need to figure out how standalone nim resolves ties in cases like this
18:04:50FromDiscord<Solitude> https://github.com/nim-lang/Nim/blob/57bd64582ceee697dc4f079baf6a4e6137ff45b4/compiler/nimblecmd.nim#L65
18:06:37FromDiscord<Solitude> the nimblepath defaults to ~/.nimble
18:06:43FromDiscord<shadow.> does `httpclient` store data like cookies in the way that something like python's `request.Session` does? or do i have to manage that manually
18:07:04ForumUpdaterBotNew thread by Benob: SSL: how to inspect and manually accept an unknown self-signed certificate?, see https://forum.nim-lang.org/t/7484
18:18:57*a_chou quit (Remote host closed the connection)
18:20:18FromDiscord<haxscramper> In the end ` nimblePath(config, ~".nimble/pkgs", TLineInfo())` was what I needed, thanks @Solitude
18:51:35*hmmm joined #nim
19:00:09Oddmongerisn't there a thing to do for importing some nim modules ?
19:00:24Oddmongerprefixing them with another module name ?
19:00:39Oddmongerfor example i try to import pathutils, but i get an error
19:00:56FromDiscord<Deorder> Can I use the Nim build system to compile and link C code?
19:01:33FromDiscord<Deorder> I want to write some parts of my code in C99 and another part in Nim
19:01:54FromDiscord<Rika> i think theres a compile pragma or something
19:02:06Oddmongerah ok pathutils is not a real module
19:02:10Oddmongerthat's why
19:02:11FromDiscord<Rika> stuff that might be useful is also the importc pragma
19:02:12FromDiscord<haxscramper> `{.compile: "your_c_file.c".}`
19:02:41FromDiscord<Deorder> Nice thanks. That will save me so much time
19:02:46FromDiscord<haxscramper> Oddmonger: there is a `compiler/pathutils.nim`
19:03:22FromDiscord<haxscramper> And probably a lot of other submodules in different libraries that are named `pathutils`, so most likely
19:03:26FromDiscord<haxscramper> You need to use library name
19:03:33FromDiscord<Deorder> And do you happen to know if it does incremental builds based on modification times of c/h vs o files?
19:04:05FromDiscord<haxscramper> Yes IIRC it computes hashes for your C files and does not recompile if file haven't changed
19:04:22Oddmongerhum… it seems include «by default», i had a mistake with the function name
19:04:41FromDiscord<Deorder> Ah thanks
19:04:41FromDiscord<haxscramper> @Deorder so based on c/h files
19:05:21FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compile-pragma
19:09:14FromDiscord<Meowx> Anyone a Idea how I could realise C# `FieldOffset` to add paddings to fields in a nim object?
19:09:15FromDiscord<Meowx> https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.fieldoffsetattribute?view=net-5.0
19:16:29FromDiscord<haxscramper> Maybe you could use `{.align.}` https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-align-pragma
19:17:11*hmmm quit (Quit: WeeChat 3.0)
19:18:08*PMunch quit (Remote host closed the connection)
19:21:33FromDiscord<Meowx> Not exactly what I'm looking for but I could look into its code yea
19:29:46*audiophile joined #nim
19:36:56FromDiscord<RealPatricia> Hello
19:42:17*hoijui joined #nim
19:49:16ForumUpdaterBotNew thread by Shucks: FieldOffset / Padding Pragma?, see https://forum.nim-lang.org/t/7485
19:54:24FromDiscord<zetashift> Hiyaa
20:24:45*audiophile quit (Ping timeout: 240 seconds)
20:45:07*liblq-dev quit (Ping timeout: 256 seconds)
21:29:14*hoijui quit (Quit: Leaving)
21:33:45*haxscramper quit (Remote host closed the connection)
21:50:17*lf_ joined #nim
21:58:03*lf_ quit (Quit: lf_)
22:20:09*demo-d joined #nim
22:21:47*demo-d quit (Client Quit)
22:22:46*natrys quit (Quit: natrys)
22:38:06*irchaxwell joined #nim
22:39:33FromDiscord<dom96> hello hello
22:50:47*irchaxwell quit (Quit: Leaving)
22:51:31*tane quit (Quit: Leaving)
23:12:57FromDiscord<gcao> sent a code paste, see https://play.nim-lang.org/#ix=2OGq
23:13:11FromDiscord<ElegantBeef> Does it error?
23:13:14FromDiscord<gcao> /Users/gcao/proj/gene-new/src/gene/interpreter.nim(94, 13) template/generic instantiation of `importFolder` from here↵/Users/gcao/.choosenim/toolchains/nim-1.4.0/lib/core/macros.nim(557, 18) Error: cannot open file: ./features/array
23:13:58FromDiscord<ElegantBeef> My recollection is that doing `parseStmt` doesnt end well for importing
23:14:21FromDiscord<ElegantBeef> https://github.com/GaryM-exkage/GDGW-Maverick-Bot/blob/master/src/nimcordbot/utils.nim#L3↵This might help you
23:15:25FromDiscord<gcao> thank you! I'll take a look at that. I wonder where "cannot open file" error comes from. Is it thrown by the generated import statement?
23:15:38FromDiscord<Recruit_main707> there was a template to know from where was your macro being called from
23:15:49FromDiscord<ElegantBeef> Doesnt work aswell as you imagine
23:15:58FromDiscord<Recruit_main707> it worked fine for me
23:16:07FromDiscord<ElegantBeef> https://nim-lang.org/docs/system.html#instantiationInfo
23:16:12FromDiscord<gcao> thanks. I'll check back later. dinner time.
23:16:27FromDiscord<ElegantBeef> I tried using it for a absolute import path relative to the root, and i couldnt get it to work
23:16:53FromDiscord<ElegantBeef> https://github.com/beef331/import_utils/blob/main/src/import_utils.nim#L47
23:17:13FromDiscord<ElegantBeef> You cannot use it inside the macro, so you need a template to call the macro, but then the emission of the importstmt didnt work with parsestmt
23:17:20FromDiscord<ElegantBeef> even though the import path and everything is correct
23:17:25FromDiscord<Recruit_main707> i used it like this:↵https://github.com/RecruitMain707/NimFlatbuffers/blob/master/src/Nimflatbuffers.nim#L9 and it works fine↵(`generateCodeImpl` is in `Codegen`)
23:19:03FromDiscord<ElegantBeef> Weird that your code works but mine doesnt 😦
23:22:09*Vladar quit (Quit: Leaving)
23:24:19FromDiscord<ElegantBeef> Also you're using `\\` for paths in the import stmt?
23:27:15FromDiscord<Recruit_main707> I’m on Windows
23:27:31FromDiscord<Recruit_main707> Now would that break on Linux?
23:27:41FromDiscord<ElegantBeef> I figure the import path accepts either
23:27:49FromDiscord<ElegantBeef> I've never seen `\\` personally
23:29:09FromDiscord<Recruit_main707> afaik that will be the a single \, but now that I think about it I don’t know why I didn’t use /
23:29:31FromDiscord<Recruit_main707> a single \\
23:29:45FromDiscord<ElegantBeef> just tested and `std\strutils` is not importable 😄
23:30:54FromDiscord<Recruit_main707> It did work...
23:31:03FromDiscord<Recruit_main707> I’ll have to check it tomorrow
23:31:11FromDiscord<ElegantBeef> Might only work on windows oddly enough
23:38:17*muffindrake joined #nim
23:54:33*abm quit (Read error: Connection reset by peer)