00:00:01 | * | junland quit (Quit: %ZNC Disconnected%) |
00:02:45 | * | junland joined #nim |
00:05:46 | * | rnrwashere joined #nim |
00:08:45 | * | rnrwashere quit (Remote host closed the connection) |
00:09:57 | * | rnrwashere joined #nim |
00:12:59 | * | sealmove joined #nim |
00:16:07 | FromDiscord | <Varriount> Anyone know of a good tutorial/walkthrough for someone who wants to try NixOS? |
00:18:08 | * | rnrwashere quit (Remote host closed the connection) |
00:23:50 | * | filcuc quit (Ping timeout: 256 seconds) |
00:25:40 | * | rnrwashere joined #nim |
00:31:49 | * | Trustable quit (Remote host closed the connection) |
00:34:13 | * | sealmove quit (Quit: WeeChat 2.7.1) |
00:38:35 | leorize | Varriount: their manual is pretty descriptive |
00:39:15 | leorize | disruptek: I have to sub to look at the vids? :P |
00:39:25 | * | krux02_ joined #nim |
00:41:52 | * | krux02 quit (Ping timeout: 246 seconds) |
00:48:48 | disruptek | leorize: really? |
00:49:09 | leorize | yea it said vid available only to subscribers |
00:49:20 | disruptek | that makes zero sense. |
00:49:36 | leorize | "This video is only available to subscribers. Sub now to watch and support disruptek." |
00:50:59 | disruptek | try it now? |
00:51:24 | disruptek | i just tried toggling a button but it toggled back. might be a ui error. |
00:52:11 | FromDiscord | <Recruit_main707> Still there for me |
00:52:24 | disruptek | idiotic. |
00:52:48 | leorize | same |
00:53:49 | disruptek | maybe it's not under "Only allow subscribers to watch your past broadcasts" but that would blow my mind. |
00:55:41 | disruptek | https://www.twitch.tv/videos/572030955 |
01:05:01 | * | Guest9949 quit (Ping timeout: 264 seconds) |
01:06:37 | * | dadada joined #nim |
01:07:00 | * | dadada is now known as Guest34533 |
01:18:33 | * | PMunch quit (Quit: leaving) |
01:18:38 | * | sleepyqt quit (Ping timeout: 250 seconds) |
01:21:23 | * | rnrwashere quit () |
01:33:34 | * | Guest34533 quit (Ping timeout: 240 seconds) |
01:37:02 | * | dadada joined #nim |
01:37:25 | * | dadada is now known as Guest76399 |
01:50:08 | FromDiscord | <Rika> collect is only nim 1.2 or devel? |
01:50:13 | disruptek | yep. |
01:51:03 | FromDiscord | <Rika> shit |
01:51:04 | FromDiscord | <Rika> okay |
01:58:07 | FromDiscord | <KingDarBoja> How I can check if some object 'x' is of type 'x' |
01:58:18 | FromDiscord | <Rika> x is y |
01:58:19 | FromDiscord | <KingDarBoja> Once again, like in Python uses `isinstance` |
01:58:25 | FromDiscord | <KingDarBoja> Really? |
01:58:26 | FromDiscord | <Rika> i think |
01:58:32 | FromDiscord | <KingDarBoja> Let me check |
01:59:04 | FromDiscord | <Rika> doesnt seem so |
01:59:06 | FromDiscord | <Benumbed> I thought it was ‘of’ |
01:59:25 | FromDiscord | <Rika> its of |
01:59:32 | disruptek | when x is SomeType: |
01:59:40 | disruptek | of is for inheritance checks. |
01:59:54 | FromDiscord | <Benumbed> Ahhhh yep, mb |
02:00:00 | FromDiscord | <Rika> eeee |
02:00:01 | FromDiscord | <Rika> ok |
02:00:05 | FromDiscord | <Benumbed> I've been working with the inheritence stuff a lot of late lol |
02:00:26 | FromDiscord | <Rika> `Checks if T is of the same type as S.` this bamboozled me! |
02:00:26 | FromDiscord | <KingDarBoja> so let x = type rika |
02:00:40 | * | Guest76399 quit (Ping timeout: 250 seconds) |
02:00:50 | FromDiscord | <KingDarBoja> y = some_instance_x |
02:01:01 | FromDiscord | <KingDarBoja> Check should be: `x is type(y)` ? |
02:01:07 | FromDiscord | <Rika> i'm a type now it seems |
02:01:16 | FromDiscord | <Rika> x is typeof y |
02:01:17 | FromDiscord | <Benumbed> I was wondering if you were going to say something about that lol |
02:01:53 | FromDiscord | <Rika> also afaik is works between 2 instances |
02:01:55 | FromDiscord | <KingDarBoja> y should be of type `Rika` |
02:02:08 | FromDiscord | <Rika> oh wow i really am a type now |
02:02:15 | FromDiscord | <KingDarBoja> I got lazy hahaha |
02:02:47 | FromDiscord | <Benumbed> imgur.com/a/SzQpWkN |
02:03:10 | FromDiscord | <Benumbed> bad paste, bad paste! |
02:03:23 | FromDiscord | <Benumbed> https://play.nim-lang.org/#ix=2eUT |
02:03:25 | FromDiscord | <KingDarBoja> ``` |
02:03:25 | FromDiscord | <KingDarBoja> type rika* = object |
02:03:25 | FromDiscord | <KingDarBoja> coolness*: int |
02:03:26 | FromDiscord | <KingDarBoja> sarcasm*: int |
02:03:26 | FromDiscord | <KingDarBoja> |
02:03:26 | FromDiscord | <KingDarBoja> let y = initRika(5, 10) |
02:03:26 | FromDiscord | <KingDarBoja> y is typeof x |
02:03:28 | FromDiscord | <KingDarBoja> ``` |
02:03:33 | FromDiscord | <KingDarBoja> ```nim |
02:03:33 | FromDiscord | <KingDarBoja> type rika* = object |
02:03:35 | FromDiscord | <KingDarBoja> coolness*: int |
02:03:36 | FromDiscord | <KingDarBoja> sarcasm*: int |
02:03:38 | FromDiscord | <KingDarBoja> |
02:03:39 | FromDiscord | <KingDarBoja> let y = initRika(5, 10) |
02:03:41 | FromDiscord | <KingDarBoja> y is typeof x |
02:03:42 | FromDiscord | <KingDarBoja> ``` |
02:03:43 | FromDiscord | <Rika> RIP irc people |
02:03:47 | FromDiscord | <Rika> a multiline paste |
02:03:51 | FromDiscord | <Rika> which was also edited |
02:03:55 | FromDiscord | <Rika> RIP indeed. |
02:04:09 | FromDiscord | <Rika> initRika is not defined 😛 |
02:04:30 | * | FromDiscord <KingDarBoja> Asume it is |
02:05:01 | FromDiscord | <Rika> thats correct yes |
02:05:11 | FromDiscord | <Rika> x is not defined :PPP |
02:05:50 | FromDiscord | <KingDarBoja> arrr |
02:06:00 | FromDiscord | <KingDarBoja> It was actually `y is typeof rika` |
02:06:59 | FromDiscord | <Rika> ah |
02:06:59 | * | dadada__ joined #nim |
02:07:01 | FromDiscord | <KingDarBoja> Nope, doesnt work |
02:07:02 | FromDiscord | <Rika> if x is not defined |
02:07:03 | FromDiscord | <KingDarBoja> `Error: 'typedesc' metatype is not valid here; typed '=' instead of ':'` |
02:07:06 | FromDiscord | <Rika> its just y is rika |
02:07:30 | FromDiscord | <KingDarBoja> Ah |
02:07:38 | FromDiscord | <Benumbed> @KingDarBoja Like so https://play.nim-lang.org/#ix=2eUT |
02:08:48 | FromDiscord | <Benumbed> (I just used a Stream as an example type) |
02:09:25 | FromDiscord | <Rika> you sure love your streams |
02:09:37 | FromDiscord | <Benumbed> Well I'm using them a lot right now 😄 |
02:10:09 | disruptek | https://play.nim-lang.org/#ix=2eUW |
02:10:11 | FromDiscord | <KingDarBoja> And what if I want to check the type by extracting it from another instance? |
02:10:16 | FromDiscord | <Benumbed> Writing a network client, so I grab a bunch of data from the socket, shhove it in a stream and that gives me some nice utility functions |
02:10:21 | FromDiscord | <Rika> typeof theinstance |
02:10:37 | FromDiscord | <Rika> sh hove |
02:10:54 | FromDiscord | <KingDarBoja> Nope |
02:10:57 | disruptek | `is` is often code smell, though. |
02:11:20 | FromDiscord | <Benumbed> disruptek: Sheer curiosity, why add the when? |
02:11:38 | disruptek | because it's a compile-time operation. |
02:11:38 | FromDiscord | <KingDarBoja> Let x and y be of the same type, `Rika` |
02:11:57 | FromDiscord | <KingDarBoja> How it should be? `x is typeof y` ? or `x is typeof(y)` |
02:12:21 | FromDiscord | <Benumbed> vs something like `if a is Stream` which would be runtime evaluation? |
02:12:37 | disruptek | it wouldn't be. that's the point. |
02:12:47 | FromDiscord | <Rika> @KingDarBoja same thing |
02:13:04 | FromDiscord | <Rika> remember, UFCS |
02:13:11 | FromDiscord | <KingDarBoja> UFCS? |
02:13:20 | FromDiscord | <Rika> https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax |
02:13:20 | FromDiscord | <Benumbed> Okay I don't understand, but I'm not all here atm anyway |
02:13:34 | disruptek | `is` is a compile-time test. |
02:13:39 | FromDiscord | <Rika> f(a) == a.f() == a.f == f a |
02:13:51 | FromDiscord | <Benumbed> okay but how does that releate to you adding `when`? |
02:14:00 | FromDiscord | <Rika> when is a compile-time if |
02:14:03 | disruptek | when is a compile-time version of `if`. |
02:14:10 | FromDiscord | <Rika> you cannot if when you use is |
02:14:24 | FromDiscord | <Benumbed> ahhah, thank you both 🙂 |
02:14:32 | FromDiscord | <KingDarBoja> And now I got confused... |
02:14:48 | FromDiscord | <Rika> where are you confused |
02:14:52 | FromDiscord | <Rika> what are you confused by |
02:14:55 | FromGitter | <awr1> what is nimph? |
02:15:03 | disruptek | !repo nimph |
02:15:04 | disbot | https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 54⭐ 3🍴 7& 1 more... |
02:15:05 | FromDiscord | <KingDarBoja> Check if two instances have the same type lol |
02:15:15 | FromDiscord | <KingDarBoja> So `typeof(x) == typeof(y)` right? |
02:15:16 | FromDiscord | <Rika> disruptek is pinged by the mere mention of nimp |
02:15:18 | FromDiscord | <Rika> nimph |
02:15:30 | FromDiscord | <Rika> i think that works, sure |
02:16:06 | FromDiscord | <KingDarBoja> `Error: 'typedesc' metatype is not valid here; typed '=' instead of ':'` wtf? |
02:16:07 | FromDiscord | <Rika> it doesnt work |
02:16:07 | FromDiscord | <Rika> lmao |
02:16:16 | FromDiscord | <Rika> use x is typeof y |
02:16:21 | FromDiscord | <Rika> theres no == for typedesc |
02:16:23 | FromDiscord | <Rika> it seems |
02:17:07 | FromDiscord | <KingDarBoja> Nope doesn't work, same error |
02:17:32 | disruptek | what is it you are trying to do? |
02:17:36 | FromDiscord | <Rika> can you put your code in playground |
02:17:40 | FromDiscord | <KingDarBoja> Hold on |
02:17:45 | FromDiscord | <Rika> i feel like the error is from some other line |
02:18:05 | disruptek | i feel like i need some ointment. |
02:18:16 | FromDiscord | <Rika> get some then |
02:18:32 | FromGitter | <awr1> ah so nimph is an extended nimble? kind of? |
02:19:03 | disruptek | it will be a nimble replacement eventually. i'm working on the compiler at the moment. |
02:19:41 | disruptek | there's stuff you can do with nimph+nim that you cannot do with nimble+nim, basically. |
02:19:45 | FromGitter | <awr1> i see |
02:20:02 | disruptek | local deps, lockfiles, nimblePaths, etc. |
02:20:19 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2eV2 |
02:20:21 | FromDiscord | <Rika> is it stable right now |
02:20:32 | FromDiscord | <Rika> because that sounds like something id use |
02:20:50 | disruptek | pretty stable, though the compiler may have broken it a little in 1.2. |
02:21:18 | FromDiscord | <Rika> isnt check runtime |
02:21:23 | FromDiscord | <Rika> is unittest.check runtime? |
02:21:30 | FromDiscord | <Rika> ofc it is |
02:21:30 | disruptek | yes. |
02:21:50 | FromDiscord | <Rika> hmm i wonder what it's doing that's not allowing the code to compule |
02:21:53 | FromDiscord | <Rika> compile |
02:22:32 | disruptek | which code? |
02:22:41 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2eV3 |
02:24:39 | disruptek | https://play.nim-lang.org/#ix=2eV6 |
02:25:24 | leorize | disruptek: for inheritance there's `as` which is a runtime check |
02:25:26 | FromDiscord | <Rika> but the code should work too with typeof no? |
02:25:39 | leorize | but what do you mean by Instance? |
02:25:45 | FromDiscord | <KingDarBoja> So I have to export Location too? I expected it to work with typeof |
02:25:56 | disruptek | yeah, they're trying to use `is`. |
02:26:08 | FromDiscord | <KingDarBoja> Instance is source variable |
02:26:09 | leorize | like "string" != "string" because they point to different addresses or something? |
02:26:19 | FromDiscord | <KingDarBoja> Whatever object is created from the initX |
02:26:28 | disruptek | Source.locationOffset, then. |
02:26:36 | FromDiscord | <KingDarBoja> Yup |
02:26:46 | disruptek | so use that. Note the capitalization. |
02:27:38 | FromDiscord | <KingDarBoja> Wait what!? |
02:27:58 | FromDiscord | <KingDarBoja> `Source` is the type, source is the instance in this case |
02:28:09 | FromDiscord | <KingDarBoja> Maybe if I rename it, it would be clear |
02:28:13 | disruptek | look dude, wtf are you trying to accomplish? |
02:28:44 | FromDiscord | <Rika> whats wrong with disruptek's solution |
02:29:05 | disruptek | it's pointless, but maybe that's the problem. |
02:29:06 | FromDiscord | <Rika> and why are you checking the type on runtime |
02:29:11 | FromDiscord | <KingDarBoja> I didn't wanted to export the Location type, that's what I mean |
02:29:12 | FromDiscord | <Rika> theres no reason to |
02:29:20 | FromDiscord | <Rika> the compiler will complain if theyre the wrong type anyway |
02:29:24 | disruptek | what does the export have to do with anything? |
02:29:39 | FromDiscord | <Rika> why do you need to make the check |
02:30:05 | * | dadada__ quit (Ping timeout: 246 seconds) |
02:30:59 | FromDiscord | <KingDarBoja> just curious about if there is some way to check if two instances have the same type, but maybe as you guys said, it is pointless |
02:31:07 | FromDiscord | <KingDarBoja> two objects* |
02:31:25 | FromDiscord | <Rika> there is a way, on compile time |
02:31:28 | FromDiscord | <Rika> this isnt python |
02:31:42 | FromDiscord | <KingDarBoja> I know, that's why I got confused while trying to ask |
02:31:44 | FromDiscord | <Rika> you dont usually need to make checks like this |
02:31:51 | FromDiscord | <Rika> - |
02:31:59 | FromDiscord | <Rika> maybe in python you do but here you dont |
02:32:06 | FromDiscord | <Benumbed> Where we're going Marty, we don't need type checks |
02:32:20 | FromDiscord | <Benumbed> (I'm sorry I couldn't resist) |
02:32:26 | FromDiscord | <Rika> lol |
02:32:33 | FromDiscord | <KingDarBoja> I understood that reference lol |
02:33:12 | FromDiscord | <Benumbed> I wish Discord would stop chewing CPU time on my laptop |
02:33:18 | FromDiscord | <Rika> ikr |
02:33:23 | FromDiscord | <Benumbed> it's making things all hot and noisy 😦 |
02:33:31 | FromDiscord | <Rika> there's Ripcord |
02:33:47 | FromDiscord | <Rika> then also the 3rd party cli i think |
02:33:48 | FromDiscord | <Rika> dunno the name |
02:33:55 | FromDiscord | <Rika> you can also always move to irc |
02:34:29 | FromDiscord | <Benumbed> I put my time in, in the IRC trenches, I honestly like the Discord/Slack-style experience more |
02:35:22 | FromDiscord | <Benumbed> I say lets bring back ICQ.... /s |
02:35:47 | FromDiscord | <Rika> what are you 30 years old |
02:36:12 | FromDiscord | <KingDarBoja> lol |
02:36:40 | FromDiscord | <Benumbed> Worse Rika, worse |
02:36:57 | * | dadada joined #nim |
02:37:04 | FromDiscord | <Benumbed> Leading edge of Millienal time-frame :/ |
02:37:20 | * | dadada is now known as Guest85317 |
02:37:34 | FromDiscord | <Rika> uh |
02:37:35 | FromDiscord | <Rika> dunno that |
02:38:27 | FromDiscord | <Benumbed> Millenials are the group that were graduating high-school and moving into the workforce around 2000 |
02:38:46 | FromDiscord | <Rika> i know millenials i just dont know the time frame |
02:38:49 | FromDiscord | <Rika> hmm |
02:38:57 | FromDiscord | <Rika> i'm in gen z i think? |
02:39:12 | * | chemist69 quit (Ping timeout: 260 seconds) |
02:39:15 | FromDiscord | <Benumbed> If you're saying things like 'what are you 30 years old' yeah you're a Zed 😄 |
02:39:30 | FromDiscord | <Rika> fuck ya |
02:39:41 | FromDiscord | <KingDarBoja> Ok used the disruptek solution |
02:40:15 | FromDiscord | <KingDarBoja> Once again, not used to think like that, I mean, I forget this language has compiler checks and runtime checks |
02:40:24 | FromDiscord | <KingDarBoja> I forgot* |
02:40:43 | * | chemist69 joined #nim |
02:40:53 | disruptek | if you don't need it, the code will compile and run faster if there is less of it. remove it. |
02:41:26 | FromDiscord | <Benumbed> @KingDarBoja Is Nim your first statically-typed language? |
02:41:37 | FromDiscord | <KingDarBoja> Does TypeScript counts? |
02:42:02 | FromDiscord | <Benumbed> Having never used it, I have no idea haha |
02:43:57 | FromDiscord | <KingDarBoja> lol |
02:45:22 | FromDiscord | <Rika> typescript semi counts |
02:45:24 | FromDiscord | <Rika> not really |
02:45:25 | FromDiscord | <KingDarBoja> The problem is that you can confuse the compiler by specifying the type as `any` and that's it, you have no idea if the property has the correct type |
02:45:26 | FromDiscord | <Rika> no i dont think so |
02:45:44 | FromDiscord | <Rika> you cannot give a variable an "Any" here afai |
02:45:45 | FromDiscord | <Rika> afaik |
02:46:10 | FromDiscord | <KingDarBoja> Yeah, that's why I got confused at first trying to check the type between instances but screw that |
02:46:17 | FromDiscord | <Rika> no need to 😛 |
02:46:27 | FromDiscord | <Benumbed> oy, `any` gives me flashbacks to boost::any 😦 |
02:46:41 | FromDiscord | <KingDarBoja> Don't get mad at me 🙈 |
02:46:55 | FromDiscord | <Rika> @Benumbed nim allows for `auto`, have fun with that |
02:46:56 | FromDiscord | <Benumbed> I'm not mad... |
02:47:04 | FromDiscord | <KingDarBoja> Just saying lol |
02:47:15 | FromDiscord | <Benumbed> I'm ok with `auto`, just `any` gives me hives 😄 |
02:47:20 | FromDiscord | <Rika> auto isnt AS bad as any, but i still think its horrible |
02:47:51 | FromDiscord | <Rika> i came from python to stop guessing types, please no auto ;; |
02:47:55 | FromDiscord | <KingDarBoja> By the way, I just created two tests files inside the tests folder and had to specify them at nimble task |
02:48:06 | FromDiscord | <KingDarBoja> Looool |
02:48:33 | FromDiscord | <Rika> tests must start with `t` |
02:48:35 | disruptek | auto gives you a way to use a type that isn't exported. |
02:48:43 | FromDiscord | <Rika> if not they wont run when `nimble test` |
02:49:01 | FromDiscord | <Rika> disruptek that sounds uh, dangerous |
02:49:04 | FromDiscord | <KingDarBoja> I named both `test_a` and `test_b` |
02:49:15 | FromDiscord | <Benumbed> disruptek: will nimph support `test` like nimble does? And if so, will it recurse into directories under your test dir? |
02:49:23 | FromDiscord | <KingDarBoja> (Got lucky It seems) |
02:49:39 | FromDiscord | <Benumbed> Sounds like `auto` works the same way it does in C++ |
02:49:49 | disruptek | if you want to run nimble's default test methodology, just run `nimble test`. nimph doesn't care. |
02:49:56 | FromDiscord | <KingDarBoja> Hey hey that's my current question, it is possible (with nimble) to just discover all tests without having to specify each file? |
02:50:00 | disruptek | else, use testament or testutils if you want to recurse. |
02:50:28 | FromDiscord | <Benumbed> testament looked like something I didn't want to spend tons of time on |
02:50:29 | FromDiscord | <Rika> ive never needed to specify a test file |
02:50:32 | FromDiscord | <KingDarBoja> Currently doing: |
02:50:32 | FromDiscord | <KingDarBoja> ```nim |
02:50:32 | FromDiscord | <KingDarBoja> task test, "Runs the test suite": |
02:50:32 | FromDiscord | <KingDarBoja> exec "nim c -r tests/dirA/test_x" |
02:50:33 | FromDiscord | <KingDarBoja> exec "nim c -r tests/dirA/test_y" |
02:50:33 | FromDiscord | <KingDarBoja> ``` |
02:50:35 | FromDiscord | <Benumbed> like it was more for the Nim core devs |
02:50:42 | FromDiscord | <Rika> run `nimble test` |
02:50:51 | FromDiscord | <Benumbed> Yep King just demonstrated what I'm talking about |
02:50:57 | FromDiscord | <Rika> ah its in a dir |
02:51:04 | FromDiscord | <Benumbed> nimble does not support subdirs under your tests dir |
02:51:04 | * | FromDiscord <KingDarBoja> in a subdir |
02:51:14 | FromDiscord | <Rika> testament docs where |
02:51:15 | FromDiscord | <KingDarBoja> and there are going to be several of them... |
02:51:17 | FromDiscord | <KingDarBoja> WHAT? |
02:51:21 | FromDiscord | <Rika> im asking |
02:51:27 | disruptek | docs/contributing.rst |
02:51:36 | disruptek | er, doc/ i think. |
02:52:40 | * | FromDiscord <KingDarBoja> insert panic meme |
02:54:35 | FromDiscord | <Benumbed> Hmm testutils is from Status |
02:54:52 | FromDiscord | <Benumbed> That's the third time they've come up |
02:55:18 | FromDiscord | <KingDarBoja> Well well well I will stick into specifying all my tests inside subdirs |
02:55:22 | * | FromDiscord <KingDarBoja> kill me pls |
02:55:32 | FromDiscord | <Rika> i mean Status is the biggest company sponsoring Nim |
02:55:49 | FromDiscord | <Benumbed> @KingDarBoja just use testutils, it looks like they recurse |
02:55:58 | FromDiscord | <KingDarBoja> Searching, hold on... |
02:55:59 | FromDiscord | <Benumbed> among other things, I shall be pulling this down |
02:56:04 | FromDiscord | <Benumbed> https://github.com/status-im/nim-testutils |
02:56:15 | disruptek | it does. i'm the dude that moved it from chronicles into its own project. |
02:56:30 | FromDiscord | <Benumbed> disruptek: Do you work for Status? |
02:56:42 | disruptek | i did a bounty for them. |
02:56:57 | FromDiscord | <Benumbed> Ahh cool |
02:57:37 | FromDiscord | <Rika> chronicles is great |
03:00:28 | * | Guest85317 quit (Ping timeout: 250 seconds) |
03:01:30 | FromDiscord | <KingDarBoja> Okay just installed it, what now? Does nimble has a specific section on yourproject.nimble file for dev only dependencies? Or it should be added as `requires` |
03:01:59 | disruptek | requires |
03:02:12 | * | FromDiscord <KingDarBoja> oh crap |
03:02:13 | FromDiscord | <KingDarBoja> Ok |
03:02:28 | FromDiscord | <Rika> does nimph have dev only deps? |
03:03:12 | disruptek | it supports that via support for sub-packages, but no one can agree on how to do developmental deps. |
03:04:51 | shashlick | is it possible to get the AST of some code after it is evaluated |
03:05:31 | disruptek | you mean codegen'd? |
03:05:51 | shashlick | yes - like I run a parseStmt("const A = 1") and get the AST of the const |
03:06:07 | shashlick | basically looking at https://github.com/nimterop/nimterop/issues/127 |
03:06:07 | disbot | ➥ [Feature] Option to dump debug in a file |
03:06:31 | shashlick | and am thinking of a macro that lets all nimterop ops run and at the end, get the resulting code and dump that to a file |
03:06:54 | * | dadada__ joined #nim |
03:07:05 | disruptek | you could do that pretty easily, i think. |
03:07:16 | disruptek | just expandMacros: somemacro: some normal code |
03:07:31 | shashlick | there's getAst() but doesn't do what i want |
03:07:40 | FromDiscord | <KingDarBoja> Btw @Benumbed the installed version of testutils is 0.1.1 but the latest on GitHub is 0.2.0 |
03:09:06 | * | tiorock joined #nim |
03:09:06 | * | tiorock quit (Changing host) |
03:09:06 | * | tiorock joined #nim |
03:09:06 | * | rockcavera is now known as Guest94448 |
03:09:06 | * | Guest94448 quit (Killed (livingstone.freenode.net (Nickname regained by services))) |
03:09:06 | * | tiorock is now known as rockcavera |
03:09:32 | FromDiscord | <KingDarBoja> Also ran `testrunner tests` and got `no tests files found` 😢 |
03:09:36 | disruptek | shashlick: what's the output you want? |
03:09:51 | disruptek | king: it uses a .test format that's different. rtfm. |
03:10:02 | * | krux02_ quit (Remote host closed the connection) |
03:10:29 | FromDiscord | <KingDarBoja> Arrrgh |
03:10:33 | shashlick | https://play.nim-lang.org/#ix=2eVi |
03:10:46 | shashlick | running that and looking at the debug output, you just see the parseStmt() as is |
03:10:56 | shashlick | instead, i want to get the const A = 1 |
03:11:20 | disruptek | oh, as ast? |
03:11:44 | shashlick | basically, I want to create a `cOutput(file: static[string], body: untyped): untyped =` macro that is called at the top of a nimterop file which will write the rendered wrapper to that file |
03:12:42 | disruptek | what form does the rendered wrapper have? |
03:12:50 | disruptek | this is still running outside of the vm, right? |
03:14:51 | disruptek | it sounds like what i do with openapi, but i dunno -- you tend to make this much harder because it's outside the vm... |
03:20:32 | shashlick | Still in the vm |
03:20:42 | shashlick | Toast already can write to file |
03:21:04 | shashlick | It's the cimport part that I want to render and write to file |
03:21:14 | shashlick | Along with any other getHeader code |
03:22:40 | disruptek | why is it in the form of a string? |
03:27:34 | shashlick | Which part |
03:28:13 | shashlick | cImport calls toast which returns the code as a string which is then loaded using parseStmt |
03:28:41 | shashlick | I could always just save that but you also need the other stuff around the cimport |
03:30:19 | * | dadada__ quit (Ping timeout: 250 seconds) |
03:36:56 | * | dadada joined #nim |
03:37:19 | * | dadada is now known as Guest73358 |
03:42:30 | * | dddddd quit (Remote host closed the connection) |
03:53:50 | FromDiscord | <KingDarBoja> Last question of the day: How do I check if a error is raised on unittest? |
03:54:45 | disruptek | expect |
03:55:30 | FromDiscord | <KingDarBoja> 👍 |
03:56:53 | * | muffindrake quit (Ping timeout: 246 seconds) |
03:59:27 | * | muffindrake joined #nim |
03:59:42 | * | sealmove joined #nim |
04:00:23 | * | Guest73358 quit (Ping timeout: 246 seconds) |
04:02:25 | * | chemist69 quit (Ping timeout: 246 seconds) |
04:02:50 | * | chemist69 joined #nim |
04:03:27 | FromDiscord | <Winton> I want to develop a chat |
04:06:57 | * | dadada__ joined #nim |
04:30:08 | * | dadada__ quit (Ping timeout: 246 seconds) |
04:36:58 | * | dadada__ joined #nim |
04:43:00 | * | tefter joined #nim |
04:47:29 | * | rockcavera quit (Remote host closed the connection) |
04:55:15 | * | rmt joined #nim |
04:59:54 | * | dadada__ quit (Ping timeout: 240 seconds) |
05:06:52 | * | dadada joined #nim |
05:07:16 | * | dadada is now known as Guest2313 |
05:30:24 | * | Guest2313 quit (Ping timeout: 250 seconds) |
05:36:53 | * | dadada__ joined #nim |
05:57:23 | * | gangstacat quit (Quit: Ĝis!) |
05:59:54 | * | dadada__ quit (Ping timeout: 240 seconds) |
06:01:22 | * | gangstacat joined #nim |
06:06:56 | * | dadada joined #nim |
06:07:20 | * | dadada is now known as Guest26080 |
06:09:07 | * | nsf joined #nim |
06:16:48 | rmt | Hm.. I'm hoping this is simple, but I suspect I have some fundamental misunderstanding.. https://gist.github.com/rmt/ccaffc4e44fa52485c103756974fe16e .. that snippet results in a runtime error: invalid object assignment [ObjectAssignmentError] |
06:21:34 | rmt | I suspect that I need to return a ref MidiMsg to instead return a subclass of MidiMsg, as memory was probably pre-allocated for the return time... that it compiles in the first place makes me wonder, though. |
06:25:29 | FromDiscord | <Rika> `ref object of` usually works better than `object of` is all i know |
06:30:32 | * | Guest26080 quit (Ping timeout: 246 seconds) |
06:34:38 | rmt | Indeed, s/object of/ref object of/g makes a difference. Is this a compiler bug (in 1.0.2) that it even compiles? |
06:36:57 | * | dadada__ joined #nim |
06:37:31 | leorize | rmt: it's a future |
06:37:34 | leorize | feature* |
06:37:40 | rmt | :) |
06:37:52 | * | solitudesf joined #nim |
06:40:22 | * | arecaceae quit (Remote host closed the connection) |
06:40:45 | * | arecaceae joined #nim |
06:42:21 | leorize | disruptek: I can't seem to find the part of the vid where there's a pragma alignment problem... |
06:54:54 | leorize | disruptek: wait are you complaining about pragma aligning with the '('? |
06:55:09 | leorize | that's always been a feature |
06:55:18 | leorize | guess it finally works this time around :P |
06:56:14 | leorize | disruptek: I just followed NEP-1 |
06:56:44 | leorize | so what's your suggestion for this? |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:00:17 | * | dadada__ quit (Ping timeout: 246 seconds) |
07:01:18 | * | Zevv joined #nim |
07:01:27 | Zevv | gm! |
07:04:57 | * | gmpreussner joined #nim |
07:06:54 | * | dadada joined #nim |
07:07:18 | * | dadada is now known as Guest49348 |
07:15:27 | * | nsf quit (Quit: WeeChat 2.7) |
07:23:54 | FromDiscord | <flywind> When I use `jester` to serve static files bigger than 10MB, I got some errors: ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_LENGTH |
07:24:00 | FromDiscord | <flywind> https://github.com/xflywind/test_jester/tree/master |
07:30:49 | * | Guest49348 quit (Ping timeout: 250 seconds) |
07:37:02 | * | dadada__ joined #nim |
07:45:19 | * | couven92 joined #nim |
07:49:20 | * | dadada__ is now known as dadada |
07:49:35 | dadada | has anyone used BOLT with Nim? |
07:49:37 | dadada | https://github.com/facebookincubator/BOLT |
07:49:44 | dadada | "Binary Optimization and Layout Tool - A linux command-line utility used for optimizing performance of binaries" |
07:53:23 | FromDiscord | <Rika> how does that work |
07:53:31 | * | andinus joined #nim |
07:53:40 | dadada | it's all written about on that link |
07:54:06 | FromDiscord | <Rika> what if i didnt wanna click the link HUH |
07:54:08 | FromDiscord | <Rika> i kid |
07:54:18 | * | andinus quit (Remote host closed the connection) |
07:55:02 | dadada | to be useful the tool depends on the layout of the code in the binary, it does need to follow certain patterns, I've no idea how Nim relates to that |
07:57:06 | dadada | https://www.phoronix.com/scan.php?page=news_item&px=Facebook-More-LLVM-Devs |
07:57:30 | dadada | facebook is hiring compiler engineers, sadly they don't seem to have catched the Nim bug (yet) |
08:19:06 | * | rnrwashere joined #nim |
08:25:18 | FromDiscord | <Benumbed> @Rika look what just appeared in my code.... `var value: auto` |
08:25:19 | FromDiscord | <Benumbed> >:> |
08:25:26 | FromDiscord | <Rika> how dare you |
08:25:29 | FromDiscord | <Rika> thats so vague |
08:25:35 | FromDiscord | <Benumbed> hahaha |
08:25:51 | FromDiscord | <Rika> ive never ever ever EVER used auto |
08:26:01 | FromDiscord | <Benumbed> In this case, it's actually really useful because that particular variable is polymorphic and there's no clean way around it |
08:26:08 | FromDiscord | <Rika> hmm |
08:26:18 | FromDiscord | <Rika> i guess that works |
08:30:13 | FromDiscord | <Benumbed> actually NM, I can get rid of it with a variant type |
08:30:16 | FromDiscord | <Benumbed> Just for you |
08:40:54 | FromDiscord | <Rika> bless |
08:49:25 | * | Trustable joined #nim |
09:07:13 | * | rnrwashere quit (Remote host closed the connection) |
09:27:06 | sealmove | does anyone have a tip for how to implement python's @property in Nim? |
09:27:57 | sealmove | I've tried proc field + closure but it seems messy |
09:28:20 | sealmove | also needs overloading of `.` operator which is experimental |
09:32:43 | FromDiscord | <Rika> eh? is it not just a regular proc |
09:33:06 | FromDiscord | <Rika> proc fieldName(self: Class):returnType = discard |
09:33:27 | FromDiscord | <Rika> proc `fieldName=`(self: var Class, val: storeType) = discard |
09:33:35 | FromDiscord | <Rika> sealmove ^ |
09:36:09 | sealmove | the problem is the syntax `myObj.fieldName` doesn't work when `fieldName` is a proc |
09:37:06 | sealmove | you can do `myObj.fieldName()`, yes, but I want to homogeneous syntax between value fields and proc fields |
09:38:55 | sealmove | I could turn all fields into procs and always use `myObj.fieldName()` syntax, but that's meh... |
09:40:14 | FromDiscord | <Rika> it works... |
09:40:22 | FromDiscord | <Rika> ive never had it not work |
09:40:48 | FromDiscord | <Rika> oh it wont work if field name is the same as proc name |
09:40:58 | FromDiscord | <Rika> otherwise it will work |
09:42:55 | sealmove | oh, wait. are you saying I should make a seperate proc? I was doing something like: |
09:43:07 | sealmove | type myType = object |
09:43:22 | sealmove | fieldName: proc(): int |
09:43:28 | FromDiscord | <Rika> what |
09:43:29 | FromDiscord | <Rika> no |
09:43:31 | FromDiscord | <Rika> separate proc |
09:43:37 | FromDiscord | <Rika> it will work then |
09:43:43 | sealmove | ah I see, that should work yes, thanks! |
09:43:59 | FromDiscord | <Rika> just make sure names are different |
09:44:13 | FromDiscord | <Rika> because its not gonna be possible to distinguish if they werent |
10:06:45 | sealmove | other question, in C when I want to make an identifier special, I begin its name with an "_". what's a similar practice for Nim? |
10:10:13 | FromDiscord | <Rika> i use `pSmth` for private |
10:24:35 | dadada | did you know there's a monkey lang implementation in Nim? https://github.com/Kashiwara0205/monkey-nim |
10:24:46 | FromDiscord | <Rika> a what |
10:24:47 | dadada | I don't know for what this would be useful though :-) |
10:25:28 | dadada | it's basically a go interpreter with only a limited featureset |
10:26:33 | dadada | there was a book on how to write a small interpreted language using go, and now everyone is copying that design |
10:26:56 | FromDiscord | <Kenran> Varriount: yeah, I recommend just installing it somewhere (maybe a VM first). It was actually the most pleasant experience from all the distros I tried with getting a slim (that is, no desktop manager) UI with sound and everything to work. It's also extremely easy to play around with, as you can just roll back on any error. |
10:27:42 | lqdev[m] | dadada: that's cool, but not really usable for anything since it uses a tree-walk interpreter |
10:27:53 | lqdev[m] | and thus it's veeery slow |
10:28:30 | dadada | lqdev[m]: maybe you could use it at compile time |
10:28:36 | FromDiscord | <Kenran> I'm quite annoyed at it now, as it was basically an experiment for me but now diving into Nim and trying to do more low-level stuff, I fail at some steps. For instance what Yardanico mentioned. I need to do some "research" to even get what it all means 😄 |
10:29:16 | * | krux02 joined #nim |
10:29:18 | lqdev[m] | dadada: yeah, but that defeats the purpose of a dynamic language altogether :p |
10:29:28 | FromDiscord | <Kenran> let alone getting something to run afterwards. |
10:29:28 | FromDiscord | <Kenran> maybe being inside a nix-shell for everything works, but there I still have some SSL problems when running nimble... quite a lot to tackle to just run a binary |
10:32:33 | dadada | for what it's worth I've been happy with Fedora for years ... |
10:34:18 | FromDiscord | <Kenran> dadada: I used Fedora for quite a while before NixOS 🙂 maybe I'll be going back to it, I really liked it. Lately I had to nixify a lot of projects at work and also use it as a server OS once, so I thought I might give it a try at home. |
10:35:01 | * | kenran joined #nim |
10:37:20 | dadada | Kenran: why did they choose nix at work? |
10:42:05 | kenran | dadada: for one, we use Haskell in some projects where the nix integration is good (you get the benefits of `stack` without having to use it), plus reproducible builds even though some use macOS, others linux flavors |
10:43:12 | kenran | dadada: it makes gitlab CI nicer to use as well (just use the nixos/nix base container and do `nix-build ..`) |
10:44:21 | kenran | (our Haskell projects often have lots of non-Haskell dependencies which are managed by nix, I should mention) |
10:45:03 | dadada | I've been interested in Haskell for a while, why did your company decide to use it? |
10:45:25 | dadada | what are the things you can do in Haskell, but couldn't for example get done in Nim or something like it |
10:45:54 | dadada | I'm looking for an answer specific to your company, I know I can google search this and get the generalized answers |
10:46:02 | * | filcuc joined #nim |
10:46:50 | dadada | and I think I already did some time ago, but I've never found a project where I needed those specific strengths (yet) |
10:46:56 | Araq | sealmove: instead of "special" identifiers use longer ones |
10:50:27 | * | filcuc_ joined #nim |
10:50:34 | * | filcuc quit (Ping timeout: 256 seconds) |
10:50:44 | kenran | dadada: we are a little bit special in that we do FP (nearly) exclusively. Plus I'm an absolute beginner in Nim. I'm reasonably sure you can do everything we do in Nim as well, but there are some things we love Haskell for. Mainly it's great for parsing stuff like a breeze and also creating very expressive DSL's. |
10:52:28 | dadada | kenran: what's the best learning resource/book for Haskell? |
10:52:56 | kenran | dadada: probably Haskell Programming from First Principles |
10:55:03 | kenran | dadada: it's not really necessary to get a book though. I have a love/hate relationship with Haskell btw. In most new projects we also choose Clojure. Haskell's great strength is its type system with which you can model your domain insanely well. But IMHO that's the hardest skill to learn and mostly stems from experience with both the topic and the language. |
10:56:34 | dadada | kenran: I think FP is most likely a big part of programming's future, I definitely have already tried to use FP patterns as much as I can, was deeply impressed with a presentation on Haskell that I saw on YouTube a few years ago |
10:58:50 | * | JustASlacker joined #nim |
11:01:15 | * | sleepyqt joined #nim |
11:02:41 | kenran | dadada: There are definitely great talks and great minds in the Haskell community. I have my problems with it, because I hate the ecosystem. It's still a research language, even though it's used in production, and a lot of the library authors jump on every new language feature and break their API all the time in the process. |
11:03:26 | kenran | So trying to use a lib that hasn't been updated since the end of 2018, I have no real hopes of it being compatible with the other libraries in a project by default. |
11:04:32 | kenran | And I'm with you on the FP part. I've been doing this for 1.5 years only now, but arrived at the same conclusions in my projects before that (Windows stuff with C#) by seeing where we always failed. |
11:05:37 | kenran | That's why I really want to get into Nim! It enables me to use most of those concepts, still be very readable and expressive, and do stuff on a lower level as well. Similar to Rust in its appeal, but Nim just "clicks" more with me :) |
11:07:24 | dadada | I definitely think there's room for Nim to adapt better to FP, I'm not sure if Nim has tail call optimizations, just to name one example |
11:09:09 | kenran | I remember googling that before I downloaded nim. Shouldn't clang/gcc do it with the resulting C code? |
11:09:12 | dadada | I read this book on using functional programming patterns in Go, the author made a huge point of criticizing Go for not supporting TCO, but it's definitely something that can get supported when there's enough demand |
11:09:43 | dadada | kenran: I thought the same thing, but I never found a proper answer |
11:09:58 | dadada | I'll probably have to do benchmarks on this sometime |
11:10:08 | kenran | yeah, we should be able to figure it out :) |
11:10:27 | FromDiscord | <Rika> nim has typeclasses btw 😛 |
11:12:06 | kenran | maybe I'm calling my NixOS experiment quits today... I can't really figure this stuff out on my own as I'm not even remotely a systems programmer or familiar with the tooling needed to debug this :D Maybe it's time to go back to Arch or Fedora. |
11:12:44 | dadada | can't you experiment with NixOS in a VM inside Arch/Fedora? |
11:13:34 | kenran | yeah I could, but I had to re-partition anyway and so I went all the way this time. |
11:14:01 | dadada | someone recently wrote a text editor in nim (presumably for the console) https://github.com/pseudo-random/editor |
11:14:29 | kenran | perhaps that's the way to go next time :) gotta run |
11:14:37 | * | kenran quit (Quit: leaving) |
11:15:05 | dadada | it looks like a nice start by a very quick glance at the code, it definitely deserves some attention, hence I mention it here |
11:19:40 | * | JustASlacker quit (Ping timeout: 250 seconds) |
11:28:19 | * | nsf joined #nim |
11:33:16 | * | natrys joined #nim |
11:36:50 | * | sealmove quit (Quit: WeeChat 2.7.1) |
11:37:55 | dadada | when I get an error like this: |
11:37:57 | dadada | fatal.nim(39) sysFatal |
11:37:58 | dadada | Error: unhandled exception: vmgen.nim(941, 10) `t != nil` [AssertionError] |
11:38:28 | dadada | is this indicative of there possibly being something wrong with Nim? or should I still assume that my code is shit? |
11:38:37 | FromDiscord | <Rika> what did you do? |
11:40:06 | * | SebastianM joined #nim |
11:43:38 | lqdev[m] | this should be a proper error, report it as a bug |
11:47:44 | * | couven92 quit (Quit: Client disconnecting) |
11:48:03 | * | couven92 joined #nim |
11:51:21 | * | SebastianM left #nim (#nim) |
11:53:16 | * | Trustable quit (Remote host closed the connection) |
12:00:17 | FromDiscord | <Rika> huh, nimprof does not like my code |
12:00:27 | FromDiscord | <Rika> it crashes due to deeply nested calls |
12:00:39 | FromDiscord | <Rika> albeit my code not crashing at all normally |
12:03:49 | * | dddddd joined #nim |
12:04:15 | * | dwdv joined #nim |
12:06:40 | dadada | can't reproduce the bug on play.nim-lang.org yet |
12:07:15 | * | JustASlacker joined #nim |
12:13:24 | axion | I need help with type parameters again :/ |
12:17:10 | krux02 | axion, what do you need to do with type parameters? |
12:17:16 | axion | So I have 2-4 component vectors parameterized as Vec[N], and 2x2, 3x3, 4x4 square matrices as Mat[N] (Mat[3] is array[9; float32]. Some operations are only valid on Mat3 or Mat4, but with a vector size 1 less than the matrix parameter, so [N: static[int], M: Mat[N], V: Vec[N-1]]. The problem here is that Mat[2], Vec[1] is invalid in this context |
12:18:24 | krux02 | I need more context |
12:18:32 | krux02 | is this a proc or a type? |
12:18:38 | axion | A bunch of procs |
12:18:41 | krux02 | ok |
12:19:13 | krux02 | I need something that I can execute |
12:19:44 | axion | Sorry this is all on paper, no code yet. |
12:20:04 | axion | I would have to read my math texts to figure out the implementation first |
12:21:07 | krux02 | ok |
12:21:27 | krux02 | well I can help you to punch things through the nim type system. |
12:21:38 | axion | But this isn't a code problem. It's a signature specification problem |
12:21:47 | krux02 | But I don't really understand your type constraints that you want to enforce |
12:21:57 | axion | Ok let me try to be more clear |
12:21:58 | krux02 | ok |
12:23:22 | krux02 | why do you need the vector to be size 1 less than the matrix parameter? |
12:23:45 | axion | I have a pile of procs that will be the same code for either a Mat3 (9 element array), or Mat4 (16-element array). These must also take in a Vec2 if it's a Mat3, or a Vec3 if it's a Mat4, (so if Mat[N], then Vec[N-1]). THe problem I have is how to constrain the Mat to not accept Mat2 and thus Vec1 which these functions shouldnt exist for |
12:24:12 | krux02 | I remember I once had a similar problem. The solution to that was, to not use the constraint of N-1 anymore. |
12:24:24 | krux02 | not sure if it really was that problem |
12:24:57 | axion | Because for example, the translation of a 3x3 transformation matrix is 2 components, and likewise 3 components for a 4x4 transformation matrix. |
12:25:33 | krux02 | well, you can start of just writing down all implementations (lots of redundancy) and then look afterwards on how to compress that. |
12:25:55 | * | JustASlacker quit (Ping timeout: 250 seconds) |
12:27:19 | axion | Yeah, I see a lot of redundancy either way, because for example a 3x3 matrix can be both a 2D transformation matrix, or a 3D rotation matrix. |
12:28:55 | krux02 | well I stopped caring about that distinction. |
12:29:04 | krux02 | 3x3 matrix is just a 3x3 matrix |
12:29:09 | krux02 | that is the mathematical part. |
12:31:54 | krux02 | After all the `3x3` rotation matrix ended up to be much less useful that I thought. |
12:32:25 | axion | I can assure you it is incredibly useful for a lot of code. It is a pretty big mathematical error to not have this distinction |
12:32:35 | krux02 | rotations are stored either in a quaternion, or in 4x4 matrix is part of a trotration/translation object transformation. |
12:33:20 | krux02 | axion: Well I am not in your code, and maybe you are right, but the solution for me was to not use 3x3 rotation matrices and it worked quite well for my code. |
12:33:32 | axion | Fair enough |
12:33:55 | krux02 | what would be much more useful to me would be a coordinate system tag for my coordinates. |
12:34:14 | krux02 | So that I don't accidentally mix up wordspace cameraspace and objectspace coordinates. |
12:34:28 | lqdev[m] | how do I explain to my C++ friend that `'a'.succ` makes more sense than `'a' + 1` |
12:34:38 | lqdev[m] | I keep telling him that a char is a char, not a number |
12:34:42 | lqdev[m] | so it doesn't make sense to add 1 to it |
12:34:51 | lqdev[m] | but he keeps saying that a char is a number |
12:35:12 | krux02 | lqdev[m], well maybe you have to stop using his c++ terms. |
12:35:24 | krux02 | but yea it is hard to fix that. |
12:36:18 | krux02 | it is also hard to tell c programmers that an array is not a pointer because for many of them it is the same thing. |
12:36:35 | krux02 | It quacks like a duck it looks like a duck, so it is a duck. |
12:36:43 | lqdev[m] | that's low level programming for ya. |
12:36:58 | Zevv | but they *are* the same thing! |
12:37:05 | FromDiscord | <Rika> tell them that if you remove the computer aspect from it it makes no sense to add a character with a number |
12:37:06 | * | Zevv ducks |
12:37:11 | FromDiscord | <Recruit_main707> in c/c++ everything is an int or a pointer XD |
12:37:39 | Zevv | almost true |
12:37:41 | Zevv | but not quite |
12:37:45 | axion | Hmm, and here I thought everything was a pointer or UB |
12:37:58 | Zevv | haha |
12:38:05 | krux02 | lqdev[m], the only fix for that that I know works is to let him run into a problem because of this non-distinction of char/integer. Make it really painful. Then come with a solution. And he will understand. But he might stop being your friend. |
12:38:08 | Zevv | and still it runs the world |
12:38:11 | FromDiscord | <Rika> the more stars you add the better |
12:38:28 | FromDiscord | <Rika> char \*\****niceVar |
12:38:54 | * | EastByte quit (Quit: WeeChat 2.7) |
12:40:06 | * | EastByte joined #nim |
12:41:13 | krux02 | Rika: you cannot tell people to remove hard wired stuff from their brain, and then think about another solution. You first have to break the hard wiring. That is the "let them run into a painful problem" I was talking about. |
12:41:46 | lqdev[m] | krux02: lol that's so true |
12:41:54 | FromDiscord | <Rika> tell them "but what if it wasnt programming" |
12:42:23 | lqdev[m] | idk why he keeps on using C++ after encountering weird problems like having to initialize an std::string explicitly (`std::string a = "";` instead of `std::string a;`) |
12:42:50 | krux02 | Rika, that will disable his arguments, but it won't convince him. |
12:45:34 | krux02 | axion, what do you mean with UB? |
12:48:41 | FromDiscord | <Rika> undefined behavior |
12:56:43 | FromDiscord | <exelotl> Ultra Beast |
13:00:54 | * | kungtotte quit (Read error: Connection reset by peer) |
13:02:37 | * | kungtotte joined #nim |
13:02:53 | disruptek | leorize: your approach is probably the correct one; i dunno. the style i arrived at is to just indent two spaces for the pragma. |
13:07:52 | * | rnrwashere joined #nim |
13:12:14 | * | rnrwashere quit (Ping timeout: 256 seconds) |
13:20:13 | FromDiscord | <clyybber> Well a char is a number |
13:20:15 | FromDiscord | <clyybber> fite me |
13:20:21 | * | nsf quit (Quit: WeeChat 2.7) |
13:20:30 | FromDiscord | <clyybber> And arrays are pointers |
13:23:00 | FromDiscord | <clyybber> But their specification doesnt say they must be |
13:23:25 | FromDiscord | <clyybber> At least in nim |
13:39:36 | FromDiscord | <Recruit_main707> type Matrix3* = object |
13:39:36 | FromDiscord | <Recruit_main707> data*: array[3, Vector3] |
13:39:36 | FromDiscord | <Recruit_main707> forward*, left*, up*: Vector3 |
13:39:36 | FromDiscord | <Recruit_main707> |
13:39:37 | FromDiscord | <Recruit_main707> inside a constructor... |
13:39:37 | FromDiscord | <Recruit_main707> [result.forward, result.left, result.up] = result.data |
13:39:39 | FromDiscord | <Recruit_main707> what am i doing wrong? this says it cannot be assigned to |
13:39:48 | disruptek | you're pasting, for one thing. |
13:40:08 | * | NimBot joined #nim |
13:40:09 | disruptek | the argument that you "forgot" just doesn't hold weight after the 5th "reminder." |
13:40:56 | FromDiscord | <Recruit_main707> i didnt forget, im not that stupid, i just consider it small enough. |
13:41:21 | disruptek | it doesn't bother me, but it bothers others and sets a poor example. |
13:42:28 | FromDiscord | <Recruit_main707> ok, fine... here you have, much cleaner: https://play.nim-lang.org/#ix=2eXA |
13:43:07 | FromDiscord | <Recruit_main707> ill just consider more than 1 line too much from now on |
13:43:22 | FromDiscord | <Rika> and it is |
13:43:38 | FromDiscord | <Recruit_main707> its all relative :p |
13:43:41 | FromDiscord | <Rika> use parentheses not brackets |
13:44:06 | FromDiscord | <Recruit_main707> oki, thanks |
13:49:22 | lqdev[m] | i don't think you can deconstruct an array like that |
13:49:34 | lqdev[m] | it only works for tuples |
13:50:06 | FromDiscord | <Recruit_main707> it doesnt throw any errors in the editor |
13:50:17 | FromDiscord | <Recruit_main707> ill see |
13:50:57 | FromDiscord | <Rika> use `unwrap` module if you really want array deconstructing |
13:51:24 | disruptek | obviously, it's for string summation. |
13:51:30 | disruptek | what else? |
13:51:59 | disruptek | the wallpaper is amazing today. what should i use it on? |
13:55:55 | * | lritter joined #nim |
14:04:23 | jken | I have a type defined, Vertex, which has position vec3[float], a normal vec3[float], and texCoord vec2[float] |
14:04:33 | jken | How in nim do I get the total size of Vertex? |
14:04:40 | jken | sizeof(Vertex) returns 8 |
14:05:36 | lqdev[m] | huh. |
14:05:38 | lqdev[m] | interesting |
14:05:57 | lqdev[m] | can you show the definitions? |
14:05:58 | jken | I am using vector types from glm |
14:06:41 | disruptek | sizeof only measures the size of one type. |
14:07:10 | jken | What does that mean? |
14:07:24 | disruptek | if that type is a pointer, you'll get the size of a pointer. |
14:08:26 | jken | Are types pointers? |
14:08:42 | krux02 | no |
14:08:45 | jken | ie. sizeof(Vertex) vs sizeof(newVertex()) |
14:08:46 | krux02 | types are types |
14:09:21 | krux02 | types are for compile time evaluation only. |
14:09:30 | krux02 | compile time does not have pointers. |
14:09:30 | * | solitudesf quit (Read error: Connection reset by peer) |
14:09:54 | jken | hmm okay |
14:09:56 | disruptek | compile time is rude that way. |
14:10:02 | krux02 | sizeof returns the size in bytes of a type. Basically how much memory it costs to put them in a seq or on a stack. |
14:10:03 | jken | sizeof(Vertex()) still give me 8 |
14:10:43 | * | disruptek sighs. |
14:10:47 | krux02 | then your Vertex is either a ref type, or it is 8 bytes in size |
14:10:58 | jken | ah, it is a ref type |
14:11:02 | jken | ref types are pointers than |
14:11:03 | disruptek | ie. a pointer. |
14:11:09 | jken | that's what I was missing. |
14:11:23 | krux02 | yes ref types are pointers |
14:11:24 | disruptek | they are sometimes called "managed pointers" in other languages. |
14:11:31 | FromDiscord | <Kenran> why is it that if I compile a project that uses `sdl2` or `nim_sdl`, the binary doesn't have `libSDL2` in its `ldd` output? Is there a way to "get it in there"? |
14:11:37 | jken | My type probably does not need to be a ref type, but out of curiousity, is there a way to get the size of a ref type? |
14:11:46 | krux02 | ref are basically a different kind of pointer, but technically identical to pointers. |
14:11:56 | krux02 | yes |
14:12:00 | krux02 | unref it with [] |
14:12:10 | krux02 | sizeof(Vertex()[]) |
14:12:10 | disruptek | kenran: static link? |
14:12:21 | jken | krux02: gotcha, thanks |
14:12:27 | krux02 | np |
14:13:09 | disruptek | kenran: nim doesn't use the "normal" shared-lib style of linking by default; instead it has its own dynlib machinery that you get to fuck with. |
14:13:20 | krux02 | btw, you are probably used to ref types from other languages like python C# or Java. But in Nim you shuold used them sparsely. |
14:13:35 | jken | krux02: is it possible to determine the size of a ref object type without an instance of it? |
14:13:49 | jken | ie, no instance to unref |
14:13:56 | krux02 | Simply because the non ref variant of a type is often all you ware about. |
14:14:06 | krux02 | yes |
14:14:36 | krux02 | sizeof(typeof(default(Vertex())[])) |
14:15:18 | krux02 | but if you care about the size of a type, you probably shouldn't use a ref type. |
14:15:32 | krux02 | sorry |
14:15:42 | krux02 | sizeof(typeof(default(Vertex)[])) |
14:15:46 | disruptek | that's still an instance. |
14:15:48 | * | solitudesf joined #nim |
14:15:58 | disruptek | 👍 |
14:16:14 | krux02 | no it is not an instance, because it is in a `typeof` argument. |
14:16:15 | jken | right, so that creates an "instance" with default values and gets the size |
14:17:49 | FromDiscord | <Kenran> disruptek: Atm it will compile and complain about libSDL2 missing when I start it. I found a post explaining how to static link against SDL2 but it's not really working yet. I'll have to see if I can get it to do that 🙂 |
14:17:50 | krux02 | ``default(Vertex)[]`` would create a nil pointer and unref it. That is basically a segfault. But the code is never executed, what matters in the type of the expression. |
14:18:25 | disruptek | kenran: it's fun to try to guess where you need to copy the shared-lib to. usually, adjacent to the binary. |
14:18:58 | krux02 | Keran: so many people force to static link SDL2. And SDL2 really doesn't want to be statically linked. |
14:19:03 | jken | kenran, I recently had this problem |
14:19:04 | jken | {.passL: "-Xlinker -rpath .".} |
14:19:14 | krux02 | I think eventually SDL2 developers gave up on it and allowed static linking of SDL2. |
14:19:20 | jken | That in config.nims in your project will make it look for the .so in that dir |
14:20:03 | disruptek | the only experience i have with sdl/opengl is debugging this exact linking issue. |
14:20:25 | jken | disruptek helped me solve that same issue but with imgui rather than sdl2 |
14:20:38 | disruptek | oh yeah, that's what it was. |
14:21:07 | krux02 | disruptek, when you are working with opengl you can forget about static linking anyway, so why is it so important to have SDL2 statically linked? I really don't understand it. |
14:21:32 | disruptek | i dunno. i didn't read too much into kenran's query, perhaps. |
14:21:56 | disruptek | i think it's the normal shared-link issue, though. |
14:22:00 | krux02 | no he isn't the only one here on IRC who asked for help on static linking SDL2. |
14:22:11 | FromDiscord | <Kenran> it's not important to me at all. I would have liked it to "just work" without static linking |
14:22:23 | disruptek | i mean, i think the issue comes from the unexpected shared-linking behavior. |
14:22:37 | disruptek | it's more like the way windows does it than the way unices do it. |
14:22:52 | FromDiscord | <Kenran> It's probably a mix between that and me being on NixOS |
14:22:54 | krux02 | yea probably. |
14:23:02 | FromDiscord | <Kenran> on my mac I get it to run just fine |
14:23:11 | disruptek | the mac uses a similar approach. |
14:23:35 | krux02 | Keran: I read about the Nix package manager. I wonder if it can be used as a substitution for nimple. |
14:23:41 | krux02 | nimble I mean. |
14:23:57 | disruptek | it's kinda heavyweight, unfortunately. |
14:24:02 | krux02 | It claims to be just a package manager, and NixOS is the os around that package manager. |
14:24:09 | krux02 | hmm |
14:24:11 | krux02 | ok |
14:24:23 | disruptek | i was attracted to it, too. |
14:24:24 | FromDiscord | <Kenran> is there a good chance this problem is going to just disappear once I switch to another linux distro again (because I'm about to do just that anyway sooner or later)? |
14:24:34 | disruptek | nope. |
14:24:53 | disruptek | jken nailed it. |
14:25:11 | disruptek | but, i'd put your passL in a .cfg as `--passL:"some shit"` instead. |
14:25:18 | krux02 | I thought NixOS is one of the most light wight distros out there (never verifiend it though), and then I just expected `Nix` to be lightweiht as well. |
14:25:36 | Yardanico | well it's not really :P |
14:25:40 | Yardanico | it also doesn't follow FHS |
14:25:51 | krux02 | FHS? |
14:26:27 | disruptek | i prefer guix because it's based upon a more mature language. |
14:26:30 | FromDiscord | <Kenran> jken, disruptek: I'll need some time to try that out, thanks. So far I've only written < 100 lines of Nim code and I don't feel ready to deal with that 😄 |
14:27:09 | FromDiscord | <Kenran> it's not lightweight at least in the sense that it uses tons of disk space when used with multiple languages, ecosystems, ... |
14:27:38 | FromDiscord | <Kenran> and I don't like the nix language either. guix would be something to try soon 🙂 |
14:35:15 | * | EastByte quit (Read error: Connection reset by peer) |
14:35:24 | * | EastByte joined #nim |
14:36:53 | FromDiscord | <Kenran> phew, I can't get it to run, but I'm probably still not grasping your advice properly jken and disruptek. I'm doing this: https://pastebin.com/XLEyZ48a |
14:37:51 | Yardanico | well you need dev files for SDL too |
14:37:57 | Yardanico | and link with sdl |
14:38:18 | FromDiscord | <Kenran> oh, it's just missing headers? |
14:38:33 | FromDiscord | <Kenran> (the first part I mean) |
14:39:36 | Yardanico | well, not headers |
14:39:44 | Yardanico | static files .a |
14:42:06 | Yardanico | why do you want to link statically with SDL though? |
14:42:21 | Yardanico | I thought that most of the time people do dynamic linking and store these .so files in the game folder or use the system ones |
14:43:12 | * | rockcavera joined #nim |
14:43:54 | FromDiscord | <Kenran> oh, I don't want to if I don't have to. it's just that it doesn't run by default (because I probably don't know that I have to pass some options to `nimble build` or `nim c` by default) |
14:45:29 | FromDiscord | <Kenran> Yardanico: any advice on how I can do it dynamically is greatly appreciated as well 🙂 I can ofc upload the source, even though there's not much of it there |
14:48:52 | * | couven92 quit (Remote host closed the connection) |
14:49:14 | * | couven92 joined #nim |
15:43:01 | krux02 | Yardanico, SDL2 in particular on Linux is usually not shipped. |
15:43:09 | krux02 | on windows however it is shipped. |
15:43:49 | krux02 | SDL2 is basically available on Linux. Many programs require it. |
15:44:21 | Yardanico | krux02: well, games ship it anyway, but it can be overriden with LD_PRELOAD_PATH |
15:44:38 | Yardanico | I mean proprietary games on linux |
15:45:20 | krux02 | well on steam games do actually ship SDL2. |
15:45:34 | Yardanico | yeah |
15:45:43 | krux02 | also GOG games do ship SDL2 as far as I know. |
15:46:19 | krux02 | yea just checke it. Yes proprietary games do ship SDL2 |
16:10:16 | * | tane joined #nim |
16:16:59 | * | dwdv quit (Ping timeout: 256 seconds) |
16:18:07 | * | dwdv joined #nim |
16:32:11 | FromDiscord | <Kenran> I checked two other linux systems (fedora and ubuntu) and could just `nimble build` and `./my-app` without problems when the appropriate `-dev` lib was installed. So it seems to be at least kind-of specific to NixOS. |
16:32:35 | FromDiscord | <Kenran> Well, time to change - which I wanted to do anyway - and see if it just works there perhaps 😄 |
16:32:51 | FromDiscord | <Kenran> But I want to take this opportunity to learn something more about this kind of thing first. |
16:37:22 | FromGitter | <zetashift> Can't you ask in a Nix related chat? |
16:37:35 | FromGitter | <zetashift> Maybe they have an IRC/forum you could ask some pointers about this |
16:37:40 | Yardanico | they do have a lot of chats, yeah |
16:37:48 | Yardanico | https://nixos.wiki/wiki/Get_In_Touch |
16:39:23 | FromDiscord | <Kenran> oh, sorry if that came out wrong: that's what I plan to do before doing the switch. the freenode nix channel is full of helpful people |
16:41:05 | FromGitter | <zetashift> Oh nice |
16:41:42 | * | dwdv quit (Quit: quit) |
16:47:54 | leorize | disruptek: so... I guess no one realised that the feature exists because it've never worked for complex cases |
16:48:07 | leorize | and I don't get bug reports because no one thought that's a bug :P |
16:49:41 | leorize | disruptek: well if you wanna tweak that logic, it's not hard |
16:50:07 | leorize | look for "lone opening curly" in indent/nim.vim |
16:50:33 | leorize | then change result from `pcol - 1` to `indent(plnum) + shiftwidth()` |
16:58:18 | * | couven92 quit (Read error: Connection reset by peer) |
16:58:44 | * | couven92 joined #nim |
17:10:04 | FromDiscord | <deech> What's a good way of using `nimble` to package NImScript files? |
17:10:45 | FromDiscord | <deech> You can get it to copy them to `nimbleDir` but how do I import them in a dependency? |
17:11:52 | shashlick | Why does it have to be nims if you want to import |
17:12:16 | FromDiscord | <deech> I'd like to import them into the `.nimble` file. |
17:12:24 | FromDiscord | <deech> Essentially a build-time dependency. |
17:12:57 | * | andinus joined #nim |
17:13:05 | shashlick | When you talk of imports, they need to be Nim files don't they |
17:13:21 | shashlick | But is it a config file |
17:14:03 | shashlick | If you mean config.nims then Nim does not load config files from packages |
17:14:08 | FromDiscord | <deech> No, I've found that if you do import "someFile.nims" in a "nims" file it will do it. |
17:15:05 | shashlick | Ok but unless you call Nim directly on someFile as well, you can just name it as a regular Nim file |
17:15:41 | shashlick | And importing into nimble file should just be relative imports as well |
17:15:41 | FromDiscord | <deech> That's true but a lot of OS functions do not work with NimScript. |
17:16:16 | FromDiscord | <deech> Oh I get it. You're saying don't use the `.nims` suffix? |
17:16:18 | Yardanico | well yeah because OS functions require FFI and that's a very complicated story with NimScript (Nim VM) :P |
17:16:28 | shashlick | Again, when you import a Nim file into nims, it is still running in the vm so the contents should be vm friendly |
17:17:49 | FromDiscord | <deech> I think I understand. |
17:20:47 | FromDiscord | <deech> I just tested it with `import httpclient; echo "hello world"` in a NimScript file and `nim e someFile.nims` fails on `nativesockets.nim`. |
17:22:50 | FromDiscord | <KingDarBoja> it is possible to create a nim variable of type int with no value? |
17:23:08 | Yardanico | var myNum: int |
17:23:12 | Yardanico | but it'll have a default value of 0 anyway |
17:23:16 | Yardanico | because that's how computers work :) |
17:23:17 | FromDiscord | <KingDarBoja> Arrr |
17:23:35 | Yardanico | if you want it to really have NO default value, use "ref" :P |
17:23:39 | * | couven92 quit (Read error: Connection reset by peer) |
17:23:49 | FromDiscord | <KingDarBoja> How to achieve `nil` value then? |
17:23:51 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2eYV |
17:24:03 | * | couven92 joined #nim |
17:24:06 | Yardanico | why not just have it at 0 ? |
17:24:08 | FromDiscord | <KingDarBoja> I don't want to initialize it to zero because the check |
17:24:12 | Yardanico | or -1, idk |
17:24:20 | FromDiscord | <KingDarBoja> Oh, could be -1 🤔 |
17:24:20 | Yardanico | or create an another bool variable |
17:24:53 | leorize | KingDarBoja: I can see that 0 works just well for you here :p |
17:24:57 | FromDiscord | <KingDarBoja> This is the issue while trying to translate python code to nim code at it uses `None` for variable declaration lol |
17:25:03 | leorize | if you move the check a bit, ofc |
17:25:14 | FromDiscord | <KingDarBoja> Yeah, was thinking the same |
17:25:19 | Yardanico | well in nim you can replicate it with "ref int" but pls dont |
17:25:44 | FromDiscord | <KingDarBoja> I will see how to change th check with the zero |
17:26:34 | disruptek | use the options module. |
17:51:11 | * | Jesin quit (Quit: Leaving) |
17:55:01 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2eZ6 ugh, got closer to what I expected |
17:56:41 | Yardanico | do you know that these functions exist in stdlib? |
17:56:46 | Yardanico | unindent for dedentBlockStringValue |
17:57:45 | Yardanico | ah nvm |
18:02:20 | FromDiscord | <Kenran> Btw @deech: Due to your Nim-related tweets I tried Nim and am now hooked. Thanks I guess 🙂 |
18:12:54 | * | couven92 quit (Ping timeout: 240 seconds) |
18:15:14 | * | tefter quit (Ping timeout: 240 seconds) |
18:15:39 | * | tefter joined #nim |
18:15:55 | * | andinus quit (Quit: ERC (IRC client for Emacs 26.3)) |
18:17:14 | * | PMunch joined #nim |
18:19:29 | * | bars joined #nim |
18:21:11 | * | bars quit (Client Quit) |
18:22:51 | FromDiscord | <Tristan> Hey y'all, excuse my ignorance but I'm playing around with c2nim for the first time, attempting to wrap lv2, and already running into problems lol. Any suggestions on how I ought to modify this header? Would this be a good use case for the '#pp' directive https://gist.github.com/TristanCrawford/5768abce2207122afd22d82fd82a2db0 |
18:24:59 | leorize | looks like c2nim can't process C string constants |
18:25:58 | * | Jesin joined #nim |
18:37:34 | Araq | yes |
18:37:43 | Araq | (question about #pp directive: yes) |
18:40:51 | axion | Will it ever be the case that a const will be able to have the same name as a proc? |
18:42:23 | disruptek | wut |
18:43:20 | Araq | axion, no. |
18:43:44 | Araq | what's the use case? is the world yet again running out of meaningful identifiers? |
18:43:50 | axion | I have to get all of Lisps great features out of my workflow |
18:43:53 | disruptek | third time this month. |
18:44:39 | disruptek | Araq: i assume i did something wrong; any idea what? error: invalid application of ‘sizeof’ to incomplete type ‘obs_service’ |
18:45:04 | disruptek | trying to import a type... |
18:45:09 | disruptek | trying to importc a type... |
18:45:22 | Araq | use .incompleteStruct pragma |
18:45:35 | disruptek | ... o.O okie, ty |
18:46:13 | disruptek | perfect. |
18:46:17 | FromDiscord | <Recruit_main707> What does —dynlibOverrideAll to the code? |
18:47:01 | FromDiscord | <Recruit_main707> Leorize suggested me it could fix my issue with winim |
18:47:12 | FromDiscord | <Recruit_main707> But it throws me an error |
18:53:42 | FromDiscord | <Tristan> According to: https://nim-doc.readthedocs.io/en/latest/nimc.html "makes the dynlib pragma have no effect" |
18:54:52 | Yardanico | why not use https://nim-lang.org/docs/nimc.html or https://nim-lang.github.io/Nim/nimc.html ? :P |
18:55:32 | FromDiscord | <Tristan> Honestly just grabbed the first link I found on DDG lol |
18:55:38 | Yardanico | xd |
18:55:50 | Yardanico | nim-lang.org contains official docs for latest stable, nim-lang.github.io - for latest devel |
18:56:31 | FromDiscord | <Tristan> Schweet, I'll keep that in mind. |
18:57:13 | FromDiscord | <Tristan> So... the #pp directives worked out well, but now c2nim seems to not like: "__attribute__((visibility("default")))" above a couple const declarations... what do? |
18:57:50 | Araq | #def __attribute__(x) |
18:59:46 | FromDiscord | <Tristan> Legend, worked like a charm. |
18:59:48 | FromGitter | <kayabaNerve> I need some help with the asyncnet library. While creating a socket, the fcntl call is failing. The resulting OSError isn't catchable and crashes my entire program. |
19:00:23 | FromGitter | <kayabaNerve> I had it trigger after a few days of normal use, or after 100k sockets while rapid firing. I'm running it now through strace, yet under strace it isn't triggering (almost 400k in) |
19:01:06 | FromGitter | <kayabaNerve> I have a friend who suggested to use strace in the first place; his idea is the way strace is hooking fcntl is causing the bug to not exist (race condition?). |
19:01:11 | FromGitter | <kayabaNerve> Anyone have any idea here? |
19:01:43 | FromGitter | <kayabaNerve> Oh. I do have a traceback. It's in the future callback for the acceptAddr function. https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/asyncnet.nim#L462 |
19:02:00 | FromGitter | <kayabaNerve> https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/nativesockets.nim#L577 is the raising fcntl call. |
19:02:50 | leorize | well what was the error message associated with the exception you got? |
19:03:32 | Araq | disruptek, live stream today? |
19:03:57 | FromGitter | <kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e77b69dfa6bd733c7b11256] |
19:03:58 | * | andinus joined #nim |
19:04:11 | disruptek | i dunno. i think i'm just sitting here mumbling most of the time. |
19:04:24 | disruptek | pretty exhausting. |
19:04:54 | disruptek | acceptAddr() looks less stupid than i expected. not sure why it would break. |
19:05:11 | FromGitter | <kayabaNerve> I'm not complaining the standard lib has this problem 0.001% of the time. I'm looking for a solution because I can't catch it and therefore can't run `continue` |
19:05:54 | FromGitter | <kayabaNerve> Happened after a few days of my server running on a VPS, as well as on my home laptop. I've triggered ulimit before and it looked very different. |
19:05:55 | disruptek | i know, i gave up on async for these sorts of applications. |
19:06:13 | FromGitter | <kayabaNerve> Have a better suggestion? Because I'm about to wrap ASIO :/ |
19:06:22 | leorize | kayabaNerve: what was the error message associtated with the OSError? |
19:06:30 | FromGitter | <kayabaNerve> "Bad file descriptor" |
19:06:35 | FromGitter | <kayabaNerve> I included the full traceback above |
19:06:45 | disruptek | i would hack it to confirm that you are able to create the socket. |
19:06:50 | FromGitter | <kayabaNerve> I think you'd have to click a link to see it from IRC though |
19:06:54 | disruptek | that's something you can catch. |
19:07:40 | FromGitter | <kayabaNerve> Yes and no? Maybe? |
19:07:47 | leorize | kayabaNerve: try compiling with `--assertions:on` |
19:07:57 | disruptek | yeah, make sure that assert is in the runtime. |
19:08:27 | Araq | krux02, awesome work on the bugfixes, many thanks! |
19:08:44 | FromGitter | <kayabaNerve> ```code paste, see link``` ⏎ ⏎ Here's my loop. `.accept` is waiting for minutes before it gets a socket and crashes. I can't include a line before it, unless there's a tryAccept. [https://gitter.im/nim-lang/Nim?at=5e77b7bc7d676c4d617050bf] |
19:12:44 | FromGitter | <kayabaNerve> Removed my define release, enabled assertions. Killed the strace run after 622k sockets. Now at 90k without strace |
19:13:20 | Araq | kayabaNerve: "catchable" assertions are a stdlib bug |
19:13:25 | Araq | I mean |
19:13:44 | Araq | the stdlib should raise a proper exception and not use 'assert' that you can catch |
19:13:54 | FromGitter | <kayabaNerve> That's not the comment |
19:14:02 | Araq | if that's the case, please report it on github |
19:14:10 | FromGitter | <kayabaNerve> It's raising an OSError I can't catch because it's under an anonymous function in the async runtime |
19:14:29 | FromGitter | <kayabaNerve> The request was I enable assertions to see if one of those shed further light on the problem. |
19:14:44 | disruptek | well, let's first see that the future is finished. |
19:16:16 | Araq | ok, so who wants to hear yet-another exception handling related thought |
19:16:51 | disruptek | oh dear. |
19:17:24 | FromGitter | <kayabaNerve> debug + explicitly enabled assertions returns nothing after 270k attempts. The initial crash was after 100k, but I'm not sure how representative that number is. For all I know, it was just extremely early and the strace one would've crashed if run long enough... |
19:17:44 | disruptek | the strace is probably flushing stuff. |
19:18:15 | * | JustASlacker joined #nim |
19:19:18 | FromGitter | <kayabaNerve> I removed it for the debug + assertions run. Now trying release + assertions, still without strace. |
19:20:14 | leorize | I guess you got a TOCTOU problem |
19:20:24 | leorize | but it's weird that you can't catch it |
19:20:33 | leorize | have you tried an empty `except` branch? |
19:21:14 | FromGitter | <kayabaNerve> Every call of mine to newAsyncSocket, accept, or even await is wrapped in try/except Exception. |
19:21:23 | leorize | like `except` instead of `except Exception`? |
19:21:55 | leorize | isn't Exception rooted from Defect and OSError rooted from CatchableError or am I mistaken? |
19:22:41 | FromGitter | <kayabaNerve> Haven't tried it, also can't generally. My macro forbids it. That said, I'll disable it for this nexthttps://play.nim-lang.org/#ix=2eZv |
19:22:50 | FromGitter | <kayabaNerve> *disable it for this next run. |
19:22:56 | FromGitter | <kayabaNerve> I was going to send that, but then i finished https://play.nim-lang.org/#ix=2eZv |
19:23:06 | FromGitter | <kayabaNerve> Which shows that except Exception works for OSError |
19:23:10 | FromGitter | <kayabaNerve> Crashed on release at 91k |
19:23:17 | FromGitter | <kayabaNerve> It doesn't crash with debug or strace |
19:23:35 | FromGitter | <kayabaNerve> Seems to be a race condition |
19:24:04 | FromGitter | <kayabaNerve> Assertions were on, none tripped |
19:24:13 | disruptek | turn the assertion into an `if`. |
19:24:48 | leorize | it's a TOCTOU |
19:24:53 | FromGitter | <kayabaNerve> I never wrote an assertion. No one told me to. All that was said was to compile wit assertions on. |
19:25:00 | leorize | the socket might be closed after you got it |
19:25:03 | Yardanico | @kayabaNerve try turning flags which release implies one-by-one, or try a different C compiler |
19:25:12 | leorize | but not being able to catch is a bigger problem here |
19:25:39 | FromGitter | <kayabaNerve> leorize: Because it's an anon function under the runtime. I do wrap all my calls and traditionally call `continue` on error. |
19:26:00 | FromGitter | <kayabaNerve> But yes, if I could catch this, I wouldn't care that it happens. |
19:26:14 | disruptek | there are uncachable exceptions all over async, though. |
19:26:19 | FromGitter | <kayabaNerve> Right. |
19:26:24 | disruptek | work the problem. |
19:26:27 | FromGitter | <kayabaNerve> Right |
19:26:36 | FromGitter | <kayabaNerve> :P I understand my circumstance. I'm trying to work it. |
19:26:57 | FromGitter | <kayabaNerve> Yardanico: I can, yet it seems to be about speed in general. strace + release was fine. debug was fine. release wasn't fine. |
19:27:26 | FromGitter | <kayabaNerve> So I don't think it will help. I also don't believe I can compile this project with clang. It uses a lot of external C libraries. |
19:27:36 | FromGitter | <kayabaNerve> (with custom bindings and compile pragmas) |
19:27:58 | Yardanico | well clang supports most of C out there :P |
19:28:25 | * | JustASlacker quit (Ping timeout: 250 seconds) |
19:28:41 | FromGitter | <kayabaNerve> Yeah, mainly worried about my compile pragmas. What's the Nim switch to use clang? |
19:28:54 | Yardanico | --cc:clang |
19:29:22 | leorize | clang supports 90% of GNU C |
19:29:38 | leorize | I'd say that it will work, assuming that you got a recent enough version of clang |
19:29:41 | FromGitter | <kayabaNerve> It's recompiling all my files now. |
19:29:56 | FromGitter | <kayabaNerve> Done |
19:29:57 | FromGitter | <kayabaNerve> Great |
19:30:02 | FromGitter | <kayabaNerve> TIL I support clang |
19:30:29 | FromGitter | <kayabaNerve> Alrighty. Probably needs a minute or two to get to 95k sockets (one crashed at 99580, one crashed at 91 something) |
19:31:25 | FromGitter | <kayabaNerve> Same error at 22k sockets |
19:31:33 | FromGitter | <kayabaNerve> clang seems to be extremely unlucky |
19:32:47 | FromGitter | <kayabaNerve> Eh. I should really say clang generated even faster code, as it this bug is a race condition/TOCTOU/something. |
19:35:06 | FromGitter | <kayabaNerve> So the immediate fix is to use debug to stop a TOCTOU. The long term fix is... submit an issue to the Nim repository and wait it out? |
19:35:41 | leorize | long term fix is to figure out why can't you catch it :P |
19:36:38 | FromGitter | <kayabaNerve> Async runtime |
19:37:36 | FromGitter | <kayabaNerve> The async runtime is full of errors which can't be caught because they're macro'd the hell away. At this point in time, I've called runForever. Even if I could try/except runForever, I wouldn't be able to recover the place in code. |
19:37:44 | FromGitter | <kayabaNerve> It would exit of everything. |
19:39:06 | disruptek | async won't be fixed. |
19:39:56 | FromGitter | <kayabaNerve> I'm not asking to change async. I'm asking to change the newAsyncSocket call to avoid this race condition crashing programs. |
19:40:15 | FromGitter | <kayabaNerve> leorize: Oh. If I try/except runForever, I can catch it. |
19:40:58 | Araq | yeah but then you lose everything in the event loop, I think |
19:41:13 | FromGitter | <kayabaNerve> Exactly. I'm debating now if I can reboot the networking code. |
19:41:28 | FromGitter | <kayabaNerve> At that point, it may be better just to ship a manager to reboot the entire app. |
19:42:37 | FromGitter | <kayabaNerve> Araq: Would you be cool if I created an error relating to the newAsyncSocket code as it has a potential TOCTOU? |
19:42:39 | disruptek | just copy and fix the event loop. PRs won't be merged. |
19:43:02 | FromGitter | <kayabaNerve> I'm not sure how I can copy and fix every single async operation I have going on. |
19:43:09 | FromGitter | <kayabaNerve> I'm pretty sure I'd just want to restart the app. |
19:43:14 | Araq | kayabaNerve: fine with me |
19:43:37 | FromGitter | <kayabaNerve> Will do if I get a MRE |
19:43:59 | * | JustASlacker joined #nim |
19:45:34 | Araq | disruptek: PRs will get merged and I might revive your PR |
19:45:56 | disruptek | surprise me. 😉 |
19:46:20 | Araq | I reviewed async's code so many times now that I might as well maintain it a little |
19:46:22 | Araq | :P |
19:47:03 | disruptek | i think it's good money after bad what with an arc future. jmo. |
19:48:23 | * | rnrwashere joined #nim |
19:48:53 | Araq | anyhow here is my idea regarding 'quirky' exceptions: when should you be forced to check for/ignore the error flag? when you call the next proc that might set it. because then you lose information. Consistent |
19:49:00 | Araq | with Nim's 'discard' idea |
19:49:14 | disruptek | is there a way to `SomeType[T]` inside a template, ie. strop a generic name composed of an untyped arg? |
19:49:41 | disruptek | i like that idea. |
19:49:44 | Araq | this also implies calling a proc that can raise inside a loop has to be annotated |
19:51:20 | disruptek | there's only one flag, right? |
19:51:49 | disruptek | so maybe it could be an error to not check it before risking a new call, but not to omit a check prior to same. |
19:51:56 | disruptek | cfg can figure that out. |
19:52:22 | Araq | yeah, task for the cfg |
19:52:52 | disruptek | first design is probably better because it moves the test closer to the source. |
19:53:32 | disruptek | scope-based exception handling probably a creepy if convenient approach. |
19:54:51 | FromGitter | <kayabaNerve> So I can't reproduce it with a minimal brute connect/close. My theory is that it's all the code running in between async calls which is screwing it up 0_o Which means I can't create a MRE. |
19:55:29 | FromGitter | <kayabaNerve> But honestly, no idea. As soon as await connect is called, and it trips, I thought everything after that was synchronous which means it shouldn't matter... |
19:55:46 | FromGitter | <kayabaNerve> Maybe LMDB/threads? 0_o Anyways. Looks like my solution is to ship in debug for now. |
19:57:52 | * | dwdv joined #nim |
19:58:04 | * | rnrwashere quit (Remote host closed the connection) |
20:21:33 | * | andinus quit (Quit: ERC (IRC client for Emacs 26.3)) |
20:27:51 | disruptek | lmdb/threads? |
20:31:01 | * | clemens3 quit (Read error: Connection reset by peer) |
20:31:02 | * | Trustable joined #nim |
20:35:05 | rayman22201 | what maintenance doe async need? (other than the obvious arc issues?) |
20:40:36 | FromGitter | <kayabaNerve> disruptek: I have no idea what about my project could be tripping it up. If I had to pick something, my guess is the thread for my GUI OR LMDB which I believe spawns a threadpool. |
20:40:49 | FromGitter | <kayabaNerve> All I know is that my MRE doesn't work despite having a RE. |
20:40:54 | disruptek | lmdb doesn't use threads by default, afaik. |
20:41:00 | FromGitter | <kayabaNerve> A RE with 20k lines of code... |
20:41:00 | disruptek | it does support their use, though. |
20:42:22 | FromGitter | <kayabaNerve> Thanks for the heads up |
20:43:00 | disruptek | i wonder if you need to tell lmdb it is being used in a threaded context? |
20:43:33 | FromGitter | <kayabaNerve> You shouldn't? I'm not even doing any writing here. Just reading, and all my reads may be RAM cached at this point in time... |
20:55:50 | disruptek | i guess i will stream a couple more hours of obs/dbus. |
20:57:15 | disruptek | ~stream |
20:57:15 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek |
20:59:51 | blackbeard420 | nice |
21:00:11 | * | krux02 quit (Remote host closed the connection) |
21:06:51 | * | rnrwashere joined #nim |
21:07:08 | * | rnrwashere quit (Remote host closed the connection) |
21:07:21 | * | rnrwashere joined #nim |
21:08:33 | * | filcuc joined #nim |
21:09:13 | * | filcuc_ quit (Ping timeout: 264 seconds) |
21:12:49 | * | dadada quit (Ping timeout: 264 seconds) |
21:16:30 | * | Deuns joined #nim |
21:16:33 | Deuns | hello |
21:17:10 | Yardanico | hi |
21:22:09 | * | dadada joined #nim |
21:22:32 | * | dadada is now known as Guest85156 |
21:26:54 | Deuns | euantor: do you have a solution for https://github.com/nim-lang/Nim/issues/12320 ? I have the same problem with multiple versions (1.0.2 and upper on openbsd 6.6) |
21:26:56 | disbot | ➥ Koch tools fails on OpenBSD with the 1.0.0 package ; snippet at 12https://play.nim-lang.org/#ix=2f0k |
21:28:07 | euantor | Deuns: afraid not. Unsure why the issue was closed as it still fails for me too |
21:28:31 | Deuns | ok, thank you :) |
21:28:47 | euantor | Running the CI tests also dumps hundreds of errors on OpenBSD, with lots of errors about unable to open file |
21:29:39 | euantor | Not yet managed to find the cause, but I’m still trying. I’m trying to get OpenBSD CI working: https://github.com/nim-lang/Nim/pull/12105 |
21:29:40 | disbot | ➥ #12103 - CI for OpenBSD |
21:35:40 | Araq | euantor, I think it was closed because we now have sourcehut support and it's green |
21:36:29 | euantor | Sourcehut only checks FreeBSD, not OpenBSD. The OpenBSD PR is still open as I have several issues to fix to get it to pass |
21:36:56 | euantor | I need to rebase the PR, which I’ll do tonight and we’ll see how it runs now |
21:41:21 | * | xet7 quit (Quit: Leaving) |
21:41:43 | * | natrys quit (Quit: natrys) |
21:43:49 | * | xet7 joined #nim |
21:44:03 | * | opal quit (Ping timeout: 240 seconds) |
21:44:28 | * | rnrwashere quit (Remote host closed the connection) |
21:44:47 | * | rnrwashere joined #nim |
21:47:27 | * | opal joined #nim |
21:49:25 | * | rnrwashere quit (Remote host closed the connection) |
21:50:54 | Araq | ok thanks |
21:53:40 | * | rnrwashere joined #nim |
22:07:00 | * | rnrwashere quit (Remote host closed the connection) |
22:07:32 | * | rnrwashere joined #nim |
22:08:25 | * | rnrwashere quit (Remote host closed the connection) |
22:16:40 | * | clemens3 joined #nim |
22:18:22 | * | rnrwashere joined #nim |
22:30:38 | * | JustASlacker quit (Quit: Leaving) |
22:35:16 | euantor | rebased, CI running. Expecting failures, will create issues for those that warrant them |
22:38:03 | euantor | Oops, hoped it might get further than that ha! `Error: cannot open file: std/macros` |
22:39:38 | euantor | Is there any easy way to debug import errors like that - eg: to print the path(s) that the files were looked for within? |
22:41:47 | * | Guest85156 quit (Ping timeout: 246 seconds) |
22:47:48 | * | dadada joined #nim |
22:47:54 | * | filcuc quit (Ping timeout: 240 seconds) |
22:48:11 | * | dadada is now known as Guest67311 |
22:51:01 | * | PMunch quit (Quit: leaving) |
22:51:32 | * | Trustable quit (Remote host closed the connection) |
23:00:22 | * | filcuc joined #nim |
23:14:20 | * | tane quit (Quit: Leaving) |
23:29:50 | * | sleepyqt quit (Ping timeout: 256 seconds) |
23:31:25 | leorize | euantor: use nim dump to get all the search paths |
23:33:03 | * | disrupteq joined #nim |
23:41:06 | * | lritter quit (Quit: Leaving) |
23:51:14 | * | filcuc quit (Ping timeout: 240 seconds) |
23:52:38 | * | krux02 joined #nim |
23:58:04 | FromDiscord | <Tristan> It's yer boi, back with more dumb questions. I'm trying to translate a C application to nim, there's an enum where a value is being 'OR'ed based on previous values in the enum. Trying to do the same in nim results in a type mismatch. Any ideas? |