Algebraic effects and handlers, dynamic effects What exactly are dynamic effects? What does it mean to dynamically create an effect?

In a language with algebraic effects and handlers (such as Eff or Koka) one could already do different operations based on runtime information, for example:

if x &gt; 10 then
  get ()
else
  put 10

In this case the actual operation done will only be known at runtime. But in the Frank paper ("Do be do be do") they talk about dynamic effects in the sense of ML-style references. In what sense are references a dynamic effect that cannot be done in Eff (without resources) or Koka? Also why were resources removed again from Eff?
Let us take the example, the input/output effect. Ordinarily, one presents this with two algebraic operations print and read. We can then imagine that things get "printed out" and "read in" from some sort of a communication channel. In fact, that's how I/O works in a typical operating system.

Except that in a typical operating system one can open lots of communication channels: open files, bind to internet sockets, etc. Whenever a new channel opens, something new gets created dynamically (i.e., while the program is running). An operating system typically just creates a new integer, the "file handle", but that's just a cheap version of what we really want: an identifier that is guaranteed to be unique and that cannot be guessed by any part of the program, unless it was already given to it. (Integers can be guessed.) Let us call such a thing an instance. (In cryptography it is often called a nonce, but they cheat and think of it as an "unguessable integer". In programming languages we can make sure that instances are abstract tokens that really are unguessable.)

There are other examples where we need to create new instances. One is state, i.e., a memory location with operations update and lookup. Typical programs want to allocate any amount of memory locations, each of which is then an instance of the state effect. In general, instances allow us to create local effects, such as local exceptions and local references. In many applications it is essential to have such effects, for instance so that we can guarantee that only a certain part of the program is allowed to use a certain effect.

There is a tendency among the theoreticians to ignore effect instances because they complicate the theory. I feel that they should not be ignored because a programming language without dynamic creation of effects is next to useless. Who wants to write programs in which all memory allocations, files, and sockets, have to be specified ahead of time?