• barsoap@lemm.ee
    link
    fedilink
    English
    arrow-up
    2
    ·
    7 个月前

    It could only fit 10 messages before it’d run out of space, and once full no messages would be received at all.

    You often hear programmers cite zero, one, infinity but fact of the matter is… while most if not all of your code should be capable of that, be blissfully ignorant about any imposed limit because it’s going to work whatever you set it to, the application often still should have a limit:

    Even if you’re not as ludicrously storage-constrained as those old Nokia bricks the data structure you’re storing it in is going to have some kind of assumptions about up to what number of elements it’s going to be efficient, so in e.g. game programming you write your code, document your assumption in the form of an error or warning thrown if that limit is exceeded, and when the level designers break it you have a look together at the thing and decide whether the limit needs increasing, or the level designers should reign in their use of whatever thingummy is breaking the limit.

    Not to mention that just storing an index for an arbitrarily large data structure can take up arbitrary amounts of RAM. Do you really expect me to use variable-sized numbers just so that you can have more than 264 (~1.84×1019) messages. Or columns in your spreadsheet, or whatnot.