Some middle-aged guy on the Internet. Seen a lot of it, occasionally regurgitating it, trying to be amusing and informative.

Lurked Digg until v4. Commented on Reddit (same username) until it went full Musk.

Was on kbin.social (dying/dead) and kbin.run (mysteriously vanished). Now here on fedia.io.

Really hoping he hasn’t brought the jinx with him.

Other Adjectives: Neurodivergent; Nerd; Broken; British; Ally; Leftish

  • 1 Post
  • 890 Comments
Joined 1 year ago
cake
Cake day: August 13th, 2024

help-circle


  • Then you find out the genie uses a signed data value and you now owe him a wish. You’re not granted magic. You’re compelled to grant the wish. The only restrictions on the genie’s wish is that it must be within your (soft, squishy) mortal power.

    I can imagine you being reset to the point of the genie’s wish every time you die (naturally or otherwise) without succeeding. This could well turn into a Groundhog Day type situation.




  • Well, in order to avoid JavaScript, it’s having to encode all seven possible block states for all possible cells of the 10×8×8 world, and they’ve chosen to use HTML “radio” buttons - a single element - to achieve this. Each radio option has its own label, which, rather than text, is a heavily stylised set of six objects that represent the sides of the cube, which only show up when their respective radio option is set.

    7×10×8×8×(1+6) = 40320. The remainder of the lines are basically everything else.

    In theory you could have JavaScript generate this on the fly directly into the DOM, and the “game” would still work without needing JavaScript to actually handle any of it, but since they’ve opted to avoid JavaScript altogether, they’ve obviously pre-generated the majority of it with some other language.





  • It’s the machine language monitor on the 40-column screen of the Commodore 128 (or, more likely, an emulator of the same). I had a whole part about that, BASIC DATA statements full of numbers, and about how anyone with any sense actually used an assembler even back then in an original draft of my comment, but decided to keep it brief.




  • Wait until you learn that postfix conditionals are syntactic sugar and the compiler* turns that line into the equivalent of $debug and print(debug message), putting the conditional in first place, a lot like the ternary operator.

    * Perl compiles to bytecode before running.

    The ternary operator itself isn’t implemented in terms of and (and or) but it could be.



  • Ah. The usually implicit topical “this” didn’t even occur to me because I thought, er, this, was about objects. $_ isn’t used for those in Perl.

    I suppose there might be some parallels with the implicit nature of $_ in non-OO contexts in Perl versus this in OO contexts in Javascript, but, at least to me, that feels pretty tenuous.



  • At the time JS was created, Perl didn’t have a this. A lot of the docs and books suggested using $self but a reference to the object would be passed as the first parameter to all class methods and you assign that to any name you wanted.

    It’s only very recently (as in the last year or so) with a new class system that Perl has hard-coded $self for that purpose.


  • Not strictly true.

    Perl’s default bitwise operators do differentiate between numbers and strings that look like numbers in a way that addition doesn’t*, and the readline/glob operator <> does different things depending on what (if anything) is between the signs.

    There’s also the whole overload pragma for objects, which doesn’t affect default data types, but if you’re sufficiently perverse, you can define a String class that uses ‘+’ like JavaScript.

    * in 2015, they added new operators so that those and the original operators don’t overload and have only one specific purpose if the bitwise pragma Edit: feature is turned on. You might know all this already though.


  • You’re right. I’ve got too much Perl on the brain and forgot my roots. There is a language that does what you’re talking about with the ‘+’ operator: BASIC

    Good luck getting the same thing retrofitted into JavaScript though. I can imagine a large number of websites would break or develop mysterious problems if this (mis)behaviour was fixed.