4 ms·
> The Killer Feature: |> with Auto-Tracing. No other language has this combination Of the languages listed, Elixir, Python and Rust can all achieve this combin
by wavemode 8mo ago
> The Killer Feature: |> with Auto-Tracing. No other language has this combination
Of the languages listed, Elixir, Python and Rust can all achieve this combination. Elixir has a pipe operator built-in, and Python and Rust have operator overloading, so you could overload the bitwise | operator (or any other operator you want) to act as a pipeline operator. And Rust and Elixir have macros, and Python has decorators, which can be used to automatically add logging/tracing to functions.
It's not automatic for all functions, though having to be explicit/selective about what is logged/traced is generally considered a good thing. It's rare that real-world software wants to log/trace literally everything, since it's not only costly (and slow) but also a PII risk.
- tyushk 8mo agoIn Rust, wouldn't implementing BitOr for Fn/FnOnce/FnMut violate the orphan rule?
- wavemode 8mo agoI'm envisioning that in Rust (and Python), the operator overload would be on a class/struct. It would be the macro/decorator (the same one that adds logging) which would turn the function definition into an object that implements Fn.
- carterschonwald 8mo agosomehow this counts like model cot.
- graemep 8mo agoI have done exactly that as an exercise in what you can do with Python: overload |, and a decorator that you can use to on any function to return an instance of a callable class that calls that function and overloads |. Whether it is a good idea to use it is another matter (it does not feel Pythonic), but it is easy to implement.
- bmitc 8mo agoRust is really not built for pipelining. It is extremely cumbersome to do even moderately sized chains of maps, filters, etc. Python's scoping and mutability make it an extremely poor language for pipelining.