Phantom Read Rights in Kotlin

  • Stage 1, Shape Detection: Detect low level features like shapes. Circles, Polygons, etc
  • Stage 2, Feature Detection: Detect higher level features like: Faces, Arms, Shoes, etc based on previously found shapes
  • Stage 3, Person Detection: Detect individual persons in the image based on previously found features
  • Stage 4, Measure: Use some fancy AI algorithm to calculate how drunk each person is and estimate the amount of beer necessary for the whole crowd

What about: Creating a Request and inherit from it?

Let’s jump right in. Here is the code:

Inherit from a base Request

What about: Phantom Types

At this moment you start thinking about a more unconventional way of handling read rights of your request object. You wonder:

Phantom Read Rights in Action
  • Step 1: Implement the Request Class.
  • Step 2: Implement ‘Read-Right-Interfaces’
  • Step 3: Implement companion access for your values.
  • Step 4: Create convenience extensions
  • Step 5: Define your stages


The ‘Phantom Read Rights’ technique is not suitable for a broad set of problems, but it can be extremely useful for certain problems. This technique is used by QuickBird Studios for a very special customer in a very special project and has been proven very useful when modelling a pipeline.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store