Block versus function

I recommend that you forget about “blocks”, and instead only think in terms of “cells” and “cell values”. What value you assign to a cell (i.e. return in it) is completely up to you.

If you want to create a reusable API and/or abstractions, then yes, functions are the way to go.

However, for quick explorations it is often enough to process a cell’s input values “on the fly” without going the extra step of defining a function in another cell first.

Note that authors can still import your notebook’s cells and override some of them with their own implementations. E.g., given a notebook “@johndoe/my-chart” with two cells “chart” and “data”, an author can provide their own data by importing like this:

import {chart} with {myData as data} from '@johndoe/my-chart'

where “myData” is a cell that is defined in the importing notebook.

You might also be interested in this discussion of various strategies for reusability: