<< 18-02-2022 >>

00:34:20*jmdaemon quit (Ping timeout: 272 seconds)
00:35:10*vicfred quit (Quit: Leaving)
00:36:15FromDiscord<exelotl> droidrage: there's not really any benefit in compiling to Vala since Vala and Nim both compile to C right?
00:37:11FromDiscord<exelotl> I believe gintro is the best Nim library for glib/gtk stuff though https://github.com/StefanSalewski/gintro
00:38:16FromDiscord<Forest> Why is the code generated by Nim's JS backend so dirty?
00:39:01FromDiscord<Forest> And how would i compile multiple modules for use?
00:39:18FromDiscord<Forest> (edit) "modules" => "nim files" | "use?" => "use with it?"
00:39:52FromDiscord<Forest> Tbh it'd be nice to not have such dirty output, since I'm using it in a CommonJS environment
00:41:31FromDiscord<Elegantbeef> Have you passed `-d:release` or `-d:danger`?
00:42:31FromDiscord<Elegantbeef> And what do you mean multiple nim files?
00:42:33FromDiscord<Elegantbeef> Just import then
00:42:42FromDiscord<Elegantbeef> import them\
00:49:09FromDiscord<Forest> Ah
00:49:18FromDiscord<Forest> Would importing them combine them into one file?
00:53:02FromDiscord<exelotl> I think so, haven't done a lot of Nim JS stuff
00:53:44FromDiscord<Forest> In reply to @Elegantbeef "Have you passed `-d:release`": It's still very cluttered lol
00:53:47FromDiscord<Forest> In reply to @exelotl "I think so, haven't": Fair
00:54:27FromDiscord<exelotl> if you're using nim to produce a library usable from nodejs or similar then I guess `--nomain` is your friend
00:54:27FromDiscord<Elegantbeef> Yes Nim does emit a single file
00:54:47droidrage> <exelotl> I believe gintro is the best Nim library for glib/gtk stuff though https://github.com/StefanSalewski/gintro
00:54:47droidrageYes 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:51FromDiscord<Elegantbeef> If you want to have multiple files you'd `exportC` the code and `importJs` it in another file
00:55:44droidrageOr would it be simpler to learn to code in vala for such projects
00:56:15FromDiscord<Forest> In reply to @Elegantbeef "If you want to": Ah okay
00:57:28FromDiscord<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:05droidrageThanks for confirming my hunch
00:59:50*jmdaemon joined #nim
01:01:18FromDiscord<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:47FromDiscord<Forest> Fair enough aha
01:04:27FromDiscord<Forest> I'm heavily debating on using Nim's JS backend instead of CoffeeScript
01:04:34FromDiscord<Forest> What would be the advantages I'd get?
01:08:30FromDiscord<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:59FromDiscord<exelotl> (edit) "mistakes," => "mistakes before the program runs,"
01:10:37FromDiscord<Forest> Hm yeah probably gonna use Nim then aha
01:10:38FromDiscord<Forest> Thanks!
01:12:23FromDiscord<Elegantbeef> Also the abillity to reuse code for native binaries if you ever need that
01:19:05FromDiscord<Forest> Idk why I'd need that in this case but cool-
01:19:21FromDiscord<Elegantbeef> Well if you make a backend and ever want to send an object to the client
01:22:08FromDiscord<Forest> Welp time to relearn the stuff I forgot about Nim
01:24:13FromDiscord<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:30FromDiscord<Elegantbeef> importjs it
01:24:35FromDiscord<Forest> It just includes it in the runtime, no imports
01:24:44FromDiscord<Forest> `importjs`?
01:25:13FromDiscord<Elegantbeef> `proc myProc(args): ReturnType {.importJs: "procRealName".}`
01:25:20FromDiscord<Forest> Ah neat, thanks!
01:25:28FromDiscord<Forest> How about if it's a static function?
01:25:38FromDiscord<Forest> Just `class.proc`?
01:25:48FromDiscord<Elegantbeef> https://nim-lang.org/docs/jsffi.html will help you a alot
01:26:11FromDiscord<Forest> I should probably read through it lol
01:26:41FromDiscord<Elegantbeef> The source of https://nim-lang.org/docs/dom.html will help aswell
01:27:41FromDiscord<Forest> Thanks xD
01:28:48*jmdaemon quit (Ping timeout: 272 seconds)
01:32:41FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PUm
01:32:56FromDiscord<Elegantbeef> may just want to use `importC` then
01:33:08FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PUn
01:33:32FromDiscord<Elegantbeef> Wait java?!
01:33:49FromDiscord<Forest> It's a project with GraalJS :p
01:34:26FromDiscord<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:48FromDiscord<Elegantbeef> I see
01:35:06FromDiscord<Elegantbeef> Anywho you might want `importC` there
01:35:17FromDiscord<Forest> Why's that?
01:35:44FromDiscord<Elegantbeef> or do \`importJs\:"Java.type(#)"
01:35:54FromDiscord<Forest> Ah okay
01:36:13FromDiscord<Forest> Thanks aha
01:42:07FromDiscord<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:19FromDiscord<huantian> https://media.discordapp.net/attachments/371759389889003532/944046135566299156/unknown.png
01:42:22FromDiscord<huantian> can't wait to add nim to this list
01:42:28FromDiscord<Forest> Lol
01:42:29FromDiscord<huantian> of random technologies and programs
01:42:42FromDiscord<Forest> It works pretty well
01:42:45FromDiscord<huantian> this actually looks kinda sick tho
01:42:54FromDiscord<Elegantbeef> I mean you can make a macro that does it but otherwise no
01:43:04FromDiscord<Forest> Ye, i actually helped to port it to Gradle and made the workflow for it haha
01:43:05FromDiscord<Elegantbeef> Nim doesnt know what `java.package.Class` contains if i get what you mean
01:43:09FromDiscord<Forest> In reply to @Elegantbeef "I mean you can": Ah fair enough
01:43:15FromDiscord<Forest> In reply to @Elegantbeef "Nim doesnt know what": Yeah fair lol
01:43:23FromDiscord<Elegantbeef> https://nim-lang.org/docs/jsffi.html#require%2Ccstring there is this though
01:43:38FromDiscord<Forest> Time to make a macro
01:43:48FromDiscord<Forest> Neat
01:50:10FromDiscord<Forest> Do macros just output the exact code in the macro, with the provided arguments?
01:50:32FromDiscord<Elegantbeef> Macros output whatever you tell them to, they're user defined compiler passes
01:50:42FromDiscord<Forest> Ah
01:51:26FromDiscord<Forest> So i could just output a syntax tree directly if i wanted to?
01:51:53FromDiscord<Elegantbeef> Well that's what Nim macros are, you take in AST and emit AST
01:52:01FromDiscord<Forest> Fair enough lol
01:54:19FromDiscord<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:32FromDiscord<Elegantbeef> I dont know how much code you're wrapping or what you're after
01:55:23FromDiscord<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:41FromDiscord<Elegantbeef> Namespace? 😀
01:55:43FromDiscord<Forest> I'm reading through docs and not understanding anything Lol
01:55:53FromDiscord<Forest> Namespace as in uh, environment?
01:56:02FromDiscord<Forest> Idk what it's called :p
01:56:48FromDiscord<Elegantbeef> Module?
01:57:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PUq
01:57:55FromDiscord<Elegantbeef> then you'd just do `import classes` and have it imported
01:58:02FromDiscord<Elegantbeef> I guess it'd be `Class`
01:58:39FromDiscord<Forest> No i don't know how to explain it bleh
01:59:06FromDiscord<Forest> Y'know how in Python you can just do `import os` and then you can do `os.system("stuff")`?
01:59:14FromDiscord<Elegantbeef> Yes
01:59:34FromDiscord<Forest> I wanna do `jclass "java.package.Class"` and then just have `Class` usable from Nim
02:00:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PUr
02:00:13FromDiscord<Forest> But it's a Java class that i want to add to the name space
02:00:33FromDiscord<Forest> And i don't know the fields/procs at compile time
02:00:35FromDiscord<Elegantbeef> Nim is not python or java. It doesnt have namespaces
02:00:55FromDiscord<Forest> I know that I'm just struggling to explain it
02:01:00FromDiscord<Elegantbeef> `JSObject` does exist which is "typeless"
02:02:00FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PUv
02:02:22FromDiscord<Forest> Macros would help me do that i think but I'm struggling to actually understand it
02:02:55FromDiscord<Elegantbeef> Well jclass would emit a typedesc with a `.()` macro
02:03:10FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#special-operators-operator-nimdot
02:03:26FromDiscord<Elegantbeef> I guess maybe a variable instead
02:05:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PUx
02:06:02FromDiscord<Forest> Ah okay then, thanks
02:06:04FromDiscord<Elegantbeef> `BukkitInternal` would be gensym'd so it'd only be accessible for the variable declaration
02:08:08FromDiscord<Elegantbeef> the macro signature would be `macro jclass(path: static string)` if unclear
02:20:09FromDiscord<Forest> Ah okay!
02:34:40FromDiscord<Forest> I got a type error using Nim because of the NimStrLit function m
02:34:41FromDiscord<Forest> ?
02:35:04FromDiscord<Forest> `TypeError: Java.type expects one string argument`
02:37:34FromDiscord<Forest> How would i fix that?
02:38:42FromDiscord<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:42FromDiscord<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:59FromDiscord<Forest> Actually there's a playground for this
03:02:12FromDiscord<Elegantbeef> Exactly as you put it 😀
03:13:08NimEventerNew question by pooooky: Why is Nim not overriding, see https://stackoverflow.com/questions/71167977/why-is-nim-not-overriding
03:20:28FromDiscord<Forest> Does Nim have default arguments or do i need to just use operator overriding?
03:28:44FromDiscord<Elegantbeef> it has defaults
03:29:06FromDiscord<Elegantbeef> Also did you mean procedure overloading?
03:29:49FromDiscord<Forest> Yeah that's what i meant
03:38:52FromDiscord<Forest> How do i overload a procedure? :p
03:39:12FromDiscord<Forest> Just defining another procedure with the same name should work, right?
03:39:14FromDiscord<Rika> Ues
03:39:22FromDiscord<Rika> Different parameter types
03:41:08FromDiscord<Forest> Aight
03:41:12FromDiscord<ckennedy> anyone have any ideas why nim would be compiling to x86_64 on an arm64 M1 Mac?
03:42:23FromDiscord<cs> What is the convention for declaring variables? Is it inside of procedures in a group?
03:42:38FromDiscord<cs> (edit) "What is the convention for declaring variables? Is it inside of procedures ... ingroup" added "or" | "group?" => "group outside of them?"
03:46:26FromDiscord<Rika> ?
03:46:42FromDiscord<Rika> Variables have scope
03:46:49FromDiscord<Rika> Local is preferred to global
03:48:09FromDiscord<cs> Okay, I see.
03:49:20FromDiscord<Elegantbeef> Ideally your modules dont have side effects unless it's desired for the program
03:49:50FromDiscord<Elegantbeef> If you make a library you should avoid global variables as much as possible
03:50:40FromDiscord<Rika> Const outside is fine just avoid let and var globals
03:50:41FromDiscord<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:22FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PUI
04:02:20FromDiscord<Elegantbeef> Code?
04:03:41FromDiscord<Rika> You’re using a variable as a proc?
04:05:05FromDiscord<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:12FromDiscord<Elegantbeef> you'd probably want to do `NamespacedKey(field: my, param: params, here: here).toJs`
04:08:55FromDiscord<Forest> Ah okay
04:11:10FromDiscord<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:06FromDiscord<Forest> It's a Java class that i usually initialise with `new NamespacedKey(my arguments)` in Java
05:14:12FromDiscord<Forest> (edit) "Java" => "JS"
05:14:46FromDiscord<Elegantbeef> You'd need to import the constructor then, or just use a JSObject
05:18:09FromDiscord<Forest> I don't understand exactly? I've imported it
05:18:48FromDiscord<Rika> what is `NamespacedKey` defined as?
05:23:21FromDiscord<Forest> It'd a JsObject
05:25:34FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/1JT
05:26:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PUX
05:27:09FromDiscord<Forest> Ah okay then
05:28:09FromDiscord<Forest> Hm issue is that Bukkit relies on getting the NamespacedKey so i need to initialise that object
05:29:01FromDiscord<Elegantbeef> Do you have the NameSpacedKey object definition handy?
05:30:09FromDiscord<Forest> What do you mean? I have the JsObject in a variable if that's what you mean
05:30:25FromDiscord<Elegantbeef> I mean the js definition
05:30:31FromDiscord<Elegantbeef> Like what's the code you're porting
05:30:42*krux02 quit (Remote host closed the connection)
05:31:20FromDiscord<Rika> js technically doesnt really have definitions no? just make the object
05:31:37FromDiscord<Rika> if ever you have more issues, you can copy the NamespacedKey and then modify the copy
05:31:52FromDiscord<Elegantbeef> Yea i know it doesnt explicitly
05:32:15FromDiscord<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:56FromDiscord<Rika> then its prolly in that jsobject he mentioned, NamespacedKey
05:33:09FromDiscord<Elegantbeef> Sure but i want to know the JS code 😛
05:33:13FromDiscord<Elegantbeef> So i can actually say what to do
05:33:38FromDiscord<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:50FromDiscord<Rika> can you run a reply
05:33:51FromDiscord<Rika> (edit) "reply" => "repl"
05:33:54FromDiscord<Elegantbeef> Well what is the code you're replicating 😀
05:34:05FromDiscord<Rika> if you can then print the object in it
05:34:07FromDiscord<Elegantbeef> You have JS code, i want to see it!
05:34:18FromDiscord<Forest> Oh sure :p
05:34:24FromDiscord<Forest> In reply to @Rika "if you can then": Sure gimme a sec
05:34:30FromDiscord<Rika> he has java i assume not js
05:35:14FromDiscord<Elegantbeef> They have JS
05:36:34FromDiscord<Forest> Wait I'm confused :p
05:36:41FromDiscord<Forest> Do you want the code I'd use in JS?
05:36:46FromDiscord<Forest> Or the actual JS source code for it?
05:36:57FromDiscord<Elegantbeef> The code you'd usue
05:36:58FromDiscord<Forest> Because there's no JS source for NamespacedKey
05:37:01FromDiscord<Forest> Ah okay
05:37:20FromDiscord<Forest> `new NamespacedKey(plugin, "string");`
05:37:30FromDiscord<Forest> I already have the plugin instance and it works
05:37:36FromDiscord<Forest> But I can't initialise the jey
05:37:38FromDiscord<Forest> Key
05:37:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PV0
05:37:45FromDiscord<Elegantbeef> That's how you'd do it
05:38:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PV1
05:40:38FromDiscord<Forest> Ah okay, thanks!
05:41:04FromDiscord<Forest> Why doesn't Nim map `new` to JS's `new`?
05:43:32FromDiscord<Elegantbeef> Cause it's for Nim's references
05:43:52FromDiscord<Elegantbeef> Nim's semantics shouldnt change due to it's backend
05:51:05*slowButPresent quit (Quit: leaving)
05:52:16FromDiscord<Forest> Ah
05:52:45FromDiscord<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:33FromDiscord<Elegantbeef> First you know you can do `array[3, T]`?
05:54:48FromDiscord<Elegantbeef> Second `ItemStack` isnt a type
05:55:19FromDiscord<Forest> What does `T` mean in that context?
05:55:26FromDiscord<Forest> Also i didn't realize lol thanks
05:55:35FromDiscord<Elegantbeef> the type the array holds
05:55:42FromDiscord<Elegantbeef> so in your case `array[3, array[3,char]]`
05:58:41FromDiscord<Elegantbeef> `T` is generally used in nim as a default generic parameter name, so a lot of pseudo code uses it
05:58:50FromDiscord<Forest> Ah okay
05:59:40FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PV4
06:01:46FromDiscord<Elegantbeef> `import std/strutils`
06:03:45FromDiscord<Forest> Oh i forgot about that lol
06:04:55FromDiscord<Elegantbeef> And welcome to the `.()` operator noisy errors 😛
06:18:05FromDiscord<Forest> XD
06:18:15FromDiscord<Forest> For Enums do i have to define all variables manually?
06:18:37FromDiscord<Elegantbeef> "all variables"?
06:18:40FromDiscord<Forest> If so... I'm gonna have fun 😅
06:18:44FromDiscord<Forest> Values
06:18:51FromDiscord<Forest> Fields?
06:18:51NimEventerNew Nimble package! dogapi - Dog API client, see https://github.com/thexxiv/dogapi-nim
06:19:07FromDiscord<Elegantbeef> You need the enumerated values explicitly yes
06:19:29FromDiscord<Forest> Rip
06:19:38FromDiscord<Forest> How do i define an enum in Nim then? :P
06:20:14nrds<Prestige99> Why don't you want to do so?
06:20:34FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#types-enumeration-types
06:20:56FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3PV7
06:20:58FromDiscord<Forest> In reply to @nrds "<Prestige> Why don't you": Just more boilerplate then i expected to do aha
06:21:10FromDiscord<ynfle> (edit) "https://play.nim-lang.org/#ix=3PV7" => "https://play.nim-lang.org/#ix=3PV8"
06:21:31nrds<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:36FromDiscord<Elegantbeef> Well nim is static, dynamic enums make 0 sense
06:22:05FromDiscord<Forest> Well it's already defined in the Java code so i thought I'd just be able to use that :p
06:22:34FromDiscord<Elegantbeef> I mean copy paste it with a slight change
06:22:42FromDiscord<Elegantbeef> Multiline editing isnt magic
06:22:42FromDiscord<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:50nrds<Prestige99> :o
06:22:50FromDiscord<Forest> I'm doing this on mobile
06:22:53FromDiscord<Forest> With nano
06:23:05FromDiscord<Elegantbeef> Nisha is that you?
06:23:08nrds<Prestige99> may god have mercy on your soul
06:23:09FromDiscord<Forest> Yup :D
06:23:12FromDiscord<Forest> XD
06:23:55FromDiscord<Forest> I also need to actually make sure the code is... Casted? Back to the JS counterpart when compiling it
06:26:56FromDiscord<Forest> Anyone have an idea on how to do that? :P
06:30:06FromDiscord<Elegantbeef> No clue what you mean
06:39:31FromDiscord<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:03FromDiscord<Elegantbeef> Well then match the JS code
06:42:03FromDiscord<Forest> With `importjs`?
06:42:10FromDiscord<Elegantbeef> Yea
06:44:10FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PVc
06:45:02FromDiscord<Elegantbeef> In that case make constants i guess
06:45:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3PVd
06:46:24FromDiscord<Forest> Aight thanks!
06:46:40FromDiscord<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:14FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PVh
07:02:47FromDiscord<Elegantbeef> `Ice`
07:02:51FromDiscord<Elegantbeef> Export markers
07:03:48FromDiscord<Forest> O ye
07:03:57*Gustavo6046 quit (Quit: Leaving)
07:04:53FromDiscord<Forest> It didn't work but i need sleep because it's 7 AM
07:05:00FromDiscord<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:21FromDiscord<Aspirus> how can i
07:51:39FromDiscord<Rika> yeah
07:55:14FromDiscord<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:59FromDiscord<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:25FromDiscord<Elegantbeef> You'd probably use `libgit` and ship the library with the binary
09:51:55FromDiscord<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:09FromDiscord<Elegantbeef> It'd be the C lib with Nim bindings
09:53:42FromDiscord<Elegantbeef> For instance https://github.com/disruptek/gittyup
09:54:05FromDiscord<Elegantbeef> That's a higher level libgit wrapper, there is also the lowerlevel one it's based on
09:54:28FromDiscord<fbpyr> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: amazing - thank you so much!
09:55:12FromDiscord<Elegantbeef> No problem
09:59:59FromDiscord<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:07FromDiscord<haxscramper> [fbpyr](https://matrix.to/#/@fbpyr:tchncs.de)\:
10:00:41FromDiscord<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:44FromDiscord<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:00supakeenwell this is unreadable
10:17:33FromDiscord<Elegantbeef> Is there a follow up?
10:17:57FromDiscord<Elegantbeef> Context is required!
10:18:15PMunchYeah, what is unreadable?
10:18:21*cheer[m] joined #nim
10:18:33FromDiscord<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:42PMunchHaha :P
10:21:38FromDiscord<Elegantbeef> Narrator\: "And supakeen quickly closed Beef's code, blurting out 'no I was not'"
10:22:04supakeenno not the code, just the amount of meta data on the IRC messages
10:22:15PMunchMeta-data?
10:22:19supakeen10: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:24FromDiscord<Elegantbeef> Ah matrix -\> discord -\> Irc is hell apparently
10:22:36PMunchOooh :P
10:22:49supakeeni can safely be ignored on this :)
10:22:51PMunchI have a script in my IRC cleans that cleans that up for me
10:22:58supakeenjust a regular old grumpy IRC user
10:23:05PMunchs/cleans/client/
10:23:20FromDiscord<Elegantbeef> Lol your message caused element to go "Nope" 'Can't load this message (m.room.message)Submit logs'
10:23:35PMunchHaha, the regex one?
10:23:48FromDiscord<Elegantbeef> Nah the paste supakeen made with the matrix links
10:23:56PMunchOooh :P
10:24:13FromDiscord<planetis> how can 'let b = not false work but not this https://play.nim-lang.org/#ix=3PVV
10:24:55PMunchBecause that is parsed as (not s).uint8
10:24:59FromDiscord<Elegantbeef> Cause `not false` has a bool op
10:25:04FromDiscord<Elegantbeef> No it's not
10:25:12PMunchYes it is?
10:25:17FromDiscord<Elegantbeef> It's parsed as `not(uint8(s))`
10:25:36FromDiscord<Elegantbeef> dot binds tighter than spaced unary
10:25:49PMunchOh
10:25:55PMunchI was wrong then
10:26:07FromDiscord<Elegantbeef> It's cause there is a specialized bool operator
10:26:23PMunchAh right
10:26:25FromDiscord<Elegantbeef> `States(not s.uint8)` is doing a integer conversion to enum which is checked
10:26:41FromDiscord<Elegantbeef> The enum's range is 0..1 and `not 0` is `255`
10:27:00PMunchSo it goes s.uint8, that is 0, not 0 is 255, then States(255) not possible
10:27:00FromDiscord<planetis> nice `States(not s.bool)` works
10:27:14FromDiscord<Elegantbeef> Yep
10:27:33PMunchWhich means that this work: https://play.nim-lang.org/#ix=3PVX
10:27:34FromDiscord<Elegantbeef> Not doesnt make sense on other enums aside from `bool` really
10:27:42PMunchBut is very likely not what you where trying to do :P
10:28:45FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3PVY
10:29:12FromDiscord<Elegantbeef> This isnt a generalizable problem imo `not`ing an enum make much sense
10:29:22FromDiscord<planetis> I am just trying to switch between them
10:29:37PMunchIsn't generalizable? Not with that attitude!
10:29:38FromDiscord<planetis> also `States(1 - s.ord)` works
10:29:39FromDiscord<Elegantbeef> Yes I know
10:30:24FromDiscord<Elegantbeef> Well yea you can do it a lot of different ways
10:30:33PMunchYou could easily write a not macro which inspects the type and then if there are two fields switches between them! Easy!
10:30:43FromDiscord<Elegantbeef> lol
10:30:46FromDiscord<planetis> lol
10:31:10FromDiscord<Elegantbeef> `proc not[T: TwoValueEnum](val: T): T` 😛
10:31:31PMunchThat could work as well, and then a concept for TwoValueEnum?
10:31:39FromDiscord<Elegantbeef> yea
10:31:45PMunchBut how would you switch? Given arbitrary values for the enum?
10:31:58FromDiscord<Elegantbeef> One second i'll show
10:32:30FromDiscord<Rika> Not all two valued enumerations are sensibly “not” able
10:32:47FromDiscord<Elegantbeef> The answer is just a case statement though
10:35:23*jmdaemon quit (Ping timeout: 272 seconds)
10:36:05PMunchSee, easy! https://play.nim-lang.org/#ix=3PW1
10:36:37*jmdaemon joined #nim
10:37:05FromDiscord<Elegantbeef> Using a macro 0/10
10:37:15FromDiscord<Rika> “Unable to not”
10:37:16FromDiscord<Rika> Lmao
10:37:21FromDiscord<Rika> I am unable to can
10:37:37FromDiscord<planetis> thanks guys I wrote ``proc `not`(x: States): States = States(not x.bool)``
10:38:02FromDiscord<planetis> In reply to @PMunch "See, easy! https://play.nim-lang.org/#ix=3PW1": thats nice as well
10:38:03PMunch@planetis, be aware though that if your values aren't 0 and 1 this will fail
10:38:09PMunchYour solution that is
10:38:26Amun-Rayes, for example it's going to fail for this Bool: https://thedailywtf.com/articles/what_is_truth_0x3f_
10:38:29PMunchAs an aside you don't have to give enums values, they will enumerate themselves if you don't
10:38:50FromDiscord<planetis> ok I don't plan to generalize it anyway
10:39:11FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3PW2 pmunch mine is cooler 😛
10:39:16PMunchAmun-Ra, oh yikes
10:39:34FromDiscord<Rika> Boolean: True, False, Indeterminate
10:39:43FromDiscord<planetis> btw did you now that `high(myarray)` returns `range[0..something]`
10:39:44FromDiscord<Elegantbeef> Quadnary
10:39:48PMunchOh, high and low. Sneaky!
10:39:52FromDiscord<Elegantbeef> Yes
10:39:56PMunchI was wondering how you would go about doing that
10:40:05FromDiscord<Rika> In reply to @Rika "Boolean: True, False, Indeterminate": Oh throw in Undefined here too
10:40:12FromDiscord<planetis> mod used to work the same and it was removed
10:40:21Amun-RaRika: and nil ;>
10:40:31FromDiscord<Rika> Eh null can be bunched in with undefined
10:40:39PMunch@planetis, wait what?
10:40:52PMunch`high(myarray)` returns the highest index, no?
10:41:04FromDiscord<Elegantbeef> Yea but it's a subrange type
10:41:05FromDiscord<planetis> `x mod 4` used to be `range[0..3]`
10:41:14FromDiscord<Elegantbeef> !eval echo typeof([10, 20].high)
10:41:16NimBotrange 0..1(int)
10:41:37Amun-RaRika: nil would indicate absence of a value while undefined presence of one we don't know
10:41:45PMunchHuh, didn't know that
10:41:52PMunchIs it actually defined as a range though?
10:41:53FromDiscord<Rika> In reply to @Amun-Ra "<@259277943275126785>: nil would indicate": Then indeterminate
10:42:05FromDiscord<Elegantbeef> What do you mean?
10:42:15FromDiscord<Elegantbeef> Arrays are implicitly converted into `array[range, type]`
10:42:20PMunch!eval for i in [10, 20].high: stdout.write "."
10:42:21NimBotCompile failed: /usercode/in.nim(1, 18) Error: type mismatch: got <range 0..1(int)>
10:42:22Amun-RaRika: I would use indeterminate for something we don't even know is null or undefined ;)
10:42:25FromDiscord<Elegantbeef> !eval typeof([2, 3, 4])\`
10:42:27NimBotCompile failed: /usercode/in.nim(1, 20) Error: identifier expected, but got '[EOF]'
10:42:37FromDiscord<Elegantbeef> !eval typeof([2, 3, 4])
10:42:39NimBotCompile 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:55FromDiscord<Elegantbeef> Too tired apparently
10:42:59FromDiscord<Elegantbeef> So buh bye
10:43:07PMunchOh right, so it's not an HSlice
10:43:13PMunchYeah range makes more sense
10:43:47PMunch!eval var myArr: array[5..10, int]; echo typeof(myArr.high)
10:43:49NimBotrange 5..10(int)
10:43:55PMunchNeat
11:06:10*krux02 joined #nim
11:09:11nrds<Abrax99> where is this bridged too?
11:09:35FromDiscord<Rika> Discord and IRC and matrix
11:09:44*gsalazar joined #nim
11:10:19nrds<Abrax99> you on irc or discord Rika?
11:10:25nrds<Abrax99> or matrix?
11:13:06FromDiscord<Rika> Discord
11:15:06*rwb is now known as rb
11:22:55FromDiscord<Aspirus> In reply to @Amun-Ra "yes, for example it's": among us
11:23:53FromDiscord<Aspirus> sent a code paste, see https://play.nim-lang.org/#ix=3PW9
11:24:14FromDiscord<Aspirus> sent a code paste, see https://play.nim-lang.org/#ix=3PWa
11:24:38FromDiscord<aph> no bots in discord 😔
11:24:45FromDiscord<aph> though there are in irc
11:28:19FromDiscord<Waldecir Santos> what sugar is called with `repr` for an object ?
11:31:02FromDiscord<Waldecir Santos> Oops I think I just need to implement it
11:49:17PMunchWhat do you mean what sugar?
11:49:23PMunchI believe repr is built-in
11:49:58PMunchYup, it's "magic" https://nim-lang.org/docs/system.html#repr%2CT
11:50:06PMunchMeaning that it is implemented in the compiler itself
11:50:15nrds<Abrax99> ah discord
11:50:17nrds<Abrax99> coo
11:51:08FromDiscord<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:11FromDiscord<Waldecir Santos> Does nim have `classmethods` like python ?
11:55:13NimEventerNew Nimble package! shorteststring - word size strings stored in an integer, see https://github.com/metagn/shorteststring
11:55:32FromDiscord<Waldecir Santos> Does nim have classmethods like python ?
11:55:59PMunchClassmethods?
11:58:25FromDiscord<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:43FromDiscord<konsumlamm> Nim doesn't even have normal python-like methods
12:01:38FromDiscord<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:21PMunchYeah, 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:52FromDiscord<Waldecir Santos> perfect @konsumlamm that is what I need, Thank you
12:05:12PMunchDo you need that though?
12:05:17PMunchWhat are you actually trying to do?
12:06:01*supakeen quit (Quit: WeeChat 3.4)
12:06:30*supakeen joined #nim
12:07:43FromDiscord<konsumlamm> a class method is kinda useless, since you get access to the "class" (the type) anyway thrugh static typing
12:08:10FromDiscord<konsumlamm> so the distinction between static and class method isn't that useful in a statically typed language (disregarding subtyping)
12:12:22FromDiscord<fbpyr> sent a long message, see https://paste.rs/46G
12:14:23FromDiscord<Rika> In reply to @NimEventer "New Nimble package! shorteststring": interesting
12:15:24FromDiscord<konsumlamm> sounds pretty useless, ngl
12:15:58FromDiscord<Rika> i mean sure
12:16:32FromDiscord<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:38FromDiscord<Rika> so just like a first param `typedesc[T]` where T is the "subclass"?
12:17:57FromDiscord<Yepoleb> I think so
12:19:11PMunchYou could also argue that this is a nice feature: http://ix.io/3PWs
12:19:17FromDiscord<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:18PMunchSee how shoddy that looks in Nim?
12:19:53PMunch@fbpyr, something like `repr` perhaps?
12:22:30*jmdaemon quit (Ping timeout: 260 seconds)
12:24:22PMunch@fbpyr, it seems like `error` was never defined in that library, I think it was just an illustration..
12:24:38FromDiscord<Rika> who are you replying to
12:25:14PMunchThe person who sent this: sent a long message, see https://paste.rs/46G
12:25:56PMunchUhm @Forest, what are you reading?
12:27:53FromDiscord<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:58PMunch@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:12PMunchThe example just forgets to import the logging module
12:28:31PMunch@jmgomez, yeah that's a false positive
12:28:52FromDiscord<Rika> the hell is choosenim gonna do on android xd
12:29:17PMunchI guess it might work in Termux
12:29:35FromDiscord<jmgomez> lol ok
12:30:09FromDiscord<jmgomez> is it normal to found discrepances using the same compiler (clang) in win vs linux? Never encounter that In cpp
12:30:36PMunchWhat kind of discrepancies?
12:31:15FromDiscord<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:52PMunchHow is the function defined?
12:32:11FromDiscord<jmgomez> https://media.discordapp.net/attachments/371759389889003532/944209681914658866/unknown.png
12:32:35FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=
12:32:46PMunchWhy does everyone suddenly insist on sending images of text? When did people stop knowing how to use Ctrl+x ctrl+v?
12:32:54FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3PWv
12:33:00PMunchNothing against you personally @jmgomez :P
12:33:12PMunchTry to use cint
12:33:18FromDiscord<jmgomez> I think it's win fault, it just quicker
12:33:19FromDiscord<jmgomez> ok
12:33:46PMunchNims int is always the same size as a pointer, and might differ from C/C++'s int type
12:34:14FromDiscord<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:32FromDiscord<Forest> In reply to @PMunch "Why does everyone suddenly": Because it's a giant file :p
12:34:45FromDiscord<jmgomez> In reply to @PMunch "Nims int is always": Good to know. Just changed it but it keeps doing the same
12:35:23PMunch@Forest, you don't need to copy paste the entire file, you can copy a selection
12:36:01PMunchHmm, try to use {.exportc, cdecl.}, but I guess that might be what {.test.} does
12:37:31FromDiscord<jmgomez> cdecl was missing, just added it and it does the same
12:37:43FromDiscord<jmgomez> what bothers me most is that it works fine in linux
12:38:00PMunchWhat can I say, superior OS :P
12:38:12FromDiscord<Forest> In reply to @PMunch "I guess it might": It'd work if there arm is supported
12:38:15FromDiscord<Forest> In reply to @PMunch "<@909883978717204561>, you don't need": Aight
12:38:30PMunchDo you cross compile or compile on the Windows machine?
12:39:03FromDiscord<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:49PMunchOh wait, is the function defined in C?
12:40:28FromDiscord<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:38PMunchThen you probably need to do `proc callbackTest(arg: cint, fun: proc(arg: cint): cint {.cdecl.}): cint {.exportc, cdecl.}`
12:41:31PMunchBy the way, do you load this as a dynamic library or as a static library?
12:43:31FromDiscord<jmgomez> ohh that worked!
12:43:57FromDiscord<jmgomez> Thanks man! ↵Im planning to do both (iOS requires static). I need to consider something else?
12:44:53FromDiscord<jmgomez> I guess you cant add pragmas with the short sugar syntax right?
12:47:14FromDiscord<Rika> you cannot
12:47:37*enyc quit (Ping timeout: 240 seconds)
12:50:40FromDiscord<konsumlamm> i thought you can?
12:50:51FromDiscord<konsumlamm> you're talking about `sugar.->`, right?
12:51:20FromDiscord<konsumlamm> at least the documentation says it supports pragmas and there's an example for it
12:51:32FromDiscord<Rika> eh did i forget again
12:51:41FromDiscord<Rika> maybe im remembering 1.0 days
12:52:35FromDiscord<konsumlamm> the pragmas go before the `->` afaict
12:52:53PMunch@jmgomez, happy to help :)
12:53:09PMunchYou might want to check out Genny by the way: https://github.com/treeform/genny
12:53:24FromDiscord<konsumlamm> so e.g. `fun : (cint) {.cdecl.} -> cint`
12:53:29PMunchHaven't tried it myself, but it promises to make Nim/C interactions easier (and other languages)
12:53:29FromDiscord<konsumlamm> (edit) "`fun :" => "`fun:"
13:01:02PMunchfun, fun, fun
13:07:39FromDiscord<jmgomez> Looks really nice!
13:08:04FromDiscord<jmgomez> btw what's the preferred way to pass data over? raw pointers and using ptr in nim side of things?
13:12:02PMunchIt depends a bit
13:12:22PMunchYou need to make sure that the garbage collection isn't messing things up for your
13:12:34PMunchBut in general it tends to be very C-like with a lot of pointers
13:13:35FromDiscord<jmgomez> 👍
13:15:47PMunchtreeform, 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:35PMunch@jmgomez, of course normally you'd create some nice abstraction in Nim
13:30:54FromDiscord<Evrensel Kişilik> hewwoooo
13:31:00FromDiscord<Evrensel Kişilik> is there anyone using Arch????????????
13:33:40PMunchYes, how so?
13:34:06PMunchBy the way, if you save your question marks you can ask a lot more questions
13:34:13PMunchDon't want to waste them all at the same time
13:34:31FromDiscord<Evrensel Kişilik> 😱
13:34:35FromDiscord<Evrensel Kişilik> sooooooooooooooooooooooooooooooooooooooooooo
13:34:47PMunchWelp, there goes all your O's for the day
13:34:57FromDiscord<Evrensel Kişilik> 😱
13:35:06FromDiscord<Evrensel Kişilik> https://aur.archlinux.org/packages/gdb-frontend-bin can you try installing this package??????????????????
13:35:37PMunchAgain with the question marks...
13:35:58FromDiscord<Evrensel Kişilik> In reply to @PMunch "Again with the question": no lol
13:36:11FromDiscord<Evrensel Kişilik> someone told me there is an issue with package
13:36:40FromDiscord<Evrensel Kişilik> we should test if it is installing correctly 😱
13:39:01PMunchShould we?
13:39:09PMunchWait, what does this have to do with Nim?
13:41:22PMunchSeems to install fine here
13:42:28FromDiscord<Evrensel Kişilik> In reply to @PMunch "Seems to install fine": oh
13:42:34FromDiscord<Evrensel Kişilik> thank youuuuuuuuu
13:43:16FromDiscord<Evrensel Kişilik> soooooooooo someone told me that better the package use could use setup.py
13:43:33FromDiscord<Evrensel Kişilik> instead of copying app to /opt
13:43:56FromDiscord<Evrensel Kişilik> and i made it buuuut another one told me that the package is not installing correctly
13:44:18FromDiscord<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:31FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=3PWQ
14:04:55PMunchI'm guessing importjs doesn't allow instantiation like you do
14:05:11FromDiscord<Forest> I'm not trying to initialise it though?
14:06:17PMunch` = newJsObject()` initialisation
14:11:16*arkurious joined #nim
14:22:35FromDiscord<Forest> Oh
14:22:49FromDiscord<Forest> But if I don't do that it doesn't work then :/
14:23:04PMunchTry to declare it with `var`
14:23:14PMunchI have an open issue for a similar thing with C
14:23:29FromDiscord<Forest> Ah okay then
14:24:08PMunchEssentially a let requires initialization, but `importc`/`importjs` should waive this requirement, but it doesn't
14:25:19FromDiscord<Forest> Ah okay that makes sense
14:25:50*slowButPresent joined #nim
14:26:03FromDiscord<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:41FromDiscord<Forest> Still getting the same error: https://www.toptal.com/developers/hastebin/qanijoniqi.nim
14:26:46FromDiscord<Forest> On line 7
14:29:34PMunchauyxm, hmm, maybe that one is fixed then
14:32:03PMunchAha, apparently it was indeed fixed: https://github.com/nim-lang/Nim/issues/14253
14:32:26PMunchI guess maybe it got fixed for importc but not importjs..
14:34:13PMunch@Forest, oh the pragma needs to go after the name but before the colon
14:34:50FromDiscord<Forest> Ohh
14:36:54FromDiscord<Forest> Thanks it's working now!
14:44:38FromDiscord<auxym> should a new issue be opened for importjs then?
14:45:43PMunchProbably, but first of course verify that it is the case
14:50:51*PMunch quit (Quit: Leaving)
14:55:53FromDiscord<gerwy> yoo Kisilik the person from GDBFrontend :>>
14:56:12FromDiscord<gerwy> @Evrensel Kişilik how is adding nim feature going?
14:57:31FromDiscord<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:55FromDiscord<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:48FromDiscord<Nick.> Learning how to code in Nim. Is there a module that pause the program until a key is pressed?
15:24:01FromDiscord<Rika> `stdin.readChar()`?
15:24:34FromDiscord<Rika> you have to discard it if you dont need what key was pressed, which i assume you dont
15:24:35FromDiscord<Rika> so
15:24:41FromDiscord<Rika> `discard stdin.readChar()`
15:24:43FromDiscord<Rika> i assume will work
15:25:18FromDiscord<Nick.> Should be a simple one. I just want to wait before closing the program. "Press any key to close my terminal"
15:26:32FromDiscord<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:21FromDiscord<Nick.> Yep, that's it.
15:27:47FromDiscord<Nick.> thanks you. So always discard when don't need it.
15:28:00FromDiscord<Rika> if you dont need the result of a procedure yes
15:28:56FromDiscord<Nick.> thanks 🙂
15:29:45FromDiscord<Nick.> I do see you use ; is that optional to add?
15:29:59FromDiscord<Nick.> after every command in nim?
15:31:00*euantorano quit (Ping timeout: 240 seconds)
15:31:19FromDiscord<Rika> Uh optional, only for one liners that I put
15:31:28FromDiscord<Rika> They can be swapped with line breaks
15:31:56*euantorano joined #nim
15:47:22FromDiscord<Evrensel Kişilik> In reply to @Life Sucks "suure, good luck and": i would like that if someone could contribute to project 😊
15:47:39FromDiscord<Evrensel Kişilik> are you using Nim with Godot???
15:50:36FromDiscord<gerwy> Im planning on using nim bindings
15:51:10FromDiscord<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:15FromDiscord<gerwy> I don like em
15:53:28FromDiscord<Evrensel Kişilik> In reply to @Life Sucks "And sorry but from": oh ok
16:07:29FromDiscord<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:49FromDiscord<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:21FromDiscord<treeform> In reply to @PMunch "<@107140179025735680>, I'm looking at": No we are just lazy
16:24:03FromDiscord<treeform> In reply to @creikey "<@!107140179025735680> I'm tentatively looking": Wasm all the way, emscripten has a windowing api
16:26:21FromDiscord<treeform> https://emscripten.org/docs/api_reference/html5.h.html#html5-h
16:51:21FromDiscord<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:13FromDiscord<Evrensel Kişilik> In reply to @Forest "Someone written a wrapper": you can build C sources for WebAssembly
17:05:32FromDiscord<Hamid_Bluri> https://github.com/treeform/nim_emscripten_tutorial
17:05:33FromDiscord<Hamid_Bluri> ?
17:08:42FromDiscord<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:54FromDiscord<Forest> Anyone know how I'd import all files in a directory?
18:00:08FromDiscord<Forest> I just need to include/import it at compile time
18:00:22FromDiscord<Forest> I'm probably gonna have a ton of files and don't wanna import them all manually lol
18:00:32FromDiscord<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:25FromDiscord<BhamidipatiNikhil> In reply to @Forest "Anyone know how I'd": I think we can use templates for this...
18:09:47FromDiscord<Forest> Oh? How?
18:12:35*jmdaemon joined #nim
18:21:45FromDiscord<BhamidipatiNikhil> sent a code paste, see https://play.nim-lang.org/#ix=3PY6
18:22:41FromDiscord<Forest> Ah okay
18:23:00FromDiscord<Forest> Well i still need to figure out the last bit aha
18:23:04FromDiscord<Forest> Thanks though!
18:28:02FromDiscord<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:26FromDiscord<demotomohiro> @BhamidipatiNikhil Your code that reads list of file is executed at runtime, but import statements runs at compile time.
18:31:48FromDiscord<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:49FromDiscord<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:56FromDiscord<BhamidipatiNikhil> In reply to @demotomohiro "Even if it reads": Oh yes, because imports are allowed only at top level!!
18:37:56FromDiscord<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:36FromDiscord<BhamidipatiNikhil> (edit) "level!!" => "in the editor..."
18:41:57FromDiscord<BhamidipatiNikhil> In reply to @demotomohiro "Just writing statememts under": Yes, understood!...
18:44:48FromDiscord<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:38FromDiscord<demotomohiro> But I don't think `template` cannot generate `import` statement from `seq[string]`.
18:45:54FromDiscord<auxym> yeah you'd need a macro for that
18:46:51FromDiscord<auxym> I have a macro that generates `{.compile: .}` pragmas at compile time to add C files to the build
19:15:11FromDiscord<Forest> Oh?
19:19:24FromDiscord<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:19FromDiscord<Waldecir Santos> Is it possible to store a type in a variable ?
19:53:26FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3PYG
19:53:35FromDiscord<Waldecir Santos> Kinda this ☝️
19:55:42FromDiscord<Waldecir Santos> I'm working on a "ORM" so I need to store the type
19:59:07*Gustavo6046 joined #nim
19:59:19FromDiscord<Waldecir Santos> right now I'm storing as string `var objtype = $typeof(Obj1)`
20:14:14FromDiscord<kodkuce> sent a code paste, see https://play.nim-lang.org/#ix=3PYM
20:16:11FromDiscord<kodkuce> should probaby posted this in webdev :(
20:22:59FromDiscord<kodkuce> dont think it is f will just rewrite it in c# no time for hole diving
20:46:29FromDiscord<cs> sent a code paste, see https://play.nim-lang.org/#ix=3PYS
20:47:44FromDiscord<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:45FromDiscord<cs> https://media.discordapp.net/attachments/371759389889003532/944334396138340362/unknown.png
20:48:17FromDiscord<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:17FromDiscord<cs> Another question: what is a way I can replicate the Ternary Operator so that the if else isn't so verbose?
20:49:50FromDiscord<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:27FromDiscord<cs> In reply to @auxym "when constructing your `Color`": ok
20:51:11FromDiscord<cs> That seems to solve one of the issues. Thanks
20:51:37FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3PYU
20:52:01FromDiscord<auxym> can even put it all on 1 line if you want
20:52:15*jmdaemon quit (Ping timeout: 272 seconds)
20:53:42FromDiscord<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:03FromDiscord<auxym> not familiar with that library, can you link it please?
20:54:29FromDiscord<cs> In reply to @auxym "not familiar with that": https://nimdocs.com/treeform/chroma/chroma.html
20:55:28FromDiscord<auxym> try `clr.r`, `clr.g`, etc instead of `[]` indexing
20:55:39FromDiscord<auxym> the type doesnt have `[]` defined
20:56:29FromDiscord<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:21FromDiscord<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:39FromDiscord<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:47FromDiscord<auxym> yes
20:59:49FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3PYW
20:59:56FromDiscord<auxym> result is implicitly returned
20:59:58FromDiscord<cs> In reply to @auxym "yes": Ok, that makes sense.
21:05:36FromDiscord<Forest> How would i use a Nim seq as an argument for a JS argument using importjs?
21:05:54FromDiscord<Forest> Since Nim does some special wrapping
21:15:20FromDiscord<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:55FromDiscord<System64 ~ Flandre Scarlet> Is it normal it's considered as a virus? https://media.discordapp.net/attachments/371759389889003532/944354824596643940/unknown.png
22:10:05FromDiscord<exelotl> yeah, certain nim binaries (`finish.exe` and `nimble.exe`) get falsely flagged by antivirus software all the time :(
22:10:53FromDiscord<System64 ~ Flandre Scarlet> AVs are dumb
22:22:05*PMunch joined #nim
22:29:48*jmdaemon quit (Ping timeout: 240 seconds)
22:31:07PMunchHmm, I'm struggling creating the most basic destroy hook
22:31:21PMunchMy program compiles and runs but the hook is never called
22:31:38PMunchMy editor complains that it can't register another destroy hook
22:38:32PMunchAha, apparently my `Test[T] = object; field: T` was too basic
22:38:47PMunchI changed it to `field: ptr T` and now it worked
22:38:54PMunchThat seems like a strange limitation
22:38:59PMunchWhat if T was a pointer type?
22:39:06*jmdaemon joined #nim
22:39:20PMunchAh, it also works if T is a `ptr int` for example
22:39:27*Gustavo6046 quit (Remote host closed the connection)
22:39:27PMunchOkay, less weird, still a bit weird
22:39:47*Gustavo6046 joined #nim
22:40:57*noeontheend quit (Ping timeout: 240 seconds)
22:41:41PMunchAh 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:11PMunchWanted to see if I could implement some macro magic which would check whether a certain proc had been called or not
22:50:52nrds<Prestige99> What fancy stuff are you making now PMunch? :P
22:51:10PMunchHaha, nothing in particular
22:51:20PMunchIt's just something that I've wanted for a while
22:52:06PMunchThis 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:21PMunchAnd throw a friendly hint that if you don't have them your program might not actually do anything
22:58:17FromDiscord<System64 ~ Flandre Scarlet> why do I have all thoses errors? https://media.discordapp.net/attachments/371759389889003532/944367244002099221/unknown.png
23:04:18PMunchIt seems like your compiler and Nim doesn't agree on the size of an int
23:04:36PMunchAnd it seems like your terminal doesn't agree with itself about which characters goes where..
23:06:53FromDiscord<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:50PMunchIt'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:16PMunchE.g. a CR and an LF (although this is more likely to be some multi-byte colour code or UTF-8)
23:08:32FromDiscord<System64 ~ Flandre Scarlet> PS uses UTF-8
23:08:52PMunchThen it misinterprets those bytes since it is now something different than it was supposed to be and it garbles all the text
23:09:05PMunchDoesn't it use UTF-16 like the rest of MS products?
23:09:12PMunchI'd be surprised if it didn't
23:13:09FromDiscord<System64 ~ Flandre Scarlet> AH I see now https://media.discordapp.net/attachments/371759389889003532/944370984411074590/unknown.png
23:16:01FromDiscord<System64 ~ Flandre Scarlet> okay fixed
23:17:09PMunchDo you have five MinGW installs?
23:17:24PMunchWell, six now I guess if you grabbed the Nim one as well
23:17:33FromDiscord<Rika> Looks more like three
23:17:40FromDiscord<Rika> Wait four
23:17:57PMunchStill, that's N-1 too many
23:18:04FromDiscord<System64 ~ Flandre Scarlet> Taboo : Four of a Kind
23:18:39FromDiscord<System64 ~ Flandre Scarlet> btw, which is better? https://media.discordapp.net/attachments/371759389889003532/944372371433857034/unknown.png
23:19:25FromDiscord<Elegantbeef> nimsaem's
23:19:56FromDiscord<System64 ~ Flandre Scarlet> alright, thanks
23:21:12FromDiscord<Elegantbeef> You may need to use the workspace settings to get it to work 100%
23:21:29FromDiscord<Elegantbeef> https://github.com/saem/vscode-nim#options `nim.project` here
23:30:03NimEventerNew post on r/nim by laker88: Nim cannot find a file, see https://reddit.com/r/nim/comments/svvl6p/nim_cannot_find_a_file/