<< 02-03-2023 >>

00:11:58*Xenon joined #nim
00:12:11*Xenon quit (Client Quit)
00:12:57*User11 joined #nim
00:15:46FromDiscord<jtv> In reply to @ShalokShalom "I see it more": Javascript isn't weakly typed, it's dynamically typed.
00:18:36FromDiscord<amadan> Thought it would be weakly typed? Like `"1" + 1 == "11"` seems like pretty weak typing imo
00:20:52FromDiscord<jtv> No, there’s a well defined type operation there
00:21:24FromDiscord<jtv> That’s just an implicit cast attached to the addition operator
00:22:30FromDiscord<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:06FromDiscord<Elegantbeef> Amadan we can do the same in Nim 😄
00:23:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pE2
00:23:35FromDiscord<Elegantbeef> It doesnt really make Nim weakly typed!
00:24:01FromDiscord<Elegantbeef> I'd jokingly say JS is typeless
00:27:02FromDiscord<jtv> Asm is basically typeless… well, monotyped
00:27:36FromDiscord<amadan> Ah ok, guess my understanding of weak types is wrong lol
00:28:05FromDiscord<Elegantbeef> To be fair there is ambiguity in what weak typing means
00:28:26FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4pE3
00:28:32FromDiscord<Elegantbeef> https://en.wikipedia.org/wiki/Strong_and_weak_typing#Definitions_of_%22strong%22_or_%22weak%22
00:28:54FromDiscord<Elegantbeef> I do not really care what anyone want's to call JS's type system or lack of, it's awful
00:29:00FromDiscord<jtv> But basically strong and weak aren’t particularly useful distinctions
00:29:16FromDiscord<jtv> And people assume static is all or nothing when it’s not
00:29:25FromDiscord<jtv> It’s a spectrum
00:29:28FromDiscord<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:26FromDiscord<Elegantbeef> Having a purely dynamic definition of an object is hellish if you ask me
00:31:31FromDiscord<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:18FromDiscord<Elegantbeef> We're making the case that whatever JS has is just bad! 😛
00:33:40FromDiscord<jtv> Exactly
00:33:48FromDiscord<Elegantbeef> If you have to run code to know it's doing things it shouldnt, you shouldnt use that
00:34:16FromDiscord<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:21User11`/disconnect
01:42:27User11oops
01:42:29User11lol
01:42:43*User11 quit (Quit: WeeChat 3.8)
02:03:36FromDiscord<Yepoleb> Goodbye User11
02:04:46FromDiscord<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:48FromDiscord<Iliketwertles> is there a simple way i can echo the output from a for loop into even columns?
03:47:41FromDiscord<Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4pEI
03:48:48FromDiscord<Iliketwertles> ~~def not making a knock-off suckless thing called suckmore~~
03:51:12FromDiscord<jtv> I mean, I have a janky string table api if need be.
03:53:38NimEventerNew 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:06FromDiscord<alx> can I get a job in #jobs in this server as a web developer?
05:17:48FromDiscord<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:36FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=4pET
05:18:41FromDiscord<Girvo> But the fun is, those new lines are all actually `\r\r\n`
05:18:44FromDiscord<Girvo> Don't ask me why lol
05:28:05Zevv_The wonderful world of the hayes protocol
05:28:12Zevv_we all thought we would get rid of that somewhere in the 80s
05:28:26Zevv_but now, it is still hunting us on a daily basis.
05:28:32Zevv_I do that shit for a living, and it makes me cry.
05:29:27Zevv_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:02Zevv_also, things are simpler if you ATE0 first
05:34:05Zevv_if you insist on npeg, something like this: http://ix.io/4pEV
05:38:43FromDiscord<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:07FromDiscord<Girvo> I've used scanf from strscans for the moment, but I think something more robust might end up being needed
05:39:13FromDiscord<Girvo> And you're not kidding about the crying 🥲
05:39:41Zevv_ikr. it's a hell. all these modems have their quirks and break their own protocols.
05:39:53FromDiscord<Girvo> they break _their own docs_
05:39:55FromDiscord<Girvo> It's madenss
05:39:58FromDiscord<Girvo> Madness, even
05:40:02Zevv_I've been working on the 7600 for a year or so, but I have not seen it drop the prefix
05:40:17Zevv_I think what you are seeing are unsilliciteds
05:40:29FromDiscord<Girvo> The only reason we're on the 7000 is we needed the 2G for one of our deployments, sadly
05:40:52FromDiscord<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:03Zevv_like, which one
05:41:41Zevv_the thing i'm making supports 5 different brands, and they are all crappy in one way or another
05:41:45FromDiscord<Girvo> I'm not allowed to say yet 😭 (which honestly drives me nuts) but you could probably guess easy enough I think
05:42:05Zevv_anyway, are you sure you handle URCs properly?
05:42:10Zevv_that messes up your protocols, also timing-wise
05:42:24FromDiscord<Girvo> Most definitely not, no
05:42:41Zevv_there you go.
05:42:59FromDiscord<Girvo> Though we do have the right timings in place, currently. but it's wonky as hell because of it
05:43:09Zevv_i feel your pain
05:43:23Zevv_but really: make sure to honour the 100ms backoff after each OK before you start ATing again
05:43:32FromDiscord<Girvo> Yeah, _that_ I do have in place at least
05:43:33Zevv_because the modem needs that interval to dump its URCs to you
05:43:45Zevv_and make sure to handle those, as these have no relation to your AT command in progress
05:44:19Zevv_all this is even more fun if you use virtual UARTS with CMUX
05:58:08FromDiscord<Girvo> Hah we're not
05:58:10FromDiscord<Girvo> The 7000 doesn't support it
05:58:15FromDiscord<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:16FromDiscord<ShalokShalom> In reply to @jtv "Asm is basically typeless…": Isn't any dynamic type system monotyped?
06:23:39FromDiscord<ShalokShalom> In reply to @jtv "Javascript isn't weakly typed,": It's both
06:24:12FromDiscord<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:40FromDiscord<Elegantbeef> I still just argue it's awful
06:25:37FromDiscord<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:47FromDiscord<ShalokShalom> And I really like asm here more
06:25:54FromDiscord<ShalokShalom> You at least know, what you get.
06:26:25FromDiscord<ShalokShalom> Implicit is another word for default. And the other way around. ↵And good defaults are half of computing.
06:26:47FromDiscord<ShalokShalom> That's the particular reason, why JS is so awful. Cause it has horrible defaults
06:26:57FromDiscord<ShalokShalom> Some people still use `var`
06:28:08FromDiscord<ShalokShalom> sent a long message, see http://ix.io/4pF7
06:28:53FromDiscord<ShalokShalom> ElegantBeef here sets the defaults for Nim, as an example 😛
06:29:17FromDiscord<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:49FromDiscord<ShalokShalom> sokam needs to show up at the disciplinary council
06:31:54FromDiscord<ShalokShalom> 🧐
06:32:15FromDiscord<Elegantbeef> `var a : Type = No`
06:32:56FromDiscord<Girvo> In reply to @Elegantbeef "`var a *: Type": hahaha
06:33:24FromDiscord<Girvo> Zevv_: I wish there was a nicer library for handling this AT stuff 🥲 Have you looked at/used FreeRTOS-Cellular?
06:34:31FromDiscord<Elegantbeef> Girvo
06:36:34Zevv_Girvo: no, we have written stuff from scratch
06:36:52Zevv_this project started about 12 years ago, we have targetted 7 or 8 different modems by now
06:37:04Zevv_every now and then I wonder how grown ups do this kind of things
06:37:17Zevv_then I open up the ModemManager source, or a few of the android RILs
06:37:40Zevv_that makes me feel like a war hero again, because the projects emit exactly the same wafts as mine
06:38:12Zevv_I have some contacts with support people for the various modem vendors, and they are actually kind of ashamed themselves
06:39:40FromDiscord<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:44FromDiscord<Girvo> I guess it can't be avoided lol
06:39:49FromDiscord<Girvo> Blame the modem mfgs!
06:40:05Zevv_esp_modem is not really usable, i must admit i have not seen freertos-cellular before
06:40:22Zevv_that might have come handy becaus I recently implemented this for ESP in C++ myself
06:40:29Zevv_good thing is that I did it in 700 lines instead of 7000
06:40:43FromDiscord<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:49FromDiscord<Girvo> I'd prefer it didn't work at all haha
06:41:06Zevv_robust is *the* problem with any of these things
06:41:08FromDiscord<Girvo> But yeah freertos-cellular I only came across the other day, its relatively new and pretty up to date
06:41:11Zevv_it's doable to get something pinging
06:41:23Zevv_but keeping it up under all circumstances is a different game
06:41:23FromDiscord<Girvo> yeah but put it in the real world and it shits the bed lol
06:41:57Zevv_I'm relatively "lucky" to have seen all possible failures at this other project over the years
06:41:58FromDiscord<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:11Zevv_oh yes, beware of modems falling back to 2G
06:42:14FromDiscord<Girvo> And only fully pulling the power to the entire board seems to fix it
06:42:26Zevv_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:31FromDiscord<Girvo> Yeah we geofence it. We have to have 2G sadly because we're deployed in Papua New Guinea
06:42:41FromDiscord<Girvo> But everywhere else we avoid it entirely
06:42:50Zevv_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:56FromDiscord<Girvo> I'm seeing 3x power draw compared to Nb-iot lol
06:43:40Zevv_we should have a beer and laught abotu all this, one day
06:44:06FromDiscord<Girvo> Absolutely haha, talk about a niche within a niche 😛
06:44:10Zevv_i'm still interested in your other modem alternative though, that might help me in my future projects
06:44:26FromDiscord<Girvo> Yeah its pretty great. Gives a socket-like interface to the PDP context as well, which is nice
06:44:39Zevv_on linux, or on esp?
06:44:51FromDiscord<Girvo> Both, apparently haha
06:44:57FromDiscord<Girvo> But its socket-like, not real sockets
06:44:57Zevv_how do they do that on esp?
06:45:16Zevv_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:17FromDiscord<Girvo> let me find the header, one moment
06:45:30Zevv_but for ESP, I wonder how they interface to the modem, if not over UART
06:45:40FromDiscord<Girvo> https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/source/include/cellular_api.h#L490
06:45:45FromDiscord<Girvo> Oh yes, it is over UART
06:45:53FromDiscord<Girvo> You provide the low level UART driver to it
06:46:02FromDiscord<Girvo> read/write, basically
06:46:05Zevv_well, so it's still uart + PPP to the modem, right
06:46:10Zevv_it's just hidden
06:46:12FromDiscord<Girvo> Doesn't do PPP actually
06:46:25Zevv_oh nice
06:46:34FromDiscord<Girvo> Uses the base 3GPP TS 27.006 AT commands for it, as far as I can tell
06:46:51FromDiscord<Girvo> Wait wrong version number lol
06:46:54FromDiscord<Girvo> You know the standard I mean
06:46:59Zevv_i'd have to readup on that stuff; i have not seen anything using serial-but-not-ppp
06:47:14Zevv_all other modems just do fancy USB interfaces, acm and the like
06:47:18FromDiscord<Girvo> Yeah true
06:47:42FromDiscord<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:56Zevv_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:01FromDiscord<Girvo> So FreeRTOS-Cellular gives you a `CellularSocketHandle_t` to use with them, so you can recv, send, setSockOpts, etc
06:48:05FromDiscord<Girvo> Ooooh nice
06:48:10Zevv_I'm for hire.
06:48:30FromDiscord<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:51FromDiscord<Girvo> Should get in contact tbh! We're a mostly remote team, and definitely will need new people shortly
06:49:23Zevv_you can always drop me a line of course, [email protected]
06:49:28FromDiscord<Girvo> will do!
06:49:37Zevv_i'm pretty busy next months tho, no promisis :)
06:51:13FromDiscord<Girvo> No worries 🙂
06:51:22FromDiscord<Girvo> Thats honestly not bad timing anyway haha
06:52:58Zevv_anyway, pleasure talking to you, rare to find people who suffer these specific ailments
06:53:02Zevv_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:48NimEventerNew thread by miran: This month with Nim - February 2023, see https://forum.nim-lang.org/t/9963
09:23:19FromDiscord<Elegantbeef> @narimiran whoops missed the link on the nimib stuff, got a PR to fix it open 😄
09:26:43FromDiscord<narimiran> In reply to @Elegantbeef "<@719992187890434069> whoops missed the": ouch! 😄
10:27:51FromDiscord<pietroppeter> haha saw that, thanks both for the post and for fixing that!
10:28:22FromDiscord<pietroppeter> (and that post might be on some orange site, if you know what I mean)
10:29:04FromDiscord<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:16FromDiscord<System64 ~ Flandre Scarlet> https://github.com/cimgui/cimnodes↵Would Futhark work on this? This is a C wrapper
12:02:21FromDiscord<basilajith> Is play.nim-lang.org down?
12:04:55FromDiscord<Rika> If need be theres an alternate site called wandbox that has nim support
12:08:47FromDiscord<Phil> In reply to @basilajith "Is play.nim-lang.org down?": Not anymore!
12:08:59FromDiscord<Phil> Shoutout to Pmunch for the quick reboot
12:12:27FromDiscord<basilajith> Yup, up now! Thanks @PMunch !
12:12:59*derpydoo quit (Quit: derpydoo)
12:13:47FromDiscord<Andreas> playground
12:13:56FromDiscord<Andreas> (edit) "playground ... " added "down ?"
12:27:14FromDiscord<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:21FromDiscord<Phil> Hot dang that was quick
12:37:38FromDiscord<Phil> Wait, no, it isn't down @Andreas , does it look like it is on your end?
12:40:41FromDiscord<Andreas> In reply to @Isofruit "Wait, no, it isn't": no, thx, its running again..
12:48:34via__is there a way to have generic specialization? like one proc myfunc[T](): T, but then a specialized myfunc[int](): int?
12:48:41FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4pGD
12:49:45FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=4pGD" => "https://play.nim-lang.org/#ix=4pGE"
12:49:56FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=4pGE" => "https://play.nim-lang.org/#ix=4pGF"
12:55:12FromDiscord<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:43via__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:15via__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:42via__nevermind, the when strategy works, thank you
13:10:41FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4pGN
13:13:47FromDiscord<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:40FromDiscord<demotomohiro> In reply to @luteva "I am using a": https://github.com/nim-lang/nimble#local-package-development
13:23:32FromDiscord<jtv> In reply to @ShalokShalom "It's both": No to both.
13:32:00*rockcavera joined #nim
13:32:46FromDiscord<ShalokShalom> JavaScript is dynamically and weakly typed.
13:48:16FromDiscord<Rika> weak typing and dynamic typing are different concepts that are not mutually exclusive
13:48:31FromDiscord<Rika> C is weakly typed, yet statically typed
13:48:44FromDiscord<Rika> Python is strongly typed, yet dynamically typed
13:51:04FromDiscord<Andreas> sent a long message, see https://paste.rs/wnp
13:51:48FromDiscord<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:11FromDiscord<Andreas> (edit) "http://ix.io/4pH0" => "http://ix.io/4pGZ"
13:52:55FromDiscord<Andreas> (edit) "http://ix.io/4pGZ" => "http://ix.io/4pH1"
13:53:32FromDiscord<Andreas> In reply to @Rika "its a bit funky": oh nnice, i'll try that..
14:37:45FromDiscord<eyes> I dont really fully understand C
14:37:53FromDiscord<eyes> but theres this type that I
14:38:05FromDiscord<eyes> (edit) "I" => "Im trying to bind to and it seems to never get defined"
14:38:19FromDiscord<eyes> sent a code paste, see https://play.nim-lang.org/#ix=4pHh
14:39:01FromDiscord<eyes> well, I'm trying to bind to ``dResourceContainerID``... so I guess i could use a generic pointer?
14:39:11FromDiscord<eyes> void pointer :drained:
14:40:06FromDiscord<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:04FromDiscord<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:59FromDiscord<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:20FromDiscord<eyes> bind the threading jobs to different and unrelated tasks
14:44:37FromDiscord<eyes> how would I parallel this in nim? is that even possible
14:45:11FromDiscord<eyes> sent a code paste, see https://play.nim-lang.org/#ix=4pHk
14:45:30FromDiscord<eyes> caused an error because ``dxResourceRequirements`` isnt defined
14:46:17FromDiscord<demotomohiro> It is called opaque type: https://internet-of-tomohiro.netlify.app/nim/gccguide.en.html
14:48:10FromDiscord<eyes> oh okay glad to hear this has a name
14:48:45FromDiscord<eyes> interesting that in my case, the members of the struct are never declared, even in implementation .c files
14:48:48FromDiscord<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:27FromDiscord<eyes> goddamn this is a useful resource
14:49:33FromDiscord<eyes> this is your website?
14:49:43FromDiscord<demotomohiro> Yes
14:49:58FromDiscord<eyes> very nice
14:50:09FromDiscord<demotomohiro> Thank you!
14:50:27FromDiscord<eyes> okay I see, i need to use the ``.header`` pragma to import the C header
14:50:47FromDiscord<eyes> and everything related to it requires that header
14:51:21FromDiscord<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:12FromDiscord<ieltan> bit`sets` have just blown my mind away
15:50:25FromDiscord<ieltan> (edit) "bit`sets` have" => "bitsetshave"
15:50:31FromDiscord<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:52NimEventerNew 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:39ehmryis there a way to run "runnableExample" snippets without generating any documentation files?
17:48:03FromDiscord<Phil> I can't say that I'm aware of one
17:48:20*azimut quit (Ping timeout: 255 seconds)
17:51:37ehmrymy 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:59cfamorning all
18:01:29cfaam i missing something obvious, or are do blocks not really documented on https://nim-lang.org/docs/manual.html ?
18:01:50cfathey're listed in the grammar and used in a few examples but i can't see anything else
18:03:35ehmrycfa: are you having a problem using them or just want to see some docs?
18:04:50ehmryI use them a lot but I just played around with them until I thought I knew how they work
18:05:35cfai wasn't really aware of them until i saw a code example recently
18:05:57cfaand i was probably unaware because there's no real discussion in the manual?
18:06:30cfaso to directly answer your question: 'just want to see some docs'
18:06:46cfai was planning on playing after reading up a little
18:08:31ehmryif you get in the habit of writing a lot of anonymous procs then do blocks makes sense and you will use them
18:08:41cfayeah, they look handy
18:08:43ehmryits just sugar
18:20:23FromDiscord<exelotl> Do notation for anonymous procs is in the "experimental" manual: https://nim-lang.org/docs/manual_experimental.html#do-notation
18:20:46cfathanks!
18:21:19cfaoh, i didn't realise that not everything in here requires the experimental pragma
18:24:55FromDiscord<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:13cfathanks for pointing me to the docs
18:28:07FromDiscord<spoon> any good guides on creating a wrapper?
18:28:19FromDiscord<Phil> wrapper?
18:28:38FromDiscord<spoon> for a c library
18:30:47FromDiscord<Phil> Tried using futhark yet?
18:31:20NimEventerNew thread by choltreppe: Import module just for comptime use, see https://forum.nim-lang.org/t/9964
18:31:21FromDiscord<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:39FromDiscord<spoon> does futhark generate a library or let you use the library directly?
18:34:11FromDiscord<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:22FromDiscord<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:32ehmryspoon: I run c2nim on the C library header and then adjust the output to be idomatic
18:39:05ehmrybut it depends how much surface area the API has
18:39:05FromDiscord<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:20FromDiscord<spoon> would prefer a general overview of what its doing before over-relying on tools
18:49:58FromDiscord<spoon> found a blog post from 2014 covering a few aspects
18:55:32FromDiscord<spoon> think i'll be fine just studying the generated wrapper code, ty
19:03:26FromDiscord<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:52FromDiscord<spoon> trying on the janet lang header file
19:08:36*jmdaemon quit (Ping timeout: 252 seconds)
19:15:46FromDiscord<Hourglass [She/Her]> Futhark is clang only
19:15:47FromDiscord<Hourglass [She/Her]> Afaik
19:16:11FromDiscord<Hourglass [She/Her]> Since Futhark works by using clang for wrapping the libraries
19:18:27FromDiscord<spoon> is there a flag i can pass into nimble install?
19:18:35NimEventerNew thread by jmgomez: Importc in NimVM, see https://forum.nim-lang.org/t/9965
19:21:14FromDiscord<Phil> PMunch , Futhark questions!
19:23:38FromDiscord<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:02FromDiscord<hotdog> In reply to @spoon "okay, so futhark 0.9": What's the error?
19:24:54FromDiscord<Phil> Jots down hotdog as point of contact for futhark questions
19:25:11FromDiscord<hotdog> In reply to @Isofruit "*Jots down hotdog as": Oh no 😆
19:25:40FromDiscord<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:42FromDiscord<spoon> busy so i'll have to pull it up later but it was an external program failure
19:26:52FromDiscord<spoon> from gcc
19:33:59*azimut_ joined #nim
19:34:05*azimut quit (Ping timeout: 255 seconds)
19:43:40FromDiscord<Hourglass [She/Her]> In reply to @hotdog "Futhark uses clang to": Ah
20:14:35*luis_ quit (Quit: Leaving)
20:49:15FromDiscord<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:24FromDiscord<Hourglass [She/Her]> In reply to @System64 "Any ways I can": I think futhark should be fine with it
21:04:42FromDiscord<System64 ~ Flandre Scarlet> In reply to @Hourglass, When the Hour Strikes "I think futhark should": I encountered problems with Futhark this time
21:06:13FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4pJ9
21:09:51FromDiscord<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:51FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4pJb
21:12:13FromDiscord<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:59FromDiscord<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:10FromDiscord<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:40FromDiscord<Rika> Strong and weak typing are different concepts to static and dynamic typing
22:47:59FromDiscord<Rika> Python is strong and dynamic
22:48:02FromDiscord<Dudugz> Hm, really? It looks the same to me
22:48:03FromDiscord<Rika> C is weak and static
22:48:34FromDiscord<Dudugz> What would be an example of static and weak language?
22:48:50FromDiscord<Dudugz> (edit) "weak" => "strong"
22:49:04FromDiscord<Dudugz> Or weak and dynamic
22:49:05FromDiscord<Rika> C, since it has typing but it also does a lot of coercion if some types do not match
22:49:21FromDiscord<Rika> JavaScript is considered weak and dynamic
22:49:54FromDiscord<Rika> It doesn’t have typing restrictions and it coerces types heavily in function resolution
22:50:26FromDiscord<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:55FromDiscord<Dudugz> This to me seems pretty strong, after all it needs to have explicit types
22:51:09FromDiscord<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:32FromDiscord<Rika> There’s a Wikipedia article huh
22:53:33FromDiscord<Rika> https://en.m.wikipedia.org/wiki/Strong_and_weak_typing
23:08:09FromDiscord<jtv> sent a long message, see http://ix.io/4pJE
23:09:14FromDiscord<jtv> And indeed that article aligns w/ that definition, it lists Python as strongly typed, etc.
23:10:15FromDiscord<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:27FromDiscord<jtv> Otherwise, the term is basically meaningless anyway
23:10:32FromDiscord<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:41FromDiscord<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:10FromDiscord<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:16FromDiscord<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:41FromDiscord<Girvo> Basically, its a stupid discussion 😄
23:21:12FromDiscord<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:37FromDiscord<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:09FromDiscord<Girvo> I think that describes what people mean when they say "weak" or "strong" (in colloquial usage) better, in most cases
23:23:33FromDiscord<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:45FromDiscord<Girvo> Agreed!
23:24:40FromDiscord<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:04FromDiscord<Girvo> My _favourite_ type system for that is Flow, interestingly
23:26:40FromDiscord<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:48FromDiscord<Girvo> Sadly, TypeScript won the battle haha
23:27:33*advesperacit quit ()
23:27:47FromDiscord<Girvo> Though typescript is now adding those features Flow had, too, so it gets better over time. Conditional types are crazy powerful
23:28:23FromDiscord<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:58FromDiscord<Girvo> It basically lets you do a restricted form of Nim `concept` haha
23:29:12FromDiscord<Girvo> Which is a feature I wish we used more as a community
23:34:28FromDiscord<Elegantbeef> Hey my code reuse writeup does encourage them
23:34:34FromDiscord<Elegantbeef> Still need to add more to it though 😄
23:34:44FromDiscord<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:32FromDiscord<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:36FromDiscord<Elegantbeef> The new style concepts are practically just an interface which should me that can happen
23:35:46FromDiscord<Elegantbeef> I mean practically just a trait
23:36:05FromDiscord<Elegantbeef> I say should, but i already have traitor written
23:36:20FromDiscord<Elegantbeef> Though it really needs a rewrite
23:37:19FromDiscord<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:42FromDiscord<Elegantbeef> I'd like a concept backed trait system the most
23:38:13FromDiscord<jtv> Basically static duck typing
23:38:30FromDiscord<Elegantbeef> Yep
23:38:35FromDiscord<jtv> 100%
23:39:00FromDiscord<jtv> That's basically why I said "semi-decent"
23:39:05FromDiscord<jtv> You shouldn't have to declare them
23:39:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pJJ
23:39:20FromDiscord<jtv> Ie, declare that you implement them
23:39:35FromDiscord<Elegantbeef> Yea i dislike how Rust does their system
23:39:41*azimut_ quit (Remote host closed the connection)
23:39:44FromDiscord<jtv> I like that tho I'd prefer you not even need to add {.trait.} tbqh
23:39:58FromDiscord<Elegantbeef> Nah concepts and traits are not the same
23:40:11FromDiscord<jtv> Well, I mean, use 'interface' instead of concept there
23:40:19FromDiscord<Elegantbeef> Ah
23:40:30FromDiscord<Elegantbeef> I dislike that
23:40:31*azimut joined #nim
23:41:02*zgasma quit (Quit: Lost terminal)
23:41:08FromDiscord<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:14FromDiscord<Elegantbeef> A concept used as a instantiated value should convert into a interface, used as a parameter should be a generic pragma
23:41:44FromDiscord<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:07FromDiscord<Elegantbeef> So then i'd argue `type Clickable = trait` 😄
23:42:27FromDiscord<jtv> That's fine too
23:43:38FromDiscord<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:03FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4pJK
23:45:40FromDiscord<Elegantbeef> Traits and the like seem like they'll be easier if ringabout's Vtable for methods gets merged in
23:46:11FromDiscord<Elegantbeef> It's just a suggested syntax
23:46:14FromDiscord<Elegantbeef> https://github.com/beef331/traitor my library doesnt use a pragma
23:48:45FromDiscord<jmgomez> ahh nice
23:48:51FromDiscord<Elegantbeef> I do also have a more go like interface toy https://github.com/beef331/nimtrest/blob/master/goface.nim#L187-L212
23:52:04FromDiscord<jmgomez> looks cool
23:53:50FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4pJM
23:54:17FromDiscord<jmgomez> Obviously 5 is not a pointer, it's just a minimal test before passing one