<< 04-10-2023 >>

00:33:39FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4I6p
00:34:13FromDiscord<ravinder387> C:\Users\ravin\Downloads\nim-2.0.0\lib\js\jsffi.nim(434, 16) template/generic instantiation of `{}` from here Error
00:34:40FromDiscord<Elegantbeef> Nim doesnt use `{}` for construction
00:36:29FromDiscord<raynei486> c++ syndrome
00:46:13FromDiscord<_gumbercules> Nim used to have optional brace syntax - maybe it still does?
00:46:16FromDiscord<_gumbercules> Who knows really
00:46:28FromDiscord<_gumbercules> Definitely not me
00:46:40FromDiscord<Elegantbeef> It doesnt anymore, syntax skins have luckily been removed
00:46:57FromDiscord<ravinder387> https://media.discordapp.net/attachments/371759389889003532/1158928211183419463/Screenshot_2023-10-04_061647.png?ex=651e0781&is=651cb601&hm=84b3f103ce2f540960c9ef88afcb5d52c6856a9662d709db3a30aa113d65d747&
00:48:08FromDiscord<_gumbercules> hahaha
00:48:52FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4I6r
00:49:10FromDiscord<_gumbercules> https://nim-lang.org/docs/jsffi.html#%7B%7D.m%2Ctypedesc%2Cvarargs%5Buntyped%5D
00:49:12FromDiscord<ravinder387> C:\Users\ravin\OneDrive\Programming-Languages\Nim-Lang\Tutorials\Interop\nim-js\Jsffi\chart-js\Day-1\file.nim(33, 3) Error: expression 'rr' is of type 'JsObject' and has to be used (or discarded)
00:49:13FromDiscord<_gumbercules> it's just a macro
00:49:45FromDiscord<_gumbercules> yeah well - the error for the second thing you posted is pretty clear no?
00:49:54FromDiscord<_gumbercules> type `discard rr`
00:50:01FromDiscord<_gumbercules> instead of just `rr`
00:51:38FromDiscord<ravinder387> C:\Users\ravin\OneDrive\Programming-Languages\Nim-Lang\Tutorials\Interop\nim-js\Jsffi\chart-js\Day-1\file.nim(29, 6) Error: implementation of 'file.Chart(a: Element, b: JsObject)' expected
00:52:10FromDiscord<ravinder387> now nim says he want Chart implementation.... I'm trying to call chart.js library
00:52:30FromDiscord<ravinder387> is jsffi only able to call jquery library
00:53:58FromDiscord<Elegantbeef> Nope
00:55:47FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4I6u
00:55:54FromDiscord<ravinder387> how to wrap this code
01:23:07FromDiscord<ravinder387> anybody know
01:23:32FromDiscord<Elegantbeef> Use importjs and `type Chart = object`
01:28:59FromDiscord<raynei486> beef RTFM coming within the next 5 messages
01:29:17FromDiscord<Elegantbeef> I only say that sparringly
02:32:10*azimut joined #nim
03:01:59FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4I6F
03:02:26FromDiscord<ravinder387> attempting to call routine: 'Chart'↵ found file.Chart [type declared in C:\Users\ravin\OneDrive\Programming-Languages\Nim-Lang\Tutorials\Interop\nim-js\Jsffi\chart-js\Day-1\file.nim(29, 6)]
03:12:07FromDiscord<ravinder387> it compile successfully but line 255 error https://media.discordapp.net/attachments/371759389889003532/1158964740857540678/Screenshot_2023-10-04_084142.png?ex=651e2986&is=651cd806&hm=6c5efc7f5371a3a2275c2db559a3f492334fcdf4275ee84e51c8a0444cee2f19&
03:13:04FromDiscord<ravinder387> line 255 error https://media.discordapp.net/attachments/371759389889003532/1158964981035974706/Screenshot_2023-10-04_084243.png?ex=651e29c0&is=651cd840&hm=eb4b842b3cb694a0ec2815c541feed7a759db2fb68578f3567fc13caab32fd98&
03:15:27*LuxuryMode joined #nim
03:15:51LuxuryModeAnyone been able to get syntax highlighting/coloring for nim in vim/nvim? I got the lsp working, but I still have no colors :(
03:20:18FromDiscord<ravinder387> vim will dead on 2025
03:20:45FromDiscord<fastfist> whaaa? that isa huge hottake
03:24:19LuxuryModelulz
03:24:28FromDiscord<dissolved.girl> In reply to @LuxuryMode "Anyone been able to": Yes
03:24:36FromDiscord<dissolved.girl> One sec
03:25:19*LuxuryMode considers moving to Discord
03:25:20FromDiscord<dissolved.girl> This is my setup: https://forum.nim-lang.org/t/10507#70259
03:25:53LuxuryModeAh, thank you so much!
03:25:56FromDiscord<dissolved.girl> nimlangserver provides the.. well... language server, and the nim.nvim provides the colours
03:28:51LuxuryModeAmazing, thank you https://ibb.co/7knLFpq
03:28:59LuxuryModeRight
03:34:07LuxuryModeDoes anything else belong in my .gitignore besides `nimcache/`, `nimblecache/`, and `htmldocs/`?
03:34:34LuxuryModeoh I guess the compiled executables
03:34:37FromDiscord<dissolved.girl> Maybe `bin/`
03:34:46FromDiscord<dissolved.girl> If you've set it to compile there
03:37:36LuxuryModeLooks like it's going into `src/` which I hadn't even realized. I've just been running with `nim c -r --verbosity:0 src/main.nim`
04:04:57*azimut quit (Remote host closed the connection)
04:04:57*blop_ quit (Remote host closed the connection)
04:05:17*azimut joined #nim
04:08:09*blop_ joined #nim
04:18:40FromDiscord<dissolved.girl> you can set a nim.cfg option to compile into specific directories
04:20:59FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4I6P
04:30:55*gooba quit (Remote host closed the connection)
04:31:12*gooba joined #nim
04:59:48*rockcavera quit (Remote host closed the connection)
05:33:14FromDiscord<dissolved.girl> sent a code paste, see https://play.nim-lang.org/#ix=4I6U
05:33:25FromDiscord<dissolved.girl> I usually have it set to `bin/` per project.
05:43:12*advesperacit joined #nim
05:46:10FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4I6W
05:47:08FromDiscord<pmunch> That it has encountered a C type which it doesn't know how to map
05:47:21FromDiscord<pmunch> Which mostly just means I never encountered it
05:47:54FromDiscord<sOkam! 🫐> https://github.com/mackron/miniaudio basically this
05:52:11FromDiscord<sOkam! 🫐> @pmunch it seems to be finding -some- stuff, which wasnt before↵but it hits that error, and dunno how to continue↵do i need to wait until you patch it? https://media.discordapp.net/attachments/371759389889003532/1159005022512750662/image.png?ex=651e4f0a&is=651cfd8a&hm=a545d7328589b9acdcc79c2829dcbf5968f3ce1a0dde62f21bc3bb61695f1fc5&
05:53:46FromDiscord<sOkam! 🫐> this seems to be the type that fails to parse 🤔 https://media.discordapp.net/attachments/371759389889003532/1159005419176468480/image.png?ex=651e4f69&is=651cfde9&hm=ac767033eabc4550b05f619c9676b7729dfe1306addf382c50ad6009fd5449d3&
05:54:41FromDiscord<sOkam! 🫐> oh nvm, there are many with `invalid`... all of them coming from mmintrin.h
06:00:07FromDiscord<sOkam! 🫐> sent a code paste, see https://paste.rs/Ll4gY
06:03:09*cnx quit (Remote host closed the connection)
06:05:25*cnx joined #nim
06:16:22FromDiscord<pmunch> Yeah, you basically need me (or someone else, hint hint) to fix it
06:20:39*GreaseMonkey quit (Remote host closed the connection)
06:25:34*PMunch joined #nim
06:26:59FromDiscord<pmunch> Looked into it, and it's caused by `attribute((vector_size(8), aligned(8)));`. This makes the type into a vector, which I'm not entirely sure how to wrap..
06:28:05FromDiscord<pmunch> If anyone is more familiar with SIMD instructions then maybe you could shed some light?
06:30:39PMunchIt seems like maybe an opaque object is the way to go, judging my this: https://github.com/bsegovia/x86_simd.nim/blob/master/x86_sse.nim
06:38:29*LuxuryMode quit (Quit: Connection closed for inactivity)
07:13:12*junaid_ joined #nim
08:36:34*advesperacit_ joined #nim
08:36:36*advesperacit quit (Ping timeout: 272 seconds)
08:49:05*azimut quit (Ping timeout: 252 seconds)
08:58:11NimEventerNew thread by Cyb3rC3lt: AES Help Please, see https://forum.nim-lang.org/t/10527
09:10:22*advesperacit_ quit (Ping timeout: 255 seconds)
09:10:42*advesperacit joined #nim
09:29:55*PMunch_ joined #nim
09:32:18FromDiscord<pmunch> @sOkam! 🫐 do you have a minimal sample of the wrapper you try to create? I think I have fixed the bug
09:32:56*PMunch quit (Ping timeout: 255 seconds)
09:34:06*PMunch_ is now known as PMunch
10:07:51PMunchHmm, for some reason `top5[(pos + 1)..^1] = top5[pos..^2]` is slower than `for i in countdown(3, pos): top5[i + 1] = top5[i]`
11:02:22FromDiscord<.aingel.> Why can I not find the nim docs for `enum`
11:02:50FromDiscord<vindaar> https://nim-lang.github.io/Nim/manual.html#types-enumeration-types
11:03:13FromDiscord<.aingel.> In reply to @vindaar "https://nim-lang.github.io/Nim/manual.html#types-en": Thanks @vindaar
11:03:21FromDiscord<.aingel.> Any idea on how to make that searchable via enum
11:03:26FromDiscord<.aingel.> (edit) "Any idea on how to make that searchable via ... enum" added "the keyword"
11:03:40FromDiscord<.aingel.> If you search google nim enum you don't get that neither if you search "enum" in the docs page
11:03:47FromDiscord<.aingel.> There should be some sort of alias or something
11:04:12FromDiscord<Phil> I mean the manual in general is not searchable on the docs page
11:04:35FromDiscord<.aingel.> Oh I see
11:04:37FromDiscord<Phil> It's basically:↵For general concepts: Go to manual page, do CTRL + F↵To reference docs to specific procs: Go to the nim lib and enter whatever into the search field
11:04:53FromDiscord<.aingel.> Shouldn't that be changed somehow
11:04:57FromDiscord<Phil> (edit) "F↵To" => "F, type whatever and press F3 until you got what you want↵To"
11:05:17FromDiscord<Phil> I don't think so tbh, they are 2 completely separate kinds of documentation
11:05:31FromDiscord<Phil> The search is specifically reference documentation search, so you look for a specific proc name that you want to know more for
11:06:02FromDiscord<Phil> the equivalent of the nim manual would be in rust "the book"
11:06:29FromDiscord<Phil> And I'm actually not sure what equivalents other languages have as a general introduction-type lang spec thingy
11:08:53FromDiscord<Phil> The manual is sort of the super short equivalent of an "Introduction to java" book.↵You want a list of chapter overview so you can easily click through - which it has in the sidebar.↵↵Wanting an explainer on a proc is looking for reference documentation which you need search for because reference documentation by its nature is structure the way the code is structure and you can't be expected to search through 4000 different files.
11:09:27FromDiscord<Phil> The fact that the manual links to reference docs in the sidebar may be just giving off the wrong impression there
11:09:40FromDiscord<Phil> (edit) "links to" => "provides a search for the"
11:10:47FromDiscord<Phil> It would be rather unexpected behaviour in my eyes if I enterd something in a search for reference documentation in Rust or python and suddenly I got linked to a piece of text from their language specification
11:10:57FromDiscord<Phil> (edit) "enterd" => "entered"
11:13:05FromDiscord<Phil> I think it makes sense to develop a sense for: When are you looking for a language construct (enums are one for example) and when are you looking for the existence of specific consts/procs/templates/macros
11:13:09FromDiscord<.aingel.> But I mean the fact that there's no way to find out about the enum type from the docs is crazy
11:13:14FromDiscord<.aingel.> To me anyways
11:14:20FromDiscord<Phil> I don't know a single language where they mix between reference documentation of libs etc. and language specs
11:14:39FromDiscord<.aingel.> https://docs.python.org/3/library/enum.html
11:14:43FromDiscord<.aingel.> I just googled python enum
11:14:45FromDiscord<.aingel.> Boom first link
11:14:54FromDiscord<.aingel.> It's part of the python docs
11:15:00FromDiscord<.aingel.> I'm sure I can do that with a ton of languages
11:15:10FromDiscord<Phil> It's also not part of the core python language of itself, it's a library that builds an enum type.
11:15:17FromDiscord<Phil> (edit) "It's also not part of the core python language ... of" added "in and"
11:15:31FromDiscord<.aingel.> https://docs.python.org/3/tutorial/classes.html
11:15:35FromDiscord<.aingel.> Boom
11:15:37FromDiscord<Phil> It may be default shipped with python, sure, but that's like as if nim had an std/enum lib
11:16:11FromDiscord<.aingel.> classes are part of the core language in python
11:17:39FromDiscord<.aingel.> Even when i search enum in the manual search thing, which first of all has a weird imo search result thing
11:17:45FromDiscord<.aingel.> I don't get the enumeration type
11:17:56FromDiscord<.aingel.> Everyone knows this type as "enum" or would expect to type enum
11:18:39FromDiscord<Phil> That's also a tutorial that can not be searched via the quick search in the top↵I will hand you though that if you search in their for "enum", that 30th hit or so finally lands you on some reference documentation, meaning that in python the search also includes reference docs
11:18:41FromDiscord<Phil> As well as changelogs
11:18:57FromDiscord<_nenc> Nim's document is honestly not as good as some other projects. For example, it has a relatively poor searching feature (but better than no searching feature). That's fact.
11:18:57FromDiscord<Phil> (edit) "That's also a tutorial that can not be searched via the quick search in the top↵I will hand you though that if you search in their for "enum", that 30th hit or so finally lands you on some reference documentation, meaning that in python the search also includes ... reference" added "language"
11:19:29FromDiscord<Phil> I'm not even disputing that, I'm disputing that a search that (in my eyes) was always only meant as search for reference on libs should suddenly search for everyone and their mother
11:20:31FromDiscord<.aingel.> Why not just have some sort of unified search
11:20:50FromDiscord<.aingel.> First of all there should be some way to search "enum" and get the enumeration section
11:20:53FromDiscord<.aingel.> without control-f
11:20:54FromDiscord<Phil> Because now I'm looking for a proc and the first 20 hits are spam about lang specs I don't care about
11:21:09FromDiscord<.aingel.> Okay I'll just leave it there
11:21:20FromDiscord<Phil> Which for the most part means it'd require a filter ability
11:21:24FromDiscord<Phil> (edit) "Which for the most part ... means" added "just"
11:23:23FromDiscord<Phil> I guess I should also leave it there, that was just my opinion on how I view documentation and my personal preferences for keeping things that are (in my head) separate in separate boxes.↵Not that I have any say on the matter, I'd like to emphasise that was solely me stating my preferences.
11:23:30FromDiscord<Phil> (edit) "matter," => "matter in general,"
11:23:51FromDiscord<Phil> Pretty sure if it were implemented the PR would likely be accepted 🤷
11:24:38FromDiscord<vindaar> ^--- this. I don't like to throw in the "PRs welcome", but in many cases the fact of the matter is\: anyone around currently just hasn't needed it / felt motivated to work on improving the situation↵(@Phil)
11:25:10FromDiscord<.aingel.> Gotcha, I mean the question though if people don't want it a certain way there's no point of developing it
11:25:39FromDiscord<.aingel.> Like would a PR be welcome to add the word enum somehow next to enumeration
11:26:45FromDiscord<Phil> sent a long message, see http://ix.io/4I81
11:26:50FromDiscord<.aingel.> Just as an example
11:26:56FromDiscord<Phil> In reply to @.aingel. "Like would a PR": I think the approach would be more to add the individual headings of the manual section to the search
11:27:19FromDiscord<.aingel.> Thats a second problem too
11:27:34FromDiscord<.aingel.> More of a general problem, or more the primary problem
11:27:41FromDiscord<.aingel.> This is just a smaller one but yeah
11:28:17FromDiscord<Phil> "enum" would match "enumeration" of the heading and land it in the search results.↵So the task would be for the most part:↵1) Add the manual headings to the list of things that get searched↵2) Determine a small text excerpt that should be shown as a search hit in the search-result box
11:28:42FromDiscord<Phil> The mechanism for rendering that excerpt in the search box and performing searches etc. wouldn't even need to be touched I'm pretty sure
11:33:01FromDiscord<Phil> In reply to @.aingel. "More of a general": Yes-ish, this is just a behemoth of one you can't tackle in one go, you chip away at it
11:33:03FromDiscord<Phil> With small changes like this
11:36:20FromDiscord<Phil> "Enable the search to search more kinds of documentation"↵Then one can add the main manual, the experimental manual, the compiler flag docs etc. one by one and thus make them findable and solve that particular problem.↵↵Could even link up with the folks over in https://github.com/nim-lang/Nim/issues/22720 which I'm sure would be happy to provide support and/or feedback
11:36:32FromDiscord<Phil> (edit) ""Enable the search to search more kinds of documentation"↵Then one can add the main manual, the experimental manual, the compiler flag docs etc. one by one ... and" added "over time"
11:36:52FromDiscord<Phil> (edit) ""Enable the search to search more kinds of documentation"↵Then one can add the main manual, the experimental manual, the compiler flag docs etc. one by one over time and thus make them findable and solve that particular problem.↵↵Could even link up with the folks over in https://github.com/nim-lang/Nim/issues/22720 which I'm sure would be happy to provide support and/or feedback" => "sent a long message, see http://ix.io/4I83
11:39:18PMunchHmm, does `-d:danger` do anything more than `--boundChecks:off`?
11:39:33PMunchI was wondering if adding `-d:danger --boundChecks:on` would make sense.
11:39:55FromDiscord<Phil> I mean for reference, I for example don't feel motivated to tackle that search problem because I busy myself currently with owlkettle and contributing there
11:41:25FromDiscord<Phil> (edit) "there" => "there.↵That suits my current interest for my fairly limited time currently more, because "search" is a problem I've solved for myself."
11:46:14FromDiscord<.aingel.> In reply to @isofruit ""Enable the search to": Thanks for the github issue I'll look into that
11:52:35FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4I85
12:23:31FromDiscord<.aingel.> How do I early end an iterator?
12:30:29PMunchbreak?
12:31:24PMunchHmm, tried to use `withValue` instead of `hasKeyOrPut` to add to a sequence if it exists otherwise add a sequence with one element. Not sure why but it was slower..
12:31:36PMunchYou'd think it would be faster as it's only a single lookup
12:31:52*junaid_ quit (Remote host closed the connection)
12:43:57*rockcavera joined #nim
13:05:45*junaid_ joined #nim
13:08:58FromDiscord<Chronos [She/Her]> @sOkam! 🫐 when are you gonna do docs? :p
13:09:14FromDiscord<Chronos [She/Her]> If you need help with them, I'm able to help/guide you to setting them up
13:13:11*rockcavera quit (Remote host closed the connection)
13:33:27*rockcavera joined #nim
13:36:06*systemdsucks quit (Remote host closed the connection)
13:38:34FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4I8y
13:39:20FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "<@186489007247589376> when are you": i know 😔
13:39:42FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "If you need help": i haven't set them up because of figuring out github pages
13:40:12FromDiscord<sOkam! 🫐> i have a task to auto-generate the docs for mostly all my libs, I just haven't connected that to gh pages, so that's why
13:41:09*systemdsucks joined #nim
13:44:44FromDiscord<Chronos [She/Her]> In reply to @heysokam "i have a task": Ah, is the code already sorted out in a .sh script?
13:45:00FromDiscord<Chronos [She/Her]> Or anything executable by Linux?
13:45:26FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "Ah, is the code": sh 🤢 hell no, its a nimscript task
13:45:40FromDiscord<Chronos [She/Her]> If so, you probably have it even easier, the Setup-Nim action + a job to run that + uploading a dir to GH Actions
13:45:48FromDiscord<sOkam! 🫐> i don't want to rely on nim actions
13:45:51FromDiscord<Chronos [She/Her]> You can definitely stitch that together in less than a day
13:46:00FromDiscord<Chronos [She/Her]> Why not? You could also do Choosenim tbf
13:46:04FromDiscord<sOkam! 🫐> i have the tasks already, i just run a single command and they generate across all my projects
13:46:16FromDiscord<sOkam! 🫐> (edit) "nim" => "gh"
13:46:24FromDiscord<Chronos [She/Her]> The Nim action is for installing Nim
13:46:35FromDiscord<Chronos [She/Her]> You need to install Nim to run nimscript :p
13:47:03FromDiscord<sOkam! 🫐> yeah
13:47:12FromDiscord<sOkam! 🫐> but i have nimscript in my system, i don't need to install anything else
13:48:01FromDiscord<sOkam! 🫐> i just haven't figured out how to connect the pages to the gh hosting for them, the rest is setup already
13:49:11FromDiscord<Chronos [She/Her]> So you'd rather upload them manually?
13:51:25FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "So you'd rather upload": its not manually, its a script that does all of it↵the difference is who triggers the task, me or some big-corp-managed system
13:51:51*greaser|q joined #nim
13:52:20FromDiscord<sOkam! 🫐> but yeah, i just haven't figured out the website connection itself, the rest is all ready (afaik)
13:54:42FromDiscord<Chronos [She/Her]> Fair enough aha
13:54:54FromDiscord<Chronos [She/Her]> I've configured my task to just build the docs when I create a new tag for it aha
13:55:07FromDiscord<Chronos [She/Her]> Though, I have been tempted to move to a Forgejo instance....
13:57:10FromDiscord<Chronos [She/Her]> Oh, GitHub Pages let's you use `<username>.github.io` as a repo to deploy to Pages
13:57:18FromDiscord<Chronos [She/Her]> So you could upload the folders of your docs there
13:59:12PMunchsOkam, seems like it works. You can try Futhark HEAD now
14:01:44*junaid_ quit (Remote host closed the connection)
14:14:17*PMunch quit (Quit: Leaving)
14:28:32FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "So you could upload": yeah, i know. -that- is the part i haven't figured out
14:28:54FromDiscord<sOkam! 🫐> In reply to @PMunch "sOkam, seems like it": kk ty ✍️ will try
14:31:53FromDiscord<sOkam! 🫐> @pmunch how do i install #head from cli? nimble its ignoring the request and installing 0.9.3 instead 🤔
14:32:49FromDiscord<sOkam! 🫐> ah nvm, it already installed it from the nimble file
14:35:03FromDiscord<sOkam! 🫐> seems like it worked this time, ty pmunch 🙏 https://media.discordapp.net/attachments/371759389889003532/1159136606146543668/image.png?ex=651ec996&is=651d7816&hm=05404aa82fbb48643a9482af390ad95b465bc315283e0048f63096ce234b0490&
15:50:00*xet7 quit (Quit: Leaving)
16:07:55FromDiscord<my.narco> what does this even mean?? https://media.discordapp.net/attachments/371759389889003532/1159159979174019078/image.png?ex=651edf5b&is=651d8ddb&hm=2031ce92aa4b06fb49f3417aa35e9a66a8d6c9e82d964494fc1ffe3cb3b92e97&
16:08:23FromDiscord<my.narco> sent a code paste, see https://play.nim-lang.org/#ix=4I9f
16:08:38FromDiscord<my.narco> sent a code paste, see https://play.nim-lang.org/#ix=4I9g
16:09:27FromDiscord<Phil> Can you compile and copy paste the error the Compiler spits out?
16:10:38FromDiscord<my.narco> sent a code paste, see https://play.nim-lang.org/#ix=4I9i
16:10:47FromDiscord<my.narco> can i not use a pointer to a seq?
16:13:45FromDiscord<Phil> Nah note that the mismatch is position 3
16:14:03FromDiscord<Phil> You provide uint, the proc expects int
16:14:49FromDiscord<my.narco> got it, OH, IT SAYS THE POSITION ON THE LEFT
16:14:54FromDiscord<my.narco> I NEVER REALIZED THAT
16:15:21FromDiscord<Phil> Quite useful ,no? 😄
16:15:31FromDiscord<my.narco> YEAH
16:15:35FromDiscord<my.narco> im so dumb sorry
16:15:36FromDiscord<my.narco> lol
16:16:04FromDiscord<my.narco> is there a way you think i can convert multiple bytes to a single uint?
16:16:14FromDiscord<Phil> All good, the first lecture is compiler > nimsuggest (aka error from Nim plugin)
16:16:58FromDiscord<Phil> Erm, I'm sure you could convert 8 into one uint64 since those take 8 bytes
16:17:28FromDiscord<Phil> How is a question for folks that do low level memory stuff more often, which is basically everyone
16:18:22FromDiscord<my.narco> i just need to be able to convert like a u2(2 byte seq) into a uint(single number made of those 2 bytes)
16:18:36FromDiscord<Phil> You should be able to summon elegantbeef by chaining multiple operators from sequtils to one another and state it's neat and efficient code
16:19:15FromDiscord<my.narco> sent a code paste, see https://play.nim-lang.org/#ix=4I9m
16:19:36FromDiscord<Phil> Nah, chain operators line mapit or he'll smell the bait
16:19:44FromDiscord<Phil> (edit) "line" => "like"
16:20:43FromDiscord<my.narco> sent a code paste, see https://play.nim-lang.org/#ix=4I9n
16:21:15FromDiscord<Phil> Chain it my man, got to use it multiple times in a row to trigger it creating copies of the seq every time
16:22:52FromDiscord<my.narco> sent a code paste, see https://play.nim-lang.org/#ix=4I9p
16:25:00FromDiscord<Phil> Okay and now we wait... or find somebody else who knows low level memory operations.↵Honestly you might be able to just cast 2 bytes to a uint16 but I would double check that by contemplating what numbers a combo of 2 bytes in a uint16 should turn into
16:26:59FromDiscord<sOkam! 🫐> `byte` is an unsigned char, afaik. so yeah, that should work
16:27:52FromDiscord<my.narco> sent a code paste, see https://play.nim-lang.org/#ix=4I9s
16:28:22FromDiscord<sOkam! 🫐> In reply to @my.narco "so something like this?": does your `readData` function expect a `ptr seq` or a `ptr byte`?
16:28:30FromDiscord<sOkam! 🫐> because if its not a seq, that will be very wrong
16:28:48FromDiscord<Chronos [She/Her]> In reply to @heysokam "yeah, i know. -that-": Fair aha
16:29:01FromDiscord<sOkam! 🫐> also, if its not an external function, just do `var seq[byte]` in the function.... don't pass a ptr
16:29:13FromDiscord<my.narco> In reply to @heysokam "does your `readData` function": that isnt my readData function
16:29:19FromDiscord<my.narco> stream is a FileStream
16:29:22FromDiscord<sOkam! 🫐> (edit) "`var" => "`arg :var"
16:29:29FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4I9t
16:29:45FromDiscord<Phil> Wait, fuck, I likely just cast the pointer to a uint and not the bytes
16:30:04FromDiscord<Phil> Yeah no, no idea how else to do that
16:30:18FromDiscord<sOkam! 🫐> yeah, you need to do `x[0]` in the cast
16:30:23FromDiscord<Chronos [She/Her]> https://github.com/Yu-Vitaqua-fer-Chronos/yu-vitaqua-fer-chronos.github.io/tree/master sokam here
16:30:27FromDiscord<sOkam! 🫐> otherwise you include the len/cap in it
16:30:29FromDiscord<Chronos [She/Her]> That's my repo
16:30:36FromDiscord<Phil> In reply to @heysokam "yeah, you need to": But I wanna combine the two bytes into a single uint
16:30:48FromDiscord<Phil> That's why the uint16
16:30:51FromDiscord<sOkam! 🫐> ah true, fudge nvm
16:31:08FromDiscord<sOkam! 🫐> well the seq is definitely in the way a bit
16:31:20FromDiscord<my.narco> In reply to @heysokam "also, if its not": this is what readData does https://media.discordapp.net/attachments/371759389889003532/1159165870040424448/image.png?ex=651ee4d7&is=651d9357&hm=21980821cda0a3ba8dd0e24e6950484e0db1ba55781384f3c1f419cef85b61c0&
16:31:31FromDiscord<Chronos [She/Her]> https://pages.github.com/ this too
16:31:41FromDiscord<Phil> With an array it behaves as expected
16:31:47FromDiscord<sOkam! 🫐> In reply to @my.narco "this is what readData": then that thing you are passing is very wrong, and you want `buffer[0].addr` instead
16:32:03FromDiscord<sOkam! 🫐> otherwise you are writing over the len/cap of the seq
16:33:10FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4I9v
16:34:08FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4I9w
16:34:33FromDiscord<sOkam! 🫐> so if you cast... you are basically casting the first two bytes of the len, not the data contents
16:35:37FromDiscord<Phil> In reply to @my.narco "i just need to": In that case, just create an array from your 2 byte seq and cast that to a uint16, bam, done
16:36:14FromDiscord<my.narco> how do you create an array from a seq? is there a ``toArray`` function?
16:36:17FromDiscord<sOkam! 🫐> I honestly would never use a seq to store a bytebuffer
16:36:26FromDiscord<Phil> In reply to @my.narco "how do you create": That or the long and arduous manual way
16:36:42FromDiscord<sOkam! 🫐> stringbuffer to store bytebuffers are a lot more usable, specially considering `treeform/binny` exists
16:36:46FromDiscord<Phil> Or rather there is definitely no toArray because toArray requires you to know the length at compiletime
16:37:00FromDiscord<my.narco> alright got it
16:37:27FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4I9x
16:37:35FromDiscord<my.narco> yeah i understnad
16:37:40FromDiscord<Phil> 👍
16:37:43FromDiscord<sOkam! 🫐> oh you can `,` inside cast? thats news didn't know
16:37:49FromDiscord<sOkam! 🫐> great and handy
16:38:03FromDiscord<Phil> In reply to @heysokam "oh you can `,`": I mean, it's not inside cast, it's inside the `[]` which create an array
16:38:16FromDiscord<sOkam! 🫐> oh wait, im blind as usual 🙈
16:38:30FromDiscord<Phil> Got too many of them blueberries
16:38:34FromDiscord<sOkam! 🫐> for sure
16:39:55FromDiscord<sOkam! 🫐> but yeah, @my.narco, consider using strings for bytebuffer stuff↵treeform/binny is great, and stringstreams are a thing, no need to void stuff in nim↵plus, in-memory strings are faster than streams by a lot, unless you are given the stream without a choice you will almost always be faster with a string and not a stream
16:40:27FromDiscord<my.narco> In reply to @heysokam "but yeah, <@811230507408031774>, consider": i will take that into account, thank you
16:42:38FromDiscord<vindaar> In reply to @heysokam "I honestly would never": well, a string is functionally identical to a `seq[byte]` (even the implementation is essentially identical). And on a byte buffer most string operations do not make any sense, so ideally you have a separate type completely for that reason
16:42:41*xet7 joined #nim
16:43:19FromDiscord<vindaar> (I assume it's more for historical reasons and compiler logic that `system.nim` doesn't just say `string = distinct seq[byte]`)
17:07:26FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4I9H
17:08:48FromDiscord<Chronos [She/Her]> https://play.nim-lang.org/#ix=4I9I
17:09:02FromDiscord<Chronos [She/Her]> Lets you pass in a seq, but obviously it just does what Phil did
17:09:05FromDiscord<Chronos [She/Her]> But manually-
17:09:17FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4I9J
17:09:28FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4I9J" => "https://play.nim-lang.org/#ix=4I9K"
17:09:37FromDiscord<Chronos [She/Her]> Also has a util for endianness-
17:09:44FromDiscord<Chronos [She/Her]> For BE
17:10:08FromDiscord<Phil> In reply to @chronos.vitaqua "https://play.nim-lang.org/#ix=4I9I": Oh neat!
17:10:47FromDiscord<Chronos [She/Her]> Yeah, I originally used it in my ID format for my app before just deciding to implement the ULID spec
17:26:36*nils` quit (Ping timeout: 248 seconds)
17:26:53FromDiscord<my.narco> sent a code paste, see https://play.nim-lang.org/#ix=4I9S
17:28:32FromDiscord<_gumbercules> no
17:28:41FromDiscord<_gumbercules> they're not variables either btw
17:28:45FromDiscord<_gumbercules> they are field names
17:28:47FromDiscord<Phil> In reply to @my.narco "can i have multiple": You mean have a field apply to 2 out of N kinds of object variants?↵no.
17:28:54FromDiscord<Phil> Dangit, gumb was faster
17:29:15FromDiscord<_gumbercules> 🫳 🔫
17:29:19FromDiscord<_gumbercules> quickest hands in the west
17:29:21FromDiscord<_gumbercules> or something
17:29:25FromDiscord<my.narco> In reply to @_gumbercules "they're not variables either": yeah may bad, im stupid at naming
17:29:31FromDiscord<my.narco> alright thats unfortunate, thanks though
17:29:33FromDiscord<_gumbercules> no worries
17:29:56FromDiscord<_gumbercules> and you're not stupid 😉
17:30:33FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4I9V
17:30:57FromDiscord<Phil> (Assume gdouble is just a flipping double, I have no idea why in GTK that stuff all is prefixed with g)
17:32:01FromDiscord<_gumbercules> yeah it's most likely a pointer to a 64-bit floating point number
17:32:13FromDiscord<_gumbercules> assuming that's what `gdouble` is
17:32:26FromDiscord<_gumbercules> but I mean - in C arrays are pointers
17:32:43FromDiscord<_gumbercules> so it could also be a pointer to an array of float64s
17:32:46FromDiscord<Phil> This should be a single float
17:33:16FromDiscord<_gumbercules> gotcha - yeah context matters in C but this is generally how you handle stuff like `var` parameters in Nim
17:33:20FromDiscord<Phil> The fact that I have to prefix so much with "should" when it comes to C is scary
17:33:46FromDiscord<_gumbercules> the caller has to pass a pointer if they want it to be mutated by the function they are calling
17:34:06FromDiscord<_gumbercules> C is that whole - ultimate power comes ultimate responsibilty, much like asm
17:34:16FromDiscord<_gumbercules> if you know what you're doing, C is the most amazing programming language ever
17:34:27FromDiscord<_gumbercules> and even then it will still surprise you
17:35:03FromDiscord<Chronos [She/Her]> I wonder if there's anything that would be useful but simple for Nim that I could implement
17:35:07FromDiscord<_gumbercules> but there are also many reasons why it's not the greatest language if you want to be productive or not have to worry about every detail all of the time
17:35:46FromDiscord<Phil> I mean, right now I'm just waging war against adwaita widgets
17:35:58FromDiscord<Chronos [She/Her]> That does not sound simple
17:36:04FromDiscord<_gumbercules> In reply to @chronos.vitaqua "I wonder if there's": simple or easy?
17:36:10FromDiscord<Chronos [She/Her]> Either
17:36:15FromDiscord<Chronos [She/Her]> Idk the difference
17:36:31FromDiscord<_gumbercules> knowing the difference is important
17:36:42FromDiscord<Chronos [She/Her]> What is the difference?
17:36:58FromDiscord<Chronos [She/Her]> To me easy means it could be big and complex but the logic is easy to comprehend
17:37:08FromDiscord<_gumbercules> For that
17:37:12FromDiscord<_gumbercules> I recommend you watch https://www.youtube.com/watch?v=SxdOUGdseq4
17:37:18FromDiscord<Chronos [She/Her]> Simple means that in hindsight it was also easy but accurately working on it may be complex
17:37:25FromDiscord<_gumbercules> it's a pretty legendary talk
17:37:48FromDiscord<demotomohiro> I think if your first programming language was assembly language, C lang would looks like a nice high level language.
17:38:48FromDiscord<_gumbercules> in reality it is, but most programmers don't even have to worry about C/C++ in their daily lives these days so to most it might as well be assembly
17:39:20FromDiscord<_gumbercules> people scoff at C being. a high level language but they are simply ignorant
17:39:35FromDiscord<_gumbercules> (edit) "being." => "being"
17:41:11FromDiscord<Chronos [She/Her]> In reply to @_gumbercules "it's a pretty legendary": I am not able to focus on videos at all aha
17:41:15*azimut joined #nim
17:41:50FromDiscord<_gumbercules> In reply to @chronos.vitaqua "I am not able": https://media.discordapp.net/attachments/371759389889003532/1159183608578330624/Screenshot_2023-10-04_at_12.41.33_PM.png?ex=651ef55c&is=651da3dc&hm=989b80b342f51002c971f1b70f167cd06992f2267e320129ca84f4abc53d17c6&
17:42:21FromDiscord<_gumbercules> https://media.discordapp.net/attachments/371759389889003532/1159183740313018539/Screenshot_2023-10-04_at_12.41.33_PM.png?ex=651ef57c&is=651da3fc&hm=e8df3462f03ff730934fab17c5895673b91cadf7dc04ccd0e0e428da757e5260&
17:42:30FromDiscord<_gumbercules> whoops
17:42:51FromDiscord<_gumbercules> https://media.discordapp.net/attachments/371759389889003532/1159183866620280882/Screenshot_2023-10-04_at_12.41.57_PM.png?ex=651ef59a&is=651da41a&hm=0f7e6ec2cd232ab3bb9a1319843cc61e895916c638c308b73b4b55f8b88d3bb1&
17:43:05FromDiscord<Chronos [She/Her]> That makes sense
17:43:14FromDiscord<Chronos [She/Her]> Then ig I'm fine with simple or easy
17:43:20FromDiscord<Chronos [She/Her]> I don't mind either
17:46:02FromDiscord<_gumbercules> the ideal is probably both combined haha - but that tends to be low-hanging fruit
17:46:26FromDiscord<_gumbercules> my advice would be to pick something that is of interest to you that would benefit others working in that same area
17:46:47FromDiscord<_gumbercules> so if you want to work on something gamedev related for instance - maybe port some popular library from C to Nim
17:47:53FromDiscord<_gumbercules> or talk to others and see what they're working on to see if there's any room for collaboration - lord knows that there are probably at least 10 Nim game engines / frameworks / libraries in development at any given time
17:49:37FromDiscord<_gumbercules> one project idea that would probably be super popular is porting https://github.com/fungos/cr to Nim
17:51:01*rockcavera quit (Ping timeout: 260 seconds)
17:52:50FromDiscord<wick3dr0se> Is it possible to modify existing headers to httpclient? Tried calling newHttpHeaders() and setting again but seems to not work. Is it necessary to call a new client?
17:57:14FromDiscord<_gumbercules> you could also create bindings to https://github.com/r-lyeh/FWK - then Nim has another 3d game engine at its disposal. That would also probably be pretty simple to do.
17:59:20FromDiscord<_gumbercules> In reply to @wick3dr0se "Is it possible to": why not call `request` and supply them?
17:59:24FromDiscord<Phil> How did you check if a proc exists in the compilation context again?
17:59:33FromDiscord<Phil> I want to do "if this proc is present do X, else do Y"
17:59:33FromDiscord<_gumbercules> `when defined(x)`
17:59:49FromDiscord<wick3dr0se> In reply to @_gumbercules "why not call `request`": Well I'm not sure how. I haven't ever seen or tried something like that
17:59:52FromDiscord<_gumbercules> or `when compiles`
18:00:02FromDiscord<sOkam! 🫐> In reply to @isofruit "How did you check": `if compiles: ...`?
18:00:33FromDiscord<_gumbercules> In reply to @wick3dr0se "Well I'm not sure": https://nim-lang.org/docs/httpclient.html#request%2CAsyncHttpClient%2C%2Cstring%2CHttpHeaders%2CMultipartData
18:00:47FromDiscord<wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4Ia7
18:01:05FromDiscord<wick3dr0se> I call it and resupply to that but yea no luck
18:02:05FromDiscord<wick3dr0se> Ahhh so I can pass directly to request. Thanks
18:02:25FromDiscord<wick3dr0se> I'm always overcomplicating everything..
18:02:31FromDiscord<wick3dr0se> Just gotta read more
18:02:33FromDiscord<_gumbercules> Nope
18:02:43FromDiscord<_gumbercules> It's just there are a myriad of ways to do things
18:02:54FromDiscord<_gumbercules> What you were trying to do is pretty sensible - I cannot explain why it doesn't work
18:02:56FromDiscord<wick3dr0se> One would think my method would work tho
18:03:02FromDiscord<wick3dr0se> Weird...
18:03:09FromDiscord<_gumbercules> Nim is full of oddities
18:03:12FromDiscord<_gumbercules> and inconsistencies
18:03:18FromDiscord<wick3dr0se> Beautiful language tho
18:03:24*rockcavera joined #nim
18:03:24*rockcavera quit (Changing host)
18:03:24*rockcavera joined #nim
18:03:37FromDiscord<wick3dr0se> I enjoy the challenge over others not implementing the same thing. At least with functional examples
18:04:16FromDiscord<wick3dr0se> Most examples I've seen writting in Nim could be rewritten a couple times
18:04:39FromDiscord<_gumbercules> yeah - writing idiomatic Nim or really idiomatic code in any language doesn't happen overnight
18:05:11FromDiscord<_gumbercules> I've been writing Nim since 2015 and still learn new things
18:05:28FromDiscord<_gumbercules> I also forget a lot of things - so that never helps but 🤷
18:08:37FromDiscord<_gumbercules> In reply to @heysokam "`if compiles: ...`?": `when` is checked at compile time and `if` at runtime I believe - that would be the only difference
18:10:23FromDiscord<wick3dr0se> I've been back and forth with it for like a year but quickly kept giving up.Being persistent these last few weeks with it and learning a lot
18:10:29FromDiscord<wick3dr0se> I'm trying to escape bash
18:10:31FromDiscord<_gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4Iad
18:10:47FromDiscord<wick3dr0se> Wrote a bunch of shit lately tho
18:10:52FromDiscord<_gumbercules> well Nim is a good escape route for bash - that and python
18:11:02FromDiscord<wick3dr0se> Started an IRC server, API, Discord bot and more
18:11:04FromDiscord<_gumbercules> I love bash though - such a quirky language
18:11:06FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4Iac
18:11:21FromDiscord<wick3dr0se> Yea Python is not as awesome as Nim tho
18:11:27FromDiscord<_gumbercules> In reply to @vindaar "not just that. `when`": good call out!
18:12:30FromDiscord<_gumbercules> In reply to @wick3dr0se "Yea Python is not": Yeah - I worked with Python for a while but was never a huge fan. I get the appeal but it was never a language that I was seriously considering for the kinds of programs I wanted to write, and then working with it professionally just turned me off more.
18:12:49FromDiscord<wick3dr0se> Can't I just append headers too? I thought in the past I've used like client.headers.add("string") but apparently not
18:13:10FromDiscord<wick3dr0se> Everyone does everything the same in Python
18:13:17FromDiscord<wick3dr0se> Thats my turnaway lol
18:13:55FromDiscord<_gumbercules> In reply to @wick3dr0se "Can't I just append": I'm going to get to the bottom of this now, one moment....
18:14:43FromDiscord<wick3dr0se> Well thank you! Idk why I'm struggling with some headers. Just decided I'll just set the auth and append content-type after if I can
18:14:58FromDiscord<wick3dr0se> Before I was trying to re-set the entire headers object
18:15:22FromDiscord<wick3dr0se> I see that works with `request` now
18:17:44FromDiscord<_gumbercules> okay - so I imagine before calling `request` you were calling whatever proc corresponds to the verb of the request you wanted to make, like `post` for instance?
18:18:34FromDiscord<wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4Iag
18:18:35FromDiscord<wick3dr0se> Setting them like this initially now
18:18:42FromDiscord<wick3dr0se> Before I included the content-type
18:18:56FromDiscord<wick3dr0se> Then I had t hat proc I was trying to modify them with
18:19:07FromDiscord<_gumbercules> I just looked at `httpclient.nim` and none of the procedures for the various HTTP request verbs pass the client headers to `request`
18:19:35FromDiscord<_gumbercules> so if you were calling like `client.post` or `post(client` or something like that - whatever headers are assigned to `client` aren't being passed to `post`
18:19:43NimEventerNew thread by bsljth: How ready is Nim (and the ecosystem) for front-end web development?, see https://forum.nim-lang.org/t/10528
18:19:49FromDiscord<_gumbercules> `post` in turn calls `request`
18:19:53FromDiscord<wick3dr0se> I'm using `request` only
18:20:28FromDiscord<wick3dr0se> I'll just overwrite them entirely within the request for now
18:20:33FromDiscord<_gumbercules> ah okay
18:20:36FromDiscord<wick3dr0se> Nothing wrong with cleaning it up later
18:20:54FromDiscord<wick3dr0se> I put too much shit off trying to optimize it
18:21:06FromDiscord<_gumbercules> yeah - it seems that whatever `headers` are associated with the `httpclient` aren't necessarilly going to be used when the actual http request is made
18:21:20FromDiscord<_gumbercules> which is definitely counter-intuitive
18:21:20FromDiscord<wick3dr0se> Thats odd
18:21:29FromDiscord<_gumbercules> and is probably a bug / poor implementation
18:21:48FromDiscord<wick3dr0se> Yea it makes no logical sense at all but I am still learning a lot
18:21:53FromDiscord<wick3dr0se> Thanks for all your help
18:22:01FromDiscord<_gumbercules> anytime!
18:27:45FromDiscord<sOkam! 🫐> is it possible to make the components of a seq, not the seq itself, to be `{.alignas(16).}`?
18:33:52FromDiscord<_gumbercules> tmk that pragma can only be applied to variables - not types
18:34:42FromDiscord<sOkam! 🫐> it also works on object fields
18:34:52FromDiscord<sOkam! 🫐> but seq is not an object I can modify, or is it?
18:37:19FromDiscord<_gumbercules> no but you could always define your own custom sequence and then write a converter that casts it to a sequence - whether this is a good idea or not is another question entirely haha
18:37:46FromDiscord<_gumbercules> but yeah - then theoretically you could specify the alignment requirement for the `data` field in the custom sequence
18:39:24FromDiscord<sOkam! 🫐> sounds awful, ngl
18:39:45FromDiscord<_gumbercules> `codegenDecl` might be your friend here as well
18:39:54FromDiscord<sOkam! 🫐> i would rather `distinct` a vector with 4 components and remove access to the fourth
18:40:10FromDiscord<sOkam! 🫐> In reply to @_gumbercules "`codegenDecl` might be your": in what way?
18:41:21FromDiscord<_gumbercules> mmm let me see if I can create an example on the playground
18:45:22FromDiscord<_gumbercules> In reply to @heysokam "in what way?": something like this: https://play.nim-lang.org/#ix=4Ial
18:46:05FromDiscord<_gumbercules> the example is contrived but hopefully gets the idea across
19:39:25FromDiscord<sOkam! 🫐> In reply to @_gumbercules "something like this: https://play.nim-lang.org/#ix=": what's the benefit of this at all, compared to just `{.align(16).}` on the fields?
19:43:42FromDiscord<_gumbercules> In reply to @heysokam "what's the benefit of": well - I don't think there is much but in this case you could use this custom type in a `seq` and you would know that it is aligned
19:44:11FromDiscord<_gumbercules> it's just a way to add a C compiler hint for alignment on a type - which we can't do in Nim
20:03:47*jmdaemon joined #nim
20:13:25FromDiscord<sOkam! 🫐> i see. yeah the nim approach seems a lot better
20:18:02FromDiscord<Chronos [She/Her]> What if Nim stdlib but made with Rust /j
20:21:13FromDiscord<_gumbercules> haha another project idea - a stdlib for Nim that doesn't require the GC
20:21:51FromDiscord<_gumbercules> bonus points if you design it so that every procedure that performs an allocation accepts an allocator as an argument
20:22:27FromDiscord<raynei486> Zig vibes
20:22:53FromDiscord<_gumbercules> C vibes 😛
20:26:35FromDiscord<Chronos [She/Her]> In reply to @_gumbercules "bonus points if you": How would you make it accept an allocator hmmm
20:26:42FromDiscord<Chronos [She/Her]> Would it have to have a vtable or something?
20:27:32FromDiscord<Chronos [She/Her]> Also for stdlib stuff like tables, should you be able to change the allocator at any time during the object's lifespan?
20:27:37FromDiscord<Chronos [She/Her]> Or only during creation?
20:27:57FromDiscord<Chronos [She/Her]> It would be an interesting challenge to take on considering I do not touch that stuff normally
20:27:59FromDiscord<_gumbercules> well your custom stdlib's table I imagine would hold a reference to the allocator it was allocated with
20:28:11FromDiscord<_gumbercules> if your writing your own stdlib your writing your own table implementation 🙂
20:28:18FromDiscord<Chronos [She/Her]> It would but should you be able to change it?
20:28:24FromDiscord<Chronos [She/Her]> In reply to @_gumbercules "if your writing your": Yep I'm aware
20:28:31*advesperacit quit ()
20:28:42FromDiscord<_gumbercules> no you wouldn't be able to change it - I think that field would be unexported
20:28:56FromDiscord<_gumbercules> you'd provide the allocator when you call `newTable` or whatever
20:29:11FromDiscord<raynei486> Just like... Zig.. 😛
20:29:15FromDiscord<Chronos [She/Her]> Also assuming you can pass an allocator as an argument but also have it be optional too and have a default allocator? (Such as Nim's allocator or malloc)
20:29:18FromDiscord<raynei486> Cool project idea tho
20:29:18FromDiscord<Chronos [She/Her]> Never used Zig so
20:29:19FromDiscord<_gumbercules> yeah but I mean Zig didn't popularize this
20:29:20FromDiscord<raynei486> who's gonna pick it up
20:29:22FromDiscord<_gumbercules> C did
20:29:32FromDiscord<_gumbercules> anyone who wants to be able to define their own allocators and use them with Nim
20:29:36FromDiscord<Chronos [She/Her]> I'm thinking of trying it on a small scale lol
20:29:42FromDiscord<raynei486> In reply to @_gumbercules "C did": Maybe I haven't read enough embedded code to know
20:29:46FromDiscord<_gumbercules> currently you can patch the stdlib and replace the allocator but you have to use that one allocator for all alocations
20:30:14FromDiscord<Chronos [She/Her]> Does system.nim rely on the GC specifically?
20:30:14FromDiscord<_gumbercules> you could have a `threadvar` and use locks etc and then keep track of the current allocator or something like that to support multiple allocators with Nim and the current stdlib
20:30:18FromDiscord<_gumbercules> but it'd probably be pretty ugly
20:30:31FromDiscord<_gumbercules> In reply to @chronos.vitaqua "Does system.nim rely on": I don't think so
20:30:37FromDiscord<Chronos [She/Her]> Also I wonder... would arc + destructors be useful here?
20:30:58FromDiscord<Chronos [She/Her]> In reply to @_gumbercules "I don't think so": I guess I'd still need to modify it to allow for custom allocators for types (such as strings) tho
20:30:59FromDiscord<_gumbercules> no - this would all be manual memory management
20:31:05FromDiscord<Chronos [She/Her]> Ah
20:31:18FromDiscord<Chronos [She/Her]> So with `free` methods for everything then?
20:31:32FromDiscord<Chronos [She/Her]> Procs
20:31:44FromDiscord<_gumbercules> well just one `free` proc most likely
20:31:50FromDiscord<_gumbercules> that allocator would implement
20:32:10FromDiscord<_gumbercules> allocator would probably expose an interface like - `alloc`, `alignedAlloc`, `realloc` and `free`
20:32:29FromDiscord<_gumbercules> and anywhere you need to do one of those things - you would pass along an allocator
20:33:01FromDiscord<_gumbercules> or could store a reference to the allocator in an object and then have a generic `free` that invokes that allocator's `free`
20:33:19*Jjp137 quit (Quit: Leaving)
20:33:26FromDiscord<_gumbercules> https://github.com/niklas-ourmachinery/bitsquid-foundation/blob/master/memory.h
20:33:27FromDiscord<_gumbercules> something like this
20:33:28FromDiscord<Chronos [She/Her]> Interesting...
20:33:57FromDiscord<_gumbercules> as @raynei486 pointed out - this would be similar to what Zig and Odin offer
20:34:25*Jjp137 joined #nim
20:34:30FromDiscord<_gumbercules> and I mean - people do this today (use Nim without the GC - so no ARC/ORC) but they have to bring their own stdlib
20:35:39FromDiscord<_gumbercules> having a standardized one or at least an off-the-shelf one would be neat
20:36:10FromDiscord<_gumbercules> people that do embedded stuff / care deeply about performance would probably be thrilled to have one
20:36:34FromDiscord<raynei486> I guess something like ETL that's available for C++
20:36:41FromDiscord<raynei486> (edit) removed "that's available"
20:36:50FromDiscord<Chronos [She/Her]> I don't have anything where I could apply this personally tbh
20:36:51FromDiscord<raynei486> No dynamic memory allocation is pretty exciting
20:37:45FromDiscord<_gumbercules> In reply to @chronos.vitaqua "I don't have anything": Unless you're working on near-realtime software or embedded software on extremely resource constrained devices, you're not likely to
20:38:08FromDiscord<_gumbercules> Games and game engines could be an application but not really unless you need to squeeze a lot of performance out
20:38:36FromDiscord<Chronos [She/Her]> Yeaaah
20:38:52FromDiscord<Chronos [She/Her]> I'll consider taking it on but I likely won't-
20:39:29FromDiscord<Chronos [She/Her]> An stdlib for Nim written in Rust /j
20:40:09FromDiscord<.aingel.> Wha
20:40:11FromDiscord<.aingel.> Haha
20:40:24FromDiscord<sOkam! 🫐> In reply to @_gumbercules "haha another project idea": misery
20:40:48FromDiscord<_gumbercules> Meh, managing memory manually isn't THAT bad
20:40:57FromDiscord<sOkam! 🫐> mm:none is not maintained, it has so many footguns because of the lang not supporting it at all
20:41:02FromDiscord<_gumbercules> and it can have advantages
20:41:22FromDiscord<sOkam! 🫐> i had a massive list of config options just to not crash the compiler, when those should have been disabled by default
20:41:49FromDiscord<_gumbercules> well yeah, that makes some sense - you're not really supposed to use it with the stdlib and I imagine certain compiler features rely on the stdlib
20:42:05FromDiscord<sOkam! 🫐> In reply to @_gumbercules "Meh, managing memory manually": yeah i know. i love it↵but a simple source-to-source compiler that takes nim and outputs C is like 100000mil times better than the mm:none idea
20:42:33FromDiscord<sOkam! 🫐> i tried it for months, and it just becomes navigating the footguns, more than actual working with the lang
20:42:39FromDiscord<sOkam! 🫐> its working against the tool, not with it
20:42:40FromDiscord<_gumbercules> doesn't gc:none still output C?
20:42:47FromDiscord<raynei486> In reply to @heysokam "mm:none is not maintained,": We need to start training a group of elite compiler engineers to tame those pesky bugs using guerrilla warfare in the compiler 😛
20:42:49FromDiscord<_gumbercules> or mm:none?
20:43:13FromDiscord<_gumbercules> tmk all gc:none / mm:none does is warn you when you make an allocation
20:43:20FromDiscord<sOkam! 🫐> In reply to @_gumbercules "doesn't gc:none still output": but there are a LOT of features that are literally not docummented, or not supported, or just outright bugged, when using mm:none
20:43:38FromDiscord<_gumbercules> well yeah - I mean essentially anything that uses the heap is not going to work with gc/mm:none
20:43:48FromDiscord<_gumbercules> so strings, sequences, tables, sets, etc...
20:43:57FromDiscord<sOkam! 🫐> yeah, and all those things -should- be disabled by default when using mm:none
20:44:06FromDiscord<sOkam! 🫐> like... why the hell would you allow to use unusable features?
20:44:12FromDiscord<Chronos [She/Her]> In reply to @heysokam "i tried it for": So an stdlib impl that lets you supply an allocator to it and free stuff manually would be a lot better?
20:44:14FromDiscord<_gumbercules> oh okay I see what you mean - yeah I mean possibly
20:44:20FromDiscord<sOkam! 🫐> which signals that basically mm:none is not maintained at all
20:44:24FromDiscord<_gumbercules> but for people who have no other option - there really is no other option
20:44:33FromDiscord<_gumbercules> well I think the rationale behind -mm:none is
20:44:34FromDiscord<Chronos [She/Her]> And just doesn't rely on typical stdlib stuff when possible
20:44:51FromDiscord<_gumbercules> if you're not going to use the GC you're already treading in territory that the majority of the Nim userbase is not - so you're basically on your own
20:44:51FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "So an stdlib impl": errr, i guess so yeah
20:44:53FromDiscord<Chronos [She/Her]> In reply to @_gumbercules "but for people who": Sokam is making something for Nim to C source to source translation
20:45:02FromDiscord<Chronos [She/Her]> In reply to @heysokam "errr, i guess so": It was what we were talking about earlier aha
20:45:03FromDiscord<_gumbercules> but there are folks who have no other choice - like the GC is a non-starter for them and they still want to use Nim
20:45:04FromDiscord<sOkam! 🫐> but how are you going to not use the stdlib, but still implement that?
20:45:24FromDiscord<Chronos [She/Her]> By designing it around `--mm:none` to begin with
20:45:32FromDiscord<sOkam! 🫐> errr i was saying that i did that
20:45:38FromDiscord<sOkam! 🫐> spend a few months there in mm:none land
20:45:45FromDiscord<Chronos [She/Her]> You disabled certain flags and such, right?
20:45:46FromDiscord<sOkam! 🫐> and its just footgun after footgun
20:45:57FromDiscord<sOkam! 🫐> yes, but all those -should- be defaults
20:46:02FromDiscord<Chronos [She/Her]> But I mean to completely rewrite it to not rely on any memory management except for manual stuff
20:46:11FromDiscord<sOkam! 🫐> which means that a good effort on PRs would need to be sent to the compiler itself
20:46:25FromDiscord<Chronos [She/Her]> In reply to @heysokam "yes, but all those": Can talk to Araq about it in #internals tbf
20:46:27FromDiscord<sOkam! 🫐> which means that mm:none support would be desired by the devs, which I have my doubts on
20:46:31FromDiscord<_gumbercules> essentially what is being pointed out I think - is that if @Chronos [She/Her] or someone else were to embark on this project, they'd be fixing all those broken `mm:none` things your'e alluding to @sOkam! 🫐
20:46:32FromDiscord<sOkam! 🫐> (edit) "on" => "about"
20:46:58FromDiscord<_gumbercules> because then there would be a non-managed string and sequence and table, etc...
20:47:07FromDiscord<sOkam! 🫐> In reply to @_gumbercules "essentially what is being": yeah i understand. my point is just that it needs to happen from the lang, not from just implementing an alternative stdlib
20:47:16FromDiscord<sOkam! 🫐> and the changes are deep
20:47:29FromDiscord<Chronos [She/Her]> But majority of those issues come from Nim expecting a GC, no?
20:47:32FromDiscord<_gumbercules> sure - but it could always be a project that someone builds that patches the compiler
20:47:33FromDiscord<sOkam! 🫐> i have a ton of mm:none code, where I was trying exactly that
20:47:36FromDiscord<_gumbercules> similar to how the mimalloc project works
20:47:39FromDiscord<Chronos [She/Her]> Ah
20:47:59FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "But majority of those": it comes from nim not having support for it, basically, and nobody thought those things should just be disabled
20:48:10FromDiscord<sOkam! 🫐> because they leak everywhere like crazy
20:48:47FromDiscord<Chronos [She/Her]> I'm probably just not understanding it then considering I've never had a need for manual allocation and stuff then rip
20:48:51FromDiscord<sOkam! 🫐> In reply to @_gumbercules "sure - but it": yeah thats a better approach. hopefully by making it a set of PRs and not a fork
20:49:25FromDiscord<_gumbercules> Yeah - I don't even think there's much of an appetite for this thing outside of a very small niche of Nim users and even they probably have already worked out their own solutions if they needed them
20:49:53FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "I'm probably just not": i even started a tutorial about it, i was really committted to mm:none. but its just painful to deal with, and the benefit is so little, that the moment I found the source-to-source idea then the project just made no sense to me personally
20:50:27FromDiscord<Chronos [She/Her]> Yeah fair rip
20:51:25FromDiscord<sOkam! 🫐> a source to source compiler, that uses the great features of nim, but outputs human-readable C, is a lot more in line with the task, since writing for mm:none feels literally like writing C (minus the metaprogramming)
20:52:00FromDiscord<sOkam! 🫐> because if you output C, and you are C, you don't need bindings, you can use C libs directly, and can output C code for other libs (and/or nim) to use
20:52:22FromDiscord<_gumbercules> definitely an interesting approach
20:52:28FromDiscord<sOkam! 🫐> the only loss is the metaprogramming, really. so far I have seen no other piece missing
20:52:52FromDiscord<Chronos [She/Her]> I should work on my own programming language for the JVM
20:52:59FromDiscord<Chronos [She/Her]> Just need to actually implement a parser sigh...
20:53:09FromDiscord<sOkam! 🫐> In reply to @_gumbercules "definitely an interesting approach": I have some progress on it, but I want it capable of creating a real app before publishing it. but its my current toy/side project
20:53:16FromDiscord<Chronos [She/Her]> Half wish I could use EBNF grammar but if I make the language self-hosting I'll need a parser for that
20:53:37FromDiscord<sOkam! 🫐> yeah parsing is big just by itself
20:54:26FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "Half wish I could": do you think self-hosting is worth it though?
20:55:32FromDiscord<_gumbercules> In reply to @heysokam "I have some progress": makes sense - I'm excited to see how it turns out!
20:56:24FromDiscord<Chronos [She/Her]> In reply to @heysokam "do you think self-hosting": For getting it to run on the JVM yeah
20:56:47FromDiscord<Chronos [She/Her]> Since that way I can skip Java codegen (or Jasmin codegen, an assembly format for the JVM) and just generate bytecode directly
20:58:21FromDiscord<Chronos [She/Her]> @TӨMΛ ☠ saw you typing aha
20:58:54FromDiscord<TӨMΛ ☠> Haha, yeah, but seems like I found answer to my question in documentation 😅
20:59:16FromDiscord<TӨMΛ ☠> Was meant to get here with not relevant thing anyway, so I don't want to disrupt the convo ❤️
20:59:36FromDiscord<TӨMΛ ☠> (edit) "Haha, yeah, but seems like I found answer to my ... question" added "typed"
21:01:18FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "Since that way I": oh i can see that, makes sense
21:01:45FromDiscord<sOkam! 🫐> sounds like a big task, better start chipping away at it slowly. won't get progress otherwise
21:02:10FromDiscord<sOkam! 🫐> for difficult/frustrating projects, I've found that just working a small amout daily works amazing
21:02:23FromDiscord<Chronos [She/Her]> In reply to @toma400 "Haha, yeah, but seems": Fair!
21:02:25FromDiscord<sOkam! 🫐> that way progress is steady, but you don't pull your hair out in frustration
21:03:22FromDiscord<Chronos [She/Her]> In reply to @heysokam "sounds like a big": Yeah, I'm just avoiding the parser now rip, I already have a tokenizer and lexer
21:03:57FromDiscord<sOkam! 🫐> yeah exactly what i mean. don't avoid it, just work a very small amount of time on it. but daily
21:04:11FromDiscord<sOkam! 🫐> don't commit to 1h even... just 10-15mins
21:05:01FromDiscord<Chronos [She/Her]> It's still a complete pain ahaa
21:05:22FromDiscord<sOkam! 🫐> i sounded like a broken record when I was a coach saying that, but it literally is the root of progress↵consistency trumps everything else, even if that consistency is 15min per day↵ive seen people achieve huge tasks by just that alone, without even doing anything big or special away from that
21:05:31FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "It's still a complete": that's why its 15min!
21:05:41FromDiscord<sOkam! 🫐> that's the core of the problem, and the core of the solution
21:06:13FromDiscord<Chronos [She/Her]> I don't know how to go about it at all-
21:06:14FromDiscord<sOkam! 🫐> 1h of pain... hell no. 15min of pain... ouch, but anyone can muster that much
21:06:29FromDiscord<_gumbercules> In reply to @chronos.vitaqua "I don't know how": have you read crafting interpreters?
21:06:58FromDiscord<sOkam! 🫐> @Chronos [She/Her] https://www3.nd.edu/~dthain/compilerbook/compilerbook.pdf
21:07:46FromDiscord<sOkam! 🫐> the main problem with compiler books is how low the teaching skill of those writers is
21:07:46FromDiscord<_gumbercules> or ^
21:08:06FromDiscord<sOkam! 🫐> sure they know a lot.... but... man, teaching is not dumping 10000pages of theory on someone, even if those pages all have value
21:09:27FromDiscord<sOkam! 🫐> teaching is entertainment first, theory second. otherwise 99% of people just drop or get bored, and only the relentless 1% survives the theory dump
21:10:23FromDiscord<sOkam! 🫐> In reply to @heysokam "<@524288464422830095> https://www3.nd.edu/~dthain/c": mentioning because this book does not fall into that trap, so very recommended
21:11:20FromDiscord<Chronos [She/Her]> In reply to @_gumbercules "have you read crafting": I have
21:11:34FromDiscord<Chronos [She/Her]> In reply to @heysokam "<@524288464422830095> https://www3.nd.edu/~dthain/c": 247 pages 😭
21:12:07FromDiscord<Chronos [She/Her]> Reading now
21:12:18FromDiscord<raynei486> Also parsing theory is
21:12:23FromDiscord<raynei486> in my experience
21:12:27FromDiscord<raynei486> skimmable
21:12:53FromDiscord<Chronos [She/Her]> Thank god
21:13:00FromDiscord<Chronos [She/Her]> Tbf I think I have the knowledge
21:13:10FromDiscord<Chronos [She/Her]> But I'd also have to document the quirks of my parser
21:13:16FromDiscord<Chronos [She/Her]> And that's putting me off so much
21:13:41FromDiscord<raynei486> yeah you just gotta know NFAs and DFAs, REs and how they are all equivalent
21:13:48FromDiscord<raynei486> do some exercises
21:13:55FromDiscord<Chronos [She/Her]> Pls expand acronyms-
21:13:57FromDiscord<raynei486> that's the main gist
21:14:30FromDiscord<jmgomez> @Chronos [She/Her] or be the one that puts Nim in the JVM and makes it shine 🙂
21:14:32FromDiscord<Chronos [She/Her]> Also my language will ideally be Nim-like in syntax because I do like Nim's syntax a lot
21:14:38FromDiscord<TӨMΛ ☠> In reply to @chronos.vitaqua "Fair!": I kinda miss the server honestly, but I fell into Python waters again due to gamedeving my RPG... I'm happy that I plan on using Nim for its mod editor at least, so I will be back in few weeks I guess 😅
21:14:45FromDiscord<raynei486> In reply to @chronos.vitaqua "Pls expand acronyms-": Nondeterministic finite automata = NFA↵Deterministic finite automata = DFA↵RE = regular expression
21:14:47FromDiscord<Chronos [She/Her]> In reply to @jmgomez "<@524288464422830095> or be the": I've done that briefly but it's so pain....
21:14:53FromDiscord<Chronos [She/Her]> In reply to @toma400 "I kinda miss the": Fair
21:15:07FromDiscord<Chronos [She/Her]> In reply to @raynei486 "Nondeterministic finite automata =": Thank you! Not sure between the difference of the first two
21:15:18FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "I've done that briefly": have it on GitHub, the beginnings of it
21:15:28FromDiscord<Chronos [She/Her]> I'm really debating on trying it again but.. Hm
21:15:31FromDiscord<jmgomez> it's much easier that building one (decent) from scratch though. Also the promise is that the new NIR will make that proccess easier
21:16:19FromDiscord<raynei486> In reply to @chronos.vitaqua "Thank you! Not sure": You should just check them out, these math theories are the reason why we have theoretically perfect scanner generators
21:16:47FromDiscord<raynei486> That's why a lot of people also use lexer & parser generators
21:16:51FromDiscord<raynei486> the math behind it is mature
21:17:04FromDiscord<Chronos [She/Her]> In reply to @raynei486 "You should just check": I probably will at some point aha
21:18:28FromDiscord<Chronos [She/Her]> This probably won't work now but hm... https://gist.github.com/haxscramper/8821819221b1d73866e4aed306147f0c
21:36:12*jmdaemon quit (Ping timeout: 240 seconds)
21:48:57FromDiscord<Chronos [She/Her]> sent a code paste, see https://paste.rs/hEKkH
21:49:29FromDiscord<Chronos [She/Her]> I did `repr` on the `ModuleGraph`
22:30:02*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
22:30:34FromDiscord<Chronos [She/Her]> Oh yeah I managed to collect all the nodes in the ast
22:30:41FromDiscord<Chronos [She/Her]> Not too sure where to go from here :p
22:30:52FromDiscord<Chronos [She/Her]> Java codegen will be very tricky
22:32:14*Lord_Nightmare joined #nim
22:48:52FromDiscord<juancarlospaco> In reply to @chronos.vitaqua "Java codegen will be": Like dali?.
22:52:54FromDiscord<Chronos [She/Her]> Wdym?
23:00:59termerwhat're we doing Java codegen for?
23:02:55FromDiscord<juancarlospaco> In reply to @chronos.vitaqua "Wdym?": https://github.com/akavel/dali
23:08:38FromDiscord<Chronos [She/Her]> In reply to @termer "what're we doing Java": Nim JVM backend lol
23:08:53termerimagine
23:09:14termerIt'd probably be pretty inefficient to emulate a bunch of the memory-related things
23:09:26termerespecially considering the fact that there's no concept of stack memory on the JVM
23:09:34termerwell, not outside of primitives
23:09:49termerstack objects just don't exist
23:10:03termerIf you ever wondered why Java applications eat so much memory, that's a big reason why
23:11:06FromDiscord<Chronos [She/Her]> There's a local stack in the bytecode iirc
23:20:35termerI'm not sure how much freedom you have in the bytecode
23:20:38termerit's really weird