http://qs321.pair.com?node_id=1172751


in reply to Re^5: why are hex values not numbers?
in thread why are hex values not numbers?

A string containing just decimal digits, can only be a number.
You could just as easily say a string containing just octal, or binary or hexadecimal digits, can only be a number.

A decimal number might be a "leetspeak" word if you were wanting to be cryptic.

Perl determines from *context* if the user is trying to use a variable as a number or a string. If the user tries to perform addition on a string -- it tries to see if the string looks like a number and allows it if it does. But there is no reason it needs to be limited to decimal digits. This is even more evident if you consider octal digits as an example. Using a rule of 'leading 0' for octal or 'leading 0x' for hex seem fairly safe -- can you give an example where doing so would be a problem?

Come-on BuK, question the status quo! ;-)

Replies are listed 'Best First'.
Re^7: why are hex values not numbers?
by hippo (Bishop) on Sep 27, 2016 at 12:21 UTC
    You could just as easily say a string containing just octal, or binary or hexadecimal digits, can only be a number.

    Except that you would be completely wrong.

    • ABBA
    • Da
    • face
    • Abe
    • EFF

    ... and many, many more are clearly not only numbers.

      I did specify that it would have to start with 0x to be a hex constant, and 0 to be an octal, so are you saying that 0xABBA, 0xDA, 0xface, 0xAbe, 0xEFF would all, clearly, not be hex values?

      I'm sorry, but at lets at least try to stay on the same page, and forgive me if I wrote this non-linearly, but such is the PM-medium.

        clearly, not be

        I didn't say "clearly, not be", I said: "might not be".


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re^7: why are hex values not numbers?
by BrowserUk (Patriarch) on Sep 27, 2016 at 12:33 UTC
    Come-on BuK, question the status quo!

    I do all the time. Unlike you, I don't just ignore the answers.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.
      BuK:...re: question the status quo
      I do all the time. Unlike you, I don't just ignore the answers.
      "In the absence of evidence, opinion is indistinguishable from prejudice."

      Note, quoting from circularly obtained or derived sources is not 'evidence'.