Live data from Hacker News

Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

dailydrip.com

41–50 of 76 posts

Re: Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

#41
post #21

Earlier quoted context omitted.

This is because in Elm a runtime error is a compiler bug. If you want no runtime errors, interoperating blindly with JavaScript is a great way to fail :-\ Another great thing about the community is a goal of a single great library for every use case, rather than a lot of half-baked competing libraries. So expect there to be a single great modal library. Etc.

That last part sounds pretty cool, how is this sort of thing being encouraged?

As a corollary to what shados was saying, now that 0.17 is out the elm-lang organization will make a library to cover every single part of the web platform [0], at which point you will never need to.

[0] https://platform.html5.org/

Re: Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

#42
post #9

I'm impressed by the Hacker News crowd. Pretty cool to see a topic as esoteric (and awesome) as Phoenix / Elm hit the top spot. Very good post!

I does look like Elixir/Phoenix is growing fast enough that it will not be considered esoteric in fairly near future.

Re: Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

#43

How come no one (seemingly) uses Elm, despite all the love? I've noticed a lot of quick, drive-by posts in Elm related threads about how great the language is. This thread ("This is a great little webstack!") and today's other front-page elm thread[1] both do this. With such high praise, I would expect the language to be more popular. What's with the disconnect? My hypotheses: 1) There are no unhappy users because un…

[deleted]

Re: Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

#45
post #38

How come no one (seemingly) uses Elm, despite all the love? I've noticed a lot of quick, drive-by posts in Elm related threads about how great the language is. This thread ("This is a great little webstack!") and today's other front-page elm thread[1] both do this. With such high praise, I would expect the language to be more popular. What's with the disconnect? My hypotheses: 1) There are no unhappy users because un…

Elm is the coolest, best programming language ever made for practical purpose and adoption by the mass...that cannot be used for practical purpose and the mass because the FFI for libraries is a private API (the "public" FFI only let's you interop within your own application/world, making it hard to wrap libraries or build libraries that do interop). So it's basically a language we desperately want to use, but can't.

I hear this criticism about ports a lot. Out of curiosity, how could we make it better? Do you have any examples of what you consider to be the ideal FFI? I haven't used ports a ton, but I have used them for interop between Elm and the Google Maps Javascript API, and I didn't think it was that bad.

Re: Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

#46
post #28
post #23

Earlier quoted context omitted.

PureScript + learning Erlang/Hakskell rekindled mine :) I ended up learning Erlang after hearing about Elixir and not being a fan of the Rubyish syntax and immutability comporomise, which has been a very rewarding experience. Haskell even more so. And Purescript has some nice Elm inspired libraries [2]. [1] https://purescript.org [2] https://github.com/search?utf8=%E2%9C%93&q=language%3Apuresc...

pedant mode on... there is no "immutability compromise" in Elixir. Static Single Assignment != Immutability. Elixir is entirely immutable - it has to be as it just runs on the Erlang VM! I think a legitimate complaint along these lines would be "pinning is confusing and error prone for beginners" and I think it's fair. Christopher Meiklejohn mentioned this on Twitter yesterday, and it's a point that's caught me plent…

> Elixir is entirely immutable - it has to be as it just runs on the Erlang VM!

No, variables are mutable in Elixir.

   Interactive Elixir (1.1.0-dev)
   iex(1)> x=1
   1
   iex(2)> x=2
   2
Notice how x is 1 then x is 2. Variable x mutated.

In Erlang:

   1> X=1.
   1
   2> X=2.
   ** exception error: no match of right hand side value 2
Variables are immutable in Erlang.

I suspect you misunderstood gp's post and thought they were talking about data, which is immutable in both languages in general.

Re: Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

#47
post #38

Earlier quoted context omitted.

Elm is the coolest, best programming language ever made for practical purpose and adoption by the mass...that cannot be used for practical purpose and the mass because the FFI for libraries is a private API (the "public" FFI only let's you interop within your own application/world, making it hard to wrap libraries or build libraries that do interop). So it's basically a language we desperately want to use, but can't.

I hear this criticism about ports a lot. Out of curiosity, how could we make it better? Do you have any examples of what you consider to be the ideal FFI? I haven't used ports a ton, but I have used them for interop between Elm and the Google Maps Javascript API, and I didn't think it was that bad.

PureScript is a good example.

The problem isn't that it doesn't work. It's that what you do with ports only work in the context of your application. The JavaScript part has to be defined somewhere else, the Elm code assumes the JavaScript part will be there. You can't redistribute that easily.

How to make it better? that's easy. IT ALREADY EXISTS and is part of Elm. It's just a private API. But it totally does work. It's how the native wrappers are written.

Ports use publisher/subscriber. If I want to, let say, wrap moment.js, which is just a bunch of synchronous functions, how would I do it? Dispatch side effects to "compute dates" and listen to the "response" in my update method? That would be silly.

The port system works beautifully to interface with the outside world. It is very poor to bring the outside world in.

Re: Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

#48
post #46
post #28

Earlier quoted context omitted.

pedant mode on... there is no "immutability compromise" in Elixir. Static Single Assignment != Immutability. Elixir is entirely immutable - it has to be as it just runs on the Erlang VM! I think a legitimate complaint along these lines would be "pinning is confusing and error prone for beginners" and I think it's fair. Christopher Meiklejohn mentioned this on Twitter yesterday, and it's a point that's caught me plent…

> Elixir is entirely immutable - it has to be as it just runs on the Erlang VM! No, variables are mutable in Elixir. Interactive Elixir (1.1.0-dev) iex(1)> x=1 1 iex(2)> x=2 2 Notice how x is 1 then x is 2. Variable x mutated. In Erlang: 1> X=1. 1 2> X=2. ** exception error: no match of right hand side value 2 Variables are immutable in Erlang. I suspect you misunderstood gp's post and thought they were talking about…

I did not misunderstand. You're calling renaming something mutation. It isn't.

You're referring to static single assignment. This has been covered before in more detail than I care to go into.

Re: Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

#49
post #46
post #28

Earlier quoted context omitted.

pedant mode on... there is no "immutability compromise" in Elixir. Static Single Assignment != Immutability. Elixir is entirely immutable - it has to be as it just runs on the Erlang VM! I think a legitimate complaint along these lines would be "pinning is confusing and error prone for beginners" and I think it's fair. Christopher Meiklejohn mentioned this on Twitter yesterday, and it's a point that's caught me plent…

> Elixir is entirely immutable - it has to be as it just runs on the Erlang VM! No, variables are mutable in Elixir. Interactive Elixir (1.1.0-dev) iex(1)> x=1 1 iex(2)> x=2 2 Notice how x is 1 then x is 2. Variable x mutated. In Erlang: 1> X=1. 1 2> X=2. ** exception error: no match of right hand side value 2 Variables are immutable in Erlang. I suspect you misunderstood gp's post and thought they were talking about…

Actually, variables in Elixir can be re-binded:

> x = [1, 2, 3]

> x = 2 # the structure [1, 2, 3] still exists in memory, but now the variable x is bound to the value 2

All data is still immutable, the BEAM itself requires so. Dave Thomas explains this in its "Programming Elixir" book.

Re: Integrating Elm and Phoenix Channels via Elm-Phoenix-socket

#50
post #46

Earlier quoted context omitted.

> Elixir is entirely immutable - it has to be as it just runs on the Erlang VM! No, variables are mutable in Elixir. Interactive Elixir (1.1.0-dev) iex(1)> x=1 1 iex(2)> x=2 2 Notice how x is 1 then x is 2. Variable x mutated. In Erlang: 1> X=1. 1 2> X=2. ** exception error: no match of right hand side value 2 Variables are immutable in Erlang. I suspect you misunderstood gp's post and thought they were talking about…

Actually, variables in Elixir can be re-binded : > x = [1, 2, 3] > x = 2 # the structure [1, 2, 3] still exists in memory, but now the variable x is bound to the value 2 All data is still immutable, the BEAM itself requires so. Dave Thomas explains this in its "Programming Elixir" book.

> the structure [1, 2, 3] still exists in memory, but now the variable x is bound to the value 2

I wasn't talking about data, I was talking about variables. Yeah you just called it "re-binded". I called it "changed" or "mutated".

You have a function, and you see x=1 first and print its value. You'd see "1". Then you can have x=2 maybe a few lines or pages below, print it, you get "2". Variable x has changed its value. I even illustrated with a short example.

> All data is still immutable, the BEAM itself requires so. All data is still immutable, the BEAM itself requires so

Agreed. I don't think I ever talked about data being mutable. Having used BEAM VM for the last 5 years, yes, I noticed data is immutable ;-)

Post reply on HN