Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. I am NOT making a Rust replacement, but — if you could fix one* thing about Rust syntax/semantics/etc.

I am NOT making a Rust replacement, but — if you could fix one* thing about Rust syntax/semantics/etc.

Scheduled Pinned Locked Moved Uncategorized
120 Posts 48 Posters 160 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

    I think I may have accidentally come up with a drinking game

    If someone mentions function coloring, you have to finish your glass

    fasterthanlime@hachyderm.ioF This user is from outside of this forum
    fasterthanlime@hachyderm.ioF This user is from outside of this forum
    fasterthanlime@hachyderm.io
    wrote last edited by
    #41

    Unfortunately the ecosystem is split between colored functions and coloured functions

    ianthetechie@fosstodon.orgI fasterthanlime@hachyderm.ioF niq@fosstodon.orgN pierrelebeaupin@mastodon.gougere.frP 4 Replies Last reply
    0
    • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

      I am NOT making a Rust replacement, but — if you could fix one* thing about Rust syntax/semantics/etc. what would you fix?

      (*one per reply, multiple replies per household are allowed)

      pndc@social.treehouse.systemsP This user is from outside of this forum
      pndc@social.treehouse.systemsP This user is from outside of this forum
      pndc@social.treehouse.systems
      wrote last edited by
      #42

      @fasterthanlime How has nobody else mentioned the orphan rule yet?

      1 Reply Last reply
      0
      • fasterthanlime@hachyderm.ioF This user is from outside of this forum
        fasterthanlime@hachyderm.ioF This user is from outside of this forum
        fasterthanlime@hachyderm.io
        wrote last edited by
        #43

        @arichtman @yosh told ya

        1 Reply Last reply
        0
        • fasterthanlime@hachyderm.ioF This user is from outside of this forum
          fasterthanlime@hachyderm.ioF This user is from outside of this forum
          fasterthanlime@hachyderm.io
          wrote last edited by
          #44

          @arichtman @pndc yeah exactly the fix is unsoundness so..

          piecritic@hachyderm.ioP 1 Reply Last reply
          0
          • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

            I am NOT making a Rust replacement, but — if you could fix one* thing about Rust syntax/semantics/etc. what would you fix?

            (*one per reply, multiple replies per household are allowed)

            waltertross@mastodon.onlineW This user is from outside of this forum
            waltertross@mastodon.onlineW This user is from outside of this forum
            waltertross@mastodon.online
            wrote last edited by
            #45

            @fasterthanlime
            let mut → var

            1 Reply Last reply
            0
            • pndc@social.treehouse.systemsP This user is from outside of this forum
              pndc@social.treehouse.systemsP This user is from outside of this forum
              pndc@social.treehouse.systems
              wrote last edited by
              #46

              @arichtman @fasterthanlime It's not quite the same thing because the languages approach traits and the problems solved by traits differently, but Scala handles this by (massive handwave over the details) giving the implementations a name, which has to be imported by the code which uses it. That way there doesn't need to be One True Implementation which limits where it can be defined. The flip side is that it needs to be imported by all library users and isn't automatically available, but since Scala code tends to wildcard-import from libraries, this is not particularly onerous.

              pndc@social.treehouse.systemsP 1 Reply Last reply
              0
              • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

                I am NOT making a Rust replacement, but — if you could fix one* thing about Rust syntax/semantics/etc. what would you fix?

                (*one per reply, multiple replies per household are allowed)

                zwol@masto.hackers.townZ This user is from outside of this forum
                zwol@masto.hackers.townZ This user is from outside of this forum
                zwol@masto.hackers.town
                wrote last edited by
                #47

                @fasterthanlime I have a dang *list*, but let's start with the pettiest one:

                The value of { a(); b(); } should be whatever b returns, not ().

                If you want to throw away the value returned by b you should have to write { a(); b(); (); }.

                Leaving off the semicolon on the last expression in a block should be a *syntax error*, except when you wouldn't have to put a semicolon after that expression if it wasn't the last expression in the block.

                soc@chaos.socialS 1 Reply Last reply
                0
                • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

                  I am NOT making a Rust replacement, but — if you could fix one* thing about Rust syntax/semantics/etc. what would you fix?

                  (*one per reply, multiple replies per household are allowed)

                  teohhanhui@mastodon.socialT This user is from outside of this forum
                  teohhanhui@mastodon.socialT This user is from outside of this forum
                  teohhanhui@mastodon.social
                  wrote last edited by
                  #48

                  @fasterthanlime Algebraic effects? 🙈

                  1 Reply Last reply
                  0
                  • yosh@toot.yosh.isY yosh@toot.yosh.is

                    @poliorcetics @cyberia @fasterthanlime

                    Tuples are anonymous structs. To my knowledge anonymous enums have not been accepted; I agree they would be nice.

                    simon@tutut.delire.partyS This user is from outside of this forum
                    simon@tutut.delire.partyS This user is from outside of this forum
                    simon@tutut.delire.party
                    wrote last edited by
                    #49

                    @yosh @poliorcetics @cyberia @fasterthanlime sometimes an anonymous struct with named fields would be nice, like for a one-off return type. but i usually eat the verbosity and make it a named struct, so it’s not where i’d spend language complexity budget first

                    cyberia@tilde.zoneC 1 Reply Last reply
                    0
                    • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

                      I am NOT making a Rust replacement, but — if you could fix one* thing about Rust syntax/semantics/etc. what would you fix?

                      (*one per reply, multiple replies per household are allowed)

                      yanns@mstdn.socialY This user is from outside of this forum
                      yanns@mstdn.socialY This user is from outside of this forum
                      yanns@mstdn.social
                      wrote last edited by
                      #50

                      @fasterthanlime I'd like some syntax sugar like in Scala: o.map(_.toString())

                      fasterthanlime@hachyderm.ioF 1 Reply Last reply
                      0
                      • yanns@mstdn.socialY yanns@mstdn.social

                        @fasterthanlime I'd like some syntax sugar like in Scala: o.map(_.toString())

                        fasterthanlime@hachyderm.ioF This user is from outside of this forum
                        fasterthanlime@hachyderm.ioF This user is from outside of this forum
                        fasterthanlime@hachyderm.io
                        wrote last edited by
                        #51

                        @yanns they use `_` for that? huh! been a while since my EPFL days

                        yanns@mstdn.socialY 1 Reply Last reply
                        0
                        • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

                          I am NOT making a Rust replacement, but — if you could fix one* thing about Rust syntax/semantics/etc. what would you fix?

                          (*one per reply, multiple replies per household are allowed)

                          kroc@oldbytes.spaceK This user is from outside of this forum
                          kroc@oldbytes.spaceK This user is from outside of this forum
                          kroc@oldbytes.space
                          wrote last edited by
                          #52

                          @fasterthanlime As someone who learnt #Rust but didn’t stick with it, get rid of * / & syntax and use in / out / inout keywords on the parameter instead. It’s a noob thing but #C’s pointer syntax has always struck me as needlessly confusing and requiring too much micro-management through a code base. Rust was too much up-front architecting and not enough proving an idea works and cleaning up afterwards for me

                          #rust #c #programming

                          1 Reply Last reply
                          0
                          • pndc@social.treehouse.systemsP pndc@social.treehouse.systems

                            @arichtman @fasterthanlime It's not quite the same thing because the languages approach traits and the problems solved by traits differently, but Scala handles this by (massive handwave over the details) giving the implementations a name, which has to be imported by the code which uses it. That way there doesn't need to be One True Implementation which limits where it can be defined. The flip side is that it needs to be imported by all library users and isn't automatically available, but since Scala code tends to wildcard-import from libraries, this is not particularly onerous.

                            pndc@social.treehouse.systemsP This user is from outside of this forum
                            pndc@social.treehouse.systemsP This user is from outside of this forum
                            pndc@social.treehouse.systems
                            wrote last edited by
                            #53

                            @arichtman @fasterthanlime In my own hypothetical Rust replacement which I don't expect to write any time soon, I would definitely be stealing quite hard from Scala. Other things: square brackets for trait parameters so we don't get weird parses from angle brackets and generally improving ergonomics, it basically having stable fn_traits so a collection or other container type can just be called directly to perform a lookup without the noise of .get or whatever, implicit parameters so some common parameter (e.g. a database handle) can bubble through the call stack without explicitly adding it to every function call, and perhaps its dependent functions/methods. But those are another three things…

                            1 Reply Last reply
                            0
                            • simon@tutut.delire.partyS simon@tutut.delire.party

                              @yosh @poliorcetics @cyberia @fasterthanlime sometimes an anonymous struct with named fields would be nice, like for a one-off return type. but i usually eat the verbosity and make it a named struct, so it’s not where i’d spend language complexity budget first

                              cyberia@tilde.zoneC This user is from outside of this forum
                              cyberia@tilde.zoneC This user is from outside of this forum
                              cyberia@tilde.zone
                              wrote last edited by
                              #54

                              @simon @yosh @poliorcetics @fasterthanlime yeah, often I find that if I'm returning multiple values from a function, either the thing returned is a useful grouping elsewhere in the program and therefore deserves a name, or the function is overburdened and can be split up

                              fasterthanlime@hachyderm.ioF 1 Reply Last reply
                              0
                              • cyberia@tilde.zoneC cyberia@tilde.zone

                                @simon @yosh @poliorcetics @fasterthanlime yeah, often I find that if I'm returning multiple values from a function, either the thing returned is a useful grouping elsewhere in the program and therefore deserves a name, or the function is overburdened and can be split up

                                fasterthanlime@hachyderm.ioF This user is from outside of this forum
                                fasterthanlime@hachyderm.ioF This user is from outside of this forum
                                fasterthanlime@hachyderm.io
                                wrote last edited by
                                #55

                                @cyberia @simon @yosh @poliorcetics something something stockholm syndrome (with all due respect)

                                cyberia@tilde.zoneC 1 Reply Last reply
                                0
                                • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

                                  @cyberia @simon @yosh @poliorcetics something something stockholm syndrome (with all due respect)

                                  cyberia@tilde.zoneC This user is from outside of this forum
                                  cyberia@tilde.zoneC This user is from outside of this forum
                                  cyberia@tilde.zone
                                  wrote last edited by
                                  #56

                                  @fasterthanlime @simon @yosh @poliorcetics ha, I think it's a pretty useful prompt that the code is getting messy and could be refactored, but sure

                                  fasterthanlime@hachyderm.ioF 1 Reply Last reply
                                  0
                                  • zwol@masto.hackers.townZ zwol@masto.hackers.town

                                    @fasterthanlime I have a dang *list*, but let's start with the pettiest one:

                                    The value of { a(); b(); } should be whatever b returns, not ().

                                    If you want to throw away the value returned by b you should have to write { a(); b(); (); }.

                                    Leaving off the semicolon on the last expression in a block should be a *syntax error*, except when you wouldn't have to put a semicolon after that expression if it wasn't the last expression in the block.

                                    soc@chaos.socialS This user is from outside of this forum
                                    soc@chaos.socialS This user is from outside of this forum
                                    soc@chaos.social
                                    wrote last edited by
                                    #57

                                    @zwol @fasterthanlime That one is also on my list!

                                    Do you have your list somewhere?
                                    My list (syntax-only) is https://soc.me/languages/design-mistakes-in-rust.

                                    zwol@masto.hackers.townZ 1 Reply Last reply
                                    0
                                    • cyberia@tilde.zoneC cyberia@tilde.zone

                                      @fasterthanlime @simon @yosh @poliorcetics ha, I think it's a pretty useful prompt that the code is getting messy and could be refactored, but sure

                                      fasterthanlime@hachyderm.ioF This user is from outside of this forum
                                      fasterthanlime@hachyderm.ioF This user is from outside of this forum
                                      fasterthanlime@hachyderm.io
                                      wrote last edited by
                                      #58

                                      @cyberia @simon @yosh @poliorcetics Right, I don't mean that as like an insult saying you're incapable of imagining things outside of the tools you're currently allowed to use. I'm just saying that I've caught myself coming up with excuses for the limitations of the language I use because I know those limitations are not going to be lifted... and therefore, it's easier to imagine that they make sense than to imagine that I'm suffering for no good reason is the long version of what I was trying to say.

                                      yosh@toot.yosh.isY cyberia@tilde.zoneC 2 Replies Last reply
                                      0
                                      • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

                                        @cyberia @simon @yosh @poliorcetics Right, I don't mean that as like an insult saying you're incapable of imagining things outside of the tools you're currently allowed to use. I'm just saying that I've caught myself coming up with excuses for the limitations of the language I use because I know those limitations are not going to be lifted... and therefore, it's easier to imagine that they make sense than to imagine that I'm suffering for no good reason is the long version of what I was trying to say.

                                        yosh@toot.yosh.isY This user is from outside of this forum
                                        yosh@toot.yosh.isY This user is from outside of this forum
                                        yosh@toot.yosh.is
                                        wrote last edited by
                                        #59

                                        @fasterthanlime @cyberia @simon @poliorcetics

                                        Hear hear! We all deserve good things! Things can be better!

                                        1 Reply Last reply
                                        0
                                        • fasterthanlime@hachyderm.ioF fasterthanlime@hachyderm.io

                                          @cyberia @simon @yosh @poliorcetics Right, I don't mean that as like an insult saying you're incapable of imagining things outside of the tools you're currently allowed to use. I'm just saying that I've caught myself coming up with excuses for the limitations of the language I use because I know those limitations are not going to be lifted... and therefore, it's easier to imagine that they make sense than to imagine that I'm suffering for no good reason is the long version of what I was trying to say.

                                          cyberia@tilde.zoneC This user is from outside of this forum
                                          cyberia@tilde.zoneC This user is from outside of this forum
                                          cyberia@tilde.zone
                                          wrote last edited by
                                          #60

                                          @fasterthanlime @simon @yosh @poliorcetics Sure - but this is a pattern I use in TypeScript as well which allows anonymous structs as function returns. In this case the restriction in Rust made me a better TS engineer, so it goes both ways. I would definitely agree with you in other contexts (like passing structs as parameters in C being messy meaning that people think it's an undesirable thing in general)

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups