Advanced

A dry run as the same code with a different write

A preview that is written separately is a preview that lies. The dry run is the same walk with the write turned off, and one walk is why the preview is the truth.

What you will see

One line. One place is what makes the rest unable to differ.

About 1 min of reading

Try It

Prove one walk

1

Collect the names

printf 'a\nb\nc\n' | wc -l

Before you run it, say out loud what it will print. Then open the answer.

What it prints
3. Three names collected is the walk.
2

Turn the switch off

printf 'a\nb\nc\n' | awk '{print "would write", $1}' | wc -l

Before you run it, say out loud what it will print. Then open the answer.

What it prints
3. The dry run prints the same three, which is one walk.
3

Name the switch place

printf 'switch at write\n' > /tmp/s.txt; cat /tmp/s.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One line. One place is what makes the rest unable to differ.

Data Flow

A walk to a write or a print
1 The walk is decided once
↓
2 The names are collected in the walk
↓
3 The switch decides write or print
↓
4 The dry run prints the names it would write
Why this works
Why the switch is not a second tool

A second tool is a second answer. A second answer is a preview that lies, and lying is the whole bug.

The failure at this step

A dry run that says one name and a run that changes two. The walk is the answer, and the walk is one.

Examples

The walk is one

One walk answers both. One walk is what makes a dry run and a run the same length.

The write is the switch

The switch is at the write and nowhere else. One place is what makes the rest of the code unable to differ.

The dry run prints what it would write

Prints the names. Names printed is what a person checks before the run that changes.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← A config file as a layer under the words
Previous Lesson
A config file as a layer under the words
Next Lesson
Quiet and loud as one dial with a default
Quiet and loud as one dial with a default →