00:00:43 | * | TakinOver joined #nim |
00:03:02 | FromDiscord | <Elegantbeef> It's a building block ontop of python afaict |
00:05:04 | demetera | Looks a bit proprietary and commercial |
00:06:14 | FromDiscord | <Nlits (Ping on reply)> In reply to @demetera "Looks a bit proprietary": yes |
00:07:57 | FromDiscord | <Elegantbeef> Yea it also lacks many things that I think are needed for a good language |
00:08:26 | FromDiscord | <Elegantbeef> No mention of static evaluation or macros, yes they say it has "powerful compile time programming" but showcase the most mundane generic |
00:09:33 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1103111063391715348/image.png |
00:09:42 | FromDiscord | <Elegantbeef> Oh yay we have compile time evaluation for if expressions...? |
00:10:49 | demetera | If they call this as a simple exploressions...man |
00:11:06 | demetera | expressions* |
00:15:39 | FromDiscord | <Elegantbeef> It really has all the warts of python |
00:15:57 | FromDiscord | <Elegantbeef> `getitem` instead of something more expressive |
00:17:52 | * | lucasta quit (Remote host closed the connection) |
00:21:56 | FromDiscord | <Elegantbeef> > Mojo types do not get default constructors, move constructors, memberwise initializers or anything else by default |
00:22:03 | FromDiscord | <Elegantbeef> Man this language is so odd |
00:22:18 | FromDiscord | <Elegantbeef> It's a python shell that introduces asinine steps |
00:22:48 | FromDiscord | <Elegantbeef> To use any type you have to declare all your memory hooks, even if they're default... |
00:29:56 | FromDiscord | <Nlits (Ping on reply)> Is there any way to get the pastebin from a terminal |
00:33:51 | FromDiscord | <Elegantbeef> "the pastebin" |
01:00:26 | * | demetera quit (Quit: Leaving) |
01:01:26 | * | demetera joined #nim |
01:10:32 | * | demetera quit (Quit: Leaving) |
01:11:42 | * | demetera joined #nim |
01:12:13 | * | demetera quit (Remote host closed the connection) |
01:12:45 | * | demetera joined #nim |
01:14:03 | * | demetera quit (Remote host closed the connection) |
01:16:57 | FromDiscord | <Nlits (Ping on reply)> In reply to @Elegantbeef ""the pastebin"": trying to implement pasting into my TUI text box, idk how |
01:56:55 | * | TakinOver quit (Ping timeout: 250 seconds) |
02:07:37 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4uLF |
02:08:03 | * | adigitoleo quit (Ping timeout: 268 seconds) |
02:08:11 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4uLF" => "https://play.nim-lang.org/#ix=4uLG" |
02:08:27 | * | adigitoleo joined #nim |
02:44:39 | * | beholders_eye quit (Ping timeout: 260 seconds) |
02:47:04 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/C4O |
02:48:40 | FromDiscord | <sOkam!> @Yardanico @ElegantBeef does this sound like a fuckup on my side, or is this a bug in the documentation? |
02:54:57 | * | Batzy quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
02:55:22 | * | Batzy joined #nim |
02:55:36 | FromDiscord | <Elegantbeef> Seems like inaccurate docs from what i know |
02:56:53 | madprops | https://www.modular.com/mojo |
02:57:01 | madprops | what's up with that |
03:03:18 | FromDiscord | <Elegantbeef> Rust but python |
03:05:38 | FromDiscord | <Rika> moldy python |
03:15:41 | madprops | why the focus on AI? |
03:16:43 | * | azimut joined #nim |
03:18:48 | FromDiscord | <Daniel Belmes> In reply to @madprops "why the focus on": https://docs.modular.com/mojo/why-mojo.html |
03:18:50 | FromDiscord | <Rika> Because that’s all the rage nowadays |
03:18:54 | FromDiscord | <Daniel Belmes> I think this is their FAQ answer |
03:22:01 | madprops | well they seem to know what they're talking about |
03:22:12 | madprops | lets see how it plays out |
03:24:11 | FromDiscord | <Elegantbeef> I mean they made a much more complex lifetime tracking system than Nim has and it's aimed for python progammers |
03:25:10 | madprops | len("python syntax can be annoying") |
03:25:32 | FromDiscord | <Elegantbeef> its not even about the syntax 😄 |
03:25:39 | FromDiscord | <Elegantbeef> You have to explicitly give up resources |
03:31:01 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Seems like inaccurate docs": does version1 sound like a bug? |
03:38:29 | FromDiscord | <j-james> "for ai" eh that's a bit gross |
03:39:22 | FromDiscord | <Elegantbeef> The real gross part is the language design and that it can accept normal python code |
03:39:27 | FromDiscord | <Elegantbeef> It has a whole dynamic level planned |
03:39:51 | FromDiscord | <ieltan> In reply to @madprops "https://www.modular.com/mojo": Interesting but it seems like the language is closed sourced? I can't seem to find anything about it |
03:40:05 | FromDiscord | <Elegantbeef> Yea it's not open source yet |
03:40:47 | FromDiscord | <j-james> subjectively i really hate the syntax, it pulled in all the pythonic conventions i hate |
03:41:03 | FromDiscord | <Elegantbeef> I mean i looked into their memory model it's awfully unintuitive |
03:41:11 | FromDiscord | <ieltan> What does this mean? |
03:41:12 | FromDiscord | <Elegantbeef> Especially given they're aiming for the Python programmer |
03:41:16 | FromDiscord | <j-james> also i'm not convinced on the memory model↵> (TODO: Not currently enabled) |
03:41:24 | FromDiscord | <ieltan> In reply to @Elegantbeef "It has a whole": this sorry |
03:41:29 | FromDiscord | <Elegantbeef> Why the fuck does one have to do `someProcThatConsumes(myVal^)` |
03:41:38 | FromDiscord | <j-james> but more languages are always nice, i love to see people trying new things |
03:41:44 | FromDiscord | <Elegantbeef> Why do i have to tell the compiler that knows it's going to take ownership that it's taking ownership |
03:42:05 | FromDiscord | <Elegantbeef> It's planned to be a super set of python which means normal python will run inside |
03:42:14 | FromDiscord | <ieltan> I can at least praise the marketing. |
03:42:25 | FromDiscord | <ieltan> Nim needs some of that |
03:42:27 | FromDiscord | <j-james> > Small values like “Int”, “Float”, and “SIMD” are passed directly in machine registers↵oh that's really weird |
03:42:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uLN |
03:42:52 | FromDiscord | <Elegantbeef> It's not a generic like `proc doThing(a, b: auto)` |
03:42:57 | FromDiscord | <Elegantbeef> It's 100% dynamically reasoned |
03:43:06 | FromDiscord | <j-james> they don't let llvm or a related backend handle that?? seems like kind of a strange optimization to market |
03:43:27 | FromDiscord | <ieltan> In reply to @Elegantbeef "It's planned to be": Is the "super" part compiled or interpreted like python? |
03:43:40 | FromDiscord | <Elegantbeef> It's planned to compile all of python afaik |
03:43:59 | FromDiscord | <Elegantbeef> It adds in structs and static typing with python's existent syntax |
03:44:21 | FromDiscord | <j-james> compiling all of python seems like a reasonable goal |
03:44:24 | FromDiscord | <Rika> Existing, I believe existent means a different connotation |
03:44:42 | FromDiscord | <ieltan> Interesting |
03:44:42 | FromDiscord | <j-james> inferring types from python seems like very much not a reasonable goal |
03:44:43 | FromDiscord | <Elegantbeef> James no clue if you seen but they have move semantics hooks, you have to explicitly say "this uses default hooks" |
03:45:00 | FromDiscord | <Elegantbeef> Yea it doesnt infer them it is purely dynamically typed |
03:45:03 | FromDiscord | <ieltan> I sure hope the package management will be good |
03:45:06 | FromDiscord | <Elegantbeef> So hidden boxing i assume |
03:45:27 | FromDiscord | <j-james> oh interesting |
03:45:37 | FromDiscord | <ieltan> Not that I'm gonna use it tho |
03:45:49 | FromDiscord | <Elegantbeef> Rika they both mean "present" afaik 😄 |
03:45:59 | FromDiscord | <ieltan> Using a language solely for AI development seems overkill |
03:46:12 | FromDiscord | <Rika> In reply to @ieltan "I sure hope the": Sounds like a big hurdle I think since you have to make sure you can access python’s ecosystem |
03:46:14 | FromDiscord | <Elegantbeef> It's supposed to be a system language that specialises for AI |
03:46:53 | FromDiscord | <ieltan> Nim SIMD and a ggml binding already goes a long way |
03:46:59 | FromDiscord | <Rika> I think dynamic typing the way python does it is bad |
03:47:08 | FromDiscord | <Elegantbeef> It's crazy though |
03:47:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uLO |
03:47:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uLP |
03:47:30 | FromDiscord | <ieltan> In reply to @Rika "Sounds like a big": Yeah, I was expecting that tbh. |
03:47:50 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4uLQ |
03:47:57 | FromDiscord | <Rika> That value thing, what does it mean |
03:47:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uLR |
03:48:05 | FromDiscord | <Rika> I mean I can understand what it is |
03:48:09 | FromDiscord | <Elegantbeef> Value means "generate default hooks" |
03:48:13 | FromDiscord | <Rika> But at a glance no one would know what it means |
03:48:17 | FromDiscord | <j-james> mmm they plan to have typeclasses too |
03:48:21 | FromDiscord | <Elegantbeef> If there are no hooks a type doesnt compile |
03:48:32 | FromDiscord | <Elegantbeef> It's such a stupid complexity |
03:48:42 | FromDiscord | <Elegantbeef> Especially given that this is aimed at python programmers |
03:48:43 | FromDiscord | <Rika> I think it’s a bit cursed to use decorators in that way lol |
03:48:55 | FromDiscord | <Rika> At least name it better |
03:48:56 | FromDiscord | <Elegantbeef> It very much is |
03:49:09 | FromDiscord | <Elegantbeef> I'd also say given a majority of types will use default hooks it's just inane |
03:49:40 | FromDiscord | <Rika> You bet most programmers are gonna just slap a @value there and call it a day without knowing what it really means |
03:50:03 | FromDiscord | <Elegantbeef> Especially since they're aiming this at python but faster |
03:50:04 | FromDiscord | <Elegantbeef> Yes |
03:51:04 | FromDiscord | <Elegantbeef> I'm also repulsed that they used `name`s |
03:51:11 | FromDiscord | <j-james> god me too |
03:51:13 | FromDiscord | <Elegantbeef> Why the hell did they do that |
03:51:23 | FromDiscord | <Elegantbeef> They could've supported the old python ones but just used normal names |
03:51:48 | FromDiscord | <Elegantbeef> `lt` could be converted by the compiler into `[]` and then people could just write it like Nim |
03:51:57 | FromDiscord | <Elegantbeef> Yes mojo also has lexical stropping just like Nim |
03:52:04 | FromDiscord | <Elegantbeef> So there is like 0 reason why it could work that way |
03:53:18 | FromDiscord | <Rika> In reply to @Elegantbeef "`__lt__` could be converted": ? |
03:53:25 | FromDiscord | <Elegantbeef> sorry `<` |
03:53:32 | FromDiscord | <Elegantbeef> was thinking `getItem` |
03:53:45 | FromDiscord | <Rika> I was wondering if it was me or you getting senile |
03:53:49 | FromDiscord | <j-james> for machine learning: i haven't stuck my head in since openai hit the scene: but i was under the impression that python was mostly used to compose function calls to fast c code via torch etc |
03:54:13 | FromDiscord | <j-james> so idk how valuable a bridge language is, when python already is the bridge language itself |
03:54:37 | FromDiscord | <Elegantbeef> Think the idea is somewhat similar to using Nim for Python modules |
03:55:06 | FromDiscord | <Elegantbeef> Except of course using a language with asinine rules |
03:55:09 | FromDiscord | <j-james> i suppose, that's a thing that unfortunately doesn't really happen though |
03:55:48 | FromDiscord | <Elegantbeef> I cannot stress how much the `^` postfix operator annoys me |
03:55:57 | FromDiscord | <Elegantbeef> It's such a stupid feature |
03:56:43 | FromDiscord | <Elegantbeef> > For movable types, the ^ operator ends the lifetime of a value binding and transfers the value to something else (in this case, the take\_ptr function). To support this, you can define functions as taking owned arguments |
03:56:48 | FromDiscord | <Elegantbeef> Uuuuugh! 😄 |
03:57:21 | FromDiscord | <j-james> hmm: is that equivalent to `sink t`? |
03:57:30 | FromDiscord | <Elegantbeef> yes |
03:57:35 | FromDiscord | <j-james> wait but you have to annotate it in the signature as well? wtf |
03:57:41 | FromDiscord | <Elegantbeef> Indeed |
03:57:47 | FromDiscord | <Elegantbeef> `owned name: T` |
03:57:50 | FromDiscord | <Elegantbeef> And guess what a mutable borrow is |
03:57:56 | FromDiscord | <Elegantbeef> `name&: T` |
03:58:08 | FromDiscord | <Dudugz> Are u guys talking about rust? |
03:58:11 | FromDiscord | <Elegantbeef> Guess what explicit pass by reference is |
03:58:15 | FromDiscord | <j-james> unfortunately not |
03:58:18 | FromDiscord | <Elegantbeef> `borrowed name: T` |
03:58:39 | FromDiscord | <Elegantbeef> The compiler like Nim will likely default to pass by reference and 'borrowed' is redundant |
03:58:49 | FromDiscord | <Elegantbeef> We're talking about mojo |
03:58:56 | FromDiscord | <Dudugz> Mojo? |
03:59:14 | FromDiscord | <Elegantbeef> It's a language that is best described as Rust but even more silly with a python syntax |
03:59:44 | FromDiscord | <j-james> that seems like more syntactical overhead than rust's ownership/borrows/mutable borrows distinction |
03:59:45 | FromDiscord | <Dudugz> Hm, By the tone of the conversation, can I predict that you didn't like what you found? |
03:59:56 | FromDiscord | <Dudugz> (edit) "By" => "by" |
04:00:06 | FromDiscord | <Elegantbeef> It's got a lot of silly design for a language aimed at python programmers |
04:00:40 | FromDiscord | <Elegantbeef> To declare a struct you need to know about hooks and how to write a `init` procedure |
04:00:47 | FromDiscord | <Elegantbeef> Unless you of course annotate it with `@value` |
04:01:03 | FromDiscord | <Dudugz> It seems painful to program in mongo then |
04:01:11 | FromDiscord | <Dudugz> (edit) "mongo" => "mojo" |
04:01:31 | FromDiscord | <Elegantbeef> Who knows I'm just looking at the language design! |
04:01:50 | FromDiscord | <Elegantbeef> It also dumbly uses annotations for features |
04:01:51 | FromDiscord | <j-james> yeah it's not open source or finished, yet |
04:01:53 | FromDiscord | <Dudugz> If the design is already bad, imagine the rest... |
04:02:01 | FromDiscord | <Elegantbeef> `@parameter` followed by an `if` statement is a `when` in Nim |
04:02:05 | FromDiscord | <Dudugz> In reply to @apropos "yeah it's not open": Ooh |
04:02:08 | FromDiscord | <Dudugz> Makes sense |
04:02:13 | FromDiscord | <Elegantbeef> `@parameter` followed by an internal procedure is a closure |
04:02:27 | FromDiscord | <Dudugz> I thought it was an already released and stable language |
04:02:41 | FromDiscord | <Elegantbeef> One might have noticed I didnt mention static evaluation |
04:02:52 | FromDiscord | <Elegantbeef> They have not documented their plans for that |
04:03:04 | FromDiscord | <Elegantbeef> They also do not have macros but static expressions + generics |
04:03:17 | FromDiscord | <Elegantbeef> Suffice to say I find it a funny language |
04:03:52 | FromDiscord | <Elegantbeef> Something somewhat interesting is that it's got move semantics but it isnt scoped based, it's last usage based |
04:03:59 | FromDiscord | <Elegantbeef> At the place of last usage the destructor is called |
04:04:23 | madprops | https://i.imgur.com/Nb4dKrh.png |
04:04:35 | madprops | anything is better than rust lol |
04:04:45 | FromDiscord | <Elegantbeef> Lol |
04:05:08 | FromDiscord | <Elegantbeef> I mean I find the explicit move semantics mostly silly myself |
04:05:19 | FromDiscord | <Dudugz> lol, agree to disagree tho, rust is good it's just too confusing with this borrowed and owned thing. Even Microsoft is porting services to rust. |
04:05:35 | FromDiscord | <Elegantbeef> I mean `borrowed` is never explicitly written |
04:05:41 | FromDiscord | <Elegantbeef> Atleast intentionally |
04:05:50 | FromDiscord | <Elegantbeef> it's just got `owned name: T` and `name&: T` really |
04:06:40 | FromDiscord | <Dudugz> I mean, you can't even make a list of instances that you lose access to instance. |
04:06:45 | FromDiscord | <Elegantbeef> Anywho i'll shush cause someone might think I know more than I do |
04:10:22 | FromDiscord | <Dudugz> I even tried rust for 1 month, until I got too much of a headache dealing with servers that need dynamism and rust being too restrictive and confusing with arc, mutex, owned and borrowed |
04:10:56 | FromDiscord | <Elegantbeef> Yea I do not dislike move semantics, I just think they should be more like Nim's |
04:11:11 | FromDiscord | <Elegantbeef> Now just if Nim could resolve multithreading with them |
04:11:35 | FromDiscord | <Dudugz> Yea |
04:12:12 | FromDiscord | <Elegantbeef> and if it could get views functioning |
04:12:49 | * | junaid_ joined #nim |
04:13:26 | FromDiscord | <huantian> If views worked I don’t know if beef would talk about open arrays more or less |
04:13:35 | FromDiscord | <ieltan> In reply to @Elegantbeef "I'm also repulsed that": they had the opportunity to correct python but they didnt |
04:13:38 | FromDiscord | <ieltan> :/ |
04:14:50 | * | TakinOver joined #nim |
04:15:11 | FromDiscord | <ieltan> In reply to @apropos "for machine learning: i": The game changer is ggml |
04:15:24 | FromDiscord | <ieltan> https://github.com/ggerganov/ggml |
04:15:29 | FromDiscord | <Dudugz> I was seeing some strange JS behavior like ``NaN^0`` which returns 0 |
04:17:14 | FromDiscord | <ieltan> What's great with Nim is that you can export functions to C so you can expose a C interface in order for other languages to use your stuff |
04:17:18 | FromDiscord | <ieltan> Actual win |
04:17:28 | FromDiscord | <ieltan> I dont think you can do that with??? |
04:17:32 | FromDiscord | <ieltan> erh |
04:17:39 | FromDiscord | <ieltan> mojo |
04:17:40 | FromDiscord | <Rika> mojo jojo |
04:17:53 | FromDiscord | <Elegantbeef> You probably could eventually |
04:18:08 | FromDiscord | <Elegantbeef> They do want it to be a system language |
04:18:51 | FromDiscord | <Dudugz> Mojo reminds me of Miojo in my language, which means noodles |
04:18:53 | FromDiscord | <ieltan> I will be sad if this ends up being the ai language |
04:20:05 | FromDiscord | <ieltan> In reply to @madprops "https://i.imgur.com/Nb4dKrh.png": 😦 |
04:20:53 | FromDiscord | <Dudugz> In reply to @ieltan "I will be sad": I don't deal with AI but I understand your pain, in any area where this language becomes popular it will be a pain. |
04:23:23 | FromDiscord | <ieltan> I've always thought "Damn, i should really learn some rust" but memes like that unironically keeps me away. and Nim already occupying my "shiny new language i want to make stuff with" itch |
04:24:42 | FromDiscord | <ieltan> In reply to @Dudugz "I don't deal with": I dont either but i've had a thought or two about learning how to create AI models. |
04:24:58 | FromDiscord | <ieltan> It fascinates me |
04:26:05 | FromDiscord | <ieltan> In reply to @Elegantbeef "You probably could eventually": Nice! |
04:27:27 | FromDiscord | <Rika> In reply to @ieltan "I've always thought "Damn,": I feel like most people have been turned off by the community and shit |
04:31:09 | * | junaid_ quit (Remote host closed the connection) |
04:33:35 | FromDiscord | <Elegantbeef> Cannot tell if you mean Rust or Nim, I can see me turning a bunch of people off |
04:33:36 | FromDiscord | <j-james> the rust community? |
04:34:16 | FromDiscord | <Elegantbeef> Oh wait you mean using Nim not sexually |
04:34:38 | FromDiscord | <j-james> i find the rust community pretty welcoming, they can be a bit uptight about the language itself sometimes but that's the case with all language communities |
04:34:39 | FromDiscord | <j-james> beef |
04:35:08 | FromDiscord | <j-james> In reply to @madprops "anything is better than": also yeah i do find traits hideously overengineered |
04:36:00 | FromDiscord | <j-james> plus i stg you should not need lifetime annotations: it's a consciousness choice of the compiler to not always infer them |
04:38:11 | FromDiscord | <Elegantbeef> James↵(@j-james) |
04:41:04 | FromDiscord | <Dudugz> sent a code paste, see https://paste.rs/NbV |
04:41:49 | FromDiscord | <ElegantBeef> Damn the bridge is pooched |
04:41:55 | FromDiscord | <ElegantBeef> I mean this is the same issue as in Nim |
04:42:40 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4uLV |
04:43:16 | FromDiscord | <ElegantBeef> Afaik you should be able to do `foo = list[0]` in Rust and reborrow |
04:43:55 | FromDiscord | <Dudugz> In reality the problem is that you can't even call a function from foo because of borrow lol, the way would be to clone which would cause this problem you mentioned |
04:44:31 | FromDiscord | <ElegantBeef> Yea the dichotomy of Rust/Nim 😄 |
04:45:06 | FromDiscord | <Dudugz> In reply to @ElegantBeef "Afaik you should be": But it's not recommended method tho, on rust server they consider it as bad design |
04:45:31 | FromDiscord | <ElegantBeef> It's consistent but it's pretty weird that `foo` no longer is accessible given that it has no owenable resources |
04:46:34 | FromDiscord | <Daniel Belmes> In reply to @Elegantbeef "Seems like inaccurate docs": Added more info to the manual to hopefully help out with this case https://github.com/nim-lang/Nim/pull/21773 |
04:46:38 | FromDiscord | <Dudugz> Yes, this is what confuses me the most, if push is no longer using the instance after adding why does it not return control of the instance to the scope? |
04:46:45 | FromDiscord | <j-james> In reply to @Dudugz "Now explain me the": yea the idiomatic way would be to `.clone()` it: because the data in `Foo` is now a part of `!vec[]` |
04:47:00 | FromDiscord | <j-james> In reply to @Dudugz "Yes, this is what": it is using the instance |
04:47:25 | FromDiscord | <ElegantBeef> It doesnt make much sense that you can take ownership of data that is not moveable |
04:47:46 | FromDiscord | <ElegantBeef> Like if a data type is purely stack allocated with no pointers taking ownership is a copy regardless |
04:48:26 | FromDiscord | <ElegantBeef> Like yes if it has internal resources that would be moved it makes sense that it invalidates `foo` to prevent dangling pointers |
04:48:43 | FromDiscord | <ElegantBeef> Seems it just does the consistent thing of all types are no longer usable after a move |
04:48:49 | FromDiscord | <Dudugz> In reply to @apropos "yea the idiomatic way": That's not cool tho, what if I want to change the value of an instance property? It would be horrible to have two identical objects with disconnected properties. Rust seems to assume that everything needs to be static. Although you can use Arc and Mutex which honestly just adds more headache with moves and values that don't support moves. |
04:48:51 | FromDiscord | <ElegantBeef> Though to be fair Nim 0's memory after a move |
04:49:13 | FromDiscord | <j-james> yeah, like what if `foo` had an element that was a pointer to somewhere else |
04:49:28 | FromDiscord | <Dudugz> In reply to @apropos "it is using the": Uses to add the instance, after the function finishes its execution it is no longer used. |
04:49:42 | FromDiscord | <j-james> `Foo` having entirely self-contained data is kinda the exception not the norm |
04:50:47 | FromDiscord | <j-james> when learning rust i definitely had to convince myself "okay, calling clone here / wrapping this in an Rc / etc is actually fine, even if it bothers me a bit" |
04:51:05 | FromDiscord | <Dudugz> Well OOP is about having objects loading data... Like a server you create an instance of a client where the temporary data of the user's session will be. |
04:51:09 | FromDiscord | <ElegantBeef> Nim's implicit copy is just nicer 😛 |
04:51:20 | FromDiscord | <j-james> yea i think i agree |
04:51:25 | FromDiscord | <Dudugz> + the functions to handle socket |
04:51:50 | FromDiscord | <ElegantBeef> Though I'd argue that Rust invalidating types without type analysis is bit funny |
04:52:05 | FromDiscord | <Dudugz> In reply to @ElegantBeef "*Nim's implicit copy is": lol, but does it actually copy the value or the pointer? In my case I use ref object |
04:52:22 | FromDiscord | <ElegantBeef> It does a value copy cause it has to be memory safe |
04:52:22 | FromDiscord | <j-james> borrowing mostly isn't the worst though. as long as you fall back to `.clone()` when needed |
04:52:44 | FromDiscord | <j-james> my rule of thumb is if i start fucking around with weird lifetime annotations, reevaluate and clone instead |
04:52:45 | FromDiscord | <ElegantBeef> Nim never lowers down to a pointer implicitly |
04:53:29 | FromDiscord | <Dudugz> In reply to @ElegantBeef "It does a value": Well it doesn't seem to affect me tho, I created a server that stores a list of client instances, modifying a client property also changed the list. |
04:53:48 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4uLW |
04:53:59 | FromDiscord | <ElegantBeef> Nim's move semantics work in a way that is more trustworthy to the programmer |
04:54:23 | FromDiscord | <Dudugz> In reply to @apropos "borrowing mostly isn't the": I always tried to use clone, until I saw that you can't clone sockets and you can't implement traits on types you didn't create yourself. |
04:54:45 | FromDiscord | <j-james> In reply to @Dudugz "I always tried to": that last one may be my #1 complaint with rust |
04:54:52 | FromDiscord | <ElegantBeef> Wait a minute |
04:54:55 | FromDiscord | <j-james> actually hold on i have a list |
04:55:02 | FromDiscord | <ElegantBeef> You cannot implement traits... on types you didnt declare |
04:55:11 | FromDiscord | <Dudugz> Well yea |
04:55:16 | FromDiscord | <j-james> other people's traits |
04:55:30 | FromDiscord | <ElegantBeef> So if you want to make something with serde you cannot? |
04:55:34 | FromDiscord | <j-james> so no implementing Display on a type you don't own |
04:55:37 | FromDiscord | <Dudugz> From a security point of view this makes sense but then if a type doesn't have some feature you are also limited to not being able to implement it. |
04:55:50 | FromDiscord | <Dudugz> In reply to @ElegantBeef "So if you want": Exactly |
04:55:52 | FromDiscord | <ElegantBeef> work with serde |
04:55:54 | FromDiscord | <ElegantBeef> Lol |
04:56:02 | FromDiscord | <ElegantBeef> I thought you could this entire time, that's wild |
04:56:15 | FromDiscord | <Dudugz> I wanted to modify Deserialize and Serialize but it wasn't possible because rust won't let me |
04:56:51 | FromDiscord | <ElegantBeef> Generics win yet again |
04:56:52 | FromDiscord | <j-james> i have been told by someone in the rust discord, presumably seriously, that wrapping the type in a single-element tuple is the idiomatic way to do this |
04:57:23 | FromDiscord | <ElegantBeef> Right i vaguely recall someone making a distinct for that |
04:57:31 | FromDiscord | <Dudugz> hmm |
04:57:35 | FromDiscord | <ElegantBeef> You now need to manually unpack it to use it |
04:58:35 | FromDiscord | <ElegantBeef> Dont you also have to reimplement any other traits now aswell which forward the call to the internal trait |
04:58:51 | FromDiscord | <Dudugz> Honestly I was between Nim and Dart but seeing Flutter with all this callback hell scared me. |
04:59:01 | FromDiscord | <Dudugz> So I opted to learn Nim |
04:59:09 | FromDiscord | <ElegantBeef> This seems like patching a hole in drywall by putting up another entire sheet of drywall |
04:59:19 | FromDiscord | <Dudugz> lol |
05:02:38 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4uM0 |
05:03:05 | FromDiscord | <ElegantBeef> I mean you could make a proc for this |
05:03:07 | FromDiscord | <Dudugz> (edit) "https://play.nim-lang.org/#ix=4uM0" => "https://paste.rs/rmL" |
05:05:16 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4uM1 |
05:05:26 | FromDiscord | <ElegantBeef> Otherwise you could use a tuple and i'd hate you immensely |
05:05:50 | FromDiscord | <Dudugz> I mean dynamic like javascript, you can create any object you want not following any pattern |
05:06:18 | FromDiscord | <j-james> sent a long message, see http://ix.io/4uM2 |
05:06:20 | FromDiscord | <Dudugz> sent a code paste, see https://paste.rs/ZWq |
05:06:24 | FromDiscord | <huantian> Do you mean like c# anonymous objects |
05:06:30 | FromDiscord | <ElegantBeef> You'd need to use an object variant like JsonNode |
05:06:33 | FromDiscord | <j-james> but, like, those are all of my gripes |
05:06:43 | FromDiscord | <ElegantBeef> Rust has limited UFCS 😛 |
05:06:51 | FromDiscord | <Dudugz> In reply to @apropos "okay yeah, my gripes": Lol I agree with all points |
05:07:36 | FromDiscord | <j-james> and proper pattern matching with algebraic data types and the excellent (as good as nim) type system make up for it |
05:07:42 | FromDiscord | <Dudugz> In reply to @ElegantBeef "You'd need to use": Couldn't a template/macro build the type and initialize it? |
05:08:00 | FromDiscord | <ElegantBeef> My favourite issue was someone wanting to do some compile time string operations but cause a Rust compile time string is a `const char` you cannot use `std::String` ops |
05:08:26 | FromDiscord | <Dudugz> Lol I had this problem with Rust |
05:08:29 | FromDiscord | <j-james> oh, and metaprogramming seems more limited + iterator laziness could probably be better done by compiler magic than in the type system |
05:08:35 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4uM3 |
05:08:36 | FromDiscord | <Dudugz> Honestly it was pretty frustrating |
05:08:37 | FromDiscord | <ElegantBeef> Might need `"foo"` do not recall |
05:08:47 | FromDiscord | <j-james> In reply to @ElegantBeef "*Rust has limited UFCS*": i know, i know... |
05:09:07 | FromDiscord | <j-james> "why would ufcs be helpful? just implement everything as a trait" ugh |
05:09:37 | FromDiscord | <ElegantBeef> Arent authoring the type? Who cares! |
05:10:14 | FromDiscord | <ElegantBeef> The premise of traits are nice atleast |
05:10:21 | FromDiscord | <j-james> i do really think that a language with a strong concept system that's used everywhere and ufcs would be really pleasant to work with: you'd have to monomorphize everything which i understand is expensive at compile time, but not like that much more expensive |
05:10:29 | FromDiscord | <ElegantBeef> Checked generics is a great thing, plus the dyn trait |
05:11:00 | FromDiscord | <ElegantBeef> Well start using concepts more in Nim, problem solved 😛 |
05:11:10 | FromDiscord | <j-james> i'm not familiar with the dyn trait actually outside of rust-analyzer suggesting it sometimes |
05:11:25 | FromDiscord | <j-james> In reply to @ElegantBeef "Well start using concepts": actually though |
05:11:27 | FromDiscord | <ElegantBeef> It gives you a vtable and allows you to raise a trait up into a box |
05:11:41 | FromDiscord | <ElegantBeef> So practically you get runtime dispatch across dynamic types |
05:12:15 | FromDiscord | <ElegantBeef> you can make a `vec<dyn trait>` and then hold anything that implements said trait |
05:12:30 | FromDiscord | <j-james> ah funky |
05:12:43 | FromDiscord | <j-james> what's a case when you'd do that over static dispatch? |
05:12:52 | FromDiscord | <ElegantBeef> GUI probably |
05:13:16 | FromDiscord | <ElegantBeef> You dynamically make a GUI hierarchy that is based off traits and can dispatch upon them |
05:13:24 | FromDiscord | <ElegantBeef> Or do something like Nim's `std/stream` |
05:13:41 | FromDiscord | <ElegantBeef> Where you have the same API across multiple and can consume them without regard at runtime |
05:13:49 | FromDiscord | <Dudugz> So far I love Nim, minus the part about having to manually add ``requires "x > y"`` to dependencies when I install a library. |
05:13:52 | FromDiscord | <j-james> ah i see |
05:14:15 | FromDiscord | <j-james> In reply to @Dudugz "So far I love": i mean that's nimble, which is separate from the language: and definitely has other issues |
05:14:16 | FromDiscord | <huantian> In reply to @Dudugz "So far I love": I think like half of the complaints about nim have something to do with tooling tbh |
05:14:21 | FromDiscord | <j-james> yeah agreed |
05:14:28 | FromDiscord | <Dudugz> In reply to @ElegantBeef "You dynamically make a": Yup, GUI widgets are usually made and connected through hierarchies |
05:15:15 | FromDiscord | <j-james> i still get orphaned `nimsuggest` processes eating up a core sometime (plus using rust-analyzer has spoiled me feature-wise) |
05:16:17 | FromDiscord | <Dudugz> I'm thinking of doing something like gtk in Nim but using SDL. Not sure it's worth the effort tho. |
05:16:53 | FromDiscord | <j-james> like gtk? like, making a whole ass widget + graphics library? |
05:17:07 | FromDiscord | <ElegantBeef> If you make the backend pluggable it'd have applications in embedded where software rendering is all they have |
05:17:24 | FromDiscord | <Dudugz> Hm, more focused on interface widgets, creating layouts, inputs, etc.. |
05:17:56 | FromDiscord | <Dudugz> In reply to @ElegantBeef "If you make the": This looks interesting and laborious 😁 |
05:18:14 | FromDiscord | <ElegantBeef> It gives you a practical reason to do it 😛 |
05:18:20 | FromDiscord | <Dudugz> yea |
05:22:05 | FromDiscord | <Dudugz> Well despite the idea of creating a UI lib with plugin support I'm still busy with university, I have 2 seminars to present next week 🙆♂️ that is, I would never finish this project. |
05:23:46 | FromDiscord | <Dudugz> I would have to have time to do research, in case I have a shallow knowledge about widgets and I would need to research more about to correctly implement each one, I would hate to create a bunch of workaround to publish lol |
05:26:44 | FromDiscord | <j-james> sent a long message, see http://ix.io/4uM7 |
05:26:54 | FromDiscord | <ElegantBeef> Wow bringing up patty when i'm right here |
05:27:01 | FromDiscord | <Dudugz> lol |
05:27:33 | FromDiscord | <j-james> ah, sorry, of course i meant $presumably_beef's_equivalent_project |
05:27:34 | FromDiscord | <ElegantBeef> And chaining iterators |
05:27:54 | FromDiscord | <ElegantBeef> Nah my fungus is not equivlent it's technically different but more akin to what you want |
05:28:00 | FromDiscord | <ElegantBeef> <https://github.com/beef331/fungus> |
05:28:38 | FromDiscord | <Dudugz> About ```` i agree, I would prefer something like export before the declaration to export, in generic methods I never remember which side to put |
05:28:45 | FromDiscord | <ElegantBeef> <https://github.com/beef331/slicerator/blob/itermacros/tests/titermacros.nim> due to a change this now uses a `template` |
05:28:56 | FromDiscord | <ElegantBeef> Magical shite 0 cost chaining iterators |
05:29:05 | FromDiscord | <ElegantBeef> `` goes on the symbol |
05:29:08 | FromDiscord | <ElegantBeef> it always goes on the symbol |
05:29:34 | FromDiscord | <j-james> but it could be `pub` and always go before the symbol and life would be nice |
05:29:36 | FromDiscord | <Dudugz> Sure |
05:29:49 | FromDiscord | <ElegantBeef> Bleh I'm indifferent |
05:29:56 | FromDiscord | <ElegantBeef> `` is fine where it's at imo |
05:30:21 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4uM9 |
05:30:37 | FromDiscord | <ElegantBeef> I would prefer you didnt design language syntax |
05:30:44 | FromDiscord | <j-james> i think i like `export` in the context of `import foo/bar`, `export bar` |
05:30:47 | FromDiscord | <j-james> In reply to @ElegantBeef "I would prefer you": oof |
05:31:05 | FromDiscord | <ElegantBeef> It's all in good fun |
05:32:16 | FromDiscord | <j-james> man speaking of fun i do wish disruptek was still around |
05:32:26 | FromDiscord | <j-james> i don't know if i ever witnessed you and him in the same channel |
05:32:29 | FromDiscord | <ElegantBeef> He's got a dark corner full of AI right now |
05:32:34 | FromDiscord | <j-james> what a combo that would be |
05:32:36 | FromDiscord | <j-james> ohno |
05:32:38 | FromDiscord | <Dudugz> ```` já tem muitos significados, ``group parameters`` (python), ``pointers`` (C), ``multiply`` (any |
05:32:57 | FromDiscord | <j-james> yeah pretty much dudugz |
05:32:59 | FromDiscord | <ElegantBeef> Oh noes it can mean different things in different contexts dudugz! |
05:33:08 | FromDiscord | <ElegantBeef> Imagine if `"hello" + "world"` compiled |
05:33:15 | FromDiscord | <Dudugz> ```` already have too much meanings like pointers, multiply and group params |
05:33:22 | FromDiscord | <ElegantBeef> It doesnt mean pointers in Nim |
05:33:26 | FromDiscord | <Rika> does not have the |
05:33:27 | FromDiscord | <Rika> Yeah |
05:33:29 | FromDiscord | <j-james> it gets it from oberon i think: but unfortunate for a language that works with c so often to not have that connotation |
05:33:37 | FromDiscord | <ElegantBeef> So that's like saying it means revolutions of the sun cause X language used it lexically |
05:33:56 | FromDiscord | <j-james> (edit) removed "not" | "that" => "an entirely different" |
05:34:03 | FromDiscord | <ElegantBeef> Oberon used an explicit `export` word |
05:34:12 | FromDiscord | <Dudugz> My cell is a bit crazy today. Operating system is eating 2.1GB RAM out of 3GB |
05:34:34 | FromDiscord | <ElegantBeef> I mean C uses it as a pointer operator so it's on it |
05:34:41 | FromDiscord | <ElegantBeef> `^` was used for pointers in pascal |
05:34:48 | FromDiscord | <ElegantBeef> Can we not use `^` for power now? |
05:35:09 | FromDiscord | <ElegantBeef> We also use `^` for backwards indexing |
05:35:19 | FromDiscord | <ElegantBeef> Isnt it a bit crazy that it has so much meaning... |
05:35:32 | FromDiscord | <ElegantBeef> Now before you say "But no one used pascal" |
05:35:33 | FromDiscord | <j-james> In reply to @ElegantBeef "Oberon used an explicit": nah i think it was oberon? at least for types |
05:35:46 | FromDiscord | <ElegantBeef> Nim is pascal inspired through Modula and oberon |
05:35:53 | FromDiscord | <ElegantBeef> So it's more clostly a concern than `` |
05:35:59 | FromDiscord | <ElegantBeef> (edit) "clostly" => "closely" |
05:36:13 | FromDiscord | <Dudugz> lol, it's not that it's just confusing. You are used to an operator having this meaning in several languages and then boom in another language has a totally different meaning |
05:36:19 | FromDiscord | <j-james> but bluh |
05:36:29 | FromDiscord | <Dudugz> (edit) "that" => "that," |
05:36:36 | FromDiscord | <ElegantBeef> In reply to @Dudugz "lol, it's not that,": You can carry this on to any language though, so it's moot |
05:36:44 | * | jmdaemon joined #nim |
05:36:52 | FromDiscord | <ElegantBeef> In C inspired languages `{}` is scope but Nim uses it for Tables/Sets |
05:37:02 | FromDiscord | <ElegantBeef> Do we have to abide by the laws of our fathers? |
05:37:21 | FromDiscord | <Rika> In reply to @ElegantBeef "In C inspired languages": Or array |
05:37:27 | FromDiscord | <j-james> In reply to @apropos "i think for nim,": at least for all of those except the public marker and the `type Foo: struct` syntax, i can hold hope that they're improvable |
05:37:30 | FromDiscord | <Rika> C used {} for arrays too iirc |
05:37:34 | FromDiscord | <Dudugz> lol no, I think it's cool that each language has its differences |
05:37:40 | FromDiscord | <ElegantBeef> When does C's ownership of `` end, it's been released for 50 years now |
05:37:51 | FromDiscord | <ElegantBeef> C uses `{}` for intialisation rika |
05:37:52 | FromDiscord | <ElegantBeef> So yea |
05:38:38 | FromDiscord | <ElegantBeef> James you're correct oberon used `` for export |
05:38:39 | FromDiscord | <j-james> tooling, adts, pattern matching, chained iterator performance, adoptation of view types and sink, better c/python interop, stropping for literal identifiers, arbitrary lookahead for type declarations |
05:38:46 | FromDiscord | <ElegantBeef> Think i was thinking of Modula or another wirth language |
05:39:26 | FromDiscord | <Dudugz> Nim captivated me precisely because of the fact that it does not have a strict syntax, you can adjust it to whatever is best for you and no one will say "But this is against PEP ur dur" |
05:39:41 | FromDiscord | <j-james> don't know how ergonomic proper adts can be but mostly-proper pattern matching and chained iterator performance are already implemented as libraries, which is really quite excellent |
05:39:41 | FromDiscord | <ElegantBeef> > arbitrary lookahead for type declarations↵Is this just "cyclical type trees"? |
05:40:01 | FromDiscord | <j-james> yea probably |
05:40:17 | FromDiscord | <j-james> i just hate having to lump everything in one type block, especially when writing wrappers |
05:40:37 | FromDiscord | <ElegantBeef> I mean the issue with proper ADTs really pattern matching, Araq seems to want to improve that properly, but who knows how long it'll be |
05:41:01 | FromDiscord | <Dudugz> I also had to create a types.nim to have the types and each type had its file declaring the procs. |
05:41:12 | FromDiscord | <ElegantBeef> For not I think Fungus' primitive pattern matching and syntax is ideal but i also dont really care about ADTs/Pattern Matching |
05:41:16 | FromDiscord | <ElegantBeef> (edit) "not" => "now" |
05:41:23 | FromDiscord | <j-james> don't think universal option types and universal concept usage can ever happen unfortunately: but like i guess that wouldn't be the best fit for nim anyway, letting rust keep those is not the worst |
05:41:38 | FromDiscord | <ElegantBeef> "universal option types" |
05:41:43 | FromDiscord | <ElegantBeef> Why doth though hate me |
05:41:47 | FromDiscord | <ElegantBeef> (edit) "though" => "thou" |
05:41:57 | FromDiscord | <j-james> OH another bad one is not sharing field names in variant types |
05:42:01 | FromDiscord | <j-james> i hate that |
05:42:20 | FromDiscord | <ElegantBeef> That's practically the exact same as "Improper ADTs" |
05:42:30 | FromDiscord | <j-james> i don't know what kinds of limitations exist in the compiler around that but i hope for it to change someday |
05:42:33 | FromDiscord | <ElegantBeef> Not being able to share field names is cause of what the object variants give you |
05:43:00 | FromDiscord | <ElegantBeef> A field access on an object variant right now does not require any runtime reasoning |
05:43:08 | FromDiscord | <ElegantBeef> It's purely a check if field is accessible and grab it |
05:43:50 | FromDiscord | <ElegantBeef> When you introduce shared field names you now need to check which branch you're on and ensure that the name is what you want and this gets even worse when you add shared names different types |
05:44:16 | FromDiscord | <ElegantBeef> Cause field order can be different across the object variant shared fields is not great |
05:44:58 | FromDiscord | <ElegantBeef> Other languages get around this by forcing you to unpack the object(as fungus does) which means you can have shared fields cause the field is a field on a sub object |
05:45:09 | FromDiscord | <Dudugz> But couldn't there be something to allow sharing a specific field? |
05:45:44 | FromDiscord | <Dudugz> (edit) "But" => "~~But" | "field?" => "field?~~" |
05:45:52 | FromDiscord | <ElegantBeef> Of course you can share the same name across a field of the same type, the issue is just accessing is more complicated |
05:46:05 | FromDiscord | <ElegantBeef> cause instead of just being able to grab the field you now need to grab the field for a specific variant |
05:46:16 | FromDiscord | <Dudugz> Oh tendi but you said that fungus almost solves the problem |
05:46:38 | FromDiscord | <Dudugz> (edit) "tendi" => "got it" |
05:46:46 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4uMc |
05:46:56 | FromDiscord | <ElegantBeef> `myObject.a` now is much more complicated |
05:47:46 | FromDiscord | <Dudugz> I hate keyboard suggestions, and I hate that my phone OS is all buggy ugh, phone updated android from 10 to 13 and now the interface keeps leaving and returning to the screen or sometimes the touch bug |
05:47:48 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4uMd |
05:48:37 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=4uMf |
05:49:01 | FromDiscord | <ElegantBeef> Sure but now consider you want to share a field across branches in rust |
05:49:07 | FromDiscord | <ElegantBeef> You now have to repeat yourself how many times |
05:49:25 | FromDiscord | <j-james> it's just much nicer syntactically to be able to nest arbitrary types instead of restricting it to structs |
05:49:26 | FromDiscord | <ElegantBeef> Once for each shape or you get a different struct and add this object as a child |
05:49:38 | FromDiscord | <ElegantBeef> There are benefits for both syntax |
05:50:46 | FromDiscord | <j-james> In reply to @ElegantBeef "Sure but now consider": yea i run into this much less frequently, and also find making a different struct to add the object as a child isn't so bad |
05:52:00 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=4uMh |
05:52:01 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/lCq |
05:52:20 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=4uMi |
05:52:51 | FromDiscord | <j-james> i do have a project i've been meaning to finish that uses heavy pattern matching, i might just rewrite it to use patty or fungus then |
05:52:57 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4uMj |
05:53:03 | FromDiscord | <ElegantBeef> But that was too confusing |
05:53:31 | FromDiscord | <ElegantBeef> well be prepared to be disappointed with Fungus' lacking pattern matching |
05:53:37 | FromDiscord | <ElegantBeef> It's very basic it only matches types |
05:54:04 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4uMk |
05:54:28 | FromDiscord | <ElegantBeef> Also have the `from` macro for `if let Some(x)` like code |
05:54:36 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4uMl |
05:55:08 | FromDiscord | <j-james> yea algebraic data types and structural pattern matching are really two sides of the same coin in my mind |
05:55:28 | FromDiscord | <j-james> that's how rust drew me in and kept me there tbh |
05:55:34 | FromDiscord | <ElegantBeef> Well you have to have pattern matching for tuple tagged unions |
05:55:39 | FromDiscord | <ElegantBeef> I refuse to call the ADTs really 😄 |
05:55:44 | FromDiscord | <ElegantBeef> (edit) "the" => "them" |
05:55:56 | FromDiscord | <ElegantBeef> ADT is a general term that covers so many other things |
05:56:01 | FromDiscord | <j-james> i think the standard is probably racket's match statement: https://docs.racket-lang.org/reference/match.html |
05:56:21 | FromDiscord | <j-james> (edit) "i think the standard ... is" added "to strive to/" |
05:56:24 | FromDiscord | <j-james> (edit) "to/" => "to" |
05:56:53 | FromDiscord | <j-james> but rust's match statement is a very good contender, i keep learning that it's more powerful than i thought every day |
05:57:15 | FromDiscord | <ElegantBeef> I still dumbly content that PM is more confusing, since i've never used it |
05:57:19 | FromDiscord | <ElegantBeef> (edit) "content" => "contend" |
05:57:50 | FromDiscord | <j-james> yeah algebraic data types is just One Of Those Terms that while like kinda descriptive is thrown around and wordy enough that it's kind of an awful name |
05:58:07 | FromDiscord | <j-james> like const generics, or generic associated types, or really a lot of rust terminology |
05:58:44 | FromDiscord | <j-james> oh yeah "parametric polymorphism" and "ad hoc polymorphism" |
05:59:00 | FromDiscord | <ElegantBeef> I love when people say polymorphism! |
05:59:04 | FromDiscord | <j-james> i got fed up with it enough that i'm putting together a computer science glossary |
05:59:10 | FromDiscord | <ElegantBeef> It's not that helpful whether they mean runtime or static |
06:00:51 | FromDiscord | <ElegantBeef> In reply to @apropos "i got fed up": "Just stop" |
06:01:21 | FromDiscord | <ElegantBeef> I'm lucky cause I'm conventionally uneducated so all these terms are just funny words that mean nothing |
06:03:11 | FromDiscord | <j-james> that's the way to go tbh, i just think of them as very long words with spaces in between parts of them |
06:08:27 | NimEventer | New thread by alexeypetrushin: Why template called when the arg list doesn't match?, see https://forum.nim-lang.org/t/10160 |
06:19:11 | * | beholders_eye joined #nim |
06:27:30 | * | PMunch joined #nim |
06:29:41 | * | kenran joined #nim |
06:29:56 | * | fredrikhr joined #nim |
06:36:59 | * | fredrikhr92 joined #nim |
06:38:28 | * | fredrikhr quit (Ping timeout: 240 seconds) |
06:42:20 | * | advesperacit joined #nim |
06:48:47 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4uMp |
06:50:20 | FromDiscord | <Dudugz> newSmth(Opts(...)) seems redundant seeing now. Since newSmth(...) would do the same thing without needing to instantiate another type |
06:53:56 | FromDiscord | <j-james> `proc newSmth(opt1: bool, opt2: int, opt3 = "default", ...)` seems good |
06:54:10 | FromDiscord | <j-james> esp. if you have default values: then that's definitely idiomatic |
06:54:57 | FromDiscord | <j-james> for a _lot_ of options though, taking a settings parameter and having a separate `initSettings()` constructor might be a good idea: that's what prologue does iirc |
06:55:08 | * | fredrik92 joined #nim |
06:56:10 | * | fredrik92 is now known as fredrikhr |
06:58:47 | * | fredrikhr92 quit (Ping timeout: 268 seconds) |
07:03:12 | * | Notxor joined #nim |
07:17:08 | FromDiscord | <Chronos [She/Her]> In reply to @Dudugz "What would be the": Honestly I prefer the first but as james said, an initSettings proc is a good idea |
07:17:26 | FromDiscord | <Chronos [She/Her]> But even better (imo): `Opts.init()` :) |
07:18:34 | FromDiscord | <Dudugz> In reply to @apropos "for a _lot_ of": like smthInstance.initSettings(...)? |
07:18:50 | FromDiscord | <Dudugz> In reply to @Hourglass, When the Hour Strikes "But even better (imo):": no need tho, bc Opts would be like an interface |
07:18:58 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4uMt |
07:19:05 | FromDiscord | <Chronos [She/Her]> In reply to @Dudugz "no need tho, bc": What do you mean? |
07:19:31 | FromDiscord | <Dudugz> Opts(opt1: false, opt2: 20, opt3: "hello") would be more idiomatic, there's no need to create a proc to initialize this type of object |
07:19:57 | FromDiscord | <Chronos [She/Her]> Fair, but without a proc you can't have defaults so keep that in mind |
07:19:59 | FromDiscord | <Dudugz> but again you could'nt relly on default values without a proc |
07:20:03 | FromDiscord | <Dudugz> yea |
07:20:05 | FromDiscord | <Chronos [She/Her]> Yeah |
07:20:19 | FromDiscord | <Dudugz> but then could do like James suggested instance.initSettings(opt1: ....) |
07:20:29 | FromDiscord | <Dudugz> (edit) "could'nt" => "couldn't" |
07:20:51 | FromDiscord | <Chronos [She/Her]> Why the instance? |
07:21:16 | FromDiscord | <Chronos [She/Her]> And I don't think James meant it like that but it also works if that's what you're going for aha |
07:21:23 | FromDiscord | <Dudugz> well you must target something to customize? |
07:21:28 | FromDiscord | <Chronos [She/Her]> No...? |
07:21:41 | FromDiscord | <Chronos [She/Her]> You make a new object and return that aha |
07:22:15 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4uMv |
07:22:40 | FromDiscord | <Chronos [She/Her]> It returns a new Opts object, and it'd depend on you to decide how to use it |
07:22:40 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4uMx |
07:23:11 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4uMy |
07:23:25 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://paste.rs/Xip |
07:23:31 | FromDiscord | <Dudugz> yea |
07:28:34 | FromDiscord | <Yardanico> also fyi nim 2.0 will have default values for object fields (compile-time known ones of course) |
07:29:18 | FromDiscord | <firq> If you need to pass a set of parameters to several different functions, then creating an Opts type and passing that, otherwise I'd suggest the parameters directly to the single function. |
07:32:45 | FromDiscord | <Dudugz> lol i didn't realized it was a super-reaction |
07:33:08 | FromDiscord | <Dudugz> i just clicked to react on the first emoji icon |
07:34:38 | FromDiscord | <Dudugz> What's the best design for an event poll without using an event handler?↵Something like using while loop? |
07:34:49 | FromDiscord | <Ras> sent a code paste, see https://play.nim-lang.org/#ix=4uMA |
07:35:20 | FromDiscord | <Dudugz> (edit) "loop?" => "loop?↵↵Beef said that procs like callbacks are costly so I want to avoid creating an event emitter" |
07:35:33 | FromDiscord | <Yardanico> you could importc the nim variable that holds argv, but what's your usecase for this? |
07:36:41 | FromDiscord | <Ras> (this changes `/proc/[pid]/cmdline` - `/proc/[pid]/comm` can be written to directly, but they're represented differently in `ps` output) |
07:36:41 | FromDiscord | <RandomVisitor> sometimes people overwrite argv so that tools like ps will report stuff like postfix [master] etc instead of just postfix |
07:36:59 | FromDiscord | <Yardanico> oh |
07:37:08 | FromDiscord | <RandomVisitor> but these days you're better off modifying the /proc filesystem instead of argv directly |
07:37:54 | FromDiscord | <Yardanico> you can importc and modify `cmdLine` |
07:38:49 | FromDiscord | <Ras> In reply to @Yardanico "you could importc the": I'm writing "malware" for an inject in a cyber exercise we're conducting. This would test blue teams' abilities to identify when processes run with non-default names (and whether they identify this behaviour in the forensics/RE part of the cyber exercise) |
07:39:21 | FromDiscord | <Yardanico> well maybe use RandomVisitor's suggestion since it will probably look cleaner, but you can importc cmdLine too |
07:39:57 | FromDiscord | <Ras> cool, I'll try them both out and see how the disassembly looks and probably decide on that |
07:39:59 | FromDiscord | <Ras> thank you! |
07:40:00 | FromDiscord | <Yardanico> it's originally defined at <https://github.com/nim-lang/Nim/blob/devel/compiler/cgen.nim#L1468> and assigned in <https://github.com/nim-lang/Nim/blob/devel/compiler/cgen.nim#L1522> |
07:40:26 | FromDiscord | <cmc> sent a code paste, see https://play.nim-lang.org/#ix=4uMD |
07:40:31 | FromDiscord | <Yardanico> In reply to @Ras "cool, I'll try them": also if you want somewhat cleaner disassembly you'd want to use --gc:arc (or orc if you're using async or ref types with cycles) instead of refc |
07:40:35 | FromDiscord | <Yardanico> orc will become the default in 2.0 anyway |
07:40:45 | FromDiscord | <Yardanico> cleaner as in more straightforward |
07:40:49 | FromDiscord | <Ras> yep, already using orc because of exactly that |
07:40:56 | FromDiscord | <Ras> but thanks for the tip |
07:41:26 | FromDiscord | <Yardanico> and then also things like -d:useMalloc if you don't want Nim to use its own allocator (but allocation-heavy code can be much slower if you're not using something like mimalloc) |
07:41:36 | FromDiscord | <Yardanico> and things like --panics:on that turn defects into unrecoverable errors |
07:41:58 | FromDiscord | <Rika> In reply to @cmc "I'm writing a macro": Not exactly? Because the values aren’t necessarily determinable on run time |
07:42:00 | FromDiscord | <Ras> super, thanks |
07:42:04 | FromDiscord | <Rika> I mean compile time |
07:44:23 | FromDiscord | <Chronos [She/Her]> In reply to @Yardanico "also fyi nim 2.0": Oh interesting |
07:44:42 | FromDiscord | <Yardanico> you can read the changelog for all changes |
07:44:45 | FromDiscord | <Yardanico> or just use devel :) |
07:45:02 | FromDiscord | <cmc> Well let's see- I don't need the values, just the type for each value. Oh maybe I got it- `getTypeImpl`↵(@Rika) |
07:46:47 | FromDiscord | <Ras> sent a long message, see http://ix.io/4uME |
07:47:45 | FromDiscord | <cmc> Yeah that does it for the type info, but I also need the field names if it's named... |
07:50:04 | FromDiscord | <Chronos [She/Her]> In reply to @Yardanico "and then also things": Wasn't there a proposal to make mimalloc the default allocator? |
07:52:17 | FromDiscord | <Yardanico> In reply to @Hourglass, When the Hour Strikes "Wasn't there a proposal": it was scrapped after araq improved the nim's own allocator, you can just check the PRs, it's all public |
07:52:32 | FromDiscord | <Yardanico> <https://github.com/nim-lang/Nim/pull/20359> |
07:52:53 | FromDiscord | <Yardanico> <https://github.com/nim-lang/Nim/pull/20492> |
07:58:51 | FromDiscord | <Chronos [She/Her]> Ah alright |
08:05:13 | FromDiscord | <Dudugz> what the `|` op is used for? |
08:05:19 | FromDiscord | <Dudugz> i mean docs aren't very clear about it |
08:05:34 | FromDiscord | <Dudugz> https://media.discordapp.net/attachments/371759389889003532/1103230855092109392/image.png |
08:06:09 | FromDiscord | <Ras> if you click the `source` button, you can see what the code does :) best source of documentation |
08:06:10 | FromDiscord | <Yardanico> same as or |
08:06:17 | FromDiscord | <Yardanico> for types |
08:06:25 | FromDiscord | <Yardanico> `type MyType = int | float` |
08:06:33 | FromDiscord | <Yardanico> `type MyType = int or float` |
08:06:38 | FromDiscord | <Yardanico> for use in generic stuff |
08:06:53 | FromDiscord | <Dudugz> sure |
08:07:09 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#generics-type-classes |
08:07:11 | FromDiscord | <Yardanico> "Type classes can be combined using the standard boolean operators to form more complex type classes:" |
08:07:15 | FromDiscord | <Dudugz> so writing my own impl will not overload it right? i mean i'm not dealing with typedescs |
08:07:26 | FromDiscord | <Yardanico> why does it matter if it'll overload it or not? |
08:07:39 | FromDiscord | <Yardanico> you won't care if there's another proc with same name defined if it has different types from your own |
08:07:43 | FromDiscord | <Dudugz> i'll use it to join flags like C does |
08:07:48 | FromDiscord | <Yardanico> since the compiler will always do disambiguation |
08:07:52 | FromDiscord | <Yardanico> In reply to @Dudugz "i'll use it to": why not sets :(( |
08:08:02 | FromDiscord | <Dudugz> i'm using enums :v |
08:08:04 | FromDiscord | <Yardanico> even if you have to interface with C's bit fields, you can use Nim sets |
08:08:07 | FromDiscord | <Yardanico> yes, enums go along with sets |
08:08:19 | FromDiscord | <Yardanico> `type MyFlags = set[MyEnum]` |
08:08:29 | FromDiscord | <Yardanico> let flagOpts = {MyEnum.Flag1, MyEnum.Flag2} |
08:08:43 | FromDiscord | <Dudugz> hm |
08:08:50 | FromDiscord | <Yardanico> and if you need interop with C you can sue https://nim-lang.org/docs/manual.html#set-type-bit-fields |
08:08:53 | FromDiscord | <Yardanico> (edit) "sue" => "use" |
08:08:53 | FromDiscord | <Dudugz> can a set be converted to uint32? |
08:09:08 | FromDiscord | <Yardanico> if you want the power of 2 style bit field |
08:09:12 | FromDiscord | <Dudugz> e.g: MyEnum.Flag1 | MyEnum.Flag2 = 129 |
08:09:19 | FromDiscord | <Yardanico> yes, see my link |
08:09:30 | FromDiscord | <Dudugz> no i mean the enum hold values that you sum and pass to the c api |
08:09:37 | FromDiscord | <Yardanico> yes, this is what the link does exactly |
08:09:41 | FromDiscord | <Yardanico> you can just convert from the set to a number and back |
08:09:53 | FromDiscord | <Yardanico> and you can have the nice set syntax instead of having to OR enum values |
08:10:34 | FromDiscord | <Dudugz> sure i'll try using sets, it seems better :v |
08:12:41 | FromDiscord | <Dudugz> lol |
08:12:48 | FromDiscord | <Dudugz> ``set is too large`` |
08:12:50 | FromDiscord | <Dudugz> pretty cool |
08:12:54 | FromDiscord | <Dudugz> 😄 |
08:13:08 | FromDiscord | <Yardanico> how many enum values do you have? |
08:13:13 | FromDiscord | <Yardanico> 100 thousand? |
08:13:38 | FromDiscord | <Dudugz> 12 |
08:13:40 | FromDiscord | <Yardanico> also maybe the docs didn't say it, but if you're using this syntax you don't have to explicitly type out enum values |
08:13:45 | FromDiscord | <Yardanico> because they'll automatically be powers of two |
08:13:56 | FromDiscord | <Dudugz> oh, then that's a issue |
08:14:03 | FromDiscord | <Yardanico> like the example just shows A, B, C, D and then A + C is 5 |
08:14:10 | FromDiscord | <Dudugz> i'm using a c api that doesn't use powers of two |
08:14:23 | FromDiscord | <Dudugz> it's like "f u, i'm using random numbers for my flags" |
08:14:32 | FromDiscord | <Yardanico> are the docs available online? |
08:14:39 | FromDiscord | <Dudugz> i'm just mapping these flags to be more dev-friendly |
08:15:39 | NimEventer | New Nimble package! grammarian - Wrapper around PEG library, enhancing PEG reusability., see https://github.com/olmeca/grammarian |
08:16:01 | FromDiscord | <Dudugz> i mean it goes til 8192 and then to a huge number |
08:16:27 | FromDiscord | <Dudugz> the last two flags are 268435456 and 536870912 |
08:16:33 | FromDiscord | <Yardanico> oh |
08:16:47 | FromDiscord | <Dudugz> removing them fix set :V |
08:17:43 | FromDiscord | <Dudugz> In this case, I think the best option will be to put them as separate options that can be activated with true or false |
08:17:48 | FromDiscord | <Ras> those are 2^28 and 2^29 |
08:18:07 | FromDiscord | <Dudugz> In reply to @Ras "those are 2^28 and": >.> but it complains because it doesn't follow the order |
08:18:31 | FromDiscord | <Ras> hrm |
08:18:32 | FromDiscord | <Dudugz> after 8192 comes 16384 |
08:19:46 | FromDiscord | <Rika> I just got here, is this a enum set |
08:19:52 | FromDiscord | <Yardanico> In reply to @Rika "I just got here,": 536870912 |
08:19:57 | FromDiscord | <Dudugz> yup :v |
08:20:13 | FromDiscord | <Rika> In that case set the values of the enums that should 2^28 and 2^29 to 28 and 29 |
08:20:26 | FromDiscord | <Dudugz> it starts normally between 0 to 8192 and then the rest of the options are "random" numbers 😁 |
08:20:28 | FromDiscord | <Yardanico> oh right |
08:20:31 | FromDiscord | <Ras> yeah |
08:20:34 | FromDiscord | <Yardanico> smart rika |
08:20:34 | FromDiscord | <Ras> set the 28th bit |
08:20:42 | FromDiscord | <Ras> aka set the value to 268435456 |
08:20:52 | FromDiscord | <Dudugz> In reply to @Rika "In that case set": makes sense |
08:21:06 | FromDiscord | <Marcus> image.png https://media.discordapp.net/attachments/371759389889003532/1103234764657405972/image.png |
08:21:26 | FromDiscord | <Marcus> My PR for nimlangserver support in nvim-lspconfig got merged yesterday. Seems to work well 🙂 |
08:21:36 | FromDiscord | <Rika> In reply to @Yardanico "smart rika": :smug: |
08:21:54 | FromDiscord | <Ras> In reply to @Marcus "My PR for nimlangserver": 🎉 |
08:27:20 | FromDiscord | <Dudugz> In reply to @Ras "set the 28th bit": it worked great, thanks everyone for the help 😁 |
08:33:46 | FromDiscord | <oxnan> say I have to look through many small/one big file for a bunch of smaller substrings, and I wanna do this as fast as possible. would it be faster for me to somehow parallelise running ripgrep for searching or is there some better alternative that I am not thinking about? (I am using nim for this as the stuff I am searching for is generated in obscure ways, and I am trying to get better at nim 🙂 ) |
08:56:29 | FromDiscord | <Dudugz> I don't even know why I try to be organized in Nim ;-; it's easier to put all the code in the same file and avoid problems because you can't import cyclic. |
08:56:43 | FromDiscord | <Dudugz> (edit) "import cyclic." => "cyclic import." |
08:59:36 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4uMQ |
09:01:03 | FromDiscord | <Dudugz> I forgot how to do it in a way where one type doesn't depend on the other. Like, doStuff needs Foo to handle some things the same way Foo needs to extend Node because they share too many similarities to be separate things. |
09:01:21 | FromDiscord | <Yardanico> usually people just have a separate file to define all types that should be shared, yeah |
09:01:53 | FromDiscord | <Dudugz> But what if foo.nim needs override draw? Wouldn't I need to import node.nim? |
09:02:10 | FromDiscord | <Dudugz> If I don't need to import then I can create a types.nim |
09:02:24 | FromDiscord | <Dudugz> (edit) "draw?" => "doStuff?" |
09:02:32 | FromDiscord | <Yardanico> In reply to @Dudugz "But what if foo.nim": hm? |
09:02:34 | FromDiscord | <Yardanico> override in what way? |
09:02:46 | FromDiscord | <Dudugz> Ops i forgot to put base pragma |
09:03:33 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4uMS |
09:03:52 | FromDiscord | <Dudugz> I mean, it would be redundant but there would be other methods that don't take foo as a second parameter |
09:05:05 | FromDiscord | <Dudugz> I actually think that since it's dawn my brain cells died, I'm sure I'm forgetting something. Best left to mess with it after sleep. |
09:05:16 | FromDiscord | <Elegantbeef> Those are two different signatures |
09:05:16 | FromDiscord | <Elegantbeef> But that's multi methods |
09:05:22 | FromDiscord | <Elegantbeef> And we do not venture down multi methods |
09:06:24 | FromDiscord | <Dudugz> Would that be bad? For type extension to have the method do something according to the extension? |
09:07:05 | FromDiscord | <Dudugz> I mean, with this I could have a list of objects and just call object.doStuff and then each different object type would handle its type appropriately. |
09:07:22 | FromDiscord | <Elegantbeef> The issue is `Foo, Foo` and `Foo, Bar` are two different procedures/methods and need multi methods to dispatch |
09:08:03 | FromDiscord | <Dudugz> ... but it's the same type |
09:08:58 | FromDiscord | <Dudugz> Well I'm sure there's a better design for this I'm just sick of the time, I'm going to sleep. |
09:09:02 | FromDiscord | <Elegantbeef> I might be misremembering but I'm fairly certain that dispatch only happens on the first parameter and it's technically incorrect to downcast a parameter |
09:09:34 | FromDiscord | <Elegantbeef> Cause `Foo, Foo` being the method means that calling `Bar, Foo` is valid but if you write `Bar, Bar` it'll error |
09:09:42 | FromDiscord | <Elegantbeef> Or atleast it should error |
09:10:21 | FromDiscord | <Dudugz> Hm, I hadn't thought of that, anyway I'm going to let my 2 neurons rest, cya |
09:14:21 | FromDiscord | <Elegantbeef> Yea without multimethods i'm right |
09:14:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uMU |
09:34:23 | * | beholders_eye quit (Ping timeout: 246 seconds) |
09:37:09 | * | demetera joined #nim |
09:37:50 | * | demetera quit (Remote host closed the connection) |
09:38:01 | FromDiscord | <oxnan> Anyone have a short example of how to use threadpool spawn to run a proc and get the result from it? 🙂 |
09:45:20 | * | demetera joined #nim |
09:54:55 | advesperacit | oxnan have you tried something like this? https://forum.nim-lang.org/t/494#3286 |
10:15:13 | FromDiscord | <Ras> sent a code paste, see https://play.nim-lang.org/#ix=4uN5 |
10:16:07 | NimEventer | New thread by zevv: Usability of ARC/ORC in multi threaded code., see https://forum.nim-lang.org/t/10161 |
10:18:48 | FromDiscord | <Ras> In reply to @Ras "so I've been trying": that is - if i `echo cmdLine[0]` after changing it, it has _seemingly_ changed, but `/proc/[pid]/cmdline` seems to be the same as if i'm not actually modifying `argv` |
10:23:55 | FromDiscord | <Ras> sent a code paste, see https://play.nim-lang.org/#ix=4uN7 |
10:41:18 | * | kenran quit (Remote host closed the connection) |
11:23:29 | FromDiscord | <oxnan> In reply to @advesperacit "oxnan have you tried": thanks! managed to get it to work 🙂 |
11:26:46 | * | beholders_eye joined #nim |
11:27:21 | FromDiscord | <Ras> In reply to @Ras "maybe as a workaround,": hrm, setting characters works. `cmdLine[0][0] = 'a'` changes `cmdline`. This makes it seem like there's a copy made somewhere of the `cmdLine` array itself which i seem to be modifying. I suppose I can just do a `copymem`, but that seems... kind of not like how I'm supposed to solve this |
11:29:18 | FromDiscord | <Ras> and i can only copymem up to the length of cmdline[0], which is less than ideal |
11:35:55 | NimEventer | New Nimble package! checksums - Hash algorithms in Nim., see https://github.com/nim-lang/checksums |
11:45:04 | * | beholders_eye quit (Ping timeout: 248 seconds) |
11:46:51 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
11:48:10 | * | ehmry joined #nim |
12:11:58 | FromDiscord | <RandomVisitor> "Hash algorithms in Nim. The documentation is at https://nim-lang.github.io/checksums/theindex.html." ↵↵I don't know why, but I'm bothered that it's not index.html |
12:29:42 | * | beholders_eye joined #nim |
12:45:52 | * | jmdaemon quit (Ping timeout: 248 seconds) |
13:04:46 | * | Notxor quit (Remote host closed the connection) |
13:23:28 | * | Notxor joined #nim |
13:26:25 | FromDiscord | <sOkam!> In reply to @Marcus "My PR for nimlangserver": ❤️ ❤️ ❤️ ❤️ ❤️ |
13:33:08 | FromDiscord | <Bung> `($(req.headers[i].name))[0 .. req.headers[i].namelen]` can I directly convert `ptr char` to `string` now it implicitly convert to `cstring` |
13:56:38 | FromDiscord | <Chronos [She/Her]> In reply to @Bung "`($(req.headers[i].name))[0 .. req.headers[i].namel": To convert Nim strings to C strings explicitly, there's `cstring`, so you use it like `"text".cstring`, does that help? |
13:58:35 | FromDiscord | <Bung> nah, I was asking for `ptr char` to `string` |
14:01:44 | FromDiscord | <Chronos [She/Her]> Oh ptr char to string? |
14:01:57 | FromDiscord | <Chronos [She/Her]> Can't you do `$` on it? |
14:02:00 | FromDiscord | <Chronos [She/Her]> Oh wait pointer |
14:02:20 | FromDiscord | <Chronos [She/Her]> `$(yourPtr[])`? |
14:02:24 | FromDiscord | <Chronos [She/Her]> Maybe? |
14:03:03 | FromDiscord | <Bung> hmm , the routine is ptr char -> cstring -> string -> slice |
14:03:32 | FromDiscord | <Bung> you see, what I want is ptr char -> string -> slice |
14:11:28 | * | PMunch quit (Quit: Leaving) |
14:24:37 | * | Notxor quit (Remote host closed the connection) |
14:32:43 | FromDiscord | <RaycatWhoDat> sent a code paste, see https://play.nim-lang.org/#ix=4uO2 |
14:33:09 | FromDiscord | <RaycatWhoDat> (edit) "https://play.nim-lang.org/#ix=4uO2" => "https://paste.rs/yfF" |
14:33:24 | FromDiscord | <RaycatWhoDat> I know it will be a combination of `importC`, `header` and something else but I'm new to Nim |
14:33:56 | NimEventer | New question by Bor: Nim Lang - Finding char index, see https://stackoverflow.com/questions/76165049/nim-lang-finding-char-index |
14:36:49 | FromDiscord | <sOkam!> In reply to @RaycatWhoDat "Quick question: If I": strings are not null terminated, but you can interop by just converting to cstring↵you can use the `emit` pragma for things that nim doesn't know how to do. but for most things i would stick to nim and let the compiler do its thing. there is always ways to make it do what you want, without relying on a specific/literal pure c representation |
14:37:12 | FromDiscord | <RaycatWhoDat> wha |
14:37:34 | FromDiscord | <sOkam!> types are actually types in Nim, not recommendations. so you can actually rely on the compiler to be explicit about them |
14:37:50 | FromDiscord | <sOkam!> and there are typed pointers, which are much safer than c pointers |
14:38:14 | FromDiscord | <RaycatWhoDat> Oh, that actually was directed at me, gotcha |
14:38:25 | FromDiscord | <RaycatWhoDat> I read the first line and thought you meant to ping the other person |
14:38:51 | FromDiscord | <sOkam!> oh no, i was trying to give some tip on things i noticed when coming from c |
14:39:31 | FromDiscord | <sOkam!> overall, you can very much rely on standard nim features to do the work for you. no need to be c-like at all (except on the step right before interoperating with c code) |
14:40:24 | FromDiscord | <RaycatWhoDat> Oh, nice. So, for making a file with that preamble, Nim has ways to make that happen IN Nim? |
14:40:31 | FromDiscord | <RaycatWhoDat> That's pretty sweet |
14:41:04 | FromDiscord | <RaycatWhoDat> I definitely thought I would be using the escape hatch a lot |
14:41:27 | FromDiscord | <sOkam!> i don't know what that macro does, but you can use a `template` and it would basically do the same. although templates are not the best way to achieve macro-like behavior in general, since the compiler can do that for you↵but if you -require- it... you can either inline or template the process |
14:42:02 | FromDiscord | <RaycatWhoDat> Got it |
14:42:12 | FromDiscord | <RaycatWhoDat> Thanks for the info |
14:42:23 | FromDiscord | <sOkam!> no worries |
14:47:57 | FromDiscord | <sOkam!> sent a long message, see https://paste.rs/Drm |
15:14:09 | * | Notxor joined #nim |
15:21:31 | FromDiscord | <IanB> Just saying hi (Perl dev, discovered Nim and reading Nim in Action), interesting language |
15:34:24 | * | Notxor quit (Remote host closed the connection) |
15:43:24 | FromDiscord | <pysan> sent a code paste, see https://play.nim-lang.org/#ix=4uOv |
16:07:59 | * | Notxor joined #nim |
16:26:46 | * | xaltsc joined #nim |
16:28:40 | * | beholders_eye quit (Remote host closed the connection) |
16:34:25 | * | arkurious joined #nim |
16:45:47 | * | arkurious quit (Quit: Leaving) |
17:05:24 | * | cnx quit (*.net *.split) |
17:05:24 | * | Lord_Nightmare quit (*.net *.split) |
17:05:51 | * | cnx_ joined #nim |
17:06:03 | * | cnx_ is now known as cnx |
17:06:30 | * | Lord_Nightmare joined #nim |
17:17:04 | FromDiscord | <Marcus> Hi from another Perler ;-)↵(@IanB) |
17:18:42 | FromDiscord | <Marcus> Well. Not so much in recent years. Reviewing a few mojo prs now and then. |
17:21:28 | * | rockcavera joined #nim |
17:24:33 | * | DaVinciGH joined #nim |
17:32:07 | * | Notxor quit (Remote host closed the connection) |
17:36:35 | * | DaVinciGH quit (Quit: Leaving) |
17:37:10 | * | lucasta joined #nim |
18:04:46 | * | beholders_eye joined #nim |
18:26:42 | * | xet7 joined #nim |
18:31:33 | FromDiscord | <IanB> When I understand a bit more, I may have a dabble see if mixing nim with Perl (either via Inline::C/C++ or FFI) out of interest, suspect the former will be a bit tricky tho |
18:45:19 | * | Notxor joined #nim |
19:00:06 | FromDiscord | <RaycatWhoDat> In reply to @IanB "When I understand a": VERY curious about that effort. Raku ex-pat here. |
19:06:09 | FromDiscord | <Marcus> Not XS? 🙂 nim compiles to C, so should be fairly easy I suspect.↵(@IanB) |
19:06:54 | FromDiscord | <Elegantbeef> Make a dynamic library then load it inside perl |
19:07:07 | FromDiscord | <Elegantbeef> I assume perl supports dynamic libraries |
19:07:27 | FromDiscord | <Marcus> https://perldoc.perl.org/perlxs yea |
19:38:55 | FromDiscord | <guttural666> How would I read a specific line of a file given a line index? (without actually looping over all the lines with the readLine proc= |
19:39:02 | FromDiscord | <guttural666> (edit) "proc=" => "proc)" |
19:40:29 | FromDiscord | <Elegantbeef> There is no API for "got to specific line" |
19:41:09 | FromDiscord | <ElegantBeef> In reply to @Elegantbeef "[BracketMaster (Yehowshua Immanuel)](https://matrix": Would probably be quicker than the stdlib readline |
19:41:30 | FromDiscord | <Elegantbeef> Whether it's bug free is beside the point 😛 |
19:42:29 | FromDiscord | <guttural666> In reply to @Elegantbeef "There is no API": should probably read my understanding the linux kernel to understand the technical details of files ^^ |
19:42:52 | FromDiscord | <Elegantbeef> I mean a file is a binary stream of data, there is no concept of lines |
19:43:08 | FromDiscord | <Elegantbeef> We only attribute `\n` as a new line |
19:45:13 | FromDiscord | <guttural666> yeah, makes sense |
19:45:39 | FromDiscord | <guttural666> may be possible to store offsets into files? |
19:45:55 | FromDiscord | <guttural666> start_bin + pointer_to_my_stuff? |
19:46:08 | FromDiscord | <guttural666> (edit) "pointer_to_my_stuff?" => "bytes?" |
19:46:56 | FromDiscord | <Elegantbeef> Huh? |
19:48:32 | FromDiscord | <guttural666> uhm, if I know the file, I could just provide an offset in terms of bytes into that file |
19:48:36 | FromDiscord | <guttural666> and then read from there? |
19:48:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4uPn |
19:48:43 | FromDiscord | <Elegantbeef> Yesyou can do `setPos` or w/e it is |
19:49:12 | FromDiscord | <Chronos [She/Her]> In reply to @ElegantBeef "Would probably be quicker": Why don't you PR that to the stdlib lol |
19:49:33 | FromDiscord | <Elegantbeef> Cause I read the stdlib lines and have no clue what the hell it's doing |
19:50:09 | FromDiscord | <guttural666> In reply to @Elegantbeef "Yesyou can do `setPos`": probably this bad boy? https://media.discordapp.net/attachments/371759389889003532/1103408174956036167/image.png |
19:50:23 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/io.nim#L376-L496 |
19:50:32 | FromDiscord | <Elegantbeef> Look at that shit, it's crazy |
19:51:00 | FromDiscord | <guttural666> 😄 |
19:51:29 | FromDiscord | <Elegantbeef> That function is called inside a while loop of `lines` |
19:51:32 | FromDiscord | <Elegantbeef> No wonder it's so slow |
20:01:33 | * | TakinOver quit (Ping timeout: 250 seconds) |
20:06:24 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Cause I read the": Ah lmao |
20:09:53 | FromDiscord | <jmgomez> Hey beef, do you happen to know if `procInstCache` is used only for generics or both? |
20:10:17 | FromDiscord | <Elegantbeef> given it's `inst` likely generics only |
20:10:20 | FromDiscord | <Elegantbeef> Normal procedures arent instantiated they're declared 😛 |
20:11:12 | FromDiscord | <jmgomez> Oh didnt know it stands for it. Thanks! Been hammering the whole day with the compiler.. So when a proc is added to the module graph? |
20:11:34 | * | TakinOver joined #nim |
20:12:39 | FromDiscord | <Elegantbeef> I assume `semProcAux` |
20:13:03 | FromDiscord | <jmgomez> Tried there but the pragmas doesnt seem to be set yet |
20:13:22 | FromDiscord | <Elegantbeef> Hey that's when it's added |
20:13:33 | FromDiscord | <Elegantbeef> It probably has a path that does pragma analysis |
20:13:56 | FromDiscord | <jmgomez> My attempt was to log it at the very last line |
20:14:12 | FromDiscord | <jmgomez> will keep looking |
20:14:24 | FromDiscord | <Elegantbeef> Well what calls `semProcAux` |
20:14:24 | FromDiscord | <Elegantbeef> Go up the stack |
20:15:01 | FromDiscord | <jmgomez> Can be called by semFunc/semPro/semMethod which is already too high |
20:15:51 | FromDiscord | <jmgomez> Will checkout the stacktrace of when a pragma is added and move from there |
20:17:52 | FromDiscord | <jmgomez> you were right, it's called from semProcAux I probably checked on the wrong symbol |
20:18:21 | FromDiscord | <jmgomez> I knew I could get something from asking you 😛 |
20:29:52 | FromDiscord | <Elegantbeef> Other than sass? |
20:34:52 | FromDiscord | <jmgomez> what's sass? |
20:35:44 | * | lucasta quit (Ping timeout: 248 seconds) |
20:36:15 | FromDiscord | <Elegantbeef> Other than a CSS superset, it's a disrespectful response 😄 |
20:38:17 | FromDiscord | <jmgomez> lol |
20:38:42 | FromDiscord | <jmgomez> you are fine, most of time on the right side of the line 😛 |
20:39:07 | FromDiscord | <Elegantbeef> You're just encouraging me to edge the line |
20:49:32 | FromDiscord | <Marcus> Finally |
20:53:37 | * | progranner joined #nim |
20:56:46 | NimEventer | New Nimble package! promexplorer - A simple tool to explore Prometheus exporter metrics, see https://github.com/marcusramberg/promexplorer |
20:57:48 | * | TakinOver quit (Ping timeout: 240 seconds) |
20:59:02 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
21:00:01 | FromDiscord | <jmgomez> any idea on how to resolve the module for a PType? |
21:02:43 | * | progranner joined #nim |
21:22:51 | * | Notxor quit (Remote host closed the connection) |
21:24:55 | * | advesperacit quit () |
21:25:08 | * | progranner quit (Ping timeout: 240 seconds) |
22:05:44 | * | azimut quit (Ping timeout: 240 seconds) |
22:09:53 | * | demetera quit (Remote host closed the connection) |
22:10:52 | * | demetera joined #nim |
22:13:51 | * | lucasta joined #nim |
22:57:48 | * | TakinOver joined #nim |
23:17:55 | FromDiscord | <Prestige> I'm trying to open a file for read/write, but simple opening and reading the data seems to be deleting the contents of the file. Is this normal? |
23:18:16 | FromDiscord | <Prestige> playground seems down again |
23:18:44 | FromDiscord | <Prestige> sent a code paste, see https://play.nim-lang.org/#ix=4uPM |
23:18:50 | FromDiscord | <Prestige> file is empty after I do this ^ |
23:23:03 | FromDiscord | <Elegantbeef> `fmReadWriteExisting` |
23:24:08 | FromDiscord | <Prestige> Well that's weird but ty |
23:25:43 | FromDiscord | <Elegantbeef> Yea it should probably be a `existing = false` or w/e |
23:25:58 | FromDiscord | <Elegantbeef> Or really `{Read, Write, Existing}` |
23:26:47 | FromDiscord | <voidwalker> How much faster are arrays vs seqs, and why ? I saw some variable length array implementation for nim, using maloc, but that allocates on the heap, right ? Wouldn't be as fast as normal arrays then, no ? I'm thinking about the optimal way to implement bit vectors, with a fixed but unknown at compile time array size |
23:27:34 | FromDiscord | <Elegantbeef> They're not |
23:28:00 | FromDiscord | <voidwalker> A solution would be to over allocate an array so that it fits your expected data in stack.. but that's not a good programming pattern |
23:28:17 | FromDiscord | <Elegantbeef> Arrays and sequences are just memory, there isnt any speed increases from using an array vs. seq minus allocations |
23:28:40 | FromDiscord | <voidwalker> I remember I read that arrays are faster at least a few times |
23:28:47 | FromDiscord | <voidwalker> because of compile optimisations |
23:36:15 | FromDiscord | <auxym> early optimization and the root of evil, etc. Point is, profile and see which (if any) is faster for your use case |
23:37:05 | FromDiscord | <Elegantbeef> `set[T]` is also generally sufficient aside from large range sets in that case use `intset` or `sets` |
23:51:22 | FromDiscord | <voidwalker> In reply to @auxym "early optimization and the": I was thinking in the context of maybe creating a new bit vector library, by stealing code from the existing ones 😛 |
23:51:42 | FromDiscord | <voidwalker> it's obviously that a specific purpose library has to be optimized. Context was bit arrays |
23:53:59 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/packedsets.html#PackedSet |
23:55:20 | FromDiscord | <voidwalker> oh but this is different.. this is for sets of integers. Bit vectors are arrays of boolean stores as bits instead of bytes |
23:55:30 | FromDiscord | <voidwalker> (edit) "stores" => "stored" |
23:55:41 | FromDiscord | <Elegantbeef> How many of these bools are you storing? |
23:55:57 | FromDiscord | <voidwalker> well, up to a few million I guess |
23:56:02 | FromDiscord | <voidwalker> 2-3 mil max |
23:56:59 | FromDiscord | <voidwalker> but usually in the 1000-20.000 range I guess |
23:57:14 | FromDiscord | <auxym> In reply to @voidwalker "I was thinking in": maybe start with bitty and see if you can optimize it? it already has benchmarks: https://github.com/treeform/bitty/blob/master/tests/bench.nim |
23:59:48 | FromDiscord | <voidwalker> I used this one so far: https://github.com/MarcAzar/BitVector |