<< 10-11-2022 >>

00:00:00FromDiscord<abby.> but the lexer kinda needs to get the token and then increment the position afterward no?
00:00:08FromDiscord<abby.> not increment and then get the token
00:00:25FromDiscord<abby.> (edit) "the" => "my"
00:00:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsY
00:01:13FromDiscord<Elegantbeef> Are you saying "how do you implement post increment"
00:02:04FromDiscord<abby.> yes for my lexer
00:02:11FromDiscord<Elegantbeef> You then just post increment
00:02:11FromDiscord<ChocolettePalette> It must be possible with macros
00:02:15FromDiscord<abby.> since i need to get the current token and then increment
00:02:19FromDiscord<Elegantbeef> why bring macros into this
00:02:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsZ
00:03:00FromDiscord<abby.> gotcha
00:03:28FromDiscord<ChocolettePalette> `for (int i = 0; i < 1; ++i) cout << i << '\n'`
00:03:28FromDiscord<abby.> so similar to how it would work in other languages without ++ then
00:04:19FromDiscord<ChocolettePalette> If you change ++i to i++, behaviour will change
00:04:23FromDiscord<Elegantbeef> `for i in 0..0: echo i`?
00:04:45FromDiscord<Elegantbeef> or `for i in 1..0: echo i`
00:04:48FromDiscord<Elegantbeef> Eitherway you can get the same semantics in a more readable way
00:06:55FromDiscord<ChocolettePalette> How about if you need to write smth like`++i - j++`?
00:09:42FromDiscord<Elegantbeef> How about you quit trolling and go write some real code
00:11:10FromDiscord<huantian> beef you can't just call someone out like that
00:13:34arkanoidis there a limit to the amount of possible ayncCheck branches in an async program, beside and other very large variables?
00:13:44arkanoid*beside ram
00:14:30FromDiscord<huantian> I don't think so?
00:20:54FromDiscord<ChocolettePalette> In C++ there's a very readable operator originating fron math "X approaches N" where X is a variable and N is a constant, used like this\:`for (int x = 100; x-->0;) cout << x << endl;`But it seems that it can't be achieved in Nim without post-increment/decrement 😔
00:21:16FromDiscord<Elegantbeef> Really going for those deep trolls today
00:21:53FromDiscord<Elegantbeef> `for x in countDown(100, 0)` you happy?!
00:22:32FromDiscord<ChocolettePalette> Oooo well it lacks a funny arrow but saves many butes actually so yes I am!
00:25:39FromDiscord<huantian> In reply to @ChocolettePalette "In C++ there's a": right but that notation doesn't even make sense coming from mathematics
00:27:25FromDiscord<ChocolettePalette> sent a code paste, see https://play.nim-lang.org/#ix=4ft3
00:27:44FromDiscord<huantian> right but have you considered what the limit actually means in mathematics
00:28:48FromDiscord<ChocolettePalette> No 😔 I only duckduckgoogled it because it has that arrow just like C++
00:29:25FromDiscord<Elegantbeef> "that arrow"
00:29:37FromDiscord<Elegantbeef> Joining two operators together stealthly isnt a new operator
00:30:23FromDiscord<ChocolettePalette> Well you can define operator --\> in Nim fortunately
00:30:34FromDiscord<ChocolettePalette> Omg and you can actually use it
00:30:37FromDiscord<Elegantbeef> can even make it an iterator
00:30:54FromDiscord<abby.> In reply to @ChocolettePalette "In C++ there's a": i hate this so much
00:31:34FromDiscord<abby.> also cant u do
00:31:56FromDiscord<abby.> sent a code paste, see https://play.nim-lang.org/#ix=4ft8
00:32:02FromDiscord<Elegantbeef> Correct
00:32:07FromDiscord<abby.> i fucking hate this
00:32:10FromDiscord<abby.> why \
00:32:11FromDiscord<abby.> (edit) removed "\"
00:32:11FromDiscord<Elegantbeef> like i said you can even make it an iterator
00:32:15FromDiscord<abby.> oh dear god
00:32:35FromDiscord<abby.> cant wait for `<$>` operator like in haskell
00:32:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ft9
00:33:08FromDiscord<abby.> close enough
00:33:11FromDiscord<abby.> https://media.discordapp.net/attachments/371759389889003532/1040061524070367293/image.png
00:33:45FromDiscord<Elegantbeef> User defined operators arent that bad, it's dumbly defined ones
00:33:45FromDiscord<Elegantbeef> I mean even C++ got it wrong with `<<` in iostream
00:34:16FromDiscord<abby.> oh just you wait
00:34:45FromDiscord<abby.> sent a code paste, see https://play.nim-lang.org/#ix=4ftb
00:35:33FromDiscord<Elegantbeef> See dumbly defined
00:35:35FromDiscord<abby.> not the exact same but ill take it
00:35:52FromDiscord<abby.> i could define
00:35:53FromDiscord<Elegantbeef> Yea you leftout the state machine
00:36:18FromDiscord<Elegantbeef> You can do exactly what C++ does with Nim's
00:36:33FromDiscord<abby.> oh god
00:36:36FromDiscord<abby.> i hate that
00:36:36FromDiscord<ChocolettePalette> sent a code paste, see https://play.nim-lang.org/#ix=
00:37:17FromDiscord<ChocolettePalette> sent a code paste, see https://play.nim-lang.org/#ix=4ftc
00:37:55FromDiscord<ChocolettePalette> ah you already made it
00:38:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ftd
00:40:41FromDiscord<Elegantbeef> Technically I should've made an Enum but alas
00:42:23FromDiscord<ChocolettePalette> sent a code paste, see https://play.nim-lang.org/#ix=4ftg
00:45:37FromDiscord<Elegantbeef> See i've never used words that have even got me threatened to be banned but chocolette here.... 😛
00:48:30FromDiscord<abby.> @ElegantBeef any idea whats going on w/ this?
00:48:39FromDiscord<abby.> sent a code paste, see https://play.nim-lang.org/#ix=4fti
00:48:56FromDiscord<abby.> wait i fixed it
00:52:46FromDiscord<DecentArmchair> sent a code paste, see https://play.nim-lang.org/#ix=4ftj
00:53:29FromDiscord<DecentArmchair> The problematic line (135):↵`(Result).align = 0;`
00:54:11FromDiscord<DecentArmchair> Looks like the code generates right below it at line 137:↵`(Result).align = ((TextProperties::Alignment) 2);`
00:54:36FromDiscord<DecentArmchair> Any idea where to go from here? Am I missing something needed to cast the initial result the code generates before assigning to it?
00:57:00FromDiscord<Elegantbeef> Well firstly `align: TextProperties.Alignment` is invalid
00:57:18FromDiscord<Elegantbeef> It should be `align: TextProperties`
00:57:33FromDiscord<Elegantbeef> Secondly how do you import `TextProperties`?
00:58:32FromDiscord<abby.> whats the best way of doing docstrings in nim?
00:58:33FromDiscord<DecentArmchair> (Much needed) background info:↵Using the nim-panda3d bindings from here:↵https://github.com/rdb/nim-panda3d/
00:58:48FromDiscord<Elegantbeef> Using doc comments `## This is a doc comment`↵(@abby.)
00:59:00FromDiscord<abby.> @DecentArmchair also unrelated but cool to meet another trans person
00:59:10FromDiscord<DecentArmchair> sent a code paste, see https://play.nim-lang.org/#ix=4ftk
00:59:10FromDiscord<abby.> In reply to @Elegantbeef "Using doc comments `##": inside the function or outside?
00:59:16FromDiscord<Elegantbeef> Inside
00:59:17FromDiscord<DecentArmchair> In reply to @abby. "<@197933326261026816> also unrelated but": Howdy 🤠
00:59:50FromDiscord<Griphcode きつね> hi
00:59:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ftl
01:00:02FromDiscord<Elegantbeef> You can use `##` or `##[comment here]##` for multi line comments
01:00:50FromDiscord<DecentArmchair> In reply to @Elegantbeef "Well firstly `align: TextProperties.Alignment`": I was told that was the intended way to use the type
01:00:51FromDiscord<Elegantbeef> I dont know the C++ backend much but i think something is up with the bindings
01:01:23FromDiscord<DecentArmchair> sent a code paste, see https://play.nim-lang.org/#ix=4ftn
01:01:31FromDiscord<Elegantbeef> Eh i'm looking at their code they do things weid
01:01:33FromDiscord<Elegantbeef> weird\
01:01:54FromDiscord<Elegantbeef> They have TextPropertiesAlignmnent\` but you have to access it using a dot operator
01:03:26FromDiscord<abby.> @ElegantBeef i more am asking how do i document parameters of functions
01:03:31FromDiscord<Elegantbeef> This reads a lot like someone wants their code to be like C++ and not Nim, but anyway i think it's with the backend Nim thinks it can zero the memory by doing `= 0` but it needs to do something different
01:03:39FromDiscord<Elegantbeef> Read the stdlib↵(@abby.)
01:03:45FromDiscord<DecentArmchair> In reply to @Elegantbeef "They have TextPropertiesAlignmnent\` but": I can edit the library to access that and get what I need working, but I was looking to use as intended and something seems to be specifically up with the generated file not catching the type
01:03:59FromDiscord<DecentArmchair> In reply to @Elegantbeef "This reads a lot": Thoughts on how I should proceed then?
01:04:03FromDiscord<abby.> is there a page on documenting functions or something or do i have to read the stdlib code
01:04:10FromDiscord<Elegantbeef> I havent used the C++ interop ever so nope
01:04:19FromDiscord<abby.> https://nim-lang.org/docs/docgen.html↵foudn this
01:04:21FromDiscord<Elegantbeef> The stdlib documents cod
01:04:22FromDiscord<Elegantbeef> code\
01:04:37FromDiscord<Elegantbeef> Look at a module, click on `source` then see what they do
01:04:45FromDiscord<DecentArmchair> In reply to @Elegantbeef "I havent used the": Thanks for helping regardless <3
01:05:19FromDiscord<Elegantbeef> Holy shit the swizzle code in `core.nim`
01:05:46FromDiscord<Elegantbeef> Jesus fucking christ 😄
01:05:57FromDiscord<Elegantbeef> That's thousands of lines of swizzle code
01:06:17FromDiscord<huantian> what's a swizzle
01:06:35FromDiscord<Elegantbeef> Accessors for like `.xzz` on a vector
01:06:53FromDiscord<huantian> ah
01:07:26FromDiscord<DecentArmchair> In reply to @huantian "what's a swizzle": https://media.discordapp.net/attachments/371759389889003532/1040070146150113310/image.png
01:07:30FromDiscord<Elegantbeef> https://github.com/GaryMcWhorter/slam/blob/main/src/slam/vectors/vectors.nim#L58-L158 Way less code to use the dotoperators
01:08:09FromDiscord<Elegantbeef> It's certainly the reason github doesnt embed the file
01:08:14FromDiscord<Elegantbeef> It also slows down compilation
01:08:23FromDiscord<alice.> In reply to @DecentArmchair "": what the actual fuck
01:09:14FromDiscord<Elegantbeef> They wanted swizzles for their vector types
01:09:25FromDiscord<Elegantbeef> It's perfectly reasonable assuming you didnt know about dotoperators
01:09:37FromDiscord<Elegantbeef> Or Nim macros in anyregard
01:09:47FromDiscord<Elegantbeef> I'd prefer a `.swizzle(xzz)` over that mess
01:10:03FromDiscord<DecentArmchair> In reply to @alice. "what the actual fuck": The code generation is actually insane
01:10:21FromDiscord<DecentArmchair> > i love it
01:10:35FromDiscord<Elegantbeef> Well if anyone wants to make that code cleaner the above solutions are much easier
01:20:44FromDiscord<alice.> also are seq just mutable arrays?
01:21:13FromDiscord<huantian> mutable length
01:21:18FromDiscord<alice.> In reply to @DecentArmchair "The code generation is": is this for swizzling?
01:21:26FromDiscord<alice.> In reply to @huantian "mutable length": as in u can push/pop items?
01:21:30FromDiscord<huantian> ye
01:21:35FromDiscord<Elegantbeef> They're growable arrays
01:21:59FromDiscord<alice.> also whats the convention for const variables
01:22:09FromDiscord<alice.> camelCase or SHOUT_CASE
01:22:26FromDiscord<Elegantbeef> NEP1 suggests upper pacal iirc
01:23:00FromDiscord<huantian> yeah that or camelCase
01:23:29FromDiscord<Elegantbeef> Shout case is the worst, but luckily Nim has style insensitivity
01:33:38FromDiscord<alice.> In reply to @Elegantbeef "Shout case is the": wdym by style insensitivity
01:34:07FromDiscord<Elegantbeef> Nim only cares about the first character's casing
01:34:12FromDiscord<Elegantbeef> `myVar` == `myvar`
01:34:36FromDiscord<Elegantbeef> `MyVar` != `myVar`
01:35:44FromDiscord<alice.> oh thats very cool
01:36:11FromDiscord<Elegantbeef> So weird when someone says that's nice, given so many that dont use Nim despise it
01:36:23FromDiscord<alice.> why would u despise it
01:36:30FromDiscord<alice.> if u have two variables that differ only by casing
01:36:33FromDiscord<alice.> what the fuck are you doing
01:36:53FromDiscord<Rika> That’s what we’ve been fucking telling everyone else but they still be saying “what the fuck” lmao
01:36:59FromDiscord<alice.> this just means u can pick one and be consistent
01:37:10FromDiscord<alice.> no one is saying use one at random every 10 lines
01:37:13FromDiscord<Elegantbeef> But "My C `GlFloat` and `glFloat` 😄
01:37:16FromDiscord<Rika> Lol
01:37:29FromDiscord<alice.> In reply to @Elegantbeef "But "My C `GlFloat`": these are different types no?
01:37:33FromDiscord<Elegantbeef> Sorry it's `GlFloat` and `Gl_Float`
01:37:40FromDiscord<Elegantbeef> Nim also doesnt see `_` in names
01:37:44FromDiscord<Elegantbeef> So those are the same
01:37:49FromDiscord<Elegantbeef> And my response is the same
01:37:52FromDiscord<alice.> In reply to @Elegantbeef "Sorry it's `GlFloat` and": why are they distinct
01:37:53FromDiscord<Elegantbeef> Good riddance
01:38:07FromDiscord<Elegantbeef> Dont look at me i didnt write opengl 😄
01:38:13FromDiscord<alice.> thank god
01:38:21FromDiscord<alice.> i would have admitted u to an asylum lol
01:38:27FromDiscord<alice.> opengl is a mess
01:38:32FromDiscord<Rika> In reply to @alice. "why are they distinct": Only god knows
01:38:44FromDiscord<alice.> i wonder if its some weird C struct namespacing thing?
01:38:45FromDiscord<alice.> but idk
01:38:47FromDiscord<Elegantbeef> `GLfloat` is a type `GL_Float` is a enum
01:39:09FromDiscord<alice.> why would u name the enum the same as the type????
01:39:15FromDiscord<Elegantbeef> Cause C
01:39:28FromDiscord<alice.> call it like `GLFloat` and `GLFloatType` or `GLFloatProperty`
01:40:24FromDiscord<Elegantbeef> Yep but it's a reason why people dislike it "It makes C interop hard", "It's allows inconsistent code"
01:41:05FromDiscord<Elegantbeef> https://github.com/nim-lang/RFCs/issues/456 if you ever are bored and want a read
01:51:04FromDiscord<alice.> @ElegantBeef how do i make a subtype in nim?
01:51:19FromDiscord<alice.> object that has properties of another object
01:53:04FromDiscord<banan|crab> i dont get this error
01:53:06FromDiscord<banan|crab> https://media.discordapp.net/attachments/371759389889003532/1040081635141505074/unknown.png
01:53:11FromDiscord<banan|crab> i get it when doing a post request
01:53:34FromDiscord<alice.> @banan|crab fellow nim user :0
01:53:37FromDiscord<Elegantbeef> do you have `libcrypto` installed?
01:55:11FromDiscord<banan|crab> https://media.discordapp.net/attachments/371759389889003532/1040082163518930945/unknown.png
01:55:28FromDiscord<banan|crab> In reply to @Elegantbeef "do you have `libcrypto`": no
01:55:31FromDiscord<banan|crab> how do i install it
01:55:38FromDiscord<banan|crab> In reply to @alice. "<@996044212158083084> fellow nim user": hello
01:55:38FromDiscord<Elegantbeef> My question doesnt change
01:55:42FromDiscord<Elegantbeef> Depends on your distro
01:56:04FromDiscord<banan|crab> what is it
01:56:26FromDiscord<Elegantbeef> It's a cryptography library named libcrypto 😄
01:56:47FromDiscord<banan|crab> why does it need it
01:56:55FromDiscord<Elegantbeef> `https`
01:57:14FromDiscord<banan|crab> hm
01:58:54FromDiscord<huantian> ye it's part of openssl
01:59:24FromDiscord<banan|crab> theres no nix package 😦
01:59:33FromDiscord<huantian> you want openssl_1_1
01:59:48FromDiscord<huantian> if you're on unstable
01:59:48FromDiscord<banan|crab> ah thanks
02:00:10FromDiscord<huantian> one day nim will udpate to open ssl 3
02:00:24FromDiscord<banan|crab> ah
02:00:44FromDiscord<huantian> (edit) "udpate" => "update"
02:00:54FromDiscord<huantian> (edit) "open ssl" => "openssl"
02:00:54FromDiscord<alice.> am i doing inheritance right?
02:01:00FromDiscord<alice.> sent a code paste, see https://paste.rs/WY6
02:01:41FromDiscord<banan|crab> the webhook works but it just crashes https://media.discordapp.net/attachments/371759389889003532/1040083796281802812/unknown.png https://media.discordapp.net/attachments/371759389889003532/1040083796617334925/unknown.png
02:01:43FromDiscord<Elegantbeef> Do it all in one error block and you should do `BaseError = object of CatchableError`
02:01:54FromDiscord<Elegantbeef> Also `CatchableError`s have a `msg` field so you dont need `reason`
02:01:57FromDiscord<alice.> In reply to @Elegantbeef "Do it all in": wdym?
02:02:14FromDiscord<alice.> can i still have the LexerError inherit f rom it?
02:02:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ftr
02:02:48FromDiscord<alice.> gotcha
02:02:52FromDiscord<Elegantbeef> I assume you want this to work with exceptions?
02:03:07FromDiscord<alice.> i kinda prefer to do them individually and not in one big type block
02:03:12FromDiscord<alice.> is it just personal preference?
02:03:21FromDiscord<Elegantbeef> No there is forward declaration in type defs
02:03:28FromDiscord<alice.> wdym?
02:03:30FromDiscord<Elegantbeef> The compiler does left then right
02:03:36FromDiscord<banan|crab> In reply to @banan|crab "the webhook works but": https://media.discordapp.net/attachments/371759389889003532/1040084278815498260/unknown.png
02:03:47FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ZEx
02:03:48FromDiscord<banan|crab> whats making it crash
02:04:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fts
02:04:34FromDiscord<alice.> sent a code paste, see https://play.nim-lang.org/#ix=4ftt
02:04:38FromDiscord<Elegantbeef> You dont need `inheritable`
02:04:44FromDiscord<Elegantbeef> `object of` is inheritable
02:05:18FromDiscord<alice.> so how do i use this new CatchableError type?
02:05:55FromDiscord<Elegantbeef> `raise (ref LexerError)(src: "hmm", msg: "You dun goofed", line: 100)`
02:06:12FromDiscord<alice.> why the ref thing?
02:06:21FromDiscord<Elegantbeef> Cause exceptions are heap allocated
02:06:58FromDiscord<Elegantbeef> Again this is only if you want to work with exceptions
02:07:02FromDiscord<Elegantbeef> Which i was assuming you did
02:07:04FromDiscord<alice.> i do
02:09:26FromDiscord<alice.> how do i make a function that returns a ref object
02:09:31FromDiscord<alice.> so i dont have to type this everywhere
02:09:43FromDiscord<Elegantbeef> The same was as you make any function
02:09:45FromDiscord<Elegantbeef> way
02:09:58FromDiscord<alice.> but how do i return ref
02:10:11FromDiscord<alice.> sent a code paste, see https://play.nim-lang.org/#ix=4ftu
02:10:17FromDiscord<Elegantbeef> The same was as you return a non ref
02:10:20FromDiscord<alice.> this obviously doesnt work
02:10:27FromDiscord<alice.> sent a code paste, see https://play.nim-lang.org/#ix=4ftv
02:10:34FromDiscord<Elegantbeef> `(ref LexerError)(...)`
02:10:39FromDiscord<Elegantbeef> I didnt do that for fun
02:10:40FromDiscord<alice.> oh that
02:10:48FromDiscord<Elegantbeef> I did that cause it's required
02:11:07FromDiscord<alice.> still errors
02:11:15FromDiscord<alice.> sent a code paste, see https://play.nim-lang.org/#ix=4ftu
02:11:23FromDiscord<Elegantbeef> ...
02:11:24FromDiscord<alice.> sent a code paste, see https://play.nim-lang.org/#ix=4ftw
02:11:29FromDiscord<Elegantbeef> ` (ref LexerError)(src: src, msg: msg, span: span, line: line)`
02:11:37FromDiscord<Elegantbeef> You are not converting to `ref LexerErro`
02:11:38FromDiscord<alice.> oh i dont put it twice?
02:11:47FromDiscord<Elegantbeef> you're constructing a `(ref LexerError)`
02:11:54FromDiscord<alice.> ah
02:14:23FromDiscord<alice.> sorry for my idiotness
03:20:32*arkurious quit (Quit: Leaving)
03:40:25FromDiscord<alice.> how would i implement a union type?
03:41:30FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html
03:46:16FromDiscord<alice.> @ElegantBeef i mean like a sum type
03:46:24FromDiscord<alice.> i cant fidn anything on here about it
03:46:44FromDiscord<alice.> unless i missed something
03:47:01FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
03:47:38FromDiscord<Elegantbeef> There is also https://github.com/alaviss/union
03:47:47FromDiscord<alice.> thank you
03:56:19FromDiscord<JeysonFlores> What's the best strategy to not have global variables? I have a simple asyncHttpServer and some routes need to access to an object declared and initialized outside the http server handler, it doesn't give any error but there's that pesky warning alert when I compile my program
03:57:10FromDiscord<Elegantbeef> Pass a state object to the procedure
03:59:28FromDiscord<JeysonFlores> This is the declaration of the serve() procedure, and the module API doesn't show any proc that lets me modify the Request object before passing the callback https://media.discordapp.net/attachments/371759389889003532/1040113435452653631/image.png
03:59:59FromDiscord<Elegantbeef> What warning are you talking about anyway?
04:00:25FromDiscord<JeysonFlores> In reply to @Elegantbeef "What warning are you": Warning: 'cbIter' is not GC-safe as it accesses 'connections' which is a global using GC'ed memory [GcUnsafe2]
04:00:38*derpydoo quit (Quit: derpydoo)
04:00:57FromDiscord<JeysonFlores> It works, but if the compiler throws that warning is because there's a better way of doing it I guess
04:02:12FromDiscord<Elegantbeef> You can hide the warning for that if you wanted or convert that access to gcsafe
04:03:33FromDiscord<JeysonFlores> In reply to @Elegantbeef "You can hide the": how can I convert that access to gcsafe?
04:04:03FromDiscord<Elegantbeef> `{.cast(gcSafe).}: #Code here`
04:07:01FromDiscord<JeysonFlores> holy crap it worked
04:07:19FromDiscord<JeysonFlores> does gcsafe only works for safe global variable access operations?
04:07:41FromDiscord<JeysonFlores> (edit) "only works for" => "mean something about"
04:07:50FromDiscord<Elegantbeef> Basically it's just thread safety analysis
04:08:35FromDiscord<JeysonFlores> In reply to @Elegantbeef "`{.cast(gcSafe).}: #Code here`": Ok, so if I want any variable to be safely accessed through async procedures or threads this pragma is the way to go?
04:09:09FromDiscord<Elegantbeef> It doesnt make it safe it tells the compiler "I know what i'm doing"
04:10:19FromDiscord<JeysonFlores> so..... if I want to make it safe I have to use something like a Lock?
04:17:25FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4ftP
04:22:43FromDiscord<Elegantbeef> you dont need the `of` you can just do `func2(base: BaseObj)` and `func2(obj: Child1)`
04:24:27FromDiscord<Elegantbeef> If you need it to use dynamic dispatch look at methods
04:24:48FromDiscord<user2m> ahhh gotcha ok I'll take a look see
04:25:10FromDiscord<huantian> it's weird that this doesn't work though
04:25:16FromDiscord<Elegantbeef> No it's not
04:25:23FromDiscord<Elegantbeef> `BaseObj` doesnt have `attrib2`
04:26:03FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ftQ
04:26:05FromDiscord<Elegantbeef> But at that point use procedures
04:28:40FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4ftR
04:28:44FromDiscord<Elegantbeef> You dont need method here
04:28:49FromDiscord<user2m> Thanks @ElegantBeef that got it working!
04:29:05FromDiscord<user2m> isn't that how you do dynamic dispatching?
04:29:11FromDiscord<user2m> with the method keyword?
04:30:41FromDiscord<Elegantbeef> Yes but you arent using dynamic dispatch
04:31:51*pech quit (Quit: Leaving)
04:32:04FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/F7u
04:32:06FromDiscord<Elegantbeef> That's dynamic dispatch
04:33:47FromDiscord<user2m> ahhh I see I need to do more reading on dynamic dispatch. Also could you link me some docs on the when keyword? I keep searching "nim when keyword" and coming up with nothing. The when keyword seems to be what make this work and I'm not sure why
04:34:16FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html the holy grail
04:34:21FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#statements-and-expressions-when-statement
04:35:23*tanami quit (Ping timeout: 248 seconds)
04:37:20FromDiscord<user2m> Fantastic thank you! "The when statement enables conditional compilation techniques" I'm guessing this is why your solution worked?
04:37:36FromDiscord<user2m> https://media.discordapp.net/attachments/371759389889003532/1040123032947146783/image.png
04:37:38FromDiscord<Elegantbeef> Yes
04:37:51FromDiscord<user2m> amazing
04:40:03FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=4ftV
04:40:14FromDiscord<huantian> if you wanted to do the type check at runtime
04:40:37FromDiscord<Elegantbeef> Correct
04:40:42FromDiscord<Elegantbeef> But that's just dynamic dispatchin
04:40:45FromDiscord<huantian> ye
04:58:04*droidrage joined #nim
05:01:32FromDiscord<JeysonFlores> In reply to @Elegantbeef "`{.cast(gcSafe).}: #Code here`": is there any way to attach this pragme to the global variable declaration? is quite ugly putting this pragma in every use of the var
05:02:03FromDiscord<Elegantbeef> You can also just annotate your proc `{.gcsafe.}` and if threads are off it's gcsafe
05:12:17FromDiscord<JeysonFlores> mmm ok I think I get it and as long as I use locks to access that variable will be safe
05:13:41*rockcavera quit (Remote host closed the connection)
05:13:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fu2
05:17:47FromDiscord<JeysonFlores> but you said that pragma will only tell the compiler that the following code is safe (without actually making it) so that means that in order to make it safe it's all up to me isn't it?
05:18:04FromDiscord<JeysonFlores> (edit) "me" => "me,"
05:18:16FromDiscord<JeysonFlores> (edit) "but you said that pragma will only tell the compiler that the following code is safe (without actually making it) so that means that in order to ... make" added "actually"
05:19:12FromDiscord<JeysonFlores> and I searched and it seems that locks are the way to make safe reads/writes from different threads or async procedures
05:19:27FromDiscord<Elegantbeef> You dont need locks for async
05:19:51FromDiscord<JeysonFlores> In reply to @Elegantbeef "You dont need locks": so async procs can access global variables safely?
05:20:13FromDiscord<Elegantbeef> Yea there is no threading there
05:20:33FromDiscord<JeysonFlores> perfect. Thanks
05:32:59FromDiscord<user2m> sent a code paste, see https://paste.rs/k1A
05:33:05FromDiscord<user2m> sent a code paste, see https://paste.rs/SKG
05:33:08FromDiscord<user2m> I keep getting this error on what seems like a basic tempate
05:33:09FromDiscord<Elegantbeef> No return type
05:33:32FromDiscord<user2m> do you mean I should add a return type to the template?
05:33:53FromDiscord<Elegantbeef> Yes
05:34:29FromDiscord<user2m> ahh I see
05:40:53FromDiscord<baalajimaestro> Does nim go well with jemalloc?
05:41:02FromDiscord<baalajimaestro> I just tried it on python, and it improved memory usage by a nice amount
05:42:03FromDiscord<Rika> no, nim doesnt by default use malloc iirc, but you can make it with -d:useMalloc when compiling your code, then plugging jemalloc via however you'd do it on c as well
05:46:41FromDiscord<Elegantbeef> It's not too hard to change the allocator
05:49:19FromDiscord<pyryrin> Are pointers gc'd
05:49:28FromDiscord<Elegantbeef> No
05:53:02FromDiscord<scarf> would bigger stdlib better for nim?
05:53:07FromDiscord<Rika> no
05:53:08FromDiscord<scarf> (edit) "would bigger stdlib ... better" added "be"
05:53:29FromDiscord<scarf> could you tell me why?
05:53:53FromDiscord<Rika> developers are scarce
05:54:17FromDiscord<scarf> so it's because big stdlib is hard to maintain, right?
05:54:50FromDiscord<Rika> yes
05:55:19FromDiscord<scarf> i see
06:03:12FromDiscord<Prestige> I don't see anything really missing from the stdlib
06:03:40FromDiscord<Prestige> We could definitely improve on the preexisting stdlib though
06:03:52FromDiscord<Elegantbeef> `concepts.nim` so everyone has easy concepts that others can use 😛↵(@Prestige)
06:04:11FromDiscord<Prestige> Yeah, concepts would be great if finished...
06:04:29FromDiscord<Elegantbeef> That's not what i mean
06:05:23FromDiscord<Prestige> Wdym?
06:06:12FromDiscord<Elegantbeef> I mean a module that has a bunch of concepts for things like Vector2, Color and other types that others would want to abstract away
06:07:04FromDiscord<Prestige> Hmm interesting, haven't seen it. I just want my own concepts
06:08:36FromDiscord<Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/shaders.nim#L132-L168 is kinda stupid for anyone else to implement 😄
06:09:37FromDiscord<Prestige> Looks nice
06:10:04FromDiscord<Prestige> I created an "Iterable" concept I'm using in a project, seems sane
06:21:59FromDiscord<ChocolettePalette> concept 😔
06:22:56FromDiscord<ChocolettePalette> Aren't they experimental?
06:23:08FromDiscord<Elegantbeef> Experimental schemimental
06:23:59FromDiscord<ChocolettePalette> They are kinda cool doe
06:36:47FromDiscord<Rika> ngl id mark the whole nim language as experimental ~~ban in 3, 2, 1,~~
06:36:52FromDiscord<Rika> is joke
06:36:59FromDiscord<Elegantbeef> "What is a spec"
06:50:47FromDiscord<ajusa> In reply to @Elegantbeef ""What is a spec"": "the implementation is the spec"
06:51:58FromDiscord<Rika> the spec is always wrong
06:57:34FromDiscord<Require Support> does `nim devel` and `--mm:orc` hate var parameters? `Error: 'handleRequest' is not GC-safe as it calls 'selectExt'`
06:57:56FromDiscord<Elegantbeef> The obviously dont hate var paramters
07:02:22FromDiscord<Require Support> https://github.com/status-im/nim-websock/blob/acbe30e9ca1e51dcbbfe4c552ee6f16c7eede538/websock/websock.nim#L317 have a program that uses websock and chronos but I think it fails to compile on devel and orc because of this.↵↵declared here and uses var params: https://github.com/status-im/nim-websock/blob/acbe30e9ca1e51dcbbfe4c552ee6f16c7eede538/websock/websock.nim#L57
07:04:09*ltriant quit (Ping timeout: 260 seconds)
07:05:00FromDiscord<ShalokShalom> Concepts would be a good feature to advertise 2.0
07:08:38FromDiscord<Rika> if only they werent that buggy
07:09:19FromDiscord<ringabout> In reply to @Require Support "does `nim devel` and": stricteffects on the devel branch sometimes requires explicit `gcsafe` pragmas.
07:12:58FromDiscord<Require Support> In reply to @ringabout "stricteffects on the devel": hey that worked, thanks. Idk what it does but at least it built something
07:18:35FromDiscord<EliasG2> is there a way to make an array with a size that is not known during compile time, yet cannot be resized once created?
07:18:43FromDiscord<Elegantbeef> `seq[T]`
07:18:51FromDiscord<Elegantbeef> Wrap that with a distinct
07:18:59FromDiscord<Elegantbeef> Someone really should make a fixed seq package
07:20:10FromDiscord<EliasG2> In reply to @Elegantbeef "Wrap that with a": how would that look?
07:20:25FromDiscord<Elegantbeef> `type FixedSeq[T] = distinct seq[T]`
07:20:43FromDiscord<EliasG2> and is it as efficient as if i knew the size and used an array?
07:20:48FromDiscord<Rika> no
07:20:49FromDiscord<Elegantbeef> Then implement all your operators and features as `FixedSeq`
07:21:20FromDiscord<EliasG2> In reply to @Elegantbeef "`type FixedSeq[T] = distinct": ok, thanks
07:21:23FromDiscord<Rika> the efficiency of an array is because the size is known specifically at compile time
07:21:39FromDiscord<Elegantbeef> The only efficieny difference is one is heap allocated
07:22:03FromDiscord<Rika> alloca go brr
07:22:04FromDiscord<Rika> sorry
07:24:26FromDiscord<EliasG2> In reply to @EliasG2 "ok, thanks": but how do i set the size when creating the sequence?
07:25:03FromDiscord<Require Support> https://nim-lang.org/docs/system.html#newSeqOfCap%2CNatural
07:25:48FromDiscord<EliasG2> In reply to @Require Support "https://nim-lang.org/docs/system.html#newSeqOfCap%2": ah
07:26:28FromDiscord<Elegantbeef> You might need to make it an object to keep the size persistent
07:30:08FromDiscord<alice.> hi all
07:30:24FromDiscord<alice.> is there a way i can reuse op here instead of having to do unaryOp and binOp?
07:30:33FromDiscord<alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fun
07:32:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fuo
07:33:43FromDiscord<alice.> but this will mean that unless its unary theres only one left hand side?
07:33:48FromDiscord<alice.> unless im reading wrong
07:34:35FromDiscord<Elegantbeef> Sorry i meant `isBinary`
07:34:40FromDiscord<alice.> ah
07:34:43FromDiscord<alice.> gotcha
07:35:21FromDiscord<Elegantbeef> You could also use a flag on the node instead but that's up to you
07:37:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fur
07:37:37FromDiscord<Elegantbeef> This is likely better for memory consumption and possibly performance as it'll reduce heap allocation costs
07:37:47FromDiscord<alice.> gotchu
07:37:53FromDiscord<Elegantbeef> But you have to implement the checks if you accidently access `right` on a unary
07:39:36*PMunch joined #nim
07:49:22*ltriant joined #nim
07:49:49FromDiscord<ShalokShalom> sent a long message, see http://ix.io/4fus
07:51:05FromDiscord<Elegantbeef> I swear you dont read my messages
07:51:32FromDiscord<ShalokShalom> Give me a rehash 🙂
07:51:48*kenran joined #nim
07:51:51FromDiscord<Elegantbeef> It's down to the author of the bindings to the dynamic library to dictate whether a procedure is pure or not
07:52:06FromDiscord<Elegantbeef> Nim cannot know if C code is pure so it's either impure or pure at the discretion of the binding author
07:54:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fuu
07:55:15*ltriant quit (Ping timeout: 260 seconds)
07:56:40PMunch@ShalokShalom, if I get what you're asking then no, that's not possible
07:56:58PMunchNim doesn't actually understand the C code you try to call. It only knows how to call it.
07:57:12FromDiscord<ShalokShalom> Then dont compile
07:57:14PMunchThere is no inspection of the C code at all to ensure that things are correct
07:57:23FromDiscord<Elegantbeef> I explained this all before pmunch
07:57:30PMunchAight
07:57:30FromDiscord<ShalokShalom> If you dont know if its pure, treat it as none pure
07:57:38FromDiscord<Elegantbeef> Which Nim does
07:57:49FromDiscord<ShalokShalom> You suggested me otherwise?
07:57:52FromDiscord<Elegantbeef> The one that decides it's pure is the one that copies the bindings
07:58:21FromDiscord<ShalokShalom> You said, Nim trusts its user
07:58:28FromDiscord<Elegantbeef> It does
07:58:41FromDiscord<Elegantbeef> You can do `{.cast(noSideEffect).}` on sideffected code
07:59:02FromDiscord<Elegantbeef> There is no such thing as perfectly pure code, an allocation is a side effect
07:59:04FromDiscord<ShalokShalom> I haven't tried it myself, but I understood this so, that putting func and using a library in it from Godot, would compile
07:59:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fuv
08:00:02FromDiscord<ShalokShalom> In reply to @Elegantbeef "There is no such": I am asking for the default behavior. ↵↵Can I trust func to be pure in any setup to be pure for sure
08:00:06*FromDiscord quit (*.net *.split)
08:00:06*hexeme quit (*.net *.split)
08:00:06*qwr quit (*.net *.split)
08:00:06*Ekho quit (*.net *.split)
08:00:06*def- quit (*.net *.split)
08:00:06*mal`` quit (*.net *.split)
08:00:06*om3ga quit (*.net *.split)
08:00:06*dv^_^ quit (*.net *.split)
08:00:06*oisota quit (*.net *.split)
08:00:07*dom96 quit (*.net *.split)
08:00:07*void09 quit (*.net *.split)
08:00:17*qwr joined #nim
08:00:18*def-- joined #nim
08:00:42*def-- is now known as def-
08:01:50*om3ga joined #nim
08:02:18*void09 joined #nim
08:02:28*mal`` joined #nim
08:02:48*dom96 joined #nim
08:04:23*hexeme joined #nim
08:12:10*Ekho joined #nim
08:16:04*FromDiscord joined #nim
08:16:20FromDiscord<Elegantbeef> But hey it works https://wandbox.org/permlink/duuUegY0iSfXgprZ
08:17:58FromDiscord<ShalokShalom> In reply to @Elegantbeef "Overriding the compiler's side": You talk about specifically telling the compiler to make an exception.
08:18:15FromDiscord<Elegantbeef> Yes cause real code isnt cut dry
08:18:23FromDiscord<ShalokShalom> I talk about the compiler not telling the truth about purity.
08:18:38FromDiscord<Elegantbeef> I mean allocating is by definition impure
08:18:53FromDiscord<Elegantbeef> So like do you want to have a perfectly pure function, or do you want a reasonably pure function
08:19:11FromDiscord<Rika> what is the truth about purity
08:19:14FromDiscord<ShalokShalom> In reply to @Elegantbeef "Nim's side effect analysis": Unless you load a libary that is in Cpp
08:19:25FromDiscord<ShalokShalom> In reply to @Rika "what is the truth": That its pure.
08:19:30FromDiscord<Rika> define
08:21:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fuz
08:21:24FromDiscord<Elegantbeef> Like i said allocating is mutating global state
08:21:37FromDiscord<Elegantbeef> Even just growing/shrinking the stack mutates global state
08:21:39FromDiscord<Rika> ~~unsafe as fuck lmao~~
08:21:45FromDiscord<Elegantbeef> Lol
08:21:49FromDiscord<Elegantbeef> The point stands
08:22:02FromDiscord<Elegantbeef> 100% pure code is pointless code
08:22:40FromDiscord<Elegantbeef> Even comparing values is impure as it writes to registers
08:22:41FromDiscord<Elegantbeef> So like how pure do we want
08:22:41FromDiscord<Elegantbeef> Do we want something usable or something pure
08:23:54FromDiscord<ShalokShalom> Pure as in Haskell
08:23:59FromDiscord<Rika> i really dont understand what you're aiming for
08:24:00FromDiscord<ShalokShalom> That's enough for me
08:24:03FromDiscord<Elegantbeef> So pure as in Nim
08:24:04FromDiscord<Elegantbeef> Got it
08:24:10FromDiscord<ShalokShalom> Its just that the state doesnt bite yoi
08:24:30FromDiscord<ShalokShalom> No, in Haskell you cant compile with a mutating library
08:24:45FromDiscord<Elegantbeef> Haskell has pointers
08:24:51FromDiscord<Rika> haskell has C binding ability
08:24:54FromDiscord<ShalokShalom> In reply to @Rika "i really dont understand": Lets say someone does a tutorial↵↵I plan to do so
08:25:08FromDiscord<ShalokShalom> Then you explain the people the sense behind func
08:25:15FromDiscord<ShalokShalom> And when you use proc instead
08:25:27FromDiscord<ShalokShalom> Then you go on and let them try their code
08:25:44FromDiscord<ShalokShalom> They use eg a Godot library and it is mutating state
08:25:51FromDiscord<ShalokShalom> They use it within a func
08:26:02FromDiscord<ShalokShalom> Why is that not nonsense?
08:26:23FromDiscord<ShalokShalom> This will go through, and the newbie will just be confused
08:27:06FromDiscord<Elegantbeef> Except if you use godot-nim they dont work with func iirc
08:27:09FromDiscord<Rika> can you show us what godot library is "incorrectly" marked as nosideeffectsd
08:27:09FromDiscord<Elegantbeef> So...
08:27:17FromDiscord<Elegantbeef> And again this is to the author
08:27:23FromDiscord<ShalokShalom> In reply to @Elegantbeef "Even comparing values is": You are constantly coming up with weird side cases. ↵↵I speak about using external code, that cant be verified.
08:27:28FromDiscord<Elegantbeef> The author of the C libraries has to annotated `noSideEffect`
08:27:36FromDiscord<Elegantbeef> It doesnt infer C api's as pure
08:27:44FromDiscord<Elegantbeef> So the same thing exists in haskell
08:27:48FromDiscord<Elegantbeef> Cause you depend on C-Apis
08:27:48FromDiscord<ShalokShalom> In reply to @Rika "can you show us": So far as I understand, is it not possible to check for purity in C/C++ libraries.
08:27:58FromDiscord<Elegantbeef> It is possible
08:28:02FromDiscord<Rika> why so?
08:28:08FromDiscord<Elegantbeef> A programmer can read the code and say "Yep this has no side effect"
08:28:15FromDiscord<ShalokShalom> In reply to @Elegantbeef "Except if you use": That would make a lot of sense
08:28:22FromDiscord<Rika> not all code can be proven, but that doesnt mean most code isnt provable
08:28:42FromDiscord<ShalokShalom> Somebody said C libs can not be proven at all
08:28:51FromDiscord<Elegantbeef> They cannot be proven by Nim
08:28:54FromDiscord<Elegantbeef> It doesnt read C
08:29:02FromDiscord<ShalokShalom> Yeah, what mean
08:29:06FromDiscord<Rika> beef youre starting to misunderstand now i believe
08:29:08FromDiscord<Elegantbeef> They can be proven by programmers or something that can speak C
08:29:17FromDiscord<ShalokShalom> He does all the time
08:29:26FromDiscord<Elegantbeef> Lol
08:29:41FromDiscord<ShalokShalom> In reply to @Elegantbeef "They can be proven": But until Nim can verify that, you dont compile
08:29:51FromDiscord<ShalokShalom> Dont compile, if you are uncertain
08:29:55FromDiscord<Elegantbeef> Well then nothing in Nim is pure cause it uses C allocation functions
08:29:55FromDiscord<ShalokShalom> Make guarantees
08:30:07FromDiscord<ShalokShalom> I want to trust you with my code.
08:30:07FromDiscord<Elegantbeef> So yay we're back to no pure functions
08:30:25FromDiscord<ShalokShalom> I care about loading libraries.
08:30:39FromDiscord<ShalokShalom> About practical applications
08:30:54FromDiscord<Rika> In reply to @ShalokShalom "Dont compile, if you": nim doesnt assume anything by default, only if a (not the) programmer decides they want to say "ok this is no side effects" will it assume it is NSE
08:31:18FromDiscord<ShalokShalom> Ok, isnt this was func is doing?/
08:31:29FromDiscord<ShalokShalom> Doesnt it say 'this is pure'
08:31:30FromDiscord<Rika> no it is what cast(NSE) is doing
08:31:48FromDiscord<Rika> there's a difference between "make this pure" and "I fucking know this is pure"
08:31:54FromDiscord<ShalokShalom> And then there is strictFuncs and they still allow for impure libraries
08:31:57FromDiscord<Rika> func is the former
08:32:00FromDiscord<Rika> cast is the latter
08:32:05FromDiscord<ShalokShalom> Ok
08:32:11FromDiscord<Elegantbeef> Of course strictFuncs allow impure libraries
08:32:28FromDiscord<Elegantbeef> No one is going to disallow all third party libraries in a func
08:32:32FromDiscord<Elegantbeef> That neuters the language
08:32:37FromDiscord<jmgomez> The context of purity only makes sense in user's code
08:32:41FromDiscord<ShalokShalom> It makes it strict.
08:32:47FromDiscord<Elegantbeef> No it makes it pointless
08:32:48FromDiscord<ShalokShalom> In reply to @jmgomez "The context of purity": Yeah, thanks.
08:33:34FromDiscord<Elegantbeef> https://github.com/juancarlospaco/nim-easings/blob/master/src/easings.h let's use this example
08:33:37FromDiscord<ShalokShalom> In reply to @Rika "func is the former": Yeah. This is how I understand it and it shows, that potentially impure sources could be raising a warning
08:33:40FromDiscord<Elegantbeef> I read the code i know it has no side effect
08:33:44FromDiscord<ShalokShalom> Or dont compile
08:33:44FromDiscord<Elegantbeef> In your world that doesnt matter
08:34:21FromDiscord<Elegantbeef> We see this has 0 pointers and 0 global state, yet it's still impure code since Nim cannot detect that
08:34:25FromDiscord<ShalokShalom> In reply to @Elegantbeef "I read the code": You dont, very often. Sometimes there is a hidden side effect. ↵↵And I see this, as already stated, as a tool for newbies to rely on.
08:34:38FromDiscord<Elegantbeef> It's not
08:34:51FromDiscord<ShalokShalom> They understand the difference between pure and impure, apply it properly with func and proc and can rely on it
08:34:53FromDiscord<Elegantbeef> Func is a tool to ensure code has no side effect in Nim and if it does it allows you to manage it
08:34:55FromDiscord<ShalokShalom> Thats my vision.
08:35:25*ltriant joined #nim
08:35:32FromDiscord<Elegantbeef> You can either override the analysis and make the code function or solve the problem another way
08:35:49FromDiscord<Elegantbeef> I do not see why allowing C procedures to be called in func is a bad thing as any otherway would vastly diminish the usefulness of func
08:35:55FromDiscord<ShalokShalom> Once I load state mutating code from cpp into my Nim code, I see this as part of my Nim code.
08:35:56FromDiscord<Rika> well unfortunately i guess this is where "give programmers the choice" is a bad thing for you
08:36:11FromDiscord<ShalokShalom> As much a Python developers see NumPy as part of their Python
08:36:13FromDiscord<Elegantbeef> Well then dont use func↵(@ShalokShalom)
08:36:19FromDiscord<Rika> what?
08:36:24FromDiscord<Rika> what does that mean
08:36:25FromDiscord<ShalokShalom> In reply to @Rika "well unfortunately i guess": But then give me the choice
08:36:34FromDiscord<Elegantbeef> A pragmatist understands the limitations of their tools and knows where to use them and where not to
08:36:34FromDiscord<ShalokShalom> Give me the choice to have this strict
08:36:50FromDiscord<ShalokShalom> In reply to @Rika "what does that mean": What do you mean?
08:36:55FromDiscord<Rika> In reply to @ShalokShalom "But then give me": just look for any "noSideEffects" in your library code beforehand i think is what araq would say
08:37:01FromDiscord<Rika> In reply to @ShalokShalom "What do you mean?": i mean to beef
08:37:19FromDiscord<ShalokShalom> In reply to @Rika "just look for any": But this is a Nim feature?/
08:37:22FromDiscord<Elegantbeef> What does what mean rika?
08:37:25FromDiscord<jmgomez> In reply to @ShalokShalom "Once I load state": Then you have to digging in the cpp code and make a wrapper that you can trust.. what's the problem you are trying to solve?
08:37:34FromDiscord<ShalokShalom> How can I apply this to any and all C libraries
08:37:51FromDiscord<Rika> In reply to @ShalokShalom "But this is a": i think its the same thing with araq and unsafety, "just grep for cast addr ptr" etc
08:38:07FromDiscord<ShalokShalom> In reply to @jmgomez "Then you have to": That the compiler does assume there is state changing stuff in a library, if it cant know for sure otherwise
08:38:21FromDiscord<ShalokShalom> And then raise a warning
08:38:29FromDiscord<ShalokShalom> Or prevent compilation
08:38:56FromDiscord<ShalokShalom> In reply to @Rika "i think its the": I mean, noSideEffects is a Nim feature
08:39:03FromDiscord<ShalokShalom> Its not a Cpp feature
08:39:05FromDiscord<jmgomez> In reply to @ShalokShalom "That the compiler does": but the compiler only assumes it if someone tells it to do it, right? If you think the person that did the wrapper is wrong. You can go ahead and override that, cant you?
08:39:09FromDiscord<Rika> that is what i mean
08:39:20FromDiscord<Rika> grep your nim libraries for those
08:39:27FromDiscord<ShalokShalom> And even it it would, I couldn't rely on the libraries author
08:39:31FromDiscord<Rika> since ofc you'd need to make nim bindings for your cpp libraries
08:39:53FromDiscord<Elegantbeef> I dont get how you can trust a library author enough to use their code but not enough that they know where to cast side effect safety
08:40:03FromDiscord<Rika> ill be out
08:40:05FromDiscord<Rika> i have work
08:40:12FromDiscord<ShalokShalom> Hnn, so you mean I could implement this on the bindings level?
08:40:23FromDiscord<ShalokShalom> And then even know for sure, what changes state?
08:40:39FromDiscord<ShalokShalom> It would be a tradeoff. But I could accept this
08:41:39FromDiscord<jmgomez> To specify the side effects on the bindings? Sure
08:42:41FromDiscord<jmgomez> But getting it right is tricky because of what you just said, it may be hard to know what the other side is exactly doing
08:43:11FromDiscord<ShalokShalom> Then just assume its impure
08:43:25FromDiscord<ShalokShalom> That's highly likely in a game engine library anyway
08:43:31FromDiscord<ShalokShalom> And also in many other cases
08:43:38FromDiscord<Elegantbeef> Nim does assume it's impure
08:43:48FromDiscord<Elegantbeef> We said this multiple times
08:43:48FromDiscord<ShalokShalom> Then show me this
08:43:52FromDiscord<ShalokShalom> And prevent compiling
08:43:55FromDiscord<ShalokShalom> Its that easy
08:44:00FromDiscord<ShalokShalom> Give me the choice
08:44:10FromDiscord<Elegantbeef> It does if a programmer didnt override it
08:44:13FromDiscord<jmgomez> The choice is there..
08:44:16FromDiscord<Elegantbeef> If you're using a programmers code you ostensibly trust them
08:44:24FromDiscord<jmgomez> exactly
08:44:29*ltriant quit (Ping timeout: 260 seconds)
08:44:40FromDiscord<Elegantbeef> So why the fuck are you using their code if you dont trust where they put code
08:44:56FromDiscord<ShalokShalom> In reply to @jmgomez "The choice is there..": Without specifying this in the binding, ideally.
08:45:06FromDiscord<ShalokShalom> In reply to @Elegantbeef "So why the fuck": I trust them to be impure.
08:45:12FromDiscord<ShalokShalom> I dont try new users
08:45:22FromDiscord<ShalokShalom> Its not about the library author
08:45:26FromDiscord<Elegantbeef> You do realise that you're painting this picture that doesnt exist
08:45:40FromDiscord<Elegantbeef> no one is doing `proc myCFunc: int {.importc, nosideeffect.}`
08:45:43FromDiscord<ShalokShalom> https://discord.com/channels/371759389889003530/371759389889003532/1040180234181427212
08:46:02FromDiscord<Elegantbeef> Ah yes link a discord link to the guy using matrix
08:46:05FromDiscord<ShalokShalom> In reply to @Elegantbeef "no one is doing": I am not caring about proc at all
08:46:21FromDiscord<ShalokShalom> I care about a Godot library being called within a func, that changes state.
08:46:34FromDiscord<Elegantbeef> Did the authors annotate it as `noSideEffect`?
08:46:40FromDiscord<Elegantbeef> You're bitching about a non existent issue
08:47:14FromDiscord<jmgomez> In reply to @ShalokShalom "I care about a": if that's true, it's wrong you can PR or Fork...?
08:47:16FromDiscord<ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/1040185861066723348/Screenshot_20221110-0946472.png
08:47:30FromDiscord<Elegantbeef> I clearly went to discord and read it
08:47:47FromDiscord<ShalokShalom> Thy
08:48:02FromDiscord<Elegantbeef> There isnt a single `noSideEffect` in the godot docs
08:48:06FromDiscord<Elegantbeef> So why are you complaining?
08:48:55FromDiscord<Elegantbeef> > I am not caring about proc at all↵Also to this `proc{.noSideEffect.}` is a func
08:49:01FromDiscord<Elegantbeef> They're literally the same thing
08:49:40FromDiscord<Elegantbeef> But yes please do find me a `noSideEffect` proc from godot-nim
08:49:57FromDiscord<Elegantbeef> Just cause i'd like you to have an actual argument instead of inane rambling about a non issue
08:50:18FromDiscord<alice.> dumb question incominggg
08:50:24FromDiscord<alice.> how do i treat this enum like a string?
08:50:27FromDiscord<Elegantbeef> Better than what's happening
08:50:36FromDiscord<alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fuJ
08:51:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fuK
08:51:56FromDiscord<Elegantbeef> Strutils `%` operator is very nice for things like this
08:52:29FromDiscord<alice.> im kinda confused whats happening here
08:52:36FromDiscord<alice.> how would i use this in place of
08:52:46FromDiscord<alice.> ` raise lexerError(lexer.src, LexerErrors.UnexpectedCharacter, span, lexer.line)↵`
08:53:07FromDiscord<Elegantbeef> `($LexerErrors.UnexpectedCharacter % $myChar)`
08:53:37FromDiscord<Elegantbeef> `%` replaces `$#`
08:53:58FromDiscord<Elegantbeef> You can also do `$1` if you prefer it being numbered
08:54:23FromDiscord<Elegantbeef> https://nim-lang.org/docs/strutils.html#%25%2Cstring%2CopenArray%5Bstring%5D
08:54:42FromDiscord<alice.> gotcha
08:58:19FromDiscord<alice.> @ElegantBeef how do i do more than one of these % substitutions
08:58:28FromDiscord<Elegantbeef> RTFM
08:58:50FromDiscord<alice.> oh i just chained %s
08:59:02FromDiscord<Elegantbeef> No it's an array
08:59:12FromDiscord<Elegantbeef> Do you not read docs?
08:59:29FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1040188938054291476/image.png
08:59:34FromDiscord<alice.> oh its an array
08:59:43FromDiscord<Elegantbeef> I'm going to go before i say something that causes someone to say "that's mean"
08:59:45FromDiscord<alice.> my brain thought they were ( )
09:00:13*ltriant joined #nim
09:07:14*ltriant quit (Ping timeout: 260 seconds)
09:20:41*ox joined #nim
09:20:52*oz quit (Ping timeout: 246 seconds)
09:27:52*jmdaemon quit (Ping timeout: 252 seconds)
09:33:42FromDiscord<Tanguy> Is there a way to disable every hints except one? `--hint:SuccessX:on --hints:off` doesn't work
09:33:56FromDiscord<Tanguy> (the other way around doesn't work either)
09:44:14om3gaHello guys! I binded meow_fft, but for some reason compiler wont find the meow_fft_generate_workset_real. What I miss? Here is example of the code: https://play.nim-lang.org/#ix=4fuZ <--- binds, https://play.nim-lang.org/#ix=4fv0 <--- what fails
09:56:22FromDiscord<alice.> is there a way to have one file refer to another? i want to split the expression parsing stuff and the regular parsing stuff into 2 files
09:56:24FromDiscord<alice.> for readability
09:56:32FromDiscord<alice.> but it causes a cyclic import
09:59:52FromDiscord<ChocolettePalette> You might need to consider changing architecture
10:01:42FromDiscord<alice.> how would i solve it?
10:01:55FromDiscord<alice.> i want the expression parsing and regular parsing not in one giant file
10:01:57FromDiscord<alice.> if possible
10:02:05FromDiscord<Elegantbeef> `include`
10:02:18FromDiscord<alice.> still doesnt work
10:03:22FromDiscord<alice.> expression_parser is like: https://pastebin.com/pTcrE6Q3↵parser is like: https://pastebin.com/BHjdBqP6
10:07:10FromDiscord<alice.> how would i restructure this?
10:08:35FromDiscord<haxscramper> Damn these 350+ messages about funcs @Rika @ElegantBeef how do you manage that
10:08:57FromDiscord<Elegantbeef> Shitposting is my speciality
10:10:14FromDiscord<alice.> so yeah i need to restructure this so it doesn't have cyclic imports
10:10:26FromDiscord<Elegantbeef> Or use forward declares
10:10:41FromDiscord<alice.> that would work?
10:10:44FromDiscord<Elegantbeef> Yes
10:10:47FromDiscord<Elegantbeef> It's what Nim does
10:11:02FromDiscord<alice.> is that the best way to solve this or should i restructure it in a better way?
10:16:38*dv^_^ joined #nim
10:17:20FromDiscord<&Makarov/1> hello beautiful people https://media.discordapp.net/attachments/371759389889003532/1040208533200838656/image.png
10:17:43FromDiscord<&Makarov/1> why i need to use ref when declaring the Node type ?
10:18:45FromDiscord<Elegantbeef> Unless you have infinite memory there is no other way of doing it
10:18:49FromDiscord<Elegantbeef> You need some possible terminating
10:19:13FromDiscord<&Makarov/1> In reply to @Elegantbeef "Unless you have infinite": i didnt quite get it
10:19:48FromDiscord<&Makarov/1> alright i do :jo
10:19:51FromDiscord<&Makarov/1> (edit) ":jo" => "😂"
10:19:54FromDiscord<&Makarov/1> thanks !
10:20:13FromDiscord<&Makarov/1> https://tenor.com/view/spongebob-squarepants-tired-sleepy-exhausted-sleep-deprived-gif-5215701
10:20:23FromDiscord<&Makarov/1> m just like that 😂 ☝️
10:22:23FromDiscord<ShalokShalom> In reply to @Elegantbeef "Just cause i'd like": I am fine with godot-nim↵↵I actually care about pupils, as said, you get used to this
10:22:34FromDiscord<ShalokShalom> They expect it to work under any condition
10:23:29FromDiscord<Rika> In reply to @haxscramper "Damn these 350+ messages": Consistent misunderstanding
10:24:11FromDiscord<rdb> In reply to @Elegantbeef "Jesus fucking christ 😄": The bindings are auto-generated, so code size wasn't actually a concern of mine. But I'll look at the other method you suggested.
10:28:54FromDiscord<rdb> Actually, code size is a bit of a concern because nim has a known bug where it can't count line numbers past 65535. 😅
10:29:28FromDiscord<Elegantbeef> Shit now that just seems like a dick comment
10:29:53FromDiscord<Elegantbeef> It also slows the compiler down cause it still semantically checks them all
10:31:18FromDiscord<ShalokShalom> In reply to @rdb "Actually, code size is": That looks like the multiply of 64, or so?
10:41:55FromDiscord<offbeat-stuff (offbeat-stuff)> Hi, -\> could not import\: SSL\_get\_peer\_certificate
10:42:01FromDiscord<offbeat-stuff (offbeat-stuff)> openssl version↵OpenSSL 3.0.7 1 Nov 2022 (Library\: OpenSSL 3.0.7 1 Nov 2022)
10:42:56FromDiscord<offbeat-stuff (offbeat-stuff)> Artix linux , xanmod kernel
10:43:05FromDiscord<rdb> In reply to @ShalokShalom "That looks like the": It's the limit of an unsigned 16-bit integer.
10:43:21FromDiscord<offbeat-stuff (offbeat-stuff)> any idea how to fix it
10:43:26FromDiscord<offbeat-stuff (offbeat-stuff)> \>
10:43:30FromDiscord<offbeat-stuff (offbeat-stuff)> ?
10:44:55FromDiscord<offbeat-stuff (offbeat-stuff)> i get the error when running nimble
10:45:11FromDiscord<offbeat-stuff (offbeat-stuff)> or nim programs compiled with -d\:ssl
10:45:27FromDiscord<jmgomez> In reply to @rdb "Actually, code size is": From where that comes from? We have bindings with +150k LoC. are you using code reordering?
10:45:30FromDiscord<rdb> In reply to @Elegantbeef "Shit now that just": No offence taken. 🙂 The bindings are a proof-of-concept I mostly hacked up in a spare afternoon after learning about nim and without knowledge of dot operators just writing a for loop to dump out a bunch of swizzles seemed the quickest way to do it. 😛
10:45:36FromDiscord<rdb> In reply to @jmgomez "From where that comes": Generated bindings.
10:45:45FromDiscord<rdb> (edit) "bindings." => "bindings for a huge C++ library."
10:45:51FromDiscord<jmgomez> I mean the idea of 65k limit
10:46:00FromDiscord<offbeat-stuff (offbeat-stuff)> does nim not support openssl 3?
10:46:11FromDiscord<jmgomez> Are you using the code reordering pragma?
10:46:15FromDiscord<rdb> In reply to @jmgomez "I mean the idea": https://github.com/nim-lang/Nim/issues/15165
10:47:00FromDiscord<jmgomez> Ohh the limit of the error not the limit of the code size. Gotcha
10:47:39FromDiscord<rdb> Right. Tbf it goes above the limit mostly because I have the textual documentation comments from the original C++ library included.
10:48:06FromDiscord<jmgomez> But if you don’t have errors it should be good. Still that needs to be fixed oc
10:48:21FromDiscord<jmgomez> Again, we have files bigger than that in NimForUE
10:51:12FromDiscord<rdb> Cool, so both our bindings are for 3D game engines
10:52:16FromDiscord<jmgomez> That’s great. Which one are you binding?
10:52:46FromDiscord<rdb> Panda3D https://github.com/rdb/nim-panda3d
10:55:19FromDiscord<rdb> Elegantbeef: Hmm, dot operators are an experimental feature, it seems. That may be why I've not considered them before.
10:57:02*ltriant joined #nim
11:03:19*ltriant quit (Ping timeout: 260 seconds)
11:12:24*ltriant joined #nim
11:35:43FromDiscord<Rika> In reply to @offbeat-stuff (offbeat-stuff) "does nim not support": No, use 1.1
11:52:27FromDiscord<rdb> Can I make a custom dot operator macro "fail" in some way, so that a regular "undeclared identifier" error is generated by nim?
11:52:59FromDiscord<offbeat-stuff (offbeat-stuff)> thanks↵(@Rika)
11:53:19FromDiscord<offbeat-stuff (offbeat-stuff)> had to download a different package
11:53:40FromDiscord<rdb> (edit) "identifier"" => "field""
11:56:19FromDiscord<alice.> In reply to @alice. "so yeah i need": how would i do this btw
11:58:22FromDiscord<ringabout> In reply to @offbeat-stuff (offbeat-stuff) "does nim not support": The devel branch has added openssl 3 support.
11:58:57FromDiscord<vindaar> can you clarify what you mean? I mean in what case should it work and in which fail?↵(@rdb)
12:00:38FromDiscord<rdb> In reply to @vindaar "can you clarify what": Normally, when I access `obj.blargh` I get an error like "undeclared field 'blargh' of type whatever"↵I have defined a custom dot operator macro so I can do `obj.xzzy`↵But now doing `obj.blargh` no longer results in an error message, it just gets substituted as a void type symbol↵Of course I can call `error()` in my macro and generate my own error, but is there a cleaner way?
12:02:34FromDiscord<rdb> I want users of my API to be able to do `obj.xzzy` (which works fine) but continue to get a helpful error message when doing `obj.blargh`
12:05:23FromDiscord<rdb> It looks like just doing something like ``result = quote do: `field`(`this`)`` in the "else" case gets me pretty close, it generates an undeclared identifier error so maybe that's good enough
12:08:46FromDiscord<vindaar> If you really need dot operator macros, then yes as far as I'm aware either calling `error` or "letting it fail" by constructing the resulting code anyway are the only two options
12:09:45FromDiscord<vindaar> I do the same here https://github.com/SciNim/Unchained/blob/master/src/unchained/units.nim#L475-L478 and it gives acceptable error messages
12:13:37FromDiscord<scarf> In reply to @Avahe "I don't see anything": could definitely use RAII or context manager (python `with`) or python's pathlib (3rd party one is 3y old and unmaintained)
12:18:33PMunchHmm, Prologue just hard crashed on me
12:18:37PMunchfree(): double free detected in tcache 2
13:10:24*kenran quit (Remote host closed the connection)
13:11:16FromDiscord<dlesnoff> In reply to @PMunch "free(): double free detected": At least the C error is clear, have you looked at the generated C code?
13:11:37*dnh joined #nim
13:12:02FromDiscord<dlesnoff> (edit) "code?" => "code's corresponding line? (If it doesn't give a line, have you run valgrind on it?"
13:14:07FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fvv
13:15:23FromDiscord<dlesnoff> I am on nim 1.6.8. Does this works on earlier Nim versions?
13:19:10FromDiscord<planetis> sent a code paste, see https://play.nim-lang.org/#ix=4fvw
13:33:30PMunch@dlesnoff, well the full error stack looks like this: http://ix.io/4fvy
13:34:07FromDiscord<ringabout> How about the devel branch?
13:36:27PMunchHmm, I'm unable to build this on devel
13:36:45PMunchregex.nim(856, 18) Error: Exception can raise an unlisted exception: Exception
13:37:02FromDiscord<ringabout> Update regex version
13:37:05PMunchAh, never mind
13:37:07PMunchYeah
13:37:28PMunchHmm, it runs fine on devel
13:38:00FromDiscord<ringabout> The devel branch defaults to ORC though.
13:38:35PMunchI tried to build with ORC on the stable branch as well
13:38:39PMunchBut that still errored out
13:39:20FromDiscord<ringabout> How about using `--mm:refc` with devel?
13:43:37FromDiscord<ringabout> https://github.com/nim-lang/website/pull/347
13:44:17FromDiscord<ringabout> v2 is coming.
13:44:35PMunchI tried with the 1.6.10 rc now with refc and it worked fine
13:44:48*derpydoo joined #nim
13:45:04FromDiscord<ringabout> nice
13:47:12PMunchBy the way, it's also logging things incorrectly
13:47:22FromDiscord<dlesnoff> Well I couldn't guess the errors from the stack 🤔
13:47:31PMunchI reply with a 201 CREATED, but the log still says DEBUG 200 OK
13:49:06FromDiscord<ringabout> That's weird
13:57:28*arkurious joined #nim
14:02:25*PMunch quit (Quit: Leaving)
14:04:03*disso_peach joined #nim
14:18:07FromDiscord<fbpyr> sent a long message, see https://paste.rs/7jR
14:19:19FromDiscord<fbpyr> sent a code paste, see https://play.nim-lang.org/#ix=4fvO
14:25:49FromDiscord<scarf> sent a code paste, see https://play.nim-lang.org/#ix=4fvT
14:30:05FromDiscord<Rika> `when tail is string: (new version)`↵`else: (the original body)`
14:30:14FromDiscord<Rika> I’m on a phone
14:30:40ZevvIs there any magic in nim allowing a fallthrough in a case? ie, omitting the 'break' in the generated C code?
14:30:48FromDiscord<Rika> Even then it doesn’t matter, the cast doesn’t generate code iirc
14:30:59FromDiscord<Rika> “Cast” we call it conversion here in Nim
14:31:03FromDiscord<Rika> Cast is another thing
14:31:09FromDiscord<Rika> In reply to @Zevv "Is there any magic": No
14:31:17Zevvthat's what I thought :/
14:31:56FromDiscord<scarf> In reply to @Rika "Even then it doesn’t": would `"foo".string` be same to `"foo"` (in compiled binary)?
14:32:18FromDiscord<Rika> I’m not sure but I would think so
14:32:30FromDiscord<scarf> (edit) "binary)?" => "binary)?↵since i get this warning: `conversion from string to itself is pointless [ConvFromXtoItselfNotNeeded]`"
14:32:35FromDiscord<Rika> Please test, I don’t have a computer to confirm on right now
14:32:43FromDiscord<Rika> But I recall it being the same
14:32:55FromDiscord<Rika> That’s just a warning, sure
14:34:23*derpydoo quit (Quit: derpydoo)
14:55:16FromDiscord<zajrik> sent a long message, see http://ix.io/4fvY
14:57:03FromDiscord<zajrik> (edit) "http://ix.io/4fvY" => "http://ix.io/4fw0"
15:12:28FromDiscord<haxscramper> Result has isSome, isNone?
15:14:42*derpydoo joined #nim
15:15:01FromDiscord<zajrik> Yes and no. It has those as shortcuts for it's own isOk and isErr, but when I tried to use the shortcuts the compiler would only pick up Option procs and gave compiler errors. After setting the fieldElement in the Match to "isOK" and "isErr" respectively, it worked as expected
15:16:38FromDiscord<zajrik> I'm able to do `if Ok(@val) ?= foo` and use it in case statement macros and its great 👍
15:17:21FromDiscord<zajrik> And same with `Err(@val)`
15:17:38FromDiscord<haxscramper> Well, I guess editing the source code is the way to go then. I don't exactly remember all implementation details and I thought isNone being present will fix the issue
15:18:05FromDiscord<haxscramper> You can try haxscramper/hmatching on GitHub
15:18:10FromDiscord<haxscramper> Fusion is dead anyway
15:18:25FromDiscord<haxscramper> In reply to @haxscramper "You can try haxscramper/hmatching": Can't guarantee this one will work though
15:19:27FromDiscord<zajrik> Oh really?? I had no idea it was dead
15:19:42FromDiscord<zajrik> I've been away from nim for quite some time now
15:19:56FromDiscord<haxscramper> Well, it doesn't move anywhere
15:20:14FromDiscord<haxscramper> It doesn't stink either, so someone might mistake it for sleeping
15:20:21FromDiscord<haxscramper> But I think it is dead
15:20:31FromDiscord<haxscramper> You can poke it with a PR/issue though
15:20:47FromDiscord<haxscramper> Hopefully it will make some funny noises
15:20:52FromDiscord<haxscramper> Like "PRS are welcome"
15:21:13FromDiscord<zajrik> I mean, it's still definitely functioning, and I wouldn't want to add support for an external lib to an internal lib, seems silly
15:21:44FromDiscord<haxscramper> You copied the source code whole anyway
15:22:55FromDiscord<zajrik> I should clarify, I wouldn't want to add official support for an external lib in an internal lib lol
15:23:08FromDiscord<zajrik> Doing it for my own little work project is fiiiine
15:23:49FromDiscord<haxscramper> Oh yeah that of course
15:23:58FromDiscord<haxscramper> Hmatching is just a fork of fusion/matching
15:24:13FromDiscord<haxscramper> With six months of work that nobody bothered to merge
15:24:31FromDiscord<zajrik> Oof. Any noteworthy additions?
15:25:42FromDiscord<tope> sent a long message, see http://ix.io/4fwl
15:27:13FromDiscord<tope> or is this thinking just entirely wrong and I should never mark arguments as sink? (so far I've only marked unary operators as sink, marking binary generates a ton of superfluous copies when arguments are not last-use)
15:28:26*derpydoo quit (Remote host closed the connection)
15:33:51FromDiscord<haxscramper> In reply to @zajrik "Oof. Any noteworthy additions?": nothing for Result
15:38:56FromDiscord<deech> @haxscramper Does hmatching have exhaustiveness checking?
15:39:06FromDiscord<haxscramper> no
15:39:17FromDiscord<haxscramper> it is too hard to implement
15:39:30FromDiscord<deech> Hah! Yes, yes it is. 🙂
15:40:03FromDiscord<deech> Trying to get that really puts a damper on the kinds of matching features you can offer.
15:40:11FromDiscord<ShalokShalom> In reply to @haxscramper "Fusion is dead anyway": Shouldnt this then be announced?
15:40:19FromDiscord<haxscramper> hah lol
15:40:22FromDiscord<haxscramper> it should
15:40:27FromDiscord<haxscramper> next quesion
15:40:28FromDiscord<ShalokShalom> There is a blog post, that actually encourages using it
15:40:29FromDiscord<haxscramper> who cares?
15:40:31FromDiscord<haxscramper> answer: nobody
15:40:32FromDiscord<ShalokShalom> Ok..
15:40:34FromDiscord<ShalokShalom> Me?
15:40:46FromDiscord<haxscramper> you do, core devs don't
15:41:01FromDiscord<ShalokShalom> You agree?
15:41:25FromDiscord<haxscramper> I mean, it is effectively dead, not officially. I agree that projects should announce whether they are actively maintained or not
15:41:33FromDiscord<haxscramper> like nimble that ships almost two-year-old version
15:41:39FromDiscord<haxscramper> fusion that hasn't seen updates in god knows what
15:41:50FromDiscord<ShalokShalom> Particularly when they were announced quite big quite recently as the hot new thing
15:41:51FromDiscord<haxscramper> drnim that is dead on arrival and had request to be removed
15:42:03FromDiscord<ShalokShalom> I mean particularly the pattern matching post
15:42:19FromDiscord<haxscramper> 1 It was a year and a half ago(
15:42:28FromDiscord<haxscramper> 2 when I wrote it the fusion was part of default shipping
15:42:37FromDiscord<haxscramper> 3 I literally watched the shit go down the drain before my eyes
15:42:41FromDiscord<ShalokShalom> Yeah, its one of the more recent blog posts, if I am not mistaken.
15:42:46FromDiscord<haxscramper> it was unbundled right when I was writing the article
15:42:59FromDiscord<haxscramper> and never cared for after
15:43:01FromDiscord<haxscramper> (edit) "and never cared for after ... " added "that"
15:43:12FromDiscord<ShalokShalom> In reply to @haxscramper "3 I literally watched": Would you explain? 🤪
15:43:14FromDiscord<deech> That's a shame, it could clean up a lot of compiler code.
15:43:28FromDiscord<ShalokShalom> Unbundled?
15:43:43FromDiscord<ShalokShalom> In reply to @deech "That's a shame, it": Cyo does this 😋
15:44:12FromDiscord<haxscramper> In reply to @ShalokShalom "Unbundled?": https://github.com/nim-lang/fusion/pull/33 merge my work into fusion
15:44:17FromDiscord<haxscramper> https://github.com/nim-lang/Nim/pull/16925
15:44:23FromDiscord<ShalokShalom> In reply to @haxscramper "With six months of": Ah, I see.
15:44:24FromDiscord<haxscramper> unbundle fusion couple weeks later
15:44:27FromDiscord<ShalokShalom> Thanks
15:44:35FromDiscord<ShalokShalom> Crazy
15:45:19FromDiscord<ShalokShalom> What a squandering
15:45:44FromDiscord<ShalokShalom> Its also rude against you
15:45:45FromDiscord<haxscramper> In reply to @deech "That's a shame, it": It could, but, well, FP and compiler implementation are not exactly friends with all this mutable state and so on
15:45:59FromDiscord<haxscramper> But the compiler itself could see a lot of improvements from the functional approaches
15:46:24FromDiscord<haxscramper> Even just `Result` and `Option` could make the code cleaner in lots of places
15:46:57FromDiscord<ShalokShalom> In reply to @haxscramper "It doesn't stink either,": Lets conclude it with sleep walking
15:47:12FromDiscord<haxscramper> damn that's a good one
15:47:56FromDiscord<deech> Not necessarily functional but so much of the compiler is just checking for nil and accessing a couple of fields. `Result` and `Option` are more or less unusable with matching. Type inference isn't good enough for a workflow based solely on map and flatmap.
15:48:16FromDiscord<deech> (edit) "with" => "without"
15:48:32FromDiscord<ShalokShalom> In reply to @haxscramper "it is too hard": What would help you, to implement this? 👀
15:49:28FromDiscord<ShalokShalom> In reply to @deech "Not necessarily functional but": Type inference in Nim, you might say and yes, I pattern matching and option go hand in hand
15:50:30FromDiscord<haxscramper> I'm not sure if it is even possible in the current matching implementation - it can do `{key: @value}`, and you can't exhaustively check for all `keys` in table for example. There might be a strict mode or certain edge cases. It might be possible to come up with an intermediate solution for this, something that only supports some edge cases
15:50:59FromDiscord<haxscramper> But I haven't looked into this in too much detail to be honest, because it requires a big effort to identify possible places where the exhaustiveness checking is applicale
15:51:31FromDiscord<haxscramper> Also this will most likely transition the macro from `untyped` to `typed` domain, which is a much bigger problem
15:51:31FromDiscord<ShalokShalom> Have you looked, how others do it?/
15:51:41FromDiscord<haxscramper> other languages?
15:51:47FromDiscord<ShalokShalom> Yes
15:51:57FromDiscord<haxscramper> 1 they have it as a compiler built-in so the information is readily available to them
15:51:59FromDiscord<ShalokShalom> Like, how are they doing it?/
15:52:08FromDiscord<haxscramper> 2 I don't think I've see thing like `{key:}` anywhere
15:52:21FromDiscord<ShalokShalom> How is it not a compiler plugin for us
15:52:22FromDiscord<haxscramper> 3 IIRC the algorithm is still exponential, there was a Rust article about that
15:52:36FromDiscord<haxscramper> In reply to @ShalokShalom "How is it not": have you seen the quote in the documentation?
15:53:01FromDiscord<haxscramper> https://media.discordapp.net/attachments/371759389889003532/1040293007200628797/image.png
15:53:25FromDiscord<ShalokShalom> Macro is not the first choice 🙂
15:53:54FromDiscord<deech> You can simply force an `else` , poor man's exhaustiveness checking.
15:54:03FromDiscord<ShalokShalom> You can.. Doesnt mean 'you should write half of the stdlib as macros'
15:54:52FromDiscord<zajrik> No, absolutely not. A compiler built-in would be the best option, but a macro is certainly the fastest way to get solid pattern matching coverage out there until such a time that a true, compiler supported solution can come about
15:55:30FromDiscord<ShalokShalom> Nim is 15 years old
15:55:35FromDiscord<zajrik> It gets the job done for now. Hopefully someday we'll see the real thing
15:55:51FromDiscord<ShalokShalom> Pattern matching is not exactly an exotic feature
15:56:11FromDiscord<haxscramper> macro allows to make experiments without creating an overly bloated compiler with millions of `--experimental` switches
15:56:22FromDiscord<ShalokShalom> I see. Makes sense
15:56:24FromDiscord<haxscramper> it allows to discuss the implementation without getting bogged down in details
15:56:30FromDiscord<haxscramper> of the compiler internals
15:56:35FromDiscord<haxscramper> because the thing is largely self-contained
15:56:57FromDiscord<haxscramper> In reply to @ShalokShalom "Nim is 15 years": asm is 1920 years old
15:57:14FromDiscord<haxscramper> on the more serious note
15:57:40FromDiscord<haxscramper> feels weird to write stdlib modules for a language that was created when I went to the first class in school
15:57:47FromDiscord<haxscramper> (edit) "class" => "grade"
15:58:05FromDiscord<ShalokShalom> Wow
15:58:13FromDiscord<haxscramper> In reply to @zajrik "It gets the job": Maybe the built-in implementation will be smaller, feature-wise
15:58:17FromDiscord<ShalokShalom> A quarter of a million people have seen the fireship video
15:58:33FromDiscord<haxscramper> There are a lot of things that might be too hard to implement fully correct
15:58:50FromDiscord<haxscramper> exhaustiveness is one of them
15:58:56FromDiscord<haxscramper> current impl effectively makes it too hard
15:59:02FromDiscord<haxscramper> smaller impl might work
15:59:13FromDiscord<zajrik> It would definitely be a ground-up kind of thing
15:59:14FromDiscord<ShalokShalom> Smaller in features, like..?
15:59:33FromDiscord<ShalokShalom> Would other work on the compiler contribute to do this easier?
15:59:45FromDiscord<ShalokShalom> Like, is there any groundwork that can be done
16:00:29FromDiscord<haxscramper> I think implementation-wise this still can be done in a manner similar to macro
16:00:38FromDiscord<haxscramper> Just with `PNode` instead of `NimNode`
16:00:59FromDiscord<haxscramper> So there is not a lot of additional groundwork needed aside from actually implementing it
16:01:06FromDiscord<haxscramper> and of course coming up with a design and rationale
16:02:32FromDiscord<dlesnoff> In reply to @ShalokShalom "A quarter of a": youtube views aren't equal to the number of people that watched it.↵There are far less different people than views.
16:04:03FromDiscord<ShalokShalom> In reply to @Jiezron "youtube views aren't equal": Isnt that accounted for?
16:04:07FromDiscord<jmgomez> @haxscramper that's sad to know that fusion is abandoned. I stopped using using case for pattern matching after this: https://github.com/nim-lang/Nim/issues/20435 so pretty quickly.. Do you have any idea of what to fix in order to make that work?
16:04:28FromDiscord<ShalokShalom> Like, I know they account for views who quit in under 10 seconds, and such
16:05:34FromDiscord<ShalokShalom> In reply to @haxscramper "and of course coming": That's why I asked about the other languages.
16:05:46FromDiscord<ShalokShalom> Did you seek inspiration at them?
16:06:11FromDiscord<ShalokShalom> To come up with a design.
16:07:07FromDiscord<haxscramper> In reply to @Jiezron "youtube views aren't equal": https://plausible.io/nim-lang.org?period=30d
16:07:51FromDiscord<deech> IMO it's best to come up ways it can concretely help now. Like, X is a bug that wouldn't have happened if we had it etc.
16:08:08FromDiscord<haxscramper> In reply to @jmgomez "<@608382355454951435> that's sad to": haven't seen this issue, but IIRC this is a known problem because untyped-macros-un-generics and so on
16:08:32FromDiscord<haxscramper> https://github.com/nim-lang/fusion/pull/33#issuecomment-716140197
16:08:42FromDiscord<haxscramper> In reply to @ShalokShalom "To come up with": yes
16:09:42FromDiscord<ShalokShalom> Plausible looks good
16:20:05FromDiscord<Tanguy> For what it's worth, we are using Result & Option without matching at a fairly large scale↵And sure, it's not as nice, but works
16:29:03*jmdaemon joined #nim
16:30:28*oisota joined #nim
16:33:58FromDiscord<zajrik> It's a pretty simple patch to support matching Results :Eyes: but yeah, they're totally fine to work with without matching. I'm just a sucker for cleaner code and less repetition
16:38:01FromDiscord<zajrik> I didn't know that about case statement macros not working in generic procedures though, thats rough
16:39:46FromDiscord<Phil> In reply to @Tanguy "For what it's worth,": You're stuck with only being able to return 1 exception type, aren't you?
16:40:02FromDiscord<Phil> Trying to recall what I saw of the result docs like half a year ago when I looked at them
16:41:30FromDiscord<Tanguy> That's specific to result (or monads) in general, not a question of pattern matching
16:41:55FromDiscord<jmgomez> In reply to @zajrik "It's a pretty simple": well most of the time you use functors around them and only need pm to concrete it or actually produce the effect
16:42:14FromDiscord<jmgomez> In reply to @Isofruit "You're stuck with only": doesnt exception has dynamic dispatching?
16:42:50FromDiscord<Phil> In reply to @jmgomez "doesnt exception has dynamic": It was more that Result isn't set up that you can have like 1 "success"-result and N "failure"-results encapsuling N different exceptions why it failed
16:43:12FromDiscord<Phil> Or at least that's what I meant and how I perceived the Result type at the time
16:43:35FromDiscord<Tanguy> What one of our team does is use `Result[T, CatchableError]` to get around this, which isn't great imo (I'm a Result absolutist though)
16:44:23FromDiscord<Tanguy> But Result allows you to use non-gced type as error, which is not possible with exception
16:44:35FromDiscord<Phil> I fully agree that Result is really nice, but I'd like to be able to explicitly communicate with the caller method "I failed because I didn't have a db connection" vs "I failed because the connection you gave me was nil"
16:44:54FromDiscord<Tanguy> Then you would use an enum
16:45:05FromDiscord<Tanguy> as error type
16:45:13FromDiscord<Phil> But then you have an enum per method where you want to use result
16:45:30FromDiscord<Phil> well, more than 1 exception-type-result
16:45:31FromDiscord<Tanguy> (I meant "I'm not a Result absolutist", typo)
16:45:56FromDiscord<Phil> Now that changes the meaning dramatically 😄
16:47:12FromDiscord<Tanguy> Yup 🙂 If you want to see lively discussions about results vs exception, this thread is nice https://github.com/status-im/nim-codex/discussions/41↵And also contains my point of view
16:47:40*joast joined #nim
16:47:45FromDiscord<jmgomez> In reply to @Isofruit "It was more that": You could have a failure as variant, that's what I do
16:47:51FromDiscord<Phil> Lively as in lots of participants or lively as in people loosing it?
16:48:24FromDiscord<Phil> In reply to @jmgomez "You could have a": Same issue as with enum, now you have a variant per result that has more than 1 failure reason, feels like a lot of extra code
16:50:32FromDiscord<jmgomez> In reply to @Isofruit "Same issue as with": Dont follow that last part. Either you express the error in the type system or you dont.. not sure how exceptions can be better there. i.e. you need an exception type per error
16:51:24FromDiscord<jmgomez> But oc, both approaches can be mixed.. I guess this is more of a style/opinated discussion rather than a technical one
16:52:27FromDiscord<Freyr> Can I ask about problems I'm having with my code in this channel?
16:53:11FromDiscord<Phil> In reply to @jmgomez "Dont follow that last": I'm more contrasting it against the way Rust does it than weighing it against exceptions in general.↵In rust you just go `Result<Type, ErrorType1, ErrotType2, ErrorType3.... etc.>` , the errortype thing is basically an openarray equivalent
16:53:17FromDiscord<Phil> And yeah Freyr, this is the channel for that
16:53:45FromDiscord<Phil> (edit) "equivalent" => "equivalent. ↵And then you can match against all of them"
16:54:15FromDiscord<Phil> I guess to build the equivalent you'd basically have to generate a varObject from the type definition you throw into the proc
16:55:11FromDiscord<jmgomez> In reply to @Isofruit "I'm more contrasting it": like a new type per error, just in there? So you endup with an arity of errors +1? That's seem a bit of a mess TBH. What I proposed was to expand the error type, rather than result
16:55:32FromDiscord<zajrik> In reply to @Inkyrius "Can I ask about": I sure hope so because otherwise I've been doing it in the wrong place lol
16:56:50FromDiscord<Freyr> sent a code paste, see https://play.nim-lang.org/#ix=4fwI
16:58:51FromDiscord<Freyr> `echo (some(5) >>= (x => some(x+1))).value` is what I'm actually running
16:59:03FromDiscord<Phil> In reply to @jmgomez "like a new type": Basically, you literally throw in the errortype, you don't have to define a new type↵`fn main() -> Result<(), UpErrorType> {` , you'd just add types after UpErrorType
17:02:21*rockcavera joined #nim
17:02:21*rockcavera quit (Changing host)
17:02:21*rockcavera joined #nim
17:04:53FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4fwN
17:05:26FromDiscord<Freyr> Wait no I think I've found what's causing it
17:05:47FromDiscord<Freyr> It works if I replace the `=>` from sugar with a full `proc`
17:06:00FromDiscord<Freyr> `echo (some(5) >>= (proc (n: int): Maybe[int] = some(n+1))).value` runs fine
17:07:10FromDiscord<Phil> In reply to @Inkyrius "`echo (some(5) >>= (proc": You might be running into issues with the order of macro evaluation (this is me doing wild guesses)
17:07:30*tanami joined #nim
17:10:21FromDiscord<rdb> In reply to @vindaar "If you really need": I don't "need" dot operator macros, but I got chewed out here for not using them, so...
17:13:07FromDiscord<Freyr> In reply to @Isofruit "You might be running": Seems to be related to passing generic functions to other generic functions, replacing the lambda with `proc addOne[A](n: A): Maybe[A] = some(n+1)` doesn't work but `proc addOne(n: int): Maybe[int] = some(n+1)` does
17:14:30FromDiscord<Freyr> Even if you define the generic `addOne` before the `>>=`
17:15:56FromDiscord<Phil> In reply to @Inkyrius "Seems to be related": What I can tell you is that when I start passing procs around within generic procs, I typically have the procs explicitly defined without using sugar and within my generic procs I try to do some compile-time assigning to a variable I later don't use, just to get better type checking
17:17:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4fwQ
17:17:21FromDiscord<Phil> readArticleById is an explicitly defined proc elsewhere, as are all the other procs
17:18:05FromDiscord<Phil> I could pass in readArticleById etc. directly into `createUpdateHandler` but by doing so, if I accidentally fuck up somewhere, I get the compiler to tell me "I failed to assign this proc at line X" instead of the cryptic output it would normally give me
17:18:28FromDiscord<Phil> Maybe something similar could be applicable to your scenario?
17:18:52FromDiscord<jmgomez> In reply to @Inkyrius "Seems to be related": It may be an issue with auto. Did you try to explicitly use the type in the lambda argument?
17:19:17FromDiscord<jmgomez> i.e. (x:MyType)=>blabla instead of (x)=>blabla
17:21:02FromDiscord<Freyr> Yep that works
17:22:02FromDiscord<Freyr> Wonder why it doesn't work if I make it a generic named function rather than a lambda
17:22:25FromDiscord<Freyr> The compiler should be able to tell what the types are there
17:41:06FromDiscord<dlesnoff> As a beginner, I wish something like this tutorial [Learning Nim: Macros and Pattern Matching](https://www.youtube.com/watch?v=GJpn6SfR_1M). I did not manage to make this old code work again.
17:48:23FromDiscord<ShalokShalom> In reply to @Jiezron "As a beginner, I": https://dev.to/beef331/demystification-of-macros-in-nim-13n8
17:48:26FromDiscord<ShalokShalom> Maybe not the same
17:48:34FromDiscord<ShalokShalom> I found it enlightening
17:55:38FromDiscord<Rika> In reply to @haxscramper "": when the fuck did i get quoted
17:55:40FromDiscord<Rika> damn
18:41:12*pro joined #nim
18:42:28*xet7 quit (Remote host closed the connection)
18:45:19*xet7 joined #nim
18:57:18FromDiscord<ShalokShalom> Your 15 minutes of fame are gone
18:57:49FromDiscord<ShalokShalom> That quickly puff 💨
19:15:51FromDiscord<alice.> what's the best ways to modularize a large file in nim and not deal w cyclic dependency?
19:18:38FromDiscord<michael_zks> sent a long message, see http://ix.io/4cn1
19:19:45FromDiscord<alice.> i'm not clicking that link lmao
19:27:01FromDiscord<huantian> <@&371760044473319454>
19:31:10FromDiscord<ShalokShalom> In reply to @alice. "what's the best ways": There is
19:32:03FromDiscord<ShalokShalom> https://nim-lang.org/docs/manual_experimental.html#code-reordering
19:50:43FromDiscord<dlesnoff> In reply to @ShalokShalom "https://dev.to/beef331/demystification-of-macros-in": The @ElegantBeef tutorial helped me to understand macros, but I wish to understand better getType, getTypeImpl, and pattern matching.
19:51:39FromDiscord<ShalokShalom> Well, pattern matching is currently in reconstruction anyway
19:51:55FromDiscord<ShalokShalom> But I get it
19:55:07FromDiscord<alice.> sent a long message, see http://ix.io/4fxB
19:55:16FromDiscord<ShalokShalom> In reply to @haxscramper "With six months of": Araw is asking in #internals for the details on this, I think 🙂
19:55:24FromDiscord<ShalokShalom> (edit) "Araw" => "Araq"
19:55:56FromDiscord<haxscramper> Well, I don't care
19:56:01FromDiscord<ShalokShalom> Ok
19:56:02FromDiscord<alice.> https://paste.gg/p/anonymous/fd1541fac2a345dbb4623e3098622e87
19:56:16FromDiscord<alice.> im not sure why this is happening
19:56:23FromDiscord<haxscramper> I said to him everything I wanted on the forum a year ago
19:56:28FromDiscord<alice.> (edit) "long message," => "code paste," | "http://ix.io/4fxB" => "https://play.nim-lang.org/#ix=4fxC"
19:57:17FromDiscord<alice.> building w verbose gives me
19:57:23FromDiscord<alice.> what am i doing wrong here?
19:57:24FromDiscord<alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fxD
19:57:47FromDiscord<Elegantbeef> `Error: attempting to call undeclared routine: 'parseRelational'`
19:57:55FromDiscord<alice.> except it is declared?
19:57:57FromDiscord<ShalokShalom> Do you have the pull request at hand that tries to merge it?/
19:58:17FromDiscord<alice.> @ElegantBeef i sent the files in the paste.gg link which cause this
19:58:37FromDiscord<Elegantbeef> I personally say dont usecode reordering
19:58:52FromDiscord<alice.> yeah that didnt fix shit
19:58:59FromDiscord<alice.> i commented it and it still cant find them
19:59:03FromDiscord<haxscramper> In reply to @ShalokShalom "Do you have the": There is a closed PR in fusion
19:59:20FromDiscord<Elegantbeef> you dont export expression
19:59:27FromDiscord<alice.> wdym?
19:59:36FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fxE
19:59:37FromDiscord<alice.> oh
19:59:39FromDiscord<Elegantbeef> Nim doesnt export symbols you import automatically
19:59:56FromDiscord<Elegantbeef> It only exports symbols you tell it to so anything marked with ``
20:00:02FromDiscord<Elegantbeef> Or if you `export x`
20:06:15FromDiscord<alice.> gotcha
20:09:38FromDiscord<ShalokShalom> Wait, there is an alternative to 👀
20:09:49FromDiscord<Elegantbeef> Kinda but not really
20:10:12FromDiscord<Elegantbeef> export is meant to export modules or symbols from modules you import
20:12:09FromDiscord<ShalokShalom> Ah, I see.
20:12:19FromDiscord<ShalokShalom> Is it possible with a macro?
20:12:27FromDiscord<ShalokShalom> 😜
20:13:07FromDiscord<Elegantbeef> Can you write the code normally?
20:13:28*krux02 joined #nim
20:13:32FromDiscord<vestel> Can I disable nim's dead code elimination?
20:13:48FromDiscord<Elegantbeef> No
20:14:04FromDiscord<Elegantbeef> I mean you can do `{.exportC.}` on procedures, but you cannot disable it otherwise
20:14:20FromDiscord<vestel> it kinda breaks my opaque predicates
20:14:45FromDiscord<Elegantbeef> What?
20:15:14FromDiscord<vestel> if statements that always evals to true
20:15:25FromDiscord<vestel> used as obfuscation
20:17:30FromDiscord<Elegantbeef> So you mean constant folding
20:17:54FromDiscord<Elegantbeef> Dead code elimination is removing unused code, not evaluating static code
20:18:03FromDiscord<alice.> sent a code paste, see https://paste.rs/qnH
20:18:10FromDiscord<Elegantbeef> compiler with `--implicitStatic:off`
20:18:11FromDiscord<Freyr> Is there any good documentation of how concepts work in nim?
20:18:11FromDiscord<Elegantbeef> compile even
20:18:37FromDiscord<alice.> the fact that i have to use unique names is kinda annoying
20:18:52FromDiscord<Elegantbeef> You can always base it off the Nim AST
20:18:59FromDiscord<alice.> wdym?
20:19:03FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#concepts is it↵(@Freyr)
20:19:10FromDiscord<Elegantbeef> You can always go copy how the Nim AST works
20:19:20FromDiscord<alice.> which is how exactly
20:19:27FromDiscord<Elegantbeef> You can go read the source
20:19:28FromDiscord<Elegantbeef> Cmon
20:20:52FromDiscord<alice.> so they have seperate types?
20:21:48FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim#L779-L797
20:21:59FromDiscord<Elegantbeef> The seperate types are due to the original being in pascal
20:23:59FromDiscord<alice.> im confused af
20:25:15FromDiscord<alice.> how do i break it down into structs??
20:25:41FromDiscord<Elegantbeef> What?
20:26:40FromDiscord<alice.> i dont want one massive ASTNode for every kind
20:26:51FromDiscord<alice.> i want to dispatch based on its .kind and then return a specialized struct
20:26:54FromDiscord<alice.> inheriting from it
20:27:11FromDiscord<Elegantbeef> Well then use inheritance and have a very slow compiler
20:27:47FromDiscord<alice.> In reply to @alice. "i dont want one": i just dont want it to be confusing af
20:28:05*krux02 quit (Remote host closed the connection)
20:28:07FromDiscord<alice.> In reply to @Elegantbeef "https://github.com/nim-lang/Nim/blob/devel/compiler": also this is way too confusing to read
20:28:11FromDiscord<alice.> i have no idea what they are doing
20:28:42*krux02 joined #nim
20:30:24FromDiscord<Elegantbeef> Complex AST is just a sequence
20:30:31FromDiscord<alice.> In reply to @alice. "is there a better": because if i do this i cant have any duplicate names
20:30:47FromDiscord<alice.> so how should i do this
20:31:08FromDiscord<Elegantbeef> So instead of specialising a bunch of data like you're doing you'd just have a sequence of AstNodes for things that are more than 1
20:31:24FromDiscord<alice.> could u give an example?
20:32:05FromDiscord<Elegantbeef> In Nim a procedure call is a `nkCall(nkIdent)`
20:32:37FromDiscord<EliasG2> how would i do something like this? i want to make a ecs thing, and all types of component have a list of types of component they need, this does not work https://media.discordapp.net/attachments/371759389889003532/1040363370387357786/image.png
20:32:47FromDiscord<Elegantbeef> so it'd be like `PNode(kind: nkCall, sons: @[PNode(kind: nkIdent, name: procName), arg1, arg2, arg3)])`
20:33:16FromDiscord<Elegantbeef> Types dont exist at runtime so you cannot make a method operate that way
20:33:28FromDiscord<EliasG2> (edit) "how would i do something like this? i want to make" => "sent" | "ecs thing, and all types of component have a list of types of component they need, this does not work" => "code paste, see https://play.nim-lang.org/#ix=4fxN"
20:33:34FromDiscord<Elegantbeef> Also if you're using methods/OOP you're not making an ECS but likely an EC
20:33:44FromDiscord<voidwalker> string of size 4 representing big endian number, to uint32 little endian, best way ?
20:34:04FromDiscord<EliasG2> In reply to @Elegantbeef "Types dont exist at": how would i then do?
20:34:07FromDiscord<Elegantbeef> `std/endians` + `copyMem`
20:34:12FromDiscord<alice.> @ElegantBeef im still confused could u give an example of how i would implement this
20:34:46*pro quit (Quit: pro)
20:35:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fxR
20:35:30FromDiscord<alice.> and why do i want this
20:35:30FromDiscord<alice.> i just want distinct types
20:35:35FromDiscord<Elegantbeef> You'd need `method hasAllComponents(ent: Entity): bool`↵(@EliasG2)
20:35:38FromDiscord<alice.> for binary expressions, variables etc
20:35:52FromDiscord<Elegantbeef> Well then do it your way
20:36:06FromDiscord<alice.> is it not possible?
20:36:12FromDiscord<Elegantbeef> I dont know what you want
20:36:21FromDiscord<alice.> ill write a idealistic example
20:37:22FromDiscord<EliasG2> In reply to @Elegantbeef "You'd need `method hasAllComponents(ent:": if that is supposed to check if the entity has all required components for a component, it would still need to know what kind of component i am checking for
20:37:28*jjido joined #nim
20:38:19FromDiscord<alice.> sent a code paste, see https://play.nim-lang.org/#ix=4fxS
20:38:20FromDiscord<Elegantbeef> Well then make it `hasAllComponent(comp: Component)`
20:38:27FromDiscord<Elegantbeef> Yes like i said alice you want OOP
20:38:29FromDiscord<Elegantbeef> So go use oop
20:38:39FromDiscord<Elegantbeef> Method dispatch + oop
20:39:05FromDiscord<alice.> is this a bad way to do it?
20:39:11FromDiscord<EliasG2> In reply to @Elegantbeef "Well then make it": so i would need an instance of the component to check it, i cannot use types?
20:39:15FromDiscord<alice.> i just dont want a massively overcomplicated ast
20:39:16FromDiscord<Elegantbeef> You can even make a template for this elias
20:42:17FromDiscord<EliasG2> In reply to @Elegantbeef "You can even make": how would that work? the small section from https://nim-lang.org/docs/tut2.html#generics is all i have read about them
20:43:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fxT
20:43:10FromDiscord<Elegantbeef> Sorry a template lacks the required capabillities
20:43:15FromDiscord<Elegantbeef> A macro would be required
20:43:26FromDiscord<Elegantbeef> Also are you actually after an ECS or a Unity like EC?
20:44:07FromDiscord<alice.> how would i best represent this in a cleaner way
20:44:13FromDiscord<alice.> using OOP seems like a antipattern
20:44:15FromDiscord<Elegantbeef> An ECS is a specifically designed API that is highly efficient for cache and memory and does not use methods
20:44:31FromDiscord<Elegantbeef> I told you how I'd do it you didnt want to do it that way so dont ask me
20:44:44FromDiscord<alice.> what is your children even for???
20:44:49FromDiscord<alice.> in the example u gave
20:44:52FromDiscord<Elegantbeef> All the children nodes
20:45:03FromDiscord<Elegantbeef> In the example i gave it'd be the name of the procedure and arguments
20:45:04FromDiscord<alice.> but i want to dispatch based on their KIND
20:45:18FromDiscord<Elegantbeef> Case statements exist
20:45:19FromDiscord<EliasG2> In reply to @Elegantbeef "An ECS is a": i am probably just making an ec, then
20:45:20FromDiscord<voidwalker> In reply to @Elegantbeef "`std/endians` + `copyMem`": code please ? :\ What am I supposed to be copying and why ? There's somethign funky with the string memory. If I manually assign its values to array[4, uint8], I get the right result, directly with the string not
20:45:29FromDiscord<alice.> but then i have to have variables that have unique names
20:47:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fxX
20:47:24FromDiscord<EliasG2> In reply to @EliasG2 "i am probably just": the components on the entities will just hold data, and i will then have a proc for each component (that needs one) that most likely loops over all entities and updates them
20:47:47FromDiscord<Elegantbeef> https://github.com/enthus1ast/ecs might help you elias
20:48:03FromDiscord<Elegantbeef> That sounds like ECS
20:48:09FromDiscord<Elegantbeef> So you're doing it completely wrong
20:48:36FromDiscord<Elegantbeef> Method and OOP is to be avoided for ECS
20:48:51FromDiscord<Elegantbeef> You use simple structs and have low level operations to allocate and manage
20:49:22FromDiscord<Elegantbeef> This isnt a very good ECS that one should use but it's a very light one on macros https://github.com/beef331/nimtrest/blob/master/yeacs.nim
20:49:31FromDiscord<Elegantbeef> Polymorph also exists but i doubt you'd want to read that
20:50:03FromDiscord<EliasG2> In reply to @Elegantbeef "Method and OOP is": how would i make a base component that the components extend without a little bit of oop?
20:53:42FromDiscord<Elegantbeef> I dont really count stack based OOP as oop but yea you do it stack wise
20:53:47FromDiscord<Elegantbeef> Like yeacs does
20:54:17FromDiscord<Elegantbeef> You dont use `ref object of X` you do `object of X` and store the layout of the archetype elsewhere
20:54:30FromDiscord<Elegantbeef> This way when operating on the data it's fast as you have small types that are contiguously stored
20:56:38FromDiscord<voidwalker> blah, so the bytes of the int I need to convert are 0 0 0 192. I get 3221225472 as value for both leInt and beInt. It's supposed to be 192
20:57:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fy1
20:57:59FromDiscord<Elegantbeef> When i query for given components i instantiate the components then check which position they are in, then i yield all of the components that way
20:58:04FromDiscord<Elegantbeef> Well you kinda lied 😄↵(@voidwalker)
20:58:09FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4fy2
20:58:10FromDiscord<voidwalker> I did ?
20:58:16FromDiscord<Elegantbeef> You dont want a uint32 you want each byte in reverse
20:58:46FromDiscord<voidwalker> of course I want a uint32, it's a 4 byte long number..
20:59:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fy3
20:59:50FromDiscord<Elegantbeef> You said you have `0 0 0 192` and expect the result to be 192
21:00:20FromDiscord<voidwalker> isn't big/little endians the bytes in reverse?
21:03:52FromDiscord<Elegantbeef> You then likely dont have BE
21:04:17FromDiscord<Elegantbeef> Cause 3221225472 is 0 0 0 192 flipped
21:05:20FromDiscord<voidwalker> The length prefix is a four byte big-endian value. :\
21:06:19FromDiscord<Elegantbeef> I dont know what to say
21:09:27FromDiscord<voidwalker> so you mean 0 0 0 192 is actually little endian ?
21:11:23*rockcavera quit (Remote host closed the connection)
21:11:51*rockcavera joined #nim
21:13:33FromDiscord<Elegantbeef> No clue
21:13:38FromDiscord<auxym> `0 0 0 192` is 192 in BE
21:14:06FromDiscord<auxym> https://en.wikipedia.org/wiki/Endianness#/media/File:Big-Endian.svg
21:17:24FromDiscord<auxym> I'm not a huge fan of the endians module personally, consider using the `READ32BE` macro defined here (https://justine.lol/endian.html), translated to nim. This way you can read a single byte at a time from your stream and `or` it into your result.
21:30:21FromDiscord<voidwalker> oh lol, I was actually looking for the ` swapEndian32` proc
21:32:28FromDiscord<voidwalker> so I just needed ` swapEndian32(addr leInt, addr msgLenS[0])`
21:44:16*ltriant quit (Ping timeout: 252 seconds)
22:03:39*ltriant joined #nim
22:08:12*xet7 quit (Read error: Connection reset by peer)
22:19:43*nyeaa49284 quit (Quit: Ping timeout (120 seconds))
22:19:59*nyeaa49284 joined #nim
22:20:22FromDiscord<auxym> yeah, that's (one reason) why I'm not a big fan of `std/endians`, the naming of procs isn't super clear and the types (`pointer`) don't help either
22:25:58FromDiscord<voidwalker> uhm can i define a string using decimal values for the chars ?
22:27:33FromDiscord<Elegantbeef> `var a = "\xaa\xaa\xaa"`
22:28:01FromDiscord<voidwalker> that's hex
22:29:09FromDiscord<Elegantbeef> same thing
22:29:10FromDiscord<Elegantbeef> `"\101\102"`
22:34:02*jmd_ joined #nim
22:34:27*jmdaemon quit (Ping timeout: 255 seconds)
22:39:17*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
22:42:35FromDiscord<voidwalker> is there maybe some more versatile/efficient (async) socks library to be using rather than the std one ?
22:42:52FromDiscord<voidwalker> for a task like a torrent client
22:43:39FromDiscord<voidwalker> (edit) "socks" => "sockets"
22:48:42*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:55:51FromDiscord<auxym> you mean std/asyncnet?
22:57:42*euantorano quit (Read error: Software caused connection abort)
22:57:52*euantorano joined #nim
23:00:35FromDiscord<auxym> you could also probably access raw socket stuff in chronos
23:15:03*xet7 joined #nim
23:32:05*LuxuryMode joined #nim
23:40:09*krux02 quit (Remote host closed the connection)
23:52:39FromDiscord<Freyr> sent a code paste, see https://play.nim-lang.org/#ix=4fyu