Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • 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
Code Project
  1. Home
  2. Other Discussions
  3. The Insider News
  4. mr. null

mr. null

Scheduled Pinned Locked Moved The Insider News
com
31 Posts 8 Posters 0 Views 1 Watching
  • 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.
  • T thewazz

    not sure if this was posted before: http://www.wired.com/2015/11/null/[^] the challenges of having Null as a (real) last name.

    B Offline
    B Offline
    Brisingr Aerowing
    wrote on last edited by
    #5

    For websites and stuff to fail like that is really worrying. Shouldn't those just be strings?

    What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

    T 1 Reply Last reply
    0
    • J Jorgen Andersson

      Java[^] for example. But which other languages does the same?

      Wrong is evil and must be defeated. - Jeff Ello

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #6

      I'm baffled. What special kind of idiot converts a specific array of byte to a null-pointer? :((

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

      J 1 Reply Last reply
      0
      • Sander RosselS Sander Rossel

        My thoughts exactly! It takes A LOT OF WORK to translate "null" into null... :~ At least in the languages I know. Unless...

        <script>
        var name = 'null';
        if (name == null) {
        alert("That's a lovely name " + name + '!');
        } else {
        alert('Please insert a name!');
        }
        </script>

        Yep, JavaScript as always X| And it's only the one language that's used for every website everywhere. Just "if (name)" would've been fine though... JavaScript... Y U DO DIS!? :confused:

        Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

        Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

        Regards, Sander

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #7

        Leeson Lesson* learned: never use a coffee-based language. :^)

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

        1 Reply Last reply
        0
        • L Lost User

          I'm baffled. What special kind of idiot converts a specific array of byte to a null-pointer? :((

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          J Offline
          J Offline
          Jorgen Andersson
          wrote on last edited by
          #8

          They don't do any actual conversions, it's an abstraction. The "null pointer" has been swapped for a type of its own. This works just fine as long as you're having a strongly typed language. Which JavaScript spit isn't. I did some research yesterday evening and it seems like C# does the same.

          Wrong is evil and must be defeated. - Jeff Ello

          L 1 Reply Last reply
          0
          • Sander RosselS Sander Rossel

            My thoughts exactly! It takes A LOT OF WORK to translate "null" into null... :~ At least in the languages I know. Unless...

            <script>
            var name = 'null';
            if (name == null) {
            alert("That's a lovely name " + name + '!');
            } else {
            alert('Please insert a name!');
            }
            </script>

            Yep, JavaScript as always X| And it's only the one language that's used for every website everywhere. Just "if (name)" would've been fine though... JavaScript... Y U DO DIS!? :confused:

            Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

            Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

            Regards, Sander

            J Offline
            J Offline
            Jorgen Andersson
            wrote on last edited by
            #9

            I wonder how this is handled in Typescript?

            Wrong is evil and must be defeated. - Jeff Ello

            Sander RosselS 1 Reply Last reply
            0
            • J Jorgen Andersson

              I wonder how this is handled in Typescript?

              Wrong is evil and must be defeated. - Jeff Ello

              Sander RosselS Offline
              Sander RosselS Offline
              Sander Rossel
              wrote on last edited by
              #10

              The only way to handle this is simply "if (name)"... Even "if (name === null)" evaluates to true if name is "null"! :~ And it gets worse "name === undefined" is also true for name is "null"... That's not even close! Well, undefined === null, but that's just bullcrap. As is JavaScript X|

              Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

              Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

              Regards, Sander

              Richard DeemingR 1 Reply Last reply
              0
              • J Jorgen Andersson

                They don't do any actual conversions, it's an abstraction. The "null pointer" has been swapped for a type of its own. This works just fine as long as you're having a strongly typed language. Which JavaScript spit isn't. I did some research yesterday evening and it seems like C# does the same.

                Wrong is evil and must be defeated. - Jeff Ello

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #11

                In C#, the string "null" does not equall a null-pointer. Type 'null' in a textbox, you get a Unicode string with the text.

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                T 1 Reply Last reply
                0
                • Sander RosselS Sander Rossel

                  The only way to handle this is simply "if (name)"... Even "if (name === null)" evaluates to true if name is "null"! :~ And it gets worse "name === undefined" is also true for name is "null"... That's not even close! Well, undefined === null, but that's just bullcrap. As is JavaScript X|

                  Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                  Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                  Regards, Sander

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #12

                  Which flavour of javascript are you using? I've tried in Firefox, Chrome, IE11 and Edge, and I can't get it to think that "null" is equal to null or undefined at all. :confused: Try this test script: https://jsfiddle.net/bfg9cxg2/[^]


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                  Sander RosselS T 2 Replies Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    Which flavour of javascript are you using? I've tried in Firefox, Chrome, IE11 and Edge, and I can't get it to think that "null" is equal to null or undefined at all. :confused: Try this test script: https://jsfiddle.net/bfg9cxg2/[^]


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    Sander RosselS Offline
                    Sander RosselS Offline
                    Sander Rossel
                    wrote on last edited by
                    #13

                    I just realized I've switched == and !=... If stupidity hurt I'd be in agonizing pain right now! :laugh:

                    Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                    Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                    Regards, Sander

                    1 Reply Last reply
                    0
                    • L Lost User

                      A text-string that literally says "null" in ASCII or Unicode gets translated to a null-pointer in which language? :rolleyes:

                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                      T Offline
                      T Offline
                      TheGreatAndPowerfulOz
                      wrote on last edited by
                      #14

                      Yeah, that's what I was thinking. What bassakward software is written to see a "null" STRING as a null object pointer. WTF? Very poorly written software. And I'm wondering just how real this is?

                      Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                      L 1 Reply Last reply
                      0
                      • J Jorgen Andersson

                        Java[^] for example. But which other languages does the same?

                        Wrong is evil and must be defeated. - Jeff Ello

                        T Offline
                        T Offline
                        TheGreatAndPowerfulOz
                        wrote on last edited by
                        #15

                        Really? Java converts a string variable with the contents "null" into a null object pointer? Really? I think maybe you mean JavaScript, but even then that doesn't do what you suggest (convert a string containing "null" to a null pointer).

                        Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                        J 1 Reply Last reply
                        0
                        • L Lost User

                          In C#, the string "null" does not equall a null-pointer. Type 'null' in a textbox, you get a Unicode string with the text.

                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                          T Offline
                          T Offline
                          TheGreatAndPowerfulOz
                          wrote on last edited by
                          #16

                          Exactly. I think Mr Jörgen is confused.

                          Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                          1 Reply Last reply
                          0
                          • Richard DeemingR Richard Deeming

                            Which flavour of javascript are you using? I've tried in Firefox, Chrome, IE11 and Edge, and I can't get it to think that "null" is equal to null or undefined at all. :confused: Try this test script: https://jsfiddle.net/bfg9cxg2/[^]


                            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                            T Offline
                            T Offline
                            TheGreatAndPowerfulOz
                            wrote on last edited by
                            #17

                            I modified it to test for "undefined == null" and "undefined === null" and only the "==" (double eq) succeeded in being "equal".

                            Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                            Richard DeemingR 1 Reply Last reply
                            0
                            • B Brisingr Aerowing

                              For websites and stuff to fail like that is really worrying. Shouldn't those just be strings?

                              What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

                              T Offline
                              T Offline
                              TheGreatAndPowerfulOz
                              wrote on last edited by
                              #18

                              There's probably some code somewhere in the frontend/backend that's comparing the string to "null" because the developers doughheads decided that was the way to represent (no data) for certain db fields instead of using the more reasonable dbnull field concept.

                              Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                              B 2 Replies Last reply
                              0
                              • T TheGreatAndPowerfulOz

                                I modified it to test for "undefined == null" and "undefined === null" and only the "==" (double eq) succeeded in being "equal".

                                Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                                Richard DeemingR Offline
                                Richard DeemingR Offline
                                Richard Deeming
                                wrote on last edited by
                                #19

                                But that's not the point. The test was whether the string value "null" would compare equal to null or undefined, which it doesn't.

                                "null" === null // false
                                "null" == null // false
                                "null" === undefined // false
                                "null" == undefined // false

                                // Neither of these tests would affect "Mr Null":
                                null === undefined // false
                                null == undefined // true


                                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                                T 1 Reply Last reply
                                0
                                • Richard DeemingR Richard Deeming

                                  But that's not the point. The test was whether the string value "null" would compare equal to null or undefined, which it doesn't.

                                  "null" === null // false
                                  "null" == null // false
                                  "null" === undefined // false
                                  "null" == undefined // false

                                  // Neither of these tests would affect "Mr Null":
                                  null === undefined // false
                                  null == undefined // true


                                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                  T Offline
                                  T Offline
                                  TheGreatAndPowerfulOz
                                  wrote on last edited by
                                  #20

                                  Yes, I know, and I understood that already. The claim was made that "undefined == null" and "undefined === null" are equivalent and "fail" but they don't. Both are valid well-defined statements and comparisons.

                                  Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                                  1 Reply Last reply
                                  0
                                  • T TheGreatAndPowerfulOz

                                    Yeah, that's what I was thinking. What bassakward software is written to see a "null" STRING as a null object pointer. WTF? Very poorly written software. And I'm wondering just how real this is?

                                    Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #21

                                    Methinks it isn't. "Null" != "null"; and does it happen to "nulls" also? Come on, a string literal is exactly that, an array of byte in a specific encoding, and it does not magically become a null-pointer. Sound like something only an idiot would parse in each user-input. Then again, the heir to the throne of idiots may have decided that a NVARCHAR text of 'Null' is actually null. I doubt we will find out.

                                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                    T 1 Reply Last reply
                                    0
                                    • L Lost User

                                      Methinks it isn't. "Null" != "null"; and does it happen to "nulls" also? Come on, a string literal is exactly that, an array of byte in a specific encoding, and it does not magically become a null-pointer. Sound like something only an idiot would parse in each user-input. Then again, the heir to the throne of idiots may have decided that a NVARCHAR text of 'Null' is actually null. I doubt we will find out.

                                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                      T Offline
                                      T Offline
                                      TheGreatAndPowerfulOz
                                      wrote on last edited by
                                      #22

                                      Eddy Vluggen wrote:

                                      Methinks it isn't.

                                      Agreed.

                                      Eddy Vluggen wrote:

                                      something only an idiot would parse

                                      Indeed.

                                      Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                                      1 Reply Last reply
                                      0
                                      • T TheGreatAndPowerfulOz

                                        There's probably some code somewhere in the frontend/backend that's comparing the string to "null" because the developers doughheads decided that was the way to represent (no data) for certain db fields instead of using the more reasonable dbnull field concept.

                                        Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                                        B Offline
                                        B Offline
                                        Brisingr Aerowing
                                        wrote on last edited by
                                        #23

                                        TheGreatAndPowerfulOz wrote:

                                        developers doughheads

                                        LOL

                                        What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

                                        1 Reply Last reply
                                        0
                                        • T TheGreatAndPowerfulOz

                                          There's probably some code somewhere in the frontend/backend that's comparing the string to "null" because the developers doughheads decided that was the way to represent (no data) for certain db fields instead of using the more reasonable dbnull field concept.

                                          Decrease the belief in God, and you increase the numbers of those who wish to play at being God by being “society’s supervisors,” who deny the existence of divine standards, but are very serious about imposing their own standards on society.-Neal A. Maxwell You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                                          B Offline
                                          B Offline
                                          Brisingr Aerowing
                                          wrote on last edited by
                                          #24

                                          Or possibly the management decided that.

                                          What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

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


                                          • Login

                                          • Don't have an account? Register

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