1. 11
  1.  

  2. 2

    The value zero (0) is a special case. It is not just an integer value, but can also be used to mean “no value” for all the types, and not just integers. If you create a variable and don’t put a value in it, it starts with the value 0.

    I refuse to believe that the language is not an elaborate joke like INTERCAL but more subtle.

    1. 5

      If I remember correctly, Pike was used to write and extend the Roxen web server. Back in the 90s the choices if you did not want Apache, but needed a programmable web server (without CGI / FastCGI) were not that many.

      1. 4

        Roxen! That takes me back…

        FWIW that company/product is named for the lake.

        The lake is home to pike fish too :)

      2. 4

        I refuse to believe that the language is not an elaborate joke like INTERCAL but more subtle.

        Read about Perl and its “zero but true” concept.

        Normally in Perl, nonempty strings are boolean true, unless they’re parseable as numbers, in which case they’re parsed as numbers and that value is used. Boolean true and false are numbers, with 0 being false and everything else being true:

        "" false (and numeric zero in numeric contexts)
        "false" true
        "true" true
        0 false
        

        But Perl, oh Perl, has a magic string is that is not empty, not really parseable as a number, equal to numeric zero, and boolean true. The magic string

        "0 but true"
        

        will get parsed as the number zero, but as boolean true. This is what’s returned from, e.g. system calls that return zero on success.

        Other strings of this form may work, I can’t remember, but this form is hardcoded into the interpreter such that it does not cause warnings.

        1. 3

          To defend Perl here a bit I think it’s to accommodate the “return 0 for success” paradigm of the shell.

          1. 2

            I’m leading a deperlification project right now in fact. ;) The problem with Perl is that it went far beyond its intended scope of “AWK on steroids”. C’s NULL can be seen as a compromise since it’s a very old design after all and was meant to work on hardware that was slow even for its day. Pike is much newer and still seem to be intentionally designed to bring all the old classes of bugs into a new era.

          2. 2

            Is that that much worse than null?

            1. 3

              Well for one value types are all nullable now. So it is the same problem but also more so.

              1. 1

                Imo it’s a big difference that with null you at least know that it always means that there is no value where in this case it can get confusing for integer types.

                1. 2

                  I guess it just means integers have no “no value” value, and the null for other types is equal to a literal zero. Not saying I agree with the decision, but I don’t think it’s “elaborate joke” levels of bad.