Post AXlWX1lAWfitRUNLLE by MiaWinter@tech.lgbt
(DIR) More posts by MiaWinter@tech.lgbt
(DIR) Post #AXlWWzPpF3SiAiNGnQ by navi@social.vlhl.dev
2023-07-16T21:04:47.083810Z
0 likes, 0 repeats
i will annoy as much rustaceans as i can by adding a explicit return to every function
(DIR) Post #AXlWX0PrWP5NH7OoUa by MiaWinter@tech.lgbt
2023-07-16T21:05:49Z
0 likes, 0 repeats
@navi wait you don't need to put return at the endWhatWhat
(DIR) Post #AXlWX16OyF75P3ImnY by navi@social.vlhl.dev
2023-07-16T21:08:02.133716Z
0 likes, 0 repeats
@MiaWinter @chronovore in rust the blocks are expressions that evaluate to the last expression in it, so: (edit better example)fn nya(a: i32, b: i32) -> i32 { let foo = a + b; return foo;}andfn nya(a: i32, b: i32) -> i32 { let foo = a + b; foo // notice the lack of ;}both work, and the community prefers the latter, but i hate it
(DIR) Post #AXlWX1lAWfitRUNLLE by MiaWinter@tech.lgbt
2023-07-16T21:08:44Z
0 likes, 0 repeats
@navi @chronovore yea, bc implicit returns where always a good idea...
(DIR) Post #AXlWX2RLzpT1YK725w by obfusk@tech.lgbt
2023-07-16T21:12:47Z
0 likes, 0 repeats
@MiaWinter @navi @chronovore I mean, I get the downsides. but if you're used to functional languages that don't have return statements (as do lambdas in quite a few other languages, like python and JS) it feels more natural. I certainly get not wanting to use it though. also depends on context IMO, how much the function does and whether it has any other returns and/or if/while/etc.
(DIR) Post #AXlWX37BUIvZe3gRIO by mildsunrise@tech.lgbt
2023-07-16T21:53:47Z
1 likes, 0 repeats
@obfusk @MiaWinter @navi @chronovore agree with everything. IMO the block-evaluates-to-last-expression rule is very useful in general (e.g. ternaries and if/else are the same thing, thanks to it) but I definitely emphathise with the feeling around implicit returns
(DIR) Post #AXlWX3omsBo1pI5GG8 by obfusk@tech.lgbt
2023-07-16T21:57:59Z
0 likes, 0 repeats
@mildsunrise @MiaWinter @navi @chronovore *nod nod*I do really dislike it when languages — *cough* Python *cough* — force if/else to be a statement and not an expression and you *cannot* have a single return/assign as a result.
(DIR) Post #AXlWX3y0JvB8HsOccq by obfusk@tech.lgbt
2023-07-16T21:30:23Z
0 likes, 0 repeats
@MiaWinter @navi @chronovore I like being able to use it when it doesn't make the code less readable, but more. I'm definitely not saying you should use it all the time. and you don't have to at all ofc.
(DIR) Post #AXlWX4JH2qBzLqLbmK by navi@social.vlhl.dev
2023-07-16T21:58:41.344466Z
0 likes, 0 repeats
@obfusk @mildsunrise @MiaWinter @chronovore there's no ternary operator in python?
(DIR) Post #AXlWX50ATMVHUsPrdY by MiaWinter@tech.lgbt
2023-07-16T21:59:53Z
0 likes, 0 repeats
@navi @chronovore @mildsunrise @obfusk pythonic way says there should only be one way to do somethingSince there is already if else, tenary is seen as waste (but there is Syntax for one line if else)
(DIR) Post #AXlWX5aKIvQXJ1Kjzs by navi@social.vlhl.dev
2023-07-16T22:01:35.669226Z
0 likes, 0 repeats
@MiaWinter @chronovore @mildsunrise @obfusk i kinda vibe with that, tho now necc as "only one way to do something" but more like "let's not have multiple language features for the same thing"
(DIR) Post #AXlWX66wLfVywAampc by MiaWinter@tech.lgbt
2023-07-16T22:02:08Z
0 likes, 0 repeats
@navi @chronovore @mildsunrise @obfusk pythonic is basically the opposite of c#
(DIR) Post #AXlWX6gODrs4i7B65Q by obfusk@tech.lgbt
2023-07-16T22:03:52Z
0 likes, 0 repeats
@MiaWinter @navi @chronovore @mildsunrise or perl x3I do kinda like perl's postfix if though/hides
(DIR) Post #AXlWX7MZh1cCowumq8 by mildsunrise@tech.lgbt
2023-07-16T22:04:31Z
0 likes, 0 repeats
@obfusk @MiaWinter @navi @chronovore postfix if is okay for me, what I dislike is having the order reversed like python does with the ternary (A if COND else B)
(DIR) Post #AXlWX7wjWaXSd5pfCS by navi@social.vlhl.dev
2023-07-16T22:05:40.618005Z
0 likes, 0 repeats
@mildsunrise @obfusk @MiaWinter @chronovore ok i dislike that, i like my c's <cond> ? <a> : <b>
(DIR) Post #AXlWX8cD2NiQhjEmqe by mildsunrise@tech.lgbt
2023-07-16T22:10:02Z
0 likes, 0 repeats
@navi @chronovore @MiaWinter @obfusk I'm very okay with that. the only thing I dislike is C's tendency to use symbols (? :) for flow control operators. so many people prefer if/else to ternaries solely because of how unintuitive the symbols are, and I can empathise with them
(DIR) Post #AXlWX9Beua4WTfp66S by navi@social.vlhl.dev
2023-07-16T22:11:10.420271Z
0 likes, 0 repeats
@mildsunrise @chronovore @MiaWinter @obfusk i can't think of another case where it's symbols and not keywords tho
(DIR) Post #AXlWX9qmRgxuXD3wCO by mildsunrise@tech.lgbt
2023-07-16T22:13:43Z
0 likes, 0 repeats
@navi @chronovore @MiaWinter @obfusk && and || are short circuiting, I'd really prefer them to be keywords... maybe that's just me though
(DIR) Post #AXlWXAUU44iyWLde5I by obfusk@tech.lgbt
2023-07-16T22:14:29Z
0 likes, 0 repeats
@mildsunrise @navi @chronovore @MiaWinter just don't be ruby and have both &&/|| and and/or with different precedence.
(DIR) Post #AXlWXBAfXET6dBNKq0 by mildsunrise@tech.lgbt
2023-07-16T22:16:00Z
0 likes, 0 repeats
@obfusk @navi @chronovore @MiaWinter :blobcatnotlikethis:
(DIR) Post #AXlWY0YWUIqvzvvbbE by aliss@outerheaven.club
2023-07-16T22:18:13.551044Z
0 likes, 0 repeats
@mildsunrise @obfusk @navi @chronovore @MiaWinter :blobcatgooglyholdingitsheadinitshands: