<< 23-12-2024 >>

00:01:58*beholders_eye quit (Quit: WeeChat 4.1.2)
00:18:20FromDiscord<.tokyovigilante> In reply to @pmunch "Yeah Futhark is able": You say that like C++ makes any sense to me... but good to know it's technically possible. Just imported SDL3 like a champ.
00:46:47*proaxis joined #nim
01:03:16proaxisI updated nimlangserver from 1.4.0 to 1.6.0 and now the nim vscode extension is saying the server is failing with SIGSEGV
01:03:44proaxisI also noticed nimlangserver still requires nim 2.0.8
01:04:18FromDiscord<Elegantbeef> The dependency shouldn't matter since it relies on the nimsuggest in your path
01:07:35proaxisI used 2.2 and it compiled fine, but I'm getting the segfaults
01:08:26proaxisused latest nimble too
01:15:51proaxisjust uninstalled 1.6.0 and reinstalled 1.4.0
01:16:59proaxisnow nimsuggest initialization failed because nimsuggest processed crashed
01:18:04proaxisI should've just stayed on 1.4.0 since it was working
01:18:29FromDiscord<Elegantbeef> I can only go for the "Did you use choosenim to install Nim?"
01:19:46proaxisyeah I used choosenim I'm on linux
01:20:14FromDiscord<Elegantbeef> Don't think it has these segfault issues, but it does have issues with choosenim
01:29:06proaxisnimlangserver has issues with choosenim?
01:30:21proaxislooks like it's trying .nimble/bin/nimsuggest which works standalone
01:43:56FromDiscord<spotlightkid> is there something like `sequtils.insert` for arrays? Or do I need to write my own for-loop for inserting a string into in a `array[n, char]`?
01:46:04FromDiscord<Elegantbeef> There is `a[b..c] = str`
01:46:26FromDiscord<Elegantbeef> Oh wait that's not for array in the stdlib
01:46:33FromDiscord<Elegantbeef> Or... nevermind it is
01:46:56FromDiscord<Elegantbeef> It's not defined for string I think, I know I've stumbled into it before
01:56:32FromDiscord<spotlightkid> Oh, yeah, that works `a[0..<s.len] = s`. Thx again!
02:00:44FromDiscord<ichigo7799> why when trying to install futhark does opir try to import unistd?
02:00:47FromDiscord<ichigo7799> (edit) "unistd?" => "unistd on windows?"
02:07:24FromDiscord<ichigo7799> is there a way for me to get it to not do that
02:10:29FromDiscord<ichigo7799> or is futhark just not compatible with windows
02:14:33FromDiscord<Elegantbeef> Did you install llvm?
02:16:55FromDiscord<ichigo7799> swift is installed, which has clang/llvm
02:17:16FromDiscord<Elegantbeef> Well time to make an issue
02:17:18FromDiscord<ichigo7799> I know it needs libclang, but does it also not build with msvc
02:18:27FromDiscord<ichigo7799> tried building nimterop, which fails with a slightly clearer (if only by accident) error message that says it won't build with anything that's not gcc or clang.
02:19:35FromDiscord<ichigo7799> (it complains while building treesitter that a variable is the wrong type and should not be a string. That string happens to be something like "error: only gcc and clang are supported" which like ha, well there's the problem, even if the actual error raised is wrong)
02:21:22FromDiscord<ichigo7799> tried installing futhark with `nimble install futhark --cc:clang` and it still fails by trying to `#include <unistd.h>` which is a thing it should not do.
02:46:16FromDiscord<.tokyovigilante> Can anyone comment on this import? I'm trying to manually define a SDL function which was not imported by futhark (possibly because of this issue). It basically returns a pointer to a list of strings, and sets an int pointer to the length of the list, but I think is confusing Nim because of the use of const everywhere.
02:46:51FromDiscord<.tokyovigilante> `extern SDL_DECLSPEC char const const SDLCALL SDL_Vulkan_GetInstanceExtensions(Uint32 count);` is the SDL func definition
02:47:13FromDiscord<.tokyovigilante> I've tried `proc SDL_Vulkan_GetInstanceExtensions (count: ptr uint32): ptr cstring {.cdecl, importc, header: "/usr/local/include/SDL3/SDL_vulkan.h"}`
02:47:31FromDiscord<.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=guklYwIn
02:49:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=oKGccAVj
02:50:20FromDiscord<Elegantbeef> This change in C compiler defaults is a pain across the board
02:51:01FromDiscord<Elegantbeef> It very much makes me prefer Nim's dlopen approach 😄
02:55:20FromDiscord<.tokyovigilante> Ah, confusing, but that works, thanks
02:57:18FromDiscord<Elegantbeef> `const` is a nice C feature, but it pollutes anything built on top of it sadly
03:12:34*cm quit (Quit: Bye.)
03:21:39*cm joined #nim
03:33:10*SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev)
04:05:29*SchweinDeBurg joined #nim
04:25:01FromDiscord<ichigo7799> trying to get nimterop to work for now
04:39:35*xet7 quit (Remote host closed the connection)
04:40:58*xet7 joined #nim
05:01:06FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=REgYqLTk
05:01:58FromDiscord<user2m> this path exists `tts\silo-season-2-episode-6-mystery-revealed-why-bernard-makes-lukas-his-shadow`
05:06:45FromDiscord<Elegantbeef> What does the error say?
05:11:12FromDiscord<dedraiaken> Anyone have thoughts on generating WASM from the NIF IR?
05:13:26FromDiscord<Elegantbeef> Would be nice to have a simpler WASM generator tooling
05:35:36FromDiscord<ichigo7799> In reply to @user2m "anyone know why this": paths max out at 260 characters; that clocks in at 245, so... maaayybeee?
05:40:23FromDiscord<Elegantbeef> If only the error raised gave information
05:57:14*xet7 quit (Remote host closed the connection)
05:58:31*xet7 joined #nim
06:49:33FromDiscord<ichigo7799> well, both nimterop and c2nim build at least, but unfortunately it does seem that it's never gonna be as easy as just importing a header from C land.
06:50:25FromDiscord<Elegantbeef> It is with futhark
08:30:04*ntat joined #nim
08:41:13*nils` quit (Ping timeout: 265 seconds)
09:43:42*nils` joined #nim
09:54:20*coldfeet joined #nim
10:05:22FromDiscord<ezquerra> sent a long message, see https://pasty.ee/PHoXxGAM
10:17:14*coldfeet quit (Quit: Lost terminal)
10:54:26FromDiscord<spotlightkid> Did you test whether the problem occurs with choosenim devel?
11:19:14FromDiscord<ezquerra> Good idea. I just checked and it does not happen with the latest devel
11:19:32FromDiscord<ezquerra> So it seems to be some kind of regression with 2.2.0, unless it is a choosenim issue
11:42:42*coldfeet joined #nim
13:25:05*ensyde joined #nim
13:42:22FromDiscord<Phil> Hmm there is no pre-made way to just "merge" 2 JSON objects in std/json, is there?
13:43:12FromDiscord<Phil> Skimming over it I'm not finding much
14:09:14FromDiscord<user2m> In reply to @ichigo7799 "paths max out at": wow duh. i thought it wae the filename that had that length limit. thank you!
14:34:09FromDiscord<albassort> https://github.com/fsh/integers
14:35:05FromDiscord<albassort> is there a better bignum respository?
14:54:00*beholders_eye joined #nim
14:55:47FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=FajzHbCP
14:56:44FromDiscord<tsoj> what do you want to achieve, what is the behaviour you observe?
14:57:09FromDiscord<user2m> both file paths should be witten to successfully, but only the shorter one is successful
14:57:36FromDiscord<user2m> when I run that code `nim c -r test.nim` writing to the long file path fails
14:58:15FromDiscord<tsoj> In reply to @albassort "is there a ": There is also this: <https://github.com/nim-lang/bigints>↔Don't know which one is better though
15:00:17FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=eUdWvhov
15:00:30FromDiscord<tsoj> In reply to @user2m "both file paths should": Are you running this from C:/?
15:01:16FromDiscord<tsoj> maybe `tts\silo-season...` is really `C:\User\Whatever\tts\silo-season` and thus becaomes longer than allowed?
15:01:21FromDiscord<user2m> no this is the full `B:\Desktop\Scripts\projects\cliply\test.nim`
15:01:58FromDiscord<user2m> In reply to @tsoj "maybe `tts\silo-season...` is really": that's what I'm thinking, but Im still able to create the path manually - shouldn't that fail as well?
15:02:07FromDiscord<tsoj> Creating the file manually (e.g. using the File explorer
15:02:12FromDiscord<tsoj> (edit) "explorer" => "explorer) works?"
15:02:17FromDiscord<tsoj> ah nvm
15:02:17FromDiscord<user2m> In reply to @tsoj "Creating the file manually": yes
15:03:30FromDiscord<user2m> this is the file created manually https://media.discordapp.net/attachments/371759389889003532/1320768755936133203/image.png?ex=676acd42&is=67697bc2&hm=8b4711579ece6a3fbb7c002082853c4416d578aa9422cac1003a2fc470300b3e&
15:05:26FromDiscord<tsoj> I mean, the full path is longer than 270 chars
15:06:19FromDiscord<tsoj> What about this:↔> To specify an extended-length path, use the "\\?\" prefix. For example, "\\?\D:\very long path".
15:06:37FromDiscord<tsoj> from the learn.microsoft website
15:07:27FromDiscord<tsoj> (edit) ""\\?\"" => ""\\?\\""
15:07:36FromDiscord<tsoj> (edit) ""\\?\D:\very" => ""\\\\?\D:\very"
15:10:05FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=OrbSBtSA
15:10:15FromDiscord<user2m> thank you @tsoj
15:10:39Amun-Raekhm, nim has raw strings
15:12:07FromDiscord<tsoj> It seems that Nim `shl` doesn't discard the shifted out bits and instead rotates them:↔https://play.nim-lang.org/#pasty=tIsAFhXS
15:13:05FromDiscord<tsoj> sent a code paste, see https://play.nim-lang.org/#pasty=GtxknzPe
15:13:43FromDiscord<leorize> I'm pretty sure that it's modulated with the bit width by default
15:17:47FromDiscord<leorize> this is Nim's method of combating the undefined behavior of `<<` shift count being larger or equal to the target bit width
15:18:38FromDiscord<tsoj> oh, that's undefined behaviour?
15:18:46FromDiscord<leorize> what you can do is to just shift twice if you wanted shifts that are larger than the bit width
15:19:41FromDiscord<tsoj> I think I just set the result to zero everytime the shift is large and hope that the branch predictor works well
15:19:46FromDiscord<tsoj> (edit) "large" => "larger than 64"
15:19:50FromDiscord<leorize> yup, see the `Shift Operators` section here\: https://en.cppreference.com/w/c/language/operator_arithmetic
15:20:11FromDiscord<albassort> In reply to @tsoj "There is also this:": i dont think it supports gmp floats?
15:26:14FromDiscord<leorize> if you need gmp then you should just use gmp directly, no?
15:29:14FromDiscord<albassort> In reply to @leorize "if you need gmp": well
15:29:15Amun-Rainteresting https://play.nim-lang.org/#pasty=QxbIdWZt
15:29:19FromDiscord<albassort> i would like good decimals
15:29:21FromDiscord<albassort> like https://github.com/JohnAD/decimal128
15:29:30FromDiscord<albassort> idrc about hot it happens
15:29:34FromDiscord<albassort> (edit) "hot" => "how"
15:29:34Amun-Raleorize: there's no undefined behavior when shifting unsigned integers
15:29:43FromDiscord<albassort> so long as it is fast and safe
15:32:23Amun-Raand given the next C standard will require signed integers to be 2's complement, there should be no undefined behavior when shifting signed ints either
15:32:26FromDiscord<leorize> it's undefined regardless of signedness↔(<@709044657232936960_=41mun-=52a=5b=49=52=43=5d>)
15:32:48FromDiscord<leorize> https://wiki.sei.cmu.edu/confluence/display/c/int34-c.+do+not+shift+an+expression+by+a+negative+number+of+bits+or+by+greater+than+or+equal+to+the+number+of+bits+that+exist+in+the+operand
15:33:37FromDiscord<leorize> a lot of this has to do with how processors handled shifts
15:34:22FromDiscord<leorize> some Intel processors mask the shifts, and thus the undefined rule was born
15:35:12FromDiscord<leorize> https://devblogs.microsoft.com/oldnewthing/20230904-00/?p=108704
15:35:19FromDiscord<leorize> here's an MS devblog that shows how different architectures handled big shifts
15:36:17FromDiscord<albassort> intel is the windows of ISA implementation
15:36:56Amun-Raleorize: C99 6.5.7p1, well, you're right
15:39:17FromDiscord<albassort> think i will use decimal128
15:39:30FromDiscord<leorize> apparently nim's behavior is similar to risc-v \:p
15:40:46Amun-Raisn't it cpu arch defined in this case?
15:43:20FromDiscord<leorize> yea, and the C people decided that they don't want to think about making it work consistently
15:43:24FromDiscord<leorize> and allow compilers to just assume that you will never use it wrong
15:45:52Amun-Rathey just call cpu intrinsics and call it a day
15:47:54FromDiscord<leorize> until they decide to do some expression simplification thanks to the assumption
15:48:01FromDiscord<leorize> probably never happens, tbh
15:48:49Amun-Ramhm
16:07:15FromDiscord<albassort> C people dont like to do anything
16:07:16FromDiscord<albassort> its their job
16:08:03FromDiscord<albassort> or well, "the C people" making the standards. People programming in C are the meek of the earth or smth
16:10:01Amun-RaC's evolving speed is similar to humans
16:10:42FromDiscord<albassort> so it hasn't caught up with farming?
16:46:25FromDiscord<albassort> proc ``(left: Decimal128, right: Decimal128): Decimal128 =
16:46:34FromDiscord<albassort> https://github.com/JohnAD/decimal128/blob/68add444773abb3d5e03979690959bf1d4881364/src/decimal128.nim#L1793
16:47:06FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=CTfEyKgP
16:47:17FromDiscord<albassort> ăȘぜ
16:49:16FromDiscord<albassort> idk how this is even happening
16:49:50FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=swRqMteP
16:55:26FromDiscord<odexine> doesnt exist in 0.1.2 https://github.com/JohnAD/decimal128/blob/8239d9ff39ae4f68dfa09490061320a0bca14af9/src/decimal128.nim
16:55:35FromDiscord<odexine> install head
16:58:45FromDiscord<albassort> i wish converters weren't total garbage
16:58:57FromDiscord<albassort> thanks rika, btw
17:05:25Amun-Raconverters should be used only internally, #changemymind
17:08:37*beholders_eye quit (Ping timeout: 248 seconds)
17:16:13FromDiscord<fabric.input_output> `converter toInt(s: set[Flag]): int` ;)
17:17:21Amun-Ra:>
17:18:23Amun-Ra+1 for it's 'toInt' and not 'toInt*' ;)
17:20:26FromDiscord<fabric.input_output> fixed :P
17:20:40Amun-Ra:D
17:21:01FromDiscord<fabric.input_output> fr tho these sort of converters are a must
17:21:08FromDiscord<fabric.input_output> this specific class of converters
17:21:24FromDiscord<fabric.input_output> when you wrap a C/js lib
17:21:37Amun-RaI always try to expose hight level types
17:21:51Amun-RaI mean only hl, if that's possible
17:22:59FromDiscord<fabric.input_output> yeah but sometimes I want to just keep the C/js functions and wrap the types
17:23:44Amun-Rathe only low level types I exposed is C-type function callbacks in my gtk lib
17:24:03Amun-RaI have to find a way to wrap them with nim ones
17:26:18FromDiscord<fabric.input_output> well I declared some js functions and types and it was fairly straightforward but the C bitwise enums gave me the ick so I did that
17:27:13FromDiscord<fabric.input_output> Amun-Ra: https://discord.com/channels/371759389889003530/371759389889003532/1317517891473506344
17:27:31FromDiscord<fabric.input_output> (edit) "https://discord.com/channels/371759389889003530/371759389889003532/1317517891473506344" => "https://discord.com/channels/371759389889003530/371759389889003532/1317518270294921238"
17:28:25Amun-Rayeah, enum-based bitfields with casts don't work on js target
17:29:11FromDiscord<fabric.input_output> I was talking about the `"auto"` shtick
17:30:03Amun-Raah, I can't see the contants of that url
17:30:09Amun-RaI was talking about: https://nim-lang.org/1.6.14/tut1.html#sets-bit-fields
17:30:20Amun-Rathese asserts will fail on js
17:31:32FromDiscord<bostonboston> I have a lib with a ton of enum to byte converters because at the end of the day it sends messages over USB and I don't what to cast every single part of the message to a byte
17:31:36FromDiscord<bostonboston> Want
17:31:42Amun-Ra"Note how the set turns enum values into powers of 2." ← not on JS
17:34:29FromDiscord<fabric.input_output> In reply to @Amun-Ra ""Note how the set": yeah because `set[T]`s on js are represented by an object with the keys being the ordinal values of `T` and the values being `true`
17:35:02Amun-Ratbh, I never looked at the resulting JS code
17:35:17FromDiscord<fabric.input_output> I did because I tried that and it didn't work
17:35:22Amun-Rahmm
17:36:32Amun-RaI've to report one compiler bug with iterators on JS, it's been a year since I discovered it
17:38:18FromDiscord<albassort> im gonna need to update my btc wrapper to use Decmial128
17:38:27FromDiscord<albassort> i know nobody is using it but i really hope nobody is using it
17:38:47Amun-Ra:>
17:39:49FromDiscord<albassort> 0.00000001 and 0.0000002 and 0.00000003 are really small
17:40:15Amun-Raremember 1 + 1 = 3 for very large values of 1
17:40:49FromDiscord<albassort> .1 + .2 = .3000000000000000000001 for binary128 bit integers
17:41:01FromDiscord<albassort> or at least this is what i read
17:41:01Amun-Rayes
17:52:55FromDiscord<albassort> hmm
17:52:57FromDiscord<albassort> there is an issue
17:53:27FromDiscord<albassort> the nim json rpc will convert things to floats and will not keep them as stringsw
17:53:31FromDiscord<albassort> (edit) "stringsw" => "strings"
17:53:37FromDiscord<albassort> (edit) "rpc" => "module"
17:53:51FromDiscord<albassort> which will cause bugs for small numbers
17:55:04FromDiscord<albassort> oh okay they can be represented by float64s
17:55:30FromDiscord<albassort> i guess fuck 32 bit users
17:57:18FromDiscord<odexine> doubles work on 32 bit computers...
17:57:22FromDiscord<odexine> its just slower
17:57:54FromDiscord<albassort> yeah but im not sure if nim will use float32 on json by default on a 32bit machine
17:58:08FromDiscord<odexine> `float` is always double
17:58:21FromDiscord<albassort> neat
18:01:53FromDiscord<albassort> maybe i shouldn't be using decmial128 if everything fits in a float64
18:02:06FromDiscord<albassort> at leat i learned some things :)
18:52:49*proaxis_ joined #nim
18:52:50*GnuYawk67 joined #nim
18:56:24*coldfeet_ joined #nim
18:56:39*nils` quit (Ping timeout: 245 seconds)
18:56:49*SchweinD1 joined #nim
18:58:32*GnuYawk6 quit (Quit: Ping timeout (120 seconds))
18:58:32*GnuYawk67 is now known as GnuYawk6
18:58:34*coldfeet quit (Ping timeout: 265 seconds)
18:58:34*proaxis quit (Ping timeout: 265 seconds)
18:58:35*SchweinDeBurg quit (Ping timeout: 265 seconds)
19:27:12*ntat_ joined #nim
19:27:42*ntat quit (Ping timeout: 276 seconds)
19:39:13*ntat_ is now known as ntat
19:43:21*coldfeet_ quit (Quit: Lost terminal)
20:35:28*nils` joined #nim
21:16:31*ntat quit (Quit: Leaving)
21:17:36*beholders_eye joined #nim
22:04:30FromDiscord<System64 ~ Flandre Scarlet> For seqs↔What's the difference between setLen and Shrink please?
22:08:28Amun-Rahttps://play.nim-lang.org/#pasty=LWhhrMMc
22:09:23Amun-Rahttps://play.nim-lang.org/#pasty=TILrtvOL
22:10:08Amun-Raif new length is less than actual size, no difference
22:10:49FromDiscord<System64 ~ Flandre Scarlet> In reply to @Amun-Ra "if new length is": Ah so to make a seq lower, I should use shrink?
22:11:24Amun-RaI'm using set_len out of habit
22:11:43FromDiscord<Elegantbeef> It's a single if statement
22:12:04FromDiscord<Elegantbeef> If that causing you performance problems you're in a good spot
22:12:19Amun-Rait's going to be probably optimized out by the compiler
22:12:50FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=GCiGdYlS
22:13:12FromDiscord<Elegantbeef> Are you trying to free memory?
22:13:17FromDiscord<Elegantbeef> Cause if you are you want ` = @[]`
22:15:57FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Are you trying to": Just avoiding reallocations
22:18:44*beholders_eye quit (Ping timeout: 245 seconds)
22:52:09*cm_ joined #nim
22:53:11*cm quit (Ping timeout: 252 seconds)
22:53:11*cm_ is now known as cm
23:02:33FromDiscord<leopotam> sent a code paste, see https://play.nim-lang.org/#pasty=BHBWbuJD
23:14:19FromDiscord<System64 ~ Flandre Scarlet> https://www.youtube.com/watch?v=7EK06n485nk↔Is there a feature like this in Nim?
23:16:34FromDiscord<bostonboston> Yes
23:17:06FromDiscord<Elegantbeef> `staticRead`
23:18:11FromDiscord<bostonboston> Personally I prefer `slurp`
23:18:22FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "`staticRead`": Oh thanks!
23:40:33FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=dWmGfDXm
23:41:26FromDiscord<Elegantbeef> People really will ask about a single line of code
23:45:53FromDiscord<bostonboston> Just seems like sugar for `for event in EventList.events`
23:46:06FromDiscord<Elegantbeef> well `events` likely shouldn't be exported
23:46:21FromDiscord<bostonboston> If true, then true
23:48:56FromDiscord<sleeves> I'm having a strangely hard time wrapping my head around how procedural types work. Does anyone happen to know where I can find a tutorial or in-depth explanation of them? The documentation is a bit too concise for the TV static in my brain.
23:49:21FromDiscord<Elegantbeef> What's your issue with them?
23:50:03FromDiscord<sleeves> No idea, I just keep looking at the section on them and just can't understand.
23:50:46FromDiscord<Elegantbeef> They're first class types that can be used to store a reference to a procedure so you can invoke a procedure based off runtime values instead of only at compile time
23:50:48FromDiscord<Elegantbeef> There's really not much to them
23:53:10FromDiscord<sleeves> Nevermind, I see what was confusing me. I kept looking at an argument name in the manual and thinking it was an existing value... mfw
23:53:26FromDiscord<sleeves> Nevermind, I see what was confusing me. I kept looking at an argument name in the manual's example and thinking it was an existing value... mfw
23:54:01FromDiscord<Elegantbeef> Reading can be hard some days 😄
23:54:11FromDiscord<sleeves> yep