[HN Gopher] From Go to Rust: The Two Types of Readable Code
___________________________________________________________________
From Go to Rust: The Two Types of Readable Code
Author : hasheddan
Score : 15 points
Date : 2024-02-14 15:42 UTC (7 hours ago)
(HTM) web link (earthly.dev)
(TXT) w3m dump (earthly.dev)
| adamgordonbell wrote:
| Thanks for sharing this! I wrote it.
|
| Here's the idea: Code readability is highly subjective. What
| looks like gibberish to some is crystal clear to others.
|
| But is readability more than just familiarity?
|
| I think so and I think their is more than one type of
| readability. Newcomer Readability and Experienced Readability.
| And sometimes, they clash.
|
| Which one should programming languages prioritize? Newcomer
| Readability helps adoption and is closely related to familiarity.
| But Experienced Readability is all about expressiveness.
| bionsystem wrote:
| f(x,y) -> Clear and straightforward - the mark of practical
| programming. f x y -> Acceptable in shell scripting, but a bit
| odd. (f x y) -> Impossibly puzzling. Approach with caution!
|
| Pretty funny. I'm working with maven at the moment so a function
| call looks more like :
|
| <plugins> <plugin>execute</plugin> <id>function-f</id>
| <executions> <execution> <cmd>f</cmd> <arguments>
| <argument>x</argument> <argument>y</argument> </arguments>
| </execution> </executions> </plugin>
| Quekid5 wrote:
| > f x y -> Acceptable in shell scripting
|
| Or Haskell (aka: with a good type system). Or even Haskell used
| for shell scripting[0]. I've used this along with Stack shebang
| lines to great effect. A 70 line git subcommand script with
| stronk type checking is amazing. (It's a very workflow-specific
| script, but the fact that I've never had to debug it because of
| weird interpolation issues, etc. is amazing.)
|
| [0] https://hackage.haskell.org/package/turtle
| impulser_ wrote:
| > But Go doesn't have a way to get the maximum of some ints in
| the standard library. So I'd have to implement the max function
| myself
|
| min and max functions are now in the standard library as of 1.21.
|
| >Myself, I think expert readability is more important than
| beginner friendliness.
|
| I think the opposite. beginner friendliness benefits both
| beginners and experts while expert readability only benefits
| experts. This is why I stopped using Rust. It hard to get started
| and even months into learning it and you finally feel productive
| you step into a new project and it feels like you are going
| backwards.
|
| I can hop into any Go project and feel productive right away.
___________________________________________________________________
(page generated 2024-02-14 23:01 UTC)