Almost every runtime has a main thread. Whatever code you write, it’s executed by that thread unless specified otherwise.

In metz, that’s not the case. If you want something executed, you need to create a “thread”. If you don’t, things simply don’t run.

In metz, a flow captures the idea of a thread. It’s not exactly that, but there’s good overlap.

For example, here are two story scripts. One does nothing, and the other works:


Unlike threads, flows have an identity that you provide. It’s not a nameless, behind the scene thing executing your code. Flows are front and center.

Business and Logical Flows

In PRDs, or even Design Documents you might have come across the term ‘Flow’. Something like ‘User login’ flow or ‘Use Cache’ flow.

In those documents, a flow represents a sequence of events that occur under that context. Mind you, the flow is a small part of a larger picture, it doesn’t tell the full story. We could be talking about a PRD to launch referrals or a Design Document about data pipelines.

We choosing the same terminology in metz is not serendipitous. It’s called a flow in metz to capture this exact meaning.

A business or logical flow, and a metz flow are meant to be exactly the same.

You can see how flows interact with each other and the system:

How to use flows?

You can create a flow through the following syntax:

std.flow(
	"<name of the flow>",
	main, // An instance of a class.
)
.hello() // Simply call the method you want to run.
.run(); // Normal flows are not eagerly executed, call 'run' when you want.

There’s so much more to flows but we will stop here for now and dig deeper in Flows-102 later.


And with that, we have learnt the basic building blocks of metz. Go to the playground to try those things, but come back soon!

In the next section we will cover how to go beyond just one class and file.