<< 21-01-2024 >>

00:02:33*advesperacit quit ()
00:11:37FromDiscord<Robyn [She/Her]> Fair
00:25:22*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
00:28:19FromDiscord<piman_discriminator_1010> is there no Table.empty?↵`path.len > 0`
00:28:26FromDiscord<piman_discriminator_1010> (edit) "Table.empty?↵`path.len" => "Seq.empty?↵`path.len"
01:00:03*nazgulsenpai quit (Quit: ZNC 1.8.2 - https://znc.in)
01:02:29*nazgulsenpai joined #nim
01:11:19*azimut quit (Ping timeout: 240 seconds)
02:27:43FromDiscord<sOkam! 🫐> In reply to @user2m "yeah I'm just now": oh that's a function I wrote. yeah, that one is super bad, it needs proper windows support 🙈
02:29:47FromDiscord<sOkam! 🫐> that function should have a check that runs the command in powershell or cmd, because `sh -c` is not supported on windows
02:30:49FromDiscord<sOkam! 🫐> I discovered the problem much later after I wrote that, and then I helped somebody here with some bindings, and seems like they took it verbatim without fixing the windows support problem
02:31:59FromDiscord<sOkam! 🫐> In reply to @piman_discriminator_1010 "is there no Seq.empty?": `Seq.len == 0` is what I use for that
02:52:33*xet7 quit (Remote host closed the connection)
02:52:52*xet7 joined #nim
03:18:39FromDiscord<leorize> btw Phil, you don't need the omit flags with --passL, in case you want to shorten it a little
03:30:42FromDiscord<piman_discriminator_1010> do enums need to be ordinals (can I put enums in enums?)
03:32:33FromDiscord<piman_discriminator_1010> I have data in the form of two numbers, the first number identifies the enum set, and the second number identifies the enum value within that enum set↵I want to know how I can represent this in code, maybe a table of lists?
03:35:08FromDiscord<Elegantbeef> Array of enum to data
03:35:20FromDiscord<Elegantbeef> `array[MyEnum, MyData]`
03:36:17FromDiscord<piman_discriminator_1010> I don't think the enum set IDs are packed (there's too many for me to actually check by hand)
03:36:31FromDiscord<piman_discriminator_1010> (edit)
03:36:52FromDiscord<Elegantbeef> If you use enums properly they'll always be contiguous! 😛
03:37:17FromDiscord<piman_discriminator_1010> no no, these are not nim enums, they are enums from data I have
03:37:43FromDiscord<piman_discriminator_1010> I'm looking to try and figure out how to get them into nim
03:38:01FromDiscord<piman_discriminator_1010> right now I just have magic numbers
03:38:12FromDiscord<Elegantbeef> Make some enums
03:38:13FromDiscord<piman_discriminator_1010> (edit) "right now I just have ... magic" added "a pair of"
03:38:40FromDiscord<Elegantbeef> Given lack of useful information to operate on I can only say "use the type system to do it in a nice type safe way" 😄
03:38:51FromDiscord<piman_discriminator_1010> In reply to @Elegantbeef "Make some enums": preferably I would like to make nested enums
03:39:06FromDiscord<Elegantbeef> A nested enum does not make any sense
03:39:09FromDiscord<piman_discriminator_1010> (edit) "enums" => "enums, but I'm not sure if that would actually work"
03:39:09FromDiscord<Elegantbeef> An enum is a ordinal value
03:39:16FromDiscord<Elegantbeef> How can a value be a nested value
03:39:31FromDiscord<piman_discriminator_1010> (some languages like Java enums are more like classes)
03:39:45FromDiscord<Elegantbeef> So emulate what they do 😛
03:40:11FromDiscord<piman_discriminator_1010> a table of lists of strings?
03:40:23FromDiscord<Elegantbeef> Sure
03:40:32FromDiscord<piman_discriminator_1010> or I guess a table of lists of string/integer paris
03:40:36FromDiscord<piman_discriminator_1010> (edit) "paris" => "pairs"
03:40:41FromDiscord<Elegantbeef> Java enums are just a global values
03:40:42FromDiscord<cletus6872> sent a long message, see https://pasty.ee/FDtjONTXaKPL
03:41:20FromDiscord<piman_discriminator_1010> In reply to @piman_discriminator_1010 "or I guess a": can this be compile time instantiated?
03:41:30FromDiscord<piman_discriminator_1010> (I assume so)
03:41:43FromDiscord<cletus6872> (edit) "https://pasty.ee/YMFhbkAXzays" => "https://pasty.ee/upuUKDzMRIMl"
03:42:04FromDiscord<Elegantbeef> We have macros so of course
03:42:11FromDiscord<Elegantbeef> We also have static evaluation
03:44:02FromDiscord<piman_discriminator_1010> is there such thing as a pair type, or would that be a tuple?
03:45:02FromDiscord<leorize> that's a tuple indeed
03:50:23FromDiscord<piman_discriminator_1010> In reply to @piman_discriminator_1010 "or I guess a": wait, I think I can do something better maybe
03:52:45FromDiscord<piman_discriminator_1010> hmmmmm, maybe not
03:53:12FromDiscord<piman_discriminator_1010> I can't use `case of` in an enum definition can I
03:53:30FromDiscord<piman_discriminator_1010> essentially a union of enums
03:54:34FromDiscord<Elegantbeef> No enums are ordinals
03:55:33FromDiscord<piman_discriminator_1010> damn https://media.discordapp.net/attachments/371759389889003532/1198475949407227904/image.png?ex=65bf0ab4&is=65ac95b4&hm=c3a6053c3c573e1b64133929bdab6114836a6e5e4101c582d5c21e782af5ea0b&
03:57:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ohQKdlZwlmjF
03:58:03FromDiscord<piman_discriminator_1010> I'm not sure what I'm looking at here
03:58:32FromDiscord<Elegantbeef> We've associated `Bleh` with a tuple of `(set[Bleh], set[Bleh])`
03:58:46FromDiscord<Elegantbeef> now you can do `vals[myEnumVal].process()` or w/e
04:02:44FromDiscord<odexine> if you want it more written out, `vals` is an `array[Bleh, (set[Bleh], set[Bleh])]` or a Bleh-indexable array of pairs of Bleh-combinations
04:03:23FromDiscord<odexine> what beef suggests is that now you can use the array as a mapping for what you want
04:03:36FromDiscord<piman_discriminator_1010> wait, I think I can change my enum holding object to use `case of`
04:03:55FromDiscord<odexine> perhaps
04:06:52FromDiscord<piman_discriminator_1010> ugh, can't use the same field name within different `of`a
04:06:54FromDiscord<piman_discriminator_1010> (edit) "`of`a" => "`of`s"
04:07:43FromDiscord<piman_discriminator_1010> sent a code paste, see https://play.nim-lang.org/#pasty=MqVlFBSSoLxr
04:07:50FromDiscord<piman_discriminator_1010> (edit) "https://play.nim-lang.org/#pasty=BAvZfKbUAqmo" => "https://play.nim-lang.org/#pasty=XcVOaoTTowYG"
04:08:03FromDiscord<piman_discriminator_1010> (edit) "https://play.nim-lang.org/#pasty=RQHmPjYEvODG" => "https://play.nim-lang.org/#pasty=qPftihXNQgpj"
04:08:08FromDiscord<piman_discriminator_1010> (edit) "https://paste.rs/TsPeq" => "https://play.nim-lang.org/#pasty=samFuJlibiSM"
04:08:15FromDiscord<Elegantbeef> Right
04:08:34FromDiscord<piman_discriminator_1010> (edit) "https://paste.rs/KTkFq" => "https://paste.rs/RGOLB"
04:08:47FromDiscord<Elegantbeef> `fooVal` and `barVal` is the conventional solution
04:09:04FromDiscord<Elegantbeef> This is the downside of Nim's non type safe sum types
04:09:17FromDiscord<Elegantbeef> It will eventually get type safe sum type
04:09:23FromDiscord<piman_discriminator_1010> what's a sum type?
04:09:32FromDiscord<piman_discriminator_1010> basically a union?
04:09:34FromDiscord<Elegantbeef> A tagged union
04:09:41FromDiscord<odexine> "enums" in other languages are more accurately called sum types iirc
04:09:43FromDiscord<Elegantbeef> Not basically they're the same thing
04:10:12FromDiscord<Elegantbeef> A tagged union is a sum type
04:10:20FromDiscord<Elegantbeef> Though an untagged union is not a sumtype
04:10:34FromDiscord<leorize> there's nothing sum-ish about enums \:p
04:11:10FromDiscord<Elegantbeef> Don't let JJ hear you say that
04:11:18FromDiscord<piman_discriminator_1010> In reply to @Elegantbeef "`fooVal` and `barVal` is": does this mean code can try to call `fooVal` even when `set` is `BAR`? (even though this would be undefined behavior)
04:11:19FromDiscord<odexine> theyre only called sumtypes because some bongo thought "oh the or operator is just like addition and the and operator is just like multiplication" (i kid)
04:11:56FromDiscord<odexine> In reply to @piman_discriminator_1010 "does this mean code": yes, it would then be a runtime error
04:12:26FromDiscord<leorize> summing is an algebraic operation, which implies the ability to undo it
04:12:51FromDiscord<piman_discriminator_1010> hmm, could I make a macro or template so that calling `val` would prepend the appropriate name and get the adjusted field value then?
04:13:08FromDiscord<leorize> I've not seen any implementations outside of the application programming sphere that implements sum types true to it's name
04:13:09FromDiscord<piman_discriminator_1010> iirc I should be able to
04:13:33FromDiscord<leorize> it's always been this weird equivalence between them and pattern matching
04:15:12FromDiscord<odexine> In reply to @leorize "summing is an algebraic": i really was joking pls ;;
04:16:24FromDiscord<leorize> don't worry that's just a mini rant about how nim still doesn't understand sum types \:p
04:39:16*krux02 quit (Remote host closed the connection)
04:59:25*droidrage quit (Ping timeout: 276 seconds)
04:59:38*azimut joined #nim
05:00:04*qwestion quit (Ping timeout: 276 seconds)
05:49:37*jmdaemon joined #nim
06:15:40FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=agsWjnZCrvOI
06:17:31FromDiscord<sOkam! 🫐> In reply to @user2m "just wrote a slightly": did you try that in the VM?
06:17:50FromDiscord<sOkam! 🫐> the reason to use `gorge` is because its running at compiletime, otherwise `execShellCmd` would be 10times better
06:18:44FromDiscord<user2m> In reply to @heysokam "did you try that": hmmm not exactly sure what you mean by the VM lol you mean with nimscript?
06:19:10FromDiscord<sOkam! 🫐> compiletime code is nimscript (ish), but its actually `when nimvm: ...` not `when defined(nimscript): ...`
06:20:26NimEventerNew thread by yeti: TCC on ARM(el) backend problem, see https://forum.nim-lang.org/t/10894
06:21:21FromDiscord<user2m> In reply to @heysokam "compiletime code is nimscript": oh cool! leaned something new. reading the docs now https://nim-lang.org/docs/manual.html#statements-and-expressions-when-nimvm-statement
06:22:15FromDiscord<sOkam! 🫐> yeah, that's why its using the `sh -c` hacky solution, and the windows solution wasnt tested. because its compile-time code that is meant to be printed back to the user in cli
07:16:44*derpydoo joined #nim
07:44:12*rockcavera quit (Remote host closed the connection)
08:45:43*azimut quit (Ping timeout: 240 seconds)
09:46:34*advesperacit joined #nim
10:07:03*jjido joined #nim
10:22:53FromDiscord<Robyn [She/Her]> Asyncdispatch has something for setting the dispatcher, and getting one, right?
10:23:09FromDiscord<Phil> In reply to @chronos.vitaqua "Asyncdispatch has something for": Aye
10:23:22FromDiscord<Robyn [She/Her]> What if I just set the same dispatcher on all threads? :p
10:23:32FromDiscord<Phil> You typically shouldn't need to access it though. Unless you need to destroy it
10:24:20FromDiscord<Phil> In reply to @chronos.vitaqua "What if I just": Given it is designed around being a threadVar and thus separate per Thread:↵I assume mayhem, potential use-after-frees etc.
10:24:30FromDiscord<Phil> Keep in mind that none of these things are locked datastructures afaik
10:24:47FromDiscord<Phil> So could be you work on the same future twice at the same time, maybe you access a future after another thread freed it, who knows
10:24:53FromDiscord<Robyn [She/Her]> Yeah makes sense :p
10:25:22FromDiscord<Robyn [She/Her]> In reply to @isofruit "You typically shouldn't need": I remember that I did actually use this to make futures work across shared library boundaries
10:25:36FromDiscord<Robyn [She/Her]> My failure was forgetting nimrtl, but otherwise it would've worked :p
10:26:00FromDiscord<Phil> "And I would have succeeded to if it weren't for this meddling nim!"
10:26:05FromDiscord<Phil> (edit) "to" => "too"
10:26:19FromDiscord<Robyn [She/Her]> Yeah basically xD
10:30:04madpropsi want to talk to beef
10:32:24FromDiscord<Phil> Likely gone for the day already, you best chance likely is in around 10h
10:32:34FromDiscord<Phil> your
10:34:39FromDiscord<odexine> well you could also just ask the question and see if someone else can answer you, if its a question
10:36:29FromDiscord<fosster> hi sweet nim community!
10:36:36FromDiscord<Phil> cheers
10:36:57FromDiscord<fosster> do you know a good html template engine (something like jinja) to be used with jester?
10:37:41FromDiscord<Phil> You can use karax (which has a SSR mode) or nimja, those at least are the projects I recall off the top of my head
10:37:46FromDiscord<fosster> it's the first time that I'm approaching to webdev in nim
10:38:05FromDiscord<fosster> thanks!
10:38:07FromDiscord<Phil> As a fallback you can look at source-code-filters which are kind of like a general templating engine you can use, though not necessarily the most readable
10:42:57FromDiscord<fosster> you know what I always say is that an huge thing that is holding nim down from taking off is its documentation
10:43:24FromDiscord<fosster> I never actually used the documentation tools provided, but it doesn't seem so intuitive
10:44:08FromDiscord<fosster> (in my opinion) if it had a simple and effective docs generator like, for instance, rust, it would be a big step up
11:19:24FromDiscord<Phil> In reply to @fosster "(in my opinion) if": Personally I can work with the docs generator that is there.↵Most certainly it could be better and trying to do something about that is on my list of potential projects, but it's not nonexistant
11:19:36*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
11:21:59NimEventerNew thread by AntonioFS: About the Nim official documentation update., see https://forum.nim-lang.org/t/10895
11:54:34FromDiscord<sOkam! 🫐> In reply to @fosster "do you know a": when it comes to generating just raw html with templates, `treeform/taggy`, `nim-html-dsl` are the ones that looked the most promising when i looked into it a couple of weeks ago↵then there is `karax` as recommended, but it tries to be a framework, not just templating↵so depends on what you need
11:55:34FromDiscord<sOkam! 🫐> might be worth looking into `happyx` too, since its similar but also works more like a framework
11:55:44FromDiscord<sOkam! 🫐> (edit) "might be worth looking into `happyx` too, since its similar but also works more like a ... framework" added "fullstack"
12:00:54*derpydoo quit (Quit: derpydoo)
12:03:40FromDiscord<Phil> In reply to @heysokam "when it comes to": How is taggy btw?
12:06:56FromDiscord<sOkam! 🫐> seems pretty decent from what I saw
12:07:43FromDiscord<sOkam! 🫐> I was looking for something more supportive of the tailwind workflow, so I didn't go with it in the end↵but if you use the standard html workflow then its pretty good
12:12:59FromDiscord<summarity> See also https://discord.com/channels/371759389889003530/764946138109050893/1191220597108256768 and preceding messages
12:21:24FromDiscord<sOkam! 🫐> ah yea, dekao is pretty cool too. I didn't remember the name so didn't mention, but its similar to taggy in spirit
12:21:36FromDiscord<sOkam! 🫐> (edit) "didn't" => "couldn't"
12:31:17FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=bOxQdewvToIT
12:38:35FromDiscord<odexine> `collect`? sugar
12:44:29arkanoidis it just me, or the new vscode extension doesn't solve anything about nimlangserver leaving nimsuggests processes hanging around the system even when vscode is closed? I have nimlangserver processes spawned 3 days ago, not opened vscode since then
12:46:33FromDiscord<Robyn [She/Her]> In reply to @arkanoid "is it just me,": New vsc extension?
12:46:42arkanoidyes
12:47:09FromDiscord<Robyn [She/Her]> Huh haven't heard of it
12:47:57arkanoidNimLang.nimlang https://marketplace.visualstudio.com/items?itemName=NimLang.nimlang https://github.com/nim-lang/vscode-nim
12:49:26FromDiscord<sOkam! 🫐> In reply to @arkanoid "is it just me,": https://media.discordapp.net/attachments/371759389889003532/1198610303605276722/image.png?ex=65bf87d5&is=65ad12d5&hm=ff513ac52d9c6d1b03cd04d8cfc94fd67db3641877e72b46018d704dbea649cb&
12:49:30FromDiscord<sOkam! 🫐> That's the nutshell of what you mentioned
12:50:10FromDiscord<sOkam! 🫐> the problem is the server itself. whatever layers of helpfulness you lay on top won't change the underlying issues with how it works internally
12:50:40FromDiscord<sOkam! 🫐> that said, amazing work on that extension. looking really gud! I didn't hear about it until now. love it
12:51:11arkanoidI know it uses nimlangsever, but the process that calls it is the extension, and the extension knows when files/editor is closed, and it should be responsible of cleaning up child processes
12:51:24arkanoidnimlangserver doesn't know when editor is closed
12:56:29FromDiscord<Robyn [She/Her]> In reply to @arkanoid "NimLang.nimlang https://marketplace.visualstudio.co": Doesn't come up on the VSC extension thing in the app... Hm
13:00:04FromDiscord<sOkam! 🫐> In reply to @arkanoid "nimlangserver doesn't know when": apparently the problem is listed in the `tooling roadmap RFC` todo list, very close to the top of the list
13:03:45FromDiscord<Robyn [She/Her]> Trying to figure out how to make allographer let me set a required length for binary data :p
13:12:00FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=ASXRBmeBKWgc
13:15:36FromDiscord<joshdougvidarr> What's a nice easy Linux terminal app I could make in Nim? I was thinking of a TUI Pacman client but that's too much. I've not coded anything in about 2yrs and I'm new to Nim - suggestions on a postcard please?
13:17:37*junaid_ joined #nim
13:19:13FromDiscord<Phil> Honestly you could look into contributing to atlas
13:19:51FromDiscord<Phil> The task (package management) is alright in scope and you're not on your own and it benefits the wider community significantly
13:19:59FromDiscord<Phil> And it's also CLI
13:20:22FromDiscord<joshdougvidarr> Good idea - thank you! I'll take a look. 🙂
13:24:11*junaid_ quit (Remote host closed the connection)
13:25:14*systemdsucks quit (Remote host closed the connection)
13:46:45*rockcavera joined #nim
13:49:52*junaid_ joined #nim
13:50:51*rockcavera quit (Remote host closed the connection)
13:51:13*rockcavera joined #nim
14:11:10*junaid_ quit (Remote host closed the connection)
14:15:49*jmdaemon quit (Ping timeout: 276 seconds)
14:45:28FromDiscord<joshdougvidarr> sent a long message, see https://pasty.ee/GMMSYzzlbnkj
15:01:42FromDiscord<␀ Array 🇵🇸 🍉> sent a long message, see https://pasty.ee/eDYInKWDwHZw
15:02:49FromDiscord<Phil (he/him)> TBF the last is not quite equivalent.↵↵The last one is equivalent to `echo "Hel", "lo"`
15:03:25FromDiscord<Phil (he/him)> Comes out to the same but overall different way to phrase the operation as opposed to `echo "Hello"` vs. `"Hello".echo()` which are equivalent
15:03:30FromDiscord<Robyn [She/Her]> Also you can do `echo"Hello"` :P
15:11:19FromDiscord<␀ Array 🇵🇸 🍉> yes, i ment identical output the procedure is being called twice
15:28:39*azimut joined #nim
15:45:18FromDiscord<joshdougvidarr> It's the kind of wild schizophrenic genius that Nikola Tesla would use. I think if Tesla was alive today he'd use Nim to program the worlds first FTL drive.
15:50:44FromDiscord<joshdougvidarr> I don't mean to scare anyone but I've completed 3 katas of Nim on codewars.com. When can I apply to be the lead dev of the language?
15:51:20Amun-Rado you have black belt in nim?
15:51:56FromDiscord<joshdougvidarr> After 3 kata? I'm still white belt.
15:52:09FromDiscord<Phil> In reply to @Amun-Ra "do you have black": More importantly does he have all the 8 nim-gym badges to compete in the nim-league?
16:17:00*azimut quit (Remote host closed the connection)
16:17:28*azimut joined #nim
16:30:09*krux02 joined #nim
16:31:43*azimut quit (Ping timeout: 240 seconds)
16:32:50*azimut joined #nim
17:02:53*azimut quit (Read error: Connection reset by peer)
17:03:56*azimut joined #nim
17:32:55*azimut quit (Ping timeout: 240 seconds)
17:37:52*azimut joined #nim
17:40:28*junaid_ joined #nim
17:48:43*azimut quit (Remote host closed the connection)
17:49:04*azimut joined #nim
17:57:17FromDiscord<Phil> I amaze myself, I do Exception handling slightly differently, BAM, memory leak
17:58:11FromDiscord<Phil> I don't even get what I could possibly be leaking here.↵This is a proc raising an exception, that being caught by an inner try-catch, which transforms the exception and re-raises it to be cought in an outer try-catch.↵What is there to leak?
18:00:38FromDiscord<Phil> ... apparently it's fixed by calling the destroy hook on the exception... manually? I.. what?
18:06:22FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=ZEpxAQWDiuzV
18:06:46FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=qRnciDPgZkZW" => "https://play.nim-lang.org/#pasty=npKUMjAuPNXf"
18:35:31FromDiscord<piman_discriminator_1010> ummmm, is there something faster than `.toTable` at compile time?
18:38:28FromDiscord<piman_discriminator_1010> I have a compile time table of tables numbering 50000 string elements, `.toTable` took over a minute to compile
18:39:59FromDiscord<Phil> ... Any chance you can just statically define that table in a JSON file?
18:40:04FromDiscord<Phil> Or is it being computed?
18:40:15FromDiscord<Phil> I'd assume reading that sucker from a JSON file would be faster
18:40:16FromDiscord<piman_discriminator_1010> In reply to @isofruit "... Any chance you": I can
18:40:27FromDiscord<Phil> You can use staticRead for that
18:40:37FromDiscord<piman_discriminator_1010> would have to rewrite my code gen again though
18:40:45FromDiscord<Phil> hmm
18:41:10FromDiscord<piman_discriminator_1010> In reply to @piman_discriminator_1010 "would have to rewrite": but this shouldn't be too bad tbh
18:41:35FromDiscord<Phil> You can just try it out first, dump it to a JSON file and write yourself a one-liner that does nothing else but read in that file at compiletime
18:41:51FromDiscord<Phil> See how quickly that compiles, should take less than a second
18:43:43FromDiscord<piman_discriminator_1010> can the keys be integers with a JSON?
18:44:40FromDiscord<piman_discriminator_1010> (edit) "can the keys be integers with ... a" added "importing"
18:45:08FromDiscord<Phil> Nope, hmm
18:45:48FromDiscord<Phil> You can dump them as strings and parse them back into ints and see if that's still faster than generating them
18:46:11FromDiscord<Phil> Other than that, you could see if you can get away with writing them into a custom format from which you parse at compileTime
18:48:44FromDiscord<piman_discriminator_1010> In reply to @isofruit "Other than that, you": I can do that?
18:49:05FromDiscord<piman_discriminator_1010> also with `.toTable`, yea...... cpu go brrrrrrrrrrrrrrr lol https://media.discordapp.net/attachments/371759389889003532/1198700814609416272/image.png?ex=65bfdc20&is=65ad6720&hm=f750bfe73c9ccf5a3c488851b02d9f95394ec85f19f03bfd94f0ae890dd91fe9&
18:50:32FromDiscord<Phil> In reply to @piman_discriminator_1010 "I can do that?": Sure. It's just representing a table as a string.↵You are the one that writes the file and reads from it, you can decide that format
18:50:50FromDiscord<piman_discriminator_1010> no I mean the parsing at compile time
18:51:42FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=bIujcsddQXCj
18:52:23FromDiscord<Phil> There's also like 3 more ways to call a proc at compileTime, but the one above suffices
18:53:09FromDiscord<piman_discriminator_1010> though come to think of it, I would prefer to not need to parse because I need to code gen the table as enums too, wait, can I store the "file" as a string literal and parse that?
18:53:52FromDiscord<piman_discriminator_1010> (but at 50000 elements, that would be a lot of memory if it stays after parsing)
18:54:30FromDiscord<Phil> In reply to @piman_discriminator_1010 "though come to think": Pretty much what you'll have to do
18:54:47FromDiscord<Phil> A file is just a string that you can click on via your file manager
18:54:54FromDiscord<Phil> a txt file
18:55:41FromDiscord<Phil> And you have that memory consumption either way
18:55:58FromDiscord<piman_discriminator_1010> In reply to @isofruit "And you have that": well yes, but temporary vs permanent
18:56:18FromDiscord<piman_discriminator_1010> or well actually no, with a file you can stream
18:56:25FromDiscord<Phil> Wait, do you need the table only at compiletime for codegen?
18:56:42FromDiscord<piman_discriminator_1010> no, the codegen is to make the table
18:56:47FromDiscord<Phil> Ah check
18:56:54FromDiscord<piman_discriminator_1010> I need it at runtime to convert magic numbers
18:56:59FromDiscord<piman_discriminator_1010> (edit) "I need it at runtime to convert magic numbers ... " added "to readable text"
18:57:36FromDiscord<Phil> Could you just have a seq?
18:57:42FromDiscord<Phil> Or rather an array I guess
18:57:51FromDiscord<piman_discriminator_1010> (and then I need the enums to convert readable text to magic numbers)
18:58:11FromDiscord<piman_discriminator_1010> In reply to @isofruit "Could you just have": it's a sparse array, there are holes in the indexing
18:58:17FromDiscord<piman_discriminator_1010> (edit) "it's a" => "it would be"
18:58:21FromDiscord<piman_discriminator_1010> (edit) "In reply to @isofruit "Could you just have": it would be ... sparse" added "a"
18:58:24FromDiscord<Phil> Sure, but that shouldn't play a role right?
18:58:49FromDiscord<Phil> If necessary you can write yourself a proc for accessing the array and if a value is a sentinel value that indicates "empty" you can raise an exception
18:58:50FromDiscord<piman_discriminator_1010> the text i'm generating this from also isn't in order
18:59:05FromDiscord<piman_discriminator_1010> (edit) "the text i'm generating this from also isn't in order ... " added "(well it's in alphabetical order rather than numeric)"
18:59:22FromDiscord<Phil> Doesn't have to be.↵Pre-allocate an array of the size and then just assign to the indexes
19:00:24FromDiscord<Phil> Like, you can know the max-index at compiletime right?↵You could go `array[maxIndex, string]` or whatever the second value is and then follow that up with a massive amount of `thatArray[someIndex] = "lala"`
19:00:43*junaid_ quit (Quit: Lost terminal)
19:01:00FromDiscord<piman_discriminator_1010> In reply to @isofruit "Like, you can know": theoretically I would know, but I would have to write another program to actually find out lol
19:01:19FromDiscord<Phil> Is it a word-count?
19:01:25FromDiscord<Phil> If so, readFile.split(" ").len()
19:01:39FromDiscord<Phil> (edit) "readFile.split("" => "`<somereadfileproc>`.split(""
19:01:43FromDiscord<piman_discriminator_1010> also one of the subtables is 4000 elements, while most subtables are under 10 elements
19:01:49FromDiscord<piman_discriminator_1010> (edit) "4000" => "4000+"
19:01:53FromDiscord<Phil> Hmmmm
19:01:54FromDiscord<piman_discriminator_1010> (edit) "4000+" => "8000+"
19:05:33FromDiscord<piman_discriminator_1010> what's the lifetime of a string literal passed directly as an argument?
19:05:38FromDiscord<Phil> So basically my approaches boil down to:↵- Write the table to a file, read that in and parse it into a table, see if that's faster↵- Instead of using .toTable, generate a bunch of direct assignments, see if that's faster↵- Try to store it as a seq instead
19:06:06FromDiscord<piman_discriminator_1010> can I build a table that way at compile time?
19:06:22FromDiscord<piman_discriminator_1010> wait, parsing would have to do that too lol
19:06:38FromDiscord<piman_discriminator_1010> I could try direct assignments I guess
19:07:04FromDiscord<Phil> In reply to @piman_discriminator_1010 "wait, parsing would have": Yeah, just trying to circumvent the codegen there which I assume is also expensive
19:08:01FromDiscord<piman_discriminator_1010> sent a code paste, see https://play.nim-lang.org/#pasty=GxGogRuwTeMJ
19:08:47FromDiscord<piman_discriminator_1010> In reply to @isofruit "Yeah, just trying to": my code gen runs in under a second
19:09:12FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=jmguprqIcJNH
19:09:16FromDiscord<piman_discriminator_1010> which I find actually kind of impressive with all the fprintfs lol
19:09:56FromDiscord<Phil> The difference here is that you don't first have to allocate whatever set-like structure you first used to then punch that into a table
19:10:03FromDiscord<piman_discriminator_1010> sent a code paste, see https://play.nim-lang.org/#pasty=sbZZyGzhNRZY
19:10:08FromDiscord<Phil> You just start with a table and punch things into it
19:10:56FromDiscord<Phil> Almost, initTable[int, string]()
19:11:07FromDiscord<piman_discriminator_1010> thanks, I will try this thn
19:11:09FromDiscord<piman_discriminator_1010> (edit) "thn" => "then"
19:12:04*lucasta joined #nim
19:23:12FromDiscord<piman_discriminator_1010> hmm, still taking a long time to compile
19:26:03FromDiscord<piman_discriminator_1010> actually seems to be taking longer
19:31:19FromDiscord<piman_discriminator_1010> hmm, and nimble doesn't seem to do incremental building?
19:32:05FromDiscord<Phil> I mean you can do incremental building typically, but that is more of a "per-file" operation and how it works in detail I couldn't tell you
19:32:25FromDiscord<Phil> You might get more detaild answers if you were to make a forum question about this or wait for elegantbeef or Pmunch to come around
19:32:26FromDiscord<piman_discriminator_1010> well, this table is in it's own file
19:32:47FromDiscord<Phil> detailed
19:34:07FromDiscord<leorize> nim doesn't do IC at the moment
20:00:39FromDiscord<piman_discriminator_1010> can `echo` accept extra arguments to `$`?↵if I define `$` with a default second argument can I call that from echo or do I need to call `$` directly still
20:03:31FromDiscord<leorize> sure
20:03:39FromDiscord<leorize> basically whenever you write `echo x` it's turned into `echo $x`
20:03:43FromDiscord<leorize> echo doesn't call `$`, it's a bit of a syntactic sugar
20:13:58FromDiscord<piman_discriminator_1010> ahh, cool
20:21:47FromDiscord<Robyn [She/Her]> Time to work on my macro for wrapping MC packets into Nim data types
20:23:36FromDiscord<Robyn [She/Her]> Nvm nope dopamine does not lay here
20:25:04FromDiscord<piman_discriminator_1010> is there a printf like function in nim, it's getting annoyting typing `&` and `"` all the time
20:26:11FromDiscord<Robyn [She/Her]> In reply to @piman_discriminator_1010 "is there a printf": https://nim-lang.org/docs/strutils.html#%25,string,openArray[string]
20:26:29FromDiscord<Robyn [She/Her]> And this: https://nim-lang.org/docs/strutils.html#format%2Cstring%2Cvarargs%5Bstring%2C%5D
20:26:49FromDiscord<Robyn [She/Her]> Though, you might like https://nim-lang.org/docs/strformat.html more
20:27:17FromDiscord<Robyn [She/Her]> it lets you do `echo &"Hello {name}! Nice to meet you!"`
20:27:22FromDiscord<Robyn [She/Her]> Like Python f-strings
20:29:45Amun-Rabut not as flexible
20:30:21Amun-Ra(no {} nesting)
20:31:20FromDiscord<Robyn [She/Her]> In reply to @Amun-Ra "(no {} nesting)": Nesting?
20:36:32FromDiscord<Robyn [She/Her]> Anyone happen to know how to execute raw SQL with Allographer?
20:37:19FromDiscord<varriount> @zevv Saw your comment on Hacker News in that Pratt Parser submission. ;P
20:37:54FromDiscord<piman_discriminator_1010> In reply to @leorize "basically whenever you write": hmmm, this didn't work↵`echo property, true`
20:37:55FromDiscord<Robyn [She/Her]> Nvm found how to do it
20:38:00FromDiscord<piman_discriminator_1010> it just printed property, then true
20:38:11FromDiscord<piman_discriminator_1010> rather than printing property with argument true
20:38:15FromDiscord<Robyn [She/Her]> In reply to @piman_discriminator_1010 "it just printed property,": That works as intended then
20:38:46FromDiscord<Robyn [She/Her]> In reply to @piman_discriminator_1010 "hmmm, this didn't work": Do `echo property(true)`, right now, `true` is being passed to `echo`, not `property`
20:39:02FromDiscord<Robyn [She/Her]> `echo property, true` is the same as `echo(property, true)`
20:40:30FromDiscord<piman_discriminator_1010> this did the same thing `echo property(true)`
20:44:16FromDiscord<Robyn [She/Her]> In reply to @piman_discriminator_1010 "this did the same": Wdym?
20:45:29FromDiscord<piman_discriminator_1010> it echoed property followed by the literal true
20:46:45FromDiscord<Robyn [She/Her]> Did you compile the code again?
20:50:08FromDiscord<piman_discriminator_1010> let me try again (but it takes a while to compile)
20:51:03FromDiscord<piman_discriminator_1010> nope, nvm it errors↵`Error: attempting to call routine: 'property'`
20:53:56FromDiscord<piman_discriminator_1010> this is the only thing I have found to work↵`echo property.`$`(true)`
20:54:05FromDiscord<piman_discriminator_1010> (edit) "property.`$`(true)`" => "property.\`$\`(true)`"
20:54:25FromDiscord<piman_discriminator_1010> (edit) "this is the only thing I have found to work↵`echo property.\`$\`(true)`" => "sent a code paste, see https://play.nim-lang.org/#pasty=grsKkhwGMfRV"
20:59:39FromDiscord<Elegantbeef> @piman_discriminator_1010 What are you doing?
20:59:53FromDiscord<piman_discriminator_1010> just wanted to be able to print extra info with a flag
21:00:37FromDiscord<Elegantbeef> So then make a `toString` proc
21:27:52FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=MFyLMmicFksu
21:28:37FromDiscord<Elegantbeef> That's not bonkers phil
21:28:41FromDiscord<Phil> But that shouldn't be a race imo, it only gets freed if one of them goes to 0... wait fuck
21:28:46FromDiscord<Phil> What if they write at the same time
21:28:46FromDiscord<Elegantbeef> In the first case `msg` lives until the end of loop
21:28:59FromDiscord<Elegantbeef> In the second case the message is scoped to the `while` loop
21:29:23FromDiscord<Phil> ... Can I change that lifetime to end at sendMessage in some way?
21:29:35FromDiscord<Phil> It's already a `sink`annotated parameter
21:29:44FromDiscord<Elegantbeef> `ensureMove` might work
21:29:53FromDiscord<Elegantbeef> But it's a ref so they do not abide by move semantics
21:30:21FromDiscord<Phil> Is that a thing?
21:30:29FromDiscord<Phil> Ah, it's a proc
21:35:27FromDiscord<Phil> Hmmm ensureMove does not play well with sink
21:35:37FromDiscord<Elegantbeef> It does play well with sink
21:35:41FromDiscord<Elegantbeef> Cause that's the entire point
21:35:55FromDiscord<Phil> Only in the sense that it causes compiler errors which talk about implicit copies
21:36:10FromDiscord<Elegantbeef> It also `move`s
21:36:23FromDiscord<Elegantbeef> So it does indeed play well with sink
21:36:32FromDiscord<Elegantbeef> But it does not solve your issue cause references are not sinkable
21:36:39FromDiscord<Phil> Hmmm
21:37:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=nQxkgpopffHY
21:37:29FromDiscord<Phil> ... I really don't want to
21:37:36FromDiscord<Phil> I'm halfway on board if I can hide this from the user
21:37:51FromDiscord<Elegantbeef> `owned MyRef(....)`
21:38:04FromDiscord<Phil> If I can't my package becomes halfway pointless if it starts becoming that inconvenient to use that I need to force them to do manual message instantiations like this all the time
21:38:39FromDiscord<Elegantbeef> Nim is just not setup to properly handle refs with threads
21:38:51FromDiscord<leorize> have you tried `--mm:atomicArc`? \:p
21:38:53FromDiscord<Elegantbeef> You have to `Isolate` at instantiation level to actually get move semantics
21:39:05FromDiscord<Phil> Which is impossible semantics
21:39:21FromDiscord<Elegantbeef> Or you can make your own distinct that does not have the same restrictions 😄
21:40:36FromDiscord<leorize> you can also use nimskull where arc won't race, just saying
21:41:11FromDiscord<Elegantbeef> Could also use Rust!
21:42:03FromDiscord<Phil> sent a long message, see https://pasty.ee/lXtQwFLftEbH
21:42:48FromDiscord<Phil> (edit) "https://pasty.ee/xxWIOGuAXTif" => "https://pasty.ee/hyeqKSAqByMb"
21:42:58FromDiscord<leorize> installing nimskull got like, 10x easier with this stuff\: https://github.com/nim-works/asdf-nimskull
21:43:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=JLMnrIEfReOg
21:45:16FromDiscord<leorize> https://mise.jdx.dev/ \<- use this instead of asdf just because it's faster
21:45:23FromDiscord<leorize> and it's a drop-in replacement for asdf
21:48:16*tiorock joined #nim
21:48:16*rockcavera quit (Killed (iridium.libera.chat (Nickname regained by services)))
21:48:16*tiorock is now known as rockcavera
21:50:32FromDiscord<Elegantbeef> The readme is lying to me now leo.... 😛
21:50:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=wZgWeJRwzkfb
21:51:51FromDiscord<leorize> \:p
21:52:04FromDiscord<leorize> use the one with the git repo in it xd
21:52:11FromDiscord<Elegantbeef> I did
21:52:19*lucasta quit (Remote host closed the connection)
21:52:35FromDiscord<Elegantbeef> mise must have a different UX here
21:53:01FromDiscord<Elegantbeef> Seems it thinks all words following `install` are packages
21:53:50FromDiscord<leorize> try `nimskull@latest` ig
21:54:01FromDiscord<Elegantbeef> Also makes another executable named `nim` so I'm not following through
21:54:50FromDiscord<leorize> too bad we haven't renamed nimskull compiler yet
22:00:28FromDiscord<Phil> I'm actually still not sure if my data-race is an actual problem
22:00:50FromDiscord<Phil> Because the counter is either 2 or 1
22:00:51FromDiscord<Elegantbeef> It'll likely run into a double free if my assumption is right
22:01:05FromDiscord<Elegantbeef> Well then perhaps not 😄
22:01:27FromDiscord<Phil> Like, the message will exist (in that sense) on the main thread and the other thread
22:01:33FromDiscord<Phil> One of them will see the count down from 2 to 1
22:01:35FromDiscord<Phil> The other from 1 to 0
22:01:44FromDiscord<leorize> are you sure?
22:01:51FromDiscord<Phil> I literally can not be
22:02:07FromDiscord<leorize> and that's not counting what happens first
22:02:13FromDiscord<leorize> zero happens first for free happens first?
22:02:55FromDiscord<leorize> s/for/or/
22:03:33FromDiscord<piman_discriminator_1010> hmmmm, theres no proc for `''(string, int)`?
22:14:31*advesperacit quit ()
22:18:12FromDiscord<domosokrat> There is `repeat(string, Natural)` in strutils↵(@piman_discriminator_1010)
22:18:28FromDiscord<piman_discriminator_1010> ah, thanks
22:19:03FromDiscord<piman_discriminator_1010> does it allow `0` as well?
22:19:28FromDiscord<piman_discriminator_1010> ex: `repeat("foo", 0)` returning an empty string
22:20:03FromDiscord<domosokrat> Don't know. Try it.
22:21:25FromDiscord<piman_discriminator_1010> seems to have probably worked
22:21:47FromDiscord<piman_discriminator_1010> didn't error (but it's also not printing right anyways, so idk if it's even being called)
22:22:41FromDiscord<piman_discriminator_1010> also takes a good 30 seconds or so to compile a single nim file :mood:
22:22:46FromDiscord<Phil> In reply to @leorize "are you sure?": From what I can tell, the race is when they check if they are the respective last reference.↵Naturally because of how compilers may fuck with ordering I can't guarantee anything.↵Damnit, this wouldn't be a problem if the counters were simply Atomics
22:23:05FromDiscord<Phil> (edit) "In reply to @leorize "are you sure?": From what I can tell, the race is when they check if they are the respective last reference.↵Naturally because of how compilers may fuck with ordering I can't guarantee anything.↵Damnit, this wouldn't be" => "sent" | "problem if the counters were simply Atomics" => "long message, see https://pasty.ee/WOpycZwLqKWz"
22:23:44FromDiscord<leorize> they also race trying to decrement them
22:24:08FromDiscord<Phil> Yeah which means worst case scenario data-leak because both decrement at the same time
22:24:21FromDiscord<Phil> Leading to only 1 decrement happening where 2 should be happening
22:24:27FromDiscord<leorize> yep
22:24:37FromDiscord<leorize> `--mm:atomicArc` and join the dark side
22:25:05FromDiscord<Phil> How the hell is that not the standard? That seems like the kind of thing without everything is fucked
22:25:13FromDiscord<Phil> Is the performance degradation that brutal?
22:25:21FromDiscord<Elegantbeef> On older hardware, yes
22:26:16FromDiscord<Phil> ... that is the kind of situation that just demotivates me, like... what are you supposed to do at that point.↵So either your program is slow or single threaded and thus also slow?
22:26:34FromDiscord<Elegantbeef> Single threaded code is not slow
22:26:39FromDiscord<leorize> it is said that a swift program spends 30% of its time doing atomic rc the last time I checked
22:26:42FromDiscord<Phil> Sure it isn't until you hit stutters
22:27:10FromDiscord<Phil> and frame-drops because a blocking operation makes the application non-responsive for a second
22:27:53FromDiscord<Elegantbeef> Just write simpler projects that allow you to temporally calculate things
22:28:49FromDiscord<Phil> I can't even move data that is behind a ref into pointer territory without copies I don't think, ugh
22:28:58FromDiscord<Elegantbeef> You can
22:29:07FromDiscord<Elegantbeef> A ref is just a pointer
22:29:43FromDiscord<Elegantbeef> `cast[ptr int](new int)` is legal assuming you do `GcRef` to keep the reference alive
22:30:07FromDiscord<leorize> disruptek packed his rc manipulation shenanigans into a neat module in insideout
22:30:13FromDiscord<Phil> Yeah but the idea is you give me e.g. a ref object to send through a channel, I turn it into a pointer and now I'm outside of nim's entire memory management system
22:30:47FromDiscord<Phil> And pump that pointer through the channel and transform it into a ref with a counter of 1 somehow that gets returned from a read proc
22:30:59FromDiscord<leorize> you should probably consult the two people who worked on that exact problem
22:31:22FromDiscord<leorize> because they broke several walls banging their heads on that one
22:31:36FromDiscord<Phil> I'll do that tomorrow, right now I'm feeling like 5% depressed and that's enough to kill coding enthusiasm for the day
22:34:01NimEventerNew thread by sergio: Cannot open file: db_connector/db_sqlite, see https://forum.nim-lang.org/t/10896
22:34:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=AIjvhLcxncye
22:36:38*systemdsucks joined #nim
23:03:50FromDiscord<Elegantbeef> Well this is pretty nice https://github.com/beef331/traitor/blob/master/traitor/streams.nim#L80-L100
23:04:49FromDiscord<Elegantbeef> Exact same api for the trait wrapped object as for the non trait wrapped object, it's totally something
23:09:35FromDiscord<Phil (he/him)> Ah, leorize - tsan works if you set ASLR to 28 bits for clang 16.0.6
23:09:50FromDiscord<Phil (he/him)> There's a clang version from november that can go up to 30 bits, but at least arch doesn't have it
23:10:31FromDiscord<Phil (he/him)> Basically running `sudo sysctl vm.mmap_rnd_bits=28` should do the trick
23:10:36FromDiscord<Phil (he/him)> Neat !
23:14:27FromDiscord<leorize> it hasn't stopped working for me, luckily
23:14:40FromDiscord<Phil (he/him)> What kernel are you on?
23:14:45FromDiscord<Phil (he/him)> 6.6.6 or higher?
23:17:20FromDiscord<Elegantbeef> I stay on the devils kernel
23:22:55FromDiscord<thepuzzleddev> Is there a way to use nim with value-based error handling like in go or rust rather than exceptions?
23:24:21FromDiscord<Elegantbeef> Yea you just do
23:24:42FromDiscord<Elegantbeef> There are multiple results packages and `std/options` in the stdlib
23:24:45FromDiscord<Elegantbeef> Plus it has tuples
23:24:50FromDiscord<Elegantbeef> So you can just write go code
23:25:12FromDiscord<thepuzzleddev> awesome thanks
23:29:09FromDiscord<leorize> 6.6.11
23:41:43FromDiscord<piman_discriminator_1010> what's the typical naming convention for enums?
23:42:41FromDiscord<leorize> `CamelCase` pretty much
23:45:11FromDiscord<piman_discriminator_1010> ....... enums can't start with numbers can they :mood: ugh
23:45:26FromDiscord<piman_discriminator_1010> In reply to @leorize "`CamelCase` pretty much": for the enums or the enum class name?
23:54:09FromDiscord<piman_discriminator_1010> sent a code paste, see https://play.nim-lang.org/#pasty=IupsWVTLQjNK
23:54:34FromDiscord<piman_discriminator_1010> how do I sanatiz a literal dot :PepeHands:
23:54:40FromDiscord<piman_discriminator_1010> (edit) "sanatiz" => "sanitize"
23:55:26FromDiscord<michaelb.eth> In reply to @isofruit "I read Zevv's thread": was that a forum thread or gh isssue or …?
23:55:52FromDiscord<thepuzzleddev> In reply to @Elegantbeef "There are multiple results": My issue though is that the std library still uses exception, and there's nothing in the function signature indicating it can throw one
23:56:52FromDiscord<Elegantbeef> Yea there is
23:57:09FromDiscord<Elegantbeef> Annotate all your procedures with `{.raises: [].}`
23:57:15FromDiscord<Elegantbeef> you now have the rust assurance
23:58:06FromDiscord<thepuzzleddev> Yes, but in the std most of the functions have no indication they can throw https://media.discordapp.net/attachments/371759389889003532/1198778580214227004/2024-01-21_18-57.png?ex=65c0248d&is=65adaf8d&hm=300b8158d4fde1b031889ebfe8e15897f25906604c13116d9775ee420a2bb1b5&
23:58:21FromDiscord<Elegantbeef> They do
23:58:29FromDiscord<Elegantbeef> The compiler infers raises and annotates it in the doc gen
23:59:59FromDiscord<michaelb.eth> at the top of your module/s you can put `{.push raises: [].}`, then recompile and you should start getting compile-time errors about std this or that raising an unlisted Exception