[HN Gopher] Gleam 0.14 - type-safe language for the Erlang VM
___________________________________________________________________
Gleam 0.14 - type-safe language for the Erlang VM
Author : lpil
Score : 121 points
Date : 2021-02-18 21:16 UTC (1 hours ago)
(HTM) web link (gleam.run)
(TXT) w3m dump (gleam.run)
| macintux wrote:
| My list of alternative languages for the Erlang VM:
|
| https://gist.github.com/macintux/6349828#alternative-languag...
| dnautics wrote:
| it's cool that gleam emits typespecs. After tooling around
| implementing type analysis in Elixir, I do have a personal take
| that dialyzer typespecs are broken, maybe we should convene a
| group in the erlef to coordinate towards improving the
| typesystem.
| lpil wrote:
| The limitations of Dialyzer and typespecs were a big motivator
| for creating Gleam. They were not reliable or fast enough for
| my taste.
|
| There is some work being done towards better types for Erlang,
| as well as sharing types between languages on the BEAM. I'm
| excited to see what comes in future.
| rubyn00bie wrote:
| Do you have any links where I could read up on the work being
| done for type sharing? Sounds awesome to me.
| dnautics wrote:
| I don't know if this counts as "publishing" but I've made
| several videos on my personal gripes (warning, super wonky,
| super BEAM-specific), with accompanying code for a type
| system that 'fixes' the problems.
|
| https://www.youtube.com/watch?v=_XSRsYSwNpQ
|
| https://youtu.be/VynXxiXPmG8
|
| https://youtu.be/2ooSWOCBTPQ
|
| https://youtu.be/qv-GR4sEsd4
| lpil wrote:
| This is the first time I've come across your work! Very
| cool stuff.
| dnautics wrote:
| thanks! work on my typechecker has slowed recently due to
| excitement with nerves + zig, and then nx + zig, so my
| plan is to do a bit more work with the typesystem
| starting next week.
| lpil wrote:
| I don't think anything has been published yet. It's very
| much in the early ideas stage, but there's a couple private
| mailing lists with some discussion going on.
| jaegerpicker wrote:
| Agreed, I loved working in Elixir but hated the typespecs. Felt
| like it was a lot of work for only a little benefit. It's not
| typing that I don't like but the way it's implemented in Elixir
| felt like it was very hard to get correct quickly. Very fiddly
| and time consuming. About the 10th time Dialyzer broke the
| build for no easily discernible reason, I wanted to scrap it.
| dnautics wrote:
| I wouldn't go so far as to say they aren't useful. I find
| dialyzer is not awful at finding mistakes that I make.
|
| I have thought about this a _lot_ (I 'm writing a static
| typechecking library for Elixir) and really the problem is
| the dialyzer typesystem. Almost all of the problems stem from
| the root fact that there isn't a granular concept of how to
| treat functions in the type system. What does `(int, int) ->
| int` mean? Dialyzer does not have a good answer for that
| question.
|
| Mind you I am not a "PL theory" type of guy, I do have a math
| degree, but my PhD is in the sciences, so I am more
| approaching this issue from a "discovering what would be
| truly useful" perspective more than "applying an existing
| typesystem to the BEAM", which is I think in line with the
| traditional pragmatism of the BEAM ecosystem.
| lpil wrote:
| > What does `(int, int) -> int` mean?
|
| This is an interesting question. Do you have any thoughts
| on what a better answer to that question might mean? Or
| languages you think do better here? Thank you
| dnautics wrote:
| Here's my thought:
|
| let's go with a simpler one: int -> int
|
| "I guarantee that if you send me an int then i will
| return you an int without crashing"
|
| In elixirland: `IO.inspect/1` would satisfy this, as
| would `Kernel.-/1`. The interesting thing is that `any ->
| int` is then a _subtype_ of `int - > int` and we need a
| new type `_ -> int` which is "any one-arity function that
| emits int".
|
| Then types become a statement of "resistance to crashing"
| in the BEAM vm, which I think is the useful thing that
| people are looking for.
|
| I don't have answers to everything; I don't know how to
| deal with a function that generates random numbers from 1
| to 20 and crashes on 13, for example.
|
| We should have a discussion about this! I'll reach out on
| another channel.
| dang wrote:
| If curious see also
|
| _Gleam: A statically typed language for the Erlang VM_ -
| https://news.ycombinator.com/item?id=22902462 - April 2020 (109
| comments)
|
| _An interview with the creator of Gleam: an ML like language for
| the Erlang VM_ - https://news.ycombinator.com/item?id=19547418 -
| April 2019 (0 comments)
___________________________________________________________________
(page generated 2021-02-18 23:00 UTC)