gleam-lang / suggestions

📙 A place for ideas and feedback
26 stars 2 forks source link

Super cool #19

Closed madasebrof closed 5 years ago

madasebrof commented 5 years ago

Like the concept! Woo-hoo!

Some thoughts:

  1. Make syntax like Python/F#/Elm (e.g. indents, not {})?
  2. Compile to Elixir, not Erlang (if possible)? (Mainly because I've never met an Erlang programmer and think it would be much harder to hire vs. and Elixir programmer)
  3. Look at F# for how they handle Union Types. I think Elm is similar. In general, I think F# is a pretty nice model to follow in term of syntax for an ML language. Elm is nice, too.
  4. Think about integrating with ExDoc? Or an equivalent substitute? (Erlang docs tend to be terrible...)
  5. Ecto integration/replacement?
  6. GenServer?

F# https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/discriminated-unions

Elm https://guide.elm-lang.org/types/custom_types.html

We use Elixir on the backend and Elm on the front end. Both are great, but the main thing I miss on the backend are proper Union types (and strong typing).

Rock on!

lpil commented 5 years ago

Hello! Thanks for the suggestions.

  1. Syntax has largely stabilised now, there will be no major changes.
  2. Compiling to Elixir would mean that Gleam requires the Elixir compiler as well as the Erlang compiler (as Elixir compiles to Erlang), so I don't see the advantage. Erlang and Elixir are very similar languages, I would suggest that most Elixir programmers are capable of writing Erlang (if not as well). You could write an Elixir backend for the Gleam compiler if that interested you, though it would be quite a lot of work to build and maintain.
  3. Gleam has this already, here's some docs https://gleam.run/tour/enum.html
  4. We don't have module documentation generation yet but it is a priority (see https://github.com/lpil/gleam/issues/153). We may use ExDoc in future but right now it doesn't support languages other than Elixir.
  5. Ecto makes heavy uses of Elixir's macro system and thus isn't usable from other languages. Likely someone will build a database query builder library in Gleam in future. Perhaps you might want to do this :)
  6. gen_server can be used today through Erlang FFI. Some official bindings may come later
madasebrof commented 5 years ago

Cool. Just to clarify, my suggestions are from the perspective of ways to increase adoption.

Syntax can be a big deal, see rising Python vs. declining Perl popularity over the years.

Re Elixir vs Erlang, LOL. The reason Elixir was invented was that Erlang is a nightmare syntactically! I think the idea that Elixir programmers have any interest in Erlang is really not the case. I think most Elixir programmers came from the JS/Node world, or Ruby on Rails, not Erlang. (I just don't think many folks are using Erlang for new projects these days, but maybe I'm crazy.)

From the stack overflow 2019 survey:

https://insights.stackoverflow.com/survey/2019#most-loved-dreaded-and-wanted

Again, it's your codebase, I'm just saying. Also, Elixir is very well supported and super easy to install, so I don't think that's a big deal, but I get having fewer dependencies in better.

I guess more my point is that I'd imagine the folks who are most likely to be interested in Gleam are folks who use Elixir/Elm. Or maybe people who like Haskell, but want a more robust infrastructure?

Re: database adapter! Man, that's a huge project! How many lines of code is Ecto?!? Really, Ecto was the proof statement for Elixir (with Phoenix being a close second).

Anyway, best of luck, it's a major undertaking to write a language!

lpil commented 5 years ago

Syntax is a factor which is why I've gone for the syntax I have (I personally prefer ML style syntax). On the survey you've linked Rust is the most popular language, and Gleam's syntax is similar to Rust, so we should do OK :)

Also, Elixir is very well supported and super easy to install

It will always be harder to install Elixir + Erlang than just Erlang, so unless there's something we can do with Elixir that we cannot do with Erlang then we won't be changing I'm afraid.

I don't think the target is that important. Elixir compiles to Erlang, Haskell compiles to C--, Purescript compiles to Javascript, but to the average user this doesn't matter as they write the language and don't interact directly with the compilation target.

Erlang is the 6th most dreaded language with 52.6%

It's also on the most loved list, how odd!

Re: database adapter! Man, that's a huge project! How many lines of code is Ecto?!? Really, Ecto was the proof statement for Elixir (with Phoenix being a close second).

Ecto was not created by Jose, neither was Phoenix, Mix, Jose, or Poison. These were community projects in Elixir and their alternatives in Gleam will also be community projects rather than being part of the core language.

After all, I'm busy creating the language itself, which is a larger job than creating a database query builder. One person can only do so much in a limited time.

madasebrof commented 5 years ago

Awesome. Good points.

More just an FYI:

Ecto: https://github.com/elixir-ecto/ecto/graphs/contributors

Phoenix: https://github.com/phoenixframework/phoenix/graphs/contributors

I think the reason Jose spent so much time on these two projects specifically is that he knew there wouldn't be much adoption of Elixir without them. (Coming from Ruby, the ultimate goal was to replace Rails and for that, you need a really good DB adapter and web framework)

Again, best of luck.

OvermindDL1 commented 5 years ago

Syntax can be a big deal, see rising Python vs. declining Perl popularity over the years.

That's less because of python having whitespace sensitivity (ew) and more that perl looks like line noise to the uninitiated.

Re Elixir vs Erlang, LOL. The reason Elixir was invented was that Erlang is a nightmare syntactically!

No it's not. Erlang is a wonderfully simple language with very few base set of keywords and operators. The big useful bit of Elixir is it's macro syntax is significantly more powerful than erlang's parse transforms.

Erlang is the 6th most dreaded language with 52.6%

I don't see how this could possibly be the case unless it was marked as such by people who don't use it. Erlang is way crazy simple, even compared to Elixir, perfectly unambiguous and clean.

lpil commented 5 years ago

Aye, while I don't like the aesthetics as much overall I do prefer Erlang's syntax as it's simple and doesn't have multiple ways of writing the same thing.