Static type casting instead of dynamic for code quality/readability/production

hello,
I’m used to code strongly typed OOP compilers, for code quality.

Now,

  1. how to turn Elixir with type variable casting static/mandatory?
  2. what are the best ways to obtain high quality QA proven source code / compiled code? Patterns?
  3. does exists profiling tools as Android Studio or TotalQA to profile used/useless vars, records, classes (struct under Elixir?), memory, api/VM calls failure? I know ErlangVM has GC, anyway quality tools exists?
  4. best behaviors for quality code?

Thank you

1 Like

Elixir is dynamically strongly typed. If you’re looking for strong static types you can try out Gleam. There’s also dialyzer in erlang, but if you come from a statically typed environment I doubt it’ll fulfill your desires.
For profiling we have mix profile.(f|c|e)prof, unused variable detection is part of the elixir compiler and you’ll get warnings. There are also third party tools like credo/boundary, which detect further problems. For inspection of the VM at runtime there’s e.g. :observer and other tools. But non of those tools won’t help you proving correctness in your elixir code. Like in other dynamic languages you’d need to run tests to do so.

2 Likes

I think this can fall under #2 and #4 of your question, but apologies if you don’t want to hear about anything outside of compilation.

I have been pleased with usage of norm for specifying data contracts. Specifically, I use the @contract functionality in place of @spec. This allows for any sort of specifications you need rather than the more general types of @spec. Very helpful for me in dev and testing, but obviously a different beast than compile time solutions.