• 60 Posts
  • 522 Comments
Joined 4 years ago
cake
Cake day: February 24th, 2021

help-circle













  • A whole lot of misdesigns are only a “small amount of brain power” to use. As your language accumulates these, however, the load builds up.

    This also has the extra problem that overloading in general brings with it. What is the result of 3 + "string"? What is the result of "string" + 3? You have to have rules for this. These rules have to be learned. They have to be kept in mind. There is room for error. And of course the way different languages react to them will vary strongly.

    For example in Rexx, Python, and Ruby these are errors (and with the latter two the error changes depending on which order). In Awk and Perl the result is 3 in both cases.

    Format strings are better than + as concatenation, to be fair, but are still not very good compared to separate concatenation operators. It’s hard to make them type-safe. They separate the value from its location in the string.

    Using actual concatenation operators has the advantage of format strings, but add the possibility for type safety. For example in Ada:

    ...
        Put_Line("Distance: " & Distance_Value'Image & "km");
    ...
    

    See here, & will only concatenate string types. If you want to print something that’s not a string, you have to convert it to a string. This means you can’t accidentally mix types. Further, it’s immediately obvious where a given value will show up in the output. Compare and contrast with the C equivalent:

    ...
        printf("Distance: %skm\n", distance_value);
    ...
    

    Not only is location of the value obfuscated—trivial to spot here, but in a complicated string it’s very difficult to spot at times. And it’s easy, too, to have the format code not match the value. As this example illustrates. Again, easy to spot in trivial code like this, but horrifically hard in real-world code, especially if the variable type changes.


  • String concatenation with + is evil. Well-designed languages (Lua, for example, among many others—I’m not calling PHP well-designed!) doesn’t do this.

    Why?

    Because +, in every other context is commutative, but suddenly, in the case of concatenation, it is not. This is an unnecessary cognitive burden for no material gain.

    Concatenation can be accomplished by juxtaposition (e.g. SNOBOL4, Rexx, much of the C family tree), by .. (Lua), by . (Perl, PHP), by || (PL/I, Rexx again), by & (Ada, some BASIC dialects), etc. without this added cognitive burden of overloading + for no good reason.




  • Because it’s sometimes a ludicrous demand?

    Common pattern I see in Mastodon’s … more strident, shall we call them? … advocates:

    Poster: I just took a picture of a <insert bird>. Note the red and yellow flash of plumage, in contrast to the more usual green and red. I caught this little darling hopping along the charcoal grey slate walkway I’ve got running through my garden, right next to the <insert flower> you can see at the right side of the frame.

    <put picture here>

    Strident Twit: WHY YOU NO PUT ALT TEXT!?

    Or, worse:

    Strident Twit Bot: WHY YOU NO PUT ALT TEXT FOR OUR BLIND USERS!?


    So what, precisely (providing details), would you put into alt text that’s not already in the post? Would you just copy and paste the alt text? When I ask the strident twits this, I generally get vague homilies and blocks.


  • Best for what purpose?

    There’s no universal “best” because different people want different things from their spaceship combat games. Myself I like quick resolution and simple record-keeping so I always kit-bashed something with the old Starfire wargame to warp it to the RPG setting. If you’re not into kit-bashing, though, that’s not going to be “best” for you.

    For spaceship combat that was tense as a suspension bridge truss, the one that was made for Traveller:2300/2300AD was really, really good, but it was very much glued with cyanoacrylate to the setting.

    The original Book 5 for Traveller had a ship combat system that was very much about capital ship combat in large fleets (and could barely scale down to smaller conflicts like individual ships). It was “perfect” for that kind of thing, but again was glued to the setting (albeit more with some contact cement rather than superglue).

    The Jovian Chronicles (game, not Mekton Zeta supplement) space combat system was rather nifty and came with a nifty spaceship design system (albeit one that had a “dreaded” cube root in the construction rules that made people panic). And while it was made for a setting, it was much easier to kit-bash for other settings.

    For more generic games, if you want the scope and glory of space opera, the game, well, Space Opera is hard to beat. It’s an old design, so filled to the brim with odd, crunchy, ornate bits, but it was a whole lot of fun when I played it. Just … be ready to fill out a lot of papers and roll a lot of dice many, many times.