00:11:58 | * | Xenon joined #nim |
00:12:11 | * | Xenon quit (Client Quit) |
00:12:57 | * | User11 joined #nim |
00:15:46 | FromDiscord | <jtv> In reply to @ShalokShalom "I see it more": Javascript isn't weakly typed, it's dynamically typed. |
00:18:36 | FromDiscord | <amadan> Thought it would be weakly typed? Like `"1" + 1 == "11"` seems like pretty weak typing imo |
00:20:52 | FromDiscord | <jtv> No, there’s a well defined type operation there |
00:21:24 | FromDiscord | <jtv> That’s just an implicit cast attached to the addition operator |
00:22:30 | FromDiscord | <jtv> Basically if your program violates the type rules of the language and the resulting behavior is well defined and isn’t a crash… |
00:23:06 | FromDiscord | <Elegantbeef> Amadan we can do the same in Nim 😄 |
00:23:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pE2 |
00:23:35 | FromDiscord | <Elegantbeef> It doesnt really make Nim weakly typed! |
00:24:01 | FromDiscord | <Elegantbeef> I'd jokingly say JS is typeless |
00:27:02 | FromDiscord | <jtv> Asm is basically typeless… well, monotyped |
00:27:36 | FromDiscord | <amadan> Ah ok, guess my understanding of weak types is wrong lol |
00:28:05 | FromDiscord | <Elegantbeef> To be fair there is ambiguity in what weak typing means |
00:28:26 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4pE3 |
00:28:32 | FromDiscord | <Elegantbeef> https://en.wikipedia.org/wiki/Strong_and_weak_typing#Definitions_of_%22strong%22_or_%22weak%22 |
00:28:54 | FromDiscord | <Elegantbeef> I do not really care what anyone want's to call JS's type system or lack of, it's awful |
00:29:00 | FromDiscord | <jtv> But basically strong and weak aren’t particularly useful distinctions |
00:29:16 | FromDiscord | <jtv> And people assume static is all or nothing when it’s not |
00:29:25 | FromDiscord | <jtv> It’s a spectrum |
00:29:28 | FromDiscord | <Elegantbeef> I have a friend that was doing a JS assignment and made a typo, the runtime didnt complain it just.... incorrectly worked and printed undefined |
00:30:26 | FromDiscord | <Elegantbeef> Having a purely dynamic definition of an object is hellish if you ask me |
00:31:31 | FromDiscord | <jtv> When I first used JavaScript it was still called livescript. Helped someone debug their loop, I kept taking code out of it until it was something like a for loop from 1 to 1000 and it still crapped out. But if I ran it backwards it worked fine… defaulted to a signed char for an index. I have never trusted the language since 🙂 |
00:33:18 | FromDiscord | <Elegantbeef> We're making the case that whatever JS has is just bad! 😛 |
00:33:40 | FromDiscord | <jtv> Exactly |
00:33:48 | FromDiscord | <Elegantbeef> If you have to run code to know it's doing things it shouldnt, you shouldnt use that |
00:34:16 | FromDiscord | <Elegantbeef> "Sir we invented a new car that doesn't have a gas metre, instead if you turn the engine on and it starts you have enough gas" |
01:42:21 | User11 | `/disconnect |
01:42:27 | User11 | oops |
01:42:29 | User11 | lol |
01:42:43 | * | User11 quit (Quit: WeeChat 3.8) |
02:03:36 | FromDiscord | <Yepoleb> Goodbye User11 |
02:04:46 | FromDiscord | <huantian> IRC moment |
02:11:28 | * | derpydoo joined #nim |
02:52:15 | * | derpydoo quit (Ping timeout: 268 seconds) |
03:08:46 | * | Jjp137 quit (Quit: Leaving) |
03:13:13 | * | Jjp137 joined #nim |
03:15:28 | * | onetwo quit (Quit: The Lounge - https://thelounge.chat) |
03:26:12 | * | onetwo joined #nim |
03:38:48 | FromDiscord | <Iliketwertles> is there a simple way i can echo the output from a for loop into even columns? |
03:47:41 | FromDiscord | <Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4pEI |
03:48:48 | FromDiscord | <Iliketwertles> ~~def not making a knock-off suckless thing called suckmore~~ |
03:51:12 | FromDiscord | <jtv> I mean, I have a janky string table api if need be. |
03:53:38 | NimEventer | New thread by Nlits: RST in nim., see https://forum.nim-lang.org/t/9962 |
04:30:11 | * | rockcavera quit (Remote host closed the connection) |
05:03:06 | FromDiscord | <alx> can I get a job in #jobs in this server as a web developer? |
05:17:48 | FromDiscord | <Girvo> Whats the best way of parsing a string/pulling data out of it on embedded? I need to basically pull out certain parts of it. regex is a bit of a no-no typically, `std/pegs` I think does a lot of allocation. npegs? |
05:18:36 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=4pET |
05:18:41 | FromDiscord | <Girvo> But the fun is, those new lines are all actually `\r\r\n` |
05:18:44 | FromDiscord | <Girvo> Don't ask me why lol |
05:28:05 | Zevv_ | The wonderful world of the hayes protocol |
05:28:12 | Zevv_ | we all thought we would get rid of that somewhere in the 80s |
05:28:26 | Zevv_ | but now, it is still hunting us on a daily basis. |
05:28:32 | Zevv_ | I do that shit for a living, and it makes me cry. |
05:29:27 | Zevv_ | anyhow, I wouldn't make a full fledged parser for that, all the `+` responses are pretty consistent: tag, colon, space and then a list of comma separated responses |
05:30:02 | Zevv_ | also, things are simpler if you ATE0 first |
05:34:05 | Zevv_ | if you insist on npeg, something like this: http://ix.io/4pEV |
05:38:43 | FromDiscord | <Girvo> Haha yeah Zevv. The downside to it is the SIM7000 is _stupidly_ inconsistent with it's responses. It drops the +(COMMAND): prefix on a lot of them, and can even just send me back `AT+CSQ\r\r\nOK\r\n` -- completely empty lol |
05:39:07 | FromDiscord | <Girvo> I've used scanf from strscans for the moment, but I think something more robust might end up being needed |
05:39:13 | FromDiscord | <Girvo> And you're not kidding about the crying 🥲 |
05:39:41 | Zevv_ | ikr. it's a hell. all these modems have their quirks and break their own protocols. |
05:39:53 | FromDiscord | <Girvo> they break _their own docs_ |
05:39:55 | FromDiscord | <Girvo> It's madenss |
05:39:58 | FromDiscord | <Girvo> Madness, even |
05:40:02 | Zevv_ | I've been working on the 7600 for a year or so, but I have not seen it drop the prefix |
05:40:17 | Zevv_ | I think what you are seeing are unsilliciteds |
05:40:29 | FromDiscord | <Girvo> The only reason we're on the 7000 is we needed the 2G for one of our deployments, sadly |
05:40:52 | FromDiscord | <Girvo> Though, without revealing who, we're in talks with another, much higher quality manufacturer of modems elsewhere in the world than Simcom 😉 |
05:41:03 | Zevv_ | like, which one |
05:41:41 | Zevv_ | the thing i'm making supports 5 different brands, and they are all crappy in one way or another |
05:41:45 | FromDiscord | <Girvo> I'm not allowed to say yet 😭 (which honestly drives me nuts) but you could probably guess easy enough I think |
05:42:05 | Zevv_ | anyway, are you sure you handle URCs properly? |
05:42:10 | Zevv_ | that messes up your protocols, also timing-wise |
05:42:24 | FromDiscord | <Girvo> Most definitely not, no |
05:42:41 | Zevv_ | there you go. |
05:42:59 | FromDiscord | <Girvo> Though we do have the right timings in place, currently. but it's wonky as hell because of it |
05:43:09 | Zevv_ | i feel your pain |
05:43:23 | Zevv_ | but really: make sure to honour the 100ms backoff after each OK before you start ATing again |
05:43:32 | FromDiscord | <Girvo> Yeah, _that_ I do have in place at least |
05:43:33 | Zevv_ | because the modem needs that interval to dump its URCs to you |
05:43:45 | Zevv_ | and make sure to handle those, as these have no relation to your AT command in progress |
05:44:19 | Zevv_ | all this is even more fun if you use virtual UARTS with CMUX |
05:58:08 | FromDiscord | <Girvo> Hah we're not |
05:58:10 | FromDiscord | <Girvo> The 7000 doesn't support it |
05:58:15 | FromDiscord | <Girvo> Thankfully, in some ways |
06:01:50 | * | azimut quit (Ping timeout: 255 seconds) |
06:06:31 | * | ltriant quit (Ping timeout: 268 seconds) |
06:06:39 | * | theki quit (Read error: Connection reset by peer) |
06:11:14 | * | theki joined #nim |
06:12:10 | * | theki quit (Read error: Connection reset by peer) |
06:23:16 | FromDiscord | <ShalokShalom> In reply to @jtv "Asm is basically typeless…": Isn't any dynamic type system monotyped? |
06:23:39 | FromDiscord | <ShalokShalom> In reply to @jtv "Javascript isn't weakly typed,": It's both |
06:24:12 | FromDiscord | <Girvo> Depends, some dynamic type systems still have internal primitive types, they just automatically cast things. I guess you could make an argument that it is monotyped |
06:24:40 | FromDiscord | <Elegantbeef> I still just argue it's awful |
06:25:37 | FromDiscord | <ShalokShalom> In reply to @Girvo "Depends, some dynamic type": yeah. it's just a difference between ultimately monotyped (js) and absolutely, purely and always monotyped (asm) |
06:25:47 | FromDiscord | <ShalokShalom> And I really like asm here more |
06:25:54 | FromDiscord | <ShalokShalom> You at least know, what you get. |
06:26:25 | FromDiscord | <ShalokShalom> Implicit is another word for default. And the other way around. ↵And good defaults are half of computing. |
06:26:47 | FromDiscord | <ShalokShalom> That's the particular reason, why JS is so awful. Cause it has horrible defaults |
06:26:57 | FromDiscord | <ShalokShalom> Some people still use `var` |
06:28:08 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4pF7 |
06:28:53 | FromDiscord | <ShalokShalom> ElegantBeef here sets the defaults for Nim, as an example 😛 |
06:29:17 | FromDiscord | <Elegantbeef> If only, then sokam's code would be readable 😛 |
06:30:38 | * | arkurious quit (Quit: Leaving) |
06:30:48 | * | derpydoo joined #nim |
06:31:49 | FromDiscord | <ShalokShalom> sokam needs to show up at the disciplinary council |
06:31:54 | FromDiscord | <ShalokShalom> 🧐 |
06:32:15 | FromDiscord | <Elegantbeef> `var a : Type = No` |
06:32:56 | FromDiscord | <Girvo> In reply to @Elegantbeef "`var a *: Type": hahaha |
06:33:24 | FromDiscord | <Girvo> Zevv_: I wish there was a nicer library for handling this AT stuff 🥲 Have you looked at/used FreeRTOS-Cellular? |
06:34:31 | FromDiscord | <Elegantbeef> Girvo |
06:36:34 | Zevv_ | Girvo: no, we have written stuff from scratch |
06:36:52 | Zevv_ | this project started about 12 years ago, we have targetted 7 or 8 different modems by now |
06:37:04 | Zevv_ | every now and then I wonder how grown ups do this kind of things |
06:37:17 | Zevv_ | then I open up the ModemManager source, or a few of the android RILs |
06:37:40 | Zevv_ | that makes me feel like a war hero again, because the projects emit exactly the same wafts as mine |
06:38:12 | Zevv_ | I have some contacts with support people for the various modem vendors, and they are actually kind of ashamed themselves |
06:39:40 | FromDiscord | <Girvo> Yeah haha thats about what I figured 😦 esp_modem is a _right_ mess (that isn't nearly robust enough, long running commands like AT+COPS=? basically crash their driver altogether), FreeRTOS-Cellular _looks_ nice but has all the same grossness underneath |
06:39:44 | FromDiscord | <Girvo> I guess it can't be avoided lol |
06:39:49 | FromDiscord | <Girvo> Blame the modem mfgs! |
06:40:05 | Zevv_ | esp_modem is not really usable, i must admit i have not seen freertos-cellular before |
06:40:22 | Zevv_ | that might have come handy becaus I recently implemented this for ESP in C++ myself |
06:40:29 | Zevv_ | good thing is that I did it in 700 lines instead of 7000 |
06:40:43 | FromDiscord | <Girvo> esp_modem is just _barely_ usable, which is why I hate it so much haha. It _almost_ works well. I get real PPPoS connections and sockets, but man it's not robust at all |
06:40:49 | FromDiscord | <Girvo> I'd prefer it didn't work at all haha |
06:41:06 | Zevv_ | robust is *the* problem with any of these things |
06:41:08 | FromDiscord | <Girvo> But yeah freertos-cellular I only came across the other day, its relatively new and pretty up to date |
06:41:11 | Zevv_ | it's doable to get something pinging |
06:41:23 | Zevv_ | but keeping it up under all circumstances is a different game |
06:41:23 | FromDiscord | <Girvo> yeah but put it in the real world and it shits the bed lol |
06:41:57 | Zevv_ | I'm relatively "lucky" to have seen all possible failures at this other project over the years |
06:41:58 | FromDiscord | <Girvo> Like, a brownout condition (we think) by pulling a battery (with mains power still!) causes the SIM7000 on our board to absolutely lose the plot _if and only if_ it is on 2G and has an open PPP conn lol |
06:42:11 | Zevv_ | oh yes, beware of modems falling back to 2G |
06:42:14 | FromDiscord | <Girvo> And only fully pulling the power to the entire board seems to fix it |
06:42:26 | Zevv_ | the power usage is spikey as hell and they emit a lot of EMC in that mode, so they will bring your whole PCB down |
06:42:31 | FromDiscord | <Girvo> Yeah we geofence it. We have to have 2G sadly because we're deployed in Papua New Guinea |
06:42:41 | FromDiscord | <Girvo> But everywhere else we avoid it entirely |
06:42:50 | Zevv_ | that happened a lot here over the last year when operators started switching off 3G; some locations ahd bad 4G coverage so these modems fell back to 2G |
06:42:56 | FromDiscord | <Girvo> I'm seeing 3x power draw compared to Nb-iot lol |
06:43:40 | Zevv_ | we should have a beer and laught abotu all this, one day |
06:44:06 | FromDiscord | <Girvo> Absolutely haha, talk about a niche within a niche 😛 |
06:44:10 | Zevv_ | i'm still interested in your other modem alternative though, that might help me in my future projects |
06:44:26 | FromDiscord | <Girvo> Yeah its pretty great. Gives a socket-like interface to the PDP context as well, which is nice |
06:44:39 | Zevv_ | on linux, or on esp? |
06:44:51 | FromDiscord | <Girvo> Both, apparently haha |
06:44:57 | FromDiscord | <Girvo> But its socket-like, not real sockets |
06:44:57 | Zevv_ | how do they do that on esp? |
06:45:16 | Zevv_ | on linux, its' pretty normal for modems to give some eth-like interface, we don't use PPP on any modem these days |
06:45:17 | FromDiscord | <Girvo> let me find the header, one moment |
06:45:30 | Zevv_ | but for ESP, I wonder how they interface to the modem, if not over UART |
06:45:40 | FromDiscord | <Girvo> https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/source/include/cellular_api.h#L490 |
06:45:45 | FromDiscord | <Girvo> Oh yes, it is over UART |
06:45:53 | FromDiscord | <Girvo> You provide the low level UART driver to it |
06:46:02 | FromDiscord | <Girvo> read/write, basically |
06:46:05 | Zevv_ | well, so it's still uart + PPP to the modem, right |
06:46:10 | Zevv_ | it's just hidden |
06:46:12 | FromDiscord | <Girvo> Doesn't do PPP actually |
06:46:25 | Zevv_ | oh nice |
06:46:34 | FromDiscord | <Girvo> Uses the base 3GPP TS 27.006 AT commands for it, as far as I can tell |
06:46:51 | FromDiscord | <Girvo> Wait wrong version number lol |
06:46:54 | FromDiscord | <Girvo> You know the standard I mean |
06:46:59 | Zevv_ | i'd have to readup on that stuff; i have not seen anything using serial-but-not-ppp |
06:47:14 | Zevv_ | all other modems just do fancy USB interfaces, acm and the like |
06:47:18 | FromDiscord | <Girvo> Yeah true |
06:47:42 | FromDiscord | <Girvo> This is basically just a set of AT commands for opening sockets/reading/writing data and so on, with a bit of mode handling/state |
06:47:56 | Zevv_ | anyhow, I'm starting to get stuff under control with my CMUX setup as well; one port for control, one for PPP, and third for GNSS. all by the book. |
06:48:01 | FromDiscord | <Girvo> So FreeRTOS-Cellular gives you a `CellularSocketHandle_t` to use with them, so you can recv, send, setSockOpts, etc |
06:48:05 | FromDiscord | <Girvo> Ooooh nice |
06:48:10 | Zevv_ | I'm for hire. |
06:48:30 | FromDiscord | <Girvo> We cheated for GNSS lol, we just ripped the GPIO to a STM32 and let it deal with it, and we grab it when we need via I2C haha |
06:48:51 | FromDiscord | <Girvo> Should get in contact tbh! We're a mostly remote team, and definitely will need new people shortly |
06:49:23 | Zevv_ | you can always drop me a line of course, [email protected] |
06:49:28 | FromDiscord | <Girvo> will do! |
06:49:37 | Zevv_ | i'm pretty busy next months tho, no promisis :) |
06:51:13 | FromDiscord | <Girvo> No worries 🙂 |
06:51:22 | FromDiscord | <Girvo> Thats honestly not bad timing anyway haha |
06:52:58 | Zevv_ | anyway, pleasure talking to you, rare to find people who suffer these specific ailments |
06:53:02 | Zevv_ | i'm off to walk da dog, laters! |
07:15:55 | * | advesperacit joined #nim |
07:39:28 | * | kenran joined #nim |
08:09:04 | * | Notxor joined #nim |
08:26:01 | * | kenran quit (Remote host closed the connection) |
08:46:42 | * | ltriant joined #nim |
09:20:48 | NimEventer | New thread by miran: This month with Nim - February 2023, see https://forum.nim-lang.org/t/9963 |
09:23:19 | FromDiscord | <Elegantbeef> @narimiran whoops missed the link on the nimib stuff, got a PR to fix it open 😄 |
09:26:43 | FromDiscord | <narimiran> In reply to @Elegantbeef "<@719992187890434069> whoops missed the": ouch! 😄 |
10:27:51 | FromDiscord | <pietroppeter> haha saw that, thanks both for the post and for fixing that! |
10:28:22 | FromDiscord | <pietroppeter> (and that post might be on some orange site, if you know what I mean) |
10:29:04 | FromDiscord | <pietroppeter> btw, the emojis in the title were removed on purpose (I guess they might be a bit too much in a header) or I can open a PR to add them back? 😉 |
11:24:06 | * | azimut joined #nim |
11:45:16 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/cimgui/cimnodes↵Would Futhark work on this? This is a C wrapper |
12:02:21 | FromDiscord | <basilajith> Is play.nim-lang.org down? |
12:04:55 | FromDiscord | <Rika> If need be theres an alternate site called wandbox that has nim support |
12:08:47 | FromDiscord | <Phil> In reply to @basilajith "Is play.nim-lang.org down?": Not anymore! |
12:08:59 | FromDiscord | <Phil> Shoutout to Pmunch for the quick reboot |
12:12:27 | FromDiscord | <basilajith> Yup, up now! Thanks @PMunch ! |
12:12:59 | * | derpydoo quit (Quit: derpydoo) |
12:13:47 | FromDiscord | <Andreas> playground |
12:13:56 | FromDiscord | <Andreas> (edit) "playground ... " added "down ?" |
12:27:14 | FromDiscord | <jmgomez> Any idea on how can I tell the NimVM to load with a cpp imported function? |
12:27:55 | * | Notxor quit (Ping timeout: 248 seconds) |
12:36:30 | * | Notxor joined #nim |
12:37:21 | FromDiscord | <Phil> Hot dang that was quick |
12:37:38 | FromDiscord | <Phil> Wait, no, it isn't down @Andreas , does it look like it is on your end? |
12:40:41 | FromDiscord | <Andreas> In reply to @Isofruit "Wait, no, it isn't": no, thx, its running again.. |
12:48:34 | via__ | is there a way to have generic specialization? like one proc myfunc[T](): T, but then a specialized myfunc[int](): int? |
12:48:41 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4pGD |
12:49:45 | FromDiscord | <Andreas> (edit) "https://play.nim-lang.org/#ix=4pGD" => "https://play.nim-lang.org/#ix=4pGE" |
12:49:56 | FromDiscord | <Andreas> (edit) "https://play.nim-lang.org/#ix=4pGE" => "https://play.nim-lang.org/#ix=4pGF" |
12:55:12 | FromDiscord | <demotomohiro> @via↵You can do `proc foo[T: SomeInteger](x: T) =` to limit T to `SomeInteger` type class.↵Or just overload proc by defining `proc foo(x: int) =` after `proc foo[T](x: T)`.↵You can also use when branch with T like `proc foo[T](x: T): T = when T is int: 10 else: x`. |
12:57:43 | via__ | the first thing i tried was the second one, just overloading, but i think the issue is that my proc isn't taking any templated params that would distinguish them, so its a compile error |
12:58:15 | via__ | i'm trying the thing with when right now, but i'm running into some issues. i'll paste if i can't figure it out in a minute |
13:04:42 | via__ | nevermind, the when strategy works, thank you |
13:10:41 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4pGN |
13:13:47 | FromDiscord | <luteva> I am using a lib (installed using nimble) and the lib has a bug/missing feature/whatever. So I fix that (by cloning the repo and making the changes) and... what do i have to do, to make the updated lib being used in my software? I mean, I have to update the lib that is used and "install" the new lib from my locale repo into the nimble packages/config(??).↵So what's the way to go? |
13:19:40 | FromDiscord | <demotomohiro> In reply to @luteva "I am using a": https://github.com/nim-lang/nimble#local-package-development |
13:23:32 | FromDiscord | <jtv> In reply to @ShalokShalom "It's both": No to both. |
13:32:00 | * | rockcavera joined #nim |
13:32:46 | FromDiscord | <ShalokShalom> JavaScript is dynamically and weakly typed. |
13:48:16 | FromDiscord | <Rika> weak typing and dynamic typing are different concepts that are not mutually exclusive |
13:48:31 | FromDiscord | <Rika> C is weakly typed, yet statically typed |
13:48:44 | FromDiscord | <Rika> Python is strongly typed, yet dynamically typed |
13:51:04 | FromDiscord | <Andreas> sent a long message, see https://paste.rs/wnp |
13:51:48 | FromDiscord | <Rika> its a bit funky to call a macro in a macro, better use a proc that takes a nimnode and is marked {.compiletime.} |
13:52:11 | FromDiscord | <Andreas> (edit) "http://ix.io/4pH0" => "http://ix.io/4pGZ" |
13:52:55 | FromDiscord | <Andreas> (edit) "http://ix.io/4pGZ" => "http://ix.io/4pH1" |
13:53:32 | FromDiscord | <Andreas> In reply to @Rika "its a bit funky": oh nnice, i'll try that.. |
14:37:45 | FromDiscord | <eyes> I dont really fully understand C |
14:37:53 | FromDiscord | <eyes> but theres this type that I |
14:38:05 | FromDiscord | <eyes> (edit) "I" => "Im trying to bind to and it seems to never get defined" |
14:38:19 | FromDiscord | <eyes> sent a code paste, see https://play.nim-lang.org/#ix=4pHh |
14:39:01 | FromDiscord | <eyes> well, I'm trying to bind to ``dResourceContainerID``... so I guess i could use a generic pointer? |
14:39:11 | FromDiscord | <eyes> void pointer :drained: |
14:40:06 | FromDiscord | <eyes> sent a code paste, see https://play.nim-lang.org/#ix=4pHi |
14:42:12 | * | Notxor quit (Remote host closed the connection) |
14:43:04 | FromDiscord | <demotomohiro> `struct structtypename;` declare the type but it does not define it.↵Then, you can use pointer to `structtypename` but you cannot declare `structtypename` variables. |
14:43:59 | FromDiscord | <eyes> okay, that seems really weird but I guess it makes sense, I think this type is for threading so being able to define it yourself sorta fits? |
14:44:20 | FromDiscord | <eyes> bind the threading jobs to different and unrelated tasks |
14:44:37 | FromDiscord | <eyes> how would I parallel this in nim? is that even possible |
14:45:11 | FromDiscord | <eyes> sent a code paste, see https://play.nim-lang.org/#ix=4pHk |
14:45:30 | FromDiscord | <eyes> caused an error because ``dxResourceRequirements`` isnt defined |
14:46:17 | FromDiscord | <demotomohiro> It is called opaque type: https://internet-of-tomohiro.netlify.app/nim/gccguide.en.html |
14:48:10 | FromDiscord | <eyes> oh okay glad to hear this has a name |
14:48:45 | FromDiscord | <eyes> interesting that in my case, the members of the struct are never declared, even in implementation .c files |
14:48:48 | FromDiscord | <demotomohiro> This article explains how to import such type to nim: https://internet-of-tomohiro.netlify.app/nim/clibrary.en.html#use-c-static-library-from-nim |
14:49:27 | FromDiscord | <eyes> goddamn this is a useful resource |
14:49:33 | FromDiscord | <eyes> this is your website? |
14:49:43 | FromDiscord | <demotomohiro> Yes |
14:49:58 | FromDiscord | <eyes> very nice |
14:50:09 | FromDiscord | <demotomohiro> Thank you! |
14:50:27 | FromDiscord | <eyes> okay I see, i need to use the ``.header`` pragma to import the C header |
14:50:47 | FromDiscord | <eyes> and everything related to it requires that header |
14:51:21 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "C is weakly typed,": Let's cast an uint32 into an array of bytes 🤣 |
15:42:32 | * | rockcavera quit (Ping timeout: 252 seconds) |
15:50:12 | FromDiscord | <ieltan> bit`sets` have just blown my mind away |
15:50:25 | FromDiscord | <ieltan> (edit) "bit`sets` have" => "bitsetshave" |
15:50:31 | FromDiscord | <ieltan> (edit) "bitsetshave" => "bitsets have" |
15:55:30 | * | rockcavera joined #nim |
15:55:30 | * | rockcavera quit (Changing host) |
15:55:30 | * | rockcavera joined #nim |
16:17:52 | NimEventer | New post on r/nim by Scypio: Learning Nim - create object with default values?, see https://reddit.com/r/nim/comments/11g6ppt/learning_nim_create_object_with_default_values/ |
16:43:33 | * | arkurious joined #nim |
17:13:02 | * | zgasma quit (Quit: Lost terminal) |
17:45:39 | ehmry | is there a way to run "runnableExample" snippets without generating any documentation files? |
17:48:03 | FromDiscord | <Phil> I can't say that I'm aware of one |
17:48:20 | * | azimut quit (Ping timeout: 255 seconds) |
17:51:37 | ehmry | my build system should be checking all the runnableExample I write, I'll probably just generate and discard tex files |
17:52:02 | * | azimut joined #nim |
17:56:51 | * | junaid_ joined #nim |
18:00:57 | * | cfa joined #nim |
18:00:59 | cfa | morning all |
18:01:29 | cfa | am i missing something obvious, or are do blocks not really documented on https://nim-lang.org/docs/manual.html ? |
18:01:50 | cfa | they're listed in the grammar and used in a few examples but i can't see anything else |
18:03:35 | ehmry | cfa: are you having a problem using them or just want to see some docs? |
18:04:50 | ehmry | I use them a lot but I just played around with them until I thought I knew how they work |
18:05:35 | cfa | i wasn't really aware of them until i saw a code example recently |
18:05:57 | cfa | and i was probably unaware because there's no real discussion in the manual? |
18:06:30 | cfa | so to directly answer your question: 'just want to see some docs' |
18:06:46 | cfa | i was planning on playing after reading up a little |
18:08:31 | ehmry | if you get in the habit of writing a lot of anonymous procs then do blocks makes sense and you will use them |
18:08:41 | cfa | yeah, they look handy |
18:08:43 | ehmry | its just sugar |
18:20:23 | FromDiscord | <exelotl> Do notation for anonymous procs is in the "experimental" manual: https://nim-lang.org/docs/manual_experimental.html#do-notation |
18:20:46 | cfa | thanks! |
18:21:19 | cfa | oh, i didn't realise that not everything in here requires the experimental pragma |
18:24:55 | FromDiscord | <exelotl> Yeah, and do is pretty safe, there are no plans to remove it. I personally don't like `do` for anonymous procs because it's a whole new syntax to save like 2 characters over `proc () =`, but `do` for passing blocks is pretty useful |
18:26:37 | * | junaid_ quit (Remote host closed the connection) |
18:27:08 | * | cfa nods |
18:27:13 | cfa | thanks for pointing me to the docs |
18:28:07 | FromDiscord | <spoon> any good guides on creating a wrapper? |
18:28:19 | FromDiscord | <Phil> wrapper? |
18:28:38 | FromDiscord | <spoon> for a c library |
18:30:47 | FromDiscord | <Phil> Tried using futhark yet? |
18:31:20 | NimEventer | New thread by choltreppe: Import module just for comptime use, see https://forum.nim-lang.org/t/9964 |
18:31:21 | FromDiscord | <Phil> But not that I'm aware of, but then again I'm not the most knowledgeable person when it comes to any sort of bindings |
18:31:39 | FromDiscord | <spoon> does futhark generate a library or let you use the library directly? |
18:34:11 | FromDiscord | <jmgomez> I never looked at them but I may, in an ideal world `auto` infer could work better. More often than not I end up specifying the first parameter when `=>` so it can infer the return type |
18:35:05 | * | luis_ joined #nim |
18:38:22 | FromDiscord | <Phil> In reply to @spoon "does futhark generate a": Futhark generally generates a lot of code that binds to C procs, to turn those into an easily understandable/useable API would be your job ^^↵Basically, understanding how to use the C -API of the library is still necessary, futhark helps with generating all the boilerplate code needed to use it |
18:38:32 | ehmry | spoon: I run c2nim on the C library header and then adjust the output to be idomatic |
18:39:05 | ehmry | but it depends how much surface area the API has |
18:39:05 | FromDiscord | <Phil> c2nim works in the same vein as futhark, both can be used for that purpose.↵I tend to default recommending futhark because honestly I hear more people talk about it. |
18:45:42 | * | Notxor joined #nim |
18:49:20 | FromDiscord | <spoon> would prefer a general overview of what its doing before over-relying on tools |
18:49:58 | FromDiscord | <spoon> found a blog post from 2014 covering a few aspects |
18:55:32 | FromDiscord | <spoon> think i'll be fine just studying the generated wrapper code, ty |
19:03:26 | FromDiscord | <spoon> okay, so futhark 0.9 and head fail to compile due to a gcc error and c2nim only generates the constants and comments then gives a found newline error and quits |
19:03:52 | FromDiscord | <spoon> trying on the janet lang header file |
19:08:36 | * | jmdaemon quit (Ping timeout: 252 seconds) |
19:15:46 | FromDiscord | <Hourglass [She/Her]> Futhark is clang only |
19:15:47 | FromDiscord | <Hourglass [She/Her]> Afaik |
19:16:11 | FromDiscord | <Hourglass [She/Her]> Since Futhark works by using clang for wrapping the libraries |
19:18:27 | FromDiscord | <spoon> is there a flag i can pass into nimble install? |
19:18:35 | NimEventer | New thread by jmgomez: Importc in NimVM, see https://forum.nim-lang.org/t/9965 |
19:21:14 | FromDiscord | <Phil> PMunch , Futhark questions! |
19:23:38 | FromDiscord | <hotdog> In reply to @Hourglass, When the Hour Strikes "Futhark is clang only": Futhark uses clang to parse the headers, but the resulting library works with gcc |
19:24:02 | FromDiscord | <hotdog> In reply to @spoon "okay, so futhark 0.9": What's the error? |
19:24:54 | FromDiscord | <Phil> Jots down hotdog as point of contact for futhark questions |
19:25:11 | FromDiscord | <hotdog> In reply to @Isofruit "*Jots down hotdog as": Oh no 😆 |
19:25:40 | FromDiscord | <hotdog> Just kidding I'm happy to help where I can. I have used it a bit but I'm not an expert |
19:26:42 | FromDiscord | <spoon> busy so i'll have to pull it up later but it was an external program failure |
19:26:52 | FromDiscord | <spoon> from gcc |
19:33:59 | * | azimut_ joined #nim |
19:34:05 | * | azimut quit (Ping timeout: 255 seconds) |
19:43:40 | FromDiscord | <Hourglass [She/Her]> In reply to @hotdog "Futhark uses clang to": Ah |
20:14:35 | * | luis_ quit (Quit: Leaving) |
20:49:15 | FromDiscord | <System64 ~ Flandre Scarlet> Any ways I can convert this to Nim quickly please? Converting the functions sounds like PAIN https://media.discordapp.net/attachments/371759389889003532/1080954996755013644/cimnodes.h |
21:04:24 | FromDiscord | <Hourglass [She/Her]> In reply to @System64 "Any ways I can": I think futhark should be fine with it |
21:04:42 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Hourglass, When the Hour Strikes "I think futhark should": I encountered problems with Futhark this time |
21:06:13 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4pJ9 |
21:09:51 | FromDiscord | <jtv> @ShalokShalom I was saying dynamic != monotype, no. And Javascript is not weakly typed... it's strongly dynamically typed, meaning types are always fully checked before trying operations. |
21:10:51 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4pJb |
21:12:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Hourglass, When the Hour Strikes "Ah idk then": Alright so c2nim did some work for me |
21:23:46 | * | jmdaemon joined #nim |
21:57:24 | * | Notxor quit (Ping timeout: 268 seconds) |
22:07:23 | * | m5zs7k quit (Ping timeout: 264 seconds) |
22:07:47 | * | m5zs7k joined #nim |
22:40:59 | FromDiscord | <Rika> In reply to @jtv "<@208199869301522432> I was saying": What does strong and weak typing mean to you in more detail? |
22:43:14 | * | zgasma joined #nim |
22:47:10 | FromDiscord | <Dudugz> For me strongly typed languages would be C, Java, and the like that rely purely on types where a variable can only be of type X. Weakly typed languages are languages that don't rely as much on specifying types, for example JavaScript the same variable can have 5 different types. Obviously some operations need to check types but the language is 'dynamic' |
22:47:40 | FromDiscord | <Rika> Strong and weak typing are different concepts to static and dynamic typing |
22:47:59 | FromDiscord | <Rika> Python is strong and dynamic |
22:48:02 | FromDiscord | <Dudugz> Hm, really? It looks the same to me |
22:48:03 | FromDiscord | <Rika> C is weak and static |
22:48:34 | FromDiscord | <Dudugz> What would be an example of static and weak language? |
22:48:50 | FromDiscord | <Dudugz> (edit) "weak" => "strong" |
22:49:04 | FromDiscord | <Dudugz> Or weak and dynamic |
22:49:05 | FromDiscord | <Rika> C, since it has typing but it also does a lot of coercion if some types do not match |
22:49:21 | FromDiscord | <Rika> JavaScript is considered weak and dynamic |
22:49:54 | FromDiscord | <Rika> It doesn’t have typing restrictions and it coerces types heavily in function resolution |
22:50:26 | FromDiscord | <Dudugz> I just don't understand why C is weak, if a variable has no type it complains, if it does it can't be changed, and if you pass a parameter with wrong type to an operator it also gives an error |
22:50:55 | FromDiscord | <Dudugz> This to me seems pretty strong, after all it needs to have explicit types |
22:51:09 | FromDiscord | <Rika> To be more realistic, naturally, weak and strong is a gradient more of than a one or the other kind of thing |
22:53:32 | FromDiscord | <Rika> There’s a Wikipedia article huh |
22:53:33 | FromDiscord | <Rika> https://en.m.wikipedia.org/wiki/Strong_and_weak_typing |
23:08:09 | FromDiscord | <jtv> sent a long message, see http://ix.io/4pJE |
23:09:14 | FromDiscord | <jtv> And indeed that article aligns w/ that definition, it lists Python as strongly typed, etc. |
23:10:15 | FromDiscord | <jtv> So really, the two concepts are often entwined in people's minds, but either need to be orthogonal or people need to have more precise and practical definitions |
23:10:27 | FromDiscord | <jtv> Otherwise, the term is basically meaningless anyway |
23:10:32 | FromDiscord | <Girvo> As per the Futhark/c2nim discussion: I use c2nim, because we can't use clang on embedded, but regardless, the output of either isn't ideal to use directly. What you want to do ideally is take those lower level functions and build nice idiomatic Nim wrappers over them in most cases; objects with destructors and proper copy semantics (or disallowing copies, in my case), especially in multithreaded environments |
23:11:41 | FromDiscord | <Girvo> `void ` and the ability to cast anything into nearly anything else (regardless of if it makes sense) are part of the reasons C's type system is "weak" rather than "strong", but there are other more type theoretic reasons as to why it is as well |
23:16:28 | * | onetwo9 joined #nim |
23:18:24 | * | onetwo quit (Ping timeout: 248 seconds) |
23:18:24 | * | onetwo9 is now known as onetwo |
23:19:10 | FromDiscord | <jtv> I mean, my definition comes from the type theory literature. The only bigger nuance is you can combine the axes, and have things be statically weak or statically strong for certain classes of operations (or in the case of something like ML for the whole language) |
23:20:16 | FromDiscord | <Girvo> Indeed -- theres the theory definition, and theres the colloquial one haha. The latter is more common in discussions about it online for better or worse |
23:20:41 | FromDiscord | <Girvo> Basically, its a stupid discussion 😄 |
23:21:12 | FromDiscord | <jtv> Exactly. I just don't use the "strong"/"weak" distinction for anything, because it's ill defined and when you try to define it, it's clear it's not useful anyway 🙂 |
23:22:37 | FromDiscord | <Girvo> I've typically described type systems as "powerful", to describe those that let me enforce real constraints at the type level. Typescript's type system is quite powerful (once you disallow `any` lol), the ML derived languages have powerful type systems. C's type system is _not_ very powerful |
23:23:09 | FromDiscord | <Girvo> I think that describes what people mean when they say "weak" or "strong" (in colloquial usage) better, in most cases |
23:23:33 | FromDiscord | <jtv> That's certainly more intuitive. For me, I find type systems more valuable the more errors they can catch, and the earlier they can catch them |
23:23:45 | FromDiscord | <Girvo> Agreed! |
23:24:40 | FromDiscord | <jtv> Yeah, many people mean "any errors that can be caught statically are", but generally all modern langs have some dynamic checking, and possibly could do more analysis to optimize out some dynamic checks in specific instances |
23:26:04 | FromDiscord | <Girvo> My _favourite_ type system for that is Flow, interestingly |
23:26:40 | FromDiscord | <Girvo> It is crazy powerful, almost reaching the abilities of a dependent type system, but in a manner that allows you to avoid most type annotations. |
23:26:48 | FromDiscord | <Girvo> Sadly, TypeScript won the battle haha |
23:27:33 | * | advesperacit quit () |
23:27:47 | FromDiscord | <Girvo> Though typescript is now adding those features Flow had, too, so it gets better over time. Conditional types are crazy powerful |
23:28:23 | FromDiscord | <Girvo> `type Example1 = Dog extends Animal ? number : string` -- combine that with `infer` and generic params and you start to be able to do some mental things at the type level |
23:28:58 | FromDiscord | <Girvo> It basically lets you do a restricted form of Nim `concept` haha |
23:29:12 | FromDiscord | <Girvo> Which is a feature I wish we used more as a community |
23:34:28 | FromDiscord | <Elegantbeef> Hey my code reuse writeup does encourage them |
23:34:34 | FromDiscord | <Elegantbeef> Still need to add more to it though 😄 |
23:34:44 | FromDiscord | <jtv> Yeah, 100%, the problem w/ nim concepts is that most people want them to result in an auto-boxed type so you can basically have them double as interfaces, but they of course do not |
23:35:32 | FromDiscord | <jtv> Which I think is consistent w/ the rest of the language, but people keep wanting to shove crap of different types into one sequence 🙂 |
23:35:36 | FromDiscord | <Elegantbeef> The new style concepts are practically just an interface which should me that can happen |
23:35:46 | FromDiscord | <Elegantbeef> I mean practically just a trait |
23:36:05 | FromDiscord | <Elegantbeef> I say should, but i already have traitor written |
23:36:20 | FromDiscord | <Elegantbeef> Though it really needs a rewrite |
23:37:19 | FromDiscord | <jtv> Yeah, I think whether it's in the 'core' language or in the std library, people do really want interfaces. It was the only semi-decent idea in Java 🙂 |
23:37:42 | FromDiscord | <Elegantbeef> I'd like a concept backed trait system the most |
23:38:13 | FromDiscord | <jtv> Basically static duck typing |
23:38:30 | FromDiscord | <Elegantbeef> Yep |
23:38:35 | FromDiscord | <jtv> 100% |
23:39:00 | FromDiscord | <jtv> That's basically why I said "semi-decent" |
23:39:05 | FromDiscord | <jtv> You shouldn't have to declare them |
23:39:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pJJ |
23:39:20 | FromDiscord | <jtv> Ie, declare that you implement them |
23:39:35 | FromDiscord | <Elegantbeef> Yea i dislike how Rust does their system |
23:39:41 | * | azimut_ quit (Remote host closed the connection) |
23:39:44 | FromDiscord | <jtv> I like that tho I'd prefer you not even need to add {.trait.} tbqh |
23:39:58 | FromDiscord | <Elegantbeef> Nah concepts and traits are not the same |
23:40:11 | FromDiscord | <jtv> Well, I mean, use 'interface' instead of concept there |
23:40:19 | FromDiscord | <Elegantbeef> Ah |
23:40:30 | FromDiscord | <Elegantbeef> I dislike that |
23:40:31 | * | azimut joined #nim |
23:41:02 | * | zgasma quit (Quit: Lost terminal) |
23:41:08 | FromDiscord | <jtv> I've found heavy reliance on pragmas scares people away, and if it's a first-class feature, you don't need one |
23:41:14 | FromDiscord | <Elegantbeef> A concept used as a instantiated value should convert into a interface, used as a parameter should be a generic pragma |
23:41:44 | FromDiscord | <Elegantbeef> So in reality it wouldnt need `trait` the point of `trait` is to "ensure that we only use procedures declared inside this concept" |
23:42:07 | FromDiscord | <Elegantbeef> So then i'd argue `type Clickable = trait` 😄 |
23:42:27 | FromDiscord | <jtv> That's fine too |
23:43:38 | FromDiscord | <jmgomez> In reply to @jtv "I've found heavy reliance": what I dont like about pragmas is that it requires too many chars, given it's frequency they feel verbose |
23:44:03 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4pJK |
23:45:40 | FromDiscord | <Elegantbeef> Traits and the like seem like they'll be easier if ringabout's Vtable for methods gets merged in |
23:46:11 | FromDiscord | <Elegantbeef> It's just a suggested syntax |
23:46:14 | FromDiscord | <Elegantbeef> https://github.com/beef331/traitor my library doesnt use a pragma |
23:48:45 | FromDiscord | <jmgomez> ahh nice |
23:48:51 | FromDiscord | <Elegantbeef> I do also have a more go like interface toy https://github.com/beef331/nimtrest/blob/master/goface.nim#L187-L212 |
23:52:04 | FromDiscord | <jmgomez> looks cool |
23:53:50 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4pJM |
23:54:17 | FromDiscord | <jmgomez> Obviously 5 is not a pointer, it's just a minimal test before passing one |