00:03:02 | * | wasted_youth quit (Ping timeout: 264 seconds) |
00:03:50 | * | wasted_youth2 joined #nim |
00:13:05 | FromDiscord | <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:08 | saem | unless you pass in a flag to the compiler TaintedString is just an alias for string |
00:16:27 | FromDiscord | <no name fits> Alright, thanks. I understood as much from the documentation 🙂 |
00:31:25 | audiophile | hmm 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:00 | FromDiscord | <flywind> https://github.com/nim-lang/Nim/pull/15423/files |
01:01:18 | saem | Yeah, that one. 😄 |
01:02:20 | FromDiscord | <konsumlamm> TaintedString has been deprecated (https://github.com/nim-lang/RFCs/issues/24) |
01:11:43 | * | actuallybatman joined #nim |
01:15:52 | FromDiscord | <no name fits> Oh thanks |
01:17:06 | FromDiscord | <no name fits> sent a code paste, see https://paste.rs/3Pt |
01:18:43 | FromDiscord | <no name fits> I basically just need a zero pointer |
01:18:59 | FromDiscord | <ElegantBeef> `cast[pointer](0)` might work |
01:19:13 | FromDiscord | <ElegantBeef> Idk i dont do translation of C 😄 |
01:19:57 | FromDiscord | <ElegantBeef> The above will work if the result of `(void) 0` is a pointer with all bits off |
01:20:04 | FromDiscord | <no name fits> Right |
01:20:28 | FromDiscord | <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:43 | FromDiscord | <no name fits> Everyone I know is using C#, Java or C++ for graphics |
01:21:17 | FromDiscord | <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:09 | FromDiscord | <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:46 | FromDiscord | <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:16 | FromDiscord | <mrgaturus> nil also works |
04:23:31 | FromDiscord | <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:42 | FromDiscord | <Stuffe> Is it possible to have 2 object types which both have the other object type on one of their fields? |
06:07:17 | FromDiscord | <Stuffe> So "type a" has a field of "type b" and vice versa |
06:08:30 | FromDiscord | <ElegantBeef> Yes |
06:10:44 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2OB2 seems you need to use ref objects though |
06:10:50 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#pragmas-acyclic-pragma |
06:10:54 | FromDiscord | <ElegantBeef> Shows another method |
06:11:55 | FromDiscord | <Stuffe> Ah ok thank you |
06:13:00 | FromDiscord | <Stuffe> didn't think of declaring both under the same "type block" |
06:13:13 | FromDiscord | <Stuffe> Looks like you can just make one of the fields ref also: https://play.nim-lang.org/#ix=2OB4 |
06:13:19 | FromDiscord | <Stuffe> which is what I need 🙂 |
06:18:32 | FromDiscord | <ElegantBeef> Yea type blocks are good for that |
06:19:44 | FromDiscord | <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:27 | FromDiscord | <Stuffe> If I change the length of a sequence by using "setLen", it doesn't change the capacity, right? |
10:59:33 | FromDiscord | <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:01 | FromDiscord | <haxscramper> Yes, it shouldn't change capacity |
11:15:09 | FromDiscord | <Stuffe> ok great |
12:07:13 | FromDiscord | <Slyris> Hello, is it possible to have default value for object in nim ? |
12:07:37 | FromDiscord | <Solitude> no, it isnt |
12:07:38 | FromDiscord | <Slyris> sent a code paste, see https://play.nim-lang.org/#ix=2OC5 |
12:11:15 | FromDiscord | <haxscramper> Common way is to define constructor procs, like `initRedisCfg(): auto = RedisCfg(host: "localhost")` |
12:23:26 | * | liblq-dev joined #nim |
12:23:35 | FromDiscord | <Slyris> ok ty for the explanation |
12:37:25 | * | xet7 quit (Remote host closed the connection) |
12:48:41 | * | letto joined #nim |
13:19:00 | FromDiscord | <lzoz> Hello! Nim newbie here, I am quite proud of my very first library written in Nim https://github.com/lzoz/nauthy |
13:23:51 | FromDiscord | <Recruit_main707> it looks very nice, specially for a first project, 4 spaces though >.> |
13:26:26 | FromDiscord | <lzoz> thank u. what do you mean by 4 spaces? |
13:27:56 | FromDiscord | <lqdev> indent width |
13:28:15 | FromDiscord | <lzoz> ah, ok |
13:39:25 | * | abm joined #nim |
14:09:50 | PMunch | @lzoz, generally Nim uses 2 spaces for indents |
14:10:19 | PMunch | Friendly reminder that my FOSDEM Nim talk is coming up, please tune in to ask any questions you might have :) |
14:10:27 | PMunch | https://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:04 | ForumUpdaterBot | New 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:19 | FromDiscord | <Casey.McMahon> sent a code paste, see https://paste.rs/rx5 |
15:02:23 | FromDiscord | <Rika> resetGame needs to look like `proc resetGame(ev: Event)` at the start |
15:02:27 | FromDiscord | <Rika> and not empty () |
15:05:57 | FromDiscord | <Rika> ah wait |
15:06:26 | FromDiscord | <Rika> not line 4 |
15:06:29 | FromDiscord | <Rika> 48 |
15:06:31 | FromDiscord | <Rika> the issue is in line 59 |
15:07:08 | FromDiscord | <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:05 | FromDiscord | <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:23 | FromDiscord | <Rika> what's the issue on that line? |
15:35:40 | FromDiscord | <Rika> and do you mind showing the original js for that part? |
15:37:22 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2ODE |
15:37:50 | FromDiscord | <Rika> ...i think |
15:38:00 | FromDiscord | <Rika> i dont know what the textContent part should be as i dont use the js backend |
15:38:58 | FromDiscord | <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:46 | FromDiscord | <Casey.McMahon> It works! Thank you. https://media.discordapp.net/attachments/371759389889003532/808000306775982130/guessingGame.png |
15:45:15 | FromDiscord | <Rika> 👌 |
15:45:22 | FromDiscord | <Rika> congrats |
15:47:18 | FromDiscord | <Casey.McMahon> That's really cool! |
15:51:19 | * | fredrikhr quit (Quit: Client Disconnecting) |
15:56:45 | ForumUpdaterBot | New thread by Clavismax: Invalid Indentation (newbie), see https://forum.nim-lang.org/t/7483 |
15:59:42 | FromDiscord | <Casey.McMahon> Well, it dosen't work perfectly... got some debugging to do. |
16:12:41 | FromDiscord | <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:26 | planetis[m] | call randomize |
16:13:28 | FromDiscord | <Casey.McMahon> How can I get the intended randomness on each refresh? |
16:13:39 | FromDiscord | <Casey.McMahon> ah thanks, I'll try that |
16:15:39 | FromDiscord | <Casey.McMahon> ah, thanks! |
16:24:54 | PMunch | Six minutes to the Nim talk! |
16:26:05 | planetis[m] | awesome! |
16:26:25 | planetis[m] | is it live or recorded? |
16:27:28 | PMunch | Video is recorded, but then there's a live Q&A afterwards |
16:27:34 | planetis[m] | did others do nim talks as well? |
16:27:54 | * | waleee-cl joined #nim |
16:28:12 | PMunch | None that I know of |
16:28:19 | planetis[m] | great im watching |
16:28:53 | PMunch | You can also join the chat on Matrix |
16:29:52 | planetis[m] | which one? |
16:30:41 | planetis[m] | fosdem i guess |
16:31:16 | PMunch | https://chat.fosdem.org/#/room/#declarative.minimalistic:fosdem.org |
16:38:25 | federico3 | PMunch: nice slide layout |
16:38:45 | PMunch | Thanks, I'm happy to share it. It's a LibreOffice Impress thing |
16:38:56 | PMunch | Hmm, got the question "How hard is to port nim to a new target cpu?" |
16:39:03 | PMunch | Anyone got anything to contribute to that? |
16:39:21 | federico3 | PMunch: plus more tooling and experimenting to overlay yourself on it and point at things with your fingers |
16:39:47 | PMunch | Ah, yes that is OBS with a green-screen |
16:55:29 | * | a_chou joined #nim |
16:59:53 | FromDiscord | <Ardek> nice talk |
17:00:38 | FromDiscord | <Recruit_main707> any url to share the vod? |
17:16:29 | PMunch | @Ardek, thanks :) |
17:16:50 | PMunch | @Recruit_main707, FOSDEM will upload it. But in the meantime you can watch it at https://uploads.peterme.net/OptimisingForHumans.mp4 |
17:17:03 | PMunch | (Please don't crash my server by sharing that link too much though :P) |
17:20:39 | FromDiscord | <Recruit_main707> 10-15 ppl at best |
17:20:45 | FromDiscord | <Recruit_main707> is that fine? |
17:21:04 | * | jjido quit (Quit: Connection closed for inactivity) |
17:22:06 | PMunch | Yeah sure |
17:22:25 | PMunch | Worst case scenario I'll just delete the file |
17:22:31 | PMunch | And upload it to YouTube myself |
17:26:41 | * | natrys joined #nim |
17:28:10 | FromDiscord | <Stuffe> im watching the talk now, really good |
17:29:00 | PMunch | Thanks :) |
17:43:25 | FromDiscord | <Rika> whats it about? other than "nim" |
17:44:05 | FromDiscord | <Recruit_main707> compile time 0 cost abstractions on microcontrollers |
17:45:29 | PMunch | Well look who's been paying attention! :P |
17:49:29 | FromDiscord | <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:11 | FromDiscord | <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:45 | FromDiscord | <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:21 | FromDiscord | <Stuffe> and its now 3.5k lines |
17:51:59 | FromDiscord | <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:03 | PMunch | Yeah, Nim is really good at making code readable |
17:52:06 | PMunch | If you do it right |
17:52:14 | PMunch | You can make stuff way worse if you try :P |
17:52:19 | FromDiscord | <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:55 | FromDiscord | <Stuffe> I only wish more emphasis was put on error messages though, it's the only feedback you get from the compiler |
17:54:43 | FromDiscord | <Recruit_main707> yep, error messages could be better |
17:55:05 | FromDiscord | <Recruit_main707> specially a few of them that are not descriptive enough |
17:55:52 | FromDiscord | <haxscramper> 'type expected' |
17:56:33 | FromDiscord | <haxscramper> But RFCs 323-325 focus on that |
17:57:25 | FromDiscord | <haxscramper> But overall "immediate convenience" is very low indeed when it comes to tooling |
17:57:49 | FromDiscord | <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:45 | FromDiscord | <Stuffe> anyway, im just complaining about something people built for free in their free time |
18:02:23 | FromDiscord | <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:56 | FromDiscord | <haxscramper> I guess I can just manually iterate over `~/.nimble` and add everything |
18:03:17 | FromDiscord | <haxscramper> But this might mess up things with multiple library versions. |
18:04:00 | FromDiscord | <haxscramper> So I might need to figure out how standalone nim resolves ties in cases like this |
18:04:50 | FromDiscord | <Solitude> https://github.com/nim-lang/Nim/blob/57bd64582ceee697dc4f079baf6a4e6137ff45b4/compiler/nimblecmd.nim#L65 |
18:06:37 | FromDiscord | <Solitude> the nimblepath defaults to ~/.nimble |
18:06:43 | FromDiscord | <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:04 | ForumUpdaterBot | New 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:18 | FromDiscord | <haxscramper> In the end ` nimblePath(config, ~".nimble/pkgs", TLineInfo())` was what I needed, thanks @Solitude |
18:51:35 | * | hmmm joined #nim |
19:00:09 | Oddmonger | isn't there a thing to do for importing some nim modules ? |
19:00:24 | Oddmonger | prefixing them with another module name ? |
19:00:39 | Oddmonger | for example i try to import pathutils, but i get an error |
19:00:56 | FromDiscord | <Deorder> Can I use the Nim build system to compile and link C code? |
19:01:33 | FromDiscord | <Deorder> I want to write some parts of my code in C99 and another part in Nim |
19:01:54 | FromDiscord | <Rika> i think theres a compile pragma or something |
19:02:06 | Oddmonger | ah ok pathutils is not a real module |
19:02:10 | Oddmonger | that's why |
19:02:11 | FromDiscord | <Rika> stuff that might be useful is also the importc pragma |
19:02:12 | FromDiscord | <haxscramper> `{.compile: "your_c_file.c".}` |
19:02:41 | FromDiscord | <Deorder> Nice thanks. That will save me so much time |
19:02:46 | FromDiscord | <haxscramper> Oddmonger: there is a `compiler/pathutils.nim` |
19:03:22 | FromDiscord | <haxscramper> And probably a lot of other submodules in different libraries that are named `pathutils`, so most likely |
19:03:26 | FromDiscord | <haxscramper> You need to use library name |
19:03:33 | FromDiscord | <Deorder> And do you happen to know if it does incremental builds based on modification times of c/h vs o files? |
19:04:05 | FromDiscord | <haxscramper> Yes IIRC it computes hashes for your C files and does not recompile if file haven't changed |
19:04:22 | Oddmonger | hum… it seems include «by default», i had a mistake with the function name |
19:04:41 | FromDiscord | <Deorder> Ah thanks |
19:04:41 | FromDiscord | <haxscramper> @Deorder so based on c/h files |
19:05:21 | FromDiscord | <haxscramper> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compile-pragma |
19:09:14 | FromDiscord | <Meowx> Anyone a Idea how I could realise C# `FieldOffset` to add paddings to fields in a nim object? |
19:09:15 | FromDiscord | <Meowx> https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.fieldoffsetattribute?view=net-5.0 |
19:16:29 | FromDiscord | <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:33 | FromDiscord | <Meowx> Not exactly what I'm looking for but I could look into its code yea |
19:29:46 | * | audiophile joined #nim |
19:36:56 | FromDiscord | <RealPatricia> Hello |
19:42:17 | * | hoijui joined #nim |
19:49:16 | ForumUpdaterBot | New thread by Shucks: FieldOffset / Padding Pragma?, see https://forum.nim-lang.org/t/7485 |
19:54:24 | FromDiscord | <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:33 | FromDiscord | <dom96> hello hello |
22:50:47 | * | irchaxwell quit (Quit: Leaving) |
22:51:31 | * | tane quit (Quit: Leaving) |
23:12:57 | FromDiscord | <gcao> sent a code paste, see https://play.nim-lang.org/#ix=2OGq |
23:13:11 | FromDiscord | <ElegantBeef> Does it error? |
23:13:14 | FromDiscord | <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:58 | FromDiscord | <ElegantBeef> My recollection is that doing `parseStmt` doesnt end well for importing |
23:14:21 | FromDiscord | <ElegantBeef> https://github.com/GaryM-exkage/GDGW-Maverick-Bot/blob/master/src/nimcordbot/utils.nim#L3↵This might help you |
23:15:25 | FromDiscord | <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:38 | FromDiscord | <Recruit_main707> there was a template to know from where was your macro being called from |
23:15:49 | FromDiscord | <ElegantBeef> Doesnt work aswell as you imagine |
23:15:58 | FromDiscord | <Recruit_main707> it worked fine for me |
23:16:07 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/system.html#instantiationInfo |
23:16:12 | FromDiscord | <gcao> thanks. I'll check back later. dinner time. |
23:16:27 | FromDiscord | <ElegantBeef> I tried using it for a absolute import path relative to the root, and i couldnt get it to work |
23:16:53 | FromDiscord | <ElegantBeef> https://github.com/beef331/import_utils/blob/main/src/import_utils.nim#L47 |
23:17:13 | FromDiscord | <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:20 | FromDiscord | <ElegantBeef> even though the import path and everything is correct |
23:17:25 | FromDiscord | <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:03 | FromDiscord | <ElegantBeef> Weird that your code works but mine doesnt 😦 |
23:22:09 | * | Vladar quit (Quit: Leaving) |
23:24:19 | FromDiscord | <ElegantBeef> Also you're using `\\` for paths in the import stmt? |
23:27:15 | FromDiscord | <Recruit_main707> I’m on Windows |
23:27:31 | FromDiscord | <Recruit_main707> Now would that break on Linux? |
23:27:41 | FromDiscord | <ElegantBeef> I figure the import path accepts either |
23:27:49 | FromDiscord | <ElegantBeef> I've never seen `\\` personally |
23:29:09 | FromDiscord | <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:31 | FromDiscord | <Recruit_main707> a single \\ |
23:29:45 | FromDiscord | <ElegantBeef> just tested and `std\strutils` is not importable 😄 |
23:30:54 | FromDiscord | <Recruit_main707> It did work... |
23:31:03 | FromDiscord | <Recruit_main707> I’ll have to check it tomorrow |
23:31:11 | FromDiscord | <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) |