Live data from Hacker News

Elixir v1.20: Now a gradually typed language

elixir-lang.org

51–60 of 426 posts

Re: Elixir v1.20: Now a gradually typed language

#51

Earlier quoted context omitted.

Yea I've worked through Elixir in Action and appreciate all book recommendations. My issue is, tutorial style books rarely cover security related concerns.

what do you mean by 'security related concerns'?

How to properly build a liveview thats safe against hijacking the websocket phoenix uses for liveviews. You can just do it from the devtools on client side. With regular HTTP requests at least I know what to look out for, with liveview there are almost no resources on how to build a view securely. Like I was able to just call the functions in my module by just addressing them from my browsers console. Just to name an example.

Re: Elixir v1.20: Now a gradually typed language

#52

Guys, I am sorry for your loss here. def example(x) when not is_map_key(x, :foo) I think this also shows that merely copy/pasting ruby's syntax, isn't an automatic win. I noticed this before with crystal, though naturally crystal had types from the get go. Fundamentally: def foo() end should stay simple. And this is no longer the case now. (Ruby also went in error, e. g. "endless methods". I don't understand why prog…

You can of course still do the second thing, the types are not forced if you don't want them!

Re: Elixir v1.20: Now a gradually typed language

#53
post #46

How does it compare to Gleam? Or rather, why use Elixir over Gleam now? I suppose Phoenix and Live View in particular are big draws to Elixir.

Do you like Rust or do you like Erlang? Writing Gleam is like writing Rust, writing Elixir is like writing Erlang. I don't know the current state of Gleam OTP, but last I checked it wasn't great. If you don't care about either of those things and only about types, use Gleam. But then why not just use Rust?

> writing Elixir is like writing Erlang

I wrote both Elixir and Erlang code. Erlang is just useless to me as a programming language; it has many great ideas though. I love the idea of being able to think in terms of immortal, re-usable, safe objects (Erlang does not call these objects, but to me this is OOP by Alan Kay's definition. I don't use e. g. the java definition for OOP.)

Elixir built on that and made Erlang code optional, meaning people could write more pleasent code. And here it succeeded. I am not sure why Elixir succumbed to type madness now, but the comment that "writing Elixir is like writing Erlang", is just simply not true.

Elixir is significantly better than Erlang with regard to writing code. José Valim got inspiration for Elixir from ruby, to some extent.

Re: Elixir v1.20: Now a gradually typed language

#54
post #26
post #22

Earlier quoted context omitted.

Java has the JVM the same way that Elixir has Beam/OTP/...

Read again... Here's what you need to do for elixir: Download and run the Erlang installer Download and run the Elixir installer Here for Java: Download and run the Java SDK And for Python: Download and run the Python installer

For Java you need a JRE and JDK depending on whether you're just running or also building. That they are bundled (for Windows) is slightly convenient, but they're not bundled on Linux so what you're saying is OS dependent

Re: Elixir v1.20: Now a gradually typed language

#55

Guys, I am sorry for your loss here. def example(x) when not is_map_key(x, :foo) I think this also shows that merely copy/pasting ruby's syntax, isn't an automatic win. I noticed this before with crystal, though naturally crystal had types from the get go. Fundamentally: def foo() end should stay simple. And this is no longer the case now. (Ruby also went in error, e. g. "endless methods". I don't understand why prog…

[deleted]

Re: Elixir v1.20: Now a gradually typed language

#56

Oh shit here I go (and learn Elixir for a whole year (again)) again. I love everything about Elixir, but Elixir constantly makes me doubt myself like no other language. My brain isnt made for functional stuff, but this makes me want to try again. Sucks that it's not really a beginner friendly ecosystem and usually, when having questions answered, people assume you already know a lot about the language.

Do https://htdp.org and follow all the exercises carefully (yes, it will feel like baby work at first) - you will retrain your brain for functional stuff. :-)

Re: Elixir v1.20: Now a gradually typed language

#57

Earlier quoted context omitted.

I love Elixir and Phoenix, but Phoenix especially uses a lot of compile-time macros and it can be a steep learning curve when you need to pull apart the skeleton framework to figure out how things are actually wired. I pretty frequently find myself needing to open up the source to understand what's actually going on, the docs aren't bad but it often feels like they assume a lot of existing familiarity with phoenix. I…

I think the lack of parentheses is whats throwing me off regularly with Elixir.

I find the optional parentheses, and the way that keyword lists are defined to be the two biggest stumbling blocks when I come back to Elixir after a while way.

Coming from other languages, I find that

    example("with", 3, extra: "arguments", as: "a", keyword: "list")
being equivalent to

    example("with", 3, [extra: "arguments", as: "a", keyword: "list"])
and

    example "with", 3, extra: "arguments", as: "a", keyword: "list"
always takes some extra mental effort to get through, especially when there's no parenthesis. But I appreciate not having to write all the extra brackets and parens when I get going, so I think it's a fair tradeoff.

Re: Elixir v1.20: Now a gradually typed language

#58

Guys, I am sorry for your loss here. def example(x) when not is_map_key(x, :foo) I think this also shows that merely copy/pasting ruby's syntax, isn't an automatic win. I noticed this before with crystal, though naturally crystal had types from the get go. Fundamentally: def foo() end should stay simple. And this is no longer the case now. (Ruby also went in error, e. g. "endless methods". I don't understand why prog…

The syntax you are commenting on has always existed in Elixir, before v1.0, as part of patterns and guards.

You are commenting as if we added this now but we have made no changes to the language surface. The difference is that we now leverage these same language constructs to extract precise type information.

Re: Elixir v1.20: Now a gradually typed language

#59
post #46

Earlier quoted context omitted.

Do you like Rust or do you like Erlang? Writing Gleam is like writing Rust, writing Elixir is like writing Erlang. I don't know the current state of Gleam OTP, but last I checked it wasn't great. If you don't care about either of those things and only about types, use Gleam. But then why not just use Rust?

> writing Elixir is like writing Erlang I wrote both Elixir and Erlang code. Erlang is just useless to me as a programming language; it has many great ideas though. I love the idea of being able to think in terms of immortal, re-usable, safe objects (Erlang does not call these objects, but to me this is OOP by Alan Kay's definition. I don't use e. g. the java definition for OOP.) Elixir built on that and made Erlang…

You're taking my comment way too literally. I'm basically just making a syntax comparison. Obviously Rust is not at all like Gleam in many ways either. It's just statically typed and has a similar syntax.

Re: Elixir v1.20: Now a gradually typed language

#60
post #26

Earlier quoted context omitted.

Read again... Here's what you need to do for elixir: Download and run the Erlang installer Download and run the Elixir installer Here for Java: Download and run the Java SDK And for Python: Download and run the Python installer

If you're going to try and use this analogy, you need to compare Elixir to Kotlin or Scala or Clojure rather than Java. Elixir is a language written for the BEAM which was created for Erlang. The BEAM happened to be useful VM for these other languages such as Elixir, Gleam, LFE, & Luerl.

No, I don't. I'm not writing gleam etc for the same reasons.
Post reply on HN