00:12:53 | FromDiscord | <QueenFuckingAdrielle> Does anyone know of a command to get the current cpu temperature on linux? Bonus points if its native and not an apt package |
00:13:28 | FromDiscord | <auxym> probably something under /dev/ that you can read from |
00:13:32 | FromDiscord | <QueenFuckingAdrielle> I should specify, I mean a bash command. a nim function would be great, but I'm pretty sure that isn't a thing. |
00:13:50 | FromDiscord | <QueenFuckingAdrielle> yea thats what I was thinking. |
00:13:54 | FromDiscord | <Elegantbeef> `sensors` exists but dont know how portable |
00:14:37 | FromDiscord | <QueenFuckingAdrielle> I can always write multiple functions for it. trying to flesh out a system monitor module. |
00:16:27 | FromDiscord | <auxym> apparently google tells me it's under `/sys/class/thermal` though I assume whatever is in there is highly hardware-dependant |
00:17:28 | FromDiscord | <auxym> Why not use `sensors` though? |
00:18:03 | FromDiscord | <auxym> or lm-sensors: https://wiki.archlinux.org/title/Lm_sensors |
00:18:15 | FromDiscord | <auxym> anyways this doesn't really have anything to do with nim... |
00:18:28 | FromDiscord | <Elegantbeef> Well they want to get linux temperature in Nim 😀 |
00:18:41 | FromDiscord | <auxym> oh yeah |
00:18:56 | FromDiscord | <Elegantbeef> I'd say use libsensors and ship that with your binary |
00:19:11 | FromDiscord | <QueenFuckingAdrielle> yea its for a system monitor written in nim, lol also I'm not sure my other programming discord servers would know honestly |
00:19:26 | FromDiscord | <QueenFuckingAdrielle> In reply to @Elegantbeef "I'd say use libsensors": this is probably what I'll do. |
00:19:53 | FromDiscord | <QueenFuckingAdrielle> I'll look at /thermal but youre right that seems like its hw dependent. |
00:20:36 | FromDiscord | <QueenFuckingAdrielle> I'm trying to keep the dependency list a slim as possible, or at least keep many of the dependencies optional |
00:21:27 | FromDiscord | <auxym> my understanding is that libsensors/lm-sensors is basically a high-level interface over the stuff in /sys, to make it more portable across HW, etc. |
00:21:33 | FromDiscord | <QueenFuckingAdrielle> this is for a robotics application so dependencies can be costly and painful |
00:21:50 | FromDiscord | <Elegantbeef> Indeed aux |
00:22:02 | FromDiscord | <QueenFuckingAdrielle> In reply to @auxym "my understanding is that": yea i figured, itll save me the trouble of maintaining it |
00:22:04 | FromDiscord | <Elegantbeef> Well it also doesnt directly use files 😀 |
00:22:42 | FromDiscord | <auxym> the readme seems to imply that libsensors can be statically linked (https://github.com/lm-sensors/lm-sensors), though it's lgpl |
00:24:17 | FromDiscord | <QueenFuckingAdrielle> Maybe I'll search for some system monitor source code on gh and see how others have done it. |
00:24:44 | FromDiscord | <QueenFuckingAdrielle> its ironic that ambient temp sensors are easier and more straightforward to deal with |
00:25:00 | FromDiscord | <QueenFuckingAdrielle> but they dont tell me much about cpu temp |
01:08:05 | * | krux02 quit (Remote host closed the connection) |
01:21:07 | * | vicfred quit (Quit: Leaving) |
02:45:01 | * | ltriant joined #nim |
02:50:00 | * | ltriant quit (Ping timeout: 272 seconds) |
03:15:09 | * | arkurious quit (Quit: Leaving) |
03:53:43 | * | wyrd quit (Quit: leaving) |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:31 | * | supakeen joined #nim |
04:53:42 | * | GnuYawk quit (Quit: GnuYawk) |
04:57:42 | * | rockcavera quit (Remote host closed the connection) |
05:11:19 | * | slowButPresent quit (Quit: leaving) |
05:53:15 | * | Gustavo6046 quit (Quit: Leaving) |
06:15:08 | * | pro joined #nim |
06:20:12 | * | pro quit (Ping timeout: 240 seconds) |
07:07:31 | * | ltriant joined #nim |
07:12:46 | * | ltriant quit (Ping timeout: 256 seconds) |
07:24:18 | * | jjido joined #nim |
07:58:37 | * | PMunch joined #nim |
09:02:24 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:17:43 | NimEventer | New thread by JPLRouge: Dear Nim enthusiasts, see https://forum.nim-lang.org/t/8949 |
09:21:06 | FromDiscord | <Rika> i dont understand |
09:22:54 | FromDiscord | <Phil> I read JPL's post, I understand the gist, I have no idea what a designer screen type is |
09:23:20 | FromDiscord | <Phil> (edit) "I read JPL's post, I understand the gist, I have no idea what a designer screen type is ... " added "or what he wanted to express with "console handling"" |
09:23:36 | FromDiscord | <Phil> (edit) "gist," => "gist being "nim is nice, readable and fast"," |
09:24:03 | FromDiscord | <Elegantbeef> I'm uncertain but i think they've made a ncurses like library that supports those console versions? |
09:24:44 | FromDiscord | <Phil> I don't know what any of those things are either, though I know the word "library" |
09:25:06 | FromDiscord | <Phil> console versions means stuff like zsh, fsh, the default bash console etc.? |
09:25:15 | FromDiscord | <Elegantbeef> No those are shells |
09:25:40 | FromDiscord | <Elegantbeef> 5250 is an ibm terminal https://i.pinimg.com/originals/f0/e9/9f/f0e99f1a60a7d09c592979aae9fbc0c0.jpg |
09:26:12 | FromDiscord | <Elegantbeef> As is a 3270 |
09:26:27 | FromDiscord | <Phil> Wait, like, "terminal = ancient computer" ? |
09:26:33 | FromDiscord | <Elegantbeef> Yea |
09:26:44 | FromDiscord | <Elegantbeef> terminal isnt really a computer as much as an interface with the computer |
09:28:19 | FromDiscord | <Elegantbeef> Ncurses is a library that abstracts terminal applications |
09:29:49 | * | jjido joined #nim |
09:30:31 | FromDiscord | <haolian9 (高浩亮)> sent a code paste, see https://paste.rs/scV |
09:37:36 | FromDiscord | <Schelz> Nim support esp32 ? |
09:38:19 | FromDiscord | <Elegantbeef> https://github.com/elcritch/nesper stuff like this exists |
09:38:26 | FromDiscord | <Schelz> Thx |
09:47:48 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:56:11 | FromDiscord | <haolian9 (高浩亮)> done. it requires `--out` option, but nim did not honor the option actually |
10:04:09 | FromDiscord | <fbpyr> sent a code paste, see https://play.nim-lang.org/#ix=3QGB |
10:04:38 | FromDiscord | <haolian9 (高浩亮)> but i believe the generated tags is not compatible with universal-ctags |
10:06:55 | FromDiscord | <fbpyr> nvm, got it via `btn.inner_text` 🙂 |
10:07:01 | FromDiscord | <Elegantbeef> `btn.innerText = "test_btn"`? |
10:07:30 | FromDiscord | <Elegantbeef> The object's fields arent visible due to the doc gen, but here they're https://github.com/nim-lang/Nim/blob/version-1-6/lib/js/dom.nim#L183-L205 |
10:07:46 | FromDiscord | <ajusa> can I subclass `string`? Tried doing↵`type mystr = object of string` and `type mystr = string of RootObj` but neither of those worked |
10:07:57 | FromDiscord | <Deceptive> How do I migrate from std/json to jsony? |
10:08:02 | FromDiscord | <Elegantbeef> You cannot inherit from string |
10:08:14 | FromDiscord | <Elegantbeef> you can make a distinct string which is kinda like a subclass |
10:08:30 | FromDiscord | <Elegantbeef> `type MyStr = distinct string` is similar to what you want I imagine |
10:08:47 | FromDiscord | <Elegantbeef> replace all your serializer function calls with jsony ones? |
10:08:55 | * | vicecea quit (Remote host closed the connection) |
10:09:26 | Amun-Ra | ajusa: what do you want to achieve? |
10:09:32 | FromDiscord | <Elegantbeef> Ajusa are you after custom logic to your `mystr`? |
10:09:37 | * | vicecea joined #nim |
10:09:38 | FromDiscord | <Elegantbeef> Yea what amun said! |
10:09:59 | FromDiscord | <ajusa> custom logic and data to a string, while retaining all existing string operations |
10:10:07 | FromDiscord | <ajusa> distinct doesn't do the latter afaik |
10:10:17 | FromDiscord | <Elegantbeef> converter with distinct does |
10:10:20 | FromDiscord | <Elegantbeef> We went over this! |
10:10:24 | FromDiscord | <Deceptive> In reply to @Elegantbeef "replace all your serializer": I will try that I guess. |
10:10:30 | FromDiscord | <ajusa> but converters don't work with generics |
10:10:40 | Amun-Ra | {.borrow.} should work too |
10:10:55 | FromDiscord | <Elegantbeef> They work for generics, just have to be concrete, what're you doing fully |
10:11:01 | FromDiscord | <Elegantbeef> I might be able to help |
10:11:04 | FromDiscord | <fbpyr> thank you [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org) 😌 |
10:11:16 | Amun-Ra | yes, a-z problem |
10:12:19 | FromDiscord | <ajusa> https://github.com/ajusa/nimtenbrew/blob/7cab445edba2910a9a93db0e362f697be927f341/src/v2.nim#L19 |
10:12:46 | FromDiscord | <Elegantbeef> You dont use cast for distinct conversions |
10:12:51 | FromDiscord | <ajusa> I believe the issue with this code was that the `toSize` converter isn't concrete, which means I can't use it |
10:12:53 | FromDiscord | <Elegantbeef> it's just `SubType base` |
10:13:01 | FromDiscord | <Elegantbeef> But yes that is the issue |
10:13:19 | FromDiscord | <ajusa> so what was the workaround I should use? |
10:14:59 | FromDiscord | <Elegantbeef> There isnt a great work around here since the converter needs to be instantiated manually |
10:15:21 | FromDiscord | <Elegantbeef> So you basically need a template that emits a converter with a type |
10:16:22 | FromDiscord | <ajusa> so every time someone uses a specific generic type, I need to somehow make a concrete converter for it? is there an easy way to do that? |
10:16:32 | FromDiscord | <Elegantbeef> There isnt really |
10:17:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QGD |
10:18:50 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3QGE |
10:19:22 | FromDiscord | <ajusa> In reply to @Elegantbeef "You need to do": does makeTyp need to be called before each use of a generic then? |
10:19:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QGF |
10:20:09 | FromDiscord | <Elegantbeef> I'd really say type conversions on distincts are hardly that annoying |
10:20:18 | FromDiscord | <ajusa> well it's double the code then isn't it |
10:20:31 | FromDiscord | <Elegantbeef> How? |
10:21:00 | FromDiscord | <ajusa> I need to call makeTyp and then also use the exact same type definition in an object. the type is basically being defined in two places |
10:21:22 | FromDiscord | <Elegantbeef> What? |
10:21:34 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3QGG |
10:22:08 | FromDiscord | <ajusa> sent a code paste, see https://paste.rs/uO4 |
10:22:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QGH |
10:23:08 | FromDiscord | <ajusa> oh |
10:23:29 | FromDiscord | <Elegantbeef> It creates and L-value and dont need to use cast |
10:24:21 | FromDiscord | <ajusa> it's acceptable, but as the fields increase I figured it might get annoying... I think I'll start simple and try the converters if it actually is annoying |
10:24:21 | FromDiscord | <Elegantbeef> Users can of course borrow procedures they want generically |
10:24:51 | FromDiscord | <ajusa> didn't know about the lvalue conversion lol, I was doing converters to the right side which felt awful |
10:26:49 | FromDiscord | <Elegantbeef> Perhaps there is an RFC idea, making it so converters do generic inference for distincts |
10:28:00 | FromDiscord | <Elegantbeef> Although the issue is more that borrowing is hard |
10:28:03 | FromDiscord | <ajusa> oh is that even possible? I thought it was more of a "really hard to solve" problem, kind of how you can't have converters go a -> b -> c automatically, they are limited to a single step |
10:28:30 | FromDiscord | <ajusa> seems like it would slow down compile time a ton, but I have no clue about compiler internals |
10:28:42 | FromDiscord | <Elegantbeef> I mean really distincts should havea `{.borrow: all.}` |
10:29:19 | FromDiscord | <Elegantbeef> which would mean in everycase a base would be valid this would be aswell |
10:29:30 | FromDiscord | <Elegantbeef> Probably could make an RFC and implement it very easily |
10:29:31 | FromDiscord | <ajusa> In reply to @Elegantbeef "I mean really distincts": yeah this would be fantastic |
10:29:33 | PMunch | Is it then distinct any more? |
10:29:39 | FromDiscord | <Elegantbeef> Yes |
10:29:44 | FromDiscord | <Elegantbeef> It's still a distinct type |
10:30:06 | PMunch | But if it behaves exactly like the base type? |
10:30:16 | FromDiscord | <Elegantbeef> It doesnt behave exactly |
10:30:26 | FromDiscord | <Elegantbeef> you can attach type information and the base cannot dispatch into it |
10:30:39 | FromDiscord | <Elegantbeef> And two distincts that both borrow all are not interopable |
10:30:45 | FromDiscord | <Elegantbeef> They need converted |
10:31:32 | FromDiscord | <ajusa> clearly I've got some sort of convoluted use case that would be easier with it lol, so a distinct type that borrows all of the other operations would be cool. |
10:32:57 | FromDiscord | <ajusa> sent a code paste, see https://paste.rs/7Q7 |
10:33:54 | * | vicecea quit (Remote host closed the connection) |
10:34:21 | FromDiscord | <ajusa> I'll try and open a really simple RFC, but I'm not a compiler dev so I can only provide reasonable usecase and expected behavior |
10:34:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/v5E |
10:34:25 | * | vicecea joined #nim |
10:34:31 | FromDiscord | <Elegantbeef> Pmunch that's what i'm proposing |
10:34:36 | FromDiscord | <ajusa> yep that exactly |
10:35:10 | FromDiscord | <Elegantbeef> Eh i have a RFC for nimskull somewhat related though talks about removing generic type aliases |
10:37:09 | FromDiscord | <Elegantbeef> There are many usages of distinct, it's not just safety |
10:38:12 | nrds | <YouLoveIran/freenode99> hi, #freenode is moderated because you American motherfuckers don't want to hear the truth? root Andrew Lee bitch, what happened with free speech you motherfucker? |
10:38:15 | nrds | <YouLoveIran/freenode99> US Congress wants to expel Russia from UN Security Council - https://www.rt.com/russia/550558-congress-expel-russia-security-council/ I can't wait to see China joining the fight! Prepare for a world war American bitch! Hide your family underground! We coming for you! |
10:38:20 | nrds | <YouLoveIran/freenode99> root you're a fucking bitch, you destroyed freenode and silenced everyone who speak against terrorism by the United States of America, where is my free speech Andrew fucking Lee? I would jump on you and beat you death you mofo |
10:38:54 | FromDiscord | <Elegantbeef> lol |
10:39:33 | FromDiscord | <Elegantbeef> Gotta feel bad when they share a RT link, really hurts the morale |
10:40:46 | FromDiscord | <Elegantbeef> Anyway ajusa make a well thoughout RFC for why you want to borrow all and i'll probably pile on |
10:41:20 | * | krux02 joined #nim |
10:41:43 | FromDiscord | <ajusa> oh god it has to be good? |
10:43:13 | FromDiscord | <Elegantbeef> I mean it doesnt have to be amazing thoughout, but a single compelling use case or reason to add it is all that's really needed |
10:43:47 | FromDiscord | <Elegantbeef> I can probably make the PR relatively quick if i'm not wrong, but not going to spend any time without an RFC personally |
10:44:39 | FromDiscord | <ajusa> gotcha, well I'm working on it now (and I can edit it if looks bad or not well written) |
10:45:38 | PMunch | @Prestige, we really need some kind of filter to remove these trolls |
10:45:47 | PMunch | Otherwise we'll have to kick the nrds bot.. |
10:46:16 | FromDiscord | <Elegantbeef> It's mostly just a summary of what I said, i'll be going to sleep soon so cant give any input now |
10:46:27 | FromDiscord | <Elegantbeef> What pmunch you dont like literal russian trolls 😀 |
10:49:19 | PMunch | Haha, I don't mind the Russian trolls any more than the other trolls spamming messages about Freenode being bad.. |
10:49:36 | PMunch | Neither are on topic for this channel |
11:00:30 | FromDiscord | <ajusa> @ElegantBeef not sure if you are still awake but https://github.com/nim-lang/RFCs/issues/450 |
11:09:05 | * | ltriant joined #nim |
11:13:48 | * | ltriant quit (Ping timeout: 240 seconds) |
11:21:23 | FromDiscord | <fbpyr> is there a way to use html strings generated with `htmlgen` directly in `dom` to create a new node? |
11:35:00 | * | wyrd joined #nim |
11:54:14 | FromDiscord | <mratsim> @ajusa don't vote for your own RFC |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:31 | * | supakeen joined #nim |
12:11:41 | * | jmdaemon quit (Ping timeout: 256 seconds) |
12:14:07 | NimEventer | New thread by Arnetheduck: Raises tracking and no more cyclic references in `chronos`, see https://forum.nim-lang.org/t/8950 |
12:15:57 | * | supakeen quit (Quit: WeeChat 3.4) |
12:16:16 | * | supakeen joined #nim |
12:27:57 | FromDiscord | <System64 ~ Flandre Scarlet> Is it normal autocompletion is broken? https://media.discordapp.net/attachments/371759389889003532/946745331234779168/unknown.png |
12:33:09 | FromDiscord | <Rika> kinda |
12:33:18 | FromDiscord | <Rika> nimsuggest is shoddy |
12:34:04 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "nimsuggest is shoddy": what should I do? |
12:34:25 | FromDiscord | <Rika> use a mixture of nimsuggest and other autosuggest engines like "in buffer" |
12:34:56 | FromDiscord | <System64 ~ Flandre Scarlet> is "in buffer" a plugin? |
12:36:24 | FromDiscord | <auxym> built in vim |
12:37:02 | FromDiscord | <System64 ~ Flandre Scarlet> Oh no! VIM! |
12:37:05 | FromDiscord | <System64 ~ Flandre Scarlet> 😱 |
12:39:15 | FromDiscord | <Rika> idk man i use vim and thats what its called |
12:39:35 | FromDiscord | <System64 ~ Flandre Scarlet> Ah I see↵I use VS Code |
13:04:50 | FromDiscord | <ajusa> In reply to @mratsim "<@!102899813149855744> don't vote for": Sorry about that, didn't know! |
13:05:13 | FromDiscord | <ajusa> (edit) "In reply to @mratsim "<@!102899813149855744> don't vote for": Sorry about that, didn't know! ... " added "Removed my like" |
13:05:13 | * | slowButPresent joined #nim |
13:05:26 | FromDiscord | <ajusa> (edit) "know!" => "know the likes were actually used to make decisions!" |
13:10:34 | FromDiscord | <Traveler> Hey guys, how does one `echo` with a carriage return? |
13:11:16 | FromDiscord | <Traveler> the docs state `\c` but `echo fmt"{somevar}\c"` does not rresult in a carriage return |
13:13:15 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3QHv |
13:13:41 | FromDiscord | <enthus1ast> !echo repr @[1,2,3] |
13:13:44 | FromDiscord | <Traveler> @hmmm does `repr` work |
13:13:48 | FromDiscord | <Traveler> ^ |
13:13:56 | FromDiscord | <enthus1ast> withouth the ! |
13:14:07 | PMunch | !eval echo repr @[1, 2, 3] |
13:14:10 | NimBot | 0x7fa62174d050@[1, 2, 3] |
13:14:14 | FromDiscord | <fbpyr> @Traveler\: iirc there is a warning on newline chars. for that you could use `&"some {var_str}\n"` |
13:14:17 | FromDiscord | <enthus1ast> ah eval |
13:14:59 | FromDiscord | <hmmm> what's this 0x7fa62174d050 |
13:15:07 | FromDiscord | <enthus1ast> the address |
13:15:09 | PMunch | The address in memory of the sequence |
13:15:14 | FromDiscord | <System64 ~ Flandre Scarlet> Yeah |
13:15:19 | FromDiscord | <System64 ~ Flandre Scarlet> like Java I think |
13:15:24 | PMunch | !eval echo $(@[1, 2, 3]) |
13:15:25 | FromDiscord | <hmmm> hmm |
13:15:26 | NimBot | @[1, 2, 3] |
13:15:34 | FromDiscord | <hmmm> perfect! |
13:15:40 | PMunch | Just a normal $ works fine :P |
13:15:50 | FromDiscord | <hmmm> haha |
13:16:01 | FromDiscord | <System64 ~ Flandre Scarlet> !eval echo $([1, 2, 3]) |
13:16:02 | PMunch | Echo of course does that by default |
13:16:02 | FromDiscord | <Rika> You could just not $ when suing echo |
13:16:03 | FromDiscord | <Rika> Using |
13:16:03 | NimBot | [1, 2, 3] |
13:16:07 | PMunch | !eval echo @[1, 2, 3] |
13:16:10 | NimBot | @[1, 2, 3] |
13:16:13 | FromDiscord | <System64 ~ Flandre Scarlet> ah yeah it works without the at |
13:16:21 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "ah yeah it works without the at ... " added "symbol" |
13:16:32 | PMunch | Yeah the @ is just to make it a sequence and not an arary |
13:16:44 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Yeah the @ is": what's the difference |
13:16:46 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "difference" => "difference?" |
13:16:55 | FromDiscord | <Traveler> array has fixed length at compile time |
13:17:04 | FromDiscord | <Traveler> sequence is similar to vector in c++ |
13:17:09 | FromDiscord | <enthus1ast> and i guess is allocated on the stack or? |
13:17:13 | FromDiscord | <Traveler> heap |
13:17:14 | FromDiscord | <Rika> Stack yes |
13:17:21 | FromDiscord | <Traveler> array = stack |
13:17:22 | FromDiscord | <Rika> Or do you mean seq |
13:17:30 | FromDiscord | <enthus1ast> no array |
13:17:47 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Traveler "array has fixed length": so it's like C arrays |
13:17:54 | FromDiscord | <Traveler> yes |
13:18:02 | FromDiscord | <System64 ~ Flandre Scarlet> familiar then |
13:18:05 | FromDiscord | <Traveler> at leas that is how i understand it |
13:18:11 | FromDiscord | <System64 ~ Flandre Scarlet> and sequences are kinda arraylists in Java |
13:18:12 | PMunch | Yes |
13:18:30 | PMunch | Not sure about arraylists |
13:18:34 | PMunch | Those might be linked lists |
13:18:36 | FromDiscord | <Traveler> but the carriage return i cant figure out |
13:19:04 | PMunch | Sequences are just a malloced array that will be realloced if it runs out of space |
13:19:25 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Sequences are just a": so like Java, C#, ...? |
13:19:28 | PMunch | @Traveler, printing a carriage return? |
13:19:36 | FromDiscord | <Rika> In reply to @Traveler "the docs state `\c`": fmt is a raw string, use & to mitigate or add a space between fmt and the string |
13:19:38 | PMunch | @System64_~_Flandre_Scarlet, maybe? |
13:19:54 | FromDiscord | <Rika> In reply to @Rika "fmt is a raw": fmt without the space makes a raw string |
13:19:54 | FromDiscord | <konsumlamm> ArrayLists are based on arrays |
13:19:59 | FromDiscord | <Traveler> I am using `echo &"T={ti} \c"` |
13:20:06 | FromDiscord | <Traveler> this produces newlines in my terminal |
13:20:18 | FromDiscord | <Rika> Sounds right, what’s the issue? |
13:20:28 | Amun-Ra | Traveler: echo does that by default |
13:20:43 | FromDiscord | <Traveler> carriage return should reset it to the beginning to the line |
13:20:50 | Amun-Ra | Traveler: if you don't want to have NL use stdout.write |
13:20:50 | FromDiscord | <Rika> Oh you don’t want them, yeah use “stdout.write” |
13:20:56 | FromDiscord | <Traveler> i want this print("test", end = "\r") |
13:21:02 | FromDiscord | <Traveler> (in python) |
13:21:09 | Amun-Ra | stdout.write "foobar\r" |
13:21:31 | FromDiscord | <Traveler> ah ok ik will have look |
13:21:48 | FromDiscord | <enthus1ast> does python print flushes the output stream? |
13:22:01 | FromDiscord | <Traveler> not if you use end |
13:22:02 | FromDiscord | <enthus1ast> if yes then you have to do a\:↵stdout.flushFile() |
13:22:15 | Amun-Ra | that is OS dependent |
13:22:32 | Amun-Ra | you don't have to flush stderr in general, you have to flush stdout |
13:22:35 | FromDiscord | <enthus1ast> ok ic↵(@Traveler) |
13:23:44 | FromDiscord | <enthus1ast> @Traveler\: if you want to have even more control, have a look at the terminal module and illwill |
13:24:51 | FromDiscord | <Traveler> https://nim-lang.github.io/Nim/terminal.html this one? |
13:25:13 | FromDiscord | <enthus1ast> this and https://github.com/johnnovak/illwill |
13:26:30 | FromDiscord | <Traveler> Thanks! |
13:26:50 | FromDiscord | <Traveler> haha point 3 https://media.discordapp.net/attachments/371759389889003532/946760149081681950/unknown.png |
13:27:21 | FromDiscord | <enthus1ast> another point\: don't use it if your input is non ascii ;) |
13:27:25 | FromDiscord | <enthus1ast> does not work yet |
13:28:15 | FromDiscord | <enthus1ast> will do it once i need illwill (and non ascii input) again |
13:35:40 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/Jhq |
13:48:18 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=3QHB |
13:49:06 | FromDiscord | <mratsim> Parameter passing:↵- By default, Nim passes objects larger than 24 bytes by reference (the {.nimcall.} convention). For FFI, you can use {.bycopy.} or {.byref.} to force one behavior or the other. |
13:49:56 | FromDiscord | <System64 ~ Flandre Scarlet> I'm interoperating with a C library in this case |
13:50:03 | FromDiscord | <mratsim> Copy behavior:↵- objects have value semantics, they are copied on assignment and on the stack↵- ref objects have reference semantics, there is a refcount, commonly called Nim "GC" |
13:50:51 | FromDiscord | <mratsim> for interop with C I usually start by using c2nim on the C header and then go over by hand. |
13:51:10 | FromDiscord | <System64 ~ Flandre Scarlet> It's what I did I think |
13:51:34 | FromDiscord | <mratsim> though sometimes I change the bycopy/byref if I see that a type is always used by ref |
13:52:03 | FromDiscord | <mratsim> example: https://github.com/status-im/nim-blscurve/blob/master/blscurve/blst/blst_abi.nim#L84-L121 |
13:52:18 | FromDiscord | <auxym> since we're on the topic... any idea why c2nim really wants to annotate all object defs with `bycopy`? |
13:52:23 | FromDiscord | <mratsim> and they will be passed by pointers here: https://github.com/status-im/nim-blscurve/blob/master/blscurve/blst/blst_abi.nim#L196-L214 |
13:52:39 | FromDiscord | <mratsim> In reply to @auxym "since we're on the": Because by default C is bycopy |
13:52:50 | FromDiscord | <auxym> my understanding was that object have value semantics by default |
13:52:58 | FromDiscord | <auxym> (edit) "object" => "objects" |
13:53:09 | FromDiscord | <mratsim> then if you see that all procs are `ptr MyObject` just change byref and remove the `ptr` |
13:54:00 | Amun-Ra | mratsim: does it work exactly like passing pointers to objects in C? |
13:54:23 | FromDiscord | <mratsim> yes |
13:54:28 | Amun-Ra | good to know |
13:54:36 | FromDiscord | <Deceptive> sent a code paste, see https://paste.rs/SNe |
13:58:26 | * | rockcavera joined #nim |
13:58:26 | * | rockcavera quit (Changing host) |
13:58:26 | * | rockcavera joined #nim |
14:01:29 | nrds | <Prestige99> PMunch yeah I'm doing to ask them to just remove the freenode bridge at this point, don't think there's a way to filter it out |
14:01:47 | FromDiscord | <Deceptive> sent a code paste, see https://play.nim-lang.org/#ix=3QHF |
14:02:42 | FromDiscord | <enthus1ast> imho jsony directly converts to object |
14:03:13 | FromDiscord | <enthus1ast> and does not have a JsonNode (like the std/json) |
14:03:49 | FromDiscord | <enthus1ast> so you could just define an object with the stuff you want, and later use jsony to generate a json string |
14:04:22 | FromDiscord | <Deceptive> How it would like in the code? I am don't really have a good grasp in Nim :/ |
14:04:58 | FromDiscord | <enthus1ast> is this the structure? |
14:05:07 | FromDiscord | <enthus1ast> or could it change? |
14:06:15 | FromDiscord | <Deceptive> In reply to @enthus1ast "is this the structure?": Like uh... it's structure↵↵The software itself should insert the stuff which is `"value": "" & test & "",` here. And test will be replaced with other thing. |
14:08:21 | * | arkurious joined #nim |
14:11:08 | FromDiscord | <enthus1ast> something like this maybe\: |
14:12:12 | FromDiscord | <enthus1ast> https://play.nim-lang.org/#ix=3QHL |
14:12:57 | FromDiscord | <enthus1ast> if the fields structure is modular you could also just use a table for this |
14:15:40 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3QHM |
14:15:47 | FromDiscord | <enthus1ast> yes works |
14:18:53 | * | enyc joined #nim |
14:19:14 | FromDiscord | <Deceptive> In reply to @enthus1ast "https://play.nim-lang.org/#ix=3QHL": Damn, looks a bit of clunky |
14:19:34 | FromDiscord | <Deceptive> If I will compare the stuff I made above, and one you wrote. |
14:19:56 | FromDiscord | <enthus1ast> mine is type safe |
14:20:29 | FromDiscord | <enthus1ast> but i guess there are others ways to make it unclunky |
14:21:20 | FromDiscord | <enthus1ast> do you just wanto store the json string? |
14:22:43 | FromDiscord | <Deceptive> In reply to @enthus1ast "do you just wanto": yeah |
14:23:05 | FromDiscord | <enthus1ast> then just add a $ \:) |
14:23:08 | FromDiscord | <enthus1ast> $ %\ |
14:24:33 | FromDiscord | <Deceptive> sent a code paste, see https://paste.rs/Txb |
14:24:38 | FromDiscord | <Deceptive> I am not sure if the code is valid tho |
14:24:47 | FromDiscord | <enthus1ast> $ %\ |
14:25:13 | FromDiscord | <Deceptive> (edit) "https://play.nim-lang.org/#ix=3QHP" => "https://play.nim-lang.org/#ix=3QHQ" |
14:25:15 | FromDiscord | <Deceptive> `var data = $ %{"content": begin & testing, "username": "Test"}`↵↵good? |
14:27:28 | FromDiscord | <enthus1ast> i think jsony does not have the %\ macro |
14:28:04 | FromDiscord | <Deceptive> `var data = ${"content": begin & testing, "username": "Test"}` |
14:28:06 | FromDiscord | <Deceptive> Good? |
14:28:09 | FromDiscord | <enthus1ast> for jsony to work, you need a type any how |
14:28:22 | FromDiscord | <enthus1ast> it just converts from string to type |
14:28:29 | FromDiscord | <enthus1ast> and back |
14:28:44 | FromDiscord | <enthus1ast> and does not have a JsonNode representation |
14:29:17 | FromDiscord | <enthus1ast> this is what %\ would create |
14:29:59 | FromDiscord | <enthus1ast> in std/json you would then convert this JsonNode tree to a type |
14:30:48 | FromDiscord | <enthus1ast> what is your goal, and why would you want to use jsony again? \:) |
14:41:09 | * | shalokshalom joined #nim |
14:52:45 | FromDiscord | <fbpyr> sent a code paste, see https://play.nim-lang.org/#ix=3QI1 |
15:11:02 | * | ltriant joined #nim |
15:16:09 | * | ltriant quit (Ping timeout: 256 seconds) |
15:18:18 | FromDiscord | <fbpyr> if I leave the await and the check for the status out it compiles and even performs the request. ↵but how would I await / waitFor the response/promise and get the content? |
15:22:39 | FromDiscord | <qb> does `eraseScreen` from `terminal` for you guys work? |
15:27:17 | FromDiscord | <enthus1ast> yes it works for me, but i can imagine that it works better if the terminal is not in linemode |
15:27:28 | FromDiscord | <enthus1ast> (or how this mode is called again) |
15:34:45 | NimEventer | New thread by Mardiyah: Declaration/definition array of array 2 elements in which's the 2nd is array, see https://forum.nim-lang.org/t/8951 |
15:42:06 | * | Gustavo6046 joined #nim |
15:43:08 | * | Gustavo6046 quit (Remote host closed the connection) |
15:43:27 | * | Gustavo6046 joined #nim |
15:44:29 | * | Gustavo6046 quit (Remote host closed the connection) |
16:01:08 | FromDiscord | <System64 ~ Flandre Scarlet> I can't AND with 2 enum elements? https://media.discordapp.net/attachments/371759389889003532/946798983739740180/unknown.png |
16:03:54 | * | Gustavo6046 joined #nim |
16:08:26 | FromDiscord | <haxscramper> is this `enum class`? |
16:11:32 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3QIE |
16:12:38 | FromDiscord | <haxscramper> sorry, the code looked like C, so I got confused. No, in nim you can't `and` two enusm together, it is not safe because the resulting value is not guaranteed to be an anum |
16:12:54 | FromDiscord | <haxscramper> to use enums like sets use `set[TLN_OVERLAY]` |
16:13:28 | FromDiscord | <haxscramper> If you are interefacing with C API you can do `TLN_OVERLAY_APERTURE.cint or TLN_OVERLAY_SCANLINES.cint`, but this can't be converted back to enum |
16:13:47 | FromDiscord | <haxscramper> unless there is an enum that has `.cint` with necessary value |
16:14:39 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3QIF |
16:15:54 | * | pro joined #nim |
16:33:31 | FromDiscord | <demotomohiro> If `TLN_Overlay` is a bit mask, you can change first parameter type to `set[TLN_Overlay]` and pass `{TLN_OVERLAY_SCANLINES, TLN-OVERLAY_APERTURE}`. |
16:49:45 | NimEventer | New post on r/nim by Ruri: Segmentation Faults when calling Win32 API, see https://reddit.com/r/nim/comments/t18h1s/segmentation_faults_when_calling_win32_api/ |
17:32:36 | * | cornfeedhobo quit (Ping timeout: 250 seconds) |
17:45:22 | * | vicfred joined #nim |
17:50:42 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3QJ5 |
18:02:21 | FromDiscord | <bartimus> Good Morning/Afternoon everyone had a question regarding dynlib and passing ptr's to them. I am creating a shared channel, I am then passing the ptr of that channel to the dynlib function to write to, when checking the addresses of the channel in both places, they are the same, but the address in the dynlib function points to nil, instead of the underlying channel. |
18:03:07 | FromDiscord | <Elegantbeef> Not having a procedure definition that stretches the entire screen is a good practice, make the parameter list vertical! |
18:03:48 | FromDiscord | <bartimus> sent a code paste, see https://play.nim-lang.org/#ix=3QJb |
18:04:58 | FromDiscord | <Elegantbeef> Code? |
18:05:44 | FromDiscord | <bartimus> sent a code paste, see https://play.nim-lang.org/#ix=3QJe |
18:06:23 | FromDiscord | <bartimus> sent a code paste, see https://play.nim-lang.org/#ix=3QJf |
18:07:06 | FromDiscord | <bartimus> the create shared channel is just a generic wrapper i wrote that uses allocshared0 |
18:07:12 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Not having a procedure": Ah thanks |
18:07:19 | FromDiscord | <Elegantbeef> `var ptr` is the issue |
18:07:38 | FromDiscord | <Elegantbeef> that's a `ptr ptr Channel` |
18:08:58 | FromDiscord | <bartimus> oh srry that was from debugging |
18:11:10 | NimEventer | New thread by Ctclmsn: Nim wrapper for C library; data segment question, see https://forum.nim-lang.org/t/8952 |
18:11:29 | FromDiscord | <bartimus> sent a code paste, see https://play.nim-lang.org/#ix=3QJg |
18:12:27 | FromDiscord | <Elegantbeef> Sending the instruction that way is 100% unsafe |
18:13:04 | FromDiscord | <Elegantbeef> But anyway `c[].send` is what you need to do |
18:13:32 | FromDiscord | <bartimus> yeah, let me update the function to the other way I had before I started going crazy with debug |
18:14:24 | FromDiscord | <bartimus> k i updated it, i did do the c[], but in that case everything runs but the channel never gets the msg, just loops |
18:16:11 | FromDiscord | <Elegantbeef> Can we change it to a `Channel[int]` for now to make it less convoluted? |
18:18:01 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3QJh |
18:19:01 | FromDiscord | <bartimus> @ElegantBeef yeah let me try |
18:19:15 | FromDiscord | <System64 ~ Flandre Scarlet> Btw I have default parameters for initWindow(), but can I pass only one parameter? I want to change the 7th one |
18:19:44 | FromDiscord | <Elegantbeef> Nim has named parameters |
18:19:53 | FromDiscord | <Elegantbeef> so you can do `initWindow(overlay = "Hello world")` |
18:20:06 | FromDiscord | <Waldecir Santos> I wish we had named varargs, run..... |
18:20:28 | FromDiscord | <Elegantbeef> A pointless thing in a static language |
18:20:31 | FromDiscord | <System64 ~ Flandre Scarlet> Aaah alright |
18:20:59 | FromDiscord | <Waldecir Santos> I'm just messing with you, I know. |
18:22:11 | FromDiscord | <bartimus> sent a code paste, see https://play.nim-lang.org/#ix=3QJi |
18:22:55 | FromDiscord | <Elegantbeef> again do `c[].send(1)` |
18:24:23 | FromDiscord | <bartimus> ok |
18:24:49 | FromDiscord | <Elegantbeef> I might be wrong but i have the wacky belief that the copy is the issue |
18:25:37 | FromDiscord | <bartimus> sent a code paste, see https://play.nim-lang.org/#ix=3QJj |
18:25:54 | FromDiscord | <Elegantbeef> Did you change it to an int in the main program? |
18:25:54 | FromDiscord | <Phil> >_> Turns out norm gives you back `"your_table_name"` and I did not account for the quotation marks.↵As for getting rid of them, is my choice `s.substr(1, s.len() - 2)` Or do we have something where I can go `s.substr(1, -1)` (doesn't have to be substr, I'll take any proc) ? |
18:26:26 | FromDiscord | <Elegantbeef> `s[1..^2]` or `s.toOpenArray(1, s.len - 2)` |
18:26:48 | FromDiscord | <Elegantbeef> the latter is more efficient if you take `openArray[char]` |
18:27:03 | FromDiscord | <bartimus> sent a code paste, see https://play.nim-lang.org/#ix=3QJl |
18:28:14 | FromDiscord | <Phil> In reply to @Elegantbeef "the latter is more": It's something that happens once per HTTP request, so readability is more likely to be king here. s[1..^2] is definitely better, thanks for that!↵Just to bad we don't have the wrap-around indexing defined for negative indexing |
18:28:24 | FromDiscord | <Elegantbeef> Uhhh no clue anymore bart, guess i should run it myself |
18:28:39 | FromDiscord | <Elegantbeef> "wrap-around indexing defined for negative indexing" ? |
18:28:54 | FromDiscord | <Phil> s[1..-1] |
18:29:20 | FromDiscord | <Phil> Sorry, it's late and I had to write a spring service today |
18:29:22 | FromDiscord | <Phil> My brain is messed up |
18:30:05 | FromDiscord | <Elegantbeef> Well negative indexes wouldnt be defects then, which means more likely to have errors |
18:30:12 | FromDiscord | <Phil> My word choice is horrendous, errr I just meant something along the lines that I'd have loved for this notation to support negative indices at the end and interpret them as `s.len() - 1 - X`, So that I could do s[1..-1] |
18:30:24 | FromDiscord | <Phil> Fair point |
18:30:40 | FromDiscord | <Phil> Given that I harp on a lot about wanting my code to blow up in my face at compile time, I guess that's for the better overall |
18:30:53 | FromDiscord | <Elegantbeef> You can always write your own `[]` 😛 |
18:31:13 | FromDiscord | <bartimus> @ElegantBeef yeah, I was at a loss too (i'm kinda new to nim, used it a little before v1). I'll try to read into dynlib and maybe i can track down whats going on. |
18:31:28 | FromDiscord | <Elegantbeef> Nim is one of the few languages that a lot is implemented in user space |
18:31:29 | FromDiscord | <Phil> In reply to @Elegantbeef "You can always write": I wish I could express how much too lazy for that I am 😄 |
18:31:47 | FromDiscord | <Elegantbeef> Can i get the full code again bart, i'll also take a look |
18:32:48 | * | rockcavera quit (Remote host closed the connection) |
18:32:50 | FromDiscord | <Elegantbeef> And that laziness is a good thing, cause it discourages people from doing things wrong |
18:32:55 | FromDiscord | <bartimus> yeah pre changes? |
18:33:03 | FromDiscord | <Elegantbeef> Post changes |
18:33:23 | FromDiscord | <bartimus> k |
18:33:32 | * | vicfred quit (Ping timeout: 240 seconds) |
18:33:39 | FromDiscord | <Elegantbeef> Distinct backwards index is capable of being statically checked! |
18:37:05 | * | rockcavera joined #nim |
18:37:05 | * | rockcavera quit (Changing host) |
18:37:05 | * | rockcavera joined #nim |
18:39:24 | FromDiscord | <bartimus> @ElegantBeef https://github.com/bartimus-primed/shared_code |
18:40:37 | FromDiscord | <Phil> In reply to @Elegantbeef "And that laziness is": Typically that lazyness encourages me to write templates to do one very complex thing instead of doing 40 near identical medium complex things |
18:40:52 | FromDiscord | <Phil> And then remove the 10 near identical medium complex things I already wrote |
18:54:32 | FromDiscord | <Elegantbeef> Well the issue is https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/channels_builtin.nim#L390 bart, one of the two types are wrong for whatever reason |
18:59:33 | * | cornfeedhobo joined #nim |
19:12:36 | * | ltriant joined #nim |
19:17:35 | * | ltriant quit (Ping timeout: 256 seconds) |
19:28:41 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3QJu |
19:29:26 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=3QJu" => "https://play.nim-lang.org/#ix=3QJv" |
19:52:12 | FromDiscord | <bartimus> @ElegantBeef ahhh, I shall debug, i greatly appreciate your help |
20:11:56 | * | pro quit (Quit: pro) |
20:13:21 | FromDiscord | <Phil> In reply to @sOkam! "What's the correct way": No idea on my end, at first glance I'd say the case statement in general requires newlines to break and can't handle semicolons well.↵Outside of that though, I am morbidly curious. What brought you to this question? |
20:13:32 | FromDiscord | <Phil> (edit) "In reply to @sOkam! "What's the correct way": No idea on my end, at first glance I'd say the case statement in general requires newlines to break and can't handle semicolons well.↵Outside of that though, I am morbidly curious. What ... brought" added "usecase" |
20:15:41 | FromDiscord | <sOkam!> In reply to @Isofruit "No idea on my": oneliner at the top of the script, so i can do with vim shortcuts `r -> v` to change the nimscript to verbose, or `r -> w` to change to whatif↵and, at the same time, not have the thing eat up 7 lines of code, making the top of the script not visible on first glance when opening |
20:16:03 | FromDiscord | <sOkam!> (edit) "whatif↵and," => "whatif. and," |
20:21:39 | NimEventer | New thread by BarrOff25: Bbqueue in Nim, see https://forum.nim-lang.org/t/8953 |
20:25:16 | * | jmdaemon joined #nim |
20:43:43 | * | PMunch quit (Quit: leaving) |
21:07:37 | FromDiscord | <Elegantbeef> @sOkam!\: why do you need a one liner? |
21:09:16 | FromDiscord | <sOkam!> In reply to @Elegantbeef "<@186489007247589376>\: why do you": explained in prev comment. don't "need" it, just more comfortable |
21:10:25 | FromDiscord | <Elegantbeef> why not just use a define? |
21:11:03 | FromDiscord | <sOkam!> In reply to @Elegantbeef "why not just use": not sure i get the syntax you mean |
21:11:29 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3QJQ |
21:11:31 | FromDiscord | <sOkam!> kinda new, that was just the first thing i thought of doing. if there is a better way, i'm happy to change it |
21:11:39 | FromDiscord | <Elegantbeef> Actually i take it back, what're you doing 😀 |
21:11:52 | FromDiscord | <sOkam!> (edit) "mean" => "mean↵kinda new, that was just the first thing i thought of doing. if there is a better way, i'm happy to change it" |
21:12:15 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Actually i take it": me or ajusa? |
21:12:21 | FromDiscord | <Elegantbeef> You |
21:12:22 | FromDiscord | <ajusa> you I think |
21:12:28 | FromDiscord | <Elegantbeef> Ajusa what is the `h2` template? |
21:13:04 | FromDiscord | <sOkam!> In reply to @Elegantbeef "You": https://media.discordapp.net/attachments/371759389889003532/946877481162539028/unknown.png |
21:13:12 | FromDiscord | <sOkam!> (edit) "" => "Turning this into one line" |
21:13:38 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3QJS |
21:15:28 | FromDiscord | <ajusa> though I believe only the last two in this would be ran |
21:16:08 | FromDiscord | <ajusa> and if I define them outside of the buildHTML template code works just fine. I'm trying to build a DSL that doesn't pollute the global namespace by scoping it to a template |
21:18:19 | FromDiscord | <Elegantbeef> ok so you've ran into the issue off template overloading i think |
21:18:29 | FromDiscord | <Elegantbeef> overloaded template cause odd typing bugs |
21:19:10 | FromDiscord | <ajusa> ah nope I'm just dumb |
21:19:30 | FromDiscord | <ajusa> the outer template has an arg called inner, and the inner templates have an arg called inner |
21:19:51 | FromDiscord | <ajusa> so nesting them causes issues, pretty sure that's in the nim tips and tricks. just changed the outer one to call it "myInner" and issue is gone |
21:20:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QJT |
21:20:21 | FromDiscord | <Elegantbeef> you can of course replace it with `w` and `s` if you really want |
21:20:38 | FromDiscord | <Elegantbeef> Ah good to hear, also nice RFC 🙂 |
21:20:52 | FromDiscord | <SoicBR> In reply to @ynfle "What is it?": I have absolutely no clue but it (probably) didn't have anything to do with iterating through the table. I was on the verge of going insane so I just gave up and used a more inefficient solution |
21:21:35 | FromDiscord | <sOkam!> In reply to @Elegantbeef "So sokam i was": i don't want opts. that's worse than having 6+lines at the start of the file |
21:21:47 | FromDiscord | <System64 ~ Flandre Scarlet> Eh okay does Nim supports Pointer arithmetic? https://media.discordapp.net/attachments/371759389889003532/946879674208907354/unknown.png |
21:21:58 | FromDiscord | <Elegantbeef> No, but yes it does |
21:22:04 | nrds | <Prestige99> Lol |
21:22:11 | nrds | <Prestige99> I love that answer |
21:22:22 | FromDiscord | <auxym> you can cast/to from int, but maybe you shouldn't |
21:22:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QJU |
21:22:27 | FromDiscord | <Elegantbeef> I mean it's done properly, pointers are distinct to pointer to collection |
21:23:14 | FromDiscord | <Elegantbeef> Well sokam i cannot suggest anything side from a if statement |
21:23:33 | FromDiscord | <Nick.> sent a code paste, see https://play.nim-lang.org/#ix=3QJV |
21:24:02 | FromDiscord | <Elegantbeef> `echo dogOwners[Dog(name: "Charlie")]` |
21:24:33 | FromDiscord | <Elegantbeef> it's a table of Dog -\> string |
21:24:45 | FromDiscord | <System64 ~ Flandre Scarlet> Doesn't really works https://media.discordapp.net/attachments/371759389889003532/946880419515731988/unknown.png |
21:24:57 | FromDiscord | <Elegantbeef> color isnt at ype |
21:25:10 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "color isnt at ype": color is a pointer |
21:25:14 | FromDiscord | <Nick.> ok, I see it now @ElegantBeef. Thanks! |
21:25:14 | FromDiscord | <Elegantbeef> Sorry it's `cast[ptr UncheckedArray[T]](ptr)[index]` |
21:25:22 | FromDiscord | <Elegantbeef> I messed up a tinge |
21:25:28 | FromDiscord | <System64 ~ Flandre Scarlet> and index is the color? |
21:25:29 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Well sokam i cannot": does if support condensing into oneline better than case of? |
21:25:40 | FromDiscord | <Elegantbeef> index is the offset, ptr would be color |
21:25:44 | FromDiscord | <sOkam!> idm changing the syntax , as long as its 1line |
21:25:44 | FromDiscord | <Elegantbeef> It should |
21:27:22 | FromDiscord | <Elegantbeef> `var s = 'w'; if s == 'w':(echo "whatif") elif s == 'v':(echo "Verbose") else:(echo "silent")` |
21:27:24 | FromDiscord | <Elegantbeef> Works fine |
21:27:48 | FromDiscord | <Elegantbeef> Personally i'd make the return type of that procedure a pointer to a collection since that's what it is |
21:28:02 | FromDiscord | <System64 ~ Flandre Scarlet> Like that? https://media.discordapp.net/attachments/371759389889003532/946881247165165608/unknown.png |
21:28:15 | FromDiscord | <Elegantbeef> Jesus you cannot read my messages 😀 |
21:28:32 | FromDiscord | <Elegantbeef> `cast[ptr UncheckedArray[Type]](color)[0]` |
21:28:47 | FromDiscord | <Elegantbeef> replace `Type` with the type the collection holds |
21:28:52 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
21:28:56 | FromDiscord | <System64 ~ Flandre Scarlet> so uint8 |
21:29:17 | FromDiscord | <Elegantbeef> Also consider making the return type of `tln_GetPalleteData` `ptr UncheckedArray[uint8]` |
21:29:56 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Also consider making the": I'm interoperating with a C lib |
21:30:05 | FromDiscord | <Elegantbeef> That doesnt change my statement |
21:30:34 | FromDiscord | <Elegantbeef> `ptr UncheckedArray[uint]` is the same as `uint8_t` or w/e in C, the difference is Nim's type safety |
21:31:00 | FromDiscord | <Elegantbeef> `ptr uint8` and `ptr UncheckedArray[uint8]` are different types in Nim one can use `[]` the other cannot |
21:33:03 | FromDiscord | <sOkam!> In reply to @Elegantbeef "`var s = 'w';": works, tyty 🙂 |
21:35:20 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "`ptr UncheckedArray[uint]` is the": Ah alright, so I guess I can change it in the nim module that interops with the lib? |
21:35:42 | FromDiscord | <Elegantbeef> Yep |
21:38:34 | FromDiscord | <System64 ~ Flandre Scarlet> Oh nice https://media.discordapp.net/attachments/371759389889003532/946883897243885668/unknown.png |
21:39:13 | FromDiscord | <Elegantbeef> color is nil |
21:41:25 | FromDiscord | <System64 ~ Flandre Scarlet> weird |
21:46:19 | FromDiscord | <ATwenty0ne> Has anyone had success using punchthrough with netty? |
21:46:54 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "color is nil": It normally shouldn't https://media.discordapp.net/attachments/371759389889003532/946885997935874058/unknown.png |
21:47:32 | nrds | <Prestige99> What is uint8T? |
21:47:47 | FromDiscord | <System64 ~ Flandre Scarlet> unsigned 8-bits int |
21:47:50 | FromDiscord | <Elegantbeef> probably the c2nim'd alias to uint8 |
21:47:57 | nrds | <Prestige99> ah |
21:47:57 | FromDiscord | <Elegantbeef> Nim already has uint8 so you could just use that |
21:50:13 | FromDiscord | <System64 ~ Flandre Scarlet> Ah well I understood |
22:11:08 | FromDiscord | <System64 ~ Flandre Scarlet> It works https://media.discordapp.net/attachments/371759389889003532/946892094834880532/unknown.png |
22:12:18 | FromDiscord | <Elegantbeef> Congrats |
22:15:16 | * | ltriant joined #nim |
22:36:00 | FromDiscord | <treeform> In reply to @enthus1ast "and does not have": Small correction, my `jsony` does not have its own `JsonNode` but uses `std/json` `JsonNode` and can read and write the std `JsonNode`s, just like `std/json` can. |
22:37:35 | NimEventer | New post on r/nim by RoughCalligrapher906: NIM Ideas in automation, see https://reddit.com/r/nim/comments/t1gki0/nim_ideas_in_automation/ |
22:39:44 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3QKh |
22:42:11 | * | jjido joined #nim |
22:46:06 | FromDiscord | <treeform> In reply to @ajusa "full template looks like": I think its because you use `inner` twise, the inner inner gets replaced by the body |
22:46:46 | FromDiscord | <treeform> https://play.nim-lang.org/#ix=3QKj this works |
22:46:56 | FromDiscord | <treeform> I had to use inner2 because otherwise it gets replaced |
22:46:58 | FromDiscord | <Elegantbeef> Yea ajusa got it fixed |
22:47:17 | FromDiscord | <treeform> oh I see now |
23:01:21 | FromDiscord | <ajusa> yeah lol, it took me about 10 minutes to see that issue. thanks treeform for the inspiration though, I was directly looking at your video and code for this bit |
23:14:13 | NimEventer | New question by itil memek cantik: Use of declaration and/or definition array of tuple, see https://stackoverflow.com/questions/71272652/use-of-declaration-and-or-definition-array-of-tuple |
23:19:31 | * | ltriant quit (Ping timeout: 256 seconds) |