<< 24-06-2023 >>

00:52:40*nisstyre quit (Server closed connection)
00:53:01*nisstyre joined #nim
01:10:05*moonlit joined #nim
01:12:23*flouer joined #nim
01:12:37*moonlit quit (Client Quit)
01:12:53*flouer quit (Client Quit)
01:13:11*flouer joined #nim
01:13:17*flouer_ joined #nim
01:13:31*flouer quit (Client Quit)
01:21:44FromDiscord<millymox> In reply to @jmgomez "It is": So you’d say it’s worth learning a framework like happyX and making websites in it?
01:26:28*redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:30:22FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4yWy
01:30:50FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=4yWy" => "https://play.nim-lang.org/#ix=4yWz"
01:31:14FromDiscord<Elegantbeef> The first could if it was a static int, and used `when`
01:31:21FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=4yWz" => "https://play.nim-lang.org/#ix=4yWA"
01:32:05FromDiscord<Elegantbeef> Would suggest the macro i mentioned 😄
01:34:58FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/ZMLrD
01:36:45FromDiscord<Elegantbeef> But yea that's just a fancy `when i == 8:... elif i == 16: ...`
01:40:52FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4yWB
01:41:09FromDiscord<Elegantbeef> Of course not
01:42:05FromDiscord<Andreas> In reply to @Elegantbeef "Of course not": so i'm demanding the impossible thing, here ? sry is that true ?
01:42:22FromDiscord<Elegantbeef> Nim is statically type what you're asking for is runtime typing
01:43:31FromDiscord<Elegantbeef> This stuff is hard cause it's just the antithesis of how most compiled languages work
01:45:28FromDiscord<Elegantbeef> The type of thing you want is done using a tagged union generally
01:46:08FromDiscord<Andreas> In reply to @Elegantbeef "Nim is statically type": not quite - fair enough `flow-typing` would help - but thats not what i need. The compiler accepts the concept and i can use 2-4 similar types 'cos they all fit into the concept. The catch-22 is the init, since i can't cast a concept i need to make sure the compiler is happy with the types - and thats the case - but i can't init them ?
01:46:26FromDiscord<Elegantbeef> I don't even know what you mean
01:46:33FromDiscord<Elegantbeef> flow-typing isnt expanding type information
01:47:33FromDiscord<Andreas> In reply to @Elegantbeef "flow-typing isnt expanding type": flow-typing is a runtime-thing - i don't get that far :(()
01:47:43FromDiscord<Elegantbeef> Flow typing isnt a runtime thing afaik
01:48:05FromDiscord<Elegantbeef> Flow typing is using static logic to reduce the possible type state
01:48:16FromDiscord<Elegantbeef> IE checking if a tagged union is of X type
01:48:22FromDiscord<Elegantbeef> You then know inside that body that it is that type
01:48:58FromDiscord<Elegantbeef> Flow typing only really works when your types are all pointers like in Java
01:49:05FromDiscord<Andreas> sure it is - it gives a hint to the runtime, that a the shape of the type has a and b and so one can use it. but nim checks anything at compile-time and in my case the compiler is happy...
01:49:09FromDiscord<Elegantbeef> Otherwise it's pointless
01:49:15FromDiscord<Elegantbeef> It's not even a hint
01:49:24FromDiscord<Elegantbeef> It narrows the type inside of the if statement to a specific type
01:49:54FromDiscord<Elegantbeef> Regardless though it's unrelated to this problem 😄
01:50:04FromDiscord<Elegantbeef> You want to be able to do `myType(size).init()`
01:50:16FromDiscord<Elegantbeef> The way you do that is to make a tagged union of your type
01:50:21FromDiscord<Andreas> In reply to @Elegantbeef "It narrows the type": correct, one can do interfaces this way - but its not compile-time-checksd AFAIK
01:50:26FromDiscord<Elegantbeef> Then have an `init` that takes an init and init's the branch
01:50:41FromDiscord<Elegantbeef> I mean it's not compile time checked, but it narrows at compile time
01:51:21FromDiscord<Elegantbeef> The check is still done at runtime cause it has to be, but in Nim you just do `when X is T` and get the same sorta logic without the runtime check cause it has generics 😄
01:52:06FromDiscord<Elegantbeef> Flow typing is mostly only sensible when all types can be upcasted to a `Object` or similar like C#/Java do afaict
01:52:19FromDiscord<Elegantbeef> Not to say Nim's inheritance couldnt use it, but yea
01:52:35FromDiscord<Elegantbeef> Or Nim's variants couldnt
01:52:51FromDiscord<Elegantbeef> It's neither here nor there cause it doesnt solve your problem
01:53:02FromDiscord<Andreas> the simple truth is : my type has one field that varies in size. All the rest is identical - thats why i can't do a variant-type
01:53:58FromDiscord<Elegantbeef> Why cant you
01:54:06FromDiscord<Elegantbeef> That field would be an objectvariant
01:54:20FromDiscord<Elegantbeef> Can you share some of your code?
01:54:41FromDiscord<Elegantbeef> You seem to have 4 states for that object, so it seems like a fine usage of an object variant
01:55:54FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4yWC
01:56:16FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=4yWC" => "https://play.nim-lang.org/#ix=4yWD"
01:56:23FromDiscord<Elegantbeef> Right so why cant you use an object variant?
01:57:18FromDiscord<Andreas> what would the discriminator be ?
01:57:55FromDiscord<Andreas> (edit) "what would the discriminator be ? ... " added "A additional field, `typesize`"
01:58:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4yWE
01:58:57FromDiscord<Elegantbeef> sure if you want you could use an enum and that information
01:59:27FromDiscord<Elegantbeef> `case size: 0u8..64u8`
01:59:33FromDiscord<Elegantbeef> Is also valid
02:52:50*arkanoid quit (Server closed connection)
02:54:24*arkanoid joined #nim
04:08:44FromDiscord<user2m> I'm trying to learn how to wrap c libraries with nim (and I also know very little about c) are there any small c libraries that would be easy to wrap?
04:15:48FromDiscord<millymox> nimcaptcha is coming along 😄 https://media.discordapp.net/attachments/371759389889003532/1122017203080937542/Screenshot_2023-06-23_at_10.15.35_PM.png
04:31:38NimEventerNew Nimble package! mvb - Minimum viable bindings for OpenCV, see https://github.com/tapsterbot/mvb-opencv
04:46:45FromDiscord<demotomohiro> In reply to @user2m "I'm trying to learn": I wrote C library tutorial for Nimmer:↵https://internet-of-tomohiro.netlify.app/nim/clibrary.en.html↵It contains simple C code.
04:51:34FromDiscord<spotlightkid> In my experience, the best way to learn programming is to program something that you actually need, so I would pick a library, which helps you with doing something you want to use Nim for.↵(@user2m)
04:59:23FromDiscord<user2m> In reply to @demotomohiro "I wrote C library": great thank you!
05:00:01FromDiscord<user2m> In reply to @spotlightkid "In my experience, the": yes I was looking to work with ImageMagick, but that proved a little to difficult at this time
05:03:08FromDiscord<elamandeep> I'm trying to use choosenim https://media.discordapp.net/attachments/371759389889003532/1122029114359021598/image.png
05:03:32FromDiscord<elamandeep> (edit) "choosenim" => "choosenim. But unable to use it. need help?"
05:03:41FromDiscord<elamandeep> (edit) "help?" => "help"
05:04:34FromDiscord<michaelb.eth> In reply to @millymox "nimcaptcha is coming along": Nim isn't C, consider dropping the prefixes and postfixes
05:05:31FromDiscord<michaelb.eth> prefix: `stuff_`
05:06:13FromDiscord<michaelb.eth> before `task`, maintaining diff re: v2 and v3
05:06:39FromDiscord<michaelb.eth> postfix: `_proxyless`
05:07:14FromDiscord<michaelb.eth> In reply to @elamandeep "I'm trying to use": how did you install Nim?
05:07:42FromDiscord<elamandeep> In reply to @michaelb.eth "how did you install": i downloaded zip of choosenim
05:08:00FromDiscord<michaelb.eth> sure, np, took another look and realized you'reon Windows
05:08:09FromDiscord<elamandeep> yes
05:09:01FromDiscord<bungfro> sent a long message, see http://ix.io/4yX4
05:10:29FromDiscord<michaelb.eth> apologies, but when I download/install/use Nim on Windows, I don't use `cmd.exe`, so my advice could be off, but I'm wondering if you missed a step adding a choosenim path to the global Windows environment
05:10:45FromDiscord<michaelb.eth> In reply to @elamandeep "i downloaded zip of": apologies, but when I download/install/use Nim on Windows, I don't use `cmd.exe`, so my advice could be off, but I'm wondering if you missed a step adding a choosenim path to the global Windows environment
05:11:04FromDiscord<elamandeep> In reply to @michaelb.eth "apologies, but when I": ok
05:11:12FromDiscord<elamandeep> i have git bash
05:11:25FromDiscord<elamandeep> and i generally use gitbash
05:11:41FromDiscord<elamandeep> (edit) "gitbash" => "git bash"
05:13:02FromDiscord<Elegantbeef> bungfro object variants
05:13:04FromDiscord<michaelb.eth> In reply to @elamandeep "i have git bash": git bash is good stuff, but!! it's a somewhat lobotomized MSYS2 installation, so if you're already using git bash, I recommend switching to using a normal MSYS2 installation, with the UCRT64 environment (currently the default anyway) being the way to go:↵https://www.msys2.org/
05:13:34FromDiscord<michaelb.eth> (edit) "environment" => "shell/environment"
05:14:13FromDiscord<elamandeep> i will try that but i'm just trying nim
05:14:17FromDiscord<michaelb.eth> form within an MSYS2 shell, you can install the compiler toolchain, git, etc., run curl/wget installer for choosenim, great stuff
05:14:33FromDiscord<elamandeep> (edit) "but i'm just trying nim" => "later"
05:14:39FromDiscord<michaelb.eth> In reply to @elamandeep "i will try that": I understand
05:14:50FromDiscord<bungfro> In reply to @Elegantbeef "bungfro object variants": Could you give an example?
05:15:09FromDiscord<elamandeep> if i do so many things i will be confused how to fix it😅
05:15:13FromDiscord<Elegantbeef> Look at the official manual/tutorial
05:15:16FromDiscord<elamandeep> (edit) "it😅" => "it😅."
05:15:36FromDiscord<elamandeep> it's path issue right?
05:15:38FromDiscord<michaelb.eth> In reply to @elamandeep "if i do so": I understand, completely
05:15:44FromDiscord<michaelb.eth> In reply to @elamandeep "it's path issue right?": yes
05:16:01FromDiscord<elamandeep> what path should i give?😅
05:16:08FromDiscord<elamandeep> i tried to add
05:18:42FromDiscord<elamandeep> @michaelb.eth still getting same error
05:18:53FromDiscord<elamandeep> (edit) "@michaelb.eth still getting same error ... " added "even after setting path"
05:18:54FromDiscord<michaelb.eth> how did you try to add it?
05:19:31FromDiscord<elamandeep> https://media.discordapp.net/attachments/371759389889003532/1122033238769156186/image.png
05:19:38FromDiscord<elamandeep> see this
05:20:04FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4yX6
05:21:14FromDiscord<elamandeep> In reply to @michaelb.eth "I haven't used git": https://media.discordapp.net/attachments/371759389889003532/1122033671214485556/image.png
05:21:20FromDiscord<elamandeep> see this
05:22:01FromDiscord<michaelb.eth> hmm, okay, that's different than how it works with MSYS2; but nevermind that
05:22:19FromDiscord<michaelb.eth> ah!
05:23:44FromDiscord<michaelb.eth> In reply to @elamandeep "": Un your screenshot above, you aren't modifying the global path. You should delete the Variable nim you created and modify the Value for Variable Path
05:23:45FromDiscord<bungfro> sent a long message, see http://ix.io/4yX7
05:23:54FromDiscord<michaelb.eth> (edit) "Un" => "In"
05:24:10FromDiscord<elamandeep> ok
05:26:28FromDiscord<millymox> In reply to @michaelb.eth "Nim isn't C, consider": Thanks
05:27:06FromDiscord<elamandeep> In reply to @michaelb.eth "In your screenshot above,": hey my file path is right
05:27:19FromDiscord<millymox> In reply to @michaelb.eth "Nim isn't C, consider": What do I name some like recap enterprise
05:28:19FromDiscord<elamandeep> @michaelb.eth `c/choosenim-0.8.4/bin
05:28:23FromDiscord<elamandeep> (edit) "`c/choosenim-0.8.4/bin" => "`c/choosenim-0.8.4/bin`"
05:28:39FromDiscord<elamandeep> (edit) "" => "This is my file path"
05:29:43FromDiscord<michaelb.eth> _starts to shrink away in terror and sleepiness_
05:30:54FromDiscord<michaelb.eth> sent a code paste, see https://paste.rs/bmAdi
05:31:19FromDiscord<michaelb.eth> (edit) "https://play.nim-lang.org/#ix=4yXa" => "https://play.nim-lang.org/#ix=4yX9"
05:32:42FromDiscord<elamandeep> https://media.discordapp.net/attachments/371759389889003532/1122036559454146560/image.png
05:33:03FromDiscord<elamandeep> I GOT PATH OF IMBLE
05:33:18FromDiscord<michaelb.eth> In reply to @michaelb.eth "In your screenshot above,": I could have given bad advice there, given my inexperience with the canonical way of installing Nim on Windows; so just disclosing that I may have incorrectly assumed you didn't understand how to modify the global Windows `Path` variable
05:34:23FromDiscord<michaelb.eth> In reply to @elamandeep "": can you copy/paste that instead of a screenshot
05:34:28FromDiscord<michaelb.eth> (edit) "screenshot" => "screenshot?"
05:35:13FromDiscord<elamandeep> sent a code paste, see https://play.nim-lang.org/#ix=4yXb
05:36:01FromDiscord<elamandeep> `c/Users/ASUS/.nimble/bin` this one
05:38:31FromDiscord<elamandeep> i have tried anything on OS level. But soon i will migrate to linux
05:38:39FromDiscord<elamandeep> (edit) "i have ... tried" added "never"
05:38:59FromDiscord<elamandeep> (edit) "linux" => "linux😅"
05:39:31FromDiscord<michaelb.eth> At one point in history there was a Windows OS limit on the number of characters in global env var `Path`. I haven't encountered that limit in awhile (I don't really use Windows), but it was a realy thing and maybe it's playing a role here.
05:40:14FromDiscord<michaelb.eth> (edit) "realy" => "real"
05:40:38FromDiscord<elamandeep> then what to do
05:41:47FromDiscord<elamandeep> (edit) "do" => "do?"
05:44:17*ntat joined #nim
05:44:41FromDiscord<michaelb.eth> In reply to @millymox "What do I name": separate modules?
05:46:23FromDiscord<millymox> In reply to @michaelb.eth "separate modules?": I’m confused lmao, Aren’t they already?
05:46:46FromDiscord<millymox> Why do I have to make a seperate module to rename it something else?
05:48:27FromDiscord<michaelb.eth> well the core noun/concept seems to be `task`
05:49:04FromDiscord<michaelb.eth> keep in mind that Nim is very liberal re: allowing you to override proc/func `task`
05:49:42FromDiscord<michaelb.eth> so consider breaking up `task`-related procs/func/etc into different modules with different library entrypoints
05:50:49FromDiscord<millymox> So, like, recaptcha(client, site_key, site_url, version)?
05:54:09FromDiscord<Elegantbeef> Right then you can do `myModule.recaptcha`
05:54:20FromDiscord<elamandeep> @michaelb.eth windows installer will work? https://media.discordapp.net/attachments/371759389889003532/1122042000678596628/image.png
05:54:32FromDiscord<michaelb.eth> sure, maybe something like that, give it a shot! remember you can define enum types, distinct types, and so on, which can be a help for writing overloads of the underlying `task()`
05:55:36FromDiscord<millymox> In reply to @Elegantbeef "Right then you can": Okay got it!
05:55:50FromDiscord<michaelb.eth> In reply to @elamandeep "<@383034029135364096> windows installer will": I don't know, and I'm sorry I can't help answer that question at the moment: I don't have a physical or virtual Windows machine handy to experiment with.
05:55:54FromDiscord<millymox> In reply to @michaelb.eth "sure, maybe something like": Thanks I will give a try, haven’t tried any of these things in nim lmao still so new
05:56:45FromDiscord<elamandeep> In reply to @michaelb.eth "I don't know, and": after installing windows installer. This i got https://media.discordapp.net/attachments/371759389889003532/1122042608869453865/image.png
05:57:05FromDiscord<Elegantbeef> You havent finished installing
05:57:17FromDiscord<Elegantbeef> One day people will not use windows and that'll e a good day
05:57:18FromDiscord<michaelb.eth> In reply to @elamandeep "after installing windows installer.": looks... promising, press Y
06:08:46FromDiscord<michaelb.eth> In reply to @Elegantbeef "One day people will": likely to be just a few milliseconds before the 🎺 blows
06:11:03FromDiscord<elamandeep> In reply to @michaelb.eth "likely to be just": installed successfully https://media.discordapp.net/attachments/371759389889003532/1122046210384080977/image.png
06:11:16FromDiscord<elamandeep> windows is not for programmer
06:11:26FromDiscord<elamandeep> (edit) "programmer" => "programmer😞"
06:14:22FromDiscord<elamandeep> @michaelb.eth how to see location of nim?
07:06:35FromDiscord<rakgew> @michaelb.eth \: in your terminal on linux you could ask via `which nim` on win it would be `where nim` - if it is in your PATH that is.
07:24:03*derpydoo quit (Ping timeout: 250 seconds)
07:26:32*azimut quit (Ping timeout: 240 seconds)
07:36:50NimEventerNew thread by noah: Thoughts on a backend target for bun?, see https://forum.nim-lang.org/t/10297
07:42:09*ntat quit (Quit: Leaving)
08:53:18FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4yXI
08:56:17FromDiscord<Elegantbeef> It strips type information for inheritiance
08:56:20FromDiscord<Elegantbeef> It's copy fields only
09:34:29FromDiscord<toma400> sent a code paste, see https://play.nim-lang.org/#ix=4yXV
09:37:29*mad_toothbrush joined #nim
09:48:40FromDiscord<Elegantbeef> Stop using regex is the answer
09:48:40FromDiscord<Elegantbeef> `if l notin Letters + {'_'}:`
09:55:01FromDiscord<toma400> In reply to @Elegantbeef "`if l notin Letters": Thank you a ton, that worked ❤️
09:56:02FromDiscord<Elegantbeef> It's also much faster
09:56:02FromDiscord<Elegantbeef> regex is awful never reach for it unless you're actually searching
10:01:25FromDiscord<odexine> “Actually searching”?
10:01:54FromDiscord<Elegantbeef> Searching a string for a complex pattern that you cannot define beforehand in logic
10:01:59FromDiscord<Elegantbeef> User facing generally
10:33:14FromDiscord<Andreas> sent a long message, see http://ix.io/4yY9
10:34:38FromDiscord<Andreas> (edit) "http://ix.io/4yY9" => "http://ix.io/4yYa"
11:46:36*mad_toothbrush quit (Ping timeout: 260 seconds)
12:25:01*ntat joined #nim
12:41:19*azimut joined #nim
12:56:30FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4yYF
12:57:16FromDiscord<heysokam> (edit) "https://play.nim-lang.org/#ix=4yYF" => "https://play.nim-lang.org/#ix=4yYG"
12:57:21FromDiscord<heysokam> (edit) "https://play.nim-lang.org/#ix=4yYG" => "https://play.nim-lang.org/#ix=4yYH"
12:58:30FromDiscord<graveflo> you should not need to de-reference
13:00:51FromDiscord<heysokam> kk ty
13:18:17FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4yYN
13:22:29FromDiscord<heysokam> In reply to @demotomohiro "How pure pragma work": i see. well explained, thenks!↵is there any practical usage of this feature?
13:22:55FromDiscord<heysokam> (edit) "usage of" => "application for"
13:31:29FromDiscord<demotomohiro> Wrapping types in C/C++ library.
14:02:04FromDiscord<bungfro> In reply to @bungfro ""attempt to redefine: 'channel'"": Bump
14:03:00FromDiscord<odexine> In reply to @bungfro ""attempt to redefine: 'channel'"": you cannot use the same field name inside object variants
15:00:49FromDiscord<bungfro> In reply to @odexine "you cannot use the": My original question was how to allow the 'channel' to be one of two types. Is there another way?
15:00:58FromDiscord<bungfro> (edit) "In reply to @odexine "you cannot use the": My original question was how to allow the 'channel' ... to" added "field"
15:02:03FromDiscord<odexine> inheritance can be (ab)used to do that, in a way
15:02:41FromDiscord<bungfro> How?
15:11:51FromDiscord<bungfro> In reply to @odexine "inheritance can be (ab)used": Would you happen to know how?
15:11:59FromDiscord<odexine> not really
15:20:32*azimut quit (Remote host closed the connection)
15:21:21*PMunch joined #nim
15:23:54*azimut joined #nim
15:24:58FromDiscord<millymox> execution of an external compiler program 'clang -c -w -ferror-limit=3 -I/Users/mox/.choosenim/toolchains/nim-1.6.12/lib -I/Users/mox/Desktop/Projects/nim/hello_world -o /Users/mox/.cache/nim/main_d/@m..@s..@s..@[email protected]@[email protected]@slib@[email protected] /Users/mox/.cache/nim/main_d/@m..@s..@s..@[email protected]@[email protected]@slib@[email protected]' failed with exit code 1
15:25:04FromDiscord<millymox> https://media.discordapp.net/attachments/371759389889003532/1122185630877749258/Screenshot_2023-06-24_at_9.25.01_AM.png
15:35:44*azimut quit (Ping timeout: 240 seconds)
15:44:45FromDiscord<heysokam> Does someone have an example on how to wrap a cpp library with `importcpp`?↵I have wrapped a C one, but wondering how classes and methods are wrapped when they come from cpp instead
15:45:22PMunchIf you have a look at Nim for UE I believe that's the biggest C++ wrapped Nim project
15:45:24FromDiscord<treeform> In reply to @millymox "Okay great thank you,": It's just my and my friend Guzba. I am just huge Nim fan and a very productive programmer.
15:45:42FromDiscord<heysokam> In reply to @PMunch "If you have a": good idea ✍️
15:46:44FromDiscord<millymox> In reply to @treeform "It's just my and": Well all respect to you my friend the things you've made are great
15:46:58FromDiscord<heysokam> or not such a good idea. its hella complicated
15:47:26FromDiscord<heysokam> @pmunch can you think of any alternative that's not so overthetopcomplex?
15:47:46PMunchHaha, I was afraid that it was a bit complicated
15:48:07PMunchNot sure really, so many C++ libraries have a C header/interface so it's not all that common to wrap C++
15:49:23FromDiscord<heysokam> @jmgomez any tips on wrapping a cpp library?↵i have exp wrapping a C one, but wondering about the specifics for cpp
15:49:26PMunchOh by the way user2m, if you're still around you might want to have a look at Futhark for wrapping C libraries. Sure you won't actually learn how to wrap a C library, but unless you want to contribute to the tool you don't really have to know
15:50:02PMunchMaybe hook up with arkanoid, they're working on adding C++ to Futhark so they've looked into it recently :)
15:50:47FromDiscord<michaelb.eth> In reply to @millymox "execution of an external": I think you're missing `importc` or something like that, though I could be wrong
15:51:00FromDiscord<michaelb.eth> iow, I'm not sure you can just supply `header`
15:51:14FromDiscord<treeform> In reply to @nnsee "as a test, i": I wanted to update 'print' to be thread-safe. I had created 'print' before it was on the -y library name train, so I decided to rename 'print' to 'pretty' and modify everything about it. However, I don't want the code of people who are currently using 'print' to break. Therefore, 'pretty' is the new 'print' with all the thread-safety and API changes.
15:52:05FromDiscord<treeform> In reply to @graveflo "https://github.com/treeform/jsony https://nim-lang.": I am also working on `taggy` for XML, but it's not ready yet.
15:52:14FromDiscord<michaelb.eth> In reply to @heysokam "Does someone have an": there's a video of a presentation that one of the participants here gave at a conference
15:52:19FromDiscord<michaelb.eth> I'll find the link
15:52:28FromDiscord<michaelb.eth> it looks at some basics of wrapping
15:52:41FromDiscord<nnsee> In reply to @treeform "I wanted to update": well, pretty causes GC issues for me so 😅
15:52:48FromDiscord<millymox> In reply to @michaelb.eth "I think you're missing": hm okay, im trying to learn how to wrap C libraries
15:53:11FromDiscord<nnsee> still need to work on a minimal repro case for that
15:53:40FromDiscord<heysokam> In reply to @millymox "": yeah you need `importc: "theSymbolName", header: "blablabla.h"`
15:54:05FromDiscord<heysokam> also probably need `cdecl` most likely
15:54:27FromDiscord<nnsee> In reply to @treeform "I wanted to update": but, if you like investigating, this is the commit just before replacing pretty with print, and has the GC issues https://git.dog/xx/fastcube/src/commit/18f333fa995288a6a97d25cec750f08fc6daed38
15:54:45PMunch@millymox, have you checked out my article on the subject?
15:54:55PMunchhttps://peterme.net/wrapping-c-libraries-in-nim.html
15:55:01FromDiscord<michaelb.eth> In reply to @heysokam "Does someone have an": in the later parts of the video deech explores c++ interop, might be helpful for getting started: https://www.youtube.com/watch?v=d2VRuZo2pdA
15:55:11FromDiscord<heysokam> ty
15:55:29FromDiscord<treeform> In reply to @millymox "Well all respect to": Thanks! We also made some vids: https://www.youtube.com/channel/UC1r0r_fciKYgF5cqC6rwdgw and there is a list of all of our libs that we currently support: https://github.com/treeform/hobby
15:55:39FromDiscord<millymox> In reply to @heysokam "yeah you need `importc:": Alright got it
15:55:52FromDiscord<millymox> In reply to @PMunch "<@1004399071848583228>, have you checked": No i have not will do now thank you!, Will this work on macos?
15:56:04PMunch@millymox, sure, why wouldn't it?
15:56:20FromDiscord<millymox> In reply to @PMunch "<@1004399071848583228>, sure, why wouldn't": curious
15:56:39PMunchIt should work on anything Clang can compile
15:57:59FromDiscord<michaelb.eth> the only thing that might come up on macos is if you installed some C lib with brew or macports and the tool put it in a place that won't collide with version of the same library that Apple ships with macOS or Xcode
15:58:09FromDiscord<michaelb.eth> brew calls that "keg only"
15:58:40FromDiscord<heysokam> ugg, ok i will just use futhark for the C interface. what a mess 😔
15:58:43FromDiscord<michaelb.eth> in any case, for those you'd need to use `--passL` and/or `--passC` with the nim compiler to point it to the directory where the headers and libs are
15:59:00FromDiscord<millymox> In reply to @michaelb.eth "the only thing that": hmmmm
15:59:34FromDiscord<michaelb.eth> brew is good about telling you what flags you need (I'm less experienced with macports, but it probably does also)
16:00:36FromDiscord<heysokam> @millymox both https://github.com/heysokam/wgpu and https://github.com/heysokam/nglfw have mac support in them, and they are C wrappers, if you need to have some reference
16:01:18FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4yZE
16:01:49FromDiscord<heysokam> @millymox better links to the relevant files, sorry:↵https://github.com/heysokam/wgpu/blob/master/src/wgpu/compile.nim↵https://github.com/heysokam/nglfw/blob/master/src/nglfw/compile.nim
16:02:20FromDiscord<millymox> In reply to @heysokam "<@1004399071848583228> better links to": Thanks a lot i will take a look
16:02:50FromDiscord<heysokam> basically, you have to write a tiny compiler configuration in the nim file, for whatever requirements the C library has
16:03:45FromDiscord<heysokam> if you link statically, the setup is more complex, because it builds the code too↵but if you link dynamically, its much simpler, like you can see here with nimassimp https://github.com/beef331/nimassimp/blob/ccdf8aa1483493dc47e19216baa8a9f2d33e9421/src/assimp.nim#L25-L30
16:08:51FromDiscord<treeform> In reply to @heysokam "basically, you have to": Do you think it would be hard to make windy work with webGPU?
16:12:14FromDiscord<heysokam> In reply to @treeform "Do you think it": you just need to provide a way to create a native surface. no idea how that's done 🤷‍♂️
16:13:01FromDiscord<heysokam> @treeform https://github.com/gfx-rs/wgpu-native/blob/6f95ce3fc1cd8829f23401e98967112f00f940c2/examples/triangle/main.c#L147-L232
16:19:09FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4yZJ
16:19:18FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4yZJ
16:19:39FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4yZK
16:24:03PMunchReplace expr with untyped I believe
16:24:39FromDiscord<heysokam> @pmunch what was the option for futhark to output prettier output?
16:24:58PMunchHmm, let me have a look in the docs
16:25:13PMunchnodeclguards is the one
16:26:11FromDiscord<heysokam> kk ty
16:26:17FromDiscord<heysokam> couldn't find it searching on disc
16:26:19FromDiscord<treeform> In reply to @heysokam "<@107140179025735680> https://github.com/gfx-rs/wgp": Wow that does not look that hard.
16:26:43FromDiscord<heysokam> In reply to @treeform "Wow that does not": yeah definitely not. its all that wants, native surface and the rest is handled by the api
16:26:55PMunch@heysokam, try searching the Futhark README for readability :)
16:27:20FromDiscord<heysokam> ahhh readability was the key to search for. i tried a few things but couldn't find anything relevant. zenks
16:27:42PMunchNo problem, if you have another keyword I could throw in there I'll consider it
16:28:08FromDiscord<heysokam> `pretty` is one
16:28:10NimEventerNew post on r/nim by 4runninglife: How do you convert a Datamancer dataframe to a CSV?, see https://reddit.com/r/nim/comments/14hx569/how_do_you_convert_a_datamancer_dataframe_to_a_csv/
16:28:33FromDiscord<heysokam> `pretty`, `prettier output` or similar, thats what i was searching for
16:28:58PMunchAh right, sounds like a good one to add
16:29:07FromDiscord<heysokam> can the defines be declared inside the .nim file, or only at compile time?
16:29:27PMunchThey are standard Nim `-d:` defines
16:29:38FromDiscord<heysokam> so only on compile i guess
16:29:38PMunchSo you can define them anywhere those can be defined
16:29:59PMunchWell Futhark only does work on compile-time, so setting it at runtime wouldn't do much..
16:30:12FromDiscord<spotlightkid> Wouldn't `smelly` be a better name? 😛 I don't touch XMl unless I have too.↵(@treeform)
16:30:26FromDiscord<heysokam> lul
16:39:35FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4yZS
16:39:42FromDiscord<treeform> In reply to @spotlightkid "Wouldn't `smelly` be a": Great idea! I don't like XML.
16:41:41PMunch@heysokam, of course
16:42:01PMunchRead the section on import paths
16:42:48PMunchBasically the definition isn't found in any of your defined `path` elements
16:44:14PMunchSo Futhark doesn't generate anything for it. But in order to make the wrappers work in creates these "opaque type" definitions so that pointers to elements can still work
16:47:13FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4yZV
16:47:28FromDiscord<heysokam> go to definition gets me nowhere, it must be coming from cpp
16:49:11FromDiscord<pmunch> Quite possibly. Do you need access to the data in that object?
16:49:18FromDiscord<heysokam> yep
16:49:31FromDiscord<heysokam> its not an opaque, it contains everything needed
16:49:39FromDiscord<heysokam> (edit) "its not an opaque, it contains everything needed ... " added "for working with the output data"
16:49:44FromDiscord<pmunch> Hmm, then it should be available from C as well
16:49:59FromDiscord<heysokam> yeah, but i dont know how to get it from futhark
16:50:40FromDiscord<pmunch> It should just be about giving it the right path. And potentially pass some switches if the library requires it
16:50:46FromDiscord<heysokam> also, how do renames work? im saying `rename aiScene, SceneTest` and its not changing anything 🤔
16:51:14FromDiscord<pmunch> It's name is structaiscene
16:51:24FromDiscord<pmunch> (edit) "It's" => "Its"
16:51:34FromDiscord<heysokam> oh the original is the resulting nim name?
16:52:14FromDiscord<heysokam> nope, still nothing
16:52:34FromDiscord<heysokam> are they quoted or unquoted? the docs just says "<thing>" and its not clear
16:52:46FromDiscord<heysokam> (edit) ""<thing>"" => "`<thing>`"
16:53:41FromDiscord<pmunch> Sorry I have to run to the store and cook dinner. Won't be back for a while.. Try looking at some other wrapped library
16:56:00FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4yZX
17:07:20*azimut joined #nim
17:47:13*rapcavera joined #nim
17:50:17*koltrast quit (Server closed connection)
17:50:36*koltrast joined #nim
17:52:46FromDiscord<Elegantbeef> @Andreas\: no problem I tend to have that effect on people
18:29:07*rapcavera quit (Quit: windows sucks bad)
18:57:40FromDiscord<mratsim> In reply to @treeform "Great idea! I don't": Who does?
18:58:33*Guest45 joined #nim
18:58:33*Guest45 quit (Client Quit)
19:01:00FromDiscord<treeform> I am sure there are XML fans, why is it everywhere!
19:29:50FromDiscord<bungfro> In reply to @bungfro "My original question was": Anyone know how this would be done? I don't really see anything on the docs.
19:34:36FromDiscord<michaelb.eth> In reply to @bungfro "Anyone know how this": you want two different object types that have a field of the same name but different types?
19:34:41FromDiscord<Elegantbeef> I think people are accidently using html as a serialisation format!↵(@treeform)
19:37:02FromDiscord<graveflo> In reply to @bungfro "Anyone know how this": type variant, generic object or inheritance
19:37:25FromDiscord<Elegantbeef> Nim is statically typed, branched types require branched logic
19:37:32FromDiscord<Elegantbeef> Also grave nice PR 😄
19:37:41FromDiscord<graveflo> I'm trying LOL
19:37:47FromDiscord<graveflo> its still broken af
19:38:17FromDiscord<bungfro> In reply to @michaelb.eth "you want two different": Yeah, so I have↵↵Object:↵ field: Type1 or Type2
19:38:26FromDiscord<Elegantbeef> That doesnt work
19:38:33FromDiscord<Elegantbeef> `Type1 or Type2` is a generic constraint
19:38:36FromDiscord<Elegantbeef> use an object variant
19:38:48FromDiscord<Elegantbeef> or https://github.com/alaviss/union
19:39:21FromDiscord<bungfro> I don't actually use `or` I just want it to be able to be either one of the types. I'll look at the link you sent.
19:39:47FromDiscord<Elegantbeef> Well I've told you to use an object variant there is no way in a statically typed language like Nim to have a field refer to two types
19:40:29FromDiscord<Elegantbeef> Even in those pesky Rust style 'adt's you need to have deliminted logic
19:40:35FromDiscord<Elegantbeef> delimited\
19:41:01FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4z0w
19:41:22FromDiscord<Elegantbeef> accidental colon
19:41:37FromDiscord<michaelb.eth> (edit) "https://play.nim-lang.org/#ix=4z0w" => "https://play.nim-lang.org/#ix=4z0y"
19:43:43FromDiscord<Elegantbeef> Man vcpkg is silly, I was all happy cause it lists a bunch of different platforms that it has assimp for, but it doesnt cross compile to any of them ... so it does nothing useful for someone using linux
20:02:42FromDiscord<millymox> sent a code paste, see https://play.nim-lang.org/#ix=4z0G
20:04:44FromDiscord<Elegantbeef> Time to use a generic
20:05:03FromDiscord<millymox> enlighten me Elegantbeef
20:06:01FromDiscord<Elegantbeef> Hard to say I just said use a generic
20:06:29FromDiscord<Elegantbeef> You're providing code that is convoluted
20:10:16FromDiscord<graveflo> design problems are not easily advisable without knowing the intentions of a project. People can give you tools but you have to use them. Here is a tool that is probably not the best one but its so general that I can say it will work in this case despite it's ill fit. Make `Task` a new root object with the `inheritable` pragma and then make two sub classes of `Task` inheriting from it. Then you can use the root object you created to have a da
20:22:49FromDiscord<heysokam> silly question: `ptr ptr SomeType` is a legal type, right?
20:22:58FromDiscord<Elegantbeef> Of course
20:23:04FromDiscord<heysokam> kk ty
20:23:08FromDiscord<Elegantbeef> Generally pointless as you likely want `var ptr T`
20:23:24FromDiscord<heysokam> its an element of a struct
20:23:45FromDiscord<Elegantbeef> Right the rare case it's not pointless
20:24:34*ntat quit (Quit: Leaving)
20:36:08PMunch@heysokam, hmm, a visibility attribute inside a struct?
20:44:11FromDiscord<heysokam> idk, i wrapped it all manually. i was wasting time. took the preexisting implementation and did a manual pass adding what was missing, and checking what was there 🤷‍♂️
20:44:59PMunchHmm, looking at assimp I'm not sure if it is even valid C..
20:45:00FromDiscord<heysokam> the idea was to save time with futhark, but i was debugging issues that i didn't need to, so manual/tedious work ended up being more reliable
20:45:25FromDiscord<heysokam> yeah, the C api is a bit of a mess
20:45:28PMunchFor a one shot thing, sure. But good look repeating it if they come out with another version..
20:45:50PMunchThey seem to add a `__declspec(dllexport)` to a struct..
20:45:54FromDiscord<heysokam> i couldn't even rename things, so...
20:46:32FromDiscord<heysokam> i figure there must be a way, but seeing that i couldn't even do the basics like that, i just went the manual way
20:46:34PMunchThat is weird
20:47:06FromDiscord<heysokam> it has worked well for other stuff, but seems like it crashes a lot with this lib for some reason
20:56:20PMunchHmm, I figured out the naming issue
20:57:22PMunchIt had to be `struct_aiscene`
20:57:29FromDiscord<yandall> Hi guys, quick question. Is possible to define an object like this?
20:58:37FromDiscord<yandall> sent a code paste, see https://play.nim-lang.org/#ix=4z0M
20:59:11PMunchNot inline like that
20:59:19PMunchYou could of course use a tuple
20:59:23PMunchBut an object needs a name
21:00:41FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4z0O
21:01:56FromDiscord<yandall> Thanks
21:04:51PMunch@heysokam, do you have the code for your Futhark attempt?
21:05:10PMunchI'd like to see what's going on
21:15:26FromDiscord<heysokam> i deleted it 😔
21:15:41FromDiscord<heysokam> but it was mostly like the example
21:16:03FromDiscord<heysokam> i was importing cimport.h... and when i added scene.h it crashed
21:16:20PMunchcimport.h?
21:20:20FromDiscord<heysokam> yeah, from assimp
21:21:00FromDiscord<heysokam> https://github.com/assimp/assimp/tree/master/include/assimp
21:21:03PMunchAh, yes now I got the issue
21:21:23FromDiscord<heysokam> aka: https://github.com/assimp/assimp/blob/master/include/assimp/cimport.h
21:29:20*beholders_eye quit (Quit: WeeChat 3.6)
21:32:55PMunchOkay, try Futhark HEAD, it should work now
21:34:43PMunchSpits out this definition for aiscene: http://ix.io/4z0X
21:34:48PMunch@heysokam ^
21:38:15FromDiscord<heysokam> its almost done. will try if they happen to make some release that breaks everything or something
21:38:32FromDiscord<heysokam> or for the next lib that I need to wrap
21:38:58PMunchhttp://ix.io/4z0Z <- Just in case you want to try it out
21:40:37FromDiscord<heysokam> zenks 🙂
22:15:03*xaltsc joined #nim
22:19:33*PMunch quit (Quit: leaving)
22:28:43*xet7 joined #nim
22:43:05FromDiscord<takko_the_boss> "Ass Imp" is what I opened this chat to. Amazing.
23:07:06FromDiscord<bungfro> sent a code paste, see https://play.nim-lang.org/#ix=4z1e
23:07:27FromDiscord<bungfro> Theres a bunch more that spammed the console, that's just the first one.
23:07:38FromDiscord<Elegantbeef> read the error
23:07:53FromDiscord<Elegantbeef> "mismatch at position 1" that means you gave it a `Embed` but it wanted `string`
23:11:17FromDiscord<bungfro> sent a code paste, see https://play.nim-lang.org/#ix=4z1g
23:12:42FromDiscord<Elegantbeef> do you not have `std/json` imported?
23:13:48FromDiscord<bungfro> I do
23:14:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4z1j
23:15:51FromDiscord<bungfro> Same error
23:15:59FromDiscord<Elegantbeef> Well read the error
23:18:25FromDiscord<Elegantbeef> The condescension is due to you not sharing the error
23:23:24FromDiscord<bungfro> It's the same error that I sent the first time
23:23:32FromDiscord<Elegantbeef> It clearly isnt
23:24:35FromDiscord<Elegantbeef> `formatstr, a: string): string` is from strutils
23:28:17FromDiscord<bungfro> sent a code paste, see https://play.nim-lang.org/#ix=4z1m
23:28:47FromDiscord<Andreas> sent a long message, see http://ix.io/4z1n
23:35:49FromDiscord<Elegantbeef> What is the type of `embed`
23:38:59FromDiscord<bungfro> sent a code paste, see https://play.nim-lang.org/#ix=4z1s
23:39:21FromDiscord<Elegantbeef> Doesnt that mean you should use `%`
23:40:57FromDiscord<bungfro> Tried that already, doesn't work. Brings back the exact same error.
23:42:47termerHow would you make a const array of uint8?
23:42:49*derpydoo joined #nim
23:43:10FromDiscord<Elegantbeef> \`const a = [0u8, 2, 3, 4, 5, 6, 7, ...]
23:43:17termeroh, I have to cast the first one
23:43:21termerconst pixmapX: array[1, uint8] = [0]
23:43:23termerI was doing this
23:46:46FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4z1u
23:47:31FromDiscord<heysokam> c2nim said `ptr ptr`, but the original wrapper im using as reference used `ptr UncheckedArray[ptr ]`
23:47:59FromDiscord<demotomohiro> It depends on whats `mskeleton` means.
23:48:31FromDiscord<heysokam> it believe its a pointer to an array of skeleton data
23:50:29FromDiscord<demotomohiro> Then, `ptr ptr UnckeckedArray[Skeleton]`.
23:51:17FromDiscord<heysokam> the rest of the lib that was mapped before says `ptr UncheckedArray[ptr ...]`... why ptr ptr array? 🤔
23:52:21FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4z1w
23:52:37FromDiscord<heysokam> im just confused because c2nim said ptr ptr, but don't really understand the difference
23:58:52FromDiscord<demotomohiro> `SomeType pdata;` in C can be `ptr Sometype` or `ptr UnckeckeArray[SomeType]` become `SomeType pdata;` can points to single value or array.