00:00:12 | FromDiscord | <Varriount> Can anyone familiar with Python and C tell me why Python's posix_spawn implementation doesn't close file descriptors duplicated to stdout, stdin, and stderr? I do that in my own implementation, and am trying to work out why it isn't done there. β΅https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Lib/subprocess.py#L1642 |
00:00:36 | PMunch | I have written the Google Authenticator algorithm in Nim before, it's pretty simple |
00:00:48 | PMunch | And you've got plenty of program memory left with my firmware :P |
00:00:50 | FromDiscord | <treeform> Was it part of your keyboard? |
00:01:01 | PMunch | Nah, it was just for fun |
00:01:05 | FromDiscord | <treeform> ok |
00:01:12 | PMunch | Before I even started working on the keyboard |
00:01:19 | PMunch | But it should be pretty simple to add it in |
00:01:27 | PMunch | As I said, plenty of program memory left :) |
00:01:49 | PMunch | I was hoping to fit the firmware on an ATtiny85 just for fun, and I think it should be doable |
00:02:31 | PMunch | My keyboard firmware only takes up 3750 bytes in the configuration I'm using |
00:02:51 | FromDiscord | <treeform> I remember making a tiny wood computer with ATtiny85 |
00:03:27 | PMunch | Compared to the smallest version of QMK (with a bunch of stuff disabled) which clocks in at 12220 bytes |
00:04:11 | PMunch | Wood computer? |
00:05:02 | FromDiscord | <treeform> yeah just used a hammer to attach all the chips and wires into wood |
00:05:05 | FromDiscord | <treeform> it worked |
00:05:28 | PMunch | Haha, that sounds like a fun project :P |
00:05:30 | FromDiscord | <treeform> I can't find picture |
00:06:54 | PMunch | Hmm, I should really go to bed.. |
00:07:02 | FromDiscord | <treeform> It looked very caveman computer |
00:07:08 | FromDiscord | <treeform> Good night |
00:07:17 | FromDiscord | <treeform> I look forward to your talk |
00:07:40 | PMunch | How am I tired all day and then bright awake when I should be going to bed.. |
00:07:51 | PMunch | I look forward to hearings yours as well! |
00:08:03 | PMunch | Good night, whenever that'll be for you |
00:08:04 | * | PMunch quit (Quit: leaving) |
00:15:06 | FromDiscord | <ElegantBeef> @treeform so should we just support clang on linux until someone figures out how to fix gcc? |
00:17:08 | FromDiscord | <ElegantBeef> Since clang works identical to windows without any need of that `torel` |
00:19:53 | FromDiscord | <treeform> Not sure |
00:20:05 | FromDiscord | <treeform> clang is not default on linux |
00:20:08 | FromDiscord | <treeform> you have to request it |
00:20:15 | FromDiscord | <treeform> it is default on mac |
00:20:45 | FromDiscord | <ElegantBeef> I suppose we could default gcc then have as `--clang` flag or something |
00:30:39 | FromDiscord | <treeform> There is no way to tell if it was compiled by GCC or LLVM? |
00:32:09 | FromDiscord | <ElegantBeef> Not that i see in the dump atleast |
00:32:27 | FromDiscord | <ElegantBeef> Suppose if we get addresses that are smaller than the stack start we know |
00:35:09 | FromDiscord | <demotomohiro> emit C code like #ifdef GNUC ...? |
00:35:39 | FromDiscord | <demotomohiro> `#ifdef GNUC` |
00:46:18 | FromGitter | <BracketMaster> you can read bytes from a file as prescribed by readBytes here: https://nim-lang.org/docs/io.html#readBuffer%2CFile%2Cpointer%2CNatural |
00:46:31 | FromGitter | <BracketMaster> I'd like to read an entire file |
00:46:40 | FromGitter | <BracketMaster> and not have to specify length |
00:46:50 | FromGitter | <BracketMaster> that is, I want to read a binary into nim |
00:46:58 | FromGitter | <BracketMaster> and entire binary as a seq of bytes |
00:50:17 | * | kevc joined #nim |
00:50:46 | * | kevc quit (Remote host closed the connection) |
01:13:18 | FromDiscord | <Rika> https://nim-lang.org/docs/io.html#readAll%2CFile |
01:19:40 | * | arkurious quit (Quit: Leaving) |
01:36:07 | FromDiscord | <treeform> @ElegantBeef I am going to merge my big hottie parser rewrite. Can you make sure linux is correct on your side. I am getting some strange readings for test5: https://github.com/treeform/hottie/pull/3/checks?check_run_id=2811817203#step:6:50 |
01:39:17 | FromDiscord | <treeform> Hmm some thing odd on linux, I think the loop gets optimized out? Is this the issue you had before? https://github.com/treeform/hottie/runs/2811823435#step:6:48 |
01:41:08 | FromDiscord | <treeform> linux test is flaky because of that |
01:42:32 | FromDiscord | <treeform> Windows: totalTime: 1.061ms, Linux: totalTime: 1.362ms |
01:42:35 | FromDiscord | <treeform> its not that hmm... |
01:42:59 | FromDiscord | <treeform> I think 1ms might be too fast for the test |
01:47:04 | FromDiscord | <treeform> I am not hitting the iterator the most on windows, just like linux did. |
01:50:11 | FromDiscord | <treeform> flaky tests = worse thing |
02:05:24 | * | michaelgugino joined #nim |
02:05:34 | * | michaelgugino quit (Remote host closed the connection) |
02:21:56 | FromDiscord | <ElegantBeef> @treeform yea close enough https://media.discordapp.net/attachments/371759389889003532/853459134221647912/unknown.png |
02:22:07 | FromDiscord | <ElegantBeef> The issue is certainly that it's not long enough |
02:23:07 | FromDiscord | <ElegantBeef> Also why i think the stack trace isnt great for linux |
02:23:41 | FromDiscord | <treeform> I think I got it to work some times p.running throws error instead |
02:23:44 | FromDiscord | <treeform> maybe nim lib bug? |
02:24:06 | FromDiscord | <treeform> I will treat exception from p.running as false, that seems to have solved it |
02:24:44 | FromDiscord | <ElegantBeef> Yea and now that the linux parser is using uint64 we'll never have an issue with `rip` when getting some odd value |
02:30:14 | FromDiscord | <ElegantBeef> Well the running issue was that you were running that while loop inside so occasionally it ended |
02:32:38 | * | Joe joined #nim |
02:32:47 | * | Joe is now known as Guest68005 |
02:33:12 | * | Guest68005 quit (Remote host closed the connection) |
02:34:28 | ForumUpdaterBot | New thread by Greenfork: Gcc does not find paths generated by os module on Windows, see https://forum.nim-lang.org/t/8111 |
02:58:05 | * | osezer20 joined #nim |
02:58:18 | * | osezer20 quit (Remote host closed the connection) |
03:38:20 | * | professoruss9 joined #nim |
03:38:23 | * | professoruss9 quit (Remote host closed the connection) |
03:43:51 | * | spiderstew_ joined #nim |
03:45:21 | * | spiderstew quit (Ping timeout: 260 seconds) |
03:57:48 | * | rockcavera quit (Remote host closed the connection) |
04:52:54 | * | johnnynitwits quit (Quit: Bridge terminating on SIGTERM) |
04:52:54 | * | threenp quit (Quit: Bridge terminating on SIGTERM) |
04:53:22 | * | johnnynitwits joined #nim |
04:53:55 | * | threenp joined #nim |
04:54:56 | * | skered joined #nim |
04:55:26 | * | skered quit (Remote host closed the connection) |
05:34:59 | * | mzar joined #nim |
05:35:12 | * | mzar quit (Remote host closed the connection) |
05:53:09 | * | rtpg joined #nim |
05:53:25 | * | rtpg quit (Remote host closed the connection) |
06:10:13 | * | dan_x joined #nim |
06:10:24 | * | dan_x quit (Remote host closed the connection) |
06:26:47 | FromDiscord | <Malma> Hey everyone, is anyone have tutorial for using nimsuggest with curl |
06:31:13 | leorize[m] | why would you want to use nimsuggest with curl? |
06:31:51 | FromDiscord | <Malma> I want to create some text editor with nim |
06:32:11 | FromDiscord | <Malma> (edit) removed "some text" |
06:32:57 | leorize[m] | then curl won't cut it |
06:33:01 | leorize[m] | you need netcat |
06:33:35 | leorize[m] | curl is for communicating via a protocol like http. nimsuggest uses pure tcp on the other hand |
06:34:05 | leorize[m] | there's also the stdin/stdout interface to nimsuggest that might be easier to use |
06:36:46 | FromDiscord | <Malma> In reply to @leorize "there's also the stdin/stdout": yes, i know that. I think i'll learn netcat then, thanks |
06:52:53 | FromDiscord | <Bung> why dont you take look at nimlsp ? you dont need third process |
07:16:10 | * | SebastianM joined #nim |
07:26:19 | SebastianM | Hey Guys, I tried to fetch contents of a page of youtube playlist with httpclient.getcontent but it fails with SIGILL: Illegal operation. |
07:26:19 | SebastianM | Illegal instruction (core dumped) |
07:28:02 | SebastianM | It works fine with other https websites. Maybe youtube should be handled differently? |
07:29:01 | Prestige | hm could you share the code? |
07:35:01 | SebastianM | Here it is: https://play.nim-lang.org/#ix=3pNl |
07:36:10 | SebastianM | and echo site_contents at the bottom |
07:38:47 | Prestige | I mean var site_contents = client.getcontent("https://youtube.com") |
07:38:59 | Prestige | this works, idk what you're doing in particular |
07:41:32 | SebastianM | Look at the commented section in the link to playground, theres a link to the playlist that I give to binary as argument |
07:43:41 | Prestige | it worked for me |
07:44:08 | Prestige | nim r -d:ssl foo.nim Cyberpunk "https://www.youtube.com/playlist?list=PL7XnGuhCcsG4DIWl3dqtYgYrBnxkHo5OM" works fine |
07:44:15 | Prestige | What version of Nim are you using? |
07:46:00 | SebastianM | Nim Compiler Version 1.5.1 [Linux: amd64] |
07:46:01 | SebastianM | Compiled at 2021-03-31 |
07:46:25 | Prestige | hm maybe try the latest stable? |
07:51:11 | SebastianM | Prestige: hm, i'll try to use stable version, thank you for your assistance |
07:51:14 | * | ohama12 joined #nim |
07:51:29 | * | ohama12 quit (Remote host closed the connection) |
07:51:45 | * | SebastianM quit (Quit: SebastianM) |
08:25:54 | * | threenp quit (Quit: Bridge terminating on SIGTERM) |
08:25:54 | * | johnnynitwits quit (Quit: Bridge terminating on SIGTERM) |
08:26:15 | * | johnnynitwits joined #nim |
08:26:18 | * | threenp joined #nim |
09:00:12 | * | DannyHpy[m] quit (Quit: Idle for 30+ days) |
09:03:42 | * | gschanuel1 joined #nim |
09:04:18 | * | gschanuel1 quit (Remote host closed the connection) |
09:33:55 | * | teasea4 joined #nim |
09:35:30 | * | conkker7 joined #nim |
09:36:24 | * | blackbea- joined #nim |
09:36:35 | * | pauwel_kwak joined #nim |
09:36:57 | * | wanr[m]1 joined #nim |
09:36:57 | * | fbpyr[m]1 joined #nim |
09:36:57 | * | nxnl[m]1 joined #nim |
09:36:57 | * | dithpri[m]1 joined #nim |
09:37:09 | * | kali___ joined #nim |
09:37:29 | * | ExtraDosages[m]1 joined #nim |
09:37:49 | * | Benjamin[m]121 joined #nim |
09:38:25 | * | stisa1 joined #nim |
09:38:34 | * | customer[m]1 joined #nim |
09:39:13 | * | fowl_ joined #nim |
09:40:04 | * | cadmium[m]1 joined #nim |
09:40:28 | * | Zoom[m]1 joined #nim |
09:41:31 | * | Edoardo[m]11 joined #nim |
09:41:43 | * | Cthalupa- joined #nim |
09:42:13 | * | fowl quit (*.net *.split) |
09:42:13 | * | euantorano quit (*.net *.split) |
09:42:13 | * | blackbeard420 quit (*.net *.split) |
09:42:13 | * | wanr[m] quit (*.net *.split) |
09:42:13 | * | vegai quit (*.net *.split) |
09:42:13 | * | nxnl[m] quit (*.net *.split) |
09:42:13 | * | fbpyr[m] quit (*.net *.split) |
09:42:13 | * | Edoardo[m]1 quit (*.net *.split) |
09:42:13 | * | ExtraDosages[m] quit (*.net *.split) |
09:42:13 | * | dithpri[m] quit (*.net *.split) |
09:42:13 | * | ee7[m] quit (*.net *.split) |
09:42:13 | * | cadmium[m] quit (*.net *.split) |
09:42:13 | * | Benjamin[m]12 quit (*.net *.split) |
09:42:13 | * | Zoom[m] quit (*.net *.split) |
09:42:13 | * | stisa quit (*.net *.split) |
09:42:13 | * | customer[m] quit (*.net *.split) |
09:42:14 | * | Jjp137 quit (*.net *.split) |
09:42:14 | * | kali_ quit (*.net *.split) |
09:42:14 | * | pauwel_k1ak quit (*.net *.split) |
09:42:14 | * | conkker quit (*.net *.split) |
09:42:14 | * | Cthalupa quit (*.net *.split) |
09:42:14 | * | teasea quit (*.net *.split) |
09:42:14 | * | conkker7 is now known as conkker |
09:42:14 | * | teasea4 is now known as teasea |
09:42:15 | * | fowl_ is now known as fowl |
09:44:15 | * | euantorano joined #nim |
09:48:43 | * | Jjp137 joined #nim |
09:48:54 | * | bashtanov3 joined #nim |
09:49:24 | * | bashtanov3 quit (Remote host closed the connection) |
09:50:26 | * | ee7[m] joined #nim |
09:50:41 | * | vegai joined #nim |
09:57:05 | * | CaptainN joined #nim |
09:57:21 | * | CaptainN quit (Remote host closed the connection) |
10:17:08 | * | SebastianM joined #nim |
10:19:45 | SebastianM | Prestige: Just a quick information about the issue. It turns out that Nim was fine and it was my c compiler fault, on gcc it works fine, and earlier I used Zig. Thank you once again:) |
10:22:02 | * | SebastianM quit (Quit: SebastianM) |
10:27:52 | FromDiscord | <zetashift> minor bikeshedding but I wonder if the top to bottom way of reading code of Nim is a good thing or not |
11:09:09 | * | ZoomZoomZoom joined #nim |
11:09:52 | FromDiscord | <ajusa> In reply to @zetashift "minor bikeshedding but I": What do you mean? There's also code reordering for people who want to organize code their way |
11:19:15 | * | PMunch joined #nim |
11:28:31 | * | arkurious joined #nim |
11:37:55 | * | saintpai23 joined #nim |
11:38:06 | * | saintpai23 quit (Remote host closed the connection) |
11:40:58 | * | ZoomZoomZoom quit (Ping timeout: 258 seconds) |
11:42:23 | * | icedev joined #nim |
11:42:40 | * | icedev quit (Remote host closed the connection) |
11:53:22 | FromDiscord | <gerwy> can anyone pls explain to me what are `block` for? |
11:53:51 | FromDiscord | <gerwy> from docs i understand its like `while false:` but why the hell would i want code that won't be reached? |
11:54:43 | FromDiscord | <Bung> block create variable scope |
11:55:21 | FromDiscord | <Bung> while false I guess just keep some code in the code base |
11:56:19 | FromDiscord | <Bung> so you dont need switch comment uncomment affected git code change |
11:57:35 | * | ZoomZoomZoom joined #nim |
12:00:51 | PMunch | @gerwy, blocks can be used as Bung mentioned to create a new scope |
12:01:37 | FromDiscord | <konsumlamm> In reply to @Life Sucks "from docs i understand": it's not, it's more like `if true:`, it just creates a new scope |
12:02:33 | PMunch | This is useful if you want to declare a variable that won't live for the entirety of the current scope (for example if you're testing and want to re-use the same variable name). It can also be used with a name `block someName:` and then you can `break someName` to jump out of the block |
12:21:14 | FromDiscord | <gerwy> Okay so what is scope then |
12:23:01 | PMunch | A lot of things introduce a new scope, an if statement, a while, a procedure, etc. Pretty much anything that indents your code |
12:23:19 | PMunch | And if you do `var x = 100` inside a scope you can't access that x outside the scope |
12:23:57 | PMunch | So if you do `if something: var x = 100` you couldn't use the `x` variable outside the scope introduced by that `if` statement |
12:25:22 | FromDiscord | <Bung> what programing language you comming from ? |
12:25:45 | FromDiscord | <Bung> I think many language has variable scope |
12:34:55 | FromDiscord | <gerwy> In reply to @PMunch "This is useful if": oh like this, so if i want to have variable, but i don't want it to live forever or to be global i do a new scope? |
12:36:20 | FromDiscord | <gerwy> In reply to @Bung "what programing language you": C++, C#, Python, JSβ΅and yeah they do, i just don't know that its called like this unfortunately i learn most of those languages in school and we learn them not in english which sux ass |
12:38:46 | PMunch | Yup you can create a new scope with a block statement for that. Another cool trick with blocks is implicit return: https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html |
12:39:21 | PMunch | Not unique to blocks, but handy if you have some slightly complicated initialisation for a variable that you for some reason don't want to push to a procedure |
12:46:31 | * | tex0l5995 joined #nim |
12:47:04 | * | tex0l5995 quit (Remote host closed the connection) |
12:47:32 | FromDiscord | <gerwy> In reply to @PMunch "Yup you can create": ah yes i know this, i tried to do it in my game few times but it didn't worked, i guess indentation was wrong |
12:48:36 | PMunch | You can see how I do it, basically the easiest way to do it is `let x =` on one line, and then whatever you want on indented below that |
12:48:46 | PMunch | You wrote a game in Nim? |
12:49:12 | FromDiscord | <hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3pOH |
12:49:23 | FromDiscord | <hamidb80> hey pmunch |
12:50:04 | FromDiscord | <Rika> not that i know of |
12:50:17 | PMunch | Hi @hamidb80 |
12:50:25 | PMunch | Well you could do a tuple |
12:50:46 | FromDiscord | <hamidb80> ok tnks |
12:51:10 | PMunch | Like this: https://play.nim-lang.org/#ix=3pOI |
12:52:34 | FromDiscord | <gerwy> In reply to @PMunch "You wrote a game": yep |
12:52:38 | FromDiscord | <gerwy> for a game jam |
12:53:59 | PMunch | Oh cool, link? |
12:54:28 | PMunch | Curious if anyone did something in Nim for GMTK this year |
12:54:30 | FromDiscord | <gerwy> sent a code paste, see https://play.nim-lang.org/#ix=3pOJ |
12:55:15 | FromDiscord | <gerwy> In reply to @PMunch "Oh cool, link?": not released it yet, im still working on it and i get stressed because i barely have half of it and i didn't do much progress ehh.... |
12:55:20 | FromDiscord | <hamidb80> In reply to @PMunch "Like this: https://play.nim-lang.org/#ix=3pOI": tnk u |
12:55:20 | FromDiscord | <gerwy> its for 4MB game jam |
12:58:38 | PMunch | @gerwy oh cool, reminds me of my Arduboy gamejam: https://community.arduboy.com/t/mannbarschwein-game-jam-5/9229 |
13:01:32 | FromDiscord | <gerwy> thats all i have right now...β΅there was minion running to the right, but as i was doing this queue for minions everything got bad and now it doesn't render any minion... https://media.discordapp.net/attachments/371759389889003532/853620098504851456/Nagranie_z_ekranu_2021-06-13_o_15.00.43.mov |
13:01:45 | FromDiscord | <gerwy> and clouds are procedurally generated, because size matters lol |
13:08:04 | * | ZoomZoomZoom quit (Remote host closed the connection) |
13:08:29 | * | ZoomZoomZoom joined #nim |
13:12:32 | FromDiscord | <zetashift> In reply to @ajusa "What do you mean?": Isn't that feature experimental though? |
13:19:54 | FromDiscord | <gerwy> i really don't get nim haha |
13:20:57 | FromDiscord | <gerwy> i was looking at cool stuff made with nim right and i was reading some stuff in "offensive nim"β΅and the person told here to use `-d:ranger` to decrease size of binary (and few others that i know) |
13:21:14 | FromDiscord | <gerwy> and i tried that with my game, just to see if that will make it even smaller than it already is |
13:21:44 | FromDiscord | <gerwy> and my problem with texture data in array suddenly was fixed and the minion appears ππππ |
13:22:32 | FromDiscord | <gerwy> why? I don't even know https://media.discordapp.net/attachments/371759389889003532/853625381395234836/Zrzut_ekranu_2021-06-13_o_15.22.25.png |
13:23:16 | PMunch | Uhm, that's not supposed to happen :P |
13:23:26 | PMunch | -d:danger vs. normal shouldn't really change much |
13:24:09 | FromDiscord | <gerwy> yeah but somehow it worked lol, i will need to look into that |
13:24:12 | * | asdflkj quit (Ping timeout: 245 seconds) |
13:24:50 | FromDiscord | <gerwy> i compiled it normally and it doesn't work okay, so it must be it |
13:25:18 | PMunch | I have run into a similar issue once, with a cryptography library |
13:25:30 | PMunch | It compiles fine with debug mode, but not with release mode |
13:25:52 | * | D_ quit (Ping timeout: 245 seconds) |
13:25:57 | FromDiscord | <gerwy> okay never mind, it wasn't the danger flagβ΅it was changing gc to arc |
13:26:13 | FromDiscord | <gerwy> how can i change default gc in nim? |
13:26:55 | leorize[m] | --gc |
13:27:53 | PMunch | Default? Put the GC option in the system wide config |
13:29:19 | FromDiscord | <gerwy> idk where is this config hahβ΅i could add something in the command that VSC is using when i click to buildβ΅but i also don't know how to change it |
13:30:29 | * | D_ joined #nim |
13:30:35 | PMunch | I mean you can also put it in a project local config |
13:33:00 | FromDiscord | <gerwy> okay i will figure it out |
13:33:02 | * | zaszi joined #nim |
13:33:09 | * | zaszi quit (Remote host closed the connection) |
13:34:45 | ForumUpdaterBot | New question by schneiderfelipe: Trouble defining a Nim concept with an auto type inside, see https://stackoverflow.com/questions/67958826/trouble-defining-a-nim-concept-with-an-auto-type-inside |
13:35:52 | FromDiscord | <schneiderfelipe> In reply to @schneiderfelipe "Hi guys! I'm having": I posted this question in https://stackoverflow.com/q/67958826/4039050. If someone could answer, that would be awesome! π |
13:46:19 | * | ZoomZoomZoom quit (Ping timeout: 258 seconds) |
13:47:57 | * | D_ quit (Ping timeout: 245 seconds) |
13:49:25 | * | D_ joined #nim |
13:51:48 | * | growpotkin joined #nim |
13:52:22 | * | growpotkin quit (Remote host closed the connection) |
13:59:22 | * | asdflkj joined #nim |
14:04:05 | * | ZoomZoomZoom joined #nim |
14:24:39 | FromDiscord | <zetashift> In reply to @schneiderfelipe "I posted this question": Also don't forget to post on the forums! More Nim eyes there |
14:25:29 | FromGitter | <BracketMaster> anyone here familiar with argparse? |
14:25:37 | FromDiscord | <schneiderfelipe> In reply to @zetashift "Also don't forget to": @zetashift No clue how to confirm my e-mail there (I changed it a couple times, no success). Without an e-mail confirmation, I'm unable to post π¦ |
14:25:44 | FromGitter | <BracketMaster> the examples only show how to use it on fabricate arrays: ``var opts = p.parse(@["--apple", "-o=foo", "hi"])`` |
14:25:59 | FromGitter | <BracketMaster> how to you use p.parse on input from the CLI? |
14:26:02 | FromDiscord | <schneiderfelipe> (edit) "success)." => "success/e-mail confirmation never came)." |
14:26:16 | FromGitter | <BracketMaster> https://github.com/iffy/nim-argparse#parse |
14:26:27 | FromGitter | <BracketMaster> **fabricated |
14:28:55 | * | blackbea- quit (Quit: ZNC 1.8.2 - https://znc.in) |
14:29:13 | * | cptMikky7 joined #nim |
14:29:14 | * | blackbeard420 joined #nim |
14:29:16 | * | cptMikky7 quit (Remote host closed the connection) |
14:34:48 | FromGitter | <BracketMaster> looks like you must pass it ``os.commandLineParams()`` |
14:51:21 | FromDiscord | <Zachary Carter> bout to start up my stream |
14:52:48 | * | ZoomZoomZoom quit (Ping timeout: 240 seconds) |
14:53:06 | * | threenp left #nim ("User left") |
14:53:23 | FromDiscord | <Zachary Carter> https://www.twitch.tv/hahahaitsfunny |
14:54:57 | FromDiscord | <Rika> no its not funny |
14:55:15 | FromDiscord | <IDF(ardek66)> its quite funny |
15:00:01 | FromDiscord | <Kermithos> Im currently trying to rewrite some python scripts in nim, is there anyway to loop trough a json?β΅https://play.nim-lang.org/#ix=3pPi |
15:13:09 | FromDiscord | <Hi02Hi> sent a code paste, see https://play.nim-lang.org/#ix=3pPF |
15:20:25 | FromDiscord | <Kermithos> In reply to @Hi02Hi "since the json is": thanks, worked |
15:22:31 | FromDiscord | <konsumlamm> you don't even need the `.pairs()` |
15:32:02 | * | samfalkner9 joined #nim |
15:32:13 | * | samfalkner9 quit (Remote host closed the connection) |
15:38:15 | * | PMunch quit (Quit: leaving) |
15:46:17 | FromDiscord | <aleclarson> can a sequence be untyped, or contain values of different types? |
15:47:42 | FromDiscord | <Rika> formally no |
15:47:46 | FromDiscord | <Rika> there are workaroun |
15:47:47 | FromDiscord | <Rika> ds |
15:49:08 | FromDiscord | <codic> use a object variant |
15:49:15 | FromDiscord | <codic> there are libraries that kinda automate that |
15:49:30 | FromDiscord | <codic> is there any way to get a less expensive exceptions impl since the std uses it? (I want to use Result in my own code anyways) |
15:50:39 | FromDiscord | <Rika> use arc? |
15:51:05 | FromDiscord | <dom96> compile to C++ |
15:52:45 | FromDiscord | <codic> hmm i wonder how good C++ exceptions are |
15:52:48 | FromDiscord | <codic> already using arc |
15:54:36 | * | ViacheslavK-t4 joined #nim |
15:55:02 | * | ViacheslavK-t4 quit (Remote host closed the connection) |
15:56:31 | FromDiscord | <codic> is it possible to extend an enum? |
15:57:07 | FromDiscord | <dom96> Don't think so |
15:59:54 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pQ2 |
16:00:20 | FromDiscord | <dom96> nope, you might be able to create a new enum with the values of another |
16:00:23 | FromDiscord | <dom96> and automate that via macros |
16:02:33 | FromDiscord | <Kermithos> does nim have bitwise operations like python does? (https://wiki.python.org/moin/BitwiseOperators) |
16:03:55 | FromDiscord | <dom96> yes |
16:04:03 | FromDiscord | <dom96> `shr`, `shl`, `and`, `xor` etc |
16:04:21 | FromDiscord | <gerwy> Hi, so umm i was thinking recentlyβ΅Is it possible to write Mobile app with nim, a lot of frameworks for mobile uses JS so it could somehow go with nim right? I was also thinking about using cordova with nim but i don't know how well it goes and also cordova seems pretty old |
16:05:07 | FromDiscord | <codic> In reply to @dom96 "nope, you might be": hmm i might just use strings for errors but i'm not suer of the cost of that |
16:05:16 | FromDiscord | <gerwy> i know that nimx supports Mobile GUI, but idk how to compile it to app |
16:05:19 | FromDiscord | <dom96> @Life Sucks yep, and in fact you don't have to be restricted to using Nim's JS backend. You can compile to C++ on Android and Obj C on iOS (it works, I've created a game that uses this approach) |
16:05:50 | FromDiscord | <dom96> In reply to @codic "hmm i might just": why are you so worried about cost? Don't prematurely optimise |
16:07:58 | FromDiscord | <gerwy> In reply to @dom96 "<@!347345994217816066> yep, and in": yeah i was also considering using C++ and compiling it to wasm with emscriptenβ΅Idk if its easy way to use pure C++ for mobile dev |
16:08:39 | FromDiscord | <codic> yeah I know, I'm just wondering |
16:09:18 | FromDiscord | <gerwy> also i noticed `droid` for nimx that says it will compile to Android so i guess that could work too, the gui doesn't looks as bad but i don't know how it is with customizing UI thingies because i would like something more modern |
16:09:19 | FromDiscord | <dom96> @Life Sucks depends on what you want to do |
16:09:32 | FromDiscord | <gerwy> just some app, not a game or anything |
16:10:20 | FromDiscord | <dom96> I see, I would recommend one of the more mature frameworks in that case, or even just using Swift/Kotlin directly. |
16:10:21 | FromDiscord | <gerwy> app like you can find in AppStore or GooglePlay, not super simple like few buttons and hello world, but also not something super complicated, connecting to million API's, doing some OS stuff in the background etc. |
16:11:16 | FromDiscord | <gerwy> well i would like to use nim to that, thats why im asking, its probably is possible and usable i just don't see anyone talking aboutβ΅nim is my Plan B btw so its not like im relying only on it |
16:12:02 | FromDiscord | <dom96> it's definitely possible, it's just going to be more painful π |
16:13:39 | FromDiscord | <gerwy> im already used to pain |
16:17:05 | FromDiscord | <gerwy> but i will be to do it, i will could ask for help to setup all the JS stuff here right? |
16:17:40 | Prestige | Yeah, ask anything you want here |
16:20:35 | FromDiscord | <gerwy> :3 |
16:20:52 | * | coderpatros[m]1 joined #nim |
16:21:19 | * | coderpatros[m]1 quit (Remote host closed the connection) |
16:21:19 | FromDiscord | <gerwy> but its not my current project, im still learning nim i only started like month ago ( i knew it before i just didn't had time to start) right now i need to finish this crappy game |
16:25:50 | * | D_ quit (Remote host closed the connection) |
16:26:06 | * | D_ joined #nim |
16:30:59 | * | ZoomZoomZoom joined #nim |
16:33:23 | FromDiscord | <Kermithos> how can I convert an int to a binary? |
16:34:17 | FromDiscord | <gerwy> like zeros and ones? |
16:34:30 | FromDiscord | <gerwy> its already in binary |
16:35:08 | FromDiscord | <Kermithos> In reply to @Life Sucks "like zeros and ones?": yes |
16:36:26 | FromDiscord | <gerwy> why do you need bits of int? You want to display it? |
16:37:00 | FromDiscord | <zetashift> There is a `toBin` proc |
16:37:29 | FromDiscord | <gerwy> yes |
16:37:32 | FromDiscord | <gerwy> https://nim-lang.org/docs/strutils.html#toBin%2CBiggestInt%2CPositive |
16:37:34 | FromDiscord | <gerwy> i think this |
16:37:48 | FromDiscord | <gerwy> but why do you need this? Just curious |
16:38:00 | * | ZoomZoomZoom quit (Ping timeout: 240 seconds) |
16:38:25 | FromDiscord | <Kermithos> just wanna play around, Im pretty new to nim |
16:39:36 | FromDiscord | <gerwy> ah okay, well have in mind that output of it is string |
16:39:49 | FromDiscord | <gerwy> (edit) "have" => "keep" |
16:39:56 | FromDiscord | <gerwy> (edit) "it" => "this" |
16:40:27 | FromDiscord | <gerwy> In reply to @Kermithos "does nim have bitwise": so you won't be able to do any bitwise operations on it |
16:40:47 | * | ZoomZoomZoom joined #nim |
16:41:21 | FromDiscord | <Kermithos> aight, thanks |
16:41:46 | * | aedan joined #nim |
16:41:54 | * | aedan is now known as Guest48376 |
16:42:23 | * | Guest48376 quit (Remote host closed the connection) |
16:53:54 | planetis[m] | exceptions are better than result in nim |
16:53:56 | planetis[m] | imo |
16:57:47 | * | ldlework quit (Changing host) |
16:57:47 | * | ldlework joined #nim |
16:58:08 | FromDiscord | <aleclarson> are there any good guides on nim + ios/android interop? |
17:00:02 | planetis[m] | They are faster than result type (since there is no NRVO), plus you can tag every proc that raises, with the .raises pragma and make exceptions part of your libs public interface |
17:00:48 | planetis[m] | (which is done by default in the docs if you click on the `{. .. .}` thing |
17:09:07 | FromDiscord | <zetashift> In reply to @planetis "exceptions are better than": Don't they have different usecases tho? |
17:09:17 | FromDiscord | <zetashift> Exceptions should only be used in exceptional situations right |
17:10:08 | planetis[m] | and what about result? |
17:10:44 | planetis[m] | when you do the result[error] thingy |
17:14:12 | FromDiscord | <dom96> ugh wth, why was nim using 0.2.2 and not #head |
17:14:35 | FromDiscord | <dom96> sent a code paste, see https://play.nim-lang.org/#ix=3pQn |
17:19:20 | FromDiscord | <zetashift> In reply to @planetis "when you do the": Same thing I guess, but isn't Result nicer to use than catching everything? |
17:20:07 | FromDiscord | <zetashift> I haven't done a lot with exceptions/results tho |
17:21:12 | planetis[m] | if you manually annotate your procs with ``.raises:[ ValueError]`` as example you dont have to |
17:22:01 | planetis[m] | I liked this talk https://www.youtube.com/watch?v=fOV7I-nmVXw |
17:22:30 | planetis[m] | btw pikus is my favourite speaker |
17:23:06 | planetis[m] | its about exceptions in C++, he tries to convice ppl there is nothing wrong with them |
17:24:04 | planetis[m] | but when that hip NASA talk about software in rovers came out, ppl just think they shouldn't use them |
17:25:19 | * | blackpawn joined #nim |
17:38:49 | * | kfenn joined #nim |
17:38:52 | * | kfenn quit (Remote host closed the connection) |
17:44:36 | FromDiscord | <dom96> Exception tracking is awesome. Wish there was more effort behind polishing this feature |
17:46:51 | * | euantorano quit (K-Lined) |
17:46:51 | * | fowl quit (K-Lined) |
17:46:51 | * | saem quit (K-Lined) |
17:57:07 | FromDiscord | <haxscramper> For haxdoc I'm tracking all direct and indirect raises in the documentation, https://github.com/haxscramper/haxdoc/commit/9e09f7a2dc2c56fdce66102a172f1d9104270145 (commit message goes into more details), but in general current system is fine - like I can't think of a feature that could be added/improved except for callback raises,. It that seems like something unfixable |
17:58:07 | FromDiscord | <codic> what is nice with result you opt in to not properly handling errors |
17:58:47 | FromDiscord | <haxscramper> With result you have to manually compose error handling which takes some time |
17:59:21 | FromDiscord | <codic> In reply to @haxscramper "With result you have": true |
17:59:23 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pQy |
17:59:35 | FromDiscord | <haxscramper> It is a good way to handle errors on the low-level, but as you get higher and higher in abstractions exceptions are just easier to work with |
18:00:23 | FromDiscord | <haxscramper> I use option all the time for different procs, but when things get complex enough so failure requires explanation it is a time for exceptions I think |
18:13:28 | planetis[m] | i was curious so have inspected the asm of Isolated[T] and provided that you use .nodestroy in the proper places there is no overhead (its optimized away), but for options i think its not the same |
18:19:16 | * | NimBot joined #nim |
18:27:15 | * | zsoltiv joined #nim |
18:41:00 | * | Saemsays[m] joined #nim |
18:47:43 | * | Saemsays[m] left #nim (#nim) |
19:10:09 | FromDiscord | <zetashift> In reply to @haxscramper "It is a good": can you explain a lil bit why exceptions are easier to work with on a higher abstraction level? |
19:13:20 | FromDiscord | <haxscramper> When you have many possible things going wrong (which happens if you get closer to the hypothetical 'main' that kick-starts all processing) handling each case becomes more and more tedious - you ether get to the go's level of "check return if every function immediately" or straight up ignore information. |
19:14:49 | FromDiscord | <haxscramper> Stacktraces are not supported with result, which is a major downside - I don't necessarily care about all possible errors for every proc I used now, but with result I either have to handle things on the spot, or ignore the erorr |
19:16:49 | FromDiscord | <haxscramper> So exceptions are opt-in for handling, but with result you are forced to write code in a particular manner or loose information. |
19:18:55 | FromDiscord | <haxscramper> But it also works other way around I think - writing try/catch all over the place for low-level procedure when it can return option does not make much sense to me either. |
19:19:26 | FromDiscord | <haxscramper> And option/either/result comes with nice helper abstractions like maps |
19:19:52 | FromDiscord | <haxscramper> (edit) "And option/either/result comes with nice helper abstractions like ... maps" added "FP" |
19:24:17 | * | Saemsays[m] joined #nim |
19:26:09 | * | Ad03 joined #nim |
19:26:16 | * | Ad03 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
19:31:26 | FromDiscord | <zetashift> ah yea that makes sense |
19:31:45 | FromDiscord | <zetashift> I really like how Scala does `Option` + for-comprehensions |
19:33:26 | * | zsoltiv quit (Quit: zsoltiv) |
19:36:00 | FromDiscord | <codic> why do C APIs using a `void ` eg in the posix module use a `pointer` type? https://nim-lang.org/docs/system.html#pointer |
19:36:19 | FromDiscord | <codic> why not a ptr void or similar |
19:36:32 | FromDiscord | <codic> oh, `pointer` is the representation of that |
19:37:59 | * | Hazelesque14 joined #nim |
19:38:07 | * | Hazelesque14 quit (Read error: Connection reset by peer) |
19:39:39 | FromDiscord | <Bung> ptr hold the ptr type |
19:39:54 | FromDiscord | <Bung> pointer just pointer that's the semantic |
19:40:29 | FromDiscord | <haxscramper> Also forgot to mention nim largely solved issue of "I don't know what procedure I used will raise, but I need to handle all errors" by introducing `.raises: [].` that will take care of that |
19:41:26 | FromDiscord | <haxscramper> So at some point you can stop and actually handle every error with compiler assisting you, but you don't have to do it all the time, on every level. |
19:43:55 | FromDiscord | <haxscramper> For example in my hmisc package I define a number of helper exception types for dealing with shell and file handling, and in most cases failed external command or missing file means that no further processing is really necessary, so it would stop the program anyway. So why not let exceptions handle this for me instead of writing dozens of 'if tmpRes1.isErr() : return' |
19:43:56 | FromDiscord | <Bung> it's force pass compiler ? |
19:44:16 | FromDiscord | <haxscramper> .raises [].? |
19:44:21 | FromDiscord | <Bung> yeah |
19:45:04 | FromDiscord | <haxscramper> Yes, it is similar to the noSideEffect - compiler will error out if there is a chance of getting unlisted exception |
19:45:45 | FromDiscord | <haxscramper> So if you don't list any it means procedure won't raise anything, otherwise list of exceptions is inferred from the body |
19:46:31 | FromDiscord | <Bung> that means compiler still do the check |
19:46:32 | FromDiscord | <haxscramper> And is a part of a procedure signature. So you can use this for callbacks as well (by default they are assumed to raise anything, so you get "callback raises" hell) |
19:46:49 | FromDiscord | <haxscramper> In reply to @Bung "that means compiler still": At compile-time yes |
19:48:29 | * | ldlework quit (Quit: co'o ro do) |
19:48:34 | FromDiscord | <haxscramper> But it is done anyway |
19:49:07 | FromDiscord | <Bung> if i do it in top level proc , so I dont need do it everywhere? |
19:50:31 | FromDiscord | <haxscramper> Well, actually that's the place where you supposed to use this, to explicitly provide handling of all the errors. But that is just hypothetically, I merely looted out possibility of using this feature to achieve most important feature elf the results - exhaustive failure handling |
19:50:47 | FromDiscord | <haxscramper> (edit) "looted" => "pointed" |
19:51:09 | FromDiscord | <haxscramper> (edit) "elf" => "of" | "ofthe results ... -" added "-based error handling" |
19:52:18 | FromDiscord | <System64 ~ Flandre Scarlet> Do you know why it doesn't work please? https://media.discordapp.net/attachments/371759389889003532/853723473742528612/unknown.png |
19:52:53 | FromDiscord | <haxscramper> Because args[0] is a char I think, but it would be better to see the error |
19:53:18 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/853723721940336660/unknown.png |
19:54:01 | FromDiscord | <haxscramper> You assign procedure to a variable, use commandLineParams() |
19:54:22 | FromDiscord | <System64 ~ Flandre Scarlet> ah works now |
19:54:23 | FromDiscord | <haxscramper> If you need to get first character as a string you can use $srgs[0] I'm not sure if .string is supposed to work |
19:58:03 | FromDiscord | <Bung> Thanks! solve my problem |
20:07:37 | * | xet7 quit (Ping timeout: 240 seconds) |
20:08:17 | FromDiscord | <Bung> I guess I dont need define a callback type as that, I already wraps callback call in try catch |
20:09:22 | FromDiscord | <Bung> I may need import segfaults , since nil acess will break server |
20:09:55 | FromDiscord | <codic> how can I create a zeroed out instance of an object |
20:10:20 | FromDiscord | <ElegantBeef> `var a: YourObject` `YourObject()` |
20:10:25 | FromDiscord | <ElegantBeef> Multiple ways |
20:10:26 | FromDiscord | <codic> like in C `struct thing instance; emset(&instance, 0, sizeof instance)` |
20:10:32 | FromDiscord | <codic> i see |
20:10:40 | FromDiscord | <ElegantBeef> Nim 0-inits by default, so as long as you take memory it'll do it |
20:10:45 | FromDiscord | <codic> i thought it would have been left uninitialized |
20:10:52 | FromDiscord | <codic> how would you make it not init it then? |
20:11:03 | * | xet7 joined #nim |
20:11:03 | FromDiscord | <ElegantBeef> `var a {.noinit.}: YourObject` |
20:11:20 | FromDiscord | <ElegantBeef> 0-init errors are relatively common so this saves hairs π |
20:12:02 | FromDiscord | <codic> i see |
20:12:38 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pRq |
20:12:42 | FromDiscord | <codic> i just type 1 instead |
20:12:44 | FromDiscord | <codic> but it's curious |
20:12:49 | FromDiscord | <codic> because it makes it not usable without a cast |
20:13:49 | FromDiscord | <codic> how to convert a string to an array[108, char]? |
20:13:59 | FromDiscord | <codic> like strncpy |
20:15:58 | FromDiscord | <Bung> found error handle still a mess if the proc implementation are os specific |
20:16:44 | FromDiscord | <Bung> one platform raise, another does not |
20:17:10 | FromDiscord | <codic> ` address.sun_path = cast[array[108, char]](socket_path)β΅`? |
20:17:13 | FromDiscord | <codic> (edit) "char]](socket_path)β΅`?" => "char]](socket_path)β΅`?is this ok?" |
20:17:20 | FromDiscord | <codic> socket_path = `const socket_path = "./socket"` |
20:17:26 | FromDiscord | <codic> (edit) "char]](socket_path)β΅`?is" => "char]](socket_path)` is" |
20:17:29 | FromDiscord | <ElegantBeef> `socket_path[0]` might be fine |
20:17:33 | FromDiscord | <ElegantBeef> (edit) "`socket_path[0]`" => "`socket_path[0].addr`" |
20:17:39 | FromDiscord | <ElegantBeef> Depends on what you're doing and where you're sending it |
20:17:53 | FromDiscord | <codic> "expression has no address" |
20:18:03 | FromDiscord | <ElegantBeef> It's a const, they're unaddressable |
20:18:10 | FromDiscord | <codic> var instead ? |
20:18:14 | FromDiscord | <ElegantBeef> `let` π |
20:18:32 | FromDiscord | <codic> let var const |
20:18:56 | FromDiscord | <codic> so, addr doesnt work |
20:19:11 | FromDiscord | <codic> but unsafeAddr gives me `got ptr char but expected array[0..107,char]` |
20:19:45 | FromDiscord | <ElegantBeef> Probably better to just make the array and copy mem |
20:20:52 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=3pRs |
20:20:56 | FromDiscord | <ElegantBeef> As so |
20:21:39 | FromDiscord | <codic> ah yes, this is what I wished to do |
20:21:43 | FromDiscord | <codic> translating strncpy |
20:22:27 | FromDiscord | <ElegantBeef> Yea i'm not someone that's written much C/C++ so that wasnt clear what `strncpy` meant π |
20:22:53 | FromDiscord | <codic> basically the same thing |
20:23:11 | FromDiscord | <codic> `char strncpy(char dest, char const src, size_t n)` iirc |
20:23:43 | FromDiscord | <ElegantBeef> Time to use magic to make this a very usable alternative |
20:27:26 | FromDiscord | <codic> interesting |
20:27:49 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=3pRt |
20:28:19 | FromDiscord | <ElegantBeef> Aw shit that doesnt work for reference objects, shit! |
20:31:17 | FromDiscord | <codic> whoa is this new |
20:31:22 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pRw |
20:31:30 | FromDiscord | <ElegantBeef> Yea too many "Nim is slow" comments |
20:31:34 | FromDiscord | <codic> lol |
20:31:52 | FromDiscord | <codic> In reply to @ElegantBeef "Aw shit that doesnt": why are you trying to rewrite strncpy |
20:32:07 | FromDiscord | <codic> concepts are cool |
20:32:09 | FromDiscord | <ElegantBeef> I'm not |
20:32:13 | FromDiscord | <codic> i do not get them |
20:32:17 | FromDiscord | <ElegantBeef> I'm just abusing concepts to make a somewhat reusable version |
20:32:23 | FromDiscord | <ElegantBeef> Concepts are user defined duck typing |
20:32:37 | FromDiscord | <codic> i know what they are, I don't get the syntax |
20:32:48 | FromDiscord | <ElegantBeef> Well the new concepts are easier |
20:33:44 | FromDiscord | <codic> i don't even know what that x is supposed to represent |
20:33:46 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pRy |
20:33:48 | FromDiscord | <ElegantBeef> concept |
20:34:07 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pRz |
20:34:09 | FromDiscord | <ElegantBeef> they're instances of the concept afaik |
20:34:12 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @codic "`char* strncpy(char* dest, char": 3 pointers, OOF |
20:34:55 | * | omnigoat left #nim (#nim) |
20:34:58 | FromDiscord | <codic> whats wrong with that |
20:35:12 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pRA |
20:35:20 | FromDiscord | <codic> it quits at the `bindSocket failed` |
20:35:21 | FromDiscord | <codic> (edit) "https://play.nim-lang.org/#ix=3pRA" => "https://play.nim-lang.org/#ix=3pRB" |
20:35:22 | FromDiscord | <codic> lemme check errn |
20:35:23 | FromDiscord | <codic> (edit) "errn" => "errno" |
20:35:29 | FromDiscord | <codic> ok that makes far more sense |
20:35:32 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3pRD |
20:35:46 | FromDiscord | <ElegantBeef> so does using typedesc π |
20:36:16 | FromDiscord | <codic> i had it open from an old thing |
20:36:18 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pRE |
20:36:19 | FromDiscord | <ElegantBeef> due to the fact `type(100)` is int seeing `type int` is jussut ugh |
20:36:27 | FromDiscord | <codic> it works, yay |
20:37:18 | FromDiscord | <ElegantBeef> Probably should do `min(socketPath.len, address.sunpath.len)` just for safety |
20:37:31 | FromDiscord | <codic> https://play.nim-lang.org/#ix=3pRF C/Posix unix socket server in nim if anyone needs it |
20:37:34 | FromDiscord | <codic> oh where? |
20:37:40 | FromDiscord | <ElegantBeef> in the copy mem |
20:37:58 | FromDiscord | <ElegantBeef> You need a check for if string is longer than path rather |
20:38:14 | FromDiscord | <ElegantBeef> Cause if the sunpath is 10 and the string is 20 you want to error |
20:38:26 | FromDiscord | <ElegantBeef> so do `assert address.sunPath >= socket_path |
20:38:27 | FromDiscord | <ElegantBeef> (edit) "socket_path" => "socket_path`" |
20:38:39 | FromDiscord | <codic> the posix module is very inconsistent with the C one, I need to submit some PRs |
20:38:40 | FromDiscord | <codic> yes true |
20:39:04 | FromDiscord | <codic> sunpath is always 108 on linux, I think other posixes too, and I have it hardcoded, but it never hurts... |
20:39:29 | FromDiscord | <ElegantBeef> Sure but socketpath could be 109 π |
20:39:35 | FromDiscord | <codic> In reply to @ElegantBeef "so do `assert address.sunPath": you meant the `.len` right? |
20:39:40 | FromDiscord | <ElegantBeef> yes |
20:40:11 | FromDiscord | <codic> https://play.nim-lang.org/#ix=3pRH fixed |
20:40:33 | FromDiscord | <codic> it's not very nice how i have to do these casts and it's completely inconsistent |
20:40:44 | FromDiscord | <codic> in C there is no such type as SocketHandle |
20:40:50 | FromDiscord | <codic> i dont see the need for that abstraction in the first place |
20:41:15 | FromDiscord | <ElegantBeef> So you dont accidently pass a wrong int to do socket logic |
20:41:25 | FromDiscord | <ElegantBeef> The entire point of the type system is to protect you fuck fuckups π |
20:42:07 | FromDiscord | <ElegantBeef> (edit) "fuck" => "from" |
20:42:11 | FromDiscord | <codic> yeah but then you end up casting everything anyways |
20:42:25 | FromDiscord | <codic> not a problem with having the abstraction, it's that half the functions use it and half don't |
20:43:04 | FromDiscord | <ElegantBeef> you dont cast socket once |
20:44:03 | FromDiscord | <ElegantBeef> Also isnt that cast from `SockAddrUn` to `SockAddr` dangerous due to the one using a path and the other using an address? |
20:44:39 | FromDiscord | <ElegantBeef> Also you dont need to cast that `address.sizeof` you can do `address.sizeof.cuint` |
20:45:18 | FromDiscord | <codic> sockaddr is basically a sort of interface for all the sockaddr types in C, it's the only way to do it in C, don't ask me how it works because i have no idea but that's what you do in C |
20:45:21 | FromDiscord | <ElegantBeef> same with line 28 just do `cl.cint` |
20:45:23 | FromDiscord | <codic> In reply to @ElegantBeef "Also you dont need": thanks that makes it cleaner |
20:45:30 | FromDiscord | <codic> 25 too? |
20:45:34 | FromDiscord | <ElegantBeef> yea |
20:46:01 | FromDiscord | <codic> ok now it looks just fine |
20:46:06 | FromDiscord | <codic> way cleaner than the C lol |
20:46:31 | FromDiscord | <ElegantBeef> Congrats, this is the benefit of distinct, you can ensure it's only usable in specific places and can always convert to the distinct base if needed |
20:46:36 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pRJ |
20:47:05 | FromDiscord | <ElegantBeef> And since distinct is just a type system thing, the conversion is free |
20:47:23 | FromDiscord | <codic> why can't I use AF_UNIX for sun_family? I found that a bit odd too because that's the only place you would use it and I have to do like AF_UNIX.cushort |
20:47:39 | FromDiscord | <ElegantBeef> it's an i32 |
20:48:11 | FromDiscord | <ElegantBeef> i32 doesnt implictly convert to cushort |
20:48:20 | FromDiscord | <ElegantBeef> a u16 should though |
20:48:36 | FromDiscord | <codic> idk |
20:48:38 | FromDiscord | <ElegantBeef> !eval var a: cushort = 3123u16 |
20:48:40 | NimBot | <no output> |
20:48:46 | FromDiscord | <codic> I'm just wondering why it is defined like that |
20:48:47 | FromDiscord | <ElegantBeef> Yep works fine |
20:49:07 | FromDiscord | <ElegantBeef> What's AFUnix in C? |
20:49:17 | FromDiscord | <ElegantBeef> And what is TSaFamily in C? |
20:51:35 | FromDiscord | <ElegantBeef> I bet the first is 32bit and the second is 16bit unsigned(i actually know this is) π |
20:52:13 | FromDiscord | <ElegantBeef> So that's why Nim has them the same type as their C counterparts, and as such you cannot implictly cast a 32bit to 16bit due to possible loss of information |
20:52:16 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pRL |
20:54:01 | FromDiscord | <codic> iirc there is no tsa family |
20:54:13 | FromDiscord | <codic> i can't find one |
20:54:24 | FromDiscord | <ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/853739101777428490/unknown.png |
20:54:36 | FromDiscord | <codic> ohh it's sa_family_t |
20:54:40 | FromDiscord | <codic> I always get confused by the `T` |
20:54:52 | FromDiscord | <codic> yeah it's type is ushort |
20:54:57 | FromDiscord | <ElegantBeef> Seems it was an accidental inclusion of `type sa_family_t` |
20:55:20 | FromDiscord | <ElegantBeef> Cause ya that T shouldnt exist |
20:55:37 | FromDiscord | <ElegantBeef> A lot of the posix wrapped stuff has a prefix char though |
20:55:38 | FromDiscord | <codic> type shuld be called Sa_Family? |
20:55:46 | FromDiscord | <codic> yeah probably auto generated |
20:56:02 | FromDiscord | <ElegantBeef> Yea probably just be called that |
20:56:24 | FromDiscord | <ElegantBeef> Anywho hopefully that explained why i'm going to go now, go email someone with your next issues π |
20:57:41 | FromDiscord | <codic> lol |
20:57:43 | FromDiscord | <codic> cya |
21:00:17 | * | yashi joined #nim |
21:00:31 | * | yashi quit (Remote host closed the connection) |
21:03:14 | * | theelous3 joined #nim |
21:40:56 | * | theelous3_ joined #nim |
21:43:00 | * | kaliy joined #nim |
21:46:14 | * | kali___ quit (Ping timeout: 258 seconds) |
21:46:15 | * | johnnynitwits quit (Ping timeout: 258 seconds) |
21:46:16 | * | theelous3 quit (Ping timeout: 258 seconds) |
21:48:02 | * | johnnynitwits joined #nim |
21:52:20 | FromDiscord | <greenb1ade> I have a question since I done quite understand how nim actually works. Does nim compile only to other languages or does it have its own compiler that can compile directly to byte code like c/c++? |
21:52:53 | FromDiscord | <codic> the official compiler compiles to C, C++, Javascript, and Objective C, which can be compiled into other languages |
21:53:04 | FromDiscord | <codic> nlvm uses llvm instead |
21:53:24 | FromDiscord | <ElegantBeef> Nim uses established languages as backends which benefits it tremendously |
21:54:16 | FromDiscord | <konsumlamm> to be clear, you don't have to compile the generated C code yourself, the nim compiler does that |
21:54:48 | FromDiscord | <ElegantBeef> ^ If you used choosenim to install it, you could actually live in ignorance that it's C under the hood π |
21:56:29 | FromDiscord | <greenb1ade> Alright thanks I just wanted to know, since I use c++ quite often and want to integrate vim and c++ into a project |
21:56:38 | FromDiscord | <ElegantBeef> You mean Nim? π |
21:56:54 | FromDiscord | <greenb1ade> Yeah nim sorry autocorrect |
21:57:09 | FromDiscord | <ElegantBeef> You know when nim is auto corrected to vim, you live in hell |
21:57:18 | FromDiscord | <greenb1ade> xD |
22:00:07 | FromDiscord | <codic> integrate Vimscript into your C++ project |
22:00:11 | FromDiscord | <codic> add some nim too |
22:00:36 | FromDiscord | <ElegantBeef> Well paravim exists, no clue if it supports vimscript π |
22:01:10 | * | D_ left #nim ("π¨") |
22:10:22 | FromDiscord | <codic> paravim is cool |
22:10:32 | FromDiscord | <codic> font rendering sucks tho |
22:11:40 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=3pSk |
22:11:44 | FromDiscord | <Bung> Error: 'formatCommon' can have side effects ? |
22:12:13 | FromDiscord | <Bung> why a string format had side effects |
22:12:42 | FromDiscord | <codic> it's probably not the format itself but either getEnv or one of the functions you call in it |
22:13:09 | FromDiscord | <codic> yes getEnv has an effect for one thing |
22:13:10 | FromDiscord | <codic> https://nim-lang.org/docs/os.html#ReadEnvEffect |
22:14:30 | FromDiscord | <ElegantBeef> @treeform ok so turns out we can do `objdump -sj .comment ./path/to/bin` and that will give us the `.comment` section which tends to store the compiler, but still not overly beautiful π |
22:15:23 | FromDiscord | <Bung> hmm then how to solve it? dont use func ? |
22:16:57 | FromDiscord | <Bung> another thing how i trace `':anonymous' is not GC-safe` |
22:17:02 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3pSo |
22:18:02 | FromDiscord | <Bung> but I think your example is about gc safe |
22:18:23 | FromDiscord | <ElegantBeef> Well if something isnt gcsafe you can always annotate the function manually |
22:19:31 | FromDiscord | <Bung> yeah, it show the source |
22:20:46 | * | krux02 joined #nim |
22:20:49 | * | bozaloshtsh quit (Quit: ZNC 1.7.5 - https://znc.in) |
22:20:58 | * | bozaloshtsh joined #nim |
22:20:58 | * | bozaloshtsh quit (Changing host) |
22:20:58 | * | bozaloshtsh joined #nim |
22:22:04 | FromDiscord | <Bung> I use rx-nim it calls next , the closure proc passing seems the problem |
22:25:47 | FromDiscord | <dom96> 2 years and a new httpbeast version is here with the cross-talk issue fixed π |
22:27:59 | FromDiscord | <Bung> great! |
22:32:26 | * | bozaloshtsh quit (Quit: ZNC 1.7.5 - https://znc.in) |
22:32:39 | * | bozaloshtsh joined #nim |
22:32:39 | * | bozaloshtsh quit (Changing host) |
22:32:39 | * | bozaloshtsh joined #nim |
22:36:02 | FromDiscord | <treeform> In reply to @ElegantBeef "<@!107140179025735680> ok so turns": That's a cool find! |
22:37:03 | FromDiscord | <codic> at least it works... |
22:37:05 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pSr |
22:37:18 | * | ZoomZoomZoom quit (Remote host closed the connection) |
22:37:36 | FromDiscord | <codic> i hate this distinction between unsafeAddr and addr and I fully support the proposal of removing the former |
22:39:44 | FromDiscord | <ElegantBeef> cant you just do `len.SockLen.unsafeaddr`? |
22:39:47 | * | ZoomZoomZoom joined #nim |
22:39:51 | FromDiscord | <ElegantBeef> iirc that's an lvalue |
22:40:59 | FromDiscord | <ElegantBeef> guess i'm wrong |
22:42:13 | FromDiscord | <ElegantBeef> Ah not exactly wrongβ΅> The type conversion T(a) is an L-value if a is an L-value and typeEqualsOrDistinct(T, typeof(a)) holds. |
22:42:26 | FromDiscord | <codic> that yields expression has no address |
22:42:32 | FromDiscord | <codic> robably because of the temporary |
22:42:45 | FromDiscord | <ElegantBeef> Yea like i said it's not an Lvalue but some type conversions are |
22:42:50 | FromDiscord | <codic> (edit) "robably" => "probably" |
22:42:52 | FromDiscord | <codic> i see |
22:43:09 | FromDiscord | <ElegantBeef> In the cast it's a 0-cost conversion it's an lvalue |
22:43:14 | FromDiscord | <ElegantBeef> (edit) "cast" => "case" |
22:43:21 | FromDiscord | <codic> yeah I don't have a problem with casting |
22:43:29 | FromDiscord | <codic> I should expect to a lot, I'm writing super C-y nim |
22:43:40 | FromDiscord | <codic> enough to use --gc:none comfortably lol |
22:44:56 | FromDiscord | <ElegantBeef> why dont you just convert `len` into `ucred.sizeof.cuint`? |
22:45:12 | FromDiscord | <ElegantBeef> Then it's just `len.unsafeaddr` |
22:50:54 | FromDiscord | <ElegantBeef> @treeform ok so now i've really solved it `--passL"-no-pie"` disables it so it behaves properly π |
22:58:55 | FromDiscord | <codic> i used .SockLen instead of .cuint jsut to be more clear |
22:58:57 | * | ZoomZoomZoom quit (Ping timeout: 240 seconds) |
22:59:05 | FromDiscord | <codic> but that works yeah thanks |
23:03:39 | FromDiscord | <ElegantBeef> @treeform Well hopefully that PR makes you happy, also replaced `Table[T, int]` with the more purpose build `CountTable` due to that's what you were using it for π |
23:42:59 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3pSx |
23:43:06 | FromDiscord | <codic> i think it's the reason the vscode extension is not working\ |
23:45:49 | FromDiscord | <treeform> In reply to @ElegantBeef "<@!107140179025735680> ok so now": that is quite hidden, probably needs better docs to explain it. |
23:46:08 | FromDiscord | <treeform> In reply to @ElegantBeef "<@!107140179025735680> Well hopefully that": Yeah count table looks great, I should have used it at the start. |
23:46:23 | FromDiscord | <ElegantBeef> Yea i realized last night when i was about to fall asleep "Wait that |
23:46:27 | FromDiscord | <ElegantBeef> (edit) "that" => "that's just a count table"" |
23:49:06 | FromDiscord | <treeform> Have you used hottie to find some hot paths in other code and fix them? |
23:54:23 | FromDiscord | <ElegantBeef> Not yet, spent most of my time recently pulling hair out trying a cleaner method of that linux support |