00:34:20 | * | jmdaemon quit (Ping timeout: 272 seconds) |
00:35:10 | * | vicfred quit (Quit: Leaving) |
00:36:15 | FromDiscord | <exelotl> droidrage: there's not really any benefit in compiling to Vala since Vala and Nim both compile to C right? |
00:37:11 | FromDiscord | <exelotl> I believe gintro is the best Nim library for glib/gtk stuff though https://github.com/StefanSalewski/gintro |
00:38:16 | FromDiscord | <Forest> Why is the code generated by Nim's JS backend so dirty? |
00:39:01 | FromDiscord | <Forest> And how would i compile multiple modules for use? |
00:39:18 | FromDiscord | <Forest> (edit) "modules" => "nim files" | "use?" => "use with it?" |
00:39:52 | FromDiscord | <Forest> Tbh it'd be nice to not have such dirty output, since I'm using it in a CommonJS environment |
00:41:31 | FromDiscord | <Elegantbeef> Have you passed `-d:release` or `-d:danger`? |
00:42:31 | FromDiscord | <Elegantbeef> And what do you mean multiple nim files? |
00:42:33 | FromDiscord | <Elegantbeef> Just import then |
00:42:42 | FromDiscord | <Elegantbeef> import them\ |
00:49:09 | FromDiscord | <Forest> Ah |
00:49:18 | FromDiscord | <Forest> Would importing them combine them into one file? |
00:53:02 | FromDiscord | <exelotl> I think so, haven't done a lot of Nim JS stuff |
00:53:44 | FromDiscord | <Forest> In reply to @Elegantbeef "Have you passed `-d:release`": It's still very cluttered lol |
00:53:47 | FromDiscord | <Forest> In reply to @exelotl "I think so, haven't": Fair |
00:54:27 | FromDiscord | <exelotl> if you're using nim to produce a library usable from nodejs or similar then I guess `--nomain` is your friend |
00:54:27 | FromDiscord | <Elegantbeef> Yes Nim does emit a single file |
00:54:47 | droidrage | > <exelotl> I believe gintro is the best Nim library for glib/gtk stuff though https://github.com/StefanSalewski/gintro |
00:54:47 | droidrage | Yes that's the one whose readme states it is wip quality still...I guess I'm asking if I want to contribute to a sw written in vala, can I do so with nim or is it not enough that they both (trans/com)pile to c? |
00:54:51 | FromDiscord | <Elegantbeef> If you want to have multiple files you'd `exportC` the code and `importJs` it in another file |
00:55:44 | droidrage | Or would it be simpler to learn to code in vala for such projects |
00:56:15 | FromDiscord | <Forest> In reply to @Elegantbeef "If you want to": Ah okay |
00:57:28 | FromDiscord | <exelotl> mmh yeah I probably wouldn't try to introduce Nim into a Vala codebase. I'm sure it's _possible_ to use them together but not worth the complexity. And Vala is a fairly nice language from what I recall. |
00:59:05 | droidrage | Thanks for confirming my hunch |
00:59:50 | * | jmdaemon joined #nim |
01:01:18 | FromDiscord | <exelotl> In reply to @Forest "It's still very cluttered": the Nim output isn't really supposed to be read by humans (though I sometimes find it helpful for debugging). Nim treats C, JS etc. as "portable assembly" |
01:02:47 | FromDiscord | <Forest> Fair enough aha |
01:04:27 | FromDiscord | <Forest> I'm heavily debating on using Nim's JS backend instead of CoffeeScript |
01:04:34 | FromDiscord | <Forest> What would be the advantages I'd get? |
01:08:30 | FromDiscord | <exelotl> a strong type system (catches your mistakes, makes refactoring easier), and a powerful macro system (allows you to eliminate boilerplate and do work at compile-time instead of runtime) |
01:08:59 | FromDiscord | <exelotl> (edit) "mistakes," => "mistakes before the program runs," |
01:10:37 | FromDiscord | <Forest> Hm yeah probably gonna use Nim then aha |
01:10:38 | FromDiscord | <Forest> Thanks! |
01:12:23 | FromDiscord | <Elegantbeef> Also the abillity to reuse code for native binaries if you ever need that |
01:19:05 | FromDiscord | <Forest> Idk why I'd need that in this case but cool- |
01:19:21 | FromDiscord | <Elegantbeef> Well if you make a backend and ever want to send an object to the client |
01:22:08 | FromDiscord | <Forest> Welp time to relearn the stuff I forgot about Nim |
01:24:13 | FromDiscord | <Forest> Ah i just realized something, the environment I'm using exposes a function by default but idk how I'm supposed to access it in Nim, how would i do that? :P |
01:24:30 | FromDiscord | <Elegantbeef> importjs it |
01:24:35 | FromDiscord | <Forest> It just includes it in the runtime, no imports |
01:24:44 | FromDiscord | <Forest> `importjs`? |
01:25:13 | FromDiscord | <Elegantbeef> `proc myProc(args): ReturnType {.importJs: "procRealName".}` |
01:25:20 | FromDiscord | <Forest> Ah neat, thanks! |
01:25:28 | FromDiscord | <Forest> How about if it's a static function? |
01:25:38 | FromDiscord | <Forest> Just `class.proc`? |
01:25:48 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/jsffi.html will help you a alot |
01:26:11 | FromDiscord | <Forest> I should probably read through it lol |
01:26:41 | FromDiscord | <Elegantbeef> The source of https://nim-lang.org/docs/dom.html will help aswell |
01:27:41 | FromDiscord | <Forest> Thanks xD |
01:28:48 | * | jmdaemon quit (Ping timeout: 272 seconds) |
01:32:41 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PUm |
01:32:56 | FromDiscord | <Elegantbeef> may just want to use `importC` then |
01:33:08 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PUn |
01:33:32 | FromDiscord | <Elegantbeef> Wait java?! |
01:33:49 | FromDiscord | <Forest> It's a project with GraalJS :p |
01:34:26 | FromDiscord | <Forest> Grakkit is a plugin that enables the use of JS to make MC plugins and i thought Nim probably would be great because i love the syntax :p |
01:34:48 | FromDiscord | <Elegantbeef> I see |
01:35:06 | FromDiscord | <Elegantbeef> Anywho you might want `importC` there |
01:35:17 | FromDiscord | <Forest> Why's that? |
01:35:44 | FromDiscord | <Elegantbeef> or do \`importJs\:"Java.type(#)" |
01:35:54 | FromDiscord | <Forest> Ah okay |
01:36:13 | FromDiscord | <Forest> Thanks aha |
01:42:07 | FromDiscord | <Forest> Would it be possible for me to just define an import hook or something? So i can do `import java.package.Class` and have that directly added to the namespace? |
01:42:19 | FromDiscord | <huantian> https://media.discordapp.net/attachments/371759389889003532/944046135566299156/unknown.png |
01:42:22 | FromDiscord | <huantian> can't wait to add nim to this list |
01:42:28 | FromDiscord | <Forest> Lol |
01:42:29 | FromDiscord | <huantian> of random technologies and programs |
01:42:42 | FromDiscord | <Forest> It works pretty well |
01:42:45 | FromDiscord | <huantian> this actually looks kinda sick tho |
01:42:54 | FromDiscord | <Elegantbeef> I mean you can make a macro that does it but otherwise no |
01:43:04 | FromDiscord | <Forest> Ye, i actually helped to port it to Gradle and made the workflow for it haha |
01:43:05 | FromDiscord | <Elegantbeef> Nim doesnt know what `java.package.Class` contains if i get what you mean |
01:43:09 | FromDiscord | <Forest> In reply to @Elegantbeef "I mean you can": Ah fair enough |
01:43:15 | FromDiscord | <Forest> In reply to @Elegantbeef "Nim doesnt know what": Yeah fair lol |
01:43:23 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/jsffi.html#require%2Ccstring there is this though |
01:43:38 | FromDiscord | <Forest> Time to make a macro |
01:43:48 | FromDiscord | <Forest> Neat |
01:50:10 | FromDiscord | <Forest> Do macros just output the exact code in the macro, with the provided arguments? |
01:50:32 | FromDiscord | <Elegantbeef> Macros output whatever you tell them to, they're user defined compiler passes |
01:50:42 | FromDiscord | <Forest> Ah |
01:51:26 | FromDiscord | <Forest> So i could just output a syntax tree directly if i wanted to? |
01:51:53 | FromDiscord | <Elegantbeef> Well that's what Nim macros are, you take in AST and emit AST |
01:52:01 | FromDiscord | <Forest> Fair enough lol |
01:54:19 | FromDiscord | <Elegantbeef> So what you might do is use a macro to iterate over the JS code and emit wrapped functions, or you might make a macro or template that allows you to easily specify the procedure name and arguments, but that's fully up to what you're doing 😀 |
01:54:32 | FromDiscord | <Elegantbeef> I dont know how much code you're wrapping or what you're after |
01:55:23 | FromDiscord | <Forest> I'm just trying to make it so `jclass "java.package.Class"` adds `Class` to the namespace as if it's been imported aha |
01:55:41 | FromDiscord | <Elegantbeef> Namespace? 😀 |
01:55:43 | FromDiscord | <Forest> I'm reading through docs and not understanding anything Lol |
01:55:53 | FromDiscord | <Forest> Namespace as in uh, environment? |
01:56:02 | FromDiscord | <Forest> Idk what it's called :p |
01:56:48 | FromDiscord | <Elegantbeef> Module? |
01:57:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PUq |
01:57:55 | FromDiscord | <Elegantbeef> then you'd just do `import classes` and have it imported |
01:58:02 | FromDiscord | <Elegantbeef> I guess it'd be `Class` |
01:58:39 | FromDiscord | <Forest> No i don't know how to explain it bleh |
01:59:06 | FromDiscord | <Forest> Y'know how in Python you can just do `import os` and then you can do `os.system("stuff")`? |
01:59:14 | FromDiscord | <Elegantbeef> Yes |
01:59:34 | FromDiscord | <Forest> I wanna do `jclass "java.package.Class"` and then just have `Class` usable from Nim |
02:00:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PUr |
02:00:13 | FromDiscord | <Forest> But it's a Java class that i want to add to the name space |
02:00:33 | FromDiscord | <Forest> And i don't know the fields/procs at compile time |
02:00:35 | FromDiscord | <Elegantbeef> Nim is not python or java. It doesnt have namespaces |
02:00:55 | FromDiscord | <Forest> I know that I'm just struggling to explain it |
02:01:00 | FromDiscord | <Elegantbeef> `JSObject` does exist which is "typeless" |
02:02:00 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PUv |
02:02:22 | FromDiscord | <Forest> Macros would help me do that i think but I'm struggling to actually understand it |
02:02:55 | FromDiscord | <Elegantbeef> Well jclass would emit a typedesc with a `.()` macro |
02:03:10 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#special-operators-operator-nimdot |
02:03:26 | FromDiscord | <Elegantbeef> I guess maybe a variable instead |
02:05:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PUx |
02:06:02 | FromDiscord | <Forest> Ah okay then, thanks |
02:06:04 | FromDiscord | <Elegantbeef> `BukkitInternal` would be gensym'd so it'd only be accessible for the variable declaration |
02:08:08 | FromDiscord | <Elegantbeef> the macro signature would be `macro jclass(path: static string)` if unclear |
02:20:09 | FromDiscord | <Forest> Ah okay! |
02:34:40 | FromDiscord | <Forest> I got a type error using Nim because of the NimStrLit function m |
02:34:41 | FromDiscord | <Forest> ? |
02:35:04 | FromDiscord | <Forest> `TypeError: Java.type expects one string argument` |
02:37:34 | FromDiscord | <Forest> How would i fix that? |
02:38:42 | FromDiscord | <Forest> Ah i changed the input type to `cstring` and it worked |
02:43:49 | * | arkurious quit (Quit: Leaving) |
02:49:36 | * | jmdaemon joined #nim |
03:01:22 | * | Gustavo6046 quit (Remote host closed the connection) |
03:01:42 | FromDiscord | <Forest> How would i accept a nested array as an argument? `array[0..2, array[0..2, string]]`? |
03:01:44 | * | Gustavo6046 joined #nim |
03:01:59 | FromDiscord | <Forest> Actually there's a playground for this |
03:02:12 | FromDiscord | <Elegantbeef> Exactly as you put it 😀 |
03:13:08 | NimEventer | New question by pooooky: Why is Nim not overriding, see https://stackoverflow.com/questions/71167977/why-is-nim-not-overriding |
03:20:28 | FromDiscord | <Forest> Does Nim have default arguments or do i need to just use operator overriding? |
03:28:44 | FromDiscord | <Elegantbeef> it has defaults |
03:29:06 | FromDiscord | <Elegantbeef> Also did you mean procedure overloading? |
03:29:49 | FromDiscord | <Forest> Yeah that's what i meant |
03:38:52 | FromDiscord | <Forest> How do i overload a procedure? :p |
03:39:12 | FromDiscord | <Forest> Just defining another procedure with the same name should work, right? |
03:39:14 | FromDiscord | <Rika> Ues |
03:39:22 | FromDiscord | <Rika> Different parameter types |
03:41:08 | FromDiscord | <Forest> Aight |
03:41:12 | FromDiscord | <ckennedy> anyone have any ideas why nim would be compiling to x86_64 on an arm64 M1 Mac? |
03:42:23 | FromDiscord | <cs> What is the convention for declaring variables? Is it inside of procedures in a group? |
03:42:38 | FromDiscord | <cs> (edit) "What is the convention for declaring variables? Is it inside of procedures ... ingroup" added "or" | "group?" => "group outside of them?" |
03:46:26 | FromDiscord | <Rika> ? |
03:46:42 | FromDiscord | <Rika> Variables have scope |
03:46:49 | FromDiscord | <Rika> Local is preferred to global |
03:48:09 | FromDiscord | <cs> Okay, I see. |
03:49:20 | FromDiscord | <Elegantbeef> Ideally your modules dont have side effects unless it's desired for the program |
03:49:50 | FromDiscord | <Elegantbeef> If you make a library you should avoid global variables as much as possible |
03:50:40 | FromDiscord | <Rika> Const outside is fine just avoid let and var globals |
03:50:41 | FromDiscord | <cs> In reply to @Elegantbeef "If you make a": Yeah, I am familiar with other programming languages, just trying to find the conventions and the nim way of doing things. |
04:00:22 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PUI |
04:02:20 | FromDiscord | <Elegantbeef> Code? |
04:03:41 | FromDiscord | <Rika> You’re using a variable as a proc? |
04:05:05 | FromDiscord | <Elegantbeef> Seems they're tying to call a constructor using `new` |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:32 | * | supakeen joined #nim |
04:07:12 | FromDiscord | <Elegantbeef> you'd probably want to do `NamespacedKey(field: my, param: params, here: here).toJs` |
04:08:55 | FromDiscord | <Forest> Ah okay |
04:11:10 | FromDiscord | <Elegantbeef> Depends what `NameSpacedKey` is |
04:40:51 | * | keyehzh quit (Remote host closed the connection) |
04:59:16 | * | rockcavera quit (Remote host closed the connection) |
05:14:06 | FromDiscord | <Forest> It's a Java class that i usually initialise with `new NamespacedKey(my arguments)` in Java |
05:14:12 | FromDiscord | <Forest> (edit) "Java" => "JS" |
05:14:46 | FromDiscord | <Elegantbeef> You'd need to import the constructor then, or just use a JSObject |
05:18:09 | FromDiscord | <Forest> I don't understand exactly? I've imported it |
05:18:48 | FromDiscord | <Rika> what is `NamespacedKey` defined as? |
05:23:21 | FromDiscord | <Forest> It'd a JsObject |
05:25:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/1JT |
05:26:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PUX |
05:27:09 | FromDiscord | <Forest> Ah okay then |
05:28:09 | FromDiscord | <Forest> Hm issue is that Bukkit relies on getting the NamespacedKey so i need to initialise that object |
05:29:01 | FromDiscord | <Elegantbeef> Do you have the NameSpacedKey object definition handy? |
05:30:09 | FromDiscord | <Forest> What do you mean? I have the JsObject in a variable if that's what you mean |
05:30:25 | FromDiscord | <Elegantbeef> I mean the js definition |
05:30:31 | FromDiscord | <Elegantbeef> Like what's the code you're porting |
05:30:42 | * | krux02 quit (Remote host closed the connection) |
05:31:20 | FromDiscord | <Rika> js technically doesnt really have definitions no? just make the object |
05:31:37 | FromDiscord | <Rika> if ever you have more issues, you can copy the NamespacedKey and then modify the copy |
05:31:52 | FromDiscord | <Elegantbeef> Yea i know it doesnt explicitly |
05:32:15 | FromDiscord | <Elegantbeef> But most time there is a limited number of fields that are populated so there is atleast a skeleton you can abstract |
05:32:56 | FromDiscord | <Rika> then its prolly in that jsobject he mentioned, NamespacedKey |
05:33:09 | FromDiscord | <Elegantbeef> Sure but i want to know the JS code 😛 |
05:33:13 | FromDiscord | <Elegantbeef> So i can actually say what to do |
05:33:38 | FromDiscord | <Forest> NamespacedKey is a Java class that GraalJS wraps into a JsObject automatically, so I don't have the JS code for it |
05:33:50 | FromDiscord | <Rika> can you run a reply |
05:33:51 | FromDiscord | <Rika> (edit) "reply" => "repl" |
05:33:54 | FromDiscord | <Elegantbeef> Well what is the code you're replicating 😀 |
05:34:05 | FromDiscord | <Rika> if you can then print the object in it |
05:34:07 | FromDiscord | <Elegantbeef> You have JS code, i want to see it! |
05:34:18 | FromDiscord | <Forest> Oh sure :p |
05:34:24 | FromDiscord | <Forest> In reply to @Rika "if you can then": Sure gimme a sec |
05:34:30 | FromDiscord | <Rika> he has java i assume not js |
05:35:14 | FromDiscord | <Elegantbeef> They have JS |
05:36:34 | FromDiscord | <Forest> Wait I'm confused :p |
05:36:41 | FromDiscord | <Forest> Do you want the code I'd use in JS? |
05:36:46 | FromDiscord | <Forest> Or the actual JS source code for it? |
05:36:57 | FromDiscord | <Elegantbeef> The code you'd usue |
05:36:58 | FromDiscord | <Forest> Because there's no JS source for NamespacedKey |
05:37:01 | FromDiscord | <Forest> Ah okay |
05:37:20 | FromDiscord | <Forest> `new NamespacedKey(plugin, "string");` |
05:37:30 | FromDiscord | <Forest> I already have the plugin instance and it works |
05:37:36 | FromDiscord | <Forest> But I can't initialise the jey |
05:37:38 | FromDiscord | <Forest> Key |
05:37:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PV0 |
05:37:45 | FromDiscord | <Elegantbeef> That's how you'd do it |
05:38:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PV1 |
05:40:38 | FromDiscord | <Forest> Ah okay, thanks! |
05:41:04 | FromDiscord | <Forest> Why doesn't Nim map `new` to JS's `new`? |
05:43:32 | FromDiscord | <Elegantbeef> Cause it's for Nim's references |
05:43:52 | FromDiscord | <Elegantbeef> Nim's semantics shouldnt change due to it's backend |
05:51:05 | * | slowButPresent quit (Quit: leaving) |
05:52:16 | FromDiscord | <Forest> Ah |
05:52:45 | FromDiscord | <Forest> I'm getting this error now for some reason? `/data/data/com.termux/files/home/testserver/plugins/grakkit/utils.nim(31, 108) Error: type expected`↵↵https://www.toptal.com/developers/hastebin/ovotejilaw.nim |
05:54:33 | FromDiscord | <Elegantbeef> First you know you can do `array[3, T]`? |
05:54:48 | FromDiscord | <Elegantbeef> Second `ItemStack` isnt a type |
05:55:19 | FromDiscord | <Forest> What does `T` mean in that context? |
05:55:26 | FromDiscord | <Forest> Also i didn't realize lol thanks |
05:55:35 | FromDiscord | <Elegantbeef> the type the array holds |
05:55:42 | FromDiscord | <Elegantbeef> so in your case `array[3, array[3,char]]` |
05:58:41 | FromDiscord | <Elegantbeef> `T` is generally used in nim as a default generic parameter name, so a lot of pseudo code uses it |
05:58:50 | FromDiscord | <Forest> Ah okay |
05:59:40 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PV4 |
06:01:46 | FromDiscord | <Elegantbeef> `import std/strutils` |
06:03:45 | FromDiscord | <Forest> Oh i forgot about that lol |
06:04:55 | FromDiscord | <Elegantbeef> And welcome to the `.()` operator noisy errors 😛 |
06:18:05 | FromDiscord | <Forest> XD |
06:18:15 | FromDiscord | <Forest> For Enums do i have to define all variables manually? |
06:18:37 | FromDiscord | <Elegantbeef> "all variables"? |
06:18:40 | FromDiscord | <Forest> If so... I'm gonna have fun 😅 |
06:18:44 | FromDiscord | <Forest> Values |
06:18:51 | FromDiscord | <Forest> Fields? |
06:18:51 | NimEventer | New Nimble package! dogapi - Dog API client, see https://github.com/thexxiv/dogapi-nim |
06:19:07 | FromDiscord | <Elegantbeef> You need the enumerated values explicitly yes |
06:19:29 | FromDiscord | <Forest> Rip |
06:19:38 | FromDiscord | <Forest> How do i define an enum in Nim then? :P |
06:20:14 | nrds | <Prestige99> Why don't you want to do so? |
06:20:34 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#types-enumeration-types |
06:20:56 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3PV7 |
06:20:58 | FromDiscord | <Forest> In reply to @nrds "<Prestige> Why don't you": Just more boilerplate then i expected to do aha |
06:21:10 | FromDiscord | <ynfle> (edit) "https://play.nim-lang.org/#ix=3PV7" => "https://play.nim-lang.org/#ix=3PV8" |
06:21:31 | nrds | <Prestige99> Can you explain what you're trying to do? Can't think of a language where you don't manually declare your enum states |
06:21:36 | FromDiscord | <Elegantbeef> Well nim is static, dynamic enums make 0 sense |
06:22:05 | FromDiscord | <Forest> Well it's already defined in the Java code so i thought I'd just be able to use that :p |
06:22:34 | FromDiscord | <Elegantbeef> I mean copy paste it with a slight change |
06:22:42 | FromDiscord | <Elegantbeef> Multiline editing isnt magic |
06:22:42 | FromDiscord | <Forest> In reply to @nrds "<Prestige> Can you explain": Currently I'm glueing Java code with Nim via JS (with GraalVM acting as the translator) |
06:22:50 | nrds | <Prestige99> :o |
06:22:50 | FromDiscord | <Forest> I'm doing this on mobile |
06:22:53 | FromDiscord | <Forest> With nano |
06:23:05 | FromDiscord | <Elegantbeef> Nisha is that you? |
06:23:08 | nrds | <Prestige99> may god have mercy on your soul |
06:23:09 | FromDiscord | <Forest> Yup :D |
06:23:12 | FromDiscord | <Forest> XD |
06:23:55 | FromDiscord | <Forest> I also need to actually make sure the code is... Casted? Back to the JS counterpart when compiling it |
06:26:56 | FromDiscord | <Forest> Anyone have an idea on how to do that? :P |
06:30:06 | FromDiscord | <Elegantbeef> No clue what you mean |
06:39:31 | FromDiscord | <Forest> I still need to use the Enum values already defined in Java, and defining them all myself is funky because of the extra data they have :p |
06:40:03 | FromDiscord | <Elegantbeef> Well then match the JS code |
06:42:03 | FromDiscord | <Forest> With `importjs`? |
06:42:10 | FromDiscord | <Elegantbeef> Yea |
06:44:10 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PVc |
06:45:02 | FromDiscord | <Elegantbeef> In that case make constants i guess |
06:45:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PVd |
06:46:24 | FromDiscord | <Forest> Aight thanks! |
06:46:40 | FromDiscord | <Forest> Time to make a very crude script to automatically do this because I'm not doing this by hand lol |
06:55:36 | * | mahlon quit (Ping timeout: 272 seconds) |
06:58:39 | * | mahlon joined #nim |
07:01:14 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PVh |
07:02:47 | FromDiscord | <Elegantbeef> `Ice` |
07:02:51 | FromDiscord | <Elegantbeef> Export markers |
07:03:48 | FromDiscord | <Forest> O ye |
07:03:57 | * | Gustavo6046 quit (Quit: Leaving) |
07:04:53 | FromDiscord | <Forest> It didn't work but i need sleep because it's 7 AM |
07:05:00 | FromDiscord | <Forest> I'll post the error tomorrow |
07:12:29 | * | vicfred joined #nim |
07:13:41 | * | vicfred_ joined #nim |
07:14:01 | * | vicfred_ quit (Remote host closed the connection) |
07:17:09 | * | vicfred quit (Ping timeout: 256 seconds) |
07:29:01 | * | PMunch joined #nim |
07:51:21 | FromDiscord | <Aspirus> how can i |
07:51:39 | FromDiscord | <Rika> yeah |
07:55:14 | FromDiscord | <creikey> @treeform I'm tentatively looking to work on porting windy to the web, should it be webassembly via emscripten and the build cache or the nim js backend? |
09:49:59 | FromDiscord | <fbpyr> hi there. 👋 ↵potential noob question(coming from python)\: ↵is there a lib or way to bundle git (or minimal parts of it) into my nim application, ↵so that I could clone and pull even on a machine, which has no git installed? |
09:50:25 | FromDiscord | <Elegantbeef> You'd probably use `libgit` and ship the library with the binary |
09:51:55 | FromDiscord | <fbpyr> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: ah, thank you for the quick response 🙂. libgit would be a nim lib or the c-lib from official git? |
09:53:09 | FromDiscord | <Elegantbeef> It'd be the C lib with Nim bindings |
09:53:42 | FromDiscord | <Elegantbeef> For instance https://github.com/disruptek/gittyup |
09:54:05 | FromDiscord | <Elegantbeef> That's a higher level libgit wrapper, there is also the lowerlevel one it's based on |
09:54:28 | FromDiscord | <fbpyr> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: amazing - thank you so much! |
09:55:12 | FromDiscord | <Elegantbeef> No problem |
09:59:59 | FromDiscord | <haxscramper> so far this is the only library that used hcparse to wrap anything. It does not cover the full git API, so you might need to go down to https://github.com/haxscramper/hlibgit2 if there is something missing |
10:00:07 | FromDiscord | <haxscramper> [fbpyr](https://matrix.to/#/@fbpyr:tchncs.de)\: |
10:00:41 | FromDiscord | <Elegantbeef> With you typing in matrix and discord for a second there i thought you needed twice as many chat clients to curse me out 😛 |
10:11:44 | FromDiscord | <fbpyr> [haxscramper](https://matrix.to/#/@haxscramper:matrix.org)\: thank you for the heads-up, luckily currently I only need clone and fetch/pull .↵working currently through the example, wich works pretty well so far.. 😌 |
10:13:26 | * | nixfreaknim[m] quit (Quit: Bridge terminating on SIGTERM) |
10:13:26 | * | happycorsair[m] quit (Quit: Bridge terminating on SIGTERM) |
10:13:27 | * | cheer[m] quit (Quit: Bridge terminating on SIGTERM) |
10:13:27 | * | xiamx quit (Quit: Bridge terminating on SIGTERM) |
10:16:00 | supakeen | well this is unreadable |
10:17:33 | FromDiscord | <Elegantbeef> Is there a follow up? |
10:17:57 | FromDiscord | <Elegantbeef> Context is required! |
10:18:15 | PMunch | Yeah, what is unreadable? |
10:18:21 | * | cheer[m] joined #nim |
10:18:33 | FromDiscord | <Elegantbeef> Must be looking at my code |
10:18:35 | * | happycorsair[m] joined #nim |
10:18:48 | * | xiamx joined #nim |
10:18:48 | * | nixfreaknim[m] joined #nim |
10:20:42 | PMunch | Haha :P |
10:21:38 | FromDiscord | <Elegantbeef> Narrator\: "And supakeen quickly closed Beef's code, blurting out 'no I was not'" |
10:22:04 | supakeen | no not the code, just the amount of meta data on the IRC messages |
10:22:15 | PMunch | Meta-data? |
10:22:19 | supakeen | 10:11 <FromDiscord> <fbpyr> [haxscramper](https://matrix.to/#/@haxscramper:matrix.org)\: thank you for the heads-up, luckily currently I only need clone and fetch/pull .↵working currently through the example, wich works pretty well so far.. 😌 |
10:22:24 | FromDiscord | <Elegantbeef> Ah matrix -\> discord -\> Irc is hell apparently |
10:22:36 | PMunch | Oooh :P |
10:22:49 | supakeen | i can safely be ignored on this :) |
10:22:51 | PMunch | I have a script in my IRC cleans that cleans that up for me |
10:22:58 | supakeen | just a regular old grumpy IRC user |
10:23:05 | PMunch | s/cleans/client/ |
10:23:20 | FromDiscord | <Elegantbeef> Lol your message caused element to go "Nope" 'Can't load this message (m.room.message)Submit logs' |
10:23:35 | PMunch | Haha, the regex one? |
10:23:48 | FromDiscord | <Elegantbeef> Nah the paste supakeen made with the matrix links |
10:23:56 | PMunch | Oooh :P |
10:24:13 | FromDiscord | <planetis> how can 'let b = not false work but not this https://play.nim-lang.org/#ix=3PVV |
10:24:55 | PMunch | Because that is parsed as (not s).uint8 |
10:24:59 | FromDiscord | <Elegantbeef> Cause `not false` has a bool op |
10:25:04 | FromDiscord | <Elegantbeef> No it's not |
10:25:12 | PMunch | Yes it is? |
10:25:17 | FromDiscord | <Elegantbeef> It's parsed as `not(uint8(s))` |
10:25:36 | FromDiscord | <Elegantbeef> dot binds tighter than spaced unary |
10:25:49 | PMunch | Oh |
10:25:55 | PMunch | I was wrong then |
10:26:07 | FromDiscord | <Elegantbeef> It's cause there is a specialized bool operator |
10:26:23 | PMunch | Ah right |
10:26:25 | FromDiscord | <Elegantbeef> `States(not s.uint8)` is doing a integer conversion to enum which is checked |
10:26:41 | FromDiscord | <Elegantbeef> The enum's range is 0..1 and `not 0` is `255` |
10:27:00 | PMunch | So it goes s.uint8, that is 0, not 0 is 255, then States(255) not possible |
10:27:00 | FromDiscord | <planetis> nice `States(not s.bool)` works |
10:27:14 | FromDiscord | <Elegantbeef> Yep |
10:27:33 | PMunch | Which means that this work: https://play.nim-lang.org/#ix=3PVX |
10:27:34 | FromDiscord | <Elegantbeef> Not doesnt make sense on other enums aside from `bool` really |
10:27:42 | PMunch | But is very likely not what you where trying to do :P |
10:28:45 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3PVY |
10:29:12 | FromDiscord | <Elegantbeef> This isnt a generalizable problem imo `not`ing an enum make much sense |
10:29:22 | FromDiscord | <planetis> I am just trying to switch between them |
10:29:37 | PMunch | Isn't generalizable? Not with that attitude! |
10:29:38 | FromDiscord | <planetis> also `States(1 - s.ord)` works |
10:29:39 | FromDiscord | <Elegantbeef> Yes I know |
10:30:24 | FromDiscord | <Elegantbeef> Well yea you can do it a lot of different ways |
10:30:33 | PMunch | You could easily write a not macro which inspects the type and then if there are two fields switches between them! Easy! |
10:30:43 | FromDiscord | <Elegantbeef> lol |
10:30:46 | FromDiscord | <planetis> lol |
10:31:10 | FromDiscord | <Elegantbeef> `proc not[T: TwoValueEnum](val: T): T` 😛 |
10:31:31 | PMunch | That could work as well, and then a concept for TwoValueEnum? |
10:31:39 | FromDiscord | <Elegantbeef> yea |
10:31:45 | PMunch | But how would you switch? Given arbitrary values for the enum? |
10:31:58 | FromDiscord | <Elegantbeef> One second i'll show |
10:32:30 | FromDiscord | <Rika> Not all two valued enumerations are sensibly “not” able |
10:32:47 | FromDiscord | <Elegantbeef> The answer is just a case statement though |
10:35:23 | * | jmdaemon quit (Ping timeout: 272 seconds) |
10:36:05 | PMunch | See, easy! https://play.nim-lang.org/#ix=3PW1 |
10:36:37 | * | jmdaemon joined #nim |
10:37:05 | FromDiscord | <Elegantbeef> Using a macro 0/10 |
10:37:15 | FromDiscord | <Rika> “Unable to not” |
10:37:16 | FromDiscord | <Rika> Lmao |
10:37:21 | FromDiscord | <Rika> I am unable to can |
10:37:37 | FromDiscord | <planetis> thanks guys I wrote ``proc `not`(x: States): States = States(not x.bool)`` |
10:38:02 | FromDiscord | <planetis> In reply to @PMunch "See, easy! https://play.nim-lang.org/#ix=3PW1": thats nice as well |
10:38:03 | PMunch | @planetis, be aware though that if your values aren't 0 and 1 this will fail |
10:38:09 | PMunch | Your solution that is |
10:38:26 | Amun-Ra | yes, for example it's going to fail for this Bool: https://thedailywtf.com/articles/what_is_truth_0x3f_ |
10:38:29 | PMunch | As an aside you don't have to give enums values, they will enumerate themselves if you don't |
10:38:50 | FromDiscord | <planetis> ok I don't plan to generalize it anyway |
10:39:11 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3PW2 pmunch mine is cooler 😛 |
10:39:16 | PMunch | Amun-Ra, oh yikes |
10:39:34 | FromDiscord | <Rika> Boolean: True, False, Indeterminate |
10:39:43 | FromDiscord | <planetis> btw did you now that `high(myarray)` returns `range[0..something]` |
10:39:44 | FromDiscord | <Elegantbeef> Quadnary |
10:39:48 | PMunch | Oh, high and low. Sneaky! |
10:39:52 | FromDiscord | <Elegantbeef> Yes |
10:39:56 | PMunch | I was wondering how you would go about doing that |
10:40:05 | FromDiscord | <Rika> In reply to @Rika "Boolean: True, False, Indeterminate": Oh throw in Undefined here too |
10:40:12 | FromDiscord | <planetis> mod used to work the same and it was removed |
10:40:21 | Amun-Ra | Rika: and nil ;> |
10:40:31 | FromDiscord | <Rika> Eh null can be bunched in with undefined |
10:40:39 | PMunch | @planetis, wait what? |
10:40:52 | PMunch | `high(myarray)` returns the highest index, no? |
10:41:04 | FromDiscord | <Elegantbeef> Yea but it's a subrange type |
10:41:05 | FromDiscord | <planetis> `x mod 4` used to be `range[0..3]` |
10:41:14 | FromDiscord | <Elegantbeef> !eval echo typeof([10, 20].high) |
10:41:16 | NimBot | range 0..1(int) |
10:41:37 | Amun-Ra | Rika: nil would indicate absence of a value while undefined presence of one we don't know |
10:41:45 | PMunch | Huh, didn't know that |
10:41:52 | PMunch | Is it actually defined as a range though? |
10:41:53 | FromDiscord | <Rika> In reply to @Amun-Ra "<@259277943275126785>: nil would indicate": Then indeterminate |
10:42:05 | FromDiscord | <Elegantbeef> What do you mean? |
10:42:15 | FromDiscord | <Elegantbeef> Arrays are implicitly converted into `array[range, type]` |
10:42:20 | PMunch | !eval for i in [10, 20].high: stdout.write "." |
10:42:21 | NimBot | Compile failed: /usercode/in.nim(1, 18) Error: type mismatch: got <range 0..1(int)> |
10:42:22 | Amun-Ra | Rika: I would use indeterminate for something we don't even know is null or undefined ;) |
10:42:25 | FromDiscord | <Elegantbeef> !eval typeof([2, 3, 4])\` |
10:42:27 | NimBot | Compile failed: /usercode/in.nim(1, 20) Error: identifier expected, but got '[EOF]' |
10:42:37 | FromDiscord | <Elegantbeef> !eval typeof([2, 3, 4]) |
10:42:39 | NimBot | Compile failed: /usercode/in.nim(1, 7) Error: expression 'typeof([2, 3, 4])' is of type 'typedesc[array[0..2, int]]' and has to be used (or discarded) |
10:42:55 | FromDiscord | <Elegantbeef> Too tired apparently |
10:42:59 | FromDiscord | <Elegantbeef> So buh bye |
10:43:07 | PMunch | Oh right, so it's not an HSlice |
10:43:13 | PMunch | Yeah range makes more sense |
10:43:47 | PMunch | !eval var myArr: array[5..10, int]; echo typeof(myArr.high) |
10:43:49 | NimBot | range 5..10(int) |
10:43:55 | PMunch | Neat |
11:06:10 | * | krux02 joined #nim |
11:09:11 | nrds | <Abrax99> where is this bridged too? |
11:09:35 | FromDiscord | <Rika> Discord and IRC and matrix |
11:09:44 | * | gsalazar joined #nim |
11:10:19 | nrds | <Abrax99> you on irc or discord Rika? |
11:10:25 | nrds | <Abrax99> or matrix? |
11:13:06 | FromDiscord | <Rika> Discord |
11:15:06 | * | rwb is now known as rb |
11:22:55 | FromDiscord | <Aspirus> In reply to @Amun-Ra "yes, for example it's": among us |
11:23:53 | FromDiscord | <Aspirus> sent a code paste, see https://play.nim-lang.org/#ix=3PW9 |
11:24:14 | FromDiscord | <Aspirus> sent a code paste, see https://play.nim-lang.org/#ix=3PWa |
11:24:38 | FromDiscord | <aph> no bots in discord 😔 |
11:24:45 | FromDiscord | <aph> though there are in irc |
11:28:19 | FromDiscord | <Waldecir Santos> what sugar is called with `repr` for an object ? |
11:31:02 | FromDiscord | <Waldecir Santos> Oops I think I just need to implement it |
11:49:17 | PMunch | What do you mean what sugar? |
11:49:23 | PMunch | I believe repr is built-in |
11:49:58 | PMunch | Yup, it's "magic" https://nim-lang.org/docs/system.html#repr%2CT |
11:50:06 | PMunch | Meaning that it is implemented in the compiler itself |
11:50:15 | nrds | <Abrax99> ah discord |
11:50:17 | nrds | <Abrax99> coo |
11:51:08 | FromDiscord | <Waldecir Santos> Yeah I was trying to implement a `repr` for my custom object, the soultion was to just create `↵ proc repr(obj: MyObject): string =` |
11:55:11 | FromDiscord | <Waldecir Santos> Does nim have `classmethods` like python ? |
11:55:13 | NimEventer | New Nimble package! shorteststring - word size strings stored in an integer, see https://github.com/metagn/shorteststring |
11:55:32 | FromDiscord | <Waldecir Santos> Does nim have classmethods like python ? |
11:55:59 | PMunch | Classmethods? |
11:58:25 | FromDiscord | <Yepoleb> Iirc classmethods are defined in a base class and get a classobject of the class they are actually called from as the first parameter |
12:00:43 | FromDiscord | <konsumlamm> Nim doesn't even have normal python-like methods |
12:01:38 | FromDiscord | <konsumlamm> you can have a function that takes a `typedesc[MyType]` as first parameter, so that you can call it like `MyType.myProc(...)` |
12:03:21 | PMunch | Yeah, that is similar to a static method in Python. A class method I guess would be more akin to one which takes a generic instance with static data in it |
12:04:52 | FromDiscord | <Waldecir Santos> perfect @konsumlamm that is what I need, Thank you |
12:05:12 | PMunch | Do you need that though? |
12:05:17 | PMunch | What are you actually trying to do? |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:30 | * | supakeen joined #nim |
12:07:43 | FromDiscord | <konsumlamm> a class method is kinda useless, since you get access to the "class" (the type) anyway thrugh static typing |
12:08:10 | FromDiscord | <konsumlamm> so the distinction between static and class method isn't that useful in a statically typed language (disregarding subtyping) |
12:12:22 | FromDiscord | <fbpyr> sent a long message, see https://paste.rs/46G |
12:14:23 | FromDiscord | <Rika> In reply to @NimEventer "New Nimble package! shorteststring": interesting |
12:15:24 | FromDiscord | <konsumlamm> sounds pretty useless, ngl |
12:15:58 | FromDiscord | <Rika> i mean sure |
12:16:32 | FromDiscord | <Yepoleb> I think classmethods are used pretty much exclusively for factory functions. So you can call `from_json` for example on a subclass and get the correct object. |
12:17:38 | FromDiscord | <Rika> so just like a first param `typedesc[T]` where T is the "subclass"? |
12:17:57 | FromDiscord | <Yepoleb> I think so |
12:19:11 | PMunch | You could also argue that this is a nice feature: http://ix.io/3PWs |
12:19:17 | FromDiscord | <Forest> What is all this? https://media.discordapp.net/attachments/371759389889003532/944206433426239498/Screenshot_2022-02-18-12-19-09-313_com.termux.jpg |
12:19:18 | PMunch | See how shoddy that looks in Nim? |
12:19:53 | PMunch | @fbpyr, something like `repr` perhaps? |
12:22:30 | * | jmdaemon quit (Ping timeout: 260 seconds) |
12:24:22 | PMunch | @fbpyr, it seems like `error` was never defined in that library, I think it was just an illustration.. |
12:24:38 | FromDiscord | <Rika> who are you replying to |
12:25:14 | PMunch | The person who sent this: sent a long message, see https://paste.rs/46G |
12:25:56 | PMunch | Uhm @Forest, what are you reading? |
12:27:53 | FromDiscord | <jmgomez> Im getting this warning when trying to execute↵choosenim.exe update 1.6.4 https://media.discordapp.net/attachments/371759389889003532/944208598018449418/unknown.png |
12:27:58 | PMunch | @fbpyr, I think it was meant to be this procedure: https://nim-lang.org/docs/logging.html#error.t%2Cvarargs%5Bstring%2C%5D |
12:28:12 | PMunch | The example just forgets to import the logging module |
12:28:31 | PMunch | @jmgomez, yeah that's a false positive |
12:28:52 | FromDiscord | <Rika> the hell is choosenim gonna do on android xd |
12:29:17 | PMunch | I guess it might work in Termux |
12:29:35 | FromDiscord | <jmgomez> lol ok |
12:30:09 | FromDiscord | <jmgomez> is it normal to found discrepances using the same compiler (clang) in win vs linux? Never encounter that In cpp |
12:30:36 | PMunch | What kind of discrepancies? |
12:31:15 | FromDiscord | <jmgomez> Im struggling to know what's going on in a function that accepts a function bind from nim and the function send over cpp. In linux works just find, In windows it stops (and no crash or error message) |
12:31:52 | PMunch | How is the function defined? |
12:32:11 | FromDiscord | <jmgomez> https://media.discordapp.net/attachments/371759389889003532/944209681914658866/unknown.png |
12:32:35 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix= |
12:32:46 | PMunch | Why does everyone suddenly insist on sending images of text? When did people stop knowing how to use Ctrl+x ctrl+v? |
12:32:54 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3PWv |
12:33:00 | PMunch | Nothing against you personally @jmgomez :P |
12:33:12 | PMunch | Try to use cint |
12:33:18 | FromDiscord | <jmgomez> I think it's win fault, it just quicker |
12:33:19 | FromDiscord | <jmgomez> ok |
12:33:46 | PMunch | Nims int is always the same size as a pointer, and might differ from C/C++'s int type |
12:34:14 | FromDiscord | <Forest> In reply to @PMunch "Uhm <@909883978717204561>, what are": It's the outputted JS code from Nim's JS backend, i know it's not meant to be human readable odd |
12:34:32 | FromDiscord | <Forest> In reply to @PMunch "Why does everyone suddenly": Because it's a giant file :p |
12:34:45 | FromDiscord | <jmgomez> In reply to @PMunch "Nims int is always": Good to know. Just changed it but it keeps doing the same |
12:35:23 | PMunch | @Forest, you don't need to copy paste the entire file, you can copy a selection |
12:36:01 | PMunch | Hmm, try to use {.exportc, cdecl.}, but I guess that might be what {.test.} does |
12:37:31 | FromDiscord | <jmgomez> cdecl was missing, just added it and it does the same |
12:37:43 | FromDiscord | <jmgomez> what bothers me most is that it works fine in linux |
12:38:00 | PMunch | What can I say, superior OS :P |
12:38:12 | FromDiscord | <Forest> In reply to @PMunch "I guess it might": It'd work if there arm is supported |
12:38:15 | FromDiscord | <Forest> In reply to @PMunch "<@909883978717204561>, you don't need": Aight |
12:38:30 | PMunch | Do you cross compile or compile on the Windows machine? |
12:39:03 | FromDiscord | <jmgomez> In reply to @PMunch "What can I say,": xD it may be but Im evaluating nim to output code for different archs/os. Im compiling in a windows machine |
12:39:49 | PMunch | Oh wait, is the function defined in C? |
12:40:28 | FromDiscord | <jmgomez> I tried both, a function defined in C and a function defined in nim. Both scenarios work in linux and both fails in win |
12:40:38 | PMunch | Then you probably need to do `proc callbackTest(arg: cint, fun: proc(arg: cint): cint {.cdecl.}): cint {.exportc, cdecl.}` |
12:41:31 | PMunch | By the way, do you load this as a dynamic library or as a static library? |
12:43:31 | FromDiscord | <jmgomez> ohh that worked! |
12:43:57 | FromDiscord | <jmgomez> Thanks man! ↵Im planning to do both (iOS requires static). I need to consider something else? |
12:44:53 | FromDiscord | <jmgomez> I guess you cant add pragmas with the short sugar syntax right? |
12:47:14 | FromDiscord | <Rika> you cannot |
12:47:37 | * | enyc quit (Ping timeout: 240 seconds) |
12:50:40 | FromDiscord | <konsumlamm> i thought you can? |
12:50:51 | FromDiscord | <konsumlamm> you're talking about `sugar.->`, right? |
12:51:20 | FromDiscord | <konsumlamm> at least the documentation says it supports pragmas and there's an example for it |
12:51:32 | FromDiscord | <Rika> eh did i forget again |
12:51:41 | FromDiscord | <Rika> maybe im remembering 1.0 days |
12:52:35 | FromDiscord | <konsumlamm> the pragmas go before the `->` afaict |
12:52:53 | PMunch | @jmgomez, happy to help :) |
12:53:09 | PMunch | You might want to check out Genny by the way: https://github.com/treeform/genny |
12:53:24 | FromDiscord | <konsumlamm> so e.g. `fun : (cint) {.cdecl.} -> cint` |
12:53:29 | PMunch | Haven't tried it myself, but it promises to make Nim/C interactions easier (and other languages) |
12:53:29 | FromDiscord | <konsumlamm> (edit) "`fun :" => "`fun:" |
13:01:02 | PMunch | fun, fun, fun |
13:07:39 | FromDiscord | <jmgomez> Looks really nice! |
13:08:04 | FromDiscord | <jmgomez> btw what's the preferred way to pass data over? raw pointers and using ptr in nim side of things? |
13:12:02 | PMunch | It depends a bit |
13:12:22 | PMunch | You need to make sure that the garbage collection isn't messing things up for your |
13:12:34 | PMunch | But in general it tends to be very C-like with a lot of pointers |
13:13:35 | FromDiscord | <jmgomez> 👍 |
13:15:47 | PMunch | treeform, I'm looking at the pixie and pixie-python packages and the Python one seems to lack behind the Nim one. Is there any particular reason for that? |
13:17:35 | PMunch | @jmgomez, of course normally you'd create some nice abstraction in Nim |
13:30:54 | FromDiscord | <Evrensel Kişilik> hewwoooo |
13:31:00 | FromDiscord | <Evrensel Kişilik> is there anyone using Arch???????????? |
13:33:40 | PMunch | Yes, how so? |
13:34:06 | PMunch | By the way, if you save your question marks you can ask a lot more questions |
13:34:13 | PMunch | Don't want to waste them all at the same time |
13:34:31 | FromDiscord | <Evrensel Kişilik> 😱 |
13:34:35 | FromDiscord | <Evrensel Kişilik> sooooooooooooooooooooooooooooooooooooooooooo |
13:34:47 | PMunch | Welp, there goes all your O's for the day |
13:34:57 | FromDiscord | <Evrensel Kişilik> 😱 |
13:35:06 | FromDiscord | <Evrensel Kişilik> https://aur.archlinux.org/packages/gdb-frontend-bin can you try installing this package?????????????????? |
13:35:37 | PMunch | Again with the question marks... |
13:35:58 | FromDiscord | <Evrensel Kişilik> In reply to @PMunch "Again with the question": no lol |
13:36:11 | FromDiscord | <Evrensel Kişilik> someone told me there is an issue with package |
13:36:40 | FromDiscord | <Evrensel Kişilik> we should test if it is installing correctly 😱 |
13:39:01 | PMunch | Should we? |
13:39:09 | PMunch | Wait, what does this have to do with Nim? |
13:41:22 | PMunch | Seems to install fine here |
13:42:28 | FromDiscord | <Evrensel Kişilik> In reply to @PMunch "Seems to install fine": oh |
13:42:34 | FromDiscord | <Evrensel Kişilik> thank youuuuuuuuu |
13:43:16 | FromDiscord | <Evrensel Kişilik> soooooooooo someone told me that better the package use could use setup.py |
13:43:33 | FromDiscord | <Evrensel Kişilik> instead of copying app to /opt |
13:43:56 | FromDiscord | <Evrensel Kişilik> and i made it buuuut another one told me that the package is not installing correctly |
13:44:18 | FromDiscord | <Evrensel Kişilik> and i fixed it toooooo i had to test it buuuuuut i don't have Arch 😱 |
13:47:25 | * | keyehzh joined #nim |
13:55:32 | * | PMunch_ joined #nim |
13:55:42 | * | PMunch quit (Read error: Connection reset by peer) |
13:57:36 | * | PMunch_ is now known as PMunch |
13:57:39 | * | rockcavera joined #nim |
13:57:39 | * | rockcavera quit (Changing host) |
13:57:39 | * | rockcavera joined #nim |
14:03:31 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PWQ |
14:04:55 | PMunch | I'm guessing importjs doesn't allow instantiation like you do |
14:05:11 | FromDiscord | <Forest> I'm not trying to initialise it though? |
14:06:17 | PMunch | ` = newJsObject()` initialisation |
14:11:16 | * | arkurious joined #nim |
14:22:35 | FromDiscord | <Forest> Oh |
14:22:49 | FromDiscord | <Forest> But if I don't do that it doesn't work then :/ |
14:23:04 | PMunch | Try to declare it with `var` |
14:23:14 | PMunch | I have an open issue for a similar thing with C |
14:23:29 | FromDiscord | <Forest> Ah okay then |
14:24:08 | PMunch | Essentially a let requires initialization, but `importc`/`importjs` should waive this requirement, but it doesn't |
14:25:19 | FromDiscord | <Forest> Ah okay that makes sense |
14:25:50 | * | slowButPresent joined #nim |
14:26:03 | FromDiscord | <auxym> Odd, I haven't had issues with `let` and `importc`, see https://github.com/beef331/picostdlib/blob/master/src/picostdlib/pio.nim#L24. Does it show up in specific cases? |
14:26:41 | FromDiscord | <Forest> Still getting the same error: https://www.toptal.com/developers/hastebin/qanijoniqi.nim |
14:26:46 | FromDiscord | <Forest> On line 7 |
14:29:34 | PMunch | auyxm, hmm, maybe that one is fixed then |
14:32:03 | PMunch | Aha, apparently it was indeed fixed: https://github.com/nim-lang/Nim/issues/14253 |
14:32:26 | PMunch | I guess maybe it got fixed for importc but not importjs.. |
14:34:13 | PMunch | @Forest, oh the pragma needs to go after the name but before the colon |
14:34:50 | FromDiscord | <Forest> Ohh |
14:36:54 | FromDiscord | <Forest> Thanks it's working now! |
14:44:38 | FromDiscord | <auxym> should a new issue be opened for importjs then? |
14:45:43 | PMunch | Probably, but first of course verify that it is the case |
14:50:51 | * | PMunch quit (Quit: Leaving) |
14:55:53 | FromDiscord | <gerwy> yoo Kisilik the person from GDBFrontend :>> |
14:56:12 | FromDiscord | <gerwy> @Evrensel Kişilik how is adding nim feature going? |
14:57:31 | FromDiscord | <Evrensel Kişilik> In reply to @Life Sucks "<@!359071052397281280> how is adding": i don't have time now buuut i will improve Nim debugging experience soooon 😱 |
14:59:20 | * | xaltsc joined #nim |
15:05:55 | FromDiscord | <gerwy> suure, good luck and waiting for it :3 |
15:10:22 | * | vicecea quit (Remote host closed the connection) |
15:10:53 | * | vicecea joined #nim |
15:21:48 | FromDiscord | <Nick.> Learning how to code in Nim. Is there a module that pause the program until a key is pressed? |
15:24:01 | FromDiscord | <Rika> `stdin.readChar()`? |
15:24:34 | FromDiscord | <Rika> you have to discard it if you dont need what key was pressed, which i assume you dont |
15:24:35 | FromDiscord | <Rika> so |
15:24:41 | FromDiscord | <Rika> `discard stdin.readChar()` |
15:24:43 | FromDiscord | <Rika> i assume will work |
15:25:18 | FromDiscord | <Nick.> Should be a simple one. I just want to wait before closing the program. "Press any key to close my terminal" |
15:26:32 | FromDiscord | <Rika> `echo "Press any key to close my terminal"; discard stdin.readChar; #[i assume after this your program has no more code, otherwise...]# quit()` |
15:27:21 | FromDiscord | <Nick.> Yep, that's it. |
15:27:47 | FromDiscord | <Nick.> thanks you. So always discard when don't need it. |
15:28:00 | FromDiscord | <Rika> if you dont need the result of a procedure yes |
15:28:56 | FromDiscord | <Nick.> thanks 🙂 |
15:29:45 | FromDiscord | <Nick.> I do see you use ; is that optional to add? |
15:29:59 | FromDiscord | <Nick.> after every command in nim? |
15:31:00 | * | euantorano quit (Ping timeout: 240 seconds) |
15:31:19 | FromDiscord | <Rika> Uh optional, only for one liners that I put |
15:31:28 | FromDiscord | <Rika> They can be swapped with line breaks |
15:31:56 | * | euantorano joined #nim |
15:47:22 | FromDiscord | <Evrensel Kişilik> In reply to @Life Sucks "suure, good luck and": i would like that if someone could contribute to project 😊 |
15:47:39 | FromDiscord | <Evrensel Kişilik> are you using Nim with Godot??? |
15:50:36 | FromDiscord | <gerwy> Im planning on using nim bindings |
15:51:10 | FromDiscord | <gerwy> In reply to @Evrensel Kişilik "i would like that": And sorry but from what i remember its JS or TS and i dont feel very comfortable with using those |
15:51:15 | FromDiscord | <gerwy> I don like em |
15:53:28 | FromDiscord | <Evrensel Kişilik> In reply to @Life Sucks "And sorry but from": oh ok |
16:07:29 | FromDiscord | <auxym> I'm also not up for contribution for various reasons (also no familiar with js&co), but a nice, friendly graphical debugger for nim would be a game changer in terms of the current tooling situation for nim, IMO |
16:15:49 | FromDiscord | <Evrensel Kişilik> In reply to @auxym "I'm also not up": sooooo buuuut the best way for very flexible UIs is JS 😊 |
16:22:21 | FromDiscord | <treeform> In reply to @PMunch "<@107140179025735680>, I'm looking at": No we are just lazy |
16:24:03 | FromDiscord | <treeform> In reply to @creikey "<@!107140179025735680> I'm tentatively looking": Wasm all the way, emscripten has a windowing api |
16:26:21 | FromDiscord | <treeform> https://emscripten.org/docs/api_reference/html5.h.html#html5-h |
16:51:21 | FromDiscord | <Forest> Someone written a wrapper for emscripten in Nim yet? |
16:58:09 | * | ltriant quit (Read error: Connection reset by peer) |
16:58:25 | * | ltriant joined #nim |
17:05:13 | FromDiscord | <Evrensel Kişilik> In reply to @Forest "Someone written a wrapper": you can build C sources for WebAssembly |
17:05:32 | FromDiscord | <Hamid_Bluri> https://github.com/treeform/nim_emscripten_tutorial |
17:05:33 | FromDiscord | <Hamid_Bluri> ? |
17:08:42 | FromDiscord | <Forest> Ah neat |
17:14:37 | * | jjido joined #nim |
17:31:55 | * | keyehzh quit (Remote host closed the connection) |
17:45:48 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
17:49:28 | * | jjido joined #nim |
17:59:54 | FromDiscord | <Forest> Anyone know how I'd import all files in a directory? |
18:00:08 | FromDiscord | <Forest> I just need to include/import it at compile time |
18:00:22 | FromDiscord | <Forest> I'm probably gonna have a ton of files and don't wanna import them all manually lol |
18:00:32 | FromDiscord | <Forest> (I also don't need direct references) |
18:00:37 | * | enthus1ast joined #nim |
18:07:31 | * | enthus1ast quit (Quit: WeeChat 1.9.1) |
18:09:25 | FromDiscord | <BhamidipatiNikhil> In reply to @Forest "Anyone know how I'd": I think we can use templates for this... |
18:09:47 | FromDiscord | <Forest> Oh? How? |
18:12:35 | * | jmdaemon joined #nim |
18:21:45 | FromDiscord | <BhamidipatiNikhil> sent a code paste, see https://play.nim-lang.org/#ix=3PY6 |
18:22:41 | FromDiscord | <Forest> Ah okay |
18:23:00 | FromDiscord | <Forest> Well i still need to figure out the last bit aha |
18:23:04 | FromDiscord | <Forest> Thanks though! |
18:28:02 | FromDiscord | <demotomohiro> How about to write a module that import all files and export them like this: https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer.nim |
18:30:26 | FromDiscord | <demotomohiro> @BhamidipatiNikhil Your code that reads list of file is executed at runtime, but import statements runs at compile time. |
18:31:48 | FromDiscord | <BhamidipatiNikhil> In reply to @demotomohiro "<@764483963422375946> Your code that": Oh yes... so i should include the for loop inside the template too and remove the step of taking input from user.... |
18:32:49 | FromDiscord | <demotomohiro> Even if it reads content of a directory at compile time, I dont think template cannot create import statement from a list of path. Macros can do it. |
18:37:56 | FromDiscord | <BhamidipatiNikhil> In reply to @demotomohiro "Even if it reads": Oh yes, because imports are allowed only at top level!! |
18:37:56 | FromDiscord | <demotomohiro> Just writing statememts under template doesn't make them executed at compile time. Here is how run code at compile time:https://internet-of-tomohiro.netlify.app/nim/faq.en.html#compile-time-how-to-run-code-at-compile-timeqmark |
18:38:36 | FromDiscord | <BhamidipatiNikhil> (edit) "level!!" => "in the editor..." |
18:41:57 | FromDiscord | <BhamidipatiNikhil> In reply to @demotomohiro "Just writing statememts under": Yes, understood!... |
18:44:48 | FromDiscord | <demotomohiro> In reply to @BhamidipatiNikhil "Oh yes, because imports": Putting `import` statements in `template` is possible: https://play.nim-lang.org/#ix=3PYh |
18:45:38 | FromDiscord | <demotomohiro> But I don't think `template` cannot generate `import` statement from `seq[string]`. |
18:45:54 | FromDiscord | <auxym> yeah you'd need a macro for that |
18:46:51 | FromDiscord | <auxym> I have a macro that generates `{.compile: .}` pragmas at compile time to add C files to the build |
19:15:11 | FromDiscord | <Forest> Oh? |
19:19:24 | FromDiscord | <auxym> https://github.com/auxym/nim-on-samd21/blob/master/src/startup.nim you could probably do the same for import, just need to figure out the AST (eg using dumpast) |
19:52:19 | FromDiscord | <Waldecir Santos> Is it possible to store a type in a variable ? |
19:53:26 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3PYG |
19:53:35 | FromDiscord | <Waldecir Santos> Kinda this ☝️ |
19:55:42 | FromDiscord | <Waldecir Santos> I'm working on a "ORM" so I need to store the type |
19:59:07 | * | Gustavo6046 joined #nim |
19:59:19 | FromDiscord | <Waldecir Santos> right now I'm storing as string `var objtype = $typeof(Obj1)` |
20:14:14 | FromDiscord | <kodkuce> sent a code paste, see https://play.nim-lang.org/#ix=3PYM |
20:16:11 | FromDiscord | <kodkuce> should probaby posted this in webdev :( |
20:22:59 | FromDiscord | <kodkuce> dont think it is f will just rewrite it in c# no time for hole diving |
20:46:29 | FromDiscord | <cs> sent a code paste, see https://play.nim-lang.org/#ix=3PYS |
20:47:44 | FromDiscord | <cs> I have tried this a few different ways , but for some reason I can't get the channel float values so that I can invert them. Also, |
20:47:45 | FromDiscord | <cs> https://media.discordapp.net/attachments/371759389889003532/944334396138340362/unknown.png |
20:48:17 | FromDiscord | <auxym> In reply to @Waldecir Santos "Is it possible to": search keyword: `typedesc`. note however: typeof can only be used at compile time, types are a compile time thing. |
20:49:17 | FromDiscord | <cs> Another question: what is a way I can replicate the Ternary Operator so that the if else isn't so verbose? |
20:49:50 | FromDiscord | <auxym> In reply to @cs "What am I doing": when constructing your `Color` object, I'm pretty sure you need to use field names like `Color(field1: "val", ...)` |
20:50:27 | FromDiscord | <cs> In reply to @auxym "when constructing your `Color`": ok |
20:51:11 | FromDiscord | <cs> That seems to solve one of the issues. Thanks |
20:51:37 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=3PYU |
20:52:01 | FromDiscord | <auxym> can even put it all on 1 line if you want |
20:52:15 | * | jmdaemon quit (Ping timeout: 272 seconds) |
20:53:42 | FromDiscord | <cs> Any ideas on this? For some reason I can't access the Color channels as floats https://media.discordapp.net/attachments/371759389889003532/944335894838652938/unknown.png |
20:54:03 | FromDiscord | <auxym> not familiar with that library, can you link it please? |
20:54:29 | FromDiscord | <cs> In reply to @auxym "not familiar with that": https://nimdocs.com/treeform/chroma/chroma.html |
20:55:28 | FromDiscord | <auxym> try `clr.r`, `clr.g`, etc instead of `[]` indexing |
20:55:39 | FromDiscord | <auxym> the type doesnt have `[]` defined |
20:56:29 | FromDiscord | <cs> In reply to @auxym "try `clr.r`, `clr.g`, etc": Yep. That worked. Not sure why I didn't think of that |
20:58:21 | FromDiscord | <auxym> btw, it's a matter of taste, but I think it's more idiomatic nim to use implicit return with the automatic `result` variable rather than assign a new variable and return it. |
20:59:39 | FromDiscord | <cs> In reply to @auxym "btw, it's a matter": How does that actually work? Is it just assigning the return value to ``result``? |
20:59:47 | FromDiscord | <auxym> yes |
20:59:49 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=3PYW |
20:59:56 | FromDiscord | <auxym> result is implicitly returned |
20:59:58 | FromDiscord | <cs> In reply to @auxym "yes": Ok, that makes sense. |
21:05:36 | FromDiscord | <Forest> How would i use a Nim seq as an argument for a JS argument using importjs? |
21:05:54 | FromDiscord | <Forest> Since Nim does some special wrapping |
21:15:20 | FromDiscord | <Forest> :p |
21:28:21 | * | xet7 quit (Ping timeout: 272 seconds) |
21:36:25 | * | noeontheend joined #nim |
21:41:19 | * | xet7 joined #nim |
21:49:39 | * | jmdaemon joined #nim |
21:52:55 | * | noeontheend quit (Ping timeout: 256 seconds) |
22:08:16 | * | noeontheend joined #nim |
22:08:55 | FromDiscord | <System64 ~ Flandre Scarlet> Is it normal it's considered as a virus? https://media.discordapp.net/attachments/371759389889003532/944354824596643940/unknown.png |
22:10:05 | FromDiscord | <exelotl> yeah, certain nim binaries (`finish.exe` and `nimble.exe`) get falsely flagged by antivirus software all the time :( |
22:10:53 | FromDiscord | <System64 ~ Flandre Scarlet> AVs are dumb |
22:22:05 | * | PMunch joined #nim |
22:29:48 | * | jmdaemon quit (Ping timeout: 240 seconds) |
22:31:07 | PMunch | Hmm, I'm struggling creating the most basic destroy hook |
22:31:21 | PMunch | My program compiles and runs but the hook is never called |
22:31:38 | PMunch | My editor complains that it can't register another destroy hook |
22:38:32 | PMunch | Aha, apparently my `Test[T] = object; field: T` was too basic |
22:38:47 | PMunch | I changed it to `field: ptr T` and now it worked |
22:38:54 | PMunch | That seems like a strange limitation |
22:38:59 | PMunch | What if T was a pointer type? |
22:39:06 | * | jmdaemon joined #nim |
22:39:20 | PMunch | Ah, it also works if T is a `ptr int` for example |
22:39:27 | * | Gustavo6046 quit (Remote host closed the connection) |
22:39:27 | PMunch | Okay, less weird, still a bit weird |
22:39:47 | * | Gustavo6046 joined #nim |
22:40:57 | * | noeontheend quit (Ping timeout: 240 seconds) |
22:41:41 | PMunch | Ah damn it, I was hoping the VM would run the destructor at the end of the module scope if I created a destructor and created a {.compileTime.} variable :P |
22:42:11 | PMunch | Wanted to see if I could implement some macro magic which would check whether a certain proc had been called or not |
22:50:52 | nrds | <Prestige99> What fancy stuff are you making now PMunch? :P |
22:51:10 | PMunch | Haha, nothing in particular |
22:51:20 | PMunch | It's just something that I've wanted for a while |
22:52:06 | PMunch | This time it came up because I wanted Ratel to be able to tell if the setup and loop procedures where actually being run or not |
22:52:21 | PMunch | And throw a friendly hint that if you don't have them your program might not actually do anything |
22:58:17 | FromDiscord | <System64 ~ Flandre Scarlet> why do I have all thoses errors? https://media.discordapp.net/attachments/371759389889003532/944367244002099221/unknown.png |
23:04:18 | PMunch | It seems like your compiler and Nim doesn't agree on the size of an int |
23:04:36 | PMunch | And it seems like your terminal doesn't agree with itself about which characters goes where.. |
23:06:53 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "It seems like your": I never had this before |
23:07:41 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:07:50 | PMunch | It's probably because it's too small to output the whole line, and then Powershell in its infinite wisdom decides to wrap a line in-between two characters which aren't supposed to be wrapped between |
23:08:16 | PMunch | E.g. a CR and an LF (although this is more likely to be some multi-byte colour code or UTF-8) |
23:08:32 | FromDiscord | <System64 ~ Flandre Scarlet> PS uses UTF-8 |
23:08:52 | PMunch | Then it misinterprets those bytes since it is now something different than it was supposed to be and it garbles all the text |
23:09:05 | PMunch | Doesn't it use UTF-16 like the rest of MS products? |
23:09:12 | PMunch | I'd be surprised if it didn't |
23:13:09 | FromDiscord | <System64 ~ Flandre Scarlet> AH I see now https://media.discordapp.net/attachments/371759389889003532/944370984411074590/unknown.png |
23:16:01 | FromDiscord | <System64 ~ Flandre Scarlet> okay fixed |
23:17:09 | PMunch | Do you have five MinGW installs? |
23:17:24 | PMunch | Well, six now I guess if you grabbed the Nim one as well |
23:17:33 | FromDiscord | <Rika> Looks more like three |
23:17:40 | FromDiscord | <Rika> Wait four |
23:17:57 | PMunch | Still, that's N-1 too many |
23:18:04 | FromDiscord | <System64 ~ Flandre Scarlet> Taboo : Four of a Kind |
23:18:39 | FromDiscord | <System64 ~ Flandre Scarlet> btw, which is better? https://media.discordapp.net/attachments/371759389889003532/944372371433857034/unknown.png |
23:19:25 | FromDiscord | <Elegantbeef> nimsaem's |
23:19:56 | FromDiscord | <System64 ~ Flandre Scarlet> alright, thanks |
23:21:12 | FromDiscord | <Elegantbeef> You may need to use the workspace settings to get it to work 100% |
23:21:29 | FromDiscord | <Elegantbeef> https://github.com/saem/vscode-nim#options `nim.project` here |
23:30:03 | NimEventer | New post on r/nim by laker88: Nim cannot find a file, see https://reddit.com/r/nim/comments/svvl6p/nim_cannot_find_a_file/ |