DEV Community

Discussion on: Explain "Memory Safe Programming Languages" Like I'm Five Please

Collapse
 
shripathikamath profile image
Shripathi Kamath

Imagine kids coloring a pentagonal star on drawing paper. Suppose that you have to color each triangular portion, but not the center.

If you're not a smart, experienced kid, you will color outside the lines. Sometimes by accident, sometimes because you're not experienced enough.

Languages that are not memory-safe are like that. Error prone, but fine for experienced kids.

Contrast that with having a stencil, maybe of triangular shapes. You will be far more tidy in your goal. The stencil is tool the likes of which are built into memory safe languages. Constrain your reach. Go wild with the coloring, but the paper only receives it in the necessary spots.

All analogies break down when you then say "There is no garbage collector in a stencil"

Collapse
 
rdrpenguin04 profile image
Ray Redondo

There is a garbage collector: it's called white-out.