<< 13-08-2023 >>

00:02:29termerTrying out Mummy on stream https://live.termer.net/
00:05:04FromDiscord<Festive> How do i install from a github repo
00:05:16FromDiscord<Festive> (edit) "How do i install ... from" added "a pkg"
00:05:19FromDiscord<Festive> Specifically https://github.com/zer0pwned/nim-screenshot.git
00:14:03FromDiscord<ajusa> Man I should stream too
00:14:31FromDiscord<ajusa> Been building a blogging site for a family member using mummy which might be interesting to some folks
00:36:48FromDiscord<System64 ~ Flandre Scarlet> Poor performances? https://media.discordapp.net/attachments/371759389889003532/1140081483621597224/image.png
00:38:53FromDiscord<Elegantbeef> Where's the performance graph, that's cpu usage
00:41:14FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DiC
00:41:24FromDiscord<Elegantbeef> You didnt show anything of importance
00:41:31FromDiscord<Elegantbeef> You showed cpu usage, that means nothing
00:41:46FromDiscord<System64 ~ Flandre Scarlet> Isn't low CPU usage better?
00:42:30FromDiscord<Elegantbeef> Sure, but all high cpu means is that you're not giving up your work
00:42:48FromDiscord<Elegantbeef> `while true:` will eat an entire thread if you want
00:43:02FromDiscord<System64 ~ Flandre Scarlet> Oh
00:44:08FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DiD
00:44:22FromDiscord<System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#ix=4DiD" => "https://play.nim-lang.org/#ix=4DiE"
00:44:23FromDiscord<System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#ix=4DiE" => "https://play.nim-lang.org/#ix=4DiF"
00:45:13FromDiscord<Elegantbeef> Actually profile if you care, do not just look at the windows task manager and go "oh it's not doing so well"
00:45:51FromDiscord<System64 ~ Flandre Scarlet> Any easy way to profile on Nim?
00:45:58FromDiscord<Elegantbeef> Use a C profile
00:46:45FromDiscord<System64 ~ Flandre Scarlet> Oh alright↵There is Valgrind I think, but not sure if it works under Windows?
00:49:37FromDiscord<heysokam> @ElegantBeouf is `sink` the same as `consume` in rust?
00:50:11*disso-peach joined #nim
00:50:13FromDiscord<Elegantbeef> No clue
00:50:13FromDiscord<Elegantbeef> Sink moves the data
00:50:40FromDiscord<heysokam> In reply to @sys64 "Oh alright There is": i used nimprof iirc
00:52:04FromDiscord<Elegantbeef> It's not that great from what I hear, best to use a normal windows profiler afaik
00:54:24FromDiscord<System64 ~ Flandre Scarlet> This is weird I'm only able to compile under... Clang
00:54:28FromDiscord<System64 ~ Flandre Scarlet> (edit) "Clang" => "gcc"
01:10:16FromDiscord<Elegantbeef> simplescreenrecorder-2023-08-12\_19.08.45.mp4 https://media.discordapp.net/attachments/371759389889003532/1140089907071684628/simplescreenrecorder-2023-08-12_19.08.45.mp4
01:10:35FromDiscord<Elegantbeef> Ah a nimvm editor for nicoscript working sorta
01:15:12FromDiscord<Festive> sent a code paste, see https://play.nim-lang.org/#ix=4DiK
01:15:48FromDiscord<Elegantbeef> Probably somewhere in winim
01:40:02termerThe stream reported about 8 viewers consistently, I don't know who was watching other than beef and voidwalker, but thanks for everyone who watched
01:40:20*lucasta joined #nim
01:41:02FromDiscord<odexine> You were streaming?
01:41:23FromDiscord<Elegantbeef> Now now it was more of casting than streaming
01:52:32termerodexine, https://forum.nim-lang.org/t/10398
01:54:17FromDiscord<Chronos [She/Her]> How would a simple macro look for importing all files from a directory?
01:54:42FromDiscord<Chronos [She/Her]> Just something like using the name, removing the .nim and emitting an import statement right?
01:57:43FromDiscord<Chronos [She/Her]> Kinda wish I could just emit an AST without using a macro since this code is a one off but oh well
01:58:11FromDiscord<Elegantbeef> Write a task to generate a new nim file that makes a `import x; export x`
01:58:13FromDiscord<Elegantbeef> Problem solved
01:58:36*lucasta quit (Quit: Leaving)
01:59:30FromDiscord<Chronos [She/Her]> That just sounds a bit extra
02:00:24FromDiscord<Elegantbeef> Simpler than a macro
02:00:59FromDiscord<Chronos [She/Her]> The macro is like, 4-5 lines tops
02:01:05FromDiscord<Elegantbeef> Then write it
02:01:48FromDiscord<Chronos [She/Her]> I am, just wish I could make it a one-off AST insertion without defining a macro :p
02:11:32FromDiscord<jos7388> are there any nice error handling libs in nim?
02:11:51FromDiscord<jos7388> i'm writing a parser and something like rust's result type would be nice
02:12:25FromDiscord<Elegantbeef> results, questionable, write your own variant
02:14:03FromDiscord<griffith1deadly> In reply to @jos7388 "are there any nice": https://github.com/arnetheduck/nim-results ?
02:17:16FromDiscord<voidwalker> that, or https://github.com/codex-storage/questionable . I like the questionable syntax better
02:18:49FromDiscord<griffith1deadly> questionable like kotlin or ts haha
02:25:37FromDiscord<Festive> How do I import mscorlib.dll and System.dll and all of the other dlls that clr needs
02:28:45termerKotlin is awesome, don't badmouth Kotlin
02:28:50termerKotlin saved my life as a Java dev
02:29:35FromDiscord<demotomohiro> In reply to @Festive "How do I import": https://forum.nim-lang.org/t/7265↵https://khchen.github.io/winim/clr.html
02:38:02FromDiscord<Festive> sent a code paste, see https://play.nim-lang.org/#ix=4DiR
02:38:08FromDiscord<Festive> even tho I loaded all the proper dlls
03:09:21FromDiscord<srmordred> using raylib..↵`'=dup' is not available for type <Font>; requires a copy because it's not the last read of 'arial';`↵but `Font` is `bycopy`↵not sure whats the problem
03:12:57FromDiscord<Elegantbeef> What's the code
03:12:58FromDiscord<Elegantbeef> the problem is likely you're doing something that requires a copy
03:12:58FromDiscord<Elegantbeef> where it eros
03:12:58FromDiscord<Elegantbeef> errors\
03:14:20FromDiscord<srmordred> but doesn't `bycopy` means that it always passed as copy?
03:14:41FromDiscord<Elegantbeef> Sure but that
03:14:55FromDiscord<Elegantbeef> is not what move semantics is about
03:15:08FromDiscord<Elegantbeef> Is that procedure annotated `sink`?
03:15:15FromDiscord<srmordred> i´m passing the Font on a proc that stores it on a object.↵like ↵`proc Text(font: Font): Text = Text(font:font) `
03:16:02FromDiscord<Elegantbeef> Right that has to copy
03:16:04FromDiscord<Elegantbeef> so it
03:16:08FromDiscord<Elegantbeef> 'll error
03:16:12FromDiscord<Elegantbeef> make that `font: sink Font`
03:16:47FromDiscord<srmordred> sent a code paste, see https://play.nim-lang.org/#ix=4Dj2
03:17:00FromDiscord<Elegantbeef> you use the font variable after it
03:17:02FromDiscord<Elegantbeef> 's moved
03:17:27FromDiscord<Elegantbeef> dammit waiting for this soldering iron to cool down, my keyboard is not where it should be. Worst typing skills ever 😄
03:17:40FromDiscord<srmordred> yeah, that part of sink i understand. ↵but why i need to sink it, if its a bycopy.
03:17:58FromDiscord<Elegantbeef> By copy is for interop not for move semantics
03:18:18FromDiscord<Elegantbeef> by copy just means when calling a procedure it's passed as a copy for whatever reason, it does not mean that procedure takes ownership
03:18:50FromDiscord<srmordred> ok, fine, thats what i want. a copy.
03:20:24FromDiscord<srmordred> if i make the `=dup` hook for it it may work then?
03:20:44FromDiscord<Elegantbeef> No cause the hook has to be defined in the module it's declared
03:20:50FromDiscord<Elegantbeef> there likely is a procedure made specifically for copying a font
03:21:35FromDiscord<jordan4ibanez> Font struct in raylib you say?
03:21:50FromDiscord<jordan4ibanez> https://tenor.com/view/cat-reading-funny-animals-reading-a-book-cats-gif-19258511
03:22:08FromDiscord<srmordred> raylib expects me to pass the font every time o want to render. ↵i'm trying to store it. ↵maybe its not suppose to :p
03:22:23FromDiscord<srmordred> (edit) "o want" => "i need" | "render. ↵i'm" => "render a text↵i'm"
03:23:10FromDiscord<jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4Dj6
03:23:15FromDiscord<Elegantbeef> Who cares about the C struct
03:23:21FromDiscord<jordan4ibanez> Hmm, how to utilize this, let me read into this
03:23:34FromDiscord<jordan4ibanez> Well, anyone utilizing the C struct in nim lmao
03:23:40FromDiscord<Elegantbeef> https://github.com/planetis-m/naylib/blob/main/src/raylib.nim#L545-L551
03:23:53FromDiscord<Elegantbeef> We have the wrapped library, why are we refering to C
03:24:08FromDiscord<Elegantbeef> Yea the issue is that the Font owns data and there is no ref count
03:24:20FromDiscord<Elegantbeef> For what you want you likely should do `ref Font`
03:25:12FromDiscord<jordan4ibanez> Render a text render a text, I'm gonna run into this so I'm gonna tear my hear out for a few brb
03:25:15FromDiscord<Elegantbeef> This keeps it automatically managed, does not require allocating a large chunk, and allows you to have multiple views into a single font
03:27:53FromDiscord<srmordred> In reply to @Elegantbeef "For what you want": ok this makes sense. I thought that Nim wouldn't care of me handling unmanaged ptrs around.
03:28:45FromDiscord<Elegantbeef> I mean you could use `ptr Font` but that's as safe as teenage sex in the bible belt
03:29:51FromDiscord<srmordred> hahaha↵so the thing is that nim understands that there is a problem copying ptrs around. https://media.discordapp.net/attachments/371759389889003532/1140125032677396561/image.png
03:30:15FromDiscord<Elegantbeef> There is no issue copying pointers around
03:31:02FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/V9iAa
03:31:06FromDiscord<Elegantbeef> Just use a reference though
03:31:14FromDiscord<Elegantbeef> For the love of all things good and holy
03:34:48FromDiscord<jordan4ibanez> Wait I was able to do it with literally no problems
03:34:57FromDiscord<srmordred> i'm trying to understand what nim is telling me. ↵if I change to another raylib struct like a `Vector2`↵it works fine. ↵i'm trying to understand where exactly is the thing that causes the problem.
03:35:29FromDiscord<Elegantbeef> inb4 running Nim 1.6.14 or something non 2.0
03:35:35FromDiscord<srmordred> let me juggle things around a bit to see whats going on
03:35:45FromDiscord<jordan4ibanez> Oh that's a great question, which version of nim are you running?
03:35:49FromDiscord<Elegantbeef> `file: file` is the issue
03:35:59FromDiscord<Elegantbeef> That requires copying since it's not a `sink` parameter
03:36:34FromDiscord<Elegantbeef> Now if you annotate that proc as `sink` the issue will move to wherever you use that variable you passed into that proc
03:37:05FromDiscord<srmordred> In reply to @jordan4ibanez "Oh that's a great": 2.0
03:37:41FromDiscord<jordan4ibanez> Are you using the default memory management?
03:38:18FromDiscord<Elegantbeef> Of course they are that's the only one that has hooks
03:38:24FromDiscord<jordan4ibanez> Are you loading this font before you initialize your window?
03:38:50FromDiscord<Elegantbeef> It doesnt matter it's a hook related error
03:38:54FromDiscord<Elegantbeef> The code does not compile presently
03:39:05FromDiscord<Elegantbeef> So it matters "How are you using this Font, please provide the scope of the variable"
03:40:39FromDiscord<srmordred> sent a code paste, see https://play.nim-lang.org/#ix=4Djd
03:42:03FromDiscord<Elegantbeef> `initText` does not take `sink Font`
03:42:03FromDiscord<Elegantbeef> Change that
03:42:04FromDiscord<Elegantbeef> Also put this inside a main proc
03:42:22FromDiscord<Elegantbeef> top level variables are not really moveable
03:44:07FromDiscord<srmordred> sent a long message, see http://ix.io/4Djg
03:45:12FromDiscord<nejikiri.> sent a long message, see http://ix.io/4Djh
03:45:51FromDiscord<Elegantbeef> What have you tried?
03:46:50FromDiscord<srmordred> oh nvm, the sink don´t solve
03:46:50FromDiscord<nejikiri.> I have tried to use mod on an if statement with the result, but i get a mismatch error
03:47:32FromDiscord<jordan4ibanez> In reply to @srmordred "oh nvm, the sink": That's it I'm trying your thing
03:47:37FromDiscord<Elegantbeef> If it's a global variable you cannot move it
03:47:37FromDiscord<Elegantbeef> Ok so show the code and error nej
03:49:02FromDiscord<srmordred> sent a code paste, see https://play.nim-lang.org/#ix=4Djj
03:49:11FromDiscord<srmordred> (edit) "https://play.nim-lang.org/#ix=4Djk" => "https://play.nim-lang.org/#ix=4Djj"
03:49:20FromDiscord<Elegantbeef> Like I said it's a global variable
03:49:48FromDiscord<Elegantbeef> That'll work
03:49:53FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/LPc2P
03:50:15FromDiscord<nejikiri.> sent a long message, see http://ix.io/4Djm
03:50:43FromDiscord<Elegantbeef> Right what does `a mod 3` mean?
03:50:54FromDiscord<Elegantbeef> an array modulo'd by 3 means what?
03:51:05FromDiscord<srmordred> sent a code paste, see https://paste.rs/IUJWj
03:51:15FromDiscord<Elegantbeef> Why what work?
03:51:57FromDiscord<Elegantbeef> the `=copy` is disabled for the fonts
03:51:57FromDiscord<Elegantbeef> Rather `=dup` is disabled
03:51:58FromDiscord<Elegantbeef> So you cannot copy it, you can only mvoe it
03:51:58FromDiscord<Elegantbeef> Vectors are not fonts
03:51:58FromDiscord<Elegantbeef> Believe or not
03:52:52FromDiscord<Elegantbeef> In Nim you can disable hooks for specific types to give specific semantics
03:53:04FromDiscord<Elegantbeef> Font's own resources as such you should never copy them as they free them when they're deleted
03:53:11FromDiscord<Elegantbeef> You should use `ref Font` to get around that
03:53:18FromDiscord<Elegantbeef> Can we move onto a new topic now, thanks
03:54:09*rockcavera quit (Remote host closed the connection)
03:54:33FromDiscord<srmordred> sent a code paste, see https://play.nim-lang.org/#ix=4Djn
03:54:52FromDiscord<Elegantbeef> I mean it told you in the error message 😛
03:55:02FromDiscord<srmordred> (edit) "https://play.nim-lang.org/#ix=4Djn" => "https://play.nim-lang.org/#ix=4Djo"
03:55:05FromDiscord<Elegantbeef> Who am I kidding people don't read those
03:55:24FromDiscord<Elegantbeef> Nejikiri did you think about your code any further?
03:55:24FromDiscord<srmordred> yes, but i don´t even knew that this was a thing xD
03:56:12FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Who am I kidding": Beef losing all his hair as he speaks on the server:
03:56:32FromDiscord<Elegantbeef> Am I wrong though?
03:56:42FromDiscord<srmordred> its my firsts weeks with nim. ↵i feel ridiculously productive with it, but there are a lot of this details that i don´t know yet.
03:56:54FromDiscord<Elegantbeef> Programmers don't read docs or error messages
03:57:01FromDiscord<jordan4ibanez> Why don't you store fonts into a cache table and utilize a "switch fonts" proc to store the pointer of the font struct instead of bundling a text component with specific fonts?
03:57:02FromDiscord<Elegantbeef> https://nim-lang.org/docs/destructors.html here you go
03:57:25FromDiscord<jordan4ibanez> I mean, raylib is already working in global state essentially, just go with the flow
03:57:54FromDiscord<srmordred> In reply to @jordan4ibanez "Why don't you store": yes, its a good one. ↵i know the solutions to this problem. ↵its was more related to nim itself, not the problem .
04:02:06FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Am I wrong though?": Not really lol
04:02:22FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Programmers don't read docs": Used to be guilty of this as a Python programmer- Nowadays I'm much better
04:04:15FromDiscord<srmordred> In reply to @Elegantbeef "https://nim-lang.org/docs/destructors.html here you": yeah , I should read more carefully.↵I confess i just started typing nim and things got going.↵after some months with Rust, Nim felt so easy i just ignored most of the docs xD
04:05:26FromDiscord<jordan4ibanez> I need to like bookmark the exception types page so I can stop googling it
04:06:53FromDiscord<jordan4ibanez> Nim is very strange, but in a good way ``proc getFont: Font = font``
04:09:50FromDiscord<srmordred> Nim made some unusual choices. but when things click, u just forget ↵( like the `` for exports. i imagine c programmers getting crazy xD )
04:12:20FromDiscord<jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4Djs
04:13:11FromDiscord<demotomohiro> In C, variables/functions are public in default. Adding static make it private.
04:13:47FromDiscord<srmordred> sent a code paste, see https://play.nim-lang.org/#ix=4Dju
04:14:55FromDiscord<srmordred> type insensitive and other things that people complain. ↵never really felt it like a problem at all.
04:17:23FromDiscord<demotomohiro> How can you design programming languages so that never makes any confusion whatever the languages you used before.
04:18:24FromDiscord<jordan4ibanez> demotomohiro I think you've just created a problem that not even a turing machine can solve
04:30:40FromDiscord<odexine> In reply to @jordan4ibanez "I think that's AMAZING!": No such thing as package private yes
04:30:46FromDiscord<odexine> It’s either exported or not right now
04:30:51FromDiscord<odexine> (edit) "not" => "not,"
04:34:57FromDiscord<jordan4ibanez> I like it, I was literally just about to say: it is absolutely incredible how easy it is to refactor nim code
04:35:44FromDiscord<odexine> I think some people still prefer exporting to be a keyword
04:43:13*lucasta joined #nim
04:43:52*lucasta quit (Remote host closed the connection)
04:48:50FromDiscord<jordan4ibanez> Hmm, couldn't that technically be a macro?
05:56:27*ntat joined #nim
06:08:02FromDiscord<jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4DjL
06:09:31FromDiscord<jordan4ibanez> (edit) "https://play.nim-lang.org/#ix=4DjL" => "https://play.nim-lang.org/#ix=4DjM"
06:16:59FromDiscord<demotomohiro> In reply to @jordan4ibanez "Is there a safe": If it is not an enum with holes: https://nim-lang.org/docs/iterators.html#items.i%2Ctypedesc%5BT%5D
06:54:53*junaid_ joined #nim
07:04:23FromDiscord<jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4DjT
07:04:35FromDiscord<jordan4ibanez> https://tenor.com/view/jeff-goldblum-jurassic-park-jurassic-scientist-your-scientists-gif-11921883
08:21:21FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dkf
08:21:40FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4Dkf" => "https://play.nim-lang.org/#ix=4Dkg"
08:21:54FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4Dkg" => "https://play.nim-lang.org/#ix=4Dkh"
08:44:01FromDiscord<Elegantbeef> `error`
08:44:15FromDiscord<Elegantbeef> I told you this recently @Phil!
08:44:33FromDiscord<demotomohiro> Use this?↵https://nim-lang.org/docs/system.html#instantiationInfo%2Cint
08:44:51FromDiscord<Phil> I even use error, I just thought expectKind was special in some way
08:44:53FromDiscord<Elegantbeef> Or just `error("msg", aNode)`
08:45:08FromDiscord<Elegantbeef> It's not it's just `assert aNode.kind in nnkSomeKind`
08:45:44FromDiscord<Elegantbeef> Well not assert, but yea it just wraps `error`
08:45:56FromDiscord<Phil> So if I implement my own expectKind that instead of using assert uses error, I'll get the proc-line of the proc called by the macro that bombed?
08:46:31FromDiscord<Elegantbeef> As is it should report the line the `aNode` is declared at
08:46:40FromDiscord<Elegantbeef> As it is\
08:47:36FromDiscord<Phil> I mean this is nice and tells me which macro blew up, but I kinda want to see in which proc that my macro uses it all blew up
08:47:50FromDiscord<Elegantbeef> What it shows exactly where it blew up in your code
08:50:02FromDiscord<Phil> sent a long message, see http://ix.io/4Dkm
08:50:21FromDiscord<Phil> The order of the full stacktrace is a bit weird, thus I missed it
08:51:17FromDiscord<Elegantbeef> How do I not go back to the statement I said earlier today of "No one reads error messages or docs" 😄
08:52:06FromDiscord<Elegantbeef> The line should be accurate on the actual error though
08:52:28FromDiscord<Elegantbeef> It should be `prog.name(l;col) Error: ....` or w/e
08:53:26FromDiscord<Elegantbeef> Alternatively if you really don't like the stack you could put an `{.error: "msg".}` into the resultant AST, but that's awful to manage
08:53:44FromDiscord<Elegantbeef> Or try using lineinfos to set the errors
08:56:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dkn
08:56:53FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4Dkn" => "https://play.nim-lang.org/#ix=4Dko"
08:57:03FromDiscord<Phil> I know it's likely like this because the compiler sees them in that order or sth but still not an easy read
08:57:07FromDiscord<Elegantbeef> line 232 is the proc though riight?
08:57:15FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4Dko" => "https://play.nim-lang.org/#ix=4Dkp"
08:57:41FromDiscord<Phil> 232 is the proc definition that gets annotated with the macro `mapVariant` as pragma
08:57:55FromDiscord<Phil> So that is what triggers the macro that then blows up
08:58:18FromDiscord<Phil> The line I'd care about is line 42 in mapsterVariant.nim because that's what I'd need to debug
08:58:40FromDiscord<Elegantbeef> So you do not want expect kind
08:58:52FromDiscord<Elegantbeef> You want to have an assert or similar
08:59:08FromDiscord<Phil> Well I do in the sense that I want to have a simple checker that X is a valid node
08:59:25FromDiscord<Phil> man, kinda feels like programming in an untyped language to a degree when you're in compiler land
08:59:27FromDiscord<Elegantbeef> Right, but if it's outside of the scope you do not want to provide a debug message to the user do you?
08:59:31FromDiscord<Phil> (edit) "compiler" => "compiler/macro"
08:59:37FromDiscord<Elegantbeef> I mean macros are dynamically typed
09:00:00FromDiscord<Elegantbeef> `error` and `expectkind` are for providing help to the user
09:00:04FromDiscord<Phil> In reply to @Elegantbeef "Right, but if it's": Pretty much. All of these expectKind-thingies are for easier debugging
09:00:06FromDiscord<Elegantbeef> though expect kind is a shitty way of doing that
09:00:16FromDiscord<Phil> (edit) "In reply to @Elegantbeef "Right, but if it's": Pretty much. All of these expectKind-thingies are for easier debugging ... " added "and to validate that up until here things are as I expect them"
09:00:32FromDiscord<Elegantbeef> Then you want assert
09:00:42FromDiscord<Phil> It's kinda like how in JS you would often check that the parameters you received are of specific types
09:00:51FromDiscord<Elegantbeef> `error("Invalid entry expected `name\: type`", entry)` for instance
09:01:20FromDiscord<Elegantbeef> OR `error("Can only make a 'mut' reference to a mutable variable.", val)`
09:01:33FromDiscord<Elegantbeef> User solvable issues
09:01:50FromDiscord<Elegantbeef> Assertions are what you should use if the code is not solvable by the user and is a bug in your code
09:02:05FromDiscord<Phil> Check... why does expectKind not accept a msg string then?
09:02:12FromDiscord<Elegantbeef> This will give you an exact line number where the bug is raised
09:02:16FromDiscord<Elegantbeef> No clue I didnt write it
09:02:29FromDiscord<Phil> Because if it's supposed to be user solvable, providing more helpful messages than "a kind is wrong" seems sensible
09:02:49FromDiscord<Phil> Off to write myself `assertKind`
09:02:51FromDiscord<Elegantbeef> I concur which is why i do not use expect kind
09:03:18FromDiscord<Elegantbeef> are we really making a proc for `asser myNode.kind in {a, b}`
09:03:32FromDiscord<Phil> Yes
09:03:44FromDiscord<Elegantbeef> Well have fun, seems so absurd
09:05:34FromDiscord<Elegantbeef> I guess you should use `doAssert`
09:05:51FromDiscord<Elegantbeef> Just so people do not compile with assertions off and go "your macro is bugged"
09:06:24FromDiscord<Phil> I disagree, I want to encapsulate specific tasks so I no longer need to think about them and have them centralized.↵If a task only takes 1 loc and I still need to do it over and over, it's worth centralizing just so I don't have to think about doing it "right"
09:06:48FromDiscord<Elegantbeef> Well given I hardly ever have the exact same check before an error it's odd to me
09:07:24FromDiscord<Phil> In reply to @Elegantbeef "Just so people do": Wait, help me with that trail of though because I'm missing something there
09:07:57FromDiscord<Elegantbeef> with assertions off `assert` in CT does not get invoked, so you'd get a random macro error later on
09:08:00FromDiscord<Phil> I use asserts while I write code so that at the time of writing I make sure my code is bug free (as far as I can understand it).↵Why would users with assertions off experience bugs?
09:08:16FromDiscord<Elegantbeef> `doAssert` is never disabled so it'd never get to a different part of the ast
09:09:54FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/zaCfa
09:10:27FromDiscord<Elegantbeef> Actually assertions do not solve your issue anyway it seems
09:10:27*SebastianM joined #nim
09:10:32FromDiscord<Elegantbeef> I thought it would, my bad
09:12:45FromDiscord<Phil> Eh, I'll just write my own expectKind and assertKind.↵assertKind for debugging for myself to validate that whatever I pass on to the next proc is valid.↵expectKind for all the inputs that the original macro receives, validating those essentially
09:13:02FromDiscord<Phil> But with an actual custom error message that can be appended
09:13:31FromDiscord<Phil> (edit) "But with an actual custom error message that can be appended ... " added "to be more useful for users to debug what they used wrong"
09:13:53*SebastianM quit (Client Quit)
09:14:18*azimut quit (Ping timeout: 246 seconds)
09:17:03FromDiscord<Elegantbeef> Exceptions might solve get good line info
09:18:47FromDiscord<Phil> say what now? ↵Didn't we literally go through this song and dance the last time with the outcome that `error` was the way to go?
09:19:16FromDiscord<Elegantbeef> It doesnt fix the line trace to what you want though
09:19:21FromDiscord<Elegantbeef> Where the bottom line is the macro
09:19:36FromDiscord<jordan4ibanez> Yerp I ran into the Font copy thing too, guess I'm gonna have to read that part again
09:20:32FromDiscord<Phil> In reply to @Elegantbeef "It doesnt fix the": I mean it would be preferrable if the last or first line were the bits that bombed in a stacktrace↵but as it is I can live with it
09:20:56FromDiscord<Phil> Just means I'll need to chase through the entire stacktrace to find where the actual problem lies
09:23:50FromDiscord<Phil> Is there a way to make a part of the string a pass into the error proc bold?
09:24:10FromDiscord<Phil> Basically can you format error messages?
09:28:57FromDiscord<Elegantbeef> Ansicodes yes
09:30:13FromDiscord<Phil> Hmm isn't that only for when you print to terminal yourself via `std/terminal`?
09:30:31FromDiscord<Elegantbeef> Nim prints strings
09:30:39FromDiscord<Elegantbeef> It doesnt escape ansi codes
09:31:04FromDiscord<Phil> Then I just need to figure out how what they look like put into a string, off to google
09:38:37FromDiscord<Elegantbeef> https://nim-lang.org/docs/terminal.html#ansiStyleCode%2Cint
09:54:03FromDiscord<Phil> ohhh styleBright is the stand in for "bold"
09:55:36FromDiscord<jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4DkB
09:56:12FromDiscord<jordan4ibanez> Hint: immutable clone vs direct reference
09:57:26FromDiscord<jordan4ibanez> In rust, you would fight the borrow checker on this lmao, but I suppose that happened anyways
09:57:40FromDiscord<jordan4ibanez> Not the same thing though, felt like it
10:01:17FromDiscord<jordan4ibanez> And the only reason I figured this out is because I noticed the game was rendering the correct font for exactly 1 frame on a move and I realized it automatically creates immutable copies internally, that is quite fancy
10:10:09*ntat quit (Quit: leaving)
10:23:01FromDiscord<dersnof> https://nim-lang.org/docs/filters.html
10:23:05FromDiscord<dersnof> i didnt understand thids
10:23:13FromDiscord<dersnof> where do i find xmlGen.nimf
10:29:59FromDiscord<Phil> Source Code Filters are a pretty rarely used feature.↵I think the only person I've ever seen use it is moigagoo who generated docker files with it
10:35:20*Guest88 joined #nim
10:35:59*Guest88 quit (Client Quit)
10:48:29FromDiscord<dersnof> In reply to @isofruit "Source Code Filters are": it says it can be used for templating
10:48:32FromDiscord<dersnof> template engines
10:48:46FromDiscord<Phil> I'm not saying it can't be, I'm saying it just isn't
10:48:55FromDiscord<dersnof> what they use then
10:49:13FromDiscord<Phil> enthus1ast used macros afaik
10:49:58FromDiscord<dersnof> interesting
10:50:42FromDiscord<Phil> That is not to say it's bad tech, I mostly brought it up to point out why asking for help regarding those will be a bit tricky ^^
10:53:30FromDiscord<Phil> I think it might actually be the smarter move to play around with SCFs in order to avoid macros for now since those need some wrapping your head around imo
10:57:35FromDiscord<Phil> If you want more of an example for using SCF then you can look at nimage
10:58:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DkQ
11:00:12FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DkR
11:04:43FromDiscord<dersnof> hmm
11:12:43FromDiscord<enthus1ast> for what?↵(@Phil)
11:13:02FromDiscord<Phil> template engines, nimja in this case
11:13:17FromDiscord<enthus1ast> ah yes
11:14:16FromDiscord<enthus1ast> lexer -\> parser -\> nim macro codegen
11:14:41FromDiscord<Phil> Did you take a deeper look into source code filters?
11:14:56FromDiscord<enthus1ast> i've used them before nimja existed
11:15:10FromDiscord<Phil> Anything to point out there in your opinion?
11:15:20FromDiscord<Phil> General thoughts and the like?
11:17:15FromDiscord<enthus1ast> if i recall correctly, the default meta chars clash with css \:) eg\: #
11:18:13FromDiscord<enthus1ast> #foo {color\: #fefefe}
11:28:10FromDiscord<enthus1ast> sent a code paste, see https://paste.rs/CX4Cf
11:28:23FromDiscord<System64 ~ Flandre Scarlet> I use wNim, is it normal the notebook isn't displayed at all? https://media.discordapp.net/attachments/371759389889003532/1140245463874928721/authWindow.nim
11:43:43*om3ga quit (Read error: Connection reset by peer)
11:57:28FromDiscord<intellij_gamer> sent a code paste, see https://play.nim-lang.org/#ix=4Dl3
11:58:22FromDiscord<intellij_gamer> ah nvm, I see the first one concatenates every line instead of merging lines together
12:21:05FromDiscord<Matt> Has anyone here worked with https://nim-lang.github.io/threading/smartptrs.html before?
12:25:30FromDiscord<planetis_m> In reply to @x.hat "Has anyone here worked": Yes, https://github.com/planetis-m/sync/blob/master/sync/spsc.nim
12:49:45FromDiscord<Phil> Which flag executed runnable Examples again?
12:51:15FromDiscord<planetis_m> Flag? I think it's just nim doc
12:52:02FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dli
13:16:29FromDiscord<Phil> Ohhh the answer is I am not that smart and runnableExamples only get executed on public procs
13:48:42*rockcavera joined #nim
14:28:51FromDiscord<metumortis> Is there any way to read arrow & space inputs from stdin? For example when I press up arrow it will call a proc
14:29:18FromDiscord<metumortis> Tried read char but it doesn't work like that
14:30:07FromDiscord<metumortis> I'm trying to make something like that (when I click arrows it switches between TS and JS) https://media.discordapp.net/attachments/371759389889003532/1140291194824425552/Screenshot_20230813_172947.png
14:34:19*junaid_ quit (Remote host closed the connection)
14:50:32FromDiscord<griffith1deadly> In reply to @metumortis "Is there any way": maybe good way check keyboard key state?
15:07:03*krux02 joined #nim
15:22:42FromDiscord<System64 ~ Flandre Scarlet> Is it normal I can't do this? https://media.discordapp.net/attachments/371759389889003532/1140304426406531082/image.png
15:25:07FromDiscord<Phil> What am I looking at?↵Are you trying to access a byte with `[]`?
15:25:33FromDiscord<Phil> since bufPtr looks like you cast it to a ptr byte, so I'm not sure whether you might not even have to unref first
15:25:50FromDiscord<Chronos [She/Her]> Hey Beef, do you happen to know a library in Nim that allows for manipulation and creation of a WASM AST?
15:32:54FromDiscord<sirolaf> Anyone try the multiple windows example from boxy? For me on linux it's all sorts of messed up, starting with the fact that one of the windows does not appear/sync <https://github.com/treeform/boxy/blob/master/examples/multiple_windows.nim>
15:33:26FromDiscord<sirolaf> Have tried to debug but getting info on x11 is like pulling teeth
15:38:13FromDiscord<System64 ~ Flandre Scarlet> In reply to @isofruit "since bufPtr looks like": I used unchecked array, it works
15:39:20FromDiscord<System64 ~ Flandre Scarlet> Yo whaaaat!↵Disabling GC improves performances so much!
15:41:17FromDiscord<konsumlamm> it also increases leaked memory
15:42:33FromDiscord<System64 ~ Flandre Scarlet> Is it possible to temporary disable GC in a specific proc?
15:44:30FromDiscord<planetis_m> sent a code paste, see https://play.nim-lang.org/#ix=4Dmb
15:45:23FromDiscord<System64 ~ Flandre Scarlet> WTF? Boehm is actually faster than ORC/ARC?
15:55:00FromDiscord<terrygillis> Hi I'm trying out macros for the first time and `dumpTree` is not outputting anything on the Nim playground, why?
15:55:14FromDiscord<Phil> That starts sounding like an internals question because on that level of memory management you'd actually need to know the Comp-Sci behind them
15:55:21FromDiscord<Phil> (Directed at System64)
15:55:47FromDiscord<terrygillis> https://play.nim-lang.org/#ix=4Dme my code that is not printing anything
15:55:47FromDiscord<System64 ~ Flandre Scarlet> In reply to @isofruit "That starts sounding like": What does it mean?
15:56:40FromDiscord<Phil> In reply to @sys64 "What does it mean?": That the nature of which GC does what and thus is good under which workloads or bad under which workloads is one that requires a pretty substantial amount of low-level knowledge that you're more likely to find in internals where the folks are that implemented those GCs
15:57:15FromDiscord<System64 ~ Flandre Scarlet> In reply to @isofruit "That the nature of": Ooooh alright↵And is it possible to disable GC for some parts of code ?
15:57:38FromDiscord<griffith1deadly> In reply to @sys64 "Is it possible to": https://nim-lang.org/docs/system.html#GC_disable
15:57:42FromDiscord<Phil> That I don't know as I never tried.↵I can only say I've not seen that done anywhere and all I read gave me the impression that no
15:58:49FromDiscord<Phil> In reply to @terrygillis "https://play.nim-lang.org/#ix=4Dme my code that": dumpTree, dumpAstGen etc. work at compile-time.↵You'll find that play.nim-lang only prints out runtime stuff
15:59:06FromDiscord<Phil> So basically a compile-time echo such as this:↵`static: echo "lala"` will also not show up
15:59:32FromDiscord<Phil> I recommend installing inim or using `nim secret` if you want to quickly type something out and see it work
15:59:52FromDiscord<Phil> nim secret is the VM that the code runs on, inim is a more fully featured kinda-REPL (like the python console)
16:00:04FromDiscord<Phil> (edit) "the" => "compile-time" | "on," => "on to get evaluated,"
16:00:10FromDiscord<terrygillis> Just curious but why disabling compile-time output on the playground? Security reasons?
16:00:28FromDiscord<sirolaf> In reply to @sys64 "Ooooh alright And is": For hooks you can do use this pragma `https://nim-lang.org/docs/destructors.html#nodestroy-pragma`
16:00:29FromDiscord<Phil> No clue, I'm only aware of the limitation, not why it exists
16:00:34FromDiscord<sirolaf> (edit) removed "do"
16:00:38FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "https://nim-lang.org/docs/system.html#GC_disable": It says undeclared identifier
16:00:55FromDiscord<sirolaf> (edit) "`https://nim-lang.org/docs/destructors.html#nodestroy-pragma`" => "https://nim-lang.org/docs/destructors.html#nodestroy-pragma"
16:21:48*junaid_ joined #nim
16:22:04*ntat joined #nim
16:31:40FromDiscord<hugogranstrom> In reply to @isofruit "dumpTree, dumpAstGen etc. work": You can see compile time stuff if you click "Showing: output" 😉
16:32:15FromDiscord<hugogranstrom> In reply to @terrygillis "Just curious but why": ^ it is there, just not obvious
16:33:00FromDiscord<Phil> In reply to @hugogranstrom "You can see compile": Well, TIL.↵Never stumbled over this because for playing around I just have a playground project that I can throw anything that's longer than 3 lines together
16:33:16FromDiscord<Phil> And inim for the 1-2 liners
16:36:08NimEventerNew thread by bjorn_madsen: Beginner question - sets , see https://forum.nim-lang.org/t/10402
17:04:36*azimut joined #nim
17:11:43FromDiscord<therealori> sent a long message, see http://ix.io/4Dmy
17:12:33FromDiscord<odexine> There are no sequences of mixed types
17:13:01FromDiscord<therealori> (edit) "long message," => "code paste," | "http://ix.io/4Dmy" => "https://play.nim-lang.org/#ix=4Dmz"
17:13:57FromDiscord<odexine> In reply to @therealori "I am wanting to": Even if you removed the line with choice(mixed) it will not compile; Nim does not have sequences with mixed types
17:15:19FromDiscord<odexine> Saying just `seq` without the generic portion does not mean that the sequence has multiple types, it just means that the sequence is implicitly generic
17:16:37FromDiscord<therealori> If that's the case, then wouldn't the "mixed" seq[] still be a seq?↵↵Also wow..I might just be done with Nim
17:16:53FromDiscord<planetis_m> Also the randint proc is incorrect. Splitwhitespace returns seq[string] you need to return an int
17:16:55FromDiscord<therealori> (edit) "If that's the case, then wouldn't the "mixed" seq[] still be a seq?↵↵Also wow..I might just be done with Nim ... " added "~~not even a month in~~"
17:16:56FromDiscord<odexine> In reply to @therealori "If that's the case,": What do you mean?
17:17:07FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DmB
17:17:29FromDiscord<therealori> In reply to @planetis_m "Also the randint proc": random[.]org returns strings. I could try to turn it into ints but ehhh
17:17:38FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4DmB" => "https://play.nim-lang.org/#ix=4DmC"
17:17:45FromDiscord<planetis_m> In reply to @therealori "If that's the case,": Maybe learn to program first then use whatever language you like, we don't hold grudges
17:17:49FromDiscord<odexine> There should be a better way to do your idea
17:18:00FromDiscord<odexine> Gotta think of it more abstractly
17:18:23FromDiscord<therealori> In reply to @planetis_m "Maybe learn to program": Currently trying to do that lol
17:19:05FromDiscord<odexine> Please be careful with giving up quickly
17:19:59FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DmE
17:20:28FromDiscord<therealori> In reply to @odexine "Please be careful with": Like, I want to use Nim (I really do), but why would I pick it over javascript or python and why would I want to subject myself to borderline insanity.↵↵Also, thank you for letting me know and helping
17:20:58FromDiscord<odexine> In reply to @therealori "Like, I want to": Well, it’s a matter of where you’re using it
17:21:39FromDiscord<odexine> I can’t use python or JavaScript on something like a small device, example like a handheld game console or something
17:21:56FromDiscord<odexine> Nim would fit pretty well there because it doesn’t consume as much resources as the other two
17:21:59FromDiscord<Phil> In reply to @therealori "Like, I want to": Because python by nature cannot be fast and actually efficient.↵Because when you call a function in python or JS, you can not get a decent guarantee that the parameter you get as an input is actually a string, or a number.↵You'll have to write those checks yourself every time, and when you forget them once you've now potentially gotten a bug in your codebase.
17:22:28FromDiscord<odexine> > Several people are typing
17:22:49FromDiscord<Phil> Nim can give you some actual hard guarantees that you can rely on that will make your life easier the more you code, and it does so with comparatively low amounts of effort (if you compare it to e.g. Rust)
17:23:49FromDiscord<Phil> (edit) "In reply to @therealori "Like, I want to": Because python by ... natureefficient.↵↵Because" added "their" | "efficient.↵Because" => "efficient.↵↵Because"
17:24:43FromDiscord<sklorn.> I've been struggling with this for a little bit. I'm trying to use the the `db_postgres` lib for my newest nim project on an M1 mac. I've downloaded x86 binaries (I _think_) from the postgres site and added them to `LD_LIBRARY_PATH`. When I `nim c -r`, the program compiles, but then it doesn't follow the `LD_LIBRARY_PATH` when I _run_ the compiled binary. I've been banging my head against the keyboard for a while on this, and am not a C e
17:24:52FromDiscord<therealori> In reply to @isofruit "Nim can give you": I understand, I am okay with specifying types...I just want it to just have a little forgiveness and allow something you'd thing would be so simple to work.
17:25:00FromDiscord<therealori> (edit) "types...I" => "types and all that...I"
17:25:47FromDiscord<therealori> (edit) "In reply to @isofruit "Nim can give you": I understand, I am okay with specifying types and all that...I just want it to just have a little forgiveness and allow something you'd thing would be so simple to work. ... " added "Like a list of multiple types of data."
17:26:48FromDiscord<odexine> In reply to @therealori "I understand, I am": Okay there’s a pretty good reason for this:↵In Nim, typing works on compile time so all data related to types have to exist on compile time↵When you do lists with many types, now the type of the data relies on something that can’t be determined on compile time: the index, so it just can’t work
17:27:09FromDiscord<Phil> In reply to @therealori "I understand, I am": I can understand that, but that is also what allows you to actually be sure that if you have a seq of strings, it's a seq of strings and you can safely perform all kinds of string operations on them without having to double check if there's an int in there
17:27:18FromDiscord<odexine> If it did work, then the typing would need to also work outside of compile time
17:27:24FromDiscord<odexine> And that has performance implications
17:27:29FromDiscord<odexine> Just like how python does
17:28:13FromDiscord<Phil> sent a long message, see http://ix.io/4DmH
17:28:31FromDiscord<Phil> (edit) "http://ix.io/4DmH" => "http://ix.io/4DmI"
17:28:49FromDiscord<odexine> Phil I don’t know what the heck you’re even addressing at this point
17:29:10FromDiscord<Phil> Trying to elaborate why mixed lists can't be a thing
17:29:35FromDiscord<Phil> Or rather they can be, if you do object variants, but not in the sense of `seq[int | string]`
17:29:59FromDiscord<planetis_m> My recommendation is to try your luck with bing chat. Or copilot. It might generate the code you need
17:31:36FromDiscord<therealori> Perhaps I'll come back to nim another time but for now I think i'm done with it until I can find a reason/purpose to code using it. Thanks for the help though.
17:32:28FromDiscord<odexine> Well everything’s got its uses I guess
17:34:00FromDiscord<Phil> In reply to @therealori "Perhaps I'll come back": Good luck either way!
17:38:54FromDiscord<Phil> sent a long message, see http://ix.io/4DmL
17:40:48FromDiscord<sklorn.> In reply to @isofruit "This one got a": Ah thank you, `DYLD_LIBRARY_PATH` seemed to work.. now I just need to remember the trick to disable those pesky mac "security" measures that prevent me from running unsigned binaries
17:41:25FromDiscord<Phil> sent a long message, see http://ix.io/4DmN
17:43:15FromDiscord<sklorn.> In reply to @isofruit "Actually, found another response": nice, thanks!
17:43:18FromDiscord<Phil> Generally that entire SO question is worth a read, other answers also provide some interesting insights
17:46:51FromDiscord<Phil> In reply to @planetis_m "My recommendation is to": Actually out of curiosity, have those resulted in actually decent suggestions for you?↵I've been using copilot at work with java and TS, 2 of the most used languages on the planet and it still screws up a fair bit here and there.
17:47:23FromDiscord<Phil> (edit) "there." => "there.↵So my estimate for nim with those tools is pretty eh"
17:48:57FromDiscord<_fcn_> Anyone else getting "https://play.nim-lang.org/" offline ?
17:51:36FromDiscord<Phil> Aye, appears some of the more recent nim-examples brought it down, have forwarded the info
17:58:12FromDiscord<Phil> In reply to @_fcn_ "Anyone else getting "https://play.nim-lang.org/"": It lives again
17:58:59FromDiscord<_fcn_> Thanks!
18:32:25FromDiscord<Phil> Yknow, object variants really make your life hard
18:32:53*Guest3 joined #nim
18:34:37FromDiscord<Phil> sent a long message, see http://ix.io/4Dn4
18:35:37*Guest3 quit (Client Quit)
18:45:49*lucasta joined #nim
18:56:32NimEventerNew thread by Cnerd: Neo vim config for nim, see https://forum.nim-lang.org/t/10403
19:10:15FromDiscord<konradmb> In reply to @therealori "I understand, I am": If you have to use that list (generally it's called a heterogenous collection) then https://nim-lang.org/docs/json.html is often suggested to do it.
19:13:08FromDiscord<_fcn_> sent a code paste, see https://play.nim-lang.org/#ix=4Dnb
19:13:32FromDiscord<_fcn_> It says: Error: cannot evaluate at compile time: is_even
19:17:08*lucasta quit (Quit: Leaving)
19:19:29FromDiscord<k0ts> > Because case statements are checked for exhaustiveness during semantic analysis, the value in every of branch must be a constant expression. This restriction also allows the compiler to generate more performant code.↵↵The compiler does not consider your let isEven a constant expression
19:25:31FromDiscord<exelotl> You can do `elif is_even` instead
19:30:42FromDiscord<Phil> In reply to @_fcn_ "Anyone have a clue": Your case statement represents all the different values your n might be.↵n is a uint64, it cannot be a boolean.↵with `of is_even` you're essentially stating "if n has the value is_even then do thing", which kinda doesn't work since is_even is a bool, not a number.
19:31:32FromDiscord<Phil> (edit) "Your" => "Another basis for thinking about it on a more intuitive level:↵Your"
19:37:50FromDiscord<roupi.rb> why is this code working without the hash proc in the key obj, https://nim-lang.org/docs/tables.html#basic-usage-hashing https://media.discordapp.net/attachments/371759389889003532/1140368633588097124/image.png
19:39:56FromDiscord<Phil> You mean why can you make a hash-table of an object without defining a hash-proc yourself?
19:40:05FromDiscord<Phil> (edit) "yourself?" => "yourself for that object?"
19:42:07FromDiscord<roupi.rb> yes
19:43:36FromDiscord<roupi.rb> the docs says using a hash with a custom obj as key without a hack proc should not compile
19:45:20FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Dnk
19:45:38FromDiscord<heysokam> I don't get what the error is trying to say about `identifier expected`
19:46:53FromDiscord<_fcn_> sent a code paste, see https://play.nim-lang.org/#ix=4Dnl
19:46:58FromDiscord<_fcn_> But thanks anyways...
19:47:03FromDiscord<heysokam> (edit) "expected`" => "expected`↵edit: changed to `func` and it worked, so I guess its something to do with the template"
19:53:00FromDiscord<Phil> In reply to @roupi.rb "the docs says using": At a glance, not a clue, can't find anything related to that, sounds like it might be the docs missing something.↵Maybe a forum post?
19:54:33FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dnq
19:55:08FromDiscord<Phil> Might be the template-syntax having some limitation for the way you typed it that forces variables there and doesn't allow expressions
20:02:05FromDiscord<heysokam> kk
20:02:06FromDiscord<k0ts> Isn't it just a case of outdated docs? There is now a default hash for objects in std/hashes
20:02:49FromDiscord<Phil> In reply to @k0ts "Isn't it just a": I would agree with you - if you required the import of std/hashes for this to work
20:03:02FromDiscord<k0ts> sent a code paste, see https://play.nim-lang.org/#ix=4Dnt
20:03:28FromDiscord<Phil> It might be that std/hashes is a default import and part of systems that I'm not aware of
20:04:17FromDiscord<Phil> (edit) "of" => "of, but so far it shouldn't work.↵I entirely agree that some default hashing is happening here, but fascinatingly enough whatever hash is being used is not available in the scope where the assignment to the hashTable is done"
20:17:50FromDiscord<planetis_m> In reply to @isofruit "Actually out of curiosity,": Yes my results are mixed for code generation tasks, but it can write the outline when starting a project. Bing chat is also pretty good interpreting error messages. I fed it android error logs and it steered me to the right direction when debugging issues with building naylib for android.
20:19:45FromDiscord<planetis_m> Don't expect miracles, but mostly better than google search.
20:21:16FromDiscord<k0ts> In reply to @isofruit "It might be that": std/tables imports std/hashes so I would think that's how the default hash proc gets picked up without being exposed to user code. But I'm not at my computer so cannot test that theory.
20:23:41FromDiscord<Phil> Nah that's fair, with the import it has access to the proc and binds it there before getting instantiated by the user.↵I assume it might be using mixin to bind that generic hashproc early to the generic-table-assignment-proc before that thing itself gets bound to the call-site of the user.
20:24:10FromDiscord<planetis_m> In reply to @planetis_m "Yes my results are": I was stupid not to record the prompts but this was the whole bugfixing process: https://github.com/planetis-m/raylib-game-template/issues/2 I don't know if it looks like a toy for a seasoned android developer but it helped me complete my task.
20:25:46*junaid_ quit (Remote host closed the connection)
20:26:30FromDiscord<Phil> Just to make sure I'm not being silly:↵There is no proc that takes in a `TypeDef` NimNode or the like and returns a seq[NimNode] of all the fields within that TypeDef, correct?
20:27:43FromDiscord<jordan4ibanez> In reply to @planetis_m "What problem does this": Passing a raylib font around, that was literally the only thing
20:28:33FromDiscord<Phil> Man I wish beef were here because I have a "simple" way to do that with `fieldPairs` when you just have the type in a normal format and a complicated way to do that with parsing the entire typeDef node and I can't figure out how to use the fieldPairs approach in a proc with a NimNode
20:28:53FromDiscord<jordan4ibanez> Has to be mutable, unless we impl pointer cloning, which I don't want to even look at that
20:29:34FromDiscord<jordan4ibanez> Unless nim has let with late initialization
20:32:56*ntat quit (Quit: leaving)
20:39:24FromDiscord<Elegantbeef> Micros has this↵(@Phil)
20:40:02FromDiscord<System64 ~ Flandre Scarlet> Do you know how I can remove the \\n characters from a string please?
20:40:28FromDiscord<Elegantbeef> https://github.com/beef331/micros/blob/master/src/micros/definitions/objectdefs.nim#L219
20:40:39FromDiscord<Phil> In reply to @sys64 "Do you know how": strutils has removeSuffix
20:40:54FromDiscord<Elegantbeef> `myStr.replace('\n')`
20:40:56FromDiscord<Phil> Ah wait, in general?↵ReplaceAll
20:41:11FromDiscord<Phil> Wait fix, nim, not js, replace
20:41:16FromDiscord<Phil> (edit) "fix," => "fuck,"
20:42:08FromDiscord<Phil> In reply to @Elegantbeef "https://github.com/beef331/micros/blob/master/src/m": Given how much valuable stuff in there it could seriously benefit from some docs
20:42:14FromDiscord<Phil> (edit) "In reply to @Elegantbeef "https://github.com/beef331/micros/blob/master/src/m": Given how much valuable stuff ... in" added "is"
20:42:29FromDiscord<Elegantbeef> Everything is documented
20:42:31FromDiscord<Elegantbeef> So uhh
20:43:01FromDiscord<Phil> Is this based on "source code is documentation" or "The readme is full enough of explanations" ?
20:43:07FromDiscord<System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/1140385060822974635/image.png
20:43:45FromDiscord<jordan4ibanez> ``'\0'``
20:43:56FromDiscord<jordan4ibanez> null terminator
20:44:09FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DnE
20:44:22FromDiscord<Elegantbeef> Simple as though
20:44:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DnF
20:44:53FromDiscord<System64 ~ Flandre Scarlet> Oh alright, thanks!
20:45:50FromDiscord<jordan4ibanez> Everyone talks about how many ways there is to do things, but no one ever talks about how many ways there are to find out how to do those things those ways
20:46:51FromDiscord<Phil> 3:↵1) Look for keywords in the nimble docs and look for procs that vaguely sound like they do what you want↵2) Ask discord chat↵3) Ask Forum
20:47:01FromDiscord<Phil> (edit) "3:↵1) Look for keywords in the nimble docs ... and" added "search"
20:47:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DnI
20:47:42FromDiscord<jordan4ibanez> In reply to @isofruit "3: 1) Look for": 4: bootstrap your own template proc generator for every different stylistic choice until you end up with lisp
20:47:43FromDiscord<Elegantbeef> that prints the condition required to be matched to access a field on an object
20:48:10FromDiscord<Phil> In reply to @jordan4ibanez "4: bootstrap your own": If you're at that point you have so much mastery over the language you can turn nim into any language there is
20:48:35FromDiscord<jordan4ibanez> I was actually wondering if that were even possible to like, spoof nim into being a curly brace language lmao
20:49:05FromDiscord<Phil> In reply to @jordan4ibanez "I was actually wondering": Pretty sure there was a package for that
20:49:09FromDiscord<jordan4ibanez> WAT
20:49:16FromDiscord<jordan4ibanez> I need to try this
20:49:52FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DnK
20:49:58FromDiscord<Elegantbeef> So then convert it 😄
20:50:43FromDiscord<Elegantbeef> Phil partly why the docs are 'subpar' is that micros is literally just a typesafe api ontop of Nimnodes, convert your AST to a nimnode then get the operations in a given module
20:52:09FromDiscord<Phil> sent a long message, see https://paste.rs/bbv1w
20:52:21FromDiscord<Phil> (edit) "http://ix.io/4DnM" => "http://ix.io/4DnL"
20:52:43FromDiscord<Phil> (edit) "http://ix.io/4DnL" => "http://ix.io/4DnN"
20:53:18FromDiscord<Elegantbeef> Just wait until you hit someone using a type with a when statement
20:53:29FromDiscord<Elegantbeef> Wasm doesnt have AST it's a byte code vm↵(@Chronos [She/Her])
20:53:35FromDiscord<Phil> a fucking what now?!
20:54:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DnO
20:54:35FromDiscord<Phil> I can't post it, but my face is the "eyes blinking".gif meme right now
20:54:42FromDiscord<Elegantbeef> You can use when inside of objects
20:54:47FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/blob/master/vershun.nim#L43-L56 you can get quite wild
20:55:20FromDiscord<Phil> Okay so I officially found people worse than those using double-object-variants (object variants with 2 kind fields)
20:55:24FromDiscord<Elegantbeef> That file actually is probably up your alley, type safe single type migration data/procs
20:56:07FromDiscord<Elegantbeef> Eh when types are pretty nice
20:56:39FromDiscord<Elegantbeef> like in my example the version is attached to the type so it's impossible to accidentally get a incorrectly versioned file
20:57:19FromDiscord<Elegantbeef> It also means that migration is quite literally calling `migrate` until `SaveData.Version == Version.high`
20:57:27FromDiscord<Phil> They might be, but they make my life difficult, I'm trying to validate if you're forgetting any assignments in a mapping proc (because it's an interesting exercise) and those make the answer depend on stuff
20:58:18FromDiscord<Phil> object variants in general are already hell for this because I can't do a proper validation there.↵Can you map object-variant A to type B?↵I dunno, you tell me first which kind of A you've got and I can tell you if you've got all the fields >=>
21:00:27FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Ucwzw
21:00:33FromDiscord<Elegantbeef> So I guess you might be efine
21:02:21FromDiscord<planetis_m> In reply to @jordan4ibanez "Passing a raylib font": Yes but why do you need the bool? Are you accessing it from multiple threads. You can also use a getter that returns lent Font. Provided that you don't assign the return in a variable (in which case you get a compile error). it's also a hidden pointer that is safe.
21:06:06FromDiscord<jordan4ibanez> I only want to initialize it once, can't check for null, I only want to check once, it's pretty obvious if something goes wrong as it defaults back to the builtin font
21:06:22FromDiscord<jordan4ibanez> Basically, if it works, it works
21:06:30FromDiscord<jordan4ibanez> https://tenor.com/view/shrug-shoulders-spongebob-gif-19763306
21:07:07FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Wasm doesnt have AST": But how would I also parse WASM to make it so you can call functions and stuff
21:08:49FromDiscord<jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4DnY
21:08:51FromDiscord<planetis_m> Yes normally you initialize resources in the main or in a loading thread.
21:09:24FromDiscord<jordan4ibanez> I know what it's telling me, but, should I write a converter that creates a new cstring?
21:10:49FromDiscord<planetis_m> In reply to @jordan4ibanez "I know what it's": It's a warning you dont have to fix it 😉 you can just cstring"mouse" if you don't like warnings.
21:11:16FromDiscord<jordan4ibanez> But muh error. Nah I'm just kidding, it's more of, I want to learn basically
21:11:45FromDiscord<arathanis> what happens if you explicitly convert to cstring?
21:12:45FromDiscord<jordan4ibanez> Oh, lmao, I just bolted on ``.cstring``
21:12:52FromDiscord<jordan4ibanez> nim is amazing, all these simple fixes
21:13:29FromDiscord<arathanis> thats what i thought haha
21:13:31FromDiscord<planetis_m> It generates an if statement equivalent to if len==0: nil else: addr s[0]
21:13:33FromDiscord<arathanis> explicit conversion
21:13:53FromDiscord<jordan4ibanez> So that means, I could theoretically just automate this with a mini module with the same parameters as a passthrough and I never have to worry about it again
21:14:14FromDiscord<jordan4ibanez> https://tenor.com/view/michael-scott-office-fantastic-great-gif-25279163
21:14:40FromDiscord<jordan4ibanez> You know, I was just trying out nim for a day I didn't expect me to like a pythonesk language lmao
21:14:54FromDiscord<planetis_m> In reply to @jordan4ibanez "So that means, I": Yes my goal is to auto generate it eventually.
21:15:04FromDiscord<jordan4ibanez> OH MY GOD YOU'RE THE GUY, thank you so much
21:15:22FromDiscord<jordan4ibanez> Or girl, I dunno, that's just kinda how I talk for some reason
21:16:03FromDiscord<Elegantbeef> Why do you need to parse wasm?↵(@Chronos [She/Her])
21:16:22FromDiscord<Phil> Okay, pre-marked the "getFields"-proc I've got for refactoring and the example you posted earlier, stuff for next time I get to code, right now brain too mush
21:17:31FromDiscord<jordan4ibanez> planetis did they ever expand the limitation to the indices when you generate a custom mesh?
21:17:49FromDiscord<jordan4ibanez> It used to be uint16 iirc and that was a problemo
21:21:59FromDiscord<jordan4ibanez> Also I just realized that if you create a passthrough wrapper, you do not need to utilize move semantics as the Font will be integrated into the scope of the module, and you can just hold a var ref ``currentFont`` with ``switchFont(fontName: string)`` making this sort of like opengl stateful but easier
21:25:08FromDiscord<jordan4ibanez> This is giving me the same feeling I got with kotlin x 1000, that's truly amazing
21:42:06NimEventerNew thread by c4UlMu: Where to read about threading and data sharing in Nim 2, see https://forum.nim-lang.org/t/10404
21:51:09*lucasta joined #nim
22:07:08FromDiscord<jordan4ibanez> In reply to @planetis_m "Yes my goal is": Something as silly as this https://pastecode.io/s/mdyg59ke could maybe just be a bolt on lib for it or something, I dunno, whatever you're feeling really. Also excuse my absurd way of programming
22:10:18FromDiscord<Phil> In reply to @Elegantbeef "Phil partly why the": I think you're selling yourself short here.↵The amount of utils I see in there seem pretty worth it
22:20:39FromDiscord<Elegantbeef> This is really too much fun now 😄
22:20:40FromDiscord<Elegantbeef> simplescreenrecorder-2023-08-13\_16.17.05.mp4 https://media.discordapp.net/attachments/371759389889003532/1140409616606433310/simplescreenrecorder-2023-08-13_16.17.05.mp4
22:21:22FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Why do you need": For interop with other WASM modules?
22:21:47*Onionhammer quit (Quit: The Lounge - https://thelounge.chat)
22:21:49FromDiscord<Elegantbeef> I might be misremembering the VM but don't you just call a symbol and if it doesnt exist the runtime erros?
22:22:26FromDiscord<Chronos [She/Her]> Ideally I'd make it so I can create 'bindings' to that just generate some simple code for my language to understand how it should be called
22:23:06FromDiscord<Chronos [She/Her]> Tho ig I'm just overthinking rn
22:24:15FromDiscord<Elegantbeef> I'm fairly certain you do not have to worry about procedures existing in a module, you just call them and the VM will go "Hey this procedure does not exist, you did wrong"
22:25:22FromDiscord<Chronos [She/Her]> Fair but my language is statically typed too-
22:25:28FromDiscord<Elegantbeef> So?
22:25:34FromDiscord<Elegantbeef> Nim is statically typed but can call JS code
22:26:06FromDiscord<Chronos [She/Her]> They shouldn't be able to call a random non-existent procedure unless they emit WASM directly
22:26:20FromDiscord<Elegantbeef> Might like C interop in any language you write the bindings to the API that's defined
22:26:24FromDiscord<Chronos [She/Her]> That's why I'd like to have something for binding autogen
22:26:30*Onionhammer joined #nim
22:26:36FromDiscord<Elegantbeef> So why do you need to parse wasm to get bindings
22:26:46FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Might like C interop": C interop is probably the best idea tbh... Sigh
22:26:53FromDiscord<Elegantbeef> I'm so confused
22:26:56FromDiscord<Chronos [She/Her]> So am I
22:27:06FromDiscord<Elegantbeef> Why not just make your procedures importable like how every language does interop
22:27:08FromDiscord<Chronos [She/Her]> I'm not thinking properly sorry
22:27:26FromDiscord<Elegantbeef> If you want bindings you can use a tool that extracts procs and their signature if that's even included
22:27:32FromDiscord<Elegantbeef> I don't recall if that type information is stored
22:27:33FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Why not just make": Because how would you define the procedures in the first place?
22:28:37FromDiscord<Chronos [She/Her]> Ig with C bindings though
22:28:51FromDiscord<Chronos [She/Her]> I'm so tired and really don't have the capacity for high-level thinking atm
22:30:15FromDiscord<Elegantbeef> Without looking at the spec I'm like 99% certain that Wasm modules jusut do `nameOfProcedure, addressOfProcedure`
22:30:15FromDiscord<Elegantbeef> It does not store any type information afaik
22:30:16FromDiscord<Elegantbeef> I might be mis remembering
22:30:16FromDiscord<Elegantbeef> Ah actually it does store that information
22:30:20FromDiscord<Elegantbeef> The thing is though what benefit is that to you given you likely are not just working on primitives
22:30:40FromDiscord<Elegantbeef> Like you'd get a `proc doThing(_: uint32)` for `proc doThing(_: MyObject)`
22:31:40FromDiscord<Elegantbeef> Remember wasm only has f32, f64, i32, i64 types everything else is built upon them and depends on the language compilation
22:31:55FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Without looking at the": I swear you call it using module name and proc name on WAT at least
22:32:13FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Like you'd get a": Fair
22:32:30FromDiscord<Elegantbeef> https://webassembly.github.io/spec/core/binary/types.html#function-types
22:32:50FromDiscord<Elegantbeef> So yes it'd contain the type information, but it's pretty moot given you need to know what the ABI is
22:33:30FromDiscord<Elegantbeef> It'd be like wrapping Nim code verbatim without knowing Nim passes objects larger than 24bytes as ref, you just get into an awful situation 😄
22:36:18FromDiscord<ahungry> sent a long message, see http://ix.io/4Doi
22:41:32FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "It'd be like wrapping": Yeah fair enough
22:50:40FromDiscord<jordan4ibanez> Elegantbeef that looks really dang cool man
22:54:54FromDiscord<Elegantbeef> `newT` was how it was done as Nim is inspired by pascal languages
22:55:33FromDiscord<Elegantbeef> Worth noting the 'proper' way of doing it is `proc new(_: typedesc[T], ...)` for ref types and `init` for value types
22:55:49FromDiscord<Elegantbeef> I say 'proper' as some people prefer `newT` and `initT` but neither of those work with generics
23:30:12FromDiscord<jordan4ibanez> So nim multidimensional arrays really do get compiled down into a contiguous array of memory?
23:33:35FromDiscord<Elegantbeef> If you want to say compiled down like they arent in reality, sure
23:33:58FromDiscord<m4ul3r> I'm trying to use a stack string pragma from: https://github.com/zimawhit3/Bitmancer/blob/main/src/Bitmancer/core/str.nim↵But running into: `Error: invalid pragma: stackStringA`
23:36:44FromDiscord<Elegantbeef> Old code not updated for present Nim probably
23:37:54FromDiscord<Elegantbeef> variable section macros are now a single argument afaik
23:38:23FromDiscord<m4ul3r> That’s helpful, thanks. Any resources I can see modern macros and compare it to?
23:39:01FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-2-0/lib/std/decls.nim#L5
23:52:57*krux02 quit (Remote host closed the connection)