<< 05-04-2023 >>

00:00:25FromDiscord<Elegantbeef> and `{.compile "nanovg.c".}` fails?
00:01:24FromDiscord<Ayy Lmao> No I can compile the c file. I just can't use the c header
00:01:44FromDiscord<Elegantbeef> But if you're compiling the C file you do not need to use the C header
00:02:14FromDiscord<Elegantbeef> Ah i guess gl and utils both include nanovg.h
00:02:19FromDiscord<Elegantbeef> Thought it was the other way around
00:02:24FromDiscord<Ayy Lmao> The c headers have all this crazy platform specific define nonsense that I was suspecting is maybe causing my problems with webassembly
00:02:33FromDiscord<Ayy Lmao> So I figured I would be better off trying to use them
00:03:18qpls1908@demotomohiro thanks :)
00:03:22qpls1908just what I was looking for
00:03:42qpls1908I still wish {} was just syntactic sugar for a hash table though
00:03:58qpls1908{}.newTable feels a bit clunky
00:04:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4sGe
00:04:34FromDiscord<Ayy Lmao> Yeah that only works if you do it from the user side
00:04:39FromDiscord<Ayy Lmao> You can't do that in the module itself
00:04:39FromDiscord<Elegantbeef> You say you wish it was just syntax sugar but using the same syntax we have 3 different tables
00:04:49FromDiscord<Elegantbeef> Right i think i had a similar issue for my wasm stuff
00:05:07FromDiscord<Elegantbeef> Plus the syntax makes things like `newHeaders` much cleaner
00:05:52FromDiscord<Elegantbeef> And since nim is a system language you can use the syntax on your own hash tables without any overhead of allocating a 'builtin' hash table
00:05:54FromDiscord<Elegantbeef> So all in all it's actually a good idea for a system language imo
00:06:58FromDiscord<Ayy Lmao> The problem I was having with webassembly was weird, I could get nanovg to run, but if I tried to wrap the library in another nicer module, it wouldn't work.
00:07:21FromDiscord<Ayy Lmao> I couldn't wrap my head around it.
00:07:29FromDiscord<Elegantbeef> And you made your own `myHeader.h` which imported the files and used it inside a `{.importc:..., header:....}`?
00:07:52FromDiscord<Ayy Lmao> Yeah, but I am somehow getting issues with multiple definitions doing that
00:08:07FromDiscord<Ayy Lmao> All of the headers have include guards so I don't know how that's happening
00:10:44FromDiscord<Ayy Lmao> I'll try it again and see if I can get it to break again
00:14:43FromDiscord<Ayy Lmao> Ok so it works, but if I try to make a function inside the module that initializes glad I get spammed with `multiple definition of nvgCreateGL3` etc
00:14:51FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4sGg
00:15:18FromDiscord<Ayy Lmao> If I make that function a template it works
00:16:48FromDiscord<Elegantbeef> Hmm i do see `#define NANOVG_GL3_IMPLEMENTATION`
00:17:04FromDiscord<Ayy Lmao> I'm doing {.passC: "-DNANOVG_GL3_IMPLEMENTATION".} in the module
00:17:21FromDiscord<Ayy Lmao> Oh wait do I need to do that in the include file?
00:17:35FromDiscord<Elegantbeef> That's perhaps a problem
00:17:36FromDiscord<Elegantbeef> https://github.com/memononen/nanovg/blob/7544c114e83db7cf67bd1c9e012349b70caacc2f/example/example_gl3.c#L27-L30
00:18:00FromDiscord<Ayy Lmao> So do you need to only define that once?
00:18:22FromDiscord<Elegantbeef> You should need it once after your `#include <nanovg.h>` apparently
00:19:19FromDiscord<Ayy Lmao> Hmm, not sure how to go about doing that with the header file approach that I'm doing
00:19:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4sGi
00:20:25FromDiscord<Ayy Lmao> but then #define NANOVG_GL3_IMPLEMENTATION would be defined in every module that it gets included in right?
00:20:37FromDiscord<Elegantbeef> After `nanovg` yes
00:20:48FromDiscord<Elegantbeef> I'm copying this code from their examples so it certainly works in C land
00:23:42FromDiscord<Ayy Lmao> For some reason it's telling me `undefined reference to nvgCreateGL3` when I do that and I'm trying to figure out why.
00:26:03FromDiscord<Ayy Lmao> And then I commented out some code, built it, and then uncommented the code and it's magically working. Not sure what to think about that
00:26:16FromDiscord<Elegantbeef> Might have had an old cache
00:26:24FromDiscord<Ayy Lmao> Yeah possibly a nimcache issue
00:26:25FromDiscord<Elegantbeef> `nim c -f ./yourCode.nim`
00:26:30*xet7 joined #nim
00:26:40FromDiscord<Ayy Lmao> does -f clear the nimcache or something?
00:26:49FromDiscord<Elegantbeef> It forces recompilation
00:26:56FromDiscord<Ayy Lmao> Good to know
00:28:23FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4sGl
00:29:32FromDiscord<Elegantbeef> Hmph, I'd change the `.h` files to `.c` then use `compile`
00:30:03FromDiscord<Elegantbeef> Only give the implementation define to the `nanovg.h`
00:30:10FromDiscord<Ayy Lmao> Specifically nanovg_gl.h and nanovg_gl_utils.h?
00:30:15FromDiscord<Elegantbeef> That way you should only have a single symbol
00:30:21FromDiscord<Elegantbeef> Yea
00:31:03FromDiscord<Ayy Lmao> The implementation define only affects nanovg_gl.h it looks like
00:31:28FromDiscord<Ayy Lmao> So maybe passing it to the compiler with passC would work if I compile it or something
00:39:11FromDiscord<Ayy Lmao> Ugh nanovg_gl and nanovg_gl_utils both need to know about the openGl types
00:39:36*arkurious quit (Quit: Leaving)
00:39:50FromDiscord<Ayy Lmao> And I remember that was different on webassembly
00:57:27qpls1908@Elegantbeef: It seems like it would make more sense to make {} a normal hash table and then just use constructors for ordered tables when you really need them
00:57:36qpls1908that's what most other languages do (e.g python)
00:57:57qpls190899% you don't care about ordering anyway
00:58:00FromDiscord<Elegantbeef> Except that now has a builtin hashtable in the language and has overhead for other types for the nice syntax
00:58:33qpls1908I assume you could do this using macros
00:58:39qpls1908though I'm not familiar enough with nim
00:59:05qpls1908also, I'm not necessarily opposed to baking hash tables into the language (like Go), since they are ubiquitous
01:01:06FromDiscord<Elegantbeef> Well Go isnt a system language
01:01:59FromDiscord<Elegantbeef> But the point is that you might want another table implementation depending on target, and having something that is not really a primitive in the language isnt the smartest imo
01:02:56qpls1908I don't see how go not being a 'systems language' is relevant
01:02:57FromDiscord<Elegantbeef> I very much like a small core language that can be extended in userspace
01:03:10qpls1908{} is already syntactic sugar
01:03:25qpls1908you could just modify it to correspond to the vanilla hashtable implementation
01:03:31qpls1908which makes the most sense in the majority of cases
01:03:44FromDiscord<Elegantbeef> I do not care about the syntax sugar 😄
01:03:45qpls1908the user can still use other hash tables by using constructors (the two are not mutually exclusive)
01:03:49FromDiscord<Elegantbeef> The thing is having it be the default table is not too wise imo
01:03:50qpls1908lol
01:03:51qpls1908ok
01:04:05qpls1908in that case, you might as well use rust
01:04:16qpls1908nim's main appeal is that it has the ergononics of python
01:04:17FromDiscord<Elegantbeef> Nope
01:04:35FromDiscord<Elegantbeef> I love that you're telling me it's appeal
01:04:54qpls1908🙄
01:05:15FromDiscord<Elegantbeef> I really just think that having a default table implementation isnt needed given that it can be done ergonomically in userspace code
01:05:59qpls1908yes, but it would be even more 'ergonomic' not to require it to be explicitly specified imo
01:06:11FromDiscord<Elegantbeef> Sure, but we're splitting hairs
01:06:26FromDiscord<Elegantbeef> Which is a better table `TableRef` or ` Table`
01:06:39qpls1908that is utterly irrelevant
01:06:52qpls1908if we are talking about a syntax feature, then discussion about said feature is germane
01:06:53FromDiscord<Elegantbeef> It very much is relavant
01:07:01qpls1908to suggest it is 'splitting hairs' is tautological
01:07:07FromDiscord<Elegantbeef> If it's a builtin hashtable should it be a ref or a value
01:07:23FromDiscord<Elegantbeef> In python it'd be a ref afaik
01:07:27FromDiscord<Elegantbeef> In JS it's a ref
01:07:48FromDiscord<Elegantbeef> I realise i'm being an asshat so i'll apologise and shush
01:11:07FromDiscord<Ayy Lmao> How can you tell if you're using emscripten from c?
01:11:15FromDiscord<Ayy Lmao> Having trouble finding info on this for some reason.
01:11:23FromDiscord<Elegantbeef> It probably sets a define
01:13:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4sGw
01:14:13FromDiscord<Ayy Lmao> Cool I'll give it a try, thanks!
01:18:22FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4sGx
01:18:24*nanxiao joined #nim
01:39:35FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4sGB
01:40:36FromDiscord<Elegantbeef> That's not a closure
01:41:02FromDiscord<Ayy Lmao> I guess I'm confused what a closure is then
01:41:10*noxp joined #nim
01:41:31FromDiscord<Elegantbeef> `gfx` is a top level variable so no capture is required
01:41:39FromDiscord<Elegantbeef> it's just a normal pointer procedure
01:41:45FromDiscord<Elegantbeef> you can do `GcRef(gfx)`
01:42:54FromDiscord<Ayy Lmao> I was under the impression this whole time that if you have access to a ref it hasn't been freed yet.
01:43:27FromDiscord<Ayy Lmao> I guess this is a weird niche case
01:43:36FromDiscord<Elegantbeef> Well you are creating a procedure that is going out to FFI
01:44:34FromDiscord<Ayy Lmao> I'd like to not have to worry about that sort of thing on the user side and take care of it in the module. Is this a dumb way to do an interface to an os window?
01:44:46FromDiscord<Ayy Lmao> I was trying to maintain the glfw style way of doing things but have it work on emscripten
01:45:13FromDiscord<Elegantbeef> No clue
01:45:39FromDiscord<Ayy Lmao> Where exactly do I do GcRef(gfx)?
01:45:57FromDiscord<Elegantbeef> Before the proc declaration
01:46:00FromDiscord<Elegantbeef> Or after i guess
01:46:04FromDiscord<Elegantbeef> Anywhere before it goes back to C
01:46:10FromDiscord<Elegantbeef> That way the ref isnt cleared at the bottom
01:47:06FromDiscord<Ayy Lmao> Yeah that works. My goodness though that was insidious not knowing that
01:48:08FromDiscord<Arathanis> is that the same as `GC_ref` in system?
01:48:16FromDiscord<Ayy Lmao> I think so
01:48:18FromDiscord<Arathanis> oh wait, nim lets you ignore the "_"
01:48:22FromDiscord<Arathanis> so it is the same lol
01:48:26FromDiscord<Ayy Lmao> Yeah it's just a different way of writing it
01:48:28*noxp quit (Quit: Leaving)
01:48:46FromDiscord<Arathanis> pretty sure when your program terminates you want to `GcUnref`
01:48:56FromDiscord<Arathanis> or technically `GC_unref`
01:48:58*noxp joined #nim
01:49:23*noxp quit (Remote host closed the connection)
01:50:14FromDiscord<Ayy Lmao> What's the point of unreffing at the top level out of curiosity? Like if the program terminates aren't the resources freed anyway?
01:50:23*noxp joined #nim
01:50:55*noxp quit (Client Quit)
01:52:17FromDiscord<Arathanis> well one your program is done I believe you should do that.
01:52:36FromDiscord<Arathanis> first you are saying "this variable is referenced, I promise. you just cant see it"
01:52:40FromDiscord<Arathanis> then you are telling it the reference is gone
01:53:05FromDiscord<Elegantbeef> It doesnt matter too much but your destructor wont run so if that has a side effect that wont happen
01:53:08FromDiscord<Arathanis> but beef probably knows better than me how required it is, my understanding is they should always be paired
01:53:39*noxp joined #nim
01:53:41FromDiscord<Ayy Lmao> So if my program is based on an FFI loop like in emscripten, I am doomed to GcRef any refs I use at top level?
01:53:43FromDiscord<Elegantbeef> It should be unrefed eventually but it's likely not a big deal in your case
01:53:57FromDiscord<Elegantbeef> You're doomed to use GCRef across the FFI bridge
01:54:01FromDiscord<Arathanis> also keep in mind that you must unref something as many times as you ref it
01:54:07FromDiscord<Arathanis> its basically incrementing the reference count
01:54:48FromDiscord<Ayy Lmao> I don't think I can unref it then if there's no way to hold the execution
01:54:50FromDiscord<czgchsz> It's like C though, in main() why free if the allocated char \ will get freed anyway upon termination? That said I always free what I allocate no matter what, used to it.
01:55:04*jmdaemon quit (Ping timeout: 276 seconds)
01:55:10FromDiscord<Elegantbeef> This is just par for the course for FFI + Refs since they're really just fancy allocators
01:56:40FromDiscord<Ayy Lmao> I guess I could unref it if there's an event to close the window or something
01:57:05FromDiscord<Arathanis> sent a long message, see http://ix.io/4sGD
01:58:15FromDiscord<Ayy Lmao> I'll keep that in mind, although I think I need to figure out how to abstract this away from the user in my interface.
01:58:25FromDiscord<Ayy Lmao> Because that was a very hard bug to find
01:58:43FromDiscord<Arathanis> maybe with your own destructor?
01:59:17FromDiscord<Ayy Lmao> The problem is my destructor being called early, I want the user to never have to worry about that
01:59:43FromDiscord<Arathanis> you could make some nice templates to simulate a context manager that handles it for you
02:00:01FromDiscord<Arathanis> have them GC_ref on opening -> body -> GC_unref
02:00:05FromDiscord<Elegantbeef> You basically need a `OnEnd` procedure that is called by the program
02:00:14FromDiscord<Arathanis> or that, exactly
02:00:17FromDiscord<Arathanis> some kind of cleanup step
02:00:52FromDiscord<Ayy Lmao> I want to abstract the OnRef call away too. I'll have to do some thinking about how I want to structure it.
02:00:59FromDiscord<Ayy Lmao> GcRef
02:01:54FromDiscord<Ayy Lmao> I dont think GC_ref on opening -> body -> GC_unref works because I can't halt the code execution
02:02:04*grimlavik joined #nim
02:02:27FromDiscord<Ayy Lmao> It just plows through to the end and goes into the ffi loop
02:02:29FromDiscord<Elegantbeef> Whoops
02:02:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4sGF
02:02:57FromDiscord<Elegantbeef> Point is store the `myObj` and `init`/`deinit` proc then call them when the program closes
02:04:02FromDiscord<Ayy Lmao> I'll play around with that approach
02:20:50*jmdaemon joined #nim
02:22:31*nanxiao quit (Quit: Client closed)
02:46:14*nanxiao joined #nim
02:51:26*droidrage joined #nim
03:03:50FromDiscord<michaelb.eth> In reply to @qpls1908 "nim's main appeal is": wat?
03:53:40FromDiscord<0xrh0d4m1n> does nims support comments?
03:54:11FromDiscord<Elegantbeef> Yes
04:18:53FromDiscord<sOkam!> is it possible to write a `.nim` file from an ast in some way?
04:20:50FromDiscord<Elegantbeef> `writeFile(myNimNode.repr)`
04:23:23FromDiscord<Rika> filename where
04:23:26FromDiscord<Rika> smh
04:23:57FromDiscord<Elegantbeef> I'm probably as wrong as chatgpt
04:26:29FromDiscord<0xrh0d4m1n> is there any linter to disable `XDeclaredButNotUsed` ?
04:27:10FromDiscord<0xrh0d4m1n> (edit) "is there any linter ... to" added "cfg"
04:27:14FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html#compiler-usage-list-of-hints
04:27:31FromDiscord<0xrh0d4m1n> thx ❤️
04:31:06*nanxiao quit (Quit: Client closed)
04:45:38*noxp quit (Quit: Leaving)
05:03:48*rockcavera quit (Remote host closed the connection)
05:27:13*nanxiao joined #nim
05:32:48*advesperacit joined #nim
06:08:35*azimut_ quit (Ping timeout: 255 seconds)
06:32:47*kenran joined #nim
06:34:57*kenran quit (Remote host closed the connection)
06:38:03FromDiscord<ShalokShalom> In reply to @0xrh0d4m1n "does nims support comments?": was just merged, is just highly experimental and will break your computer
06:46:54*PMunch joined #nim
06:50:22*nanxiao quit (Quit: Client closed)
06:59:25*Notxor joined #nim
07:02:20FromDiscord<HitBlast> Is there a good library for formatting Nim code?
07:04:59*nanxiao joined #nim
07:14:42PMunch@HitBlast, formatting?
07:14:50PMunchI guess NimPretty might be what you're looking for
07:14:55Amun-Ranimpretty
07:35:27*ltriant quit (Ping timeout: 255 seconds)
07:35:34*arkurious joined #nim
07:54:30FromDiscord<Marcus> downgrade nim until they release the fix↵(@sOkam!)
08:03:35FromDiscord<Marcus> pMunch\: btw, did you consider integrating nimpretty into nimslp for formatting support?
08:05:38FromDiscord<Marcus> Oh, I see there's a wip PR. I'm struggling to parse the reasons it stopped tho https://github.com/PMunch/nimlsp/pull/59#issuecomment-1151200100
08:07:23PMunchNot sure why really
08:07:52PMunchIt would be nice to have it integrated indeed
08:08:12FromDiscord<Marcus> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1093083502297239563): pMunch\: btw, did you consider integrating nimpretty into nimlsp for formatting support?
08:08:30FromDiscord<huantian> one day nimpretty will be good enough for me to actually use 😛
08:08:37FromDiscord<Elegantbeef> Here's huan to say "Beed we should make nimpretty better"
08:08:40FromDiscord<Elegantbeef> beef\
08:09:27FromDiscord<huantian> lol beef you know me so well
08:09:40*kenran joined #nim
08:09:50FromDiscord<Elegantbeef> All the initiative of a wet paper bag
08:10:10FromDiscord<hellerbarde> Is there a version of nimlsp/nim/nim\ that did work? because I started with nim 2 days ago and I had to blacklist nimlsp from my neovim lsp autoconfig because it kept crashing. I just assumed it wasn't ready yet.
08:10:37FromDiscord<Elegantbeef> 1.6.10 and below should
08:10:48FromDiscord<Elegantbeef> Nim tooling is really subpar
08:11:23FromDiscord<huantian> not sure if it's initiative or just motivation
08:11:26FromDiscord<huantian> or unlazyness?
08:11:40FromDiscord<huantian> I will do something eventually one day
08:11:42FromDiscord<hellerbarde> Downgrade nim, and then re-compile nimlsp, yes?
08:11:53FromDiscord<Elegantbeef> Yea
08:12:29FromDiscord<hellerbarde> excellent. thanks! (Out of curiosity, is/was there a notice about this somewhere that I missed and is there a feed of that where I could follow?)
08:12:35FromDiscord<Marcus> Yeah, I'm on 1.6.10 now and lsp works.
08:13:15FromDiscord<Elegantbeef> Nope
08:13:54FromDiscord<huantian> Is nimlangserver dead on .12 as well?
08:14:05FromDiscord<hellerbarde> ok.
08:14:20FromDiscord<Elegantbeef> I think so huan
08:14:35FromDiscord<Elegantbeef> Seems to have fucked up the user settings
08:14:36FromDiscord<Elegantbeef> Kate that is
08:16:37FromDiscord<Elegantbeef> The lsp also seems to work with devel
08:16:41FromDiscord<Elegantbeef> Though no clue how reliable
08:16:42FromDiscord<Marcus> There's a link to the fix in nimlsp github issues nim-lang/Nim#21555
08:17:03FromDiscord<Marcus> Elegantbeef\: yeah because it was fixed, and we're just waiting for a new release of 1.6
08:17:19FromDiscord<Elegantbeef> Just use devel like a normal person 😛
08:17:47FromDiscord<hellerbarde> I installed Nim via nixpkgs \:) I shall switch to choosenim now.
08:19:28FromDiscord<huantian> Huh there’s so many nix users here
08:20:12FromDiscord<huantian> If you’re on NixOS choosenim probably won’t work, if you’re using nix on another distro then go ahead
08:20:46FromDiscord<hellerbarde> nix gained in popularity recently. I am using it because I was griping to a friend that my work laptop (Ubuntu) was lacking some newer version of something, so he showed me `home-manager` and I'm never going back.
08:21:00FromDiscord<hellerbarde> I'm on Ubuntu on this machine, so that should be good.
08:21:36FromDiscord<hellerbarde> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1093087824594608158): nix gained in popularity recently. I am using it because I was griping to a friend that my work laptop (Ubuntu) was lacking some newer version of something, so he showed me `home-manager` and I'm never going back (until I find a new toy ;) )
08:21:47FromDiscord<Elegantbeef> The more impressive thing is the matrix users! 😄
08:22:10FromDiscord<huantian> Yeah there’s like 4 of us here
08:22:52FromDiscord<hellerbarde> huh. So on Discord, you can see which are Matrix users? I don't think I can see (from Matrix) which of you are Discord users...
08:23:03FromDiscord<huantian> Wonder if it’d be worth to get a nix devel flake going…
08:23:08FromDiscord<Marcus> I'm also on nix \:)
08:23:09FromDiscord<Elegantbeef> Yea on discord we show up as bots
08:23:16FromDiscord<Elegantbeef> Discord users show up as `t2bot` users
08:23:30FromDiscord<Elegantbeef> @huantian notice the smelly huan's name
08:23:44FromDiscord<hellerbarde> I might or might not be planning to do that. So feel free to ping me if you think about doing it, and you might be lucky already.
08:23:49FromDiscord<Elegantbeef> `@_discordSnowflakeHere:t2bot.io`
08:24:38FromDiscord<huantian> Yeah it’s kinda weird that it seems to prioritize mh discord bridge account, and shows my full matrix url thing next to my name in chat
08:25:00FromDiscord<huantian> Also beef you’re the only one not on Nix in this convo maybe you should switch 🙃
08:25:26FromDiscord<Elegantbeef> Let me waste a shit load of time configuring my system for like -10 benefit
08:25:29FromDiscord<Elegantbeef> I use a total of like 3 programs
08:25:36FromDiscord<hellerbarde> indeed. But I kinda have to really want to see it. There seem to be pretty decent tools/methods to make my client just show the "pretty" usernames
08:26:08FromDiscord<Elegantbeef> IMmMutaBle DisTro
08:26:12FromDiscord<hellerbarde> 😂
08:26:51FromDiscord<Elegantbeef> Not to mention all the struggles it seems to cause
08:27:39FromDiscord<huantian> Nahhhhhhhhhhh I’ve experienced zero difficulties at all and definitely haven’t spent excessive amounts of time packaging some things
08:27:42*nanxiao quit (Quit: Client closed)
08:28:03FromDiscord<hellerbarde> tHaT wOuLd NeVeR hApPeN...
08:28:09FromDiscord<Elegantbeef> When i install an OS i just want to be able to install my software and use it
08:28:12FromDiscord<huantian> I’ll just keep an eye out for now, I don’t have anything rn that really needs to use devel so I’ll just stick with stable
08:28:21FromDiscord<Elegantbeef> I should be able to use my PC from scratch in like 30 minutes
08:28:47FromDiscord<huantian> Hey I mean I can use my PC immediately if I just use my preexisting config \:p
08:28:59FromDiscord<Elegantbeef> I almost never keep my home file alive
08:29:21FromDiscord<Elegantbeef> I purge that thing like 80% of the time
08:29:59FromDiscord<hellerbarde> is this really a discussion worth having? I think everyone should use what they want and feel like works for them.
08:30:27FromDiscord<huantian> Probably not I’m mostly just antagonizing beef
08:30:37FromDiscord<hellerbarde> Elegantbeef\: I find yours an evidently sensible position to have.↵I just like tinkering \:)
08:30:47FromDiscord<Elegantbeef> This is the meandering conversation room
08:31:48FromDiscord<huantian> Especially at this time of day
08:31:51FromDiscord<huantian> Or rather night
08:33:21FromDiscord<Rika> E
08:33:28FromDiscord<Elegantbeef> h
08:33:41FromDiscord<Rika> I like Nix the manager but not the language
08:35:26FromDiscord<huantian> I wish the language was more statically typed
08:35:32FromDiscord<hellerbarde> That's interesting. I actually really enjoy the language. I like that you can set properties both with nested Maps `foo = { bar = { baz =true }}}` or with a "path" like `foo.bar.baz = true`
08:35:47FromDiscord<hellerbarde> honestly, yes, me too. \:D
08:36:55FromDiscord<hellerbarde> actually, do you mean more explicitly statically typed? or how do you mean it?
08:37:32FromDiscord<huantian> I think something like that yeah
08:38:09FromDiscord<huantian> For general configuration I think the language is great, except for the lack of autocompletion and comforts like that
08:38:15*kenran quit (Remote host closed the connection)
08:38:38*kenran joined #nim
08:39:19FromDiscord<huantian> I have to actually try and build my system to see if I used a parameter wrong instead of having it show up in my editor for example
08:39:23*nanxiao joined #nim
08:39:50FromDiscord<Marcus> I don't like the nix stdlibs, always throwing some unparsable stack trace when you do something wrong. But the base language is mostly ok to work with.
08:41:29FromDiscord<huantian> I also don’t do much functional programming in general and I also never go super deep with the functional stuff of the language, at most just doing basic packaging
08:44:42FromDiscord<Rika> In reply to @hellerbarde "That's interesting. I actually": That’s nice of course but going further than that the syntax is awkward if you don’t use or like Haskell
08:45:31FromDiscord<huantian> Also docs need to be improved, but it seems that work on that is starting
08:51:22FromDiscord<hellerbarde> I guess. I don't know much Haskell, so I guess I can't speak on that. The syntax is quite different from C-like languages, but that's ok, isn't it? As long as it's consistent.↵(@Rika)
08:55:47FromDiscord<Elegantbeef> Consistent syntax does not mean good syntax
08:56:43FromDiscord<hellerbarde> Good is a matter of taste.
08:56:53FromDiscord<hellerbarde> within reason.
08:58:52FromDiscord<Marcus> I don't use haskell and I think nix syntax is pretty familiar. Also the parser does a good job of telling you how you fucked up when you forget quotes or semicolons and similar.
09:00:06FromDiscord<Elegantbeef> Meanwhile i'm writing a parser that doesnt even presently track line numbering
09:06:49FromDiscord<Rika> Maybe I’ve gone off the deep end and have a crazy complex config
09:06:54FromDiscord<faldor20> Hey. I'm looking to dos own unit testing in nim with mocks. I'm looking to test some code for nesper and want to mock the gpio pin interface. I've read some stuff in the forums about using patchfile but haven't found any examples and I'm struggling to get it working. Wondering if anyone has any advice?
09:07:03FromDiscord<faldor20> (edit) "dos own" => "do some"
09:13:22FromDiscord<Elegantbeef> make a config.nims, use the patchfile procedure to replace your module with one of the same API but different implementations
09:13:51FromDiscord<Elegantbeef> https://github.com/Yardanico/mimalloc_nim/tree/master/src
09:14:10FromDiscord<Elegantbeef> Whoops https://github.com/Yardanico/mimalloc_nim/blob/master/src/main.nims#L32
09:51:38NimEventerNew thread by nimnam: Future of typing ?, see https://forum.nim-lang.org/t/10072
09:53:11*PMunch quit (Quit: Leaving)
09:58:19*nanxiao quit (Quit: Client closed)
10:05:22FromDiscord<ricky> In reply to @hellerbarde "tHaT wOuLd NeVeR hApPeN...": 😅 ...
10:05:34FromDiscord<ricky> that used to be me until I moved 2 Nix
10:05:42FromDiscord<ricky> now life is ez
10:28:44FromDiscord<ieltan> In reply to @Elegantbeef "Let me waste a": I use NixOS, it is pretty tough but I can't go back
10:29:22*ltriant joined #nim
10:30:37FromDiscord<ieltan> In reply to @Rika "I like Nix the": Right, the language's lack of a static type system has me crying tears of blood.
10:31:15FromDiscord<ieltan> Error messages are not obvious across the board
10:32:00FromDiscord<ieltan> And you need to learn how everything works to not fall into recursive pitfalls
10:35:08FromDiscord<ieltan> One of my frustrations with Nix has been "declarative secrets", see this for example https://github.com/NixOS/nixpkgs/issues/24288
10:35:55*qpls1908 quit (Ping timeout: 248 seconds)
10:40:03FromDiscord<Rika> Oh this
10:40:10FromDiscord<Rika> I’ve still been trying to figure that out
10:42:25*jmdaemon quit (Ping timeout: 260 seconds)
10:44:27FromDiscord<ieltan> In reply to @Rika "I’ve still been trying": Well, it's just my opinion but I think Nix is just ill-suited for secrets for multiple reasons, that's why I gave up using Nix for 'em
10:45:15FromDiscord<ieltan> Like i have a `pass` password-manager
10:45:52FromDiscord<ieltan> It's in its own private git repo that i just pull on my NixOS system
10:46:56FromDiscord<ieltan> And it just works, now maybe for things like VMs or a farm it'll be better to have something a bit more automatic
10:47:15*jmdaemon joined #nim
10:53:30FromDiscord<lluar> sent a code paste, see https://play.nim-lang.org/#ix=4sIv
11:14:26FromDiscord<S3cur3Th1sSh1t> sent a code paste, see https://play.nim-lang.org/#ix=4sIE
11:19:14FromDiscord<S3cur3Th1sSh1t> Nevermind, found out its possible with compiler flags.
11:21:53*jmdaemon quit (Ping timeout: 268 seconds)
11:42:53*xet7 quit (Remote host closed the connection)
11:45:44FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4sIS
12:21:13FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4sJ8
12:23:10FromDiscord<sOkam!> write that source code to a file
12:23:20FromDiscord<sOkam!> or print it to console or something
12:23:24FromDiscord<Rika> That’s not how you do it
12:23:36FromDiscord<Rika> The repr echo part goes inside the macro
12:23:38*rockcavera joined #nim
12:24:34FromDiscord<jmgomez> Or inside a compile time func called from a macro. Maybe static: works too. Not sure
12:24:37FromDiscord<sOkam!> how do you generate a file over multiple orders then? struggling to understand how to build it, since the return from the macro is just untyped
12:24:58FromDiscord<sOkam!> this is just making one single line, but the goal is to write more at once, without overwriting the file every time
12:25:25FromDiscord<sOkam!> (edit) "it," => "the string,"
12:25:32FromDiscord<jmgomez> Think of the macro as the last thing that triggers everything else. I generate the bindings for NimForUE just like that
12:26:21FromDiscord<Rika> You can’t get the node a macro returns from outside a macro iirc
12:26:24FromDiscord<sOkam!> yeah, i got everything inserted into an object. but still, don't know how to iterate over all the things without having to overwrite the file every call
12:27:43FromDiscord<sOkam!> i have a single object that contains some representation of what the code will look like (coming from a json file)... but don't know how to convert all of it into code, since it contains a lot of it
12:28:20FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4sJb
12:29:02FromDiscord<sOkam!> how do you add more lines to it?
12:29:08FromDiscord<jmgomez> @sOkam! you want to gather all the code using functions and then foldl all the nodes togetether and print them where you want
12:29:15FromDiscord<jmgomez> what do you mean?
12:29:23FromDiscord<sOkam!> i mean that the example is doing one single line
12:29:26*Notxor quit (Read error: Connection reset by peer)
12:29:45FromDiscord<jmgomez> I dont follow. What the number of line has to do?
12:30:00FromDiscord<sOkam!> that i don't know how to add more lines to that
12:30:11FromDiscord<jmgomez> You compose the NimNodes via nnkStmList
12:30:56*Notxor joined #nim
12:32:34FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4sJc
12:32:53FromDiscord<sOkam!> i don't have the code
12:33:01FromDiscord<sOkam!> im trying to create it
12:33:10FromDiscord<jmgomez> It doesnt matter
12:33:14FromDiscord<sOkam!> does that accept the macro i linked?
12:34:02FromDiscord<jmgomez> yes, but remember you cant call macros from macros that's why I used procs
12:34:13FromDiscord<sOkam!> i don't remember, i just don't know
12:34:23FromDiscord<sOkam!> i can't remember
12:39:51FromDiscord<sOkam!> calling the macro doesn't work there
12:40:20FromDiscord<sOkam!> it just takes the macro name itself instead of expanding its result
12:44:21FromDiscord<jmgomez> Dont follow
12:44:47FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4sJf
12:45:05FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4sJg
12:45:21FromDiscord<sOkam!> testgen is a macro that returns a proc
12:46:03FromDiscord<jmgomez> Told you before, use procs if you want to compose multiple calls
12:46:11FromDiscord<sOkam!> those are procs
12:46:34FromDiscord<jmgomez> In reply to @sOkam! "testgen is a macro": 👆
12:46:38FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4sJh
12:46:55FromDiscord<sOkam!> yeah but how do you even generate from an object that contains strings, if you cannot use a macro
12:48:18FromDiscord<jmgomez> I dont understand what you just said
12:48:36FromDiscord<jmgomez> generete from an object that contains a string?
12:49:05FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4sJi
12:50:02FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4sJk
12:50:55FromDiscord<jmgomez> What's the problem?
12:51:34FromDiscord<sOkam!> that i just tried to generate multiple with something that is meant to generate code, but i get the call itself converted instead of its contents
12:52:36FromDiscord<sOkam!> if that doesn't work, i literally cannot grasp how to convert from the object that contains strings defining the code itself, because there are a lot of them
12:53:27FromDiscord<jmgomez> oh you mean that it converts the code for you into NimNodes?
12:53:43FromDiscord<sOkam!> i mean that your examples already have the code
12:53:50FromDiscord<sOkam!> i don't have it, its represented as strings
12:53:58FromDiscord<jmgomez> That doesnt matter
12:54:01FromDiscord<sOkam!> i need to generate it, and the shapes are wildly different
12:54:13FromDiscord<sOkam!> well it does, when i tried right there and it failed. so asking what i did wrong
12:59:11FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4sJn
13:00:12FromDiscord<sOkam!> that is still generating the code from existing nim code
13:00:39FromDiscord<jmgomez> No, it's generating parametric code based on a parameter which is to some extend what you said you want to do
13:01:18FromDiscord<jmgomez> I dont see what's your issue, is maybe with genAst?
13:01:59FromDiscord<sOkam!> my issues is that i asked genAst, and it resolved to the call itself, and not to the generated code that comes from that call
13:02:34FromDiscord<jmgomez> I use it because it's more readable but genAst does "generate" code
13:03:25FromDiscord<jmgomez> you can replace the it with nnkProc or what you need. The principle it's the same
13:04:04FromDiscord<sOkam!> i don't understand that line at all, not sure what its doing or how to replace it
13:05:40FromDiscord<jmgomez> sent a code paste, see https://paste.rs/PWs
13:06:19FromDiscord<jmgomez> and you will see how it generates the tree. You can try to recreate it yourself if that makes you understand it better
13:09:47FromDiscord<sOkam!> i think im too tired today to get it. i saved it and will read it tomorrow
13:09:59FromDiscord<sOkam!> (edit) "read" => "try"
13:26:47FromDiscord<Ayy Lmao> How do I wrap `pthread_t` in nim? I'm not on Linux and I can't seem to find the header anywhere.
13:28:45Amun-Ratype pthread_t* {.incompletestruct.} = object
13:30:02FromDiscord<HitBlast> Does anybody here have experience with nimwave here? I'd like to render a simple text box with a few elements inside but seems like I'm doing something wrong. https://media.discordapp.net/attachments/371759389889003532/1093165651432067213/Screenshot_2023-04-05_at_7.15.47_PM.png
13:30:12FromDiscord<HitBlast> I've imported nimwave using `from nimwave as nw import nil`
13:30:12Amun-Rayou only operate on pointer to pthread_t either way; I found that to be the best type equivalent
13:30:33FromDiscord<Ayy Lmao> In reply to @Amun-Ra "type pthread_t* {.incompletestruct.} =": Cool, didn't know about that pragma. What is the difference between using ptr object?
13:30:46FromDiscord<Ayy Lmao> `type pthread_t = ptr object` for instance
13:31:45Amun-Rathat works too; it really depends whether you want to implement API 1:1 or not
13:32:17Amun-Rait 'ptr object' example you have to remember that your pthread_t is C's pthread_t*
13:32:31Amun-Ras/it/in/
13:33:24FromDiscord<Ayy Lmao> Is pthread_t not a pointer itself?
13:33:33Amun-RaI sometimes do: type FooObj {.incompletestruct.} = object; type Foo* = ptr FooObj to be more explicit
13:34:17Amun-Rahmm, iirc it's an integer of some length
13:34:38Amun-Raso… disregard what I was writing
13:35:04Amun-RaI mistook thread_t for something else
13:36:02Amun-Ramy example described opaque type in C
13:37:46FromDiscord<Ayy Lmao> Would it be safe to treat it as a void pointer maybe?
13:44:44Amun-RaI don't think so
13:50:06*jmdaemon joined #nim
13:54:09FromDiscord<turbo> Is there a std function or nim library to humanize time spans? So a few seconds -> "x seconds", 1440 min -> "1 day", etc.
13:55:09FromDiscord<Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4sJz
13:56:02FromDiscord<Nerve> (edit) "https://play.nim-lang.org/#ix=4sJz" => "https://play.nim-lang.org/#ix=4sJA"
13:57:21FromDiscord<Nerve> Oh the `=>` parameters are not destructuring the tuple
13:57:23FromDiscord<Nerve> hmmmm
13:58:30*jmdaemon quit (Ping timeout: 250 seconds)
13:58:55FromDiscord<Nerve> So I have to do `zip(a_seq, b_seq).map(ab => (ab[0] ab[1]) / 3.14159)`?
13:59:04FromDiscord<Nerve> Is there no cleaner way to destructure the tuple?
14:01:34*jmdaemon joined #nim
14:05:52*jmdaemon quit (Ping timeout: 250 seconds)
14:31:09*kenran quit (Remote host closed the connection)
14:45:53*jmdaemon joined #nim
15:02:08FromDiscord<Ayy Lmao> sent a code paste, see https://paste.rs/NH1
15:14:21*jmdaemon quit (Ping timeout: 268 seconds)
15:18:33*azimut joined #nim
15:29:34FromDiscord<demotomohiro> @Ayy Lmao You might need to wrap `const EmscriptenUiEvent` type like this: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#use-nim-with-other-language-how-to-wrap-const-charstar-type-in-cqmark
15:31:18FromDiscord<Ayy Lmao> I'll try that if I have more problems, I might have figured out a way to get it working.
15:54:56FromDiscord<sOkam!> how would you run Nim code from inside a cpp project 🤔↵I figure you would build it into a `.a` file, and link with it? is that correct?↵also, how would you access the procs. would the other project require some custom-made header file to declare the exportc nim procs or something?
16:05:01FromDiscord<Arathanis> In reply to @sOkam! "how would you run": ive done this before, compiled the nim code using the cpp backend to a static library, provided a header file and then imported it directly into a cpp projecg.
16:05:03FromDiscord<Arathanis> (edit) "projecg." => "project."
16:05:20FromDiscord<Arathanis> (edit) "project." => "project and linked the static lib."
16:07:50FromDiscord<Arathanis> `nim cpp --noMain:on --gc:orc -d:useMalloc --app:staticlib ...`
16:08:54*grimlavik quit (Quit: Client closed)
16:10:23FromDiscord<sOkam!> ✍️
16:13:22FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4sKc
16:13:44FromDiscord<sOkam!> kk
16:14:11FromDiscord<Arathanis> (edit) "https://play.nim-lang.org/#ix=4sKc" => "https://play.nim-lang.org/#ix=4sKd"
16:14:42FromDiscord<Arathanis> i usually put the once-wrapped call to `NimMain` in a function called `initialize` or similar.
16:15:20*jmdaemon joined #nim
16:21:22*kenran joined #nim
16:37:55*kenran quit (Remote host closed the connection)
16:57:14*lucasta joined #nim
17:29:02*redj quit (Ping timeout: 246 seconds)
17:31:23FromDiscord<jmgomez> @ShalokShalom you can also generate a dll or even embed the cpp code directly in the project (we do both in NUE)
17:31:43FromDiscord<jmgomez> In reply to @jmgomez "<@208199869301522432> you can also": ups wrong tag @sOkam!
18:08:42*arkurious quit (Quit: Leaving)
18:34:28FromDiscord<morgan> nimble.directory's cert seems to have expired yesterday
18:35:53*junaid_ joined #nim
18:36:01FromDiscord<Gumbercules> now if only nimble would expire
18:36:11FromDiscord<morgan> hm?
18:36:15*junaid_ quit (Client Quit)
18:37:03FromDiscord<Gumbercules> I'm kidding in the sense that I know it won't happen, but I wish it would go the way of the dodo bird.
18:37:06*junaid_ joined #nim
18:37:09FromDiscord<morgan> why?
18:37:15FromDiscord<Gumbercules> Because it's hot garbage.
18:38:25FromDiscord<Gumbercules> it's overly complex, poorly documented, tries to do too many things and ends up not doing anything well
18:40:23FromDiscord<Gumbercules> I want a package manager to manage packages - that's pretty much it...
18:46:36NimEventerNew Nimble package! hyper - Binding for hyper an HTTP library, see https://github.com/thechampagne/hyper-nim
19:02:45FromDiscord<ieltan> In reply to @Gumbercules "now if only nimble":
19:03:48FromDiscord<ieltan> In reply to @Gumbercules "I want a package": What's the name of the package manager made by "the one who shall not be named" again?
19:04:07FromDiscord<Gumbercules> nimph I think?
19:04:21FromDiscord<ieltan> Yeah, think it's a proper one or not?
19:04:31FromDiscord<Gumbercules> https://github.com/disruptek/nimph
19:04:51*qpls1908 joined #nim
19:05:29FromDiscord<Gumbercules> I've never used it but I've heard good things - I tend to just rely on git submodules and Nim tasks for building my project (I'm not writing libraries for anyone atm). It's terrible, but works out better than using nimble.
19:05:57FromDiscord<ieltan> Wow, crazy lol.
19:06:19FromDiscord<ieltan> I'll try nimph later too
19:06:38NimEventerNew Nimble package! rure - Binding for rust regex library, see https://github.com/thechampagne/rure-nim
19:06:38NimEventerNew Nimble package! rustls - Binding for rustls a TLS library, see https://github.com/thechampagne/rustls-nim
19:09:31FromDiscord<Phil> Man, I just ran into one of those "Oh my god how am I this dumb" errors
19:10:10FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4sKM
19:10:25FromDiscord<Phil> Sidenote, this code is 8 months old, so this function can never ever have worked properly
19:11:38NimEventerNew Nimble package! whisky - A blocking WebSocket client, see https://github.com/guzba/whisky
19:12:05FromDiscord<Yepoleb> It's raining packages again
19:12:19FromDiscord<Phil> Halleluja?
19:12:55FromDiscord<Yepoleb> doing some merging on vacation
19:17:48FromDiscord<morgan> i think im gonna start working on a library to turn desmos graphs into functions
19:18:49FromDiscord<Nerve> what is the preferred method to pop/delete the first element in a seq?
19:21:30FromDiscord<Phil> I don't think there's a default method outside of the `delete`
19:21:42FromDiscord<Phil> If we had a pop method I'd use that, but I think you'll need to define that yourself
19:22:30FromDiscord<guzba> pop exists but removes last iirc. del vs delete and the ordering question with seqs and the cost of moving in th order-preserving case↵consider using https://nim-lang.org/docs/deques.html if you have the choice? has popFirst and all that ready to roll
19:22:46FromDiscord<guzba> (edit) "th" => "the" | "case↵consider" => "case, bleh↵consider"
19:23:15FromDiscord<Phil> I stand corrected, couldn't find it in sequtils thus assumed it didn't exist, but yeah pop is a thing
19:23:27FromDiscord<Nerve> yeah deque is probably the way to go if ti has a popfront
19:23:38FromDiscord<Nerve> (edit) "ti" => "it"
19:23:59FromDiscord<guzba> ive found std/deques to be a super useful little thing, big fan
19:26:31*qpls1908 quit (Quit: leaving)
19:40:50FromDiscord<Phil> I kind of sort of regret not using a linked-list to denote the order of "scenes" in a "diaryentry" table now
19:44:35FromDiscord<Elegantbeef> Is the performance that bad?
19:54:06FromDiscord<Phil> No, but my alternative approach (have a column called "order_index") is proving cumbersome as fuck
19:54:50FromDiscord<Elegantbeef> Time for a rewrite
19:55:36*lucasta quit (Quit: Leaving)
20:01:53*Notxor quit (Quit: Leaving)
20:01:57FromDiscord<Phil> Nevaaaaaa
20:02:01FromDiscord<Phil> Not if it means also having to touch the underlying datastructure as well as frontend
20:04:16FromDiscord<Elegantbeef> Hi it's clippy, it seems you exposed implementation details to the users.... have you tried not?
20:07:06*xet7 joined #nim
20:26:42*junaid_ quit (Remote host closed the connection)
20:29:35FromDiscord<Phil> If I start linked listing I expose the doubly linked list datastructure that the frontend needs to be aware of anyway
20:29:44FromDiscord<Phil> (edit) "If I start linked listing I expose the doubly linked list datastructure that the frontend needs to be aware of anyway ... " added "if it's supposed to keep things in order"
20:31:31*advesperacit quit ()
20:51:32FromDiscord<Arathanis> sent a long message, see http://ix.io/4sL5
20:51:56FromDiscord<Arathanis> mangled, but im to lazy to edit it more 😎
20:52:01FromDiscord<Elegantbeef> That just seems toxic now!
20:52:19FromDiscord<Arathanis> maybe true lol
20:52:22FromDiscord<Arathanis> i can just delete it lol
20:52:30FromDiscord<Elegantbeef> Nah it's fine
22:41:06FromDiscord<faldor20> Thankyou! I used your example and was finally able to get it working. The docs for the function are pretty useless 😅
23:24:00*Jjp137 quit (Ping timeout: 250 seconds)
23:24:00*LyndsySimon quit (Ping timeout: 250 seconds)
23:24:49*Jjp137 joined #nim
23:25:51*LyndsySimon joined #nim