<< 18-02-2024 >>

00:02:42FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=wtmPUrsHvvCN
00:03:45FromDiscord<sOkam! 🫐> also don't know if `free event` would be the same outcome in nim. feels wrong freeing a `ptr T` 🤔
00:05:36FromDiscord<Elegantbeef> `while ptr != nil` == `while myPtr` in C
00:06:03FromDiscord<Elegantbeef> You should use the xcb free instead of Nim's free
00:06:20FromDiscord<Elegantbeef> Nim's free is for it's allocator, we know xcb does not use your program's allocator
00:06:45FromDiscord<sOkam! 🫐> its not using xcb's free, its using C's free
00:08:04FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=ShGdmwwZEgyS
00:08:16FromDiscord<sOkam! 🫐> never assigned anything in a while loop. i don't even use while loops most of the time
00:10:12FromDiscord<Elegantbeef> well you should be using the free to accompany the xcb alloc
00:10:13FromDiscord<Elegantbeef> So if it uses C's free you use C's free
00:10:13FromDiscord<Elegantbeef> Nope
00:10:14FromDiscord<Elegantbeef> `while (let ev = xcb.waitForEvent(conn); ev != nil)` is though 😛
00:10:14FromDiscord<Elegantbeef> Nim does not have return on assignment for good reason
00:10:14FromDiscord<Elegantbeef> Return on assignment is bad and especially bad in an expressionful language
00:10:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=jEGwHFYVZDLd
00:12:25FromDiscord<bosinski2023> In reply to @Elegantbeef "`while (let ev =": and he did it again - don't forget your wiki..
00:13:47FromDiscord<Elegantbeef> I mean let expressions arent anything fancy
00:13:47FromDiscord<Elegantbeef> It's a natural extension of the langauge
00:13:48FromDiscord<Elegantbeef> If you can put a stmt list somewhere you can write code in it
00:17:33FromDiscord<sOkam! 🫐> In reply to @Elegantbeef "`while (let ev =": ty
00:18:21FromDiscord<sOkam! 🫐> In reply to @Elegantbeef "I mean let expressions": "nothing" you know is "anything fancy"... for you↵except it is really smart and fancy for everybody else, but its understandable that you don't value it as much as everybody else does because you already have it
00:21:01FromDiscord<sOkam! 🫐> @pmunch does futhark have any sort of support for enum sets?↵trying to `or` some enum values together, but they are really annoying to be calling `entry.ord` everytime, and creating converters is ugly and clashes so much that I banned it from my codebases 😦↵Did you already figure something out for this usecase?
00:21:46FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=EKnGesczzbVO
00:26:20*lucasta quit (Quit: Leaving)
00:26:59FromDiscord<sOkam! 🫐> @ElegantBeef is C's `free` already mapped in nim, or do I need to wrap it?
00:30:05FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=tswDebuVTvnv
00:33:41FromDiscord<sOkam! 🫐> xcb wrapper #worked 🥳↵thanks again for futhark, @pmunch. its such a huge timesaver 🤘 https://media.discordapp.net/attachments/371759389889003532/1208572009605505084/image.png?ex=65e3c565&is=65d15065&hm=77ae93611038270f74f72e022d36b10d392f3d897ae8dcc89698903ee33be8dc&
00:37:49FromDiscord<Elegantbeef> `cast[uint32]({GcForeground, GcGraphicsExposure})`
00:41:20*def- quit (Quit: -)
00:42:17*def- joined #nim
00:42:59FromDiscord<sOkam! 🫐> its still the same issue, though. but with uglier syntax↵the underlying problem is that there are a lot of enums that were wrapped automatically and they don't have (or i don't know if they have) auto-generated ways to handle them
00:47:18*def- quit (Quit: -)
00:49:32*def- joined #nim
01:00:03*nazgulsenpai quit (Quit: ZNC 1.8.2 - https://znc.in)
01:02:26*nazgulsenpai joined #nim
01:05:29FromDiscord<pmunch> In reply to @heysokam "xcb wrapper #worked 🥳": Glad you like it! I've been having a lot of success with it myself 🙂
01:05:53FromDiscord<Elegantbeef> You can always change the procs to accept `set[YourEnum]` but it's very manual
01:05:56FromDiscord<Elegantbeef> Or make a indirection proc that does that
01:06:14FromDiscord<pmunch> And no, Futhark doesn't really have any kind of support for anything like sets. It just does the low level wrapping, no more, no less
01:07:08FromDiscord<pmunch> sent a code paste, see https://play.nim-lang.org/#pasty=BkhEybidoTOw
01:07:52FromDiscord<pmunch> Although it would be nice to convert the first letter case based on what Nim identifier it ended up as to make more idiomatic code 🤔
01:08:37FromDiscord<sOkam! 🫐> definitely
01:08:53FromDiscord<sOkam! 🫐> In reply to @pmunch "Although it would be": it is creating types in lowercase, so yeah absolutely would be great
01:23:32*def- quit (Quit: -)
01:25:21*def- joined #nim
01:44:46*def- quit (Quit: -)
01:45:39*def- joined #nim
01:50:01*def- quit (Client Quit)
01:51:26*def- joined #nim
01:59:30FromDiscord<sOkam! 🫐> how do you execute a shell command with an ENV variable set just for that shell call only?↵something like: `DISPLAY=:1 path/to/mycmd`
02:14:25FromDiscord<leorize> I think osproc does let you pass an environment in
02:32:58*def- quit (Quit: -)
02:33:49*def- joined #nim
02:37:03*def- quit (Client Quit)
02:37:48*def- joined #nim
02:43:56*rockcavera quit (Remote host closed the connection)
02:44:21*rockcavera joined #nim
02:46:34FromDiscord<sOkam! 🫐> didn't work. ended up sending all commands concatenated to the shell call 🤷‍♂️
02:50:37FromDiscord<aryzen> So I was gonna make a sudoku app to practice until I learned how hard a sudoku puzzle generating algorythm is gonna be. It's not hard to make a working complete sudoku but it's hiding the right ones and still having only a single solution that's the hard part
02:50:46FromDiscord<aryzen> soooooo, now I'm gonna make minesweeper lol
03:08:20*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
03:11:36*Lord_Nightmare joined #nim
03:19:24FromDiscord<aryzen> This is annoying, I'm just trying to make an object and yet intellisense or whatever this is keeps suggesting nonsense https://media.discordapp.net/attachments/371759389889003532/1208613709761478717/image.png?ex=65e3ec3b&is=65d1773b&hm=73a32ef475e3c551769d3ef921da292d036e50c98f0be2b86d277c962f3becaa&
03:19:34FromDiscord<aryzen> or am I doing something wrong?
03:20:54FromDiscord<leorize> you're using the wrong syntax
03:21:58FromDiscord<aryzen> oh ok
03:22:04FromDiscord<aryzen> let me look closer at the manual
03:22:40FromDiscord<leorize> it's just `:` -\> `=`
03:22:41FromDiscord<aryzen> right, I should have used an equal sign
03:22:59FromDiscord<aryzen> still does this though https://media.discordapp.net/attachments/371759389889003532/1208614612321443850/image.png?ex=65e3ed12&is=65d17812&hm=5f225f989c7576ae1293f7f1e0e5baff1205f94d9112ae240cda2130b842d5af&
03:23:49FromDiscord<Elegantbeef> The suggestion never suggests `object`
03:24:05FromDiscord<aryzen> that's on purpose?
03:24:11FromDiscord<Elegantbeef> Nope
03:24:12*def- quit (Quit: -)
03:24:18FromDiscord<aryzen> :S that's an issue then?
03:24:24FromDiscord<Elegantbeef> It's a type and typeclass but nimsuggest seemingly doesn't know that
03:24:33FromDiscord<aryzen> ah I see
03:24:43FromDiscord<aryzen> Should I use lsp or something?
03:24:47FromDiscord<aryzen> Or is there a setting I can tweak?
03:25:05FromDiscord<Elegantbeef> Nope no setting Nimsuggest just has many oddities
03:25:12FromDiscord<aryzen> argh. ok
03:25:24FromDiscord<aryzen> I'll power on through. I'm eager to learn this language even if it kills me
03:25:25*def- joined #nim
03:25:47FromDiscord<Elegantbeef> I assume the reason is that `object` is a keyword and nimsuggest does not know how to suggest keywords
03:25:56*rockcavera quit (Read error: Connection reset by peer)
03:26:02FromDiscord<aryzen> Yeah I guess that makes sense
03:26:10FromDiscord<aryzen> Also, thank you for the answer, helps a lot
03:27:28FromDiscord<aryzen> I'm also guessing another one of the oddities is only updating when I save
03:27:44FromDiscord<Elegantbeef> Enable autosave
03:27:59FromDiscord<aryzen> I hit save every other character anyways, so that's no big issue
03:28:10FromDiscord<aryzen> Just wondering to make 100% I didn't screw up something
03:28:23FromDiscord<aryzen> Once bitten twice shy with a really really broken .net install
03:28:49FromDiscord<aryzen> Not 100% sure anything on my computer works right anymore
03:29:09FromDiscord<Elegantbeef> Years ago C# tooling on linux just pretty much never worked right, was fun writing code
03:29:22FromDiscord<aryzen> hah, I'm on mac, I think it's still the case here
03:29:35FromDiscord<Elegantbeef> But they promised cross platform!
03:29:45FromDiscord<aryzen> yeah it works across multiple windows pcs!
03:30:02FromDiscord<aryzen> mission accomplished
03:30:04FromDiscord<Elegantbeef> I still love that their MAUI has no linux or BSD support
03:30:25FromDiscord<Elegantbeef> Crossplatform gui toolkit to replace xamarin
03:30:38FromDiscord<aryzen> yet they already depricated their other gui stuff
03:31:04FromDiscord<aryzen> good luck making anything look native, now everything looks like a webapp
03:31:13*tc424 quit (Ping timeout: 268 seconds)
03:32:09*rockcavera joined #nim
03:38:45*def- quit (Quit: -)
03:40:13*def- joined #nim
03:49:58*def- quit (Quit: -)
03:50:30*def- joined #nim
03:55:01*disso-peach joined #nim
04:36:11FromDiscord<ebahi> using parsecfg is it possible to get all keys from a particular section?
04:37:57FromDiscord<ebahi> i looked into the source code and didn't find any way to do so, so is there a way to do it?
04:40:32FromDiscord<leorize> so you read until you found the section
04:40:38FromDiscord<leorize> then all keys after is of that section
04:40:40FromDiscord<leorize> until the next one that is
04:40:58FromDiscord<Elegantbeef> Or parse it all and just iterate the section you care about
04:56:33FromDiscord<ebahi> ended up just modifying parsecfg
06:20:22*junaid_ joined #nim
07:39:38FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=hziuuksnAojT
07:40:07FromDiscord<odexine> `set[T]`
07:40:20FromDiscord<odexine> T -> whatever enum response_type holds
07:41:00FromDiscord<odexine> the values of such enum must be roughly sequential and not the value you're ANDing against
07:42:16FromDiscord<sOkam! 🫐> In reply to @odexine "the values of such": what does this mean?
07:44:21FromDiscord<sOkam! 🫐> In reply to @odexine "T -> whatever enum": as you can see, it contains no enum, its a `uint8`. I'm struggling to find the docs, as this value is hardcoded in all of the xcb examples and the documentation is basically nonexistent for the field 😔↵I guess I could makeup an enum manually and use that to check.↵How would you do this check specifically with an enum set?
07:45:25FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=shsGnNxctEJM
07:46:02FromDiscord<odexine> In reply to @heysokam "as you can see,": idk, good luck if everything is hardcoded like that because that just makes it difficult to translate since you dont know the meaning of anything
07:46:13FromDiscord<sOkam! 🫐> In reply to @odexine "idk, good luck if": yeah that's the probl
07:46:36FromDiscord<sOkam! 🫐> In reply to @odexine "C flag enums often": i know this. my question is specifically about doing the equivalent to `& ~0x80`
07:47:08FromDiscord<sOkam! 🫐> (edit) "`&" => "`thing &"
07:47:49FromDiscord<odexine> thing & ~0x80 is essentially a check for some value not being in the set, or so
07:47:57FromDiscord<odexine> actually no, miswrote
07:48:29FromDiscord<odexine> its a filter for that specific item, it filters out that item from the set
07:50:31FromDiscord<sOkam! 🫐> so we are accessiing the value of the field without whatever is contained in the bit at `1_000_0000` I guess 🤔
07:51:32FromDiscord<odexine> pretty much
07:51:47FromDiscord<odexine> so depending on how that value is really used, it might be a set or not
07:51:59FromDiscord<odexine> usually it is but sometimes it isnt so
07:52:31*advesperacit joined #nim
07:52:32FromDiscord<Elegantbeef> Cut to people using the last 16bits of a pointer for their own purposes 😛
07:58:22FromDiscord<sOkam! 🫐> In reply to @Elegantbeef "Cut to people using": you mean tagged pointers?
07:58:54FromDiscord<sOkam! 🫐> In reply to @odexine "so depending on how": apparently internally it isnt, but the values are literally hardcoded defines, not enums 🤦‍♂️
08:05:45*ntat joined #nim
08:12:24FromDiscord<odexine> In reply to @heysokam "apparently internally it isnt,": thats frustrating to deal with lol
08:38:50FromDiscord<Elegantbeef> Yes↵(@sOkam! 🫐)
08:48:37*azimut joined #nim
08:54:38FromDiscord<fosster> guys, do you think is better to mark a toString function (`$`) as `func` instead of `proc`? In my opinion yes because it acts more like a `func` considering in only gives back the result
08:56:01FromDiscord<fosster> I know it seems like a pretty dumb question, but I always see `$` functions marked as `proc` and I don't agree with it
08:57:00FromDiscord<Elegantbeef> Nim has func inference so if it's a proc that's truly a func it's fine
08:57:06FromDiscord<Elegantbeef> But if you want it as a func go ahead
08:57:20FromDiscord<Elegantbeef> I do not use func as much as I should
08:58:04advesperacitI forget it exists
08:58:23FromDiscord<fosster> neither I, but I wonder how does it infer it
08:59:12FromDiscord<Elegantbeef> If the proc has a side effect it's not marked `noSideEffect`
08:59:15FromDiscord<Elegantbeef> It's quite simple
09:06:26FromDiscord<sOkam! 🫐> is it possible to use an enum set as the `case ... of myset: ` instead of using single values separately?
09:06:48FromDiscord<Elegantbeef> You can use array, set, and range values as long as it's constant
09:07:20FromDiscord<sOkam! 🫐> i had no idea, thought only ranges were an option. ty
09:08:58FromDiscord<Elegantbeef> Well unless you want to use a constant there is not much benefit in the set
09:09:24FromDiscord<Elegantbeef> `of A..B, C, D, E, F, X..Z` is the exact same as you'd do in the set
09:15:43FromDiscord<fosster> is there a function in the module `std/uri` or perhaps in some other module that checks if an URI/URL is valid?
09:20:20FromDiscord<Elegantbeef> Less than ideal but you could parse it then check the components are fine
09:23:01*tc424 joined #nim
09:37:42FromDiscord<sOkam! 🫐> In reply to @Elegantbeef "`of A..B, C, D,": except is not single letters, its long names
09:38:13*tc424 quit (Ping timeout: 264 seconds)
09:39:10FromDiscord<sOkam! 🫐> `const MouseEvents = {xcb.Ev.BtnPress, xcb.Ev.BtnRelease, xcb.Ev.Motion, xcb.Ev.OtherEvent, xcb.Ev.SomeOtherEvent, .... ... }`↵imagine trying to make sense of the caseof that forks into ten million places, but the cases are gigantic like that
09:44:18*xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1 - https://znc.in)
10:03:10*xutaxkamay joined #nim
10:35:23*junaid_ quit (Remote host closed the connection)
11:02:21*xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1 - https://znc.in)
11:03:20*xutaxkamay joined #nim
11:06:53*rockcavera quit (Read error: Connection reset by peer)
11:07:14*rockcavera joined #nim
11:07:14*rockcavera quit (Changing host)
11:07:14*rockcavera joined #nim
11:29:23*rockcavera quit (Read error: Connection reset by peer)
11:30:23*rockcavera joined #nim
11:54:47NimEventerNew thread by devosalain2: Looking for a python-flask like nim web framework., see https://forum.nim-lang.org/t/11032
12:01:56*junaid_ joined #nim
12:17:50*gst joined #nim
13:04:02gsthi, I would like to speed this up: "151842 lines; 38.466s; 955.969MiB peakmem;" on an amd 3700x cpu.
13:04:02gstI know that there are long term solutions (ic: not ready yet, nim multithreaded: a far future?, split the code into libraries: I'd rather avoid, less templates/generics/macros: not an option) but I would like to go to a more immediate solution: bruteforce it with hardware.
13:04:03gstThe questions is, does amd large x3d cache with its frequency limitations help? or better go with the fastest mono-threaded cpu and fastest ram? do you have real world experiences or benchmarks?
13:41:19*junaid_ quit (Remote host closed the connection)
13:41:21NimEventerNew thread by felixfxu: Totally lost when reading tutorial of "code-blocks-as-arguments", see https://forum.nim-lang.org/t/11035
14:15:11*derpydoo quit (Ping timeout: 260 seconds)
14:26:41*src joined #nim
14:36:10*ntat quit (Quit: Leaving)
14:49:46NimEventerNew thread by dwhall256: Type mismatch when static uint32 is given to the slice operator, see https://forum.nim-lang.org/t/11036
15:35:18*xutaxkamay quit (Read error: Connection reset by peer)
15:35:53*xutaxkamay joined #nim
15:42:49*ntat joined #nim
15:57:07FromDiscord<alex.boisvert> In reply to @gst "I know that there": Just an idea -- perhaps you can rent out a couple cloud instances to test this out yourself with your own project.
15:58:32FromDiscord<bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=nEBwQRLoCLfz
15:59:43FromDiscord<bosinski2023> (edit) "https://play.nim-lang.org/#pasty=kIsVHrQPGlqc" => "https://play.nim-lang.org/#pasty=pkYZajrZGABV"
16:03:39FromDiscord<odexine> What is -1 supposed to be as a uint?
16:03:54FromDiscord<odexine> What would the bits look like
16:04:20FromDiscord<bosinski2023> In reply to @odexine "What is -1 supposed": that puzzels mee, too.. Don't know the bits..
16:06:02FromDiscord<bosinski2023> In reply to @odexine "What would the bits": its taken from here, has no name, might be called 'Lemire reduction' [ https://en.algorithmica.org/hpc/arithmetic/division/ ]
16:11:59FromDiscord<odexine> Checked
16:12:16FromDiscord<odexine> It’s as the comment says (I missed it)
16:18:04FromDiscord<demotomohiro> !eval doAssert cast[uint64](int64(-1)] == uint64.high
16:18:08NimBotCompile failed: /usercode/in.nim(1, 33) Error: expected: ')', but got: ']'
16:18:37FromDiscord<MDuardo> Somebody using Nim 2.0 in NixOS?↵I can't install it, the package is broken
16:18:52FromDiscord<demotomohiro> !eval doAssert cast[uint64](int64(-1)) == uint64.high
16:18:58NimBot<no output>
16:20:49FromDiscord<demotomohiro> In reply to @bosinski2023 "that puzzels mee, too..": You can translate `uint64_t(-1)` in C to `uint64.high` in Nim. They are both all bits 1.
16:33:40FromDiscord<bosinski2023> In reply to @demotomohiro "You can translate `uint64_t(-1)`": thx 🙂
16:51:18*xet7 quit (Remote host closed the connection)
16:56:19FromDiscord<nasuray> In reply to @MDuardo "Somebody using Nim 2.0": I am what is your issue
16:59:20FromDiscord<leorize> gst\: an apple silicon CPU will beat pretty much all x86 wrt compiling nim
17:01:26FromDiscord<demotomohiro> @MDuardo↵You can compile Nim from source or download precompiled binary from https://github.com/nim-lang/nightlies/releases
17:02:48FromDiscord<leorize> those won't work on nixos
17:03:23FromDiscord<leorize> their fs layout is a major PITA
17:04:00FromDiscord<leorize> I worked around that by running a fedora distrobox on nixos to reduce the need for tinkering
17:07:20*gst quit (Quit: Client closed)
17:07:39*gst joined #nim
17:40:57FromDiscord<pr0c_mm3r> hey people, Im new to nim, coming from a bit of python, is there any good way to learn the language
17:43:12*junaid_ joined #nim
17:55:35FromDiscord<demotomohiro> In reply to @pr0c_mm3r "hey people, Im new": https://narimiran.github.io/nim-basics/
17:57:50FromDiscord<madonuko> I'm surprised nim isn't in Nix
17:58:15FromDiscord<madonuko> it's even on goddamn Fedora
17:59:41FromDiscord<nasuray> In reply to @madonuko "I'm surprised nim isn't": It is and works great
18:01:50FromDiscord<madonuko> what
18:02:03FromDiscord<madonuko> I mean OP said it didn't work so
18:03:21srcanyone using nvim w/ mason & mason-lspconfig by chance? Wanted to try out nim, added the langserver to my config https://dpaste.com/HHDETLKU5 and upon restart expected an clean install, but all it seems to kick off is a never ending CPU hogging festival of whatever this is https://dpaste.com/DSKFFANG7
18:03:31FromDiscord<madonuko> ~~Kill me if they tried `nim` instead of `nim-unwrapped`~~
18:05:36*gooba joined #nim
18:11:52FromDiscord<nasuray> In reply to @src "anyone using nvim w/": It's running nimble install for the lang-server which is picking up `nim` from the lock file. We need to update this https://github.com/mason-org/mason-registry/blob/main/packages/nimlangserver/package.yaml to use the tags and not install from master
18:16:24*gooba quit (Remote host closed the connection)
18:18:42*gooba joined #nim
18:19:38*gooba quit (Remote host closed the connection)
18:21:09*gooba joined #nim
18:35:06srcalright I installed nimls ; not sure about the differences atm
18:35:39srcsyntax highlighting works as well now thanks to a plugin
18:37:19srcnasuray ty for the answer
18:37:42srcand hover works as well
18:37:49srcgood that should get me going
18:51:05*derpydoo joined #nim
19:34:53FromDiscord<itr_> sent a long message, see https://pasty.ee/CxfwtuGqoNca
19:57:33FromDiscord<alex.boisvert> I think the two most common way in Nim would be:↵1) as a typed function/closure (more or less what you described above), this is the "functional way"↵2) with an object hierarchy + method(s), this is the "OO way"↵Both of these give you dynamic dispatch, such that the Strategy doesn't have to be selected at compile time. If you're ok with compile-time, then it opens up concepts/generics and compile-time conditionals.
19:57:41FromDiscord<alex.boisvert> (edit) "way" => "ways"
19:58:13*junaid_ quit (Remote host closed the connection)
19:59:17FromDiscord<itr_> In reply to @alex.boisvert "I think the two": compile time is fine, just wanted to be able to swap a strategy by just changing one argument (at compile time) ↵Do you know any examples I can look at
20:00:08FromDiscord<itr_> compile time conditionals might get a little messy though
20:41:39FromDiscord<Elegantbeef> make a proc that takes in a `static proc(...)`↵(@itr_)
21:08:28*ntat quit (Quit: Leaving)
21:10:44*def- quit (Quit: -)
21:12:04*def- joined #nim
21:15:09*def- quit (Client Quit)
21:33:54*def- joined #nim
22:50:58*xet7 joined #nim
23:01:36*lucasta joined #nim
23:30:46*gst quit (Ping timeout: 250 seconds)
23:46:50*advesperacit quit ()
23:56:19*ursa-major joined #nim