Optic [0] caught my eye. They seem to have made possible a new kind of abstraction in code. Something that's different from both functions and macros. It's a kind of abstraction that can be arbitrarily customized at each call site, yet retain its identity across all of them.
Example:
foo = do_a()
bar = do_b(foo)
Example 2:
foo = do_a()
bar = do_z(foo)
baz = do_b(bar)
Example 3:
foo = do_a()
bar = foo + 10
baz = do_b(bar)
The three examples have strong similarity in their first and last statements. There is a pattern there, but that pattern cannot be abstracted into a single macro or a function. So this pattern does exist, and is recognizable to the human eye, but the language does not allow one to express it.
What Optic seems to do is to recognize the pattern, create a single model out of it, and allow you to re-use that pattern elsewhere, or even transform it into new ones and re-use those new patterns elsewhere.
Again, this would be a new kind of abstraction. One whose leaks are easier to fix. You can have your cake and eat it too!
[0] https://useoptic.com
Example:
Example 2: Example 3: The three examples have strong similarity in their first and last statements. There is a pattern there, but that pattern cannot be abstracted into a single macro or a function. So this pattern does exist, and is recognizable to the human eye, but the language does not allow one to express it.What Optic seems to do is to recognize the pattern, create a single model out of it, and allow you to re-use that pattern elsewhere, or even transform it into new ones and re-use those new patterns elsewhere.
Again, this would be a new kind of abstraction. One whose leaks are easier to fix. You can have your cake and eat it too!
[0] https://useoptic.com