Layered problem language


Imagine we could define behaviour or code about an attribute of a large system in isolation from other concerns and have them tied together automatically into a whole.


Starting from a blank slate is easier than modifying existing code sometimes.

I propose all behaviour is split into snippets that the computer arranges into a whole.

You should never have difficulty finding where to insert code to add or modify behaviour in a system.

You can specify before/after behaviour between a problem and another problem.

Each snippet is an invariant that the system should hold.

The snippet has an optional condition when it applies, a bit like an intelligent if statement that is essentially ran after every statement in the system.

Problems are matched by types of the Inputs and outputs.

There is not necessarily an explicit method call.

It looks like this

Problem "form data is sanitised before usage"

Input form FormData # whenever FormData is in scope, this code runs


for key, value in form: form[key] = sanitise(value)

I want to be able to do a search for matching code on a path such as whenever the database is updated, or sanitisation happens.

If I was writing code for a btree I would have problems for portions of insert and search logic. I could extend the behaviour by adding a problem and solution code.

The system would layer the code accordingly automatically. I can also refer to problems from code to create hook points.

Problem "insert into btree"


find insert location in tree

leaf, last_child, parents = self.find(key)

    leaf = last_child

    # print("Trying to insert {} at Found insertion leaf {}".format(key, leaf))

    if len(leaf.children) less than leaf.max_size:

        Problem Insert non-full

        Problem Insert full

This way I dont have to pollute the reference implementation of a btree and can handle locking, security, logging, tracing as separate snippets. Not a mess of everything combined together.

The computer can do the matching up of control flow.


(別通知) (可選) 請,登錄