Announcement

Collapse
No announcement yet.

Help with VBASIC!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    A couple:
    1. 2 is a number, whereas "2" is a character string; most languages will either convert the number into a string ("2" + "2" = "22") or else convert the string into a number (2 + "2" = 4); this language converted the string into a number (2 + "2" = 4) and then converted the result back into a string (2 + "2" = "4")
    2. [] is usually an empty array (list of stuff); "2" + [] usually either produces a type error (can't add a character string to an array - they're not the same sort of thing), or else the empty array gets converted to a "" so "2" + [] = "2", or else the "2" gets put into the array so "2" + [] = ["2"]. This language put "2" in the array but then converted the entire thing to a character string, so "2" + [] = "[2]"
    3. This is normal behavior - if you divide by zero then you usually get an error or else you get a NaN (not a number)
    4. Dunno what's going on here - maybe NaP means Not a Parenthesis?
    5. Normal behavior
    6. Dunno
    7. Dunno
    8. 3/2 + 1/2 is going to produce roundoff error because computers can't precisely represent a lot of decimal values unless you take special care about how you store them. The joke here is that 2/(2 - (3/2 + 1/2)) would result in 2/0 using precise arithmetic, but using imprecise arithmetic the (3/2 + 1/2) isn't going to equal 2, so what the language did is it precisely calculated the result of 2/(2 - (3/2 + 1/2)) which is 2/0 which is NaN, then it appended the roundoff error from (3/2 + 1/2).
    9, 10, 11, 14(???). Dunno
    13. The Floor function takes a decimal as input and returns the next lowest integer as output, so Floor(10.5) should return 10. Looks like here it just prints 10.5 on the floor.
    <p style="font-size:1024px">HTML is disabled in signatures </p>

    Comment


    • #47
      <p style="font-size:1024px">HTML is disabled in signatures </p>

      Comment


      • #48
        It's a joke about duck typing, which is popular in new languages. It's not a very funny joke, mind you. Basically all of the results are cute misinterpretations of common programming idioms.

        Comment


        • #49
          Originally posted by regexcellent View Post
          It's a joke about duck typing, which is popular in new languages. It's not a very funny joke, mind you. Basically all of the results are cute misinterpretations of common programming idioms.
          That's not a joke about duck typing, since this is not duck typing. It's a joke about JavaScript and PHP, which have type systems that perform automatic value conversions that lose information and avoid throwing errors as long as they can produce some result, however inane. Call it "weak typing" if you want.

          Duck typing has no definition, but structural typing with late (dynamic) binding is in my opinion the closest thing to one.
          Graffiti in a public toilet
          Do not require skill or wit
          Among the **** we all are poets
          Among the poets we are ****.

          Comment


          • #50
            6 and 7, it adds (2 / 4) to all the elements in the array, and compares them to the operation number, returning true if either of them matches.
            10 adds the two to the operation number.

            13 is displayed after 14 to properly put it on the floor I guess.
            Indifference is Bliss

            Comment


            • #51
              Originally posted by onodera View Post
              That's not a joke about duck typing, since this is not duck typing. It's a joke about JavaScript and PHP, which have type systems that perform automatic value conversions that lose information and avoid throwing errors as long as they can produce some result, however inane. Call it "weak typing" if you want.
              My favorite WTF typing from javascript is {} + [] = 0, but [] + {} = {}. This appears to lack commutativity, which is somewhat alarming.

              I finally had this explained to me last year: In the first example, {} is not actually an empty object, but an empty block, which implicitly returns value 0. Number + array = number. Array + object = object. So the + operator is commutative, but depending on context {} can have multiple meanings. Spooky.
              If there is no sound in space, how come you can hear the lasers?
              ){ :|:& };:

              Comment


              • #52
                goddamn JM. Stupid forum
                If there is no sound in space, how come you can hear the lasers?
                ){ :|:& };:

                Comment


                • #53
                  We could have a community programming project to fix vB. (It appears the double posting is a common issue that was never fixed. I think it's an incompatibility between vB 4 and PHP 5.4)

                  Comment


                  • #54
                    Wait you're still running PHP 5.4? Why not 5.6?
                    If there is no sound in space, how come you can hear the lasers?
                    ){ :|:& };:

                    Comment


                    • #55
                      No, the PHP is updated to the latest version. vB just had problems with PHP 5.4 and it hasn't been fixed yet as far as I can tell.

                      Comment

                      Working...
                      X