Skip to content

Routing: Factories for extendible transformers, mappings, smart defaults etc. #40

@thorwhalen

Description

@thorwhalen

The idea (or solution to a common "problem pattern") of parametrized transformers comes back a lot.

I've denoted the idea by many names such as:

  • routing
  • parametrized transformers
  • declarative transformer
  • casting function factories
  • wrapping rules
  • declarative wrapping
  • declarative interpreters

Highlighted here is one of the cornerstone problems. There are many names to this because there's many angles we can approach the problem under. Different contexts bring about different "natural" interfaces to a same underlying problem.

It definitely would be useful to gain a bit more clarity on the underlying ontology so a useful taxonomy can be developed and used to better design reusable tools around this problem. In theory, it's the same underlying idea at the base of "dispatchers" such as py2http and front, and is quite present in other "i2i" tools such as dol.

Below are a few examples of where we actually implemented a tool for some sub-class of the declarative wrapping/transformer solution.

Examples

You get things like the extremely useful (though badly designed, since carries ancient legacies)
StrTupleDict
that is useful to express multi directional transformers from strings, tuples and dictionaries: Used a lot in the context of key transformation when using dol.

The main entropy-reducing part of py2api was it's transformation mini-languages expressed in near-json objects that were then interpreted by interpreters such as InputTrans

The "Input/Output Trans the i2.wrapper way" mentions that these could probably be boiled down to use i2.wrapper as their backend.

Indeed, i2.wrapper is a pretty solid and general base for such matters, though (1) I wonder if it's a complexity overkill versus having a few specific tools written without so many abstract layers, and (2) I still wonder if we should switch to using wrapt as our base, since it was written by someone who understands the annoying wrap-unfriendly traps deep end python laid out for us all!

Some more mentionables:

References

Quick search links

The links below will take you directly to the github advanced search with a few key terms where you might find more information. These are useful because it will give you a more "current" view of the landscape.

┆Issue is synchronized with this Asana task by Unito

Metadata

Metadata

Labels

design discussionTo discuss design options, pros and cons, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions