On Tuesday, 18 July 2017 at 19:22:38 UTC, Jean-Louis Leroy wrote:

Look at https://github.com/jll63/methods.d/blob/master/examples/matrix/source/matrix.d and https://github.com/jll63/methods.d/blob/master/examples/matrix/source/densematrix.d They know nothing about printing. They don't want to. The matrix modules do math, the app does printing.

J-L

I may not have been clear enough. My ideal solution wouldn't make any changes to that densematrix.d file, just the interface. So I don't have any issue with the matrix modules doing the math and the app doing the printing.

For instance, consider the traits in Rust
https://doc.rust-lang.org/book/first-edition/traits.html
My idea is like making the interfaces in D similar to the traits in Rust (or at least having the option to do something similar with them). Your @method void _print(Matrix m) would be similar to impl print for Matrix in Rust.

Nevertheless, I get that it may be a difficult thing to implement.

Reply via email to