Once this has been proved useful, and although I do not see how this
could be not happening, I would like to encourage you to go one step
further in this direction by opening a PR to the compiler itself to
basically get rid of its typiing/ subdirectory, which will, by your
magic, contain only dead code.
Very nice! I often use the ocaml REPL as a calculator.
It’s totally improductive because of the number of type errors I make but remains faster than using a calculator app with hidden state or another language that is not as hardwired in my brain as OCaml is.
So I actually contemplated more than once adding a Down.calculator () mode that would do exactly that:
Redefine integer operators to work on floats (easy)
Transforms integer literals into floating point ones (unclear).
Just never got the time to get to it yet. No joke. (PR’s welcome as they say)
It is funny… Ada is even more picky about types (we do have many Integer types and need explicit conversion when doing something with 2 different types). It is seen as a feature, not a flaw.
But sure REPL inputs and code saved in a file have different constraints.
Being to extreme with implicit type conversion make “11”+1 = “111” and “11”-1 = 10 in JavaScript. We just need to get the good compromise.
Conclusion: After using OCaml without type system for the whole of April 1st, facing multiple runtime bugs, I realized that the type system is actually helpful! I’ll train my skills playing roguetype instead of writing not-serious PPXes…
@SebHash thanks for the support! I may open a PR for that at the anniversary of the ppx_untype release, be prepared to merge it before anyone realize!
As a technical note, this PPX bypass the type system by wrapping every expression in a call to Obj.magic. So please, do not use this joke in production