Show newer

if you’ve been following me for a while you know what to fill in here

Show thread

like i think they just cut library science from elementary education instead of modernizing it

FEEL FREE TO CORRECT ME IF I’M WRONG

Show thread

the contemporary equivalent is the URL but something tells me they don’t have classes on those to the same extent

Show thread

in elementary school when i was growing up we all had to learn about the Dewey Decimal System, which is terrible but at least it got me thinking from a very early age about tree-based hierarchical classification systems

if you are up on Web Standards then you probably know that DOM4, the W3C specification, no longer exists and has been replaced with the DOM Living Standard, developed by WHATWG, which makes this sort of specificity about a thousand times harder

Show thread

if you have interacted with RDF before, you may know about something called rdf:XMLLiteral, which is a very useful and important datatype for encoding XML data directly in RDF datasets

if you have read the actual RDF 1.1 specifications, you may be surprised to learn that rdf:XMLLiteral is non‐normative, because it depends on DOM4, which is a specification which had not yet reached Recommendation status at the time of publication

can you imagine if actual programmers working on APIs flagged the parts of their programs with non‐stable dependencies the way that W3C does

what bothers me the zeroth most about leftpad is that the criticisms of this thread are not in any way specific to leftpad

and what actually got me thinking about this was the YAML processor which ships by default in Ruby and is used in virtually every Rails application

Show thread

the number of times when i have written

const hex = codepoint.toString(16);
return `U+${hex.length >= 4 ? "" : Array(4 - hex.length).fill(0).join("")}${hex.toUpperCase()}`;

it’s not that hard

Show thread

what bothers me third most about leftpad is that this is not a situation where DRY is applicable; it is clearer and less ambiguous to just write this as a one‐to‐three‐liner directly in your code

Show thread

and these are the same people who argue semantic versioning is “important” and “meaningful”

Show thread

what bothers me the second most about leftpad is that packages released “stable” versions while having a dependency on something versioned 0.0.3

Show thread

here is how i would write that 

function leftpad (str, len, ch) {
if ( str.length < len ) {
var fillChar = !ch ? " " : String(ch)[0];
return Array(len - str.length).fill(fillChar).join("") + str;
} else {
return str;
}
}

Show thread

this is the code for leftpad 

function leftpad (str, len, ch) {
str = String(str);

var i = -1;

if (!ch && ch !== 0) ch = ' ';

len = len - str.length;

while (++i < len) {
str = ch + str;
}

return str;
}

Show thread

what bothers me the most about leftpad is that it isn’t even good

i’m at the point where i’m wondering whether i don’t want to just make a hard dependency on xmldom instead of relying on browsers’ DOM capabilities

Show older
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.