<< 13-09-2022 >>

00:18:26*cyraxjoe quit (Read error: Connection reset by peer)
00:22:16*cyraxjoe joined #nim
01:11:41*rockcavera quit (Remote host closed the connection)
01:12:55*rockcavera joined #nim
01:12:55*rockcavera quit (Changing host)
01:12:55*rockcavera joined #nim
01:26:31FromDiscord<Girvo> Hi all 🙂
01:27:25FromDiscord<Girvo> I'm using stew/endians2 to handle some Modbus data, converting two uint8s into an endian-aware uint16, for example. ↵It doesn't handle signed ints though. Any good references for how I should go about it? ↵The specific comments in the library itself mention that under/overflow complicate matters a little
01:33:41FromDiscord<Elegantbeef> I'd say something if i was smart enough to understand why signed ints change anything
01:37:18FromDiscord<Girvo> See thats what I thought too lol
01:37:34FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=4al3
01:38:01FromDiscord<Elegantbeef> Oh the issue is more just using those types increase the chance of going over/under
01:38:29FromDiscord<Girvo> Right. In this case it never will because the slave is generating known-good values. So I could safely add them then?
01:38:48FromDiscord<Elegantbeef> LIkely
01:38:56FromDiscord<Elegantbeef> I do like that `uint8` is there
01:39:02FromDiscord<Girvo> haha same
01:39:04FromDiscord<Elegantbeef> Is it BE or LE, who knows?! ;D
01:39:41FromDiscord<Girvo> One thing I'm dreading is dealing with word-order that differs with byte-order. I'm praying none of the modbus slaves we deal with do that, but sadly it's apparently semi-common
01:40:08FromDiscord<Girvo> I can't for the life of me work out _why_ you would ever want that, but I dunno maybe I'm missing something
01:40:36FromDiscord<Elegantbeef> Those C programmers were on somthing
01:45:59FromDiscord<Girvo> Now to work out how to do a `float` in the same way, with 4 bytes, endian-aware. Maybe it'll work the same way?
01:46:21FromDiscord<Elegantbeef> float32 you mean 😛
01:46:27FromDiscord<Girvo> Indeed 😛
01:46:36FromDiscord<Girvo> Though we may need to deal with float64 as well, apparently
01:46:45FromDiscord<Elegantbeef> `cast[uint32]` then use the same mechanisms as the uint32?
01:47:19FromDiscord<Girvo> Thats basically what I've done. I'll test it and see if it works
01:48:33FromDiscord<xzntrc> whats the best way for writing configs?
01:48:51FromDiscord<Elegantbeef> Depends on your view, you can use json, yaml, toml,....
01:49:13FromDiscord<xzntrc> ah toml
01:49:21FromDiscord<xzntrc> toml is basically .ini right?
01:49:34FromDiscord<Elegantbeef> More standard and more modern yes
01:51:10FromDiscord<Bung> In reply to @Girvo "I'm using stew/endians2 to": I use https://github.com/OpenSystemsLab/struct.nim for handle endians
01:53:27FromDiscord<Girvo> @Bung Oh that looks nice
01:55:50FromDiscord<Bung> or if you like node's buffer api https://github.com/bung87/buffer
01:56:41*arkurious quit (Quit: Leaving)
02:02:10FromDiscord<wegathabtc> Click on the link and thank me later 👉👉👉https://t.me/+6418gUGZ6qQ2YzE0
02:08:46FromDiscord<Girvo> <@&371760044473319454>
02:09:08FromDiscord<Girvo> How would swapBytes work for a float32... treat it all as uint32 then cast at the end maybe?
02:09:30FromDiscord<Girvo> I might dig into your code Bung
02:09:39FromDiscord<Elegantbeef> Likely if strict aliasing doesnt get in your way 😄
02:11:25FromDiscord<Girvo> Yeah lol
02:11:35FromDiscord<Girvo> I'm having fun with the various shift-lefts it relies on
02:13:12FromDiscord<Elegantbeef> Oh i do have to say girvo wasm3 solves most of my issues with the other wasm runtimes 😄
02:13:37FromDiscord<Girvo> Oh thats awesome 😄
02:14:35FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=4ala
02:14:39FromDiscord<Girvo> Trying to special case float32 handling for it
02:14:50FromDiscord<Elegantbeef> You can throw a when inside
02:15:05FromDiscord<Girvo> Yeah I just don't know what the `==` check I'm supposed to do is lol
02:15:10FromDiscord<Elegantbeef> You also could move that to be `x: ExtraEndianint): ExtraEndianint`
02:15:16FromDiscord<Elegantbeef> Oh it'd be `x is float32`
02:15:24FromDiscord<Girvo> Ah! `is` is what i was missing 🙂
02:15:25FromDiscord<Girvo> Cheers
02:15:33FromDiscord<Elegantbeef> then you could have a `func swapBytes(x; float32): float32)`
02:17:22FromDiscord<Girvo> Yeah thats how stew/endians2 handles it
02:17:31FromDiscord<Girvo> Has a whole suite of them for every type it uses
02:20:36FromDiscord<Elegantbeef> I'm quite surprised you havent needed the `is` operator before now
02:32:19FromDiscord<Girvo> I've just not had too do much directly with it tbh
02:32:41*monkeybusiness quit (Remote host closed the connection)
02:32:54FromDiscord<Girvo> Theres a lot less type-level abstraction in this firmware right now, though once the expo is done we'll be going back and refactoring a lot of it
02:43:11FromDiscord<Girvo> Okay so the cast-to-uint32 for float32 handling appears to work, though I've done "little endian" usage as I think the swap bytes implementation is off. I'll test it more when I connect the real slaves to it. But I can get the expected float from my slave simulator
02:43:48FromDiscord<Girvo> Oh lol. The endianness is because Modbus uses "FloatReverse" apparently. Wild.
02:43:52FromDiscord<Elegantbeef> "slave simulator" is an atrocious term used in any other context 😛
02:44:10FromDiscord<Girvo> Haha it gets worse, this is an Active Slave Simulator 😐
02:45:03FromDiscord<Girvo> Hmm. I'm losing some precision across all this somewhere. `1.900` on the simulator is being read back as `1.899999976158142` on the ESP itself. Weird.
02:45:27FromDiscord<Girvo> The simulator doesn't let me be more precise than three decimal places though. Probably a reason for it...
02:46:44FromDiscord<Girvo> The joys of IEEE-734...
02:50:51FromDiscord<Girvo> Is there a way to round to `n` decimals? I know `round` in std/math will do to `0` places obviously
02:52:30FromDiscord<Elegantbeef> Other than formatting, not really, you can do `round(a / 0.00001) 0.000001` but precision be spiteful mistress
02:52:44FromDiscord<Elegantbeef> Those literals should be the same size
02:52:48FromDiscord<Girvo> Yeah, damn. Alright, I
02:53:02FromDiscord<Girvo> I'll look into whether its even a problem, this simulator is a bit funny anyway
02:53:06FromDiscord<Girvo> It might be fine with real data
03:04:23*derpydoo quit (Ping timeout: 268 seconds)
04:09:03FromDiscord<ravinder387> config = {type: 'barchart'} ----> when i map this in nim it gets error
04:09:14FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4alt
04:09:22FromDiscord<ravinder387> i can't use keyword as object variable
04:09:28FromDiscord<ravinder387> what should i do
04:12:05FromDiscord<Elegantbeef> `typ {.imporc: "type".}`
04:12:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=450k
04:13:48FromDiscord<ravinder387> `type↵ Config = object↵ type: cstring {.importc: `type`.}↵ data: DataObj`
04:13:51FromDiscord<ravinder387> i get error
04:14:00FromDiscord<Elegantbeef> Yea cause you dont know how to copy code
04:15:02FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4alu
04:17:42FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4alv
04:30:22FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4alx
04:30:43FromDiscord<ravinder387> seq[T] undeclare T. how to declare generic sequence
04:31:07FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut2.html#generics
04:57:08FromDiscord<Girvo> `Dataset[T] = object`
05:08:36*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
06:10:31*wallabra quit (Ping timeout: 250 seconds)
06:11:59*wallabra joined #nim
06:39:09*wallabra quit (Ping timeout: 252 seconds)
06:47:50FromDiscord<ravinder387> I wrap the library but this is not desirable https://media.discordapp.net/attachments/371759389889003532/1019137310698242089/2022-09-13.png
06:48:24FromDiscord<ravinder387> seq[cstring] is this possible to create seq of cstring type
06:48:34FromDiscord<ravinder387> seq[cstring] i geeting error
06:49:06FromDiscord<ravinder387> nim string represent as buffer in javascript
06:50:27*rockcavera quit (Remote host closed the connection)
06:57:47FromDiscord<supakeen> Which error are you getting?
07:00:47FromDiscord<Elegantbeef> The one
07:14:22FromDiscord<fbpyr> sent a long message, see http://ix.io/4alT
07:15:23FromDiscord<Elegantbeef> might need `--dynLibOverride:"git2"`
07:17:15FromDiscord<Elegantbeef> Yea seems hlibgit2 is only for linux presently
07:17:16FromDiscord<Elegantbeef> https://github.com/haxscramper/hlibgit2/blob/3756ac59743824e8ba2cf030b072eaea53b6e01f/src/hlibgit2/libgit2_config.nim#L3
07:17:47FromDiscord<haxscramper> > strdefine
07:17:59FromDiscord<haxscramper> You can define whatever you need
07:18:57FromDiscord<fbpyr> ahh 💡 the `.so` it comes from hlibgit - thank you Elegantbeef 🙂
07:19:10FromDiscord<Elegantbeef> Ah yea i'm tired so... yea
07:23:45FromDiscord<fbpyr> thank you haxscramper\: the strdefine would be in gittyup to override the .so stringLiteral in hlibgit2 ?
07:24:38FromDiscord<haxscramper> Strdefine needs to be defined from the compilation
07:24:57FromDiscord<haxscramper> But all of this is garbage anyway, I will move to normal linking sometimes later
07:25:02FromDiscord<fbpyr> ah ok - I did not find it in the compiler option docs
07:25:38FromDiscord<fbpyr> haxscramper\: that linker would then pick up the dll on win?
07:26:01FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4alW
07:26:11FromDiscord<Elegantbeef> `when` not `if`
07:26:16FromDiscord<haxscramper> Supposedly yes, but I haven't tested it on windows
07:26:25FromDiscord<haxscramper> I don't know how the linker works there
07:26:33FromDiscord<haxscramper> According to dynlib it should work
07:27:08FromDiscord<4zv4l> thank you ^^ is there a else for when ?
07:27:27FromDiscord<Elegantbeef> `else` and `elif`
07:28:09FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4alX
07:28:18FromDiscord<4zv4l> after the Book return here it says its unreachable
07:28:37FromDiscord<Elegantbeef> Full code?
07:29:46FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4alY
07:30:00FromDiscord<Elegantbeef> `elif` not another when
07:30:20FromDiscord<Elegantbeef> Otherwise you have a return after another
07:30:39FromDiscord<4zv4l> I thought when is like if but compile time
07:30:42FromDiscord<Elegantbeef> It is
07:31:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4alZ
07:31:21FromDiscord<4zv4l> yeah the type can change
07:31:22FromDiscord<Elegantbeef> Which is invalid nim
07:31:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4am0
07:31:42FromDiscord<Elegantbeef> And?
07:31:42FromDiscord<Elegantbeef> Make a proper when tree
07:31:43FromDiscord<4zv4l> so the first one isn't always true
07:31:48FromDiscord<Elegantbeef> Except in this case it is true
07:32:17FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4am1
07:33:28FromDiscord<Elegantbeef> so then write that
07:33:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4am2
07:39:47FromDiscord<Elegantbeef> But why you dont just create a `proc create(_: typedesc[Book], els: openarray[string]): Book` is beyond me
07:40:29FromDiscord<pouriya_inmanta> hi↵how can i check if a string variable is empty or not? I tried myString.isNil but it does not compile.
07:40:40FromDiscord<Elegantbeef> `.len` or `== ""`
07:42:23FromDiscord<4zv4l> where can I see all exception a proc can raise ? like opening a file ?
07:42:39FromDiscord<Elegantbeef> the raises list
07:43:07FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1019151224697798728/image.png
07:43:26FromDiscord<Elegantbeef> It's in docgen, luckily if you dont want a proc to raise you can just annotated it `{.raises: [].}`
07:43:44FromDiscord<4zv4l> image.png https://media.discordapp.net/attachments/371759389889003532/1019151380759445534/image.png
07:43:46FromDiscord<4zv4l> I don't see them
07:43:57FromDiscord<Elegantbeef> `raises: []` means it doesnt raise
07:44:05FromDiscord<4zv4l> so it can always open the file ?
07:44:16FromDiscord<Elegantbeef> It returns a bool if it fails
07:44:43FromDiscord<4zv4l> how do I know if that's because the file doesn't exist or if it's because of permissions ?
07:44:52FromDiscord<Elegantbeef> You dont with that api
07:44:54FromDiscord<Elegantbeef> Use the other open if you care
07:45:57*Vladar joined #nim
07:46:01FromDiscord<4zv4l> alright, thanks !
08:05:17*mahlon quit (Ping timeout: 265 seconds)
08:06:33*mahlon joined #nim
08:17:12*mahlon quit (Ping timeout: 264 seconds)
08:18:43*mahlon joined #nim
08:21:15FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=4am8
08:21:35FromDiscord<aruZeta> (note that I have a converter to make Percentage into bool)
08:21:49FromDiscord<aruZeta> maybe I can't do it that way?
08:28:25FromDiscord<Rika> looks likes an internal error though
08:29:10FromDiscord<aruZeta> yes
08:29:58FromDiscord<demotomohiro> that compile error come from gcc. Probably Nim compiler bug or wrapping C lib incorrectly.
08:30:21FromDiscord<aruZeta> i'm not wrapping any lib
08:30:33FromDiscord<aruZeta> unless you mean the nim complier itself
08:30:37FromDiscord<aruZeta> (edit) "complier" => "compiler"
08:33:14FromDiscord<demotomohiro> Then, it might Nim compiler bug
08:33:43FromDiscord<Elegantbeef> The Nim compiler isnt supposed to have any C compiler errors without you causing them directly importing bad C
08:33:44FromDiscord<Elegantbeef> So yes it's a compiler bug
08:34:49FromDiscord<aruZeta> what should I do then
08:35:02FromDiscord<aruZeta> file an issue in the nim github
08:35:12FromDiscord<Elegantbeef> Make a min repro and yep
08:37:09FromDiscord<aruZeta> what do you mean by "min repro"
08:37:20FromDiscord<Elegantbeef> minimum reproduction
08:37:36FromDiscord<aruZeta> ahh ok
08:38:00FromDiscord<Elegantbeef> The best github issues are single files and the fewest lines
08:38:27FromDiscord<aruZeta> will try to make a min repro then
08:38:50FromDiscord<aruZeta> i'm more concerned with what coud I do to fix it tho hmm
08:39:13FromDiscord<Elegantbeef> remove the converter and see if that changes anything
08:39:17FromDiscord<aruZeta> nope
08:39:23FromDiscord<Elegantbeef> Likely the if expression then
08:39:39FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=4amd
08:39:40FromDiscord<aruZeta> this doesn't
08:39:58FromDiscord<aruZeta> well yh removing the if fixes it
08:40:44FromDiscord<Elegantbeef> Figuring out what causes it will let you work around it
08:40:48FromDiscord<Elegantbeef> I dont know what would cause it
08:41:08FromDiscord<Elegantbeef> Ah found it
08:41:31FromDiscord<Elegantbeef> It's the subrange type
08:42:06FromDiscord<Elegantbeef> Ah yes that makes sense
08:42:36*reversem3[m] quit (Quit: Bridge terminating on SIGTERM)
08:42:36*buster_blue[m] quit (Quit: Bridge terminating on SIGTERM)
08:42:37FromDiscord<Elegantbeef> It requires checking when it converts from Percentage to `0f32 .. 0.4f32` so it creates funky code
08:43:32*vicecea quit (Ping timeout: 268 seconds)
08:48:21*buster_blue[m] joined #nim
08:58:10FromDiscord<Rika> range of float kinda funky
08:58:11*reversem3[m] joined #nim
09:12:08FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4amm
09:12:24FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4amn
09:14:49FromDiscord<Elegantbeef> Templates are not procedures
09:15:08FromDiscord<Elegantbeef> they paste the code exactly so wherever you are you're inserting `return Choices.Book`
09:15:56FromDiscord<4zv4l> so I should change it to a proc or modify a little thing to make it work ?
09:16:11FromDiscord<Elegantbeef> Make it a proc
09:17:43FromDiscord<4zv4l> alright, thank you again ^^
09:28:57FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4amp
09:37:14FromDiscord<aruZeta> In reply to @Elegantbeef "It requires checking when": hmm, so removing the type and using the range directly should fix it?
09:37:21FromDiscord<aruZeta> ah no it doesn't :/
09:38:19FromDiscord<aruZeta> instead of using a range I could check with an if if the value is between 0 and 100 and raise a Defect, but makes the code more complicated
09:50:11FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=4amx
09:53:01*Vladar quit (Quit: Leaving)
09:53:15FromDiscord<aruZeta> okay seems like the issue is that using `if` in a default param is not supported
09:55:33FromDiscord<aruZeta> or at least `if`'s not using known at compiletime code
09:58:08FromDiscord<Rika> it should be iirc
10:01:23FromDiscord<aruZeta> okay I found why
10:01:52FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=4amE
10:05:41FromDiscord<aruZeta> and the same with `float` and `float32`
10:10:26FromDiscord<soda> I think i'm going to implement a lot of nim's std in c++
10:10:35FromDiscord<soda> starting with string splitting
10:10:45FromDiscord<soda> i need a lot of these helper functions xD
10:10:45FromDiscord<Rika> why?
10:10:49FromDiscord<Rika> i mean you do you but why
10:10:53FromDiscord<soda> bored + why not?
10:10:56FromDiscord<Rika> okay
10:11:12FromDiscord<soda> i'm curious why you find the idea bad(?)
10:11:33FromDiscord<ache of head> isnt a lot of this stuff already in stl
10:11:33FromDiscord<aruZeta> it's not that he finds it bad, he just asked why
10:11:58FromDiscord<soda> In reply to @c1m5j "isnt a lot of": It is, but the stl is always so annoying to use
10:12:09FromDiscord<ache of head> 🤔
10:13:12FromDiscord<soda> it's very verbose an also achieving something often requires multiple steps.↵I want string.split(char delim) to generate a dynamic array of vectors, no questions asked
10:13:21FromDiscord<soda> (edit) "vectors," => "strings,"
10:13:29FromDiscord<soda> Like it does in nim
10:13:38FromDiscord<ache of head> maybe its verbose for a reason?
10:14:10FromDiscord<soda> I wish they shared those reasons
10:14:23FromDiscord<ache of head> who did
10:14:36FromDiscord<soda> whoever makes the stl
10:14:36FromDiscord<Rika> you know i misunderstood you when you said "reimplement"
10:14:41FromDiscord<Rika> rather implement
10:14:53FromDiscord<soda> err my bad, you are right, they are different
10:14:55FromDiscord<Rika> i thought you meant that you were gonna write the stdlib for nim in c++
10:15:09FromDiscord<Rika> that would be truly strange really
10:15:46FromDiscord<soda> no i meant i want nim-style functionality in C++
10:15:57FromDiscord<soda> the other way around, kinda
10:16:04FromDiscord<ache of head> why not just write in nim?
10:16:22FromDiscord<ache of head> unless it’s like a school project and there are restrictions or smth like that
10:16:32FromDiscord<Rika> yeah i know im just saying thats why i asked why
10:16:51FromDiscord<soda> no im just bored and have about two weeks until my next job
10:17:34FromDiscord<ache of head> i see
10:17:46FromDiscord<ache of head> an original way to kill boredom then
10:23:26*monkeybusiness joined #nim
10:26:24FromDiscord<soda> https://media.discordapp.net/attachments/371759389889003532/1019192316910645258/emacs_UBxmSf47WW.png
10:26:34FromDiscord<soda> ¯\_(ツ)_/¯
10:36:04*genpaku quit (Remote host closed the connection)
10:40:41*genpaku joined #nim
11:25:22FromDiscord<dlesnoff> Hello, I got an error when trying to use the raises pragma. Do I have to activate a switch for the nim compiler to understand ? Can we not attach exceptions to macro definition ?
11:26:41FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4amV
11:27:03FromDiscord<dlesnoff> I get :↵Error: cannot attach a custom pragma to 'typeMemoryRepr'
11:30:29FromDiscord<dlesnoff> but raises is not a custom pragma, isn't it ?
11:31:20FromDiscord<Generic> that error is pretty bad, but I don't think macros should throw exceptions
11:31:40FromDiscord<Generic> if you want to signal an error, use the error proc from the macros module
11:32:15FromDiscord<Generic> it generates a compile error and you can optionally pass a NimNode to it, which's location will be set as the location of the error
11:32:41FromDiscord<Generic> for what you're doing specially there's a utility function in the macros module
11:32:44FromDiscord<Generic> expectKind
11:32:56FromDiscord<Generic> https://nim-lang.org/docs/macros.html#expectKind%2CNimNode%2CNimNodeKind
11:33:09FromDiscord<Generic> https://nim-lang.org/docs/macros.html#error%2Cstring%2CNimNode
11:33:58*monkeybusiness quit (Quit: Leaving)
11:40:23FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=4amX
11:40:35FromDiscord<aruZeta> the workaround is using another func
11:40:47FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=4amY
11:46:46FromDiscord<aruZeta> but it doesn't seem to work with my og code tho
11:48:30FromDiscord<aruZeta> :(
11:49:01FromDiscord<aruZeta> oh wait
11:49:10FromDiscord<aruZeta> it works removing the `range`
11:49:50FromDiscord<aruZeta> will have to remove the range and check if the value is on range, raising Defects if it's not
13:07:32*arkurious joined #nim
13:28:05*derpydoo joined #nim
14:15:29FromDiscord<@thatrandomperson5-6310e3b26da03> How would i insert a xmlNode into an XmlNode children at a pos
14:18:32*wallabra joined #nim
14:25:11*wallabra quit (Ping timeout: 268 seconds)
14:25:19FromDiscord<vestel> In reply to @@thatrandomperson5-6310e3b26da03 "How would i insert": afaik its a tree so you can't
14:25:27FromDiscord<vestel> just travel to required child
14:36:16*rockcavera joined #nim
14:36:17*rockcavera quit (Changing host)
14:36:17*rockcavera joined #nim
14:43:37FromDiscord<Not Saucx> sent a code paste, see https://play.nim-lang.org/#ix=4aof
14:44:05FromDiscord<Not Saucx> so if the input is "<https://www.urbandictionary.com/define.php?term=vomit>"↵I want↵"<https://www.urbandictionary.com>"
14:44:25FromDiscord<Not Saucx> (edit) "so if the input is "<https://www.urbandictionary.com/define.php?term=vomit>"↵I want↵"<https://www.urbandictionary.com>"" => "sent a long message, see http://ix.io/4aog"
14:44:27FromDiscord<Not Saucx> https://media.discordapp.net/attachments/371759389889003532/1019257251933986907/unknown.png
14:48:14FromDiscord<hotdog> sent a code paste, see https://play.nim-lang.org/#ix=4aoi
14:48:44FromDiscord<Not Saucx> i got it
14:48:46FromDiscord<hotdog> so `"https://www.urbandictionary.com/define.php?term=vomit"` becomes `@["https:", "", "www.urbandictionary.com", "define.php?term=vomit"]`
14:48:58FromDiscord<Not Saucx> sent a code paste, see https://paste.rs/zFf
14:50:27FromDiscord<hotdog> So if you want to use split to generate the output you said above, it will need to be something like `line.split("/")[0..2].join("/") & "/"`
14:51:02FromDiscord<hotdog> But there are better ways to do this, `std/strscans` is good for general parsing stuff, and there are uri specific parsers already
14:51:03FromDiscord<hotdog> 1sec
14:51:25FromDiscord<hotdog> `std/uri` - https://nim-lang.org/docs/uri.html
14:53:29NimEventerNew thread by drkameleon: Custom macro for if-let statement, see https://forum.nim-lang.org/t/9462
14:53:31FromDiscord<enthus1ast> @Not Saucx\: why not use parseUri from uri?
14:53:45FromDiscord<enthus1ast> then output the stuff you need from the parsed object
14:53:54FromDiscord<Not Saucx> In reply to @enthus1ast "<@497120370436866069>\: why not use": could i then connect to it after?
14:54:18FromDiscord<enthus1ast> sure why not
14:54:19FromDiscord<Not Saucx> b/c i want to basically remove all links params in a file and then connect to it
14:56:16FromDiscord<vestel> how does uint8(uint64) converts? by saturation?
15:03:09FromDiscord<auxym> In reply to @Not Saucx "b/c i want to": remove the params then use https://nim-lang.org/docs/uri.html#%24%2CUri
15:06:22FromDiscord<@thatrandomperson5-6310e3b26da03> What do you mean?↵(@vestel)
15:16:26FromDiscord<Not Saucx> sent a code paste, see https://play.nim-lang.org/#ix=4aoB
15:16:59FromDiscord<Not Saucx> sent a code paste, see https://play.nim-lang.org/#ix=4aoC
15:49:55FromDiscord<hotdog> sent a code paste, see https://paste.rs/T2B
15:55:17FromDiscord<Crimeware💾> Good day everyone, is there a reference resource anyone can point me to for making linux kernel modules in Nim?
15:59:37FromDiscord<auxym> In reply to @Crimeware💾 "Good day everyone, is": https://github.com/zevv/nim-kernel-module
15:59:57FromDiscord<Crimeware💾> In reply to @auxym "https://github.com/zevv/nim-kernel-module": Thanks!
16:05:14FromDiscord<Rika> that was quick
16:11:17FromDiscord<Not Saucx> sent a code paste, see https://play.nim-lang.org/#ix=4aoT
16:13:07*wallabra joined #nim
16:15:18FromDiscord<Rika> a bad request would not have Http200
16:45:56FromDiscord<ZaRR> Hello everyone!↵Trying to configure latest version of Nim with tcc which are installed to:↵``C:\Nim``↵``C:\tcc`` https://media.discordapp.net/attachments/371759389889003532/1019287821699264584/unknown.png
16:46:28FromDiscord<ZaRR> Hello everyone!↵Trying to configure latest version of Nim with tcc which are installed to:↵``C:\Nim``↵``C:\tcc``
16:46:53FromDiscord<ZaRR> Wonder if I need the one with ``Users\...`` didn't install anything there. https://media.discordapp.net/attachments/371759389889003532/1019288066365599894/unknown.png
16:48:03FromDiscord<ZaRR> (edit) "Hello everyone!↵Trying to configure latest version of Nim with tcc which are installed to:↵``C:\Nim``↵``C:\tcc``" => "sent a long message, see http://ix.io/4ap5"
16:48:43FromDiscord<jan0809> whats tcc
16:48:51FromDiscord<ZaRR> tiny c compiler
16:48:57FromDiscord<ZaRR> (edit) "compiler" => "compiler. Nim supports it."
16:49:52FromDiscord<jan0809> not sure if its that easy on windows since it compile inside a virtual linux environment afaik
16:50:13FromDiscord<jan0809> i think to avoid the huge vs deps
16:50:28FromDiscord<jan0809> correct me if im wrong
16:50:39FromDiscord<ZaRR> That would surprise me if that's true.
16:51:41FromDiscord<ZaRR> sent a code paste, see https://play.nim-lang.org/#ix=4ap7
16:52:03FromDiscord<jan0809> see choosenim readme
16:52:07FromDiscord<jan0809> https://media.discordapp.net/attachments/371759389889003532/1019289382915670136/IMG_20220913_185137.jpg
16:53:01FromDiscord<jan0809> dont remember right off the bat what it downloads but some kind of msys thing if i remener right
16:53:38FromDiscord<jan0809> thats why i use nim in wsl when i happen to use windows
16:53:44*tiorock joined #nim
16:53:45*tiorock quit (Changing host)
16:53:45*tiorock joined #nim
16:53:45*rockcavera quit (Killed (molybdenum.libera.chat (Nickname regained by services)))
16:53:45*tiorock is now known as rockcavera
16:54:04FromDiscord<jan0809> but im not sure maybe im completely wrong
16:56:25FromDiscord<ZaRR> In reply to @jan0809 "see choosenim readme": where such doc, can't find.
16:57:09FromDiscord<jan0809> from the image? here https://github.com/dom96/choosenim
16:57:46FromDiscord<jan0809> atleast thats what i use to install nim
16:58:34FromDiscord<ZaRR> aaaa, I feel like there should be easier way. Let's wait what others say 🙂
16:59:19FromDiscord<jan0809> yeah true, i could totally be missinformed here
17:00:16FromDiscord<jan0809> but i would be interested in the answer aswell tcc sounds quite lightweight
17:05:50FromDiscord<ZaRR> https://nim-lang.org/faq.html↵at the bottom
17:12:44FromDiscord<auxym> afaik tcc should work on windows. you can do the config change as in the FAQ (either system wide config or project config) or pass `--cc:tcc` as a command line arg
17:13:50FromDiscord<auxym> tcc is small and fast, but does not optimize, so resulting code will be larger and slower compared to gcc/msvc/clang
17:17:49FromDiscord<jan0809> is tcc in any package manager (scoop chocolatey etc)
17:18:44FromDiscord<auxym> In reply to @jan0809 "dont remember right off": and msys2 is just a windows port of gcc and various related utils (make, binutils, etc). It's not a VM. Nim and msys2 works just fine on windows without WSL. Can also use MSVC in theory.
17:19:25FromDiscord<auxym> https://scoop.sh/#/apps?q=tcc&s=0&d=1&o=true
17:19:59FromDiscord<jan0809> yeah but its a way bigger download still on windows than inside wsl, and i have garbage internet connection so thats a huge difference for me lol
17:20:32FromDiscord<jan0809> but to be fair
17:20:45FromDiscord<jan0809> way way smaller then the vs compiler
17:21:20FromDiscord<auxym> trust me MSVC is worst 🙂 like 4 GB to get a working c/c++ toolchain with ms build tools 2022
17:21:42FromDiscord<jan0809> thats what i was talking about
17:21:46FromDiscord<auxym> just checked and msys2 download is 82 mb...
17:22:06FromDiscord<jan0809> ok thats not as big as i thought
17:22:26FromDiscord<auxym> but I mean if you want to play around with tcc go ahead, should work
17:22:42FromDiscord<jan0809> does nim work on alpine btw?
17:22:50FromDiscord<auxym> no idea
17:22:55FromDiscord<jan0809> or does it conflict with musl
17:23:41FromDiscord<auxym> no idea but: https://scripter.co/nim-deploying-static-binaries/
17:23:52FromDiscord<jan0809> chocolatey also seem to have tcc
17:26:28FromDiscord<ZaRR> I already configured ``cc:tcc`` in config file.↵Ofcourse I used msys2 before, but I wonder if possible to use Nim directly from Win.
17:26:57FromDiscord<jan0809> ah i remeber now i didnt had a problem msys2s size but i were afraid it could mess up devkitpro i think
17:27:58FromDiscord<Ekopalypse> @ZaRR - seems to work for me `nim r --cc:tcc --eval:"echo 1"`
17:28:04FromDiscord<Ekopalypse> on windows 10
17:28:07FromDiscord<auxym> In reply to @ZaRR "I already configured ``cc:tcc``": what about msys2 is not "directly on win"? As I said msys2 is a windows port of gcc and binuttils, etc, it's not any kind of VM
17:28:43FromDiscord<jan0809> it feels like that a bit bc in some form it offers a seperate shell just like wsl
17:29:10FromDiscord<auxym> MSVC also has its "shell" (Developer Command Prompt)
17:29:22FromDiscord<jan0809> oh dang thats true
17:29:33FromDiscord<auxym> they just add their stuff to PATH and maybe some env vars
17:29:50FromDiscord<jan0809> and it doesnt even expose the binarys to the normal powershell afaik
17:30:24FromDiscord<auxym> it might have an option to add its stuff to PATH during install but I cant remember
17:30:34FromDiscord<auxym> (global path)
17:30:36FromDiscord<jan0809> not sure neither
17:32:05FromDiscord<ZaRR> In reply to @Ekopalypse "<@516334337633943553> - seems to": still same error. I feel smth about path is wrong.
17:32:52FromDiscord<Ekopalypse> Can you call tcc -version
17:33:26FromDiscord<Ekopalypse> or `where tcc`
17:33:54FromDiscord<jan0809> is where windows which?
17:34:02FromDiscord<Ekopalypse> yes
17:34:08FromDiscord<Ekopalypse> 😄
17:34:08FromDiscord<jan0809> didnt knew that
17:34:20FromDiscord<Ekopalypse> is where which - still lol
17:34:31FromDiscord<ZaRR> both where/which not working for me.. weird
17:34:37FromDiscord<auxym> In reply to @ZaRR "still same error. I": what's the error? you never stated it
17:35:02FromDiscord<jan0809> did you reastart the terminal after adding to path?
17:35:04FromDiscord<ZaRR> in powershell 'where' seems working, but can't find tcc.↵I use cmd.
17:35:14FromDiscord<Ekopalypse> Me too
17:35:20FromDiscord<Ekopalypse> cmd user only
17:35:22FromDiscord<auxym> so tcc isnt on your path then?
17:35:45FromDiscord<auxym> `echo %PATH%` on cmd (or `echo $ENV:PATH` in posh)
17:36:13FromDiscord<ZaRR> Oh works! Thanks everyone!↵Indeed needed restarting cmd...
17:37:42FromDiscord<ZaRR> sent a code paste, see https://play.nim-lang.org/#ix=4apn
17:37:58FromDiscord<ZaRR> ``stdlib_dollars.nim`` DOLLARS! Give me too!
17:39:59FromDiscord<jan0809> ins talling via choco didnt add to path properly aswell it seem
17:47:49FromDiscord<ZaRR> sent a code paste, see https://play.nim-lang.org/#ix=4apq
18:20:29FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=4apE
18:20:42FromDiscord<mattrb> This is with nim/nimble built from source
18:23:38FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=4apF
18:23:43FromDiscord<mattrb> (edit)
18:27:14FromDiscord<mattrb> Looks like it changed sometime between Nim 1.6.0 and now
18:28:18FromDiscord<demotomohiro> Are you using Nim ver1.6.6?
18:28:31*jjido joined #nim
18:29:58FromDiscord<mattrb> I'm on the latest devel build
18:30:15FromDiscord<mattrb> So 1.7.1 I guess
18:32:41FromDiscord<demotomohiro> Maybe it fails because sdl2 is only tested on latest stable version and not tested on latest devel branch.
18:33:45FromDiscord<mattrb> Heh well I mean that much was obvious. I just haven't had a chance to check which change to the compiler disallowed that syntax
19:07:36FromDiscord<Not Saucx> Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect]
19:07:37FromDiscord<Not Saucx> whats this?
19:29:47FromDiscord<auxym> you probably have a seq or array that is length 1, therefore the only valid index is 0 (0..0 range). 1 is no a valid index.
19:34:14*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
20:00:24*cyraxjoe quit (Ping timeout: 264 seconds)
20:00:26*MightyJoe joined #nim
20:04:07*arkurious quit (Read error: Connection reset by peer)
20:34:42*monkeybusiness joined #nim
20:46:17NimEventerNew post on r/nim by Wysardry: How to set up a new C compiler?, see https://reddit.com/r/nim/comments/xdi4tu/how_to_set_up_a_new_c_compiler/
20:54:09*jjido joined #nim
21:37:19FromDiscord<AmjadHD> sent a code paste, see https://play.nim-lang.org/#ix=4aql
21:59:34*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:23:43*derpydoo quit (Ping timeout: 268 seconds)
22:44:46FromDiscord<hotdog> In reply to @AmjadHD "https://nim-lang.github.io/Nim/manual.html#pragmas-": You are just telling the compiler that there are no cycles with this type, not making it impossible to create cycles. Imagine a binary tree structure. You as the programmer know your program will not create cycles even if it looks like it is possible from the type
23:16:13*qwr quit (Ping timeout: 268 seconds)
23:17:10*qwr joined #nim
23:55:40FromDiscord<AmjadHD> Is there a switch that makes the compiler log found cycles ?
23:55:53FromDiscord<Elegantbeef> Nope sadly not
23:56:00FromDiscord<Elegantbeef> There really should be, but there is not