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