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 (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Programmer Humor
  3. Why make it complicated?

Why make it complicated?

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
116 Posts 58 Posters 128 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.
  • hiddenlayer555@lemmy.mlH This user is from outside of this forum
    hiddenlayer555@lemmy.mlH This user is from outside of this forum
    [email protected]
    wrote on last edited by [email protected]
    #1

    Made with KolourPaint and screenshots from Kate (with the GitHub theme).

    G T _ dan@upvote.auD O 14 Replies Last reply
    373
    • hiddenlayer555@lemmy.mlH [email protected]

      Made with KolourPaint and screenshots from Kate (with the GitHub theme).

      G This user is from outside of this forum
      G This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #2

      You're encoding more information in the typescript one. You're saying it's a string that will get updated.

      M M scoopta@programming.devS H Z 5 Replies Last reply
      51
      • G [email protected]

        You're encoding more information in the typescript one. You're saying it's a string that will get updated.

        M This user is from outside of this forum
        M This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #3

        That looks like rust ngl

        C W 2 Replies Last reply
        10
        • hiddenlayer555@lemmy.mlH [email protected]

          Made with KolourPaint and screenshots from Kate (with the GitHub theme).

          T This user is from outside of this forum
          T This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #4

          I've always wondered where all this 'let' business started

          hiddenlayer555@lemmy.mlH N 2 Replies Last reply
          14
          • T [email protected]

            I've always wondered where all this 'let' business started

            hiddenlayer555@lemmy.mlH This user is from outside of this forum
            hiddenlayer555@lemmy.mlH This user is from outside of this forum
            [email protected]
            wrote on last edited by [email protected]
            #5

            It's commonly used in math to declare variables so I assume programming languages borrowed it from there.

            B chaos@beehaw.orgC 2 Replies Last reply
            27
            • G [email protected]

              You're encoding more information in the typescript one. You're saying it's a string that will get updated.

              M This user is from outside of this forum
              M This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #6

              Yeah, it's explicitly distinct from const a: String which says it won't change, and var a: String, which means this is legacy code that needs fixing.

              psaldorn@lemmy.worldP 1 Reply Last reply
              34
              • G [email protected]

                You're encoding more information in the typescript one. You're saying it's a string that will get updated.

                scoopta@programming.devS This user is from outside of this forum
                scoopta@programming.devS This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #7

                You aren't though. In most languages that use the latter declaration you would prefix the declaration with final or const or the like to specify it won't be updated.

                1 Reply Last reply
                18
                • hiddenlayer555@lemmy.mlH [email protected]

                  It's commonly used in math to declare variables so I assume programming languages borrowed it from there.

                  B This user is from outside of this forum
                  B This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #8

                  BASIC uses (used?) it to declare variables. (I don't know if earlier languages did.)

                  Not that that's a reason for other languages to copy it.

                  hiddenlayer555@lemmy.mlH 1 Reply Last reply
                  6
                  • B [email protected]

                    BASIC uses (used?) it to declare variables. (I don't know if earlier languages did.)

                    Not that that's a reason for other languages to copy it.

                    hiddenlayer555@lemmy.mlH This user is from outside of this forum
                    hiddenlayer555@lemmy.mlH This user is from outside of this forum
                    [email protected]
                    wrote on last edited by [email protected]
                    #9

                    Doesn't Basic use Dim a As String?

                    dan@upvote.auD 1 Reply Last reply
                    7
                    • hiddenlayer555@lemmy.mlH [email protected]

                      Made with KolourPaint and screenshots from Kate (with the GitHub theme).

                      _ This user is from outside of this forum
                      _ This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #10

                      python:

                      a: str = 1

                      beigeagenda@lemmy.caB H 2 Replies Last reply
                      40
                      • T [email protected]

                        I've always wondered where all this 'let' business started

                        N This user is from outside of this forum
                        N This user is from outside of this forum
                        [email protected]
                        wrote on last edited by
                        #11

                        More than you'd ever want to know: https://en.m.wikipedia.org/wiki/Let_expression

                        T 1 Reply Last reply
                        15
                        • M [email protected]

                          Yeah, it's explicitly distinct from const a: String which says it won't change, and var a: String, which means this is legacy code that needs fixing.

                          psaldorn@lemmy.worldP This user is from outside of this forum
                          psaldorn@lemmy.worldP This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #12

                          If there's only two options you only need one keyword

                          H L 2 Replies Last reply
                          9
                          • hiddenlayer555@lemmy.mlH [email protected]

                            Doesn't Basic use Dim a As String?

                            dan@upvote.auD This user is from outside of this forum
                            dan@upvote.auD This user is from outside of this forum
                            [email protected]
                            wrote on last edited by [email protected]
                            #13

                            Older variants used DIM for arrays and LET for other variables. DIM was originally called that because it was setting the dimensions of the array.

                            In modern BASIC variants, DIM has become a backronym: "declare in memory".

                            T M S 3 Replies Last reply
                            8
                            • hiddenlayer555@lemmy.mlH [email protected]

                              Made with KolourPaint and screenshots from Kate (with the GitHub theme).

                              dan@upvote.auD This user is from outside of this forum
                              dan@upvote.auD This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #14

                              Can we talk about PHP functions with typehints too?

                              public static function foo(): string {
                              

                              Practically every other language with similar syntax does this instead:

                              public static string foo() {
                              
                              hiddenlayer555@lemmy.mlH S C 3 Replies Last reply
                              7
                              • dan@upvote.auD [email protected]

                                Can we talk about PHP functions with typehints too?

                                public static function foo(): string {
                                

                                Practically every other language with similar syntax does this instead:

                                public static string foo() {
                                
                                hiddenlayer555@lemmy.mlH This user is from outside of this forum
                                hiddenlayer555@lemmy.mlH This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #15

                                TIL PHP has statics.

                                Also, does PHP actually enforce the type declarations? I'd assume it would but knowing PHP...

                                dan@upvote.auD 1 Reply Last reply
                                5
                                • hiddenlayer555@lemmy.mlH [email protected]

                                  TIL PHP has statics.

                                  Also, does PHP actually enforce the type declarations? I'd assume it would but knowing PHP...

                                  dan@upvote.auD This user is from outside of this forum
                                  dan@upvote.auD This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by
                                  #16

                                  It enforces scalar types (string, int, etc) at runtime if you enable strict mode. There's also static analysis tools like PHPStan and Psalm that will flag issues at build time.

                                  W 1 Reply Last reply
                                  3
                                  • dan@upvote.auD [email protected]

                                    Older variants used DIM for arrays and LET for other variables. DIM was originally called that because it was setting the dimensions of the array.

                                    In modern BASIC variants, DIM has become a backronym: "declare in memory".

                                    T This user is from outside of this forum
                                    T This user is from outside of this forum
                                    [email protected]
                                    wrote on last edited by
                                    #17

                                    TIL Backronyms and cuil BASIC technicalities
                                    Much obliged all

                                    1 Reply Last reply
                                    3
                                    • _ [email protected]

                                      python:

                                      a: str = 1

                                      beigeagenda@lemmy.caB This user is from outside of this forum
                                      beigeagenda@lemmy.caB This user is from outside of this forum
                                      [email protected]
                                      wrote on last edited by
                                      #18

                                      And then assign an int to a string just to mess with the interpreter.

                                      S I 2 Replies Last reply
                                      20
                                      • hiddenlayer555@lemmy.mlH [email protected]

                                        Made with KolourPaint and screenshots from Kate (with the GitHub theme).

                                        O This user is from outside of this forum
                                        O This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by
                                        #19

                                        First time i used let it was to inline variable declaration with assignment . Can’t remember the language.

                                        1 Reply Last reply
                                        1
                                        • dan@upvote.auD [email protected]

                                          Older variants used DIM for arrays and LET for other variables. DIM was originally called that because it was setting the dimensions of the array.

                                          In modern BASIC variants, DIM has become a backronym: "declare in memory".

                                          M This user is from outside of this forum
                                          M This user is from outside of this forum
                                          [email protected]
                                          wrote on last edited by
                                          #20

                                          Even older variants required both a let to declare the variable and a dim to set its size.

                                          I remember a REDIM command, but I really can't remember what basic it's from.

                                          dan@upvote.auD 1 Reply Last reply
                                          1
                                          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