Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2023-05-08 00:00:00Z and 2023-05-09 00:00:00Z
02:52
02:52
xd
02:52
maybe for months it's using calendar months but for weeks it's calculating with days
02:52
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
02:53
maybe they should just be 30 day months
Avatar
365 / 12
Avatar
yes that is 30
Avatar
chillerdragon BOT 2023-05-08 07:44:19Z
paiton trivia! Will this print any duplicated messages when run? if so which lines are the same?class Foo: pass class Bar: def __init__(self, f = Foo()): self.f = f b = Bar() print(id(b)) print(id(b.f)) print('----') b = Bar() print(id(b)) print(id(b.f))
Avatar
ChillerDragon BOT 2023-05-08 07:46:29Z
btw id(object) is to check if those are the same objects https://docs.python.org/3/library/functions.html#id
The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order.,,,, Built-in Functions,,, A, abs(), aiter(), all(), a...
07:46
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.
Avatar
It is allowed to. Idk if CPython re-uses ids that aggressively though
Avatar
ChillerDragon BOT 2023-05-08 07:57:10Z
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
07:58
TIL print(id(b.f)) matches but print(id(b)) does not
07:58
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
07:58
thats so broken
Avatar
chillerdragon BOT 2023-05-08 08:00:57Z
class Foo: def __init__(self): self.prop = None class Bar: def __init__(self, f = Foo()): self.f = f self.prop = None b = Bar() b.prop = "bar" b.f.prop = "foo" b = Bar() print(b.prop) print(b.f.prop)
08:01
$ python3 fml.py None foo
Avatar
Wait really? Now that is most unexpected. Is it because of when the default parameters get evaluated?
Avatar
ChillerDragon BOT 2023-05-08 08:01:51Z
idk what happens but it fucked my morning xd
08:02
i moved the f = Foo() out of the parameters into the init body and it stopped doing the weird stuff
Avatar
Yeah, then I guess my hypothesis is right
Avatar
ChillerDragon BOT 2023-05-08 08:03:25Z
seems like the class constructor parameters are evaluated once and kept/shared forever even if they are objects with state
08:03
such a trol
Avatar
That'd be hell to debug 😄
Avatar
ChillerDragon BOT 2023-05-08 08:04:13Z
tell me about it
08:04
i did nothing else all day
Avatar
chillerdragon BOT 2023-05-08 08:08:40Z
class Bar: def __init__(self, f = "f"): self.f = f self.g = "f" b = Bar() print(id(b.f)) print(id(b.g)) b = Bar() print(id(b.f)) print(id(b.g))
08:08
so lerato out of those 4 printed ids how many are the same?
Avatar
This is a problem from a chat group member and I am trying to seek more details from him. Not much hope... version: 16.9 !ddnet_issue https://user-images.githubusercontent.com/60285058/236774693-8564bb2c-7cb2-4bed-81ac-f821a3b9a05c.mp4
Avatar
python bad
Avatar
chillerdragon: impl dependent
09:52
@Learath2 yea, default parameters are only evaluated once 'for performance reasons' (lol python)
Avatar
ChillerDragon BOT 2023-05-08 09:52:30Z
yea thought so too
09:52
well in my python its all the same id lol
09:53
python is slow af and then it tries to optimize random things with weird side effects xd
Avatar
4e87313 Update Turkey costs and funding by Learath2 (thanks!) - def-
Avatar
@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?
Avatar
probably finnish, german and spanish law
Avatar
spanish cuz im spanish right? xd
Avatar
yes
Avatar
i cant say european law right
11:40
xd
11:41
=== Jurisdiction and legality of content === 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 violation of any laws; and cannot be responsible for any violations of such laws, should you link to this domain or use, reproduce, or republish the information contained herein. Thank you for spending the time to read this page, and please enjoy your experience at wiki.ddnet.org.
11:41
this is the current dislaimer on the legality of content
11:41
how should i word these 3 countries? xd
Avatar
maybe:
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 ...
11:43
why do you have this disclaimer though? if it's for some actual legal effect, I'm no expert
11:44
if not, why have it at all?
Avatar
idk i copied mediawiki
11:44
and why not?
11:44
its a empty page like the copyright u linked in #wiki by default
Avatar
why not: because copy-pasted boilerplate text isn't useful, it wastes people's time
Avatar
what if someone sues me
11:45
xd
11:45
also this text is quite ez to read
11:46
i copied it from mediawiki
Avatar
what should i put in that link?
Avatar
Avatar
Ryozuki
what if someone sues me
if you want it to have legal effect, maybe you shouldn't ask me ^^ (edited)
Avatar
or is it useless too
Avatar
Avatar
heinrich5991
if you want it to have legal effect, maybe you shouldn't ask me ^^ (edited)
i dont ask u as if u a lawyer
11:46
xd
11:47
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.
11:47
hmm
11:47
but if its not a business
11:47
xd
11:47
the world is complicated
Avatar
ddnet has MIT license which also has a disclaimer
Avatar
Put a rickroll
Avatar
@heinrich5991 imagine a editor suddenly post something rly ilegal
11:48
i just want a bit of assurance xd
Avatar
Avatar
Robyt3
ddnet has MIT license which also has a disclaimer
ddnet is under the zlib license, not MIT
Avatar
Avatar
heinrich5991
ddnet is under the zlib license, not MIT
oh, interesting, so only teeworlds is MIT?
Avatar
the rest of the point still stands
11:50
ddnet inherited teeworlds's zlib license
11:50
i.e. teeworlds isn't MIT
Avatar
ah, yeah, I'm mixing them up
Avatar
MIT is also a confusing name
11:51
it can mean x11
11:51
or other things
11:51
Expat License (#Expat)
>
This is a lax, permissive non-copyleft free software license, compatible with the GNU GPL.
>
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.”
Avatar
2596dac Remove dead code - Robyt3 73091cd Add CPickup::Type and CPickup::Subtype getters - Robyt3 72c2ed0 Remove magic number 20.0f from pickup handling - Robyt3 a4dc138 Allow using rescue (/r) on health pickup - Robyt3 1112c9e Merge #6566 - bors[bot]
Avatar
ChillerDragon BOT 2023-05-08 12:03:10Z
legal advice :justatest:
Avatar
Did you get a chance to look at #5737 yet, @heinrich5991 ?
Avatar
Port map and editor support for CURVETYPE_BEZIER from upstream, i.e. support bezier curves with configurable in- and out-tangents for every envelope point. The in- and out-tangents are represented ...
Avatar
bezier curve collision justatest
12:07
suddenly we can build rollercoasters in tw 😂
Avatar
Avatar
Robyt3
Did you get a chance to look at #5737 yet, @heinrich5991 ?
not really, no, sorry
12:15
I can only guarantee it's going to be included when I go through all the PRs of ddnet the next time
Avatar
We should also be careful to not add too much for the release
12:19
The ime stuff is already a major improvement and should be tested
Avatar
Avatar
Learath2
Wait really? Now that is most unexpected. Is it because of when the default parameters get evaluated?
default parameter are created once, then they are shared across all calls
12:22
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 (edited)
12:23
that's why you should use None rather than class or mutable objects
12:23
string can be safely used as default as they're immutable
Avatar
that's why python does something wrong here
12:24
because it's unintuitive without knowing the rules
Avatar
nice trivia chiller
13:26
tomorrow more
Avatar
ChillerDragon BOT 2023-05-08 14:18:12Z
ryo python enjoyer
14:18
@Chairn oh no post removed what did it say o.O
Avatar
Microsoft: Wait, I can explain Google: You spy through the whole OS? I only spy the web. Apple: Your users know that you are spying? Linux: You guys are spying?
Avatar
ChillerDragon BOT 2023-05-08 14:21:02Z
hacker
14:21
and thanks
14:22
how did u get it? or do u remember it?
14:22
14:23
makes more sense if you know the movie i guess
Avatar
the movie?
14:28
wasn't the last one some athlete?
Avatar
ChillerDragon BOT 2023-05-08 14:44:14Z
yes wat pati said
Avatar
simple terminal UI for git commands. Contribute to jesseduffield/lazygit development by creating an account on GitHub.
14:54
chiller this for u
14:54
the name matches u cuz u lazy
Avatar
ChillerDragon BOT 2023-05-08 14:56:15Z
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
14:56
but i know people swear on lazy git
Avatar
my query time is growing up justatest
Avatar
ChillerDragon BOT 2023-05-08 14:57:22Z
ddstats?
Avatar
no unrelated to ddnet
Avatar
ChillerDragon BOT 2023-05-08 14:57:33Z
trash
14:59
chiller
14:59
do git pull at my game
14:59
and run it
14:59
release
Avatar
ChillerDragon BOT 2023-05-08 15:04:29Z
ok
15:05
me in the future (?)
15:06
justatest
Avatar
ChillerDragon BOT 2023-05-08 15:06:04Z
xd
15:08
it sticks out waaaaayyy to far bru
15:08
Avatar
yy
Avatar
ChillerDragon BOT 2023-05-08 15:09:49Z
15:09
gnome be like
15:12
lol crazy that ur toolchain toml made me auto dl new toolchain on cargo build
15:12
rust very pog
Avatar
its cuz the last nightly is broken
15:12
with wgpu
Avatar
ChillerDragon BOT 2023-05-08 15:12:54Z
its 0 setup for me to compile this
Avatar
Code Haven't been able to minimize it yet, but it can be reproduced by creating a new cargo project, adding matrix-sdk = "0.6.2" to the dependencies and compiling it with nightly rust...
Avatar
ChillerDragon BOT 2023-05-08 15:12:58Z
so nice
Avatar
i know
15:13
i set it up
15:13
im rust god
Avatar
ChillerDragon BOT 2023-05-08 15:13:08Z
i see
15:13
but the time safed from me manually setting it up is spent on compiling xd
15:13
saved*
15:13
jesus
15:13
the thing is
15:13
the weapon is made for a side view
15:13
and i need top down
15:13
so it will always look weird xd
Avatar
ChillerDragon BOT 2023-05-08 15:14:06Z
oh so u need diff angle?
15:14
but im bad artist
Avatar
ChillerDragon BOT 2023-05-08 15:14:16Z
bot u can stick it more in either way
Avatar
so i just go with it
15:14
xxxxxxxxxxD
15:14
old but gold
Avatar
so far bevy is pog
15:15
i have system that aims any entity which has a AimTarget() for me
Avatar
ChillerDragon BOT 2023-05-08 15:15:49Z
bot
Avatar
i could do it 3d
15:16
actually blender is easier for me than drawing
15:16
but 3d is more complex
Avatar
@Ryozuki are u in ur holidays?
15:17
the game update i did yesterday xd
Avatar
so u writing compilers and games
Avatar
ChillerDragon BOT 2023-05-08 15:17:59Z
yes teecity is for sure ryos dayjob
Avatar
any other awesome project i'd to know about from u?
Avatar
ChillerDragon BOT 2023-05-08 15:18:20Z
paypal
Avatar
not yet
15:18
recently i tried wow again
15:18
xd
Avatar
ChillerDragon BOT 2023-05-08 15:18:34Z
xd
15:18
my paypal crate is quite big
15:18
or not
Avatar
ChillerDragon BOT 2023-05-08 15:19:07Z
yes big
Avatar
i actually met a ffxiv plugin dev that knows someone working in a company that uses my crate
15:19
lmfao
15:19
but thats my bad
15:19
i was in my age where i didnt use agpl for everything yet
Avatar
ChillerDragon BOT 2023-05-08 15:19:39Z
hope your warranty disclaimer is legally solid axaxax
Avatar
too bad
Avatar
ChillerDragon BOT 2023-05-08 15:21:37Z
bash and c both dont have and need a package manager because the devs are pros and write everything from scratch within minutes
15:22
only latte drinking rust soydevs need to cargo add sum_positive_digits
Avatar
i just noticed, i have 0 IQ
Avatar
ChillerDragon BOT 2023-05-08 15:24:15Z
xxxxxxxxxxxxxxxD
15:24
dislexic jopsti
15:25
15:25
rust devs be like
Avatar
i no get it
Avatar
ChillerDragon BOT 2023-05-08 15:26:54Z
they need crate for that
Avatar
doesnt it make sense xd
Avatar
ChillerDragon BOT 2023-05-08 15:27:08Z
because they dont know how to build stuff without using other ppl lib
Avatar
so basically like javascript
Avatar
ChillerDragon BOT 2023-05-08 15:27:25Z
yes
Avatar
just in fast
15:27
sounds good xd
Avatar
ChillerDragon BOT 2023-05-08 15:27:30Z
yes
15:27
xd
Avatar
I randomly got the map unloaded crash in the CI on the PR that was supposed to fix exactly this crash :/ #6565
Avatar
When a client component (e.g. the menu or the console) disconnects the client, this immediately unloads the map data but the render call continues as normal. This causes all components rendered aft...
Avatar
Avatar
Robyt3
I randomly got the map unloaded crash in the CI on the PR that was supposed to fix exactly this crash :/ #6565
that's what i call lucky
Avatar
Avatar
Patiga
Click to see attachment 🖼️
don't explain to 0 IQers pls
Avatar
thats the dependency list of the crate is-even-or-odd
15:31
it depends on a crate is-even and another one is-odd, extending the joke about pointless dependencies
Avatar
the crate always returns positivity, i'd say its a win for human species
Avatar
gud description saddo
Avatar
ChillerDragon BOT 2023-05-08 15:34:13Z
lol roby
15:34
lmao patiga xd
15:36
Returns true if the given number is even or odd.
15:36
xd
15:36
fn is_odd_or_even(num: i32) { true }
Avatar
no num.is_even() || num.isodd()
15:37
xdd
Avatar
ChillerDragon BOT 2023-05-08 15:37:08Z
ye
Avatar
they dont optimize it
15:37
xD
Avatar
ChillerDragon BOT 2023-05-08 15:37:14Z
xd
15:37
aw shit i forgot :bool i guess
Avatar
Avatar
ChillerDragon
fn is_odd_or_even(num: i32) { true }
bad rust code
Avatar
ChillerDragon BOT 2023-05-08 15:37:24Z
my rust is ass
15:37
ik ik
Avatar
it should be const
Avatar
ChillerDragon BOT 2023-05-08 15:37:28Z
fakof
Avatar
Avatar
Ryozuki
bad rust code
and _ before num
Avatar
ChillerDragon BOT 2023-05-08 15:37:40Z
ah no its -> bool
Avatar
bcs unused
Avatar
and #[inline]
Avatar
ChillerDragon BOT 2023-05-08 15:37:43Z
ye
15:37
jesus
Avatar
ur so bad
15:37
shame
Avatar
XD
Avatar
ChillerDragon BOT 2023-05-08 15:38:05Z
._.
15:38
literally crying
Avatar
welcome to rust heaven chilllerdragon
15:38
we except programmers from all languages
15:38
NOT
Avatar
ChillerDragon BOT 2023-05-08 15:38:30Z
its like learning french
Avatar
chiller
15:38
add this
15:38
#![forbid(unsafe_code)] #![deny(missing_docs)] #![deny(warnings)] #![deny(clippy::nursery)] #![deny(clippy::pedantic)] #![deny(clippy::all)]
15:38
at the top of lib.rs
15:39
it will tell u how to make good rust
Avatar
ChillerDragon BOT 2023-05-08 15:39:13Z
good to know
Avatar
the first may not be needed if u need unsafe
Avatar
ChillerDragon BOT 2023-05-08 15:39:31Z
the 2nd is also trol
Avatar
ChillerDragon BOT 2023-05-08 15:39:38Z
okok
Avatar
document
15:39
even if heinrich dislikes it
15:39
kek
Avatar
ChillerDragon BOT 2023-05-08 15:39:56Z
he also doc
Avatar
he dislikes pointless docs
Avatar
ChillerDragon BOT 2023-05-08 15:40:08Z
wot
15:40
in the code?
15:40
since when
Avatar
// this function returns if the number is even fn is_even
Avatar
ChillerDragon BOT 2023-05-08 15:40:37Z
heinrich u no like^?
Avatar
ChillerDragon BOT 2023-05-08 15:41:21Z
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
15:41
wat a waste
Avatar
xDD 1 - 1 = 0 <=> 1 = 1
Avatar
A massively parallel, optimal functional runtime in Rust - GitHub - HigherOrderCO/HVM: A massively parallel, optimal functional runtime in Rust
15:43
hvm > haskell
Avatar
ChillerDragon BOT 2023-05-08 15:43:36Z
justatest 1
15:43
nice marketing readme
Avatar
ChillerDragon BOT 2023-05-08 15:44:47Z
because its written in js
Avatar
Avatar
Ryozuki
// this function returns if the number is even fn is_even
// Get Search by Id fn getSearchById(id: u32)
Avatar
parameters: id: u32
15:54
  • the id to search by
15:54
xD
Avatar
/* Get Search by ID /* Parameters: /* id: u32 -> The id (unsigned 32 bit integer) of the search to get /* Returns: /* Search -> The Search object that belongs to the id */ fn getSearchById(id: u32) -> Search
15:56
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
15:57
hi `hi` hi
15:58
One of the engineerings
Avatar
hard syntax
16:01
we actually have quite a few markdown bugs on our ddnet website bcs of this syntax xd
16:02
*we have quite a few syntax errors, if we'd follow strict markdown rules, what we dont
Avatar
ChillerDragon BOT 2023-05-08 16:05:07Z
imagine not using a linter in strict mode when writing markdown
Avatar
portability bra
16:06
the js markdown lib broke xd
Avatar
Avatar
Learath2
/* Get Search by ID /* Parameters: /* id: u32 -> The id (unsigned 32 bit integer) of the search to get /* Returns: /* Search -> The Search object that belongs to the id */ fn getSearchById(id: u32) -> Search
i know u dont like this
16:07
but i have a sense of completion in me
16:07
in games too
16:07
as in, everything must be perfect
16:07
hard to describe
Avatar
if its perfect, it doesnt need documentation
16:07
😉
16:07
only simple code documents itself
16:09
also wtf is that /*
16:09
u only need the first
16:09
xd
Avatar
indeed in rust, which i like
16:09
this is a bug
Avatar
rust docs are awesome
16:09
so easy to do intra links
Avatar
multilines open new multilines inside other multilines
Avatar
[[your mom]]
16:09
and then a link to ur mom
16:10
(heinrich dont ban me pls)
16:10
sometimes i have the urge to do ur mom jokes, very childish i know
Avatar
where is the joke?
16:11
@Jupstar ✪ if ur lazy to write docs
16:11
just ask chatgpt
16:12
bonus points if u ask it passing classified company code
Avatar
if i write doc, i am defs not a person to write much. Some ppl are like: Ok now lets add my whole biography
16:14
@Ryozuki i have an important question to you. When you code (and i don't mean the writing itself), do you think in english or in spanish in your head? XD
Avatar
or catalan xdd
Avatar
english
16:15
i do so much in english
16:15
even my internal voice is often in english
16:15
lately
Avatar
i think in Chairn 🙂
Avatar
i have to say, i couldn't tell
16:15
it's probably a mix
Avatar
it's probably none
16:16
concept and ideas are not thought in terms of human language directly iirc
Avatar
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"
Avatar
XD
16:18
chatgpt is sadly too diplomatic (edited)
16:19
but it probably knows the real answer
Avatar
Avatar
Ryozuki
xd
16:21
that's how u do it
Avatar
the trick in chatgpt is, tell it to answer your question "just for fun" it suddenly gives u approximation numbers etc.
16:23
everything where it normally says: "i cant tell bro" (edited)
16:24
Avatar
I pretty much only document quirks and specifics. Like if the function is double sin(double t) I’d document it’s domain, the approximation I’ve used, and maybe performance characteristics. Something like size_t container::length() doesn’t really need any documentation. At least imho, obv very very subjective
Avatar
Adds basic WebAuthn support to KeePassXC. Currently it uses the default Elliptic Curve key (EC2, ES256 signature, P-256 curve), 2048-bit RSA key, and basic registration/authentication with User Ver...
16:30
this is poggers
Avatar
Avatar
Jupstar ✪
the trick in chatgpt is, tell it to answer your question "just for fun" it suddenly gives u approximation numbers etc.
Another trick is to say it’s for creative writing. It flat out refused to write anything doomer without that
Avatar
Avatar
Learath2
Another trick is to say it’s for creative writing. It flat out refused to write anything doomer without that
good to know xd
Avatar
Avatar
Learath2
I pretty much only document quirks and specifics. Like if the function is double sin(double t) I’d document it’s domain, the approximation I’ve used, and maybe performance characteristics. Something like size_t container::length() doesn’t really need any documentation. At least imho, obv very very subjective
i would say in C it needs more docs than in rust
16:31
// this can cause ub due to the following 999 reasons:
  • its made in c
16:32
but yeah some stuff can be very obvious to you, the main dev, but good docs often help ppl get onboard
16:32
and some stuff may not be obvious for others
16:32
i dont talk about these very simple things tho xd
Avatar
As long as the input domain is respected I think your code shouldn’t exhibit any UB ever
Avatar
(well i wouldnt be surprised if taking the length of a container is ub)
Avatar
I guess if calling member functions before calling an init function is UB that is definitely worth documenting
Avatar
For any string operation, if as a result of the operation, size() would exceed max_size() then the operation throws length_error.
16:34
xd
16:34
§21.3/4a (
16:34
exceptions ew
16:34
c++ rly wanted to be ugly
Avatar
I really enjoy how rust did errors, one of my fav things about it
Avatar
but probably nobody would handle such errors even in rust
Avatar
Just need to not misuse it and make an anyhow sled all the way to main
Avatar
Avatar
Jupstar ✪
but probably nobody would handle such errors even in rust
thats not the point tho
Avatar
if u arent working on smth critical xd
Avatar
u get fully typed errors u can pass up the call stack easily
16:36
thats why u use anyhow or eyre in binary crates
16:36
but thiserror on libs
Avatar
yeah
16:36
its defs well done
Avatar
also it forces u to handle the errors
16:36
one way or another
Avatar
better would be no bugs at all
Avatar
u cant ignore them
Avatar
:^) (edited)
Avatar
u opt in to ignore them
16:36
by crashing
16:37
well
Avatar
Passing an error up the callstack should imho be a conscious decision you have to make every time
Avatar
not crashing
Avatar
Avatar
Learath2
Passing an error up the callstack should imho be a conscious decision you have to make every time
thats what u do with Result
Avatar
Avatar
Learath2
Passing an error up the callstack should imho be a conscious decision you have to make every time
Not the default like with exceptions
16:37
and java has the worst
16:37
checked and non checked
16:37
a mix of shit
16:37
xd
Avatar
the worst about exceptions is actually that ppl use it in places where u except them to throw
16:38
e.g. IO
Avatar
lets face it, i bough 32gb ram for minecraft
16:39
not for coding
16:39
Avatar
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
16:39
insane laggs
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
is that the new java syntax?
16:41
didnt use java since java 8 i think xd
16:41
ah i had to use it for android
16:41
<.<
16:41
pain
Avatar
Avatar
Jupstar ✪
is that the new java syntax?
No new syntax there 😛
Avatar
Avatar
Learath2
No new syntax there 😛
oh xd
16:42
never seen it before in java code
Avatar
i mean that's not bad i assume?
16:42
that means i didnt waste enough time using java
Avatar
You mean throws?
Avatar
yeah
Avatar
thats like the holy grail of java
16:43
xd
Avatar
or do you have to write it? cant remember xd
Avatar
Avatar
Jupstar ✪
or do you have to write it? cant remember xd
For checked exceptions you need it
Avatar
fuck and not fuck, i probably actually forgot it
16:44
my brain managed to completely remove it from existence
Avatar
Those need to be either handled immediately or consciously thrown upwards
Avatar
yeah it was probably always there xD
16:44
lmao
16:44
now i do i feel old for sure
16:45
we had java in school, that was like 9 years ago
16:45
damn
Avatar
I actually think it makes java error handling somewhat similar to rust's
16:45
unfortunately, many people decided to go with unchecked exceptions instead
16:45
like e.g. google's json library
16:45
and then there's atrocities like this:
16:46
catch(...) {}
16:46
catch(Exception e) { System.out.println(e); } // continue normally anyway
16:46
People are trying to claim real videos are deepfakes. The courts are not amused
Avatar
@Ryozuki what do u do about non fatal errors Would you use Option instead always? where is the line between them?
Avatar
instead of what?
Avatar
Avatar
heinrich5991
instead of what?
i mean when result instead of option or wise versa
16:57
result with stack strings or heap strings?
16:57
i defs struggle to find a good line here for me
Avatar
hmm, I'd use Result if it's an error condition or if the "failing" case needs to carry data
Avatar
so everytime u assume the result should not be "handleable"
Avatar
i use option in case it logically makes sense if a value can be or not there
16:59
but it doesnt feel like a error
16:59
like a get from a database with a id
Avatar
or from a hashmap
Avatar
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
Avatar
yeah i understand that
17:02
that's why i asked, if it should™️ not be handled, use result?
17:02
e.g. u can handle it, but usually don't do it?
17:03
u could also say hashmap etc. could also use Result instead
17:03
because get is like a search
17:03
a search may or not find stuff
Avatar
if u dont find it its an search error
17:03
xd
17:04
did u know Option<Box<T>> is optimized out
Avatar
optimized out to what? xd
17:04
completely gone?
Avatar
to a simple pointer
Avatar
ah
Avatar
option has tricks for the none value
17:05
it can use a value that cant be set in the inner value type iirc
17:05
or smth like that
17:05
in this case box is a ptr
17:05
so it can use nullptr as a none tag
Avatar
this is not specific to Option
Avatar
yeah to enums
17:06
option is the most obvious to explain xd
Avatar
Result<Box<T>, SingletonError> gets the same treatment
17:06
(just wanted to point out that it's not a reason to use Option over Result)
Avatar
(io::Result is quite heavy though, even coming with a destructor)
Avatar
If T is an FFI-safe non-nullable pointer type, Option<T> 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.
Avatar
Avatar
heinrich5991
(io::Result is quite heavy though, even coming with a destructor)
scary, bcs its not clear to me ^^
Avatar
io::Error is basically an enum that has a variant storing a Box<dyn Error>
17:14
this means that every time a io::Result leaves the scope, it needs to be checked whether there's a Box<dyn Error> that needs freeing
Avatar
interesting insights
Avatar
Avatar
Jupstar ✪
that's why i asked, if it should™️ not be handled, use result?
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
17:28
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
Avatar
Result is also used when you need data in the "no value" case
17:29
e.g. binary search in std returns Result<usize, usize>, I think
Avatar
Binary searches this slice for a given element. This behaves similarly to contains if this slice is sorted.
>
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.
17:31
A dynamically-sized view into a contiguous sequence, [T]. Contiguous here means that elements are laid out so that every element is the same distance from its neighbors.
Avatar
the carry argument is fine, but i still don't see a 100% reason to not always use result
Avatar
it's not a problem to always use a result
17:35
maybe the iterator trait can give you an example for Option?
Avatar
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:
>
Initial values Return values for functions that are not defined over their entire input range (partial functions) Return value for otherwise reporting simple errors, where None is returned on error Optional struct fields Struct fields that can be loaned or “taken” Optional function arguments Nullable pointers Swapping things out of difficult situations
17:35
from the docs
17:35
on std
17:36
Functions return Result whenever errors are expected and recoverable. In the std crate, Result is most prominently used for I/O.
Avatar
mh ok 😄
Avatar
did u know u can collect a iterator of results into a single result with a vec
17:38
Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries.
17:38
u can even partition!
17:39
fn main() { let strings = vec!["tofu", "93", "18"]; let (numbers, errors): (Vec<_>, Vec<_>) = strings .into_iter() .map(|s| s.parse::<i32>()) .partition(Result::is_ok); println!("Numbers: {:?}", numbers); println!("Errors: {:?}", errors); }
17:39
neat af
Avatar
cool
Avatar
Avatar
Ryozuki
fn main() { let strings = vec!["tofu", "93", "18"]; let (numbers, errors): (Vec<_>, Vec<_>) = strings .into_iter() .map(|s| s.parse::<i32>()) .partition(Result::is_ok); println!("Numbers: {:?}", numbers); println!("Errors: {:?}", errors); }
I fail to come up with a sane use case for this
17:44
in this case, I'd rather loop and show the errors in order with the rest
Avatar
@heinrich5991 handling bad packets from a bad actor? or smth
17:44
xd
Avatar
Avatar
Jupstar ✪
the carry argument is fine, but i still don't see a 100% reason to not always use result
I even have a Result<Option<T>, Error> in some places
19:29
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
19:29
ignorance is bliss
Avatar
its common
Avatar
anyway, i mostly used option for parameters and attributes yet
19:31
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
Avatar
@Jupstar ✪ zig is not memsafe by nature
19:57
u can get ez segfaults
19:58
it does nothing to prevent u
Avatar
Oh ok
19:58
Thought it tries similar like rust just with malloc
Avatar
some ppl claim rust is like the new c++ and zig the new c
19:58
but i dont agree
Avatar
To be more c
Avatar
rust is the new c and c++
Avatar
Avatar
Jupstar ✪
Thought it tries similar like rust just with malloc
the main thing about zig is u can pass allocators everywhere
19:58
or smth
Avatar
Avatar
Ryozuki
rust is the new c and c++
I mean c++ is the new c. So yes xD
Avatar
Avatar
Ryozuki
the main thing about zig is u can pass allocators everywhere
So Learath loves it ?
Avatar
i think he prefers rust
19:59
also some drama in zig
19:59
political (?)
Avatar
Ok but that is not directly related to the language design^^
Avatar
const eql = std.mem.eql; const ArrayList = std.ArrayList; const test_allocator = std.testing.allocator; test "arraylist" { var list = ArrayList(u8).init(test_allocator); defer list.deinit(); try list.append('H'); try list.append('e'); try list.append('l'); try list.append('l'); try list.append('o'); try list.appendSlice(" World!"); try expect(eql(u8, list.items, "Hello World!")); }
20:00
zig code
20:00
for me its as ugly as it gets
20:00
xd
Avatar
Lmao
20:01
Looks verbise
20:01
Ose
20:01
osu
Avatar
OSU!
Avatar
0b1960c Fix Y Alignment by respecting cursor height independent of character height - Jupeyy 23ce762 Merge #6551 - bors[bot]
Avatar
doesnt github already have the ability to search code?
Avatar
github search is the worst xd
Avatar
nice they finally improved it
Avatar
github search worked fine for finding code snippets for fixed strings/variable names
20:32
what do you use github search for?
Avatar
Wildcard strings
20:39
Everything else is basically useless
Avatar
what will you use the new github search for?
20:45
i dont manage dbs
Avatar
damn, gotta ask @deen then
Avatar
Avatar
heinrich5991
what will you use the new github search for?
If I just want to find stuff without cloning the project it should not work better
Exported 564 message(s)