<< 24-03-2024 >>

00:01:09FromDiscord<Elegantbeef> you can just do `substr buffer` but I do not get why you're mutating the parameters
00:05:18FromDiscord<albassort> im using var buffer because it needs to write into the buffer and why make new ones
00:05:40FromDiscord<albassort> var a because i dont wanna make a new int to make sure its littleEndian
00:07:04FromDiscord<Elegantbeef> It's an array what are you really saving?
00:07:22FromDiscord<albassort> 4 cpu cycleds
00:07:24FromDiscord<albassort> (edit) "cycleds" => "cycles"
00:07:28FromDiscord<albassort> maybe more
00:09:12FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=ptyUJxPfIqhH
00:09:22FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=cqKcOxZufEBe" => "https://play.nim-lang.org/#pasty=ObIyEoGcIGQq"
00:10:08FromDiscord<tsoj> what does the `version = "0.1.0"` thing in a nimble file do?
00:10:24FromDiscord<albassort> specifies the release version
00:11:01FromDiscord<Elegantbeef> It's a dumb thing that you need to babysit
00:11:17FromDiscord<albassort> you don't need to babysit smart thing beef
00:11:35FromDiscord<albassort> (edit) "thing" => "things"
00:11:47FromDiscord<tsoj> But which implication does this have? If I understand correctly, nimble will look at the git tags anyway to determine which version to install
00:11:59FromDiscord<tsoj> In reply to @albassort "specifies the release version": But which implication does this have? If I understand correctly, nimble will look at the git tags anyway to determine which version to install
00:12:08FromDiscord<albassort> i forgor
00:12:14FromDiscord<albassort> oh
00:12:15FromDiscord<albassort> i remember
00:12:18FromDiscord<albassort> its for nimble installer
00:12:25FromDiscord<albassort> controls when people update
00:12:51FromDiscord<tsoj> so I can leave it if it's a binary project?
00:12:53FromDiscord<Elegantbeef> It's not for nimble cause nimble uses the git tags
00:13:10FromDiscord<Elegantbeef> I mean you can leave it but I do suggest properly versioning somewhere
00:13:11FromDiscord<albassort> idk what a binary project is
00:13:32FromDiscord<albassort> its probably fine if you're not releasing it for others
00:22:30FromDiscord<kdot_227> will it ever be possible to build static binaries in nim without needing the respective dll files in the same directory?
00:22:47FromDiscord<Elegantbeef> You can make static libraries already
00:22:51FromDiscord<kdot_227> (it probably is possible now just very complicated)
00:23:03FromDiscord<kdot_227> In reply to @Elegantbeef "You can make static": please point me to the documentation for this
00:23:11FromDiscord<Elegantbeef> static binaries\
00:23:28FromDiscord<Elegantbeef> https://scripter.co/nim-deploying-static-binaries/ for musl
00:24:18FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-import mentions `--dynliboverride`
00:24:29FromDiscord<Elegantbeef> As does https://nim-lang.org/docs/nimc.html#dynliboverride
00:26:23FromDiscord<kdot_227> In reply to @Elegantbeef "https://nim-lang.org/docs/manual.html#foreign-funct": so using this I can specify the libraries to link for the linker?
00:26:46FromDiscord<Elegantbeef> You can override dynamically linked libraries and tell the linker to statically link them yes
00:27:04FromDiscord<kdot_227> In reply to @Elegantbeef "You can override dynamically": thank you for the info 👍
00:28:46FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1221254344519843841/image.png?ex=6611e8bd&is=65ff73bd&hm=5980c48648ba9f7bb51a3a84e0d202e40bdc8bd293eac6fe564eef783ff2ce2e&
00:28:48FromDiscord<albassort> static is pretty easuy
00:28:50FromDiscord<albassort> (edit) "easuy" => "easy"
00:28:58FromDiscord<albassort> well
00:29:00FromDiscord<albassort> semi-static
00:29:16FromDiscord<albassort> because of gnu internal politics, you need muslc
00:29:18FromDiscord<Robyn [She/Her]> MC Rcon? Any reason why you're implementing that? :P
00:29:19FromDiscord<albassort> (edit) "because of gnu internal politics, you need muslc ... " added "or something else"
00:29:43FromDiscord<albassort> so I can use it in server daemon scripts
00:29:57FromDiscord<albassort> i also didn't like any of the other implementations
00:30:01FromDiscord<Robyn [She/Her]> In reply to @albassort "because of gnu internal": Politics? There's drama regarding static linking of glibc?
00:30:18FromDiscord<albassort> gnu is anti-static linking but has internal factions which are pro
00:30:23FromDiscord<Robyn [She/Her]> In reply to @albassort "i also didn't like": Fair enough, was just curious since I'm slowly working on an MC server in Nim :p
00:30:25FromDiscord<albassort> its kinda "political thing"
00:30:31FromDiscord<Robyn [She/Her]> Ah
00:30:59FromDiscord<albassort> In reply to @chronos.vitaqua "Fair enough, was just": theres a rust minecraft server
00:31:12FromDiscord<Robyn [She/Her]> Feather-rs, I'm assuming?
00:31:26FromDiscord<albassort> i think the concept of foreign language implementations of minecraft are pretty cool
00:31:34FromDiscord<albassort> anything to get away from java
00:32:22FromDiscord<Robyn [She/Her]> Fair lol, yeah I'm working on a server slowly and have a few libs related to it
00:32:29FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1221255282890375248/MCRconImp.nim?ex=6611e99d&is=65ff749d&hm=876466a119dd3a0ee7a884cb0d3bc9416b7e4bd98ac023f8bf6dc1d0afbd6dc4&
00:32:34FromDiscord<Robyn [She/Her]> (TagForge for NBT and ModernNet for networking-related shenanigans)
00:32:38FromDiscord<albassort> heres my implementation
00:32:43FromDiscord<albassort> pretty sure its a fully functional client
00:32:57FromDiscord<albassort> gonna write some tests after i wake up then make a CLI tool and maybe put it on the AUR
00:33:04FromDiscord<albassort> and then use it for some scripts
00:34:14FromDiscord<albassort> need to figure out if multi-line commands are supported and how to do that
00:34:20FromDiscord<albassort> (edit) "multi-line" => "multi-packet"
00:34:38FromDiscord<Robyn [She/Her]> Wait does RCON use the same/similar format that MC's Java protocol uses for packets and stuff?
00:34:58FromDiscord<albassort> no
00:35:03FromDiscord<albassort> its modern so its little endian
00:35:10FromDiscord<Robyn [She/Her]> Ooh okay
00:35:20FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1221255999105536110/image.png?ex=6611ea48&is=65ff7548&hm=b319b50aaf4fdedf89055b84f4464430ba918ebd059e5378017e32eda98fd370&
00:35:32FromDiscord<albassort> pretty standard packet foramt
00:37:33FromDiscord<Robyn [She/Her]> Fair enough
00:38:21FromDiscord<albassort> honestly robyn what i would do for a nim implementation of minecraft
00:38:26FromDiscord<kdot_227> In reply to @albassort "": would that give me the same output as using dynlibOverride?
00:38:30FromDiscord<albassort> is i would replace modules in spigot / paper
00:38:58FromDiscord<albassort> use java FFI and just slowly replace its inner functions
00:39:11FromDiscord<albassort> (edit) "use java FFI and just slowly replace its inner functions ... " added "with native binaries"
00:39:20FromDiscord<albassort> that way you can bug test as you go along
00:39:34FromDiscord<Elegantbeef> Kdot if you're using libc requring dependencies yes
00:40:04FromDiscord<kdot_227> In reply to @Elegantbeef "Kdot if you're using": I'm trying with the example code for httpclient
00:40:09FromDiscord<Robyn [She/Her]> In reply to @albassort "that way you can": Reflection would be a pain in the ass, but a Spigot compatibility layer would be super interesting
00:40:27FromDiscord<Robyn [She/Her]> Probably won't be possible though
00:40:30FromDiscord<kdot_227> which also requires the cacert.pem file
00:40:40FromDiscord<albassort> I did some testing with a native mc mod
00:40:42FromDiscord<albassort> it worked
00:40:44FromDiscord<Robyn [She/Her]> I am hoping to make whatever MC makes data-driven, the same here
00:40:51FromDiscord<albassort> although it had to go through tcp
00:41:00FromDiscord<Robyn [She/Her]> Oh wait I misunderstood what you meant :P
00:41:20FromDiscord<albassort> yeah i mean literally going into a file, and just replace all the files and logic
00:41:23FromDiscord<Elegantbeef> kdot you're on windows so you need to have the static libraries built for your C compiler
00:41:26FromDiscord<albassort> and then hook it up
00:41:37FromDiscord<albassort> (edit) removed "files and"
00:41:40FromDiscord<␀ Array 🇵🇸 🍉> java is the only reason i havent made mods for the game↵(@albassort)
00:42:02FromDiscord<albassort> honestly modding games is just not fun
00:42:08FromDiscord<albassort> feels like a job
00:42:11FromDiscord<Robyn [She/Her]> JNI would kill perf I'd imagine
00:42:22FromDiscord<Robyn [She/Her]> In reply to @albassort "honestly modding games is": What if: WASM plugin API for Java :)
00:42:37FromDiscord<Robyn [She/Her]> I've wanted to do it before but touching Java makes me feel like I'm dying
00:42:45FromDiscord<albassort> you'd need to fork the jvm
00:42:46FromDiscord<Robyn [She/Her]> I really want to do modding but 😔
00:43:03FromDiscord<kdot_227> In reply to @Elegantbeef "kdot you're on windows": I just tested with -static and it is working 👍
00:43:05FromDiscord<zumi.dxy> wasm for executables feels cursed for some reason↵but theoretically it'd make it portable↵if only because they're literally just >bytecode
00:43:23FromDiscord<Robyn [She/Her]> In reply to @chronos.vitaqua "JNI would kill perf": Panama is gonna fix that tho
00:43:27FromDiscord<albassort> well if you expose the internal api to the wasm you can use nim for it
00:43:32FromDiscord<albassort> hence the JVM hooks
00:43:36FromDiscord<Robyn [She/Her]> In reply to @zumi.dxy "wasm for executables feels": Oh definitely but for a plugin API it'd be rad
00:43:57FromDiscord<zumi.dxy> what if nim compiled to jvm bytecode 🤔
00:44:03FromDiscord<albassort> was about to say
00:44:14FromDiscord<albassort> you can also use that for a real nim script
00:44:21FromDiscord<albassort> people have tried and many have failed
00:44:31FromDiscord<albassort> by many i mean like 1
00:44:51FromDiscord<zumi.dxy> nim at one point compiled to php↵so, not the most cursed thing ever
00:45:18FromDiscord<albassort> nim running on a python interpreter
00:45:20FromDiscord<albassort> best timeline
00:45:44FromDiscord<Robyn [She/Her]> In reply to @zumi.dxy "what if nim compiled": Would be cool but it's hard
00:45:47FromDiscord<zumi.dxy> does nimpy count?
00:45:49FromDiscord<zumi.dxy> or did you mean nim to pyc
00:45:49FromDiscord<Robyn [She/Her]> I tried but gave up :P
00:45:55FromDiscord<albassort> https://github.com/mratsim/photon-jit
00:46:05FromDiscord<zumi.dxy> i've got the feeling jvm is more stable than pyc
00:46:06FromDiscord<␀ Array 🇵🇸 🍉> why doesnt the offical nim compiler do llvm?
00:46:09FromDiscord<albassort> what the mratsim
00:46:13FromDiscord<albassort> (edit) "what the mratsim ... " added "doin"
00:46:14FromDiscord<albassort> (edit) removed ""
00:46:20FromDiscord<zumi.dxy> In reply to @␀ Array 🇵🇸 🍉 "why doesnt the offical": C has more targets
00:46:54FromDiscord<Robyn [She/Her]> ^^^
00:47:01FromDiscord<albassort> c is based
00:47:04FromDiscord<albassort> c++ cringe
00:47:06FromDiscord<albassort> frfr
00:47:08FromDiscord<zumi.dxy> not enough languages compile to C anyway
00:47:18FromDiscord<␀ Array 🇵🇸 🍉> sure but couldnt c be the default but also have llvm as an option↵(@zumi.dxy)
00:47:22FromDiscord<albassort> i want a language that compiles to lua
00:47:26FromDiscord<albassort> so i dont have to write lua
00:47:37FromDiscord<Robyn [She/Her]> In reply to @␀ Array 🇵🇸 🍉 "sure but couldnt c": Nlvm is a separate thing to be fair
00:48:01FromDiscord<Robyn [She/Her]> But the reasoning for why Nim doesn't support LLVM directly is because Clang exists, probably
00:48:04FromDiscord<zumi.dxy> NIR is slowly emerging from the horizon anyway
00:48:15FromDiscord<albassort> https://github.com/hengestone/lua-languages woah
00:48:17FromDiscord<albassort> anyway offtopic
00:48:21FromDiscord<albassort> 👋
00:48:23FromDiscord<zumi.dxy> nim -> NIR -> LLVM IR -> native binary ???
00:48:24FromDiscord<Robyn [She/Her]> In reply to @zumi.dxy "NIR is slowly emerging": Is it? Haven't checked in a bit
00:48:31FromDiscord<zumi.dxy> I did give it a try one time
00:48:38FromDiscord<determiedmech1> In reply to @albassort "so i dont have": haxe?
00:48:40FromDiscord<zumi.dxy> i think i have its output somewhere
00:48:56FromDiscord<determiedmech1> lua is fun tho
00:49:17FromDiscord<zumi.dxy> 2023-12-30 https://media.discordapp.net/attachments/371759389889003532/1221259505166450699/tryfinally.nir.txt?ex=6611ed8b&is=65ff788b&hm=91f59019c03ff03cd33c056b88bd3b40a33b11d8fbfd0566e1764e2fb5564835&
00:50:01FromDiscord<zumi.dxy> sent a code paste, see https://play.nim-lang.org/#pasty=zKlcaRZnTvNj
00:50:09FromDiscord<Robyn [She/Her]> Hm neat
00:50:27FromDiscord<zumi.dxy> it might have changed in the meantime
00:50:48FromDiscord<Robyn [She/Her]> I am tempted to work on a JVM backend for Nim again, tbf... Not sure if it'd be worth it
00:51:57FromDiscord<zumi.dxy> sent a code paste, see https://play.nim-lang.org/#pasty=kcXDCzFvfNah
00:54:13FromDiscord<Robyn [She/Her]> Huh...
00:54:24FromDiscord<Robyn [She/Her]> Just type defs
01:00:02*nazgulsenpai quit (Quit: ZNC 1.8.2 - https://znc.in)
01:02:57*nazgulsenpai joined #nim
01:04:10FromDiscord<kdot_227> @ElegantBeef im slow it isn't working with httpclient anymore
01:05:24FromDiscord<kdot_227> does this only work for linux?
01:05:59FromDiscord<Elegantbeef> No
01:06:43FromDiscord<kdot_227> sent a code paste, see https://play.nim-lang.org/#pasty=ghvWoUGILhQv
01:07:04FromDiscord<kdot_227> now lets say for libcrypto
01:07:07FromDiscord<Elegantbeef> Yes for windows you need to provide the static libraries that support your compiler
01:07:12FromDiscord<kdot_227> would I do
01:07:33FromDiscord<Elegantbeef> you do `--dynlibOverride:crypt --passL:libcrypto.a` or w/e windows calls it's static libraries
01:07:45FromDiscord<Elegantbeef> There are multiple pages for 'static linking openssl' on the forum
01:08:05FromDiscord<kdot_227> In reply to @Elegantbeef "There are multiple pages": it's also sqlite3
01:08:10FromDiscord<kdot_227> and pcre
01:08:11FromDiscord<Elegantbeef> There are also alternative http clients like the one in chronos, or treeform's puppy
01:08:20FromDiscord<kdot_227> im sorry I'm just confused atm
01:08:23FromDiscord<Elegantbeef> Right you have to statically link all your libraries if you want to
01:08:34FromDiscord<Elegantbeef> The convention on windows is to dynamically link but ship the .dlls
01:08:42FromDiscord<Elegantbeef> So when in rome
01:29:32FromDiscord<kdot_227> In reply to @Elegantbeef "Right you have to": I tried the command you sent but it doesn't seem to be working
01:29:51FromDiscord<kdot_227> it's still looking for the libcrypto.dll
01:31:47FromDiscord<Robyn [She/Her]> I wonder if first making some code to turn Nim AST to JVM bytecode would be smarter than diving into the compiler straight away
01:32:14FromDiscord<Robyn [She/Her]> Probably would be smarter lol, but I wonder how much is applicable
04:32:01FromDiscord<Ethin> zevv\: when using `>1` instead of matching a rule in npeg do you need to return a bool value? Or what's the return type in the case of that example you showed me?
04:47:11FromDiscord<zumi.dxy> sent a code paste, see https://play.nim-lang.org/#pasty=EjuVuyRMTHoN
04:48:48FromDiscord<Elegantbeef> Yea not nil annotation is a pipedream and you're better off doing `Option[T]` 😄
04:49:00FromDiscord<zumi.dxy> lmfao
04:49:44FromDiscord<zumi.dxy> how much overhead does the `results` package incur over `std/option`? i'm hoping it's negligible
04:49:53FromDiscord<Elegantbeef> No clue
04:54:17FromDiscord<zumi.dxy> `Error: type mismatch: got 'Option[typeof(nil)]' for 'some(nil)' but expected 'Option[ref int]'`↵lmao you're right
04:55:27FromDiscord<Elegantbeef> I mean `Option[T]` is a 'zero cost' on top of `ref T`
04:55:35FromDiscord<Elegantbeef> It's really just a `distinct ref T` in a trenchcoat
05:47:19FromDiscord<MDuardo> Is possible to display in the same line using the JS backend?`stdout.writeLine` doesn't workSays↵Error\: undeclared identifier 'stdout'
05:47:20FromDiscord<MDuardo> C backend works fine
05:50:59FromDiscord<Elegantbeef> You need to use whatever mechanism your JS runtime has
06:26:44ZevvEthin: https://github.com/zevv/npeg?tab=readme-ov-file#custom-match-validations
06:26:59Zevvofficialy you call 'validate(true)' or `validate(false)`
06:27:21Zevvthe code block is currently implemented as a closure that can return a value, but that's no guarentee for the future
06:27:33Zevvhttps://github.com/zevv/npeg?tab=readme-ov-file#custom-match-validations
06:43:53*FromDiscord quit (Remote host closed the connection)
06:44:07*FromDiscord joined #nim
06:55:06FromDiscord<odexine> What?
07:02:52*advesperacit joined #nim
07:10:11*junaid_ joined #nim
07:13:24*ntat joined #nim
07:32:30FromDiscord<Phil> @the_mnc I'm handing you your first warning. This is 1) out of topic for this server in general 2) is flame bait and as such will lead to a ban for repeat infractions given rule 1,2,3 and 4
09:22:12FromDiscord<whisperecean> I am trying to use https://github.com/status-im/nim-confutils but if I define a version command and call a proc in the defaultValue it does not print anything
09:22:16FromDiscord<whisperecean> Am I doing something wrong?
10:09:48FromDiscord<penguinite> Can you share your code via the nim playground?
10:20:41FromDiscord<whisperecean> Not at my pc but i just took the example and instead of the first logLevel i put version and in the same file i created a proc getVersion(): string = echo “1.2.3” and put the defaultValue
10:21:22FromDiscord<whisperecean> This is only for assigning the values probably right? But i thought this is also a cli library and i can just call a proc to print stuff on the command line
10:28:36FromDiscord<penguinite> Hm, you probably want to change `echo` to `return` in that getVersion proc.
10:28:54FromDiscord<whisperecean> I think i did but that wont print it only assigns to version
10:29:56FromDiscord<penguinite> what if you do both? You will have to return something because the proc is supposed to return a string. So try adding a `echo` before `return`
10:30:10FromDiscord<whisperecean> Ill try that!
10:30:48FromDiscord<whisperecean> But would not echo automatically get assigned to result?
10:31:19*junaid_ quit (Remote host closed the connection)
10:31:40FromDiscord<penguinite> No, echo does not automatically assign anything, it has no return value
10:33:36FromDiscord<whisperecean> Great ill try that
10:33:37advesperacitecho is a macro to stdout.writeLine()
10:36:35FromDiscord<whisperecean> What would return be for that version with just echo? Empty string?
10:37:59advesperacitActually, I misremember, echo is "roughly equivalent to writeLine(stdout, x); flushFile(stdout)"
10:38:30FromDiscord<penguinite> Yes, since result is unmodified it just returns an empty string.
10:38:52FromDiscord<penguinite> (edit) "Yes, since ... result" added "the"
11:02:29FromDiscord<penguinite> Also I am not sure if this bug has been reported before, but this bit code causes Nim's compiler to segfault.↵https://play.nim-lang.org/#pasty=tqcWFbeArXBU↵↵I am a bit busy to look deep into it. But the part that makes the compiler crash is most likely the second argument to varargs.
11:10:22FromDiscord<whisperecean> Ok i tried it but it does not work that way
11:37:20advesperacitIf you gave a play.nim-lang.org link with an example of what you are trying to do it would be easier to help you
11:52:39FromDiscord<whisperecean> I solved it. I think I just misunderstood how to use the library
11:55:35*une left #nim (#nim)
12:40:09FromDiscord<srabb> how do i add 10 to a variable if "up" is true https://media.discordapp.net/attachments/371759389889003532/1221438404588339280/image.png?ex=66129428&is=66001f28&hm=295deb8faeab6ff15869d1c7bf2a402ed278d4721cc63b792b51a7644e6b57c7&
12:52:12FromDiscord<odexine> = not ==
12:52:13FromDiscord<determiedmech1> +=? https://media.discordapp.net/attachments/371759389889003532/1221441439318147162/image.png?ex=661296fc&is=660021fc&hm=dce4e5f408ba0e809c6f0fa23a9f096b8ef45c36271c95e5e2595ee7340851c8&
12:52:37FromDiscord<determiedmech1> (edit) "+=?" => "+="
12:52:44FromDiscord<determiedmech1> (edit)
12:53:29FromDiscord<srabb> In reply to @determiedmech1 "you can use +=": it works, thanks
12:54:20FromDiscord<determiedmech1> np
13:00:02*Jhonny2x4 quit (Quit: Jhonny2x4)
13:00:24*Jhonny2x4 joined #nim
13:01:20FromDiscord<srabb> https://media.discordapp.net/attachments/371759389889003532/1221443733070024794/Screencast_from_24-03-2024_025414_.webm?ex=6612991f&is=6600241f&hm=ed91d237b82ad731fb8d3d2e48509a0bd584e66ec16280a5555b3fa60b7c6a1c&
13:02:08FromDiscord<srabb> im trying to change this triangle's points' positions so that i can control it with the arrow keys (please tell me theres an easier way to do it)
13:02:13FromDiscord<srabb> im gonna ask in gamedev to
13:02:15FromDiscord<srabb> (edit) "to" => "too"
13:02:53*advesperacit quit (Ping timeout: 240 seconds)
13:03:48FromDiscord<Jotrorox> I'm new to nim but would you use a single equals and plus sign?
13:04:45*krux02 joined #nim
13:27:05FromDiscord<Phil> For what?
13:27:16FromDiscord<Phil> For assignments, sure, for equality checks the `==` is used
13:27:36FromDiscord<Phil> (edit) "For assignments, sure, for equality checks the `==` ... is" added "operator"
14:08:59*advesperacit joined #nim
15:06:29FromDiscord<myxi> make sure the variable is mutable and use += i think
15:08:08FromDiscord<Robyn [She/Her]> Anyone know if Norm supports an easy way of adding constraints to fields?
15:08:40FromDiscord<Robyn [She/Her]> I don't want to execute raw SQL but not opposed to it if I have to
15:12:35*advesperacit quit (Ping timeout: 260 seconds)
15:33:14FromDiscord<Phil> In reply to @chronos.vitaqua "Anyone know if Norm": Beyond making a field a pk field - no.
15:33:22FromDiscord<Phil> (edit) "pk" => "pk/fk"
15:34:02FromDiscord<Phil> I would not use norm to create the database.↵I'd do that with raw-sql and manage the evolution of my database-schema with something like liquibase or flyway
15:40:39FromDiscord<Robyn [She/Her]> Fair
15:41:48FromDiscord<griffith1deadly> i love nim errors https://media.discordapp.net/attachments/371759389889003532/1221484115354849400/image.png?ex=6612bebb&is=660049bb&hm=cb6f0408900a03ffdeb3ac8e431456befdcbcfc61b12391e8bd0f26d27fc79b5&
15:42:51FromDiscord<1234789> sent a code paste, see https://play.nim-lang.org/#pasty=HKejeerioTDq
15:43:50FromDiscord<solitudesf> In reply to @1234789 "Hi. I am new": https://nim-lang.org/docs/manual.html#procedures-export-marker
15:43:53*advesperacit joined #nim
15:47:45FromDiscord<1234789> In reply to @solitudesf "https://nim-lang.org/docs/manual.html#procedures-ex": Thank you!
17:46:02*dtomato quit (Ping timeout: 264 seconds)
17:50:12*dtomato joined #nim
17:55:01NimEventerNew Nimble package! pmath - library that resolves the inaccuracies of normal float math. , see https://github.com/nlits-projects/pmath
18:23:25Amun-Rafrom abnormal import math; missed opportunity
18:26:28*krux02_ joined #nim
18:29:34*krux02 quit (Ping timeout: 268 seconds)
19:35:40*ntat quit (Quit: Leaving)
20:01:03NimEventerNew question by MatrixManAtYrService: Flake fails on update, nimPackages is missing, where has it gone?, see https://stackoverflow.com/questions/78215937/flake-fails-on-update-nimpackages-is-missing-where-has-it-gone
20:25:18NimEventerNew Nimble package! avrman - A tool for managing nim and c projects targetting AVR microcontrollers., see https://github.com/Abathargh/avrman
21:10:47*arkanoid quit (Ping timeout: 264 seconds)
21:15:54FromDiscord<zumi.dxy> one of the QRTs of this tweet says it's "a GC'd language problem"↵in Nim I really had to try in order to have this kind of behavior↵https://x.com/i/status/1770528106513600636
21:16:02FromDiscord<zumi.dxy> sent a code paste, see https://play.nim-lang.org/#pasty=wjLXNXewsuAI
21:16:19FromDiscord<zumi.dxy> sent a code paste, see https://play.nim-lang.org/#pasty=tqaeAZhWDXtX
21:17:04FromDiscord<zumi.dxy> i'm curious↵can getting the behavior of the first one be made easier
21:19:44*advesperacit quit ()
21:20:08FromDiscord<zumi.dxy> honestly, i'd say this is more a "dynamically typed language" problem or something
21:20:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=qpNkYkTMbUIH
21:20:19FromDiscord<Elegantbeef> It's not even dynamic type problem
21:20:22FromDiscord<Elegantbeef> It's a class based problem
21:20:33FromDiscord<Elegantbeef> Any language that makes it's data types `ref` will have this problem
21:20:41FromDiscord<Elegantbeef> It also arises in C# if you use `List<T>`
21:24:43FromDiscord<zumi.dxy> is there a "non-ref" equivalent of `List<T>` there?↵or is it just its array type
21:25:08FromDiscord<Elegantbeef> Even arrays are refs
21:25:19FromDiscord<Elegantbeef> Since C# does not have value type arrays
21:26:10FromDiscord<zumi.dxy> oh boy
21:26:54FromDiscord<zumi.dxy> hang on, seqs are refs in nim right?↵except that you can't just do `[[]] 4`
21:27:12FromDiscord<Elegantbeef> No
21:27:19FromDiscord<Elegantbeef> In Nim seqs are treated as value types
21:27:39FromDiscord<zumi.dxy> 🤔
21:28:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=VctiTvvDBpCZ
21:29:59FromDiscord<zumi.dxy> so to make `b == a` you either have to copy the seq or make `b` a reference to `a` right?
21:32:17FromDiscord<Elegantbeef> Right
21:32:31FromDiscord<Elegantbeef> Or use a ptr but even then you'd have to do `b[] == a`
21:32:39FromDiscord<zumi.dxy> yeah
21:36:03FromDiscord<Elegantbeef> People often like blaming GC for no reason other than it's a scary word
21:36:04FromDiscord<Elegantbeef> It's the "thanks obama" of the programming world
21:36:38FromDiscord<zumi.dxy> lmao
21:36:40FromDiscord<haywiressc> sent a code paste, see https://play.nim-lang.org/#pasty=CHOkvNzfVPwJ
21:36:49FromDiscord<haywiressc> I am having a simple problem with openarray
21:37:16FromDiscord<haywiressc> I create the variable game and it is of type seq[Board]
21:37:35FromDiscord<Elegantbeef> hopefully `type` is not a field name
21:37:42FromDiscord<haywiressc> sent a code paste, see https://play.nim-lang.org/#pasty=VXPwQhFzwhEf
21:37:48FromDiscord<haywiressc> it does not let me
21:37:58FromDiscord<Elegantbeef> Of course it won't
21:38:04FromDiscord<Elegantbeef> you're doing `newSeq[Board]`
21:38:33FromDiscord<haywiressc> oops
21:38:33FromDiscord<haywiressc> lmao
21:38:35FromDiscord<Elegantbeef> That allocates a sequence of `Board`s which means it's `seq[Board]`
21:38:44FromDiscord<haywiressc> i genuinely thought I had written Game and not board
21:38:52FromDiscord<Elegantbeef> `openArray` also can only be a parameter
21:38:58FromDiscord<haywiressc> In reply to @haywiressc "i genuinely thought I": i was stuck for like 20 mins
21:39:01FromDiscord<Elegantbeef> There is no reason to use openarray in the above
21:39:09FromDiscord<Elegantbeef> `game` will always be `seq[Board]`
21:39:15FromDiscord<haywiressc> In reply to @haywiressc "i was stuck for": nvm
21:39:22FromDiscord<haywiressc> (edit) "https://play.nim-lang.org/#pasty=UczzQBLOftWi" => "https://play.nim-lang.org/#pasty=nfMsNxHMAnfb"
21:39:34FromDiscord<haywiressc> In reply to @Elegantbeef "`openArray` also can only": oh right
21:39:35FromDiscord<Elegantbeef> The reason for openArray is to allow a procedure to accept either `seq[T]` or `array[I, T]` or a 0 cost slice of them
21:39:46FromDiscord<haywiressc> so my type has to be either seq or array then ig
21:39:52FromDiscord<Elegantbeef> Correct
21:39:57FromDiscord<haywiressc> thanks
21:40:18FromDiscord<haywiressc> sent a code paste, see https://play.nim-lang.org/#pasty=CjrlYqRIqJPm
21:40:35FromDiscord<Elegantbeef> If you say so
21:41:02FromDiscord<Elegantbeef> `Board = set[0..63]` is much better
21:41:22FromDiscord<Elegantbeef> It's much smaller 😄
21:41:58FromDiscord<haywiressc> In reply to @Elegantbeef "`Board = set[0..63]` is": really?
21:42:15FromDiscord<Elegantbeef> If we care about performance and allocations, yes
21:42:22FromDiscord<Elegantbeef> It's only 8 bytes vs. 64bytes
21:42:31FromDiscord<haywiressc> like different int for each piece and include it in the set if the bool in my code would had been true?
21:42:39FromDiscord<haywiressc> In reply to @Elegantbeef "If you say so": i mean not much better but it works xd
21:42:43FromDiscord<Elegantbeef> You do need to do `(x + y width) in mySet`
21:43:10FromDiscord<Elegantbeef> In Nim a `set` is a bitset so in the above you have a 64bit integer internally to represent all the state instead of 64 bools
21:43:10FromDiscord<haywiressc> In reply to @Elegantbeef "You do need to": wdym
21:43:48FromDiscord<haywiressc> 8 8 sizeof bool amount of boards?
21:44:04FromDiscord<haywiressc> In reply to @Elegantbeef "In Nim a `set`": ohhh i see
21:44:05FromDiscord<haywiressc> nice
21:44:09FromDiscord<haywiressc> 1 bit insted of 8
21:44:10FromDiscord<Elegantbeef> vs 8 \ amount of boards
21:44:27FromDiscord<haywiressc> yeah
21:44:35FromDiscord<Elegantbeef> You do have to convert the xy into a single integer but the math is simple
21:45:08FromDiscord<haywiressc> yeah
21:45:22FromDiscord<haywiressc> i mean what I am doing is code to test other code so performance is not important but why not
21:47:07FromDiscord<Elegantbeef> You can almost play an entire game of chess just sending an integer of the board state each move!
21:47:18FromDiscord<MDuardo> For a moment I thought you were compiling to a Commodore 64 or something
21:47:45FromDiscord<Elegantbeef> Hey we have bitsets so we best use them
21:47:54FromDiscord<Elegantbeef> Pretty much no other language has builtin bitsets
21:47:56FromDiscord<zumi.dxy> if i'm reading this correctly, sets don't store positional information right?
21:47:59FromDiscord<Elegantbeef> Hold it over them!
21:48:19FromDiscord<zumi.dxy> In reply to @Elegantbeef "Pretty much no other": it's a really handy feature
21:48:22FromDiscord<Elegantbeef> Sets are bitsets they're either an integer of the smallest size that can hold each entry or an array of `uint8`
21:48:44FromDiscord<Elegantbeef> Atleast on the C/C++ backend
21:48:48FromDiscord<Elegantbeef> In the VM they're just a sequence
21:49:07FromDiscord<Elegantbeef> On JS they're probably also a sequence, but I do not know
21:49:17FromDiscord<zumi.dxy> `if {someDisplayFlag, otherDisplayFlag} in someIOaddrThatControlsDisplays`
21:49:38FromDiscord<Elegantbeef> Yep they're so much nicer since they're more structured
21:49:51FromDiscord<zumi.dxy> looks more obvious than playing around with boolean operations
21:50:19FromDiscord<zumi.dxy> In reply to @MDuardo "For a moment I": now I imagine C64 demos written in Nim…
21:50:39FromDiscord<Elegantbeef> https://github.com/beef331/reflector/blob/master/reflector.nim#L251-L253 Thanks to them I wrote a very simple router using inotify 😄
21:50:56FromDiscord<Elegantbeef> Can just use any set of events you want to care about and you can assign a procedure to them
21:51:30FromDiscord<zumi.dxy> the compile-time facilities would come in really handy there↵LUTs for complex math operations…
21:53:03FromDiscord<Elegantbeef> Can also abstract much more tedious things with macros but get optimised code
21:54:04FromDiscord<Elegantbeef> There's even that lovely hidden goto feature using case statements and enums instead of labels 😄
21:57:03FromDiscord<Elegantbeef> https://github.com/mratsim/constantine/blob/976c8bb215a3f0b21ce3d05f894eb506072a6285/constantine/math/arithmetic/bigints.nim#L744 for an example of that goto
21:57:42FromDiscord<Elegantbeef> It uses case branches and enum values to indicate goto, which means it's again more structured than the conventional method
21:59:19FromDiscord<MDuardo> Why has to explain why used Nim?↵Guys over Rust do entire just rewrites just do say it's written in Rust™
21:59:44FromDiscord<Elegantbeef> It's an obscure language people will always go "but yea why not the more popular Z"
22:00:41FromDiscord<MDuardo> Wish a company boosted Nim's popularity a little bit
22:01:05FromDiscord<MDuardo> Or a large project
22:06:13FromDiscord<Elegantbeef> Sorry the best that we can do is use a shitty heuristic and report all Nim software as malware
22:07:00FromDiscord<zumi.dxy> In reply to @MDuardo "Or a large project": Nitter is probably the closest thing to a large Nim project with tons of exposure
22:07:32FromDiscord<zumi.dxy> it's a twitter proxy↵elon's changes to twitter has rendered it very useful for all of 10 seconds
22:07:40FromDiscord<zumi.dxy> (edit) "even ifit's ... a" added "just"
22:09:17FromDiscord<zumi.dxy> In reply to @MDuardo "Wish a company boosted": Meanwhile, this would be status.im↵I'm not sure how much reach they have but they are at least taking Nim seriously
22:09:54FromDiscord<haywiressc> In reply to @Elegantbeef "Pretty much no other": To be fair it's not hard to do something similar for this in c
22:10:09FromDiscord<Elegantbeef> No one said it was hard
22:10:12FromDiscord<Elegantbeef> But it's not structured
22:10:34FromDiscord<zumi.dxy> it's the kind of thing you may need comments above the line that does it
22:10:35FromDiscord<Elegantbeef> You can take any ordinal and make a set of a range in Nim
22:10:43FromDiscord<Elegantbeef> This gives you type safety
22:11:02FromDiscord<Elegantbeef> you can never do 'a' in {0u8}\`
22:11:28FromDiscord<Elegantbeef> Plus you can just do `{0u8 .. 10u8}` and don't have to futz around 😛
22:11:49FromDiscord<zumi.dxy> 'cept if you cast it probably, but that's an explicitly unsafe operation :p
22:12:30FromDiscord<zumi.dxy> people say we need `unsafe` blocks, but if we had they won't be happy anyway
22:12:35FromDiscord<haywiressc> In reply to @Elegantbeef "Plus you can just": I haven't used nim in a while, the .. means range so that makes bitset including 0 through to 10?
22:12:46FromDiscord<Elegantbeef> Yes
22:13:30FromDiscord<zumi.dxy> i forgot if mojo offered `unsafe` blocks↵given it's whole "Rust but with Python syntax" thing
22:13:49FromDiscord<Elegantbeef> It's also `u8` which means you cannot do `someInt in mySet`
22:13:56FromDiscord<Elegantbeef> It must be a `uint8`
22:14:14FromDiscord<Elegantbeef> Zumi I do think it'd be cool if Nim used it's effect tracking to tag unsafe operations with `unsafe`
22:14:42FromDiscord<Elegantbeef> But you can always just `grep` for `addr` `cast` `ptr`
22:15:23FromDiscord<Elegantbeef> Before you say "But what about style insensitivity" fairly certain someone made a script that'd convert an identifier to a style insensitive regex pattern
22:15:50FromDiscord<haywiressc> In reply to @zumi.dxy "Nitter is probably the": Surely nim will grow eventually
22:16:18FromDiscord<haywiressc> I mean like it's such a nice language to use
22:29:06FromDiscord<MDuardo> It's great that this exist, but as I don't use cryto, I have no use for this↵(@zumi.dxy)
22:31:50FromDiscord<zumi.dxy> In reply to @Elegantbeef "Before you say "But": that's just called `nimgrep` 😛
22:32:02FromDiscord<Elegantbeef> I mean no, but yes
22:32:17FromDiscord<zumi.dxy> In reply to @haywiressc "Surely nim will grow": it's been here for quite a while
22:36:43FromDiscord<zumi.dxy> In reply to @Elegantbeef "Zumi I do think": you're saying the compiler should be like: "I've got at least one instance of `addr` `cast` `ptr` so I have an `UnsafeEffect`"↵wonder how much it would break existing code
22:36:49FromDiscord<zumi.dxy> (edit) "`UnsafeEffect`"↵wonder" => "`UnsafeEffect`"?↵wonder"
22:37:08FromDiscord<Elegantbeef> It wouldn't
22:37:26FromDiscord<Elegantbeef> It only breaks code that uses `tags: []` which is pretty much none
22:37:40FromDiscord<zumi.dxy> ah
22:38:15FromDiscord<zumi.dxy> oh yeah, `forbids: [Unsafe]` would be cool to see
22:38:48FromDiscord<zumi.dxy> but then there's safe code wanting to call unsafe code...
22:39:00FromDiscord<zumi.dxy> because it should be a safe abstraction over it
22:39:20FromDiscord<zumi.dxy> btw, i forgot what the difference is between `pointer` and `ptr`
22:39:25FromDiscord<Elegantbeef> Imagine if there was a way to tell the compiler "I know it's not safe but I want it to be safe" 😄
22:39:35FromDiscord<Elegantbeef> `pointer` is `void` in C
22:39:39FromDiscord<Elegantbeef> `ptr T` is `T` in C
22:39:45FromDiscord<zumi.dxy> ah
22:40:08FromDiscord<zumi.dxy> `tags: [TrustMeBroImSafe]`
22:40:18FromDiscord<Elegantbeef> No
22:40:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=czNHpAHQfith
22:41:06FromDiscord<zumi.dxy> wait, can you actually cast tags...?
22:41:23FromDiscord<Elegantbeef> You can cast raises
22:41:25FromDiscord<Elegantbeef> So I don't see why not
22:41:30FromDiscord<zumi.dxy> hmm...
22:42:24FromDiscord<zumi.dxy> y'know, people bring up the "what if the libraries you're pulling up are unsafe" thing↵but uhh↵quite a few rust libs have `unsafe{}` in them by necessity or otherwise
22:42:56FromDiscord<Elegantbeef> That's the entire point of `unsafe` though
22:43:14FromDiscord<Elegantbeef> The thing is though in the Rust world unsafe blocks are hidden
22:43:22FromDiscord<zumi.dxy> and a portion of `cve-rs` could also hide in some packages because compiler bugs, but miri would catch it
22:44:29FromDiscord<zumi.dxy> cue the "actix, y u use unsafu?????" shenanigans of yesteryear
22:44:42FromDiscord<Elegantbeef> I think the elimination of `unsafe` is a fine idea but this means that all your code has to be compiled in one shot
22:44:54FromDiscord<Elegantbeef> If you want 0 unsafe code no component you rely on must use unsafe code
22:45:12FromDiscord<Elegantbeef> Which means everything from the kernel to your system libraries need some mark of "this is not unsafe" 😄
22:45:38FromDiscord<Elegantbeef> Plus Rust does not have overflow checks in release builds so.... what is unsafe?
22:48:42FromDiscord<zumi.dxy> some things still need to be checked at run time it turns out 😏
22:50:09FromDiscord<zumi.dxy> In reply to @Elegantbeef "That's the entire point": i thought it was for basically sectioning off the unsafe parts of the code so that inspection can be made easier, because anything outside it is guaranteed to be Safe™️
22:51:26FromDiscord<Elegantbeef> Unsafe exists to be used
22:51:44FromDiscord<Elegantbeef> If you need to do something that the Rust language considers unsafe but you know is safe you need to be able to tell it that
22:51:59FromDiscord<zumi.dxy> yeah
22:52:03FromDiscord<Elegantbeef> If a library uses unsafe blocks what is a reasonable person supposed to do
22:52:12FromDiscord<zumi.dxy> "i paid for the unsafe i'm gonna use the whole unsafe"
22:52:20FromDiscord<Elegantbeef> Lol
22:52:40FromDiscord<Elegantbeef> Rewrite everything in Rust and compile everything into a single unit to ensure the code has no unsafe
22:54:51FromDiscord<zumi.dxy> people unironically want that↵"if there is no more C in this world we wouldn't have to use unsafe"
22:55:01FromDiscord<zumi.dxy> something something cross language exploits
22:55:22FromDiscord<Elegantbeef> Ah yes the only way to write code is my way to write code
22:55:58FromDiscord<zumi.dxy> i wonder how rust programs interact with redox syscalls
22:56:42FromDiscord<zumi.dxy> In reply to @Elegantbeef "Ah yes the only": there's also the fact that dealing directly with hardware is inherently unsafe↵at some point there has to be an interface between the two
22:57:07FromDiscord<Elegantbeef> Nah just use a rust covered iron beam
22:57:10FromDiscord<zumi.dxy> zero probably doesn't actually mean zero, just "reduced surface area"
22:58:01FromDiscord<Elegantbeef> Is this where I mention linked lists exist
22:59:25FromDiscord<zumi.dxy> the rust people would say linked lists are terrible so it doesn't count :p
23:00:01FromDiscord<zumi.dxy> have a big array of things instead that is never reallocated if the capacity happens to be smaller
23:00:18FromDiscord<zumi.dxy> (which i think is what nim also does anyway)
23:00:25FromDiscord<Elegantbeef> Eh data oriented design is nice
23:02:53FromDiscord<Elegantbeef> I'm just annoyed at how tedious it is to get a cstring in Rust 😛
23:03:40FromDiscord<Elegantbeef> I've wrote a small thing to use a dynamic library and just wanted to use cstrings, but you have to use a procedure to allocate them then get use `c_str()` on them
23:12:34FromDiscord<MDuardo> What data oriented is supposed to be?↵Odin is advertised as such
23:13:15FromDiscord<Elegantbeef> Data oriented design is about designing the solution to a problem to be the most cache efficient for the cpu
23:13:23FromDiscord<Elegantbeef> This reduces pointer chasing and cache trashing
23:13:49FromDiscord<Elegantbeef> Since most systems have a 64byte cache line if your data is small enough querying a single element of a sequence can get you the ones in front of it
23:14:17FromDiscord<Elegantbeef> It's pretty much why linked lists are slower than sequences
23:14:35FromDiscord<Elegantbeef> Pointer indirection means you're very unlikely to get any useful information when you query memory
23:34:04FromDiscord<bosinski2023> In reply to @Elegantbeef "Since most systems have": i just learned that the ARM/Apple M-cpus all have 128-byte cache-lines.
23:40:08FromDiscord<Elegantbeef> Big cache lines and bigger caches really are magical
23:43:37FromDiscord<bosinski2023> In reply to @Elegantbeef "Big cache lines and": i like big-stuff, too. BTW: the latest ARM SIMD/Vector-extensions give you the avail. vector-length at runtime - not before. And intel announced they will do the same, soon.. thats funny for people who do anything with SIMD
23:47:51FromDiscord<Robyn [She/Her]> In reply to @zumi.dxy "i wonder how rust": Redox?
23:50:47FromDiscord<zumi.dxy> Redox OS
23:51:45FromDiscord<zumi.dxy> the "you want a kernel written in Rust? you got a kernel written in Rust" OS