1.5 USD = 1.5 * USD
65 mph = 65 * mile / hour
you can then use simple algebra to solve unit conversion and many other common deductive reasoning questions ("how many miles per gallon...?"), relying on the units to guide you to the solution.
There's probably a name for this, and it is indeed built into the SI notation (km/h vs mph).
Force f = 5 kg * 9.807 m/s/s; // result: 49.035 Newtons
Area space = (20ft + 2in) * (37ft + 7.5in); // result: 758 37/48 ft²
All unit expressions internally store amounts as SI units, which enables interunit expressions.
Length height = 6 ft + 4 cm; // mix SI and US units
out.println(height.to(ft)); // display any unit
You aren't limited to units. Generally, any concatenative sequence can be implemented. Like ranges:
IntegerRange range = 1 to 5;
Here the `to` identifier's type implements reactions to Number types to produce range types, which enables:
for (int i: 1 to 5) { out.println(i); }
See the manifold project's Unit and Science modules:
Units: https://github.com/manifold-systems/manifold/tree/master/man...
Science: https://github.com/manifold-systems/manifold/tree/master/man...
The idea with binding expressions is the type of expression A and the type of expression B implement "reactions" with one another in order to form a binding expression when they are lexically adjacent.
65 mph
The type of `mph` defines a post reaction method with the type of `65` as an argument that results in type Rate. As I understand it this is concatenative, right?
Another example:
Money payment = 1.5M USD;
There are tons of these.
Concatenative programming in general feels like it should have a more prominent place in mainstream languages. Just my take.
[1] https://github.com/manifold-systems/manifold/tree/master/man...