Remix.run Logo
jmull 5 days ago

> minefield

Cookies are a bit of a mess, but if you're going to use them, you can follow the standard and all will be well. Not so much a minefield, but a hammer; you just need to take some care not to hit yourself on the thumb.

I guess the confusion here is that the browser is taking on the role of the server in setting the cookie value. In doing so it should follow the same rules any server should in setting a cookie value, which don't generally allow for raw JSON (no double-quote! no comma!).

Either use a decent higher-level API for something like this (which will take care of any necessary encoding/escaping), or learn exactly what low-level encoding/escaping is needed. Pretty much the same thing you face in nearly anything to do with information communication.

klysm 5 days ago | parent | next [-]

I don’t understand how that’s not a minefield, it’s easy to go astray?

jmull 5 days ago | parent | next [-]

Well, we’re getting into how to choose metaphors here. Not being literal, there’s always room to stretch. Still, you try to choose a metaphor with characteristics congruent with the topic.

With a minefield, you can be doing something perfectly reasonable, with eyes open and even paying attention yet nevertheless it can blow up on you.

Here, though, there’s no special peril. If you just follow the standard everything will be fine.

If this is a minefield, then practically everything in software development is equally a minefield and the metaphor loses its power.

(Later in the article they touch on something that is a minefield — updating dependencies. There’s probably a good article about that to be written.)

johnisgood 5 days ago | parent | prev [-]

Probably just semantics.

5 days ago | parent | prev [-]
[deleted]