Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But elixir doesn't have types.


It does. Always has.

It just doesn’t have static types, it has strong types.

That difference gives you the flexibility to avoid circumstances where static typing can be a hindrance.


Is it really strong typing if you can't type functions parameters and returns?


"Strong typing" most of the time means "no implicit type conversion" like e.g. C or Javascript do. That is indepentend of having statíc or dynamic typing (and anything between).


The thing is, low level types can already be inferred by the operators anyway. That’s what dialyzer does and it catches most things.

For the rest of it, you have a conversation where the benefits of full static typing don’t exist in a distributed environment. Example, you’re making function calls to other nodes in the cluster and the node is updated while your code is running potentially changing the function call. You won’t get the chance to do a contract exchange live with other nodes, recompile and examine results.

Instead, you have to pattern match on the parts you care about just like with an API call to a server you don’t control.

Even with Gleam, static typing only protects your node. In a distributed environment you can’t validate everything and on the BEAM everything is a distributed environment.

Once you accept this, you realize that the benefit of static typing simply doesn’t exist here.


... and misses all the occasions where static typing can be a benefit.



Sure it does. How could it be dynamically typed if it didn't have types? How would you even program in a language that doesn't have any types?


Like in assembler. Or, if you prefer that, in untyped lambda calculus.


Now this is outside my comfort zone but I'd expect that to include integers.


Forth as well


assembler has tons of types. Bits, bytes, registers.


First release of Elixir with gradual typing announced today. It's not complete but the work is underway.

https://elixir-lang.org/blog/2024/06/12/elixir-v1-17-0-relea...


Everyone knows very well the parent comment means "static types", come' on.


No we don't. Many people are super confused about this.


No we're not (yes, it's a bad answer, but that's what you've just done).


Hello Many People. I am boxed.


Many argue that static types and Beam style of deployments are actually a bad fit. Static types assume atomic deployment of a statically checked codebase for their guarantees.


It doesn’t right now, but it will. Jose and company have been working on a gradual type system. Elixir 1.17 recently released the first typing features.


You seriously think the language doesn't differentiate between strings and integers let alone all the other types of values in elixir?


So you're saying it's even better?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: