00:30:22 | FromDiscord | <auxym> also important to note: if anything you're doing can be optimized as a "bitwise op" (for example shl instead of division by power of 2), then its highly probable that gcc O2 or O3 will do that optimization for you. |
00:40:59 | FromDiscord | <Generic> gcc will do that optimisation even with O1 |
00:41:04 | FromDiscord | <auxym> damn, even with O0, gcc is optmizing "divide by 13" to "multiply by 1321528399 and some shifts |
00:41:14 | FromDiscord | <auxym> https://godbolt.org/z/a5fcbKjcc |
00:41:42 | FromDiscord | <Generic> it's probably because those optimisations are guaranteed to be always better |
00:41:43 | FromDiscord | <Elegantbeef> Cmon why not using nim?! |
00:42:05 | FromDiscord | <Generic> in terms of speed and about equal or less in terms of code size |
00:42:55 | FromDiscord | <auxym> In reply to @Elegantbeef "Cmon why not using": because I get lost somewhere in the ~12 extra asm instructions that nim generates D: |
00:43:46 | FromDiscord | <Elegantbeef> It's not too bad https://godbolt.org/z/a5YxobWj9 |
00:44:08 | FromDiscord | <Generic> I know that complaining isn't very productive |
00:44:21 | FromDiscord | <Generic> but Nim on Godbolt isn't that useful |
00:44:23 | FromDiscord | <Elegantbeef> Wait it's not?! |
00:44:32 | FromDiscord | <Generic> you can't compare between compilers and architectures |
00:45:03 | FromDiscord | <Generic> it's only x64 gcc |
00:45:59 | FromDiscord | <Generic> (edit) "you can't compare between ... compilers" added "C" |
00:50:14 | FromDiscord | <exelotl> this |
00:50:30 | FromDiscord | <Elegantbeef> No dont use `this` |
00:53:06 | FromDiscord | <auxym> self? |
00:53:13 | FromDiscord | <Elegantbeef> Not that either |
00:53:33 | FromDiscord | <exelotl> that |
00:57:44 | FromDiscord | <Patitotective> beef prefers `myLongObjectName` |
01:02:56 | FromDiscord | <auxym> you should see the stuff I'm writing these days https://github.com/auxym/nim-tinyusb/blob/master/src/tinyusb/class/cdc.nim#L262 I hate it D: |
01:03:35 | FromDiscord | <Patitotective> im sure beef will love `proc foo(cdcAbstractControlMgmtDescriptor: CdcAbstractControlMgmtDescriptor)` |
01:04:29 | FromDiscord | <Elegantbeef> Oh this is porting the stuff the C used macros for? |
01:06:55 | FromDiscord | <auxym> yeah. it's way more of a PITA than I imagined. but it's almost done, only thing WIP is HID report descriptors |
01:07:06 | FromDiscord | <auxym> I was not planning on reading a whole bunch of USB specs |
01:07:11 | FromDiscord | <Patitotective> you're gonna live this beef, KDL allows empty type annotations↵meaning that `("")node 1 2 3` should be printed out as `("")node 1 2 3` |
01:07:16 | FromDiscord | <Patitotective> (edit) "live" => "love" |
01:08:03 | FromDiscord | <Elegantbeef> KDL is a joke |
01:08:40 | FromDiscord | <Patitotective> i might better hard-fork it and fix it :p |
01:09:00 | FromDiscord | <Elegantbeef> Then it's a purposeless file format |
01:09:16 | FromDiscord | <Patitotective> ? |
01:09:20 | FromDiscord | <Patitotective> (edit) "?" => "🤨" |
01:09:25 | FromDiscord | <auxym> haven't actually used it, but on the surface, I like how it looks compared to toml, yaml, etc |
01:09:58 | FromDiscord | <Elegantbeef> Sure but it's spec is quite odd |
01:10:01 | FromDiscord | <auxym> also json pisses me off with the no comments and no trailing comma thing |
01:10:10 | FromDiscord | <Patitotective> In reply to @auxym "haven't actually used it,": it also looked nice but specification is too vague, it doesnt seem mature |
01:10:23 | FromDiscord | <Elegantbeef> By forking the spec you now have a second variant that looks the same but behaves differently |
01:11:03 | FromDiscord | <Patitotective> POML: pats obvious minimal language |
01:11:27 | FromDiscord | <Patitotective> In reply to @Elegantbeef "By forking the spec": different extension |
01:12:15 | FromDiscord | <auxym> which parts are vague? out of curiosity. and how do the existing implementations resolve the ambiguous parts? |
01:12:27 | FromDiscord | <Elegantbeef> 😛 |
01:12:27 | FromDiscord | <Elegantbeef> What's an extension? |
01:16:07 | FromDiscord | <Patitotective> sent a long message, see http://ix.io/4aSl |
01:18:54 | FromDiscord | <Patitotective> KDL is a fork of SDL so another fork is not that bad :p |
01:20:08 | FromDiscord | <auxym> meh, personally I'd just follow whatever the most-used existing implementations are doing |
01:21:02 | FromDiscord | <Patitotective> you mean, just use json |
01:22:03 | FromDiscord | <auxym> json5 😉 |
01:22:03 | FromDiscord | <Patitotective> In reply to @Elegantbeef "😛": i dont get your inanities |
01:22:04 | FromDiscord | <Patitotective> :p |
01:27:07 | FromDiscord | <Patitotective> but they, the author agrees with me https://media.discordapp.net/attachments/371759389889003532/1021230923833946122/unknown.png |
01:27:31 | FromDiscord | <Patitotective> (edit) "they," => "hey," |
01:31:03 | FromDiscord | <Elegantbeef> You use linux pat extensions dont mean anything |
01:32:11 | FromDiscord | <Patitotective> extensions live in my heart |
01:33:43 | FromDiscord | <Elegantbeef> They're lies that make people sleep better at night |
01:34:26 | FromDiscord | <Patitotective> how can i get a nice icon in my file explorer without extensions? |
01:34:56 | FromDiscord | <Elegantbeef> Have a preview api and attempt to decode the file until it succeeds |
01:35:09 | FromDiscord | <Elegantbeef> Clearly the most efficient way of doing it |
01:35:45 | FromDiscord | <Patitotective> even better, train an AI to guess a file's extension from it's content |
01:37:53 | FromDiscord | <Elegantbeef> Extensions are a ploy by big windows to attempt to know what you want |
01:40:39 | * | attah joined #nim |
01:43:10 | FromDiscord | <Rika> I mean technically magic bytes are just extensions but in the file |
01:43:46 | FromDiscord | <auxym> both magic bytes and extensions are sort of a hack, to think of it |
01:43:59 | FromDiscord | <Rika> Well there isn’t a good solution |
01:44:24 | FromDiscord | <auxym> btw @retkid this might be of interest if you are into bit-twiddling https://graphics.stanford.edu/~seander/bithacks.html |
01:44:29 | FromDiscord | <Rika> Consider two programming languages with syntaxes that don’t differ that much, how would either be distinguished without either extensions or magic bytes? |
01:44:48 | FromDiscord | <Rika> Cough cough |
01:45:17 | FromDiscord | <Elegantbeef> If they're similar enough tools cannot distinguish them they're the same language! 😛↵(@Rika) |
01:45:21 | FromDiscord | <auxym> I agree, there's no clean solution. filesystem attrs would be another option but also has at least as many problems with it |
01:45:36 | FromDiscord | <Elegantbeef> The real solution is feed it to a compiler/runtime, if it succeeds it's that file type! |
01:45:41 | FromDiscord | <Rika> In reply to @auxym "I agree, there's no": Not portable haha |
01:45:47 | FromDiscord | <Patitotective> `print("Hello World")`↵what language is that? |
01:46:25 | FromDiscord | <Elegantbeef> The only way to know if a file is the type you want is by attempting it |
01:47:38 | FromDiscord | <Patitotective> you shouldnt go changing extensions through folders |
01:47:48 | FromDiscord | <Patitotective> everything just works lol |
01:48:23 | FromDiscord | <huantian> In reply to @Patitotective "`print("Hello World")` what language": I mean in that case the best way is just the shebang |
01:48:25 | FromDiscord | <huantian> or you just guess |
01:48:30 | FromDiscord | <huantian> or you don't guess anything |
01:49:11 | FromDiscord | <huantian> like if its not identifyable you just assume either plain text, or bytes |
01:49:33 | FromDiscord | <Elegantbeef> Yall would use regex to validate emails! |
01:50:03 | FromDiscord | <Patitotective> In reply to @Elegantbeef "Yall would use regex": `'@' in email` |
01:50:17 | FromDiscord | <Rika> In reply to @Elegantbeef "Yall would use regex": You would try eating a book because you didn’t know it was a book |
01:50:48 | * | wallabra quit (Ping timeout: 264 seconds) |
01:50:51 | FromDiscord | <Patitotective> hahah |
01:53:42 | FromDiscord | <Elegantbeef> Hey if papers good enough for the beaver why not me↵(@Rika) |
01:55:58 | FromDiscord | <Patitotective> is it bad using `type None = object`? |
01:56:11 | * | attah quit (Ping timeout: 260 seconds) |
01:56:56 | FromDiscord | <auxym> `void`? |
01:57:10 | FromDiscord | <Patitotective> always forget |
01:57:50 | FromDiscord | <auxym> you can also use `distinct void` |
01:57:57 | FromDiscord | <auxym> stole that from beef |
01:58:30 | FromDiscord | <Patitotective> why would i want a distinct void 🤔 |
01:58:44 | FromDiscord | <auxym> type system black magic fuckery |
02:00:00 | FromDiscord | <auxym> your proposed empty object would behave like a `distinct void` though. ie `type None1 = object` and `type None2 = object` are not the same type (nominal typing) |
02:00:40 | FromDiscord | <auxym> or maybe you want them to be the same 🤷♂️ |
02:00:52 | FromDiscord | <Elegantbeef> Plus you dont have people thinking they're smart passing `void` instead of `None` 😄 |
02:01:11 | FromDiscord | <Elegantbeef> YMMV |
02:01:11 | FromDiscord | <Elegantbeef> Type aliases are nice but i think people generally misunderstand their reason for existing |
02:01:49 | FromDiscord | <Elegantbeef> Tuples are one place i feel people really misunderstand type aliases |
02:03:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aSq |
02:03:43 | FromDiscord | <Elegantbeef> But not all `(string, int)` are actually `Person` |
02:03:58 | FromDiscord | <Elegantbeef> Since they're structurally typed that's something people seem to mis |
02:05:22 | FromDiscord | <Rika> Doesn’t it match field names too? Just not type name |
02:05:39 | FromDiscord | <Elegantbeef> Nope tuples just match types |
02:05:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aSs |
02:06:14 | FromDiscord | <Rika> If they’re anonymous yes |
02:06:27 | FromDiscord | <Rika> If the tuple passed has names then doesn’t it check those too |
02:07:04 | FromDiscord | <Bung> it may resolve generic problem, void type arguments are striped out when generate proc |
02:07:20 | FromDiscord | <Elegantbeef> seems you're right rika |
02:07:27 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1021241075635060756/image.png |
02:10:05 | FromDiscord | <Elegantbeef> I honestly only use tuples for return types so didnt realise this semantic existed |
02:10:20 | FromDiscord | <Patitotective> it would be cool if inim allowed multi-line statements |
02:11:02 | FromDiscord | <Elegantbeef> PRs welcome 😛 |
02:11:08 | FromDiscord | <Elegantbeef> And it does support multiine statements.... on flow control |
02:11:41 | FromDiscord | <Elegantbeef> For instance |
02:11:44 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1021242144394072144/image.png |
02:11:48 | FromDiscord | <Patitotective> oh, really cool, didnt know |
02:12:48 | FromDiscord | <Elegantbeef> Hmmph needs syntax highlighting |
02:12:49 | FromDiscord | <Elegantbeef> Patito you got that? 😛 |
02:14:06 | FromDiscord | <Patitotective> you mean the text editor i was doing in imgui? |
02:14:15 | FromDiscord | <Elegantbeef> No i mean in inim |
02:15:40 | FromDiscord | <Patitotective> can macros be generic 👀 |
02:15:55 | FromDiscord | <slymilano> I actually used Nim tuples for the first time tonight - I'm so used to Elixir's `{:ok, foobar} | {:error, foobar}` pattern, this felt nice https://media.discordapp.net/attachments/371759389889003532/1021243209290096640/unknown.png |
02:15:59 | FromDiscord | <Elegantbeef> Yes but only limited |
02:16:08 | FromDiscord | <Patitotective> how limited |
02:16:25 | FromDiscord | <Elegantbeef> Jusut use an option sly 😄 |
02:16:29 | FromDiscord | <Patitotective> In reply to @slymilano "I actually used Nim": rusts result |
02:16:44 | FromDiscord | <Elegantbeef> What do you need pat |
02:16:50 | FromDiscord | <Elegantbeef> Instead of making me guess ask the actual question |
02:17:39 | FromDiscord | <Elegantbeef> Actually never mind you're uusing results |
02:17:43 | FromDiscord | <Elegantbeef> There is the results package if you want that |
02:17:47 | FromDiscord | <Elegantbeef> Personally though i find exceptions just better |
02:18:12 | FromDiscord | <huantian> I did some rust and I think I did results wrong |
02:18:19 | FromDiscord | <huantian> because I just used them like exceptions |
02:18:35 | FromDiscord | <Elegantbeef> I mean that's what they are afaict |
02:18:51 | FromDiscord | <Elegantbeef> They move the flow control from a stack unwind to the user explicitly unpacking them |
02:20:08 | FromDiscord | <Elegantbeef> Instead of putting `parseInt` inside a try except you attempt to parse and return an result which you must check to get the value |
02:20:17 | FromDiscord | <Elegantbeef> There's a reason they're an alternative to exceptions |
02:20:23 | FromDiscord | <Elegantbeef> Cause they quite literally are just more explicit and manual exceptions |
02:20:39 | FromDiscord | <Elegantbeef> If you want to do what most do in Nim without `raises` you just use `?` to unpack and possibly panic |
02:21:39 | FromDiscord | <Elegantbeef> In the case of parseint i'd probably argue for options over exceptions, but i generally prefer exceptions over results |
02:24:15 | FromDiscord | <Rika> Most people don’t even care about the result thing and just do ? |
02:24:25 | FromDiscord | <Rika> Which makes me think “the fuck was the point of that then” |
02:24:29 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4aSt |
02:24:35 | FromDiscord | <Patitotective> so was thinking about generics but dont actually need them |
02:24:40 | FromDiscord | <Elegantbeef> And why does the macro need generic |
02:24:44 | FromDiscord | <Patitotective> `typed` would work right? |
02:24:51 | FromDiscord | <Elegantbeef> Ah yea there you go |
02:25:02 | FromDiscord | <Elegantbeef> `typedesc` |
02:25:18 | FromDiscord | <Elegantbeef> also cmon do `parsing: bool` like a normal person |
02:25:35 | FromDiscord | <Patitotective> forgot i could do that :p |
02:25:59 | FromDiscord | <Elegantbeef> Yea rika quite a few people dislike the fact `?` exists |
02:26:00 | * | attah joined #nim |
02:26:31 | FromDiscord | <Elegantbeef> You now have code that can panic and it's just worse |
02:26:48 | FromDiscord | <Elegantbeef> Nim's exception tracking + raises is ideal |
02:28:41 | FromDiscord | <Patitotective> not going `/home/cristobal/minidev/kdl-nim/src/kdl/parser.nim(90, 1) Error: illformed AST: Match[Token]`↵https://github.com/Patitotective/kdl-nim/blob/main/src/kdl/parser.nim#L19 |
02:29:24 | * | wallabra joined #nim |
02:31:35 | FromDiscord | <Elegantbeef> https://github.com/rust-lang/rfcs/pull/2388 ah rust is funny sometimes |
02:31:46 | FromDiscord | <Elegantbeef> `echo result.treeRepr`↵`echo result.repr` |
02:32:08 | FromDiscord | <Patitotective> fine |
02:32:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aSu |
02:32:51 | FromDiscord | <huantian> doesnt' rust also have the yeet expresion or something |
02:33:02 | FromDiscord | <huantian> https://github.com/rust-lang/lang-team/issues/160 |
02:33:03 | FromDiscord | <huantian> yeah |
02:33:07 | * | Just-Jasmine joined #nim |
02:33:13 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4aSv |
02:33:17 | FromDiscord | <huantian> I have no idea what rust is doing |
02:34:55 | FromDiscord | <Elegantbeef> Yeet is a joke PR |
02:35:29 | FromDiscord | <Just Jasmine, Please> Do they really have a thing in their language called yeet?? |
02:35:40 | FromDiscord | <Elegantbeef> Patito you say fine like you wanted me to work on the problem |
02:36:10 | * | Just-Jasmine quit (Client Quit) |
02:36:30 | wallabra | JS also has +[]() and other weird things you can do with it, but doesn't matter because most programmers won't |
02:36:32 | wallabra | Same with Rust's yeet |
02:36:38 | wallabra | Don't judge a language by such things that never happen in real life lol |
02:37:05 | wallabra | It's like judging a wardrobe because it has a nail that's jutting out a bit, when it's the backside that should be against a wall to begin with |
02:37:06 | FromDiscord | <Patitotective> In reply to @Elegantbeef "Patito you say fine": hehe i already solved it↵i say fine like i was admitting my bad |
02:37:09 | FromDiscord | <Elegantbeef> It's mostly a joke but it's reserved |
02:37:26 | FromDiscord | <Elegantbeef> Uh oh we said rust too many times |
02:37:36 | FromDiscord | <Patitotective> v |
02:37:49 | FromDiscord | <Elegantbeef> Nah we cannot say V enough to summon the 2 Vv users |
02:38:11 | FromDiscord | <Patitotective> haha |
03:03:51 | FromDiscord | <Patitotective> is `compiles(a)` the best way to know if a symbol is defined? |
03:04:00 | FromDiscord | <Elegantbeef> `declared` exists |
03:11:11 | FromDiscord | <huantian> Hey beef was considering if you could do polymorphic (de)serialization for json with some macros |
03:11:25 | FromDiscord | <huantian> Like you have a pragma on the base type and one on each child? |
03:12:56 | FromDiscord | <Elegantbeef> You could store the name of the type in a list then inside the deserialise procedure unpack it yes |
03:13:12 | FromDiscord | <Elegantbeef> But that requires the name to be accessible in the module deserialising |
03:13:16 | FromDiscord | <Elegantbeef> You do mean runtime polymorphism right? |
03:13:51 | FromDiscord | <huantian> Is that what it’s called? |
03:14:27 | FromDiscord | <huantian> But hmmm yeah it would have to be in the same module or something |
03:14:51 | FromDiscord | <Elegantbeef> It doesnt have to be in the same module |
03:15:24 | FromDiscord | <Elegantbeef> You just need to be able to access the type in the module you're deserialising |
03:18:23 | FromDiscord | <Elegantbeef> Something like this should work |
03:18:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aSB |
03:18:55 | FromDiscord | <Elegantbeef> Aslong as you call unpack after you subscribe the type |
03:19:24 | FromDiscord | <Elegantbeef> This is the issue with deserialising, there is no way to go "Hey generate code after all types are created" |
03:20:07 | FromDiscord | <Elegantbeef> You basically need the logic for method calls to happen |
03:21:11 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4aSC |
03:21:39 | FromDiscord | <Elegantbeef> Obviously the latter |
03:21:42 | FromDiscord | <Rika> I’m betting he likes latter |
03:21:48 | FromDiscord | <Rika> Wait for me you dingus |
03:22:04 | FromDiscord | <Elegantbeef> Sorry |
03:22:23 | FromDiscord | <Patitotective> In reply to @Rika "Wait for me you": dingus |
03:22:39 | FromDiscord | <Rika> In reply to @Patitotective "dingus": No you |
03:22:55 | FromDiscord | <Patitotective> dingus sounds so funny, like really |
03:25:02 | FromDiscord | <Rika> Lol |
03:26:08 | FromDiscord | <Patitotective> imagine a picture of a cat saying dingus↵i bet it already exists |
03:26:38 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=4aSD |
03:27:01 | FromDiscord | <Patitotective> code?? |
03:29:14 | FromDiscord | <Elegantbeef> That code is to ensure there isnt a type mismatch |
03:32:57 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=4aSE |
03:33:36 | FromDiscord | <Elegantbeef> Are you sure you're using a compiler that matches your CPU's arch? |
03:34:33 | FromDiscord | <ynfle> Nop |
03:34:35 | FromDiscord | <ynfle> Nope |
03:34:40 | FromDiscord | <ynfle> How do I chech that |
03:34:45 | FromDiscord | <ynfle> And I installed with choosenim |
03:35:08 | FromDiscord | <ynfle> `Nim Compiler Version 1.6.6 [Windows: i386]` |
03:37:26 | FromDiscord | <ynfle> I have 64 bit which I'm assuming means it doesn't match |
03:37:48 | FromDiscord | <ynfle> How can I get the right one and why doesn't choosenim determine that? |
03:39:01 | FromDiscord | <Patitotective> try `nim c --cpu:amd64 file.nim` |
03:39:40 | FromDiscord | <ynfle> works |
03:40:19 | FromDiscord | <ynfle> How can I switch and tell choosenim to switch |
03:41:04 | FromDiscord | <ynfle> Choosenim says it's 64 bit `choosenim v0.8.4 (2022-07-06 14:50:55) [windows/amd64]` |
03:43:28 | FromDiscord | <Elegantbeef> compile with `--listCmd` and also check `which gcc` |
03:45:18 | FromDiscord | <ynfle> gcc is the nimble one |
03:45:25 | FromDiscord | <Elegantbeef> Sure but it installed 32bit nim so something on your system makes it think it's 32bit |
03:45:27 | FromDiscord | <Elegantbeef> I could've sworn someone else had this issue |
03:46:16 | FromDiscord | <ynfle> I definitely heard of this issue before on here |
03:46:33 | FromDiscord | <Elegantbeef> I dont recall what the fix was though sadly |
03:46:46 | FromDiscord | <ynfle> What will `--listCmd` show? |
03:46:54 | FromDiscord | <Elegantbeef> Gcc flags |
03:49:52 | FromDiscord | <ynfle> Doesn't seem too interesting |
05:45:44 | * | xet7 quit (Quit: Leaving) |
06:13:26 | FromDiscord | <jan0809> what msys? |
06:22:30 | FromDiscord | <Girvo> I know I've asked this before, but whats the size in-memory of a `none(T)` and does it depend on `T`? |
06:22:57 | FromDiscord | <Elegantbeef> Yes it depends it's atmost `sizeof(int) + sizeof(T)` |
06:23:34 | FromDiscord | <Elegantbeef> atleast it'ss `sizeof(byte) + sizeof(T)` |
06:23:38 | FromDiscord | <Elegantbeef> Alignment/padding is a bitch 😄 |
06:29:35 | FromDiscord | <PyryTheBurger> How do i have a seq of typedescs |
06:29:51 | FromDiscord | <PyryTheBurger> Like @[int, string] |
06:29:56 | FromDiscord | <Elegantbeef> You dont |
06:30:01 | FromDiscord | <PyryTheBurger> Bruh |
06:30:19 | FromDiscord | <Elegantbeef> What are you actually after |
06:30:33 | FromDiscord | <PyryTheBurger> In reply to @PyryTheBurger "Like @[int, string]": . |
06:30:45 | FromDiscord | <Elegantbeef> Nim's types do not exist at runtime so things like `@[int, string]` makes no sense |
06:30:46 | FromDiscord | <Elegantbeef> So what are you actually after |
06:30:59 | FromDiscord | <PyryTheBurger> That thing |
06:32:05 | FromDiscord | <Elegantbeef> Why do you need a collection of types? |
06:32:09 | FromDiscord | <Elegantbeef> Like there has to be a reason |
06:33:02 | FromDiscord | <Rika> The best you will be able to get is a tuple of type descent |
06:33:05 | FromDiscord | <Rika> Descs |
06:51:44 | FromDiscord | <jan0809> i think its about union types(?) |
06:52:12 | FromDiscord | <jan0809> that would make sense atleast |
06:52:20 | FromDiscord | <Rika> We ask because we are unsure |
07:23:35 | * | hochata quit (Ping timeout: 268 seconds) |
07:49:23 | * | rockcavera quit (Ping timeout: 265 seconds) |
08:13:34 | FromDiscord | <Bung> any idea how to fix this https://github.com/nim-lang/Nim/issues/4448 , haven't found where the mutability `var` stored |
08:15:03 | FromDiscord | <Elegantbeef> Isnt it just in the type as `tyVar`? |
08:15:22 | FromDiscord | <retkid> something i would like is the ability to use all templates functions and macros like var |
08:15:35 | FromDiscord | <Bung> so it's son of tyVar taken into generic ? |
08:15:36 | FromDiscord | <Elegantbeef> What? |
08:15:55 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=4aTJ |
08:16:05 | FromDiscord | <Elegantbeef> it should be `tyOr(tyVar(MyObject), tyRef(MyObject))` |
08:16:26 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=4aTK |
08:16:27 | FromDiscord | <retkid> thats a cool feature i'd like |
08:16:44 | FromDiscord | <Rika> I don’t even understand the feature you ask for |
08:16:45 | FromDiscord | <Bung> In reply to @Elegantbeef "it should be `tyOr(tyVar(MyObject),": thanks ! good explain |
08:17:08 | FromDiscord | <Elegantbeef> They want all code to allow section syntax |
08:17:11 | FromDiscord | <retkid> In reply to @Rika "I don’t even understand": each function / keyword / template / macro can be put into a codeblock and executed on all those variables |
08:17:46 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=4aTL |
08:17:48 | FromDiscord | <Rika> And if they return? |
08:17:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aTM |
08:18:01 | FromDiscord | <retkid> you echo a b c |
08:18:05 | FromDiscord | <retkid> ok only code which has no return |
08:18:19 | FromDiscord | <flywind> There seem to be a feature request for the function block and be rejected, but I forget which issue |
08:18:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aTN |
08:18:37 | FromDiscord | <flywind> (edit) "There seem to be a feature request for the function block and be rejected, but I forget which issue ... " added "or forum post" |
08:20:17 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=4aTO |
08:20:51 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=4aTO" => "https://play.nim-lang.org/#ix=4aTP" |
08:21:02 | FromDiscord | <Rika> No that would never be supported |
08:21:09 | FromDiscord | <Bung> I think you can make a template |
08:21:23 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=4aTQ |
08:21:40 | FromDiscord | <retkid> probably |
08:21:50 | FromDiscord | <retkid> if i had one to specifically ask for |
08:22:06 | FromDiscord | <retkid> its the discard one |
08:22:27 | FromDiscord | <retkid> because sometimes I just have a ton of discards .-. |
08:22:55 | FromDiscord | <Elegantbeef> you know you can make procedures discardable? |
08:23:27 | FromDiscord | <Elegantbeef> though i dont really think having block discard are that great |
08:24:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4aTU |
08:24:38 | FromDiscord | <Elegantbeef> Though i think araq wants to make the parser handle newline seperated entries in an array |
08:31:20 | FromDiscord | <Rika> Really? |
08:31:52 | FromDiscord | <Elegantbeef> IIRC he called using commas a hack and wanted to remove it |
08:31:53 | FromDiscord | <Elegantbeef> But i might be having a fever dream |
08:58:13 | NimEventer | New Nimble package! mpv - Nim bindings for libmpv, see https://github.com/WeebNetsu/nim-mpv |
09:24:31 | NimEventer | New thread by drkameleon: Get a pointer to a ref object and hold on to it, see https://forum.nim-lang.org/t/9478 |
10:00:37 | NimEventer | New thread by pg13: Hashsets and OpenArrays, see https://forum.nim-lang.org/t/9479 |
10:04:26 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=4aUo |
10:05:47 | FromDiscord | <Rika> There is a `default(T)` proc that returns the default value of the type |
10:22:08 | * | jmdaemon quit (Ping timeout: 265 seconds) |
10:27:43 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=4aUv |
10:28:58 | FromDiscord | <retkid> alright |
10:29:21 | FromDiscord | <retkid> does anyone wanna work on new godot4 nim bindings through GDExtension |
10:30:51 | FromDiscord | <retkid> I guess the question is rather |
10:31:20 | FromDiscord | <retkid> is someone already working on that and do i have to start or can i hop on an already existing project |
10:31:58 | FromDiscord | <retkid> (edit) "that and do" => "it. Do" |
10:34:02 | FromDiscord | <retkid> https://github.com/Hapenia-Lans/gdextension-nim |
10:34:07 | FromDiscord | <retkid> alright time to make some prs |
10:43:25 | * | arkurious joined #nim |
11:21:51 | FromDiscord | <Forest [She/Her]> Is there no way to get decent error messages with async programming? |
11:22:06 | FromDiscord | <Forest [She/Her]> Why can't i catch errors thrown in futures like i would with synchronous programming? |
11:39:13 | FromDiscord | <Rika> In reply to @Forest "Why can't i catch": You can if you await |
11:39:50 | FromDiscord | <Rika> Otherwise you can’t because the error happens outside of the caller proc |
11:40:21 | NimEventer | New Nimble package! packy - Library to pack dependencies in the compiled binary. Supports .dll files, see https://github.com/xrfez/packy |
11:43:45 | FromDiscord | <Rika> Bet it would be immediately flagged as a virus |
11:44:44 | FromDiscord | <retkid> how do i get the list of cpp arguments my nim used to compile a file |
11:45:04 | FromDiscord | <retkid> i need to compile a file to cpp + .h then compile the cpp seperately |
11:45:11 | FromDiscord | <retkid> (edit) "seperately" => "separately" |
11:45:13 | FromDiscord | <retkid> usecase: interop |
11:49:05 | FromDiscord | <Forest [She/Her]> In reply to @Rika "You can if you": Ah okay |
11:49:58 | FromDiscord | <retkid> yo nice system name Forest |
11:58:27 | FromDiscord | <Forest [She/Her]> `/home/raees/projects/Nim/Nimberite/modules/java/packet/unpackers.nim(20, 27) Error: invalid type: 'openArray[byte]' in this context: 'proc (length: int32, id: int32, byteArray: openArray[byte]): HandshakePacket' for proc` why am i getting an error here? I don't understand the issue |
11:59:24 | FromDiscord | <Forest [She/Her]> Nvm figured it out |
12:01:39 | FromDiscord | <Forest [She/Her]> Okay this is odd, I'm getting a type mismatch error despite my type using `openArray[byte]` when initialising it |
12:02:27 | FromDiscord | <retkid> holy in in the p |
12:05:17 | FromDiscord | <Forest [She/Her]> Now I'm getting the invalid type in the context error again |
12:08:27 | FromDiscord | <Forest [She/Her]> I'm just gonna stick to seqs |
12:29:23 | FromDiscord | <retkid> how can i compile nim from a .json |
12:32:11 | FromDiscord | <retkid> guess i can do it in bash and alter it on the fly |
12:33:19 | FromDiscord | <retkid> or well i guess we're doing it in python |
12:33:23 | FromDiscord | <retkid> naisu |
12:36:10 | FromDiscord | <aph> is there a enum thingy only 1 value can be set true? |
13:40:01 | FromDiscord | <auxym> what |
13:43:57 | FromDiscord | <retkid> @auxym I don't like the nim keybindings for godot so i wanted to use my own↵But i wanted to just be simple, so i was going to compile to cpp ↵But turns out you cant link anything in GDNative, and godot4 doesn't even have it↵So I have to use IPC |
13:44:10 | FromDiscord | <retkid> (edit) "@auxym I don't like the nim keybindings for godot so i wanted to use my own↵But i wanted to just be simple, so i was going to compile to cpp ↵But turns out you cant link anything in GDNative, and godot4 doesn't even have it↵So I have to use IPC" => "sent a long message, see http://ix.io/4aVu" |
13:44:26 | FromDiscord | <retkid> So we're running a tcp server :O |
13:44:32 | FromDiscord | <retkid> or maybe pipes |
13:44:34 | FromDiscord | <retkid> i dont quite know |
13:44:44 | FromDiscord | <retkid> something invovling streams |
13:45:26 | FromDiscord | <auxym> ok i don't know anything about godot. |
13:45:36 | FromDiscord | <auxym> keybindings? you mean bindings? |
13:46:26 | FromDiscord | <retkid> sorry brain is onfire |
13:46:28 | FromDiscord | <retkid> (edit) "onfire" => "on fire" |
13:46:52 | FromDiscord | <auxym> btw you might like zeromq for ipc, as a replacement for raw tcp sockets |
13:47:52 | FromDiscord | <retkid> ((i was dreading setting up TCP for ipc)) |
13:47:59 | FromDiscord | <retkid> shit sucks |
13:49:02 | FromDiscord | <auxym> yeah try zeromq, so much nicer than bare sockets, but still pretty light and flexible |
13:49:13 | FromDiscord | <retkid> well |
13:49:17 | FromDiscord | <retkid> im more dreading the godot side |
13:49:26 | FromDiscord | <retkid> https://docs.godotengine.org/en/stable/classes/class_streampeertcp.html |
13:50:11 | FromDiscord | <auxym> yeah no idea about that |
13:50:20 | FromDiscord | <retkid> code is scary |
13:50:28 | FromDiscord | <retkid> don't let anybody tell you otherwise |
14:14:14 | FromDiscord | <retkid> @auxym Does ZMQ do the "\r\L" nim does normally |
14:14:31 | FromDiscord | <Forest [She/Her]> Anyone know what'd be the best way to know what instance of the server should calls be made to? Is it better to use a global list with IDs or just pass a reference to that object down function calls (only the last function call actually needs the reference to the server, the reference isn't used otherwise) |
14:14:37 | FromDiscord | <retkid> because im connecting but not receiving any data |
14:15:02 | FromDiscord | <retkid> In reply to @Forest "Anyone know what'd be": I default to pass my reference |
14:15:04 | FromDiscord | <retkid> whenever I can |
14:15:50 | FromDiscord | <Forest [She/Her]> I'm just trying to think if it'd be slower to do that instead of using a table with the servers in an int:server pair |
14:16:01 | FromDiscord | <retkid> no way |
14:16:03 | FromDiscord | <retkid> table will be way slower |
14:16:09 | FromDiscord | <Forest [She/Her]> Fair enough, thanks |
14:16:34 | FromDiscord | <Rika> im confused and lost |
14:16:41 | FromDiscord | <Rika> what are you guys even discussing? |
14:17:55 | FromDiscord | <Forest [She/Her]> I need to access a value from a `Server` object that stores all of the general server data, but since there can be multiple server instances, i need a way to get the correct instance |
14:17:58 | FromDiscord | <retkid> i have barely an idea |
14:18:04 | FromDiscord | <Forest [She/Her]> So i'll just be passing by references now |
14:18:19 | FromDiscord | <retkid> ah i see |
14:18:35 | FromDiscord | <retkid> Reference and table will be about the same, references might be more confusing in the code |
14:18:49 | FromDiscord | <Forest [She/Her]> With the reference as the first parameter? |
14:19:13 | FromDiscord | <retkid> you mean you give it the reference, then it defines it, then the main function can control it from there |
14:19:21 | FromDiscord | <retkid> basically |
14:20:17 | FromDiscord | <Rika> do you need reference semantics (as in copies "propagate" changes) or are you just using ref because you think it might be quicker? |
14:22:05 | FromDiscord | <auxym> In reply to @retkid "<@882793909246369864> Does ZMQ do": zmq just pushes "messages" around (from your point of view as library user). Messages are raw bytes. But messages are always guaranteed to be complete, you'll never get part of a message, so you don't need to concern yourself with "delimiters" and trying to packetize messages yourself from a raw byte stream. |
14:22:36 | FromDiscord | <retkid> no but in Nim, to read a message of an unkown size you concatenate with \r\L |
14:22:47 | FromDiscord | <retkid> (edit) "with" => "until" |
14:22:57 | FromDiscord | <auxym> messages can also be "multipart", which is useful for example as the first part can be a short, fixed length "header" that tells you what kind of message it is and other useful metadata |
14:23:15 | FromDiscord | <retkid> hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm |
14:23:22 | FromDiscord | <auxym> In reply to @retkid "no but in Nim,": yeah, as I said, zmq will always send full messages. |
14:23:37 | FromDiscord | <auxym> so you don't need to concatenante and split them on \r\l or whatever |
14:23:37 | FromDiscord | <retkid> having a horrible time amt |
14:23:46 | FromDiscord | <retkid> (edit) "amt" => "atm" |
14:23:47 | FromDiscord | <retkid> but |
14:23:50 | FromDiscord | <retkid> this was expected |
14:25:40 | FromDiscord | <auxym> quick intro here: https://zguide.zeromq.org/docs/chapter1/ |
14:26:09 | FromDiscord | <retkid> no |
14:26:14 | FromDiscord | <retkid> i dont even think its zmq |
14:26:43 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/1021427118485282978/unknown.png |
14:26:48 | FromDiscord | <retkid> no connection |
14:26:52 | FromDiscord | <retkid> (╯°□°)╯︵ ┻━┻ |
14:28:34 | FromDiscord | <auxym> well yeah if you're gonna use zmq you need it on both ends (server/client). no idea if its even possible to use it within godot or with that class or whatever, I don't know anything about godot |
14:28:43 | FromDiscord | <retkid> In reply to @auxym "well yeah if you're": really |
14:28:45 | FromDiscord | <retkid> 😭 |
14:29:26 | FromDiscord | <auxym> well yeah, zmq is a protocol on top of raw tcp (or udp, pipes, other stuff), both ends need to speak it |
14:29:50 | FromDiscord | <retkid> welp back to net |
14:32:03 | FromDiscord | <apahl> sent a code paste, see https://play.nim-lang.org/#ix=4aVJ |
14:32:43 | FromDiscord | <apahl> (edit) "https://play.nim-lang.org/#ix=4aVJ" => "https://play.nim-lang.org/#ix=4aVK" |
14:33:02 | FromDiscord | <Rika> Ubuntu is, I believe, the only distro that does not ship 1.1 as well as 3 |
14:33:32 | FromDiscord | <Forest [She/Her]> In reply to @retkid "you mean you give": Yeah |
14:33:54 | FromDiscord | <Forest [She/Her]> In reply to @Rika "do you need reference": Yeah i need to be able to change the data and have it reflect on the original instance |
14:34:00 | FromDiscord | <Rika> There is an open issue for support for 3 |
14:34:12 | FromDiscord | <Rika> In reply to @Forest "Yeah i need to": Var parameter? |
14:34:24 | FromDiscord | <apahl> This is currently really a deal breaker for me. |
14:34:35 | FromDiscord | <Forest [She/Her]> In reply to @Rika "Var parameter?": What'd be the difference? |
14:34:54 | FromDiscord | <Rika> In reply to @Forest "What'd be the difference?": You’d be avoiding the unnecessary ref |
14:41:22 | FromDiscord | <Forest [She/Her]> Fair |
14:41:27 | * | m33mt33n joined #nim |
14:52:45 | * | m33mt33n left #nim (AndroIRC) |
15:00:29 | * | disso_peach quit (Quit: Leaving) |
15:09:33 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4aW3 |
15:11:19 | FromDiscord | <auxym> or with a proc instead of template, whatever |
15:17:08 | FromDiscord | <auxym> I think I was remembering wrong. macro it is. |
15:26:25 | FromDiscord | <retkid> at times |
15:26:33 | FromDiscord | <retkid> working with servers with no connections |
15:26:39 | FromDiscord | <retkid> is like banging you head against a brick wall |
15:37:25 | FromDiscord | <Patitotective> need commas, otherwhise its a statement list afaik |
15:37:33 | FromDiscord | <Patitotective> In reply to @auxym "hm so I though": . |
15:41:38 | * | rockcavera joined #nim |
15:41:38 | * | rockcavera quit (Changing host) |
15:41:38 | * | rockcavera joined #nim |
15:46:17 | FromDiscord | <retkid> so like |
15:46:22 | FromDiscord | <retkid> does netty even work? |
15:51:55 | FromDiscord | <hotdog> In reply to @retkid "does netty even work?": Yes |
15:52:01 | FromDiscord | <hotdog> What problem are you having? |
15:52:08 | FromDiscord | <retkid> no messages were being recieved |
15:52:14 | FromDiscord | <retkid> was it waiting for \r\L |
15:52:31 | FromDiscord | <hotdog> Are you using netty at both ends, |
15:52:35 | FromDiscord | <hotdog> ? |
15:52:38 | FromDiscord | <retkid> i was never told to |
15:53:11 | FromDiscord | <hotdog> It needs to be both |
15:53:24 | FromDiscord | <retkid> well |
15:53:29 | FromDiscord | <retkid> im on normal udp now |
15:54:09 | FromDiscord | <hotdog> Is this for the Godot thing? |
15:54:59 | * | hochata joined #nim |
16:11:08 | FromDiscord | <TheOctoberSurprise> sent a code paste, see https://play.nim-lang.org/#ix=4aWs |
16:13:08 | FromDiscord | <TheOctoberSurprise> (edit) "https://play.nim-lang.org/#ix=4aWs" => "https://play.nim-lang.org/#ix=4aWt" |
16:22:53 | FromDiscord | <retkid> In reply to @hotdog "Is this for the": yea |
16:24:38 | FromDiscord | <hotdog> In reply to @retkid "yea": Did the tcp one not work? |
16:26:37 | FromDiscord | <retkid> meh |
16:26:39 | FromDiscord | <retkid> tcp is slow |
16:29:42 | FromDiscord | <auxym> ... |
16:30:26 | FromDiscord | <auxym> use udp if you have to but saying that the protocol that the entire internet runs on is "slow" is sort of difficult to swallow |
16:30:30 | FromDiscord | <Bloss> will playground ever work lol |
16:31:32 | FromDiscord | <auxym> yeah PMunch was pinged a couple times but he might be on vacation or something (hope he's ok). in the meantime you can use wandbox |
16:35:45 | FromDiscord | <Bloss> if the playground is advertised on the website then maybe more than 1 person should be able to run it |
17:03:26 | * | krux02 joined #nim |
17:09:19 | NimEventer | New post on r/nim by shujidev: How to override a method, see https://reddit.com/r/nim/comments/xiib6l/how_to_override_a_method/ |
17:12:37 | * | disso_peach joined #nim |
17:13:47 | * | jmdaemon joined #nim |
17:19:28 | FromDiscord | <Kiloneie> When do you guys use inheritance over object variants ? |
17:28:48 | FromDiscord | <Phil> In reply to @Kiloneie "When do you guys": When using norm |
17:29:50 | FromDiscord | <Phil> The usecase there for making it inheritance was that you wanted to have some guarantees, those being that regardless of what fields you have, you must have an id field |
17:30:25 | FromDiscord | <Phil> So you needed something user-extendable in a package that had some base properties |
17:30:44 | FromDiscord | <pouriya.jamshidi> Does Nim have a built-in build system similar to `make`? I am aware of `nim script` but I am looking for something more generic. |
17:33:54 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4aWS |
17:37:23 | FromDiscord | <Kiloneie> In reply to @Isofruit "The usecase there for": ... i don't understand how inheritance gives some guarantees. If i write equivalent code for inheritance and object variants, neither require you to have a field mandatory... unless there is a pragma for that ? and it only works with inheritance ?... |
17:37:37 | FromDiscord | <vestel> if object is used only by compileTime procs will it be included into resulting executable? |
17:37:57 | FromDiscord | <vestel> (edit) "procs" => "procs," |
17:39:05 | FromDiscord | <Phil> In reply to @Kiloneie "... i don't understand": Oh no, I wasn't trying to say it so only inheritance can give you those guarantees, I was just trying to say that was a reason for choosing inheritance over e.g. not doing inheritance and telling the user that all their model types must have an id field and they need to add it themselves |
17:39:15 | FromDiscord | <Phil> (edit) "it so" => "that" |
17:39:54 | FromDiscord | <Phil> I haven't tried with object variants but I'd assume that they can't be really user-extended |
17:40:27 | FromDiscord | <auxym> In reply to @pouriya.jamshidi "Does Nim have a": you can define custom tasks, as well as pre/post hooks, in your nimble file |
17:40:40 | FromDiscord | <auxym> or you can just use make, depending on what you need |
17:40:49 | FromDiscord | <Phil> And in the case of models I don't think an object variant would even make any sense |
17:41:22 | FromDiscord | <Phil> Because if I had to write all my models as a single object variant the variant would be massive, like hundreds of lines of codes long just for the field definitions. |
17:42:25 | FromDiscord | <auxym> the reason is that in nim, the "build system" is integrated in the compiler. In C, what make was designed for, you need to call the compiler for each source file, then call the linker to link the object files created by the compiler. In Nim, the compiler takes care of compiling all your source files to C, then calling the c compiler and linker, all from a single nim call. @pouriya.jamshidi |
17:42:51 | FromDiscord | <Phil> In reply to @auxym "you can define custom": Ohhhh nimble tasks have pre/post hooks? |
17:43:54 | FromDiscord | <Phil> Just saw it in the docs, nice |
17:44:07 | FromDiscord | <auxym> yeah |
17:44:29 | FromDiscord | <auxym> esp useful is before/after build IMO. |
17:45:11 | * | hochata quit (Ping timeout: 268 seconds) |
17:50:46 | FromDiscord | <pouriya.jamshidi> In reply to @auxym "the reason is that": Thanks! |
18:01:10 | FromDiscord | <exelotl> In reply to @Kiloneie "... i don't understand": Use methods if you want unbounded polymorphism (can add new kinds of thing without having to go update a master list of things - useful if you're expecting to be adding new things all the time, or if you're making a library and want users to be able to make their own kinds). Otherwise use object variants. |
18:02:17 | FromDiscord | <exelotl> Oops this was supposed to be an answer to your original question, has nothing to do with guarantees :P |
18:02:40 | FromDiscord | <Kiloneie> Still a decent answer |
18:03:07 | FromDiscord | <Require Support> sent a long message, see http://ix.io/4aX2 |
18:04:14 | FromDiscord | <Require Support> (edit) "http://ix.io/4aX2" => "http://ix.io/4aX3" |
18:12:00 | FromDiscord | <Phil> In reply to @auxym "you can define custom": You just triggered me rewriting the dozen or so bash scripts I have for building my app into nimble tasks with pre and post hooks :_D |
18:12:02 | FromDiscord | <Phil> (edit) ":_D" => "😄" |
18:14:00 | FromDiscord | <auxym> In reply to @Require Support "im fairly new to": you can run valgrind I think to detect memory leaks. but yeah if there's a leak in nim or the stdlib, definitely try and put together a minimal reproduction and open an issue |
18:17:17 | FromDiscord | <Forest [She/Her]> Is there a way to get rid of the terminator on a string? |
18:17:42 | FromDiscord | <Forest [She/Her]> I need to send it over a network (prefixed with the length) without the null terminator |
18:30:09 | FromDiscord | <auxym> on a cstring you mean? can you not just subtract 1 from the length when you are sending it (presumably you're passing a pointer and length or something like that) |
18:42:43 | FromDiscord | <Forest [She/Her]> On a normal Nim string |
18:42:55 | FromDiscord | <Forest [She/Her]> Since it included the null terminator by default, iirc |
18:44:47 | FromDiscord | <auxym> not to my knowledge? My understanding is that nim strings under the hood were mostly equivalent to `seq[char]` |
18:45:48 | FromDiscord | <auxym> doesn't matter anyways. your function that sends data over the network, it takes a pointer and length? just pass it `myString[0].addr, myString.len` and it should be fine |
18:57:45 | FromDiscord | <dlesnoff> Can I initialize an array with 500 zero values ? |
18:59:08 | FromDiscord | <dlesnoff> (edit) "?" => "(at declaration, without a for loop)?" |
19:03:54 | FromDiscord | <auxym> In reply to @Jiezron "Can I initialize an": `newSeqOfCap[int](500)` or in case you need anything else than zeros, see https://nim-lang.org/docs/sequtils.html#newSeqWith.t%2Cint%2Cuntyped |
19:03:55 | FromDiscord | <Forest [She/Her]> Ah fair |
19:03:58 | FromDiscord | <Forest [She/Her]> Thanks! |
19:04:17 | FromDiscord | <auxym> In reply to @auxym "`newSeqOfCap[int](500)` or in case": though that's just a template that expands to a for loop |
19:04:35 | FromDiscord | <vestel> In reply to @Jiezron "Can I initialize an": `zeroMem(unsafeAddr(x[0]), x.len sizeof(x[0])` |
19:05:38 | FromDiscord | <dlesnoff> In reply to @auxym "`newSeqOfCap[int](500)` or in case": that is faster to type and more readable ? Thanks |
19:06:25 | FromDiscord | <auxym> btw you said "array" but my answer was actually for seqs. are you familiar with arrays vs seqs in nim? |
19:06:25 | FromDiscord | <dlesnoff> In reply to @vestel "`zeroMem(unsafeAddr(x[0]), x.len * sizeof(x[0])`": That's a very C, low-level solution but should works indeed 😂 |
19:06:33 | FromDiscord | <vestel> 🙂 |
19:06:47 | FromDiscord | <dlesnoff> In reply to @auxym "btw you said "array"": yeah they are CT and constant-sized |
19:06:53 | FromDiscord | <auxym> for arrays, just `var arr: array[500, int]` will give you a zeroed array |
19:06:59 | FromDiscord | <dlesnoff> (edit) "are" => "exist at" |
19:07:19 | FromDiscord | <auxym> yeah and arrays are stack allocated, seqs allocate on the heap |
19:08:16 | FromDiscord | <auxym> nim always zeros memory when allocating a new variable |
19:09:26 | FromDiscord | <dlesnoff> I prefer to be explicit in general and tell it is zero-allocated to the program reader (just in case it isn't familiar with Nim) |
19:10:47 | FromDiscord | <auxym> you do you, use the zeroMem as suggested by vestel I guess. |
19:11:15 | FromDiscord | <Forest [She/Her]> Would defining a proc with the name `[]` allow me to do `myObj[index]`? |
19:11:46 | FromDiscord | <auxym> on another topic, anyone has info on how macros-within-macros are handled? or templates in macros? is it possible to expand the "inner" macros first? |
19:11:51 | FromDiscord | <auxym> In reply to @Forest "Would defining a proc": yes |
19:12:53 | FromDiscord | <vestel> In reply to @auxym "on another topic, anyone": https://nim-lang.org/docs/manual.html#macros |
19:13:34 | FromDiscord | <Forest [She/Her]> In reply to @auxym "yes": Thanks! |
19:14:44 | FromDiscord | <auxym> you can also define `[]=` to be able to do `myObj[index] = (...)` |
19:17:14 | FromDiscord | <Forest [She/Her]> Oh neat, thanks! |
19:18:02 | FromDiscord | <Forest [She/Her]> I've decided to just return a reference to the underlying sequence anyway, since idk how else to make it modifiable, i don't think i can return a `var seq[JavaBasePacket]` |
19:18:26 | FromDiscord | <Forest [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4aXz |
19:18:49 | FromDiscord | <auxym> In reply to @vestel "https://nim-lang.org/docs/manual.html#macros": right so macros are expanded outside-first. hm, this is messing with my plans 😒 |
19:19:27 | FromDiscord | <vestel> afaik you can return call to macro as AST statement |
19:19:34 | FromDiscord | <vestel> not sure why you need it tho |
19:22:22 | FromDiscord | <Forest [She/Her]> Is the object inside of a reference mutable even if i do `let`? |
19:23:33 | FromDiscord | <vestel> no |
19:23:55 | FromDiscord | <Forest [She/Her]> Alright then thanks |
19:24:07 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4aXD |
19:24:16 | FromDiscord | <Forest [She/Her]> In reply to @jmgomez "are you doing a": Nope |
19:24:39 | FromDiscord | <Forest [She/Her]> Making a Minecraft Java Edition server implementation (with plans of perhaps making native support for Bedrock) |
19:25:11 | FromDiscord | <jmgomez> oh ok! Nim to bytecode would be cool though |
19:25:42 | FromDiscord | <Forest [She/Her]> In reply to @jmgomez "oh ok! Nim to": I'm actually working on that too, just my ADHD being a bitch so working on something else for now |
19:28:07 | FromDiscord | <jmgomez> Gotcha! Not a Java dev myself (I used to code in .NET back in the day) but Nim to java can be a big deal for Nim. It's probably the biggest community willing to try new langs |
19:32:36 | FromDiscord | <Forest [She/Her]> Yeah absolutely, and ik that people in general are annoyed with how Java looks and works, and Kotlin has been a deterrent for others even with people's claims of it being great |
19:32:52 | FromDiscord | <Forest [She/Her]> Nim doesn't feel like a JVM lang, and this ideally wouldn't change that much |
19:36:54 | FromDiscord | <Forest [She/Her]> In reply to @jmgomez "Gotcha! Not a Java": I think an issue that'll probably have to be solved is the stdlib and the built-in system stuff |
19:37:44 | FromDiscord | <Forest [She/Her]> Since ideally everything would just work™️ once i get the semantics to translate, but i doubt it would work like that, so may have to fill a lot of libraries specifically for Nim on the JVM |
19:46:05 | FromDiscord | <auxym> so basically I'm trying to achieve something like this with a macro: |
19:46:23 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4aXJ |
19:47:01 | FromDiscord | <auxym> so, stuff mutiple nodes in the middle of existing child nodes, at the same AST level. is that possible? |
19:52:09 | FromDiscord | <jmgomez> In reply to @Forest "I think an issue": I mean the stdlib can be just rewritten for it, right? Is not that much and probably having the signature can be automatized |
19:52:32 | FromDiscord | <jmgomez> (edit) removed "Is not that much and probably having the signature can be automatized" |
19:56:19 | FromDiscord | <Forest [She/Her]> In reply to @jmgomez "I mean the stdlib": It can yeah, but that's a big task |
20:02:42 | * | krux02 quit (Remote host closed the connection) |
20:07:18 | NimEventer | New thread by auxym: Return multiple "flat" nodes from a macro, see https://forum.nim-lang.org/t/9480 |
20:11:02 | FromDiscord | <huantian> In reply to @Forest "Is the object inside": Yeah refs are always mutable |
20:18:01 | FromDiscord | <jmgomez> In reply to @Forest "It can yeah, but": yeah, it is. But smaller than having it compiling to bytecode. Is there a repo or something of what you have so far? |
20:18:04 | * | hochata joined #nim |
20:25:55 | FromDiscord | <Forest [She/Her]> In reply to @jmgomez "yeah, it is. But": Fair |
20:26:21 | FromDiscord | <Forest [She/Her]> Yeah there's a repo, here: https://github.com/Mythical-Forest-Collective/Nimpiler |
20:26:30 | FromDiscord | <Forest [She/Her]> I'm working on it again rn |
20:27:04 | FromDiscord | <Forest [She/Her]> It's using a fork of Nim meant to make it easier to maintain the existing backends and make new ones |
20:42:35 | FromDiscord | <Forest [She/Her]> Oh yeah, and i need to work on something to wrap Java packages into a Nim 'package' that just emits the Jasmin code directly |
20:43:03 | FromDiscord | <Forest [She/Her]> (Jasmin is a low-level human read and writable format for it) |
20:45:24 | * | LuxuryMode joined #nim |
20:50:48 | FromDiscord | <Forest [She/Her]> Is there a reliable way to invoke the JVM? I need to run a jar file but running through OS seems like a bit of a hell for different platforms |
20:53:43 | FromDiscord | <David> Forest is this what you're looking for\: https://github.com/yglukhov/jnim ? |
20:55:14 | FromDiscord | <Forest [She/Her]> It should be fine yeah, thanks! |
20:55:21 | FromDiscord | <David> If you are directly invoking a JVM to run Jasmin I would encourage taking a peak at either https://asm.ow2.io or https://bytebuddy.net/#/ |
20:56:09 | FromDiscord | <David> Jasmin hasn't been updated in years and asm is the standard JVM bytecode manipulation library. Bytebuddy is slower, but it's much simpler wrapper built on top of asm. |
21:00:04 | FromDiscord | <Forest [She/Her]> In reply to @David "If you are directly": Ah no that's not what I'm doing |
21:00:52 | FromDiscord | <Forest [She/Her]> What i'm doing is taking Nim's source code (from the AST) and attempting to compile it to Jasmin, and i want to invoke the Jasmin compiler to compile the source code |
21:06:43 | FromDiscord | <David> Any particular reason you're going that route over outputting java directly? You are still introducing a new compilation step and the Jasmin compiler is unsupported from what I can tell. There are probably a lot more resources to debug your generated Java source code than an esoteric assembler. |
21:07:30 | FromDiscord | <David> Either way good luck! |
21:15:14 | FromDiscord | <Elegantbeef> Without strict funcs 😛↵(@huantian) |
21:15:22 | FromDiscord | <huantian> true! |
21:16:30 | FromDiscord | <Elegantbeef> Make a `&` operator for arrays then you can do `@([2, 3, 4] & manyItems() & 5)`↵(@auxym) |
21:19:34 | FromDiscord | <David> @Forest [She/Her]\: Sorry one last thing to keep in mind is the source map debugging spec in JSR-45. This may not be possible with Jasmin. |
21:23:57 | * | neceve quit (Quit: ZNC - https://znc.in) |
21:24:33 | FromDiscord | <John Fred> sent a long message, see http://ix.io/4aGV |
21:24:49 | FromDiscord | <Kiloneie> oO |
21:25:38 | FromDiscord | <Patitotective> In reply to @John Fred "Do you have a": <@&371760044473319454> ❤️ |
21:25:42 | * | neceve joined #nim |
21:26:45 | FromDiscord | <Elegantbeef> Imagine being paid to spam a url no one clicks in a programming matrix |
21:26:50 | FromDiscord | <Elegantbeef> Fucking top tier waste of money |
21:27:23 | FromDiscord | <Kiloneie> Ever seen a milk ad when watching a gaming stream ? lol. Anyways off topic. |
21:30:01 | FromDiscord | <Kiloneie> Is Nim Forum ever getting a dark mode ? |
21:30:18 | FromDiscord | <Elegantbeef> PRs welcome |
21:32:23 | FromDiscord | <David> image.png↵(@Kiloneie) https://media.discordapp.net/attachments/371759389889003532/1021534242641018882/image.png |
21:32:37 | FromDiscord | <David> @Kiloneie\: https://darkreader.org/ is pretty decent ^ |
21:33:17 | FromDiscord | <Kiloneie> I think i have a dark theme on firefox, but not this... This will be amazing, thank you |
21:34:01 | FromDiscord | <Patitotective> forum get a new style along with nimble directory, would be cool |
21:35:32 | FromDiscord | <Kiloneie> Browser extensions are such life savers, especially YT background play fix for phones, they charge money for that... |
21:35:59 | FromDiscord | <Elegantbeef> Though sometimes the bridge shits the bed and matrix goes dark 😛 |
21:36:00 | FromDiscord | <Elegantbeef> I mean emojis |
21:36:00 | FromDiscord | <Elegantbeef> Even discord custom reactions reach us |
21:36:00 | FromDiscord | <Elegantbeef> Reactions are not bridged |
21:48:48 | FromDiscord | <auxym> In reply to @Elegantbeef "Make a `&` operator": yeah, I have another workaround that involves more AST manipulation, seems that's what I'll have to do |
21:52:18 | FromDiscord | <Elegantbeef> You could also just make a macro that iterates it's elements an joins them with `&` but meh |
21:56:34 | FromDiscord | <Kiloneie> Whats the benefit of using strictFuncs ? |
21:56:55 | FromDiscord | <Elegantbeef> The functions are properly pure |
22:10:09 | * | qwr quit (Ping timeout: 250 seconds) |
22:22:11 | * | qwr joined #nim |
22:53:14 | * | arkurious quit (Quit: Leaving) |
23:04:44 | FromDiscord | <retkid> whats that function which echos the repl of a string |
23:04:50 | FromDiscord | <retkid> byte for byte |
23:05:07 | FromDiscord | <retkid> im having one of those classic string assertions wrong for inexplicable reasons |
23:05:11 | FromDiscord | <retkid> and i need to see whats happening |
23:05:57 | FromDiscord | <! Nilts> How would i capitalize in nim? |
23:06:08 | FromDiscord | <retkid> toCapitapleAscci |
23:06:11 | FromDiscord | <retkid> or however you spell it |
23:06:17 | FromDiscord | <retkid> its in string utils |
23:06:42 | FromDiscord | <Patitotective> In reply to @not logged in "How would i capitalize": strutils.toUpperAscii |
23:06:58 | FromDiscord | <Patitotective> nvm |
23:07:04 | FromDiscord | <retkid> haha nerd |
23:07:07 | FromDiscord | <retkid> i used this proc yesterdayt |
23:07:08 | FromDiscord | <retkid> (edit) "yesterdayt" => "yesterday" |
23:07:20 | FromDiscord | <Patitotective> its capitalizeAscii |
23:07:26 | FromDiscord | <retkid> shit |
23:07:51 | FromDiscord | <Elegantbeef> repr?↵(@retkid) |
23:08:25 | FromDiscord | <retkid> it i |
23:08:28 | FromDiscord | <retkid> it is repr |
23:08:29 | FromDiscord | <Patitotective> !eval echo repr "Hello\nWorld" |
23:08:43 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/1021558483696504893/unknown.png |
23:08:46 | FromDiscord | <retkid> estrange |
23:09:29 | NimBot | Compile failed: <no output> |
23:09:44 | FromDiscord | <Patitotective> nimbot doesnt work anymore, does it |
23:10:37 | FromDiscord | <retkid> hmmm |
23:10:42 | FromDiscord | <Elegantbeef> Uses playground api |
23:10:43 | FromDiscord | <retkid> im not understanding this |
23:10:47 | FromDiscord | <Elegantbeef> What's your full code ret |
23:11:27 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=4aYm |
23:11:38 | FromDiscord | <retkid> .q. != .q. |
23:11:57 | FromDiscord | <retkid> hmmm |
23:12:11 | FromDiscord | <retkid> i think theres unprintable characters between them |
23:14:39 | FromDiscord | <Elegantbeef> `toOpenArrayByte(0, buffer.high)` might help |
23:14:46 | FromDiscord | <Elegantbeef> It'll show you the byte data of the string |
23:15:15 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/1021560128417308722/unknown.png |
23:15:17 | FromDiscord | <retkid> ye |
23:15:23 | FromDiscord | <retkid> its infested with null |
23:15:45 | FromDiscord | <retkid> is there a null check proc |
23:15:51 | FromDiscord | <retkid> so i can filter |
23:16:20 | FromDiscord | <Elegantbeef> It's just a character so yes |
23:16:48 | FromDiscord | <retkid> In reply to @Elegantbeef "It's just a character": ?!? |
23:16:58 | FromDiscord | <Elegantbeef> `\0` is just a character |
23:17:02 | FromDiscord | <retkid> yes |
23:17:06 | FromDiscord | <Elegantbeef> Like what is so confusing |
23:17:11 | FromDiscord | <retkid> what isn't here |
23:17:24 | FromDiscord | <retkid> oh i see |
23:17:31 | FromDiscord | <retkid> i don't know what didn't click |
23:20:52 | FromDiscord | <retkid> why doesn't filter on a string return a string |
23:21:11 | FromDiscord | <retkid> it should return the T inputed |
23:24:33 | FromDiscord | <Elegantbeef> Cause it uses openarray[char] |
23:24:45 | FromDiscord | <Elegantbeef> `str.replace("\0")` is what you want |
23:25:09 | FromDiscord | <Elegantbeef> But in all honesty i think if you have to remove `\0` from the stream you're doing it wrong |
23:25:26 | FromDiscord | <retkid> temporary solution |
23:25:38 | FromDiscord | <retkid> until i think of something better |
23:25:48 | FromDiscord | <Elegantbeef> Read the 32bit integers like you're supposed to? |
23:26:11 | FromDiscord | <retkid> which ones |
23:26:29 | FromDiscord | <Elegantbeef> `2000` `4200` `4000` `3000` `46113560` I'm not an expert but those seem to be 32bit integers |
23:26:47 | FromDiscord | <retkid> oh |
23:27:09 | FromDiscord | <retkid> 😓 |
23:27:22 | FromDiscord | <retkid> my brain is off |
23:27:29 | FromDiscord | <retkid> it should be one 32bit into though |
23:27:34 | FromDiscord | <Elegantbeef> I mean atleast i think those are 32bit integers |
23:27:37 | FromDiscord | <retkid> they have to be |
23:27:56 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/1021563319301185628/unknown.png |
23:28:01 | FromDiscord | <retkid> right now im trying to figure htis out |
23:28:16 | FromDiscord | <Elegantbeef> I dont know what this is |
23:28:31 | FromDiscord | <retkid> im suppose to be sending 2 strings |
23:28:35 | FromDiscord | <retkid> "42" ".q." |
23:28:38 | FromDiscord | <! Nilts> `toUpperAscii` is char? |
23:28:47 | FromDiscord | <retkid> yes |
23:30:41 | FromDiscord | <Elegantbeef> If you're sending `42` and `.q.` you shoulf get `42` and `.q.` |
23:32:11 | FromDiscord | <retkid> might switch to fifo |
23:33:18 | FromDiscord | <retkid> current idea |
23:33:27 | FromDiscord | <retkid> !headermarker!sizeofmessage! |
23:33:35 | FromDiscord | <Elegantbeef> You confuse me |
23:33:44 | FromDiscord | <retkid> whys that |
23:33:56 | FromDiscord | <Elegantbeef> What are you trying to do? |
23:34:00 | FromDiscord | <retkid> i dont know |
23:34:11 | FromDiscord | <Elegantbeef> Ok |
23:34:38 | FromDiscord | <Elegantbeef> So then why are you writing socket code |
23:40:11 | FromDiscord | <Bung> https://github.com/nim-lang/Nim/issues/7955 this expected all failed right ? |
23:53:41 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/1021569803120549918/unknown.png |
23:53:42 | FromDiscord | <retkid> orkthi |
23:53:49 | FromDiscord | <retkid> his works |
23:53:55 | FromDiscord | <retkid> this works |
23:54:06 | FromDiscord | <retkid> but its probably pretty slow |
23:54:14 | FromDiscord | <retkid> eh its fine |