04:52 <+bridge> /times 04:52 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1104963942524129351/image.png 04:52 <+bridge> xd 04:52 <+bridge> maybe for months it's using calendar months but for weeks it's calculating with days 04:52 <+bridge> i can't imagine a specific scenario where this would happen but i guess it's possible if they're not using the same system 04:53 <+bridge> maybe they should just be 30 day months 04:53 <+bridge> months = days / 30 04:53 <+bridge> weeks = (days / 30) % 7 04:54 <+bridge> 365 / 12 04:55 <+bridge> yes that is 30 09:44 <+bridge> paiton trivia! Will this print any duplicated messages when run? if so which lines are the same?```python 09:44 <+bridge> class Foo: 09:44 <+bridge> pass 09:44 <+bridge> 09:44 <+bridge> class Bar: 09:44 <+bridge> def __init__(self, f = Foo()): 09:44 <+bridge> self.f = f 09:44 <+bridge> 09:44 <+bridge> b = Bar() 09:44 <+bridge> print(id(b)) 09:44 <+bridge> print(id(b.f)) 09:44 <+bridge> 09:44 <+bridge> print('----') 09:44 <+bridge> 09:44 <+bridge> b = Bar() 09:44 <+bridge> print(id(b)) 09:44 <+bridge> print(id(b.f)) 09:44 <+bridge> ``` 09:46 <+ChillerDragon> btw ``id(object)`` is to check if those are the same objects https://docs.python.org/3/library/functions.html#id 09:46 <+ChillerDragon> > Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value. 09:53 <+bridge> It is allowed to. Idk if CPython re-uses ids that aggressively though 09:57 <+ChillerDragon> yea the docs i linked are a bit missleading tbh it not about id reuse but by the objects staying the old ones with all the old properties set etc 09:58 <+ChillerDragon> TIL ``print(id(b.f))`` matches but ``print(id(b))`` does not 09:58 <+ChillerDragon> so even tho you get a new outer Bar instance the Foo instance inside will be the old one. If you change the inner foo and recreate bar you still have the changes in foo 09:58 <+ChillerDragon> thats so broken 10:00 <+bridge> ```python 10:00 <+bridge> class Foo: 10:00 <+bridge> def __init__(self): 10:01 <+bridge> self.prop = None 10:01 <+bridge> 10:01 <+bridge> class Bar: 10:01 <+bridge> def __init__(self, f = Foo()): 10:01 <+bridge> self.f = f 10:01 <+bridge> self.prop = None 10:01 <+bridge> 10:01 <+bridge> b = Bar() 10:01 <+bridge> b.prop = "bar" 10:01 <+bridge> b.f.prop = "foo" 10:01 <+bridge> 10:01 <+bridge> b = Bar() 10:01 <+bridge> print(b.prop) 10:01 <+bridge> print(b.f.prop) 10:01 <+bridge> 10:01 <+bridge> ``` 10:01 <+bridge> ``` 10:01 <+bridge> $ python3 fml.py 10:01 <+bridge> None 10:01 <+bridge> foo 10:01 <+bridge> ``` 10:01 <+bridge> Wait really? Now that is most unexpected. Is it because of when the default parameters get evaluated? 10:01 <+ChillerDragon> idk what happens but it fucked my morning xd 10:02 <+ChillerDragon> i moved the f = Foo() out of the parameters into the __init__ body and it stopped doing the weird stuff 10:03 <+bridge> Yeah, then I guess my hypothesis is right 10:03 <+ChillerDragon> seems like the class constructor parameters are evaluated once and kept/shared forever even if they are objects with state 10:03 <+ChillerDragon> such a trol 10:04 <+bridge> That'd be hell to debug 😄 10:04 <+ChillerDragon> tell me about it 10:04 <+ChillerDragon> i did nothing else all day 10:08 <+bridge> ```python 10:08 <+bridge> class Bar: 10:08 <+bridge> def __init__(self, f = "f"): 10:08 <+bridge> self.f = f 10:08 <+bridge> self.g = "f" 10:08 <+bridge> 10:08 <+bridge> b = Bar() 10:08 <+bridge> print(id(b.f)) 10:08 <+bridge> print(id(b.g)) 10:08 <+bridge> 10:08 <+bridge> b = Bar() 10:08 <+bridge> print(id(b.f)) 10:08 <+bridge> print(id(b.g)) 10:08 <+bridge> ``` 10:09 <+bridge> so lerato out of those 4 printed ids how many are the same? 10:52 <+bridge> python bad 11:52 <+bridge> chillerdragon: impl dependent 11:52 <+bridge> @Learath2 yea, default parameters are only evaluated once 'for performance reasons' (lol python) 11:52 <+ChillerDragon> yea thought so too 11:52 <+ChillerDragon> well in my python its all the same id lol 11:53 <+ChillerDragon> python is slow af and then it tries to optimize random things with weird side effects xd 13:38 <+bridge> @heinrich5991 i remember asking this before, but if my server is in helsinki, but the hetzner company is german, what laws apply to my server? 13:39 <+bridge> https://www.pinsentmasons.com/out-law/news/content-is-made-available-in-jurisdiction-where-server-is-located-rules-high-court 13:39 <+bridge> probably finnish, german and spanish law 13:39 <+bridge> spanish cuz im spanish right? xd 13:39 <+bridge> yes 13:40 <+bridge> i cant say european law right 13:40 <+bridge> xd 13:41 <+bridge> ``` 13:41 <+bridge> === Jurisdiction and legality of content === 13:41 <+bridge> Publication of information found on wiki.ddnet.org may be in violation of the laws of the country or jurisdiction from where you are viewing this information. The wiki.ddnet.org database is stored on servers in Finland, and is maintained in reference to the protections afforded under local and federal law. Laws in your country or jurisdiction may not protect or allow the same kinds of speech or distribution. wiki.ddnet.org does not encourage the vi 13:41 <+bridge> 13:41 <+bridge> Thank you for spending the time to read this page, and please enjoy your experience at wiki.ddnet.org. 13:41 <+bridge> ``` 13:41 <+bridge> this is the current dislaimer on the legality of content 13:41 <+bridge> how should i word these 3 countries? xd 13:43 <+bridge> maybe: 13:43 <+bridge> > The wiki.ddnet.org database is stored on servers in Finland hosted by a company in Germany maintained by a person in Spain, all in reference to the protections afforded under each local ... 13:43 <+bridge> why do you have this disclaimer though? if it's for some actual legal effect, I'm no expert 13:44 <+bridge> if not, why have it at all? 13:44 <+bridge> idk i copied mediawiki 13:44 <+bridge> and why not? 13:44 <+bridge> its a empty page like the copyright u linked in #wiki by default 13:45 <+bridge> why not: because copy-pasted boilerplate text isn't useful, it wastes people's time 13:45 <+bridge> what if someone sues me 13:45 <+bridge> xd 13:45 <+bridge> also this text is quite ez to read 13:46 <+bridge> i copied it from mediawiki 13:46 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105098342662426624/image.png 13:46 <+bridge> what should i put in that link? 13:46 <+bridge> if you want it to have legal effect, maybe you 13:46 <+bridge> or is it useless too 13:46 <+bridge> if you want it to have legal effect, maybe you shouldn't ask me ^^ 13:46 <+bridge> i dont ask u as if u a lawyer 13:46 <+bridge> xd 13:47 <+bridge> > Yes, you need a disclaimer on your website. Disclaimers protect your business against legal liability by saying that you won't be held responsible for how people use your site, or for any damages they suffer as a result of your content. 13:47 <+bridge> hmm 13:47 <+bridge> but if its not a business 13:47 <+bridge> xd 13:47 <+bridge> the world is complicated 13:47 <+bridge> ddnet has MIT license which also has a disclaimer 13:48 <+bridge> Put a rickroll 13:48 <+bridge> @heinrich5991 imagine a editor suddenly post something rly ilegal 13:48 <+bridge> i just want a bit of assurance xd 13:48 <+bridge> ddnet is under the zlib license, not MIT 13:49 <+bridge> oh, interesting, so only teeworlds is MIT? 13:49 <+bridge> the rest of the point still stands 13:50 <+bridge> ddnet inherited teeworlds's zlib license 13:50 <+bridge> i.e. teeworlds isn't MIT 13:50 <+bridge> ah, yeah, I'm mixing them up 13:51 <+bridge> MIT is also a confusing name 13:51 <+bridge> it can mean x11 13:51 <+bridge> or other things 13:51 <+bridge> https://www.gnu.org/licenses/license-list.en.html 13:51 <+bridge> > Expat License (#Expat) 13:51 <+bridge> > 13:52 <+bridge> > This is a lax, permissive non-copyleft free software license, compatible with the GNU GPL. 13:52 <+bridge> > 13:52 <+bridge> > Some people call this license “the MIT License,” but that term is misleading, since MIT has used many licenses for software. It is also ambiguous, since the same people also call the X11 license “the MIT License,” failing to distinguish them. We recommend not using the term “MIT License.” 14:03 <+ChillerDragon> legal advice :justatest: 14:06 <+bridge> Did you get a chance to look at #5737 yet, @heinrich5991 ? 14:06 <+bridge> https://github.com/ddnet/ddnet/pull/5737 14:07 <+bridge> bezier curve collision :justatest: 14:07 <+bridge> suddenly we can build rollercoasters in tw 😂 14:14 <+bridge> not really, no, sorry 14:15 <+bridge> I can only guarantee it's going to be included when I go through all the PRs of ddnet the next time 14:18 <+bridge> We should also be careful to not add too much for the release 14:19 <+bridge> The ime stuff is already a major improvement and should be tested 14:22 <+bridge> default parameter are created once, then they are shared across all calls 14:22 <+bridge> if you use a list with `[]` as default parameter, then it is shared through all calls 14:23 <+bridge> that's why you should use None rather than class or mutable objects 14:23 <+bridge> string can be safely used as default as they're immutable 14:24 <+bridge> that's why python does something wrong here 14:24 <+bridge> because it's unintuitive without knowing the rules 14:24 <+bridge> if you use a list with `[]` as default parameter, then it is shared through all calls, so if it is modified by a call, it is modified in all subsequent calls 14:24 <+bridge> true 14:47 <+bridge> https://www.reddit.com/r/ProgrammerHumor/comments/13bhkyv/true/ 14:53 <+bridge> Where is the joke 15:26 <+bridge> nice trivia chiller 15:26 <+bridge> tomorrow more 16:18 <+ChillerDragon> ryo python enjoyer 16:18 <+ChillerDragon> @Chairn oh no post removed what did it say o.O 16:20 <+bridge> > Microsoft: Wait, I can explain 16:20 <+bridge> > Google: You spy through the whole OS? I only spy the web. 16:20 <+bridge> > Apple: Your users know that you are spying? 16:21 <+bridge> > Linux: You guys are spying? 16:21 <+ChillerDragon> hacker 16:21 <+ChillerDragon> and thanks 16:22 <+ChillerDragon> how did u get it? or do u remember it? 16:22 <+ChillerDragon> https://i.redd.it/vhzuhx672ju61.jpg 16:23 <+ChillerDragon> makes more sense if you know the movie i guess 16:28 <+bridge> the movie? 16:28 <+bridge> wasn't the last one some athlete? 16:34 <+bridge> https://www.youtube.com/watch?v=eZZbt7KFJqU 16:34 <+bridge> I think the relevant part in the second half, don't have audio rn 16:44 <+ChillerDragon> yes wat pati said 16:53 <+bridge> https://github.com/jesseduffield/lazygit 16:54 <+bridge> chiller this for u 16:54 <+bridge> the name matches u cuz u lazy 16:56 <+ChillerDragon> yea ik it but never felt the urge to try it i prefer prompts of uis unless something really needs it like a text editor 16:56 <+ChillerDragon> but i know people swear on lazy git 16:57 <+bridge> my query time is growing up :justatest: 16:57 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105146354340220958/image.png 16:57 <+ChillerDragon> ddstats? 16:57 <+bridge> no unrelated to ddnet 16:57 <+ChillerDragon> trash 16:57 <+bridge> xd 16:59 <+bridge> chiller 16:59 <+bridge> do git pull at my game 16:59 <+bridge> and run it 16:59 <+bridge> release 17:04 <+ChillerDragon> ok 17:05 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105148537014079519/FvnVxoKaYAALkxs.png 17:05 <+bridge> me in the future (?) 17:06 <+bridge> :justatest: 17:06 <+ChillerDragon> xd 17:08 <+ChillerDragon> it sticks out waaaaayyy to far bru 17:08 <+ChillerDragon> https://zillyhuhn.com/cs/.1683558513.png 17:09 <+bridge> yy 17:09 <+ChillerDragon> https://zillyhuhn.com/cs/.1683558579.png 17:09 <+ChillerDragon> gnome be like 17:12 <+ChillerDragon> lol crazy that ur toolchain toml made me auto dl new toolchain on cargo build 17:12 <+ChillerDragon> rust very pog 17:12 <+bridge> its cuz the last nightly is broken 17:12 <+bridge> with wgpu 17:12 <+ChillerDragon> its 0 setup for me to compile this 17:12 <+bridge> https://github.com/rust-lang/rust/issues/111320 17:12 <+ChillerDragon> so nice 17:12 <+bridge> i know 17:13 <+bridge> i set it up 17:13 <+bridge> im rust god 17:13 <+ChillerDragon> i see 17:13 <+ChillerDragon> but the time safed from me manually setting it up is spent on compiling xd 17:13 <+ChillerDragon> saved* 17:13 <+ChillerDragon> jesus 17:13 <+bridge> xd 17:13 <+bridge> the thing is 17:13 <+bridge> the weapon is made for a side view 17:13 <+bridge> and i need top down 17:13 <+bridge> so it will always look weird xd 17:14 <+ChillerDragon> oh so u need diff angle? 17:14 <+bridge> yeah 17:14 <+bridge> but im bad artist 17:14 <+ChillerDragon> bot u can stick it more in either way 17:14 <+bridge> so i just go with it 17:14 <+ChillerDragon> https://www.youtube.com/watch?v=MtZpB6_rY-0 17:14 <+ChillerDragon> xxxxxxxxxxD 17:14 <+ChillerDragon> old but gold 17:15 <+bridge> so far bevy is pog 17:15 <+bridge> i have system that aims any entity which has a AimTarget() for me 17:15 <+bridge> 17:15 <+ChillerDragon> bot 17:16 <+bridge> i could do it 3d 17:16 <+bridge> actually blender is easier for me than drawing 17:16 <+bridge> but 3d is more complex 17:17 <+bridge> @Ryozuki are u in ur holidays? 17:17 <+bridge> no 17:17 <+bridge> the game update i did yesterday xd 17:17 <+bridge> so u writing compilers and games 17:17 <+ChillerDragon> yes teecity is for sure ryos dayjob 17:18 <+bridge> any other awesome project i'd to know about from u? 17:18 <+ChillerDragon> paypal 17:18 <+bridge> not yet 17:18 <+bridge> recently i tried wow again 17:18 <+bridge> xd 17:18 <+ChillerDragon> xd 17:18 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105151793081618512/image.png 17:18 <+bridge> my paypal crate is quite big 17:18 <+bridge> or not 17:19 <+ChillerDragon> yes big 17:19 <+bridge> i actually met a ffxiv plugin dev that knows someone working in a company that uses my crate 17:19 <+bridge> lmfao 17:19 <+bridge> but thats my bad 17:19 <+bridge> i was in my age where i didnt use agpl for everything yet 17:19 <+ChillerDragon> hope your warranty disclaimer is legally solid axaxax 17:19 <+bridge> too bad 17:21 <+ChillerDragon> bash and c both dont have and need a package manager because the devs are pros and write everything from scratch within minutes 17:22 <+ChillerDragon> only latte drinking rust soydevs need to ``cargo add sum_positive_digits`` 17:24 <+bridge> i just noticed, i have 0 IQ 17:24 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105153135124692992/image.png 17:24 <+ChillerDragon> xxxxxxxxxxxxxxxD 17:24 <+ChillerDragon> dislexic jopsti 17:25 <+ChillerDragon> https://zillyhuhn.com/cs/.1683559496.png 17:25 <+ChillerDragon> rust devs be like 17:26 <+bridge> i no get it 17:26 <+ChillerDragon> they need crate for that 17:27 <+bridge> doesnt it make sense xd 17:27 <+ChillerDragon> because they dont know how to build stuff without using other ppl lib 17:27 <+bridge> so basically like javascript 17:27 <+ChillerDragon> yes 17:27 <+bridge> just in fast 17:27 <+bridge> sounds good xd 17:27 <+ChillerDragon> yes 17:27 <+ChillerDragon> xd 17:29 <+bridge> I randomly got the map unloaded crash in the CI on the PR that was supposed to fix exactly this crash :/ #6565 17:29 <+bridge> https://github.com/ddnet/ddnet/pull/6565 17:29 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105154522298458202/2023-05-08-173602_672x467_scrot.png 17:29 <+bridge> that's what i call lucky 17:30 <+bridge> don't explain to 0 IQers pls 17:31 <+bridge> thats the dependency list of the crate `is-even-or-odd` 17:31 <+bridge> it depends on a crate `is-even` and another one `is-odd`, extending the joke about pointless dependencies 17:32 <+bridge> the crate always returns positivity, i'd say its a win for human species 17:34 <+bridge> gud description :saddo: 17:34 <+ChillerDragon> lol roby 17:34 <+ChillerDragon> lmao patiga xd 17:36 <+ChillerDragon> > Returns true if the given number is even **or** odd. 17:36 <+ChillerDragon> xd 17:36 <+ChillerDragon> ``fn is_odd_or_even(num: i32) { true }`` 17:37 <+bridge> no 17:37 <+bridge> 17:37 <+bridge> num.is_even() || num.isodd() 17:37 <+bridge> xdd 17:37 <+ChillerDragon> ye 17:37 <+bridge> they dont optimize it 17:37 <+bridge> xD 17:37 <+ChillerDragon> xd 17:37 <+ChillerDragon> aw shit i forgot :bool i guess 17:37 <+bridge> bad rust code 17:37 <+ChillerDragon> my rust is ass 17:37 <+ChillerDragon> ik ik 17:37 <+bridge> it should be const 17:37 <+ChillerDragon> fakof 17:37 <+ChillerDragon> ah no its -> bool 17:37 <+bridge> and _ before num 17:37 <+ChillerDragon> ye 17:37 <+bridge> bcs unused 17:37 <+bridge> and #[inline] 17:37 <+ChillerDragon> jesus 17:37 <+bridge> ur so bad 17:37 <+bridge> shame 17:38 <+bridge> XD 17:38 <+ChillerDragon> ._. 17:38 <+ChillerDragon> literally crying 17:38 <+bridge> XD 17:38 <+bridge> welcome to rust heaven chilllerdragon 17:38 <+bridge> we except programmers from all languages 17:38 <+bridge> NOT 17:38 <+ChillerDragon> its like learning french 17:38 <+bridge> chiller 17:38 <+bridge> add this 17:38 <+bridge> ```rust 17:38 <+bridge> #![forbid(unsafe_code)] 17:38 <+bridge> #![deny(missing_docs)] 17:39 <+bridge> #![deny(warnings)] 17:39 <+bridge> #![deny(clippy::nursery)] 17:39 <+bridge> #![deny(clippy::pedantic)] 17:39 <+bridge> #![deny(clippy::all)] 17:39 <+bridge> ``` 17:39 <+bridge> at the top of lib.rs 17:39 <+bridge> it will tell u how to make good rust 17:39 <+ChillerDragon> good to know 17:39 <+bridge> the first may not be needed if u need unsafe 17:39 <+ChillerDragon> the 2nd is also trol 17:39 <+bridge> no 17:39 <+ChillerDragon> okok 17:39 <+bridge> document 17:39 <+bridge> even if heinrich dislikes it 17:39 <+bridge> kek 17:39 <+ChillerDragon> he also doc 17:40 <+bridge> he dislikes pointless docs 17:40 <+ChillerDragon> wot 17:40 <+ChillerDragon> in the code? 17:40 <+ChillerDragon> since when 17:40 <+bridge> // this function returns if the number is even 17:40 <+bridge> fn is_even 17:40 <+ChillerDragon> heinrich u no like^? 17:40 <+bridge> xdd 17:41 <+ChillerDragon> i can already see ppl putting their code into chatgpt and generating wall of doc comments and the others putting the wall of text into chatgpt to sum it up 17:41 <+ChillerDragon> wat a waste 17:42 <+bridge> xDD 1 - 1 = 0 <=> 1 = 1 17:42 <+bridge> https://github.com/HigherOrderCO/HVM 17:43 <+bridge> hvm > haskell 17:43 <+ChillerDragon> https://zillyhuhn.com/cs/.1683560612.png 17:43 <+ChillerDragon> nice marketing readme 17:44 <+bridge> ofc 17:44 <+ChillerDragon> because its written in js 17:53 <+bridge> ```rust 17:53 <+bridge> // Get Search by Id 17:53 <+bridge> fn getSearchById(id: u32) 17:53 <+bridge> ``` 17:54 <+bridge> parameters: id: u32 17:54 <+bridge> - the id to search by 17:54 <+bridge> xD 17:55 <+bridge> ```rust 17:55 <+bridge> /* Get Search by ID 17:55 <+bridge> /* Parameters: 17:56 <+bridge> /* id: u32 -> The id (unsigned 32 bit integer) of the search to get 17:56 <+bridge> /* Returns: 17:56 <+bridge> /* Search -> The Search object that belongs to the id 17:56 <+bridge> */ 17:56 <+bridge> fn getSearchById(id: u32) -> Search``` 17:56 <+bridge> Noooo, I ruined the syntax hilighting by not putting the \`\`\` on the next line, damn you shitty markdown implementation written by a drunk js developer 17:57 <+bridge> ``` hi `hi` ```hi``` ``` 17:58 <+bridge> One of the engineerings 18:01 <+bridge> hard syntax 18:01 <+bridge> we actually have quite a few markdown bugs on our ddnet website bcs of this syntax xd 18:02 <+bridge> *we have quite a few syntax errors, if we'd follow strict markdown rules, what we dont 18:05 <+ChillerDragon> imagine not using a linter in strict mode when writing markdown 18:05 <+bridge> portability bra 18:06 <+bridge> the js markdown lib broke xd 18:07 <+bridge> i know u dont like this 18:07 <+bridge> but i have a sense of completion in me 18:07 <+bridge> in games too 18:07 <+bridge> as in, everything must be perfect 18:07 <+bridge> hard to describe 18:07 <+bridge> if its perfect, it doesnt need documentation 18:07 <+bridge> 😉 18:07 <+bridge> fake 18:07 <+bridge> only simple code documents itself 18:09 <+bridge> also wtf is that /* 18:09 <+bridge> u only need the first 18:09 <+bridge> xd 18:09 <+bridge> indeed in rust, which i like 18:09 <+bridge> this is a bug 18:09 <+bridge> rust docs are awesome 18:09 <+bridge> so easy to do intra links 18:09 <+bridge> multilines open new multilines inside other multilines 18:09 <+bridge> [[your mom]] 18:09 <+bridge> and then a link to ur mom 18:10 <+bridge> (heinrich dont ban me pls) 18:10 <+bridge> sometimes i have the urge to do ur mom jokes, very childish i know 18:10 <+bridge> where is the joke? 18:10 <+bridge> :kek: 18:11 <+bridge> @Jupeyy_Keks if ur lazy to write docs 18:11 <+bridge> just ask chatgpt 18:12 <+bridge> bonus points if u ask it passing classified company code 18:13 <+bridge> if i write doc, i am defs not a person to write much. 18:13 <+bridge> 18:13 <+bridge> Some ppl are like: 18:13 <+bridge> Ok now lets add my whole biography 18:14 <+bridge> @Ryozuki i have an important question to you. 18:14 <+bridge> When you code (and i don't mean the writing itself), do you think in english or in spanish in your head? XD 18:15 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105165981837430884/image.png 18:15 <+bridge> or catalan xdd 18:15 <+bridge> english 18:15 <+bridge> i do so much in english 18:15 <+bridge> even my internal voice is often in english 18:15 <+bridge> lately 18:15 <+bridge> i think in Chairn 🙂 18:15 <+bridge> i have to say, i couldn't tell 18:15 <+bridge> it's probably a mix 18:15 <+bridge> it's probably none 18:16 <+bridge> concept and ideas are not thought in terms of human language directly iirc 18:17 <+bridge> what i am sure about is. there is a learath in my head saying "waste more ram for more performance, you are doing it right" 18:18 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105166847344660611/image.png 18:18 <+bridge> XD 18:18 <+bridge> chatgpt is sadly to diplomatic 18:19 <+bridge> but it probably knows the real answer 18:19 <+bridge> xd 18:19 <+bridge> chatgpt is sadly too diplomatic 18:21 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105167644321124352/image.png 18:21 <+bridge> that's how u do it 18:22 <+bridge> xd 18:22 <+bridge> the trick in chatgpt is, tell it to answer your question "just for fun" 18:22 <+bridge> 18:22 <+bridge> it suddenly gives u approximation numbers etc. 18:23 <+bridge> everything where it normally says: "it cant tell bro" 18:23 <+bridge> everything where it normally says: "i cant tell bro" 18:24 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105168244437950485/image.png 18:25 <+bridge> xd 18:29 <+bridge> I pretty much only document quirks and specifics. Like if the function is `double sin(double t)` 18:29 <+bridge> I’d document it’s domain, the approximation I’ve used, and maybe performance characteristics. 18:29 <+bridge> Something like `size_t container::length()` doesn’t really need any documentation. At least imho, obv very very subjective 18:30 <+bridge> https://github.com/keepassxreboot/keepassxc/pull/8825 18:30 <+bridge> this is poggers 18:30 <+bridge> https://news.ycombinator.com/item?id=35859877 18:30 <+bridge> Another trick is to say it’s for creative writing. It flat out refused to write anything doomer without that 18:31 <+bridge> good to know xd 18:31 <+bridge> i would say in C it needs more docs than in rust 18:31 <+bridge> // this can cause ub due to the following 999 reasons: 18:31 <+bridge> - its made in c 18:32 <+bridge> but yeah some stuff can be very obvious to you, the main dev, but good docs often help ppl get onboard 18:32 <+bridge> and some stuff may not be obvious for others 18:32 <+bridge> i dont talk about these very simple things tho xd 18:32 <+bridge> As long as the input domain is respected I think your code shouldn’t exhibit any UB ever 18:32 <+bridge> (well i wouldnt be surprised if taking the length of a container is ub) 18:34 <+bridge> I guess if calling member functions before calling an init function is UB that is definitely worth documenting 18:34 <+bridge> > For any string operation, if as a result of the operation, size() would exceed max_size() then the operation throws length_error. 18:34 <+bridge> xd 18:34 <+bridge> §21.3/4a ( 18:34 <+bridge> exceptions ew 18:34 <+bridge> c++ rly wanted to be ugly 18:35 <+bridge> I really enjoy how rust did errors, one of my fav things about it 18:35 <+bridge> but probably nobody would handle such errors even in rust 18:35 <+bridge> Just need to not misuse it and make an anyhow sled all the way to main 18:35 <+bridge> thats not the point tho 18:35 <+bridge> if u arent working on smth critical xd 18:36 <+bridge> u get fully typed errors u can pass up the call stack easily 18:36 <+bridge> thats why u use anyhow or eyre in binary crates 18:36 <+bridge> but thiserror on libs 18:36 <+bridge> yeah 18:36 <+bridge> its defs well done 18:36 <+bridge> also it forces u to handle the errors 18:36 <+bridge> one way or another 18:36 <+bridge> better would be no bugs at all 18:36 <+bridge> u cant ignore them 18:36 <+bridge> :⁾ 18:36 <+bridge> :^) 18:36 <+bridge> u opt in to ignore them 18:36 <+bridge> by crashing 18:37 <+bridge> well 18:37 <+bridge> Passing an error up the callstack should imho be a conscious decision you have to make every time 18:37 <+bridge> not crashing 18:37 <+bridge> thats what u do with Result 18:37 <+bridge> Not the default like with exceptions 18:37 <+bridge> true 18:37 <+bridge> and java has the worst 18:37 <+bridge> checked and non checked 18:37 <+bridge> a mix of shit 18:37 <+bridge> xd 18:38 <+bridge> the worst about exceptions is actually that ppl use it in places where u except them to throw 18:38 <+bridge> e.g. IO 18:38 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105171962545831976/jvm.png 18:39 <+bridge> lets face it, i bough 32gb ram for minecraft 18:39 <+bridge> not for coding 18:39 <+bridge> true 18:39 <+bridge> https://cdn.discordapp.com/attachments/293493549758939136/1105172160533774406/kkfp545bxpq01.png 18:39 <+bridge> i remember i had flags so the GC could use upto 20GB ram, and then it hit 20gb ram and cleared all at once xDDD 18:39 <+bridge> insane laggs 18:40 <+bridge> xd 18:40 <+bridge> is that the new java syntax? 18:41 <+bridge> didnt use java since java 8 i think xd 18:41 <+bridge> ah i had to use it for android 18:41 <+bridge> <.< 18:41 <+bridge> pain 18:41 <+bridge> No new syntax there 😛 18:42 <+bridge> oh xd 18:42 <+bridge> never seen it before in java code 18:42 <+bridge> wat 18:42 <+bridge> i mean that's not bad i assume? 18:42 <+bridge> that means i didnt waste enough time using java 18:42 <+bridge> You mean `throws`? 18:43 <+bridge> yeah 18:43 <+bridge> thats like the holy grail of java 18:43 <+bridge> xd 18:43 <+bridge> or do you have to write it? cant remember xd 18:43 <+bridge> For checked exceptions you need it 18:43 <+bridge> fuck and not fuck, i probably actually forgot it 18:44 <+bridge> my brain managed to completely remove it from existence 18:44 <+bridge> Those need to be either handled immediately or consciously thrown upwards 18:44 <+bridge> yeah it was probably always there xD 18:44 <+bridge> lmao 18:44 <+bridge> now i do i feel old for sure 18:45 <+bridge> we had java in school, that was like 9 years ago 18:45 <+bridge> damn 18:45 <+bridge> I actually think it makes java error handling somewhat similar to rust's 18:45 <+bridge> unfortunately, many people decided to go with unchecked exceptions instead 18:45 <+bridge> like e.g. google's json library 18:45 <+bridge> and then there's atrocities like this: 18:46 <+bridge> catch(...) {} 18:46 <+bridge> catch(Exception e) { System.out.println(e); } // continue normally anyway 18:46 <+bridge> https://text.npr.org/1174132413 18:46 <+bridge> > People are trying to claim real videos are deepfakes. The courts are not amused 18:54 <+bridge> @Ryozuki what do u do about non fatal errors 18:54 <+bridge> Would you use Option instead always? 18:54 <+bridge> 18:54 <+bridge> where is the line between them? 18:56 <+bridge> instead of what? 18:57 <+bridge> i mean when result instead of option or wise versa 18:57 <+bridge> result with stack strings or heap strings? 18:57 <+bridge> i defs struggle to find a good line here for me 18:58 <+bridge> hmm, I'd use `Result` if it's an error condition or if the "failing" case needs to carry data 18:59 <+bridge> so everytime u assume the result should not be "handleable" 18:59 <+bridge> i use option in case it logically makes sense if a value can be or not there 18:59 <+bridge> but it doesnt feel like a error 18:59 <+bridge> like a get from a database with a id 19:01 <+bridge> or from a hashmap 19:01 <+bridge> > The Option type is used when the value of a computation may be absent. For example, it is often used when a function may return a value or nothing, such as when searching for an item in a collection. The Result type is used when the success or failure of a computation is important 19:02 <+bridge> yeah i understand that 19:02 <+bridge> that's why i asked, if it should™️ not be handled, use result? 19:02 <+bridge> e.g. u can handle it, but usually don't do it? 19:03 <+bridge> u could also say hashmap etc. could also use Result instead 19:03 <+bridge> no 19:03 <+bridge> because get is like a search 19:03 <+bridge> a search may or not find stuff 19:03 <+bridge> if u dont find it its an search error 19:03 <+bridge> xd 19:04 <+bridge> xd 19:04 <+bridge> did u know Option> is optimized out 19:04 <+bridge> optimized out to what? xd 19:04 <+bridge> completely gone? 19:04 <+bridge> to a simple pointer 19:05 <+bridge> ah 19:05 <+bridge> option has tricks for the none value 19:05 <+bridge> it can use a value that cant be set in the inner value type iirc 19:05 <+bridge> or smth like that 19:05 <+bridge> in this case box is a ptr 19:05 <+bridge> so it can use nullptr as a none tag 19:06 <+bridge> this is not specific to `Option` 19:06 <+bridge> yeah to enums 19:06 <+bridge> option is the most obvious to explain xd 19:06 <+bridge> `Result, SingletonError>` gets the same treatment 19:06 <+bridge> (just wanted to point out that it's not a reason to use `Option` over `Result`) 19:06 <+bridge> https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=bab644e35609b5475978821378d3560f 19:07 <+bridge> https://www.sobyte.net/post/2022-04/rust-enum-layout/ 19:08 <+bridge> (`io::Result` is quite heavy though, even coming with a destructor) 19:08 <+bridge> > If T is an FFI-safe non-nullable pointer type, Option is guaranteed to have the same layout and ABI as T and is therefore also FFI-safe. As of this writing, this covers &, &mut, and function pointers, all of which can never be null. 19:10 <+bridge> scary, bcs its not clear to me ^^ 19:14 <+bridge> `io::Error` is basically an enum that has a variant storing a `Box` 19:14 <+bridge> this means that every time a `io::Result` leaves the scope, it needs to be checked whether there's a `Box` that needs freeing 19:20 <+bridge> interesting insights 19:26 <+bridge> I don't think it has to do with whether it should or should not be handled but more to do so with whether it's standard operation or not 19:28 <+bridge> `Result` is when something unexpected might happen. A search not finding anything is not always unexpected, and if it is it might be a good idea to wrap it in a way that the search failing is an assert and you can just return the object itself 19:29 <+bridge> `Result` is also used when you need data in the "no value" case 19:29 <+bridge> e.g. binary search in std returns `Result`, I think 19:31 <+bridge> > Binary searches this slice for a given element. This behaves similarly to contains if this slice is sorted. 19:31 <+bridge> > 19:31 <+bridge> > If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then Result::Err is returned, containing the index where a matching element could be inserted while maintaining sorted order. 19:31 <+bridge> https://doc.rust-lang.org/std/primitive.slice.html#method.binary_search 19:34 <+bridge> the carry argument is fine, but i still don't see a 100% reason to not always use result 19:35 <+bridge> it's not a problem to always use a result 19:35 <+bridge> > Type Option represents an optional value: every Option is either Some and contains a value, or None, and does not. Option types are very common in Rust code, as they have a number of uses: 19:35 <+bridge> > 19:35 <+bridge> > Initial values 19:35 <+bridge> > Return values for functions that are not defined over their entire input range (partial functions) 19:35 <+bridge> > Return value for otherwise reporting simple errors, where None is returned on error 19:35 <+bridge> > Optional struct fields 19:35 <+bridge> > Struct fields that can be loaned or “taken” 19:35 <+bridge> > Optional function arguments 19:35 <+bridge> > Nullable pointers 19:35 <+bridge> > Swapping things out of difficult situations 19:35 <+bridge> maybe the iterator trait can give you an example for `Option`? 19:35 <+bridge> from the docs 19:36 <+bridge> on std 19:36 <+bridge> > Functions return Result whenever errors are expected and recoverable. In the std crate, Result is most prominently used for I/O. 19:37 <+bridge> mh ok 😄 19:37 <+bridge> did u know u can collect a iterator of results into a single result with a vec 19:38 <+bridge> https://doc.rust-lang.org/rust-by-example/error/iter_result.html 19:38 <+bridge> u can even partition! 19:39 <+bridge> ```rust 19:39 <+bridge> fn main() { 19:39 <+bridge> let strings = vec!["tofu", "93", "18"]; 19:39 <+bridge> let (numbers, errors): (Vec<_>, Vec<_>) = strings 19:39 <+bridge> .into_iter() 19:39 <+bridge> .map(|s| s.parse::()) 19:39 <+bridge> .partition(Result::is_ok); 19:39 <+bridge> println!("Numbers: {:?}", numbers); 19:39 <+bridge> println!("Errors: {:?}", errors); 19:39 <+bridge> } 19:39 <+bridge> ``` 19:39 <+bridge> neat af 19:43 <+bridge> cool 19:44 <+bridge> I fail to come up with a sane use case for this 19:44 <+bridge> in this case, I'd rather loop and show the errors in order with the rest 19:44 <+bridge> @heinrich5991 handling bad packets from a bad actor? or smth 19:44 <+bridge> xd 21:28 <+bridge> I even have a `Result, Error>` in some places 21:29 <+bridge> Though I bet it's not good for some reason, I just haven't read enough rust internals to know if it's bad or not 21:29 <+bridge> ignorance is bliss 21:30 <+bridge> its common 21:30 <+bridge> anyway, i mostly used option for parameters and attributes yet 21:31 <+bridge> only in few places as return type when i felt like it should happen regulary, even tho i still think its not really an argument probably, but given u dont have to name the error type its maybe simply simpler code 21:57 <+bridge> @Jupeyy_Keks zig is not memsafe by nature 21:57 <+bridge> u can get ez segfaults 21:58 <+bridge> it does nothing to prevent u 21:58 <+bridge> Oh ok 21:58 <+bridge> Thought it tries similar like rust just with malloc 21:58 <+bridge> some ppl claim rust is like the new c++ and zig the new c 21:58 <+bridge> but i dont agree 21:58 <+bridge> To be more c 21:58 <+bridge> rust is the new c and c++ 21:58 <+bridge> the main thing about zig is u can pass allocators everywhere 21:58 <+bridge> or smth 21:59 <+bridge> I mean c++ is the new c. So yes xD 21:59 <+bridge> So Learath loves it ? 21:59 <+bridge> i think he prefers rust 21:59 <+bridge> also some drama in zig 22:00 <+bridge> political (?) 22:00 <+bridge> Ok but that is not directly related to the language design^^ 22:00 <+bridge> ```zig 22:00 <+bridge> const eql = std.mem.eql; 22:00 <+bridge> const ArrayList = std.ArrayList; 22:00 <+bridge> const test_allocator = std.testing.allocator; 22:00 <+bridge> 22:00 <+bridge> test "arraylist" { 22:00 <+bridge> var list = ArrayList(u8).init(test_allocator); 22:00 <+bridge> defer list.deinit(); 22:00 <+bridge> try list.append('H'); 22:00 <+bridge> try list.append('e'); 22:00 <+bridge> try list.append('l'); 22:00 <+bridge> try list.append('l'); 22:00 <+bridge> try list.append('o'); 22:00 <+bridge> try list.appendSlice(" World!"); 22:00 <+bridge> 22:01 <+bridge> try expect(eql(u8, list.items, "Hello World!")); 22:01 <+bridge> } 22:01 <+bridge> ``` 22:01 <+bridge> zig code 22:01 <+bridge> for me its as ugly as it gets 22:01 <+bridge> xd 22:01 <+bridge> Lmao 22:01 <+bridge> Looks verbise 22:01 <+bridge> Ose 22:01 <+bridge> ose 22:01 <+bridge> osu 22:01 <+bridge> OSU! 22:16 <+bridge> https://github.blog/2023-05-08-github-code-search-is-generally-available/ 22:18 <+bridge> doesnt github already have the ability to search code? 22:19 <+bridge> github search is the worst xd 22:20 <+bridge> fair 22:20 <+bridge> nice they finally improved it 22:32 <+bridge> github search worked fine for finding code snippets for fixed strings/variable names 22:32 <+bridge> what do you use github search for? 22:39 <+bridge> Wildcard strings 22:39 <+bridge> Everything else is basically useless 22:43 <+bridge> what will you use the new github search for? 22:45 <+bridge> do you say oopsie at work @Ryozuki ? https://www.reddit.com/r/ProgrammerHumor/comments/13bsymd/warning_strong_language/ 22:45 <+bridge> xd 22:45 <+bridge> i dont manage dbs 22:46 <+bridge> damn, gotta ask @deen then 22:49 <+bridge> If I just want to find stuff without cloning the project it should not work better