10 ms·
Social virtual spaces with Elixir at Mozilla
- travisgriggs 5y agoI can't speak for Phoenix (yet), but today, I wrote my first macro for Elixir. I think I know what I like about Elixir. At its heart, it is a very simple language. It's not afraid to have an API that manipulates its own AST. 3 element tuple for every kind of AST node. That fricking simple. It makes it super easy to reason about the code and rewrite/restructure it programatically. It's like an abstraction of the RISC vs CISC debates. A language built from a few simple consistent building blocks, or a massive amalgamation of corner case optimizations designed ad hoc for each situation as it arises? Years ago, I was a full on Smalltalk enthusiast/ninja. One of the coolest tools that ever existed in the Smalltalk world was the Refactoring Browser written by John Brant and Don Roberts. It blazed the trail and wrote the book in IDE driven code refactoring. In all of the IDEs I've used since outside of Smalltalk, I haven't seen a refactoring they didn't implement, and there were quite a few I've never seen outside of that environment. Which was interesting, because Smalltalk has no manifest typing (it's run time typed rather than compile time). I once asked John and Don if they were going to do the same tooling for for Java in Eclipse. It would have been the bomb in those days, and probably a great money maker. I theorized that some of the "fuzzier" parts of refactoring Smalltalk code would be easier because of Java's manifest typing. Don replied that he had thought that as well, and they had looked at it. But what they had found was that if there was a gain in having the types available, it was dramatically overpowered by the complexity of the Java AST (this was in the early days of Java too). The corner cases of trying to transmogrify code in a behavior retaining way just blew up combinatorially with all of the different corner cases. They looked at doing the same for Ruby eventually when it began gaining in popularity. Ruby, like Smalltalk, has no manifest types. But they found the same thing. At the time, there were 90+ different node types for a Ruby AST. And it was much more difficult. So all of this tale is just a long way of saying, I'm liking Elixir so far. It's fundamentals are strange and paradigm challenging for me. That will take some patience to surpass. But I believe that platforms built on fewer scalable parts, rather than lots of syntactic sugar and variant execution models (I'm looking at all you "hybrid" languages), are better in the long run and way more empowering.
- spicybright 5y agoWhy floating torsos without limbs? Could they have designed something less creepy to talk to?
- LinusPrime 5y agoLimbs can be tricky to animate correctly in VR… I still get nightmares from some of the abominations I’ve seen in VR Chat.
- jayd16 5y agoUsually all you have is head position and hand position. You don't have torso tracking separate from head tracking and because of that doing elbow IK can be really hard. This style keeps you out of the uncanny valley. Although, the realistic torso shape might go a bit too far.
- gfodor 5y agoWorth noting Hubs is more like Wordpress for social VR - the content is largely up to the user (to either adopt or create) - so the avatars in screenshots say less about some kind of universal art design choices than whatever specific setup the user was in.
- astlouis44 5y agoHow's Jel going, Greg?
- gfodor 5y agoFiguring out what to do with it! :) https://twitter.com/gfodor/status/1400670444533936128 https://twitter.com/gfodor/status/1400670444533936128
- gfodor 5y agoBelieve me, not creepy is harder than it seems, especially in VR.
- 5y ago
- sergiomattei 5y agoThese frequent posts about Elixir are tempting me to give it another shot... But the last time I tried (weeks ago), it was a total pain. I could barely find documentation for the authentication packages I was trying for Phoenix and the docs I did find were usually outdated. Packages were unmaintained left and right and there's no official libraries for things like Stripe. It was a real shame because I seriously align with the ideology behind it. It just slows me downvand for that reason I can't use it.
- dudul 5y agoWhat auth packages were you trying? Documentation in the Elixir ecosystem is often excellent. The recommended auth library with Phoenix is now phx_gen_auth if it helps. As for Stripe, this looks pretty mature to me https://github.com/code-corps/stripity_stripe https://github.com/code-corps/stripity_stripe Definitely not a lot of "official" libs/clients in Elixir, companies aren't gonna spend a lot of resources maintaining that.
- sergiomattei 5y agoMy experience with phx_gen_auth was like this: 1. Install Phoenix, expect the command to be available because everyone is raving about it. 2. Missing command. 3. Dig through docs. 4. Pull the development branch of Phoenix because phx_gen_auth is only available there. 5. Run the generator within the Phoenix git repo because it won't allow me to run it elsewhere using a development version. 6. Use the generator. 7. Never figure things out because the phx_gen_auth command is barely documented and now I've got files everywhere that I don't understand. I tried implementing API authentication as well and while I got it working, it was less pleasant than my usual Django stack. Another example. The colossal amount of docs referring to a missing Phoenix plugin for Guardian that got removed in a random update made me scratch my head and spend an hour digging through their changelog and commits to figure out why my code wasn't working. The change was not documented at all. All in all, there were roadblocks every step of the way with poor docs and big undocumented breaking changes in libraries like Guardian. I want to love this thing but it made me so unproductive in the first couple weeks of using it for basic web/api development that I simply noped out.
- pqb 5y agoThis submission is probably the first example of usage Phoenix Framework in big company that I know. I remember how many there were Elixir vs Go "battles" on HN in last three years but what I have noticed the Phoenix have worse traction and new adopters evangelizing it. That's sad, because I think Elixir and Phoenix Framework definitely is worth some attention.
- dudul 5y agoThere are plenty of big companies using Elixir/Phoenix. Bleacher Report, Cars.com, Pinterest and many more.
- enraged_camel 5y agoDiscord uses Elixir too, I think?
- bcrosby95 5y agoThey use Elixir but not Phoenix.
- dnautics 5y agoI have heard pagerduty deploys their elixir microservices using a (very cut down) version of Phoenix. Somewhere they have a private "miniPhoenix" template that autogenerates everything for them. There are some big non-tech companies that you probably know that use elixir-phoenix, off the top of my head, PepsiCo, MBTA, BBC, PRX (of NPR/public radio fame).
- ch4s3 5y agoYou can roll out your own mini Phoenix with flags passed to mix phi.new
- ch4s3 5y agoWe use it at Pepsi eConmerce for multiple teams. In fact all of our newer backend projects use it.
- benatkin 5y agoMozilla licenses almost everything under the MPL, which seems to reduce interaction with other open source organizations. I wonder if it bothers them, or they're OK with it.
- dralley 5y agoI doubt that's the reason (and if it is, that's a shame, because MPL is a great license and one of my personal favorites). Most of Mozilla's code is on their internal mercurial server rather than GitHub. That feels like a larger reason.
- syspec 5y agoI really want to try elixir, but I need an IDE based debugger! I tried the IntelliJ plugin, but it did not work (would work once the disconnect when the first BP was hit) JetBrains if you're listening, please make an official app / plug-in! Pretty please - My other gripe is the state of abandoned packages
- raarts 5y agoI used that debugger three years ago and it worked fine. Remember I had to do something special to set it up though. Made a career change after that so can't help you now.
- ch4s3 5y agoYou probably don’t need a debugger in elixir, based on my experience. You can drop into a process with iex.pry() or use the repl and get a lot of insight that way. You’re generally not dealing with state outside or GenServers which you can inspect if needed.
- teeray 5y agoI can't believe this has been around since 2018 and this is the first I've heard of it. I can think of a bunch of events over the past year where this would have been awesome to use. Shame that the marketing hasn't been better.
- gfodor 5y agoHello, I'm sure Mozilla folks will be here too (I no longer work on Hubs) but I am quoted a few times in this article and happy to answer any questions I can!
- yetanothermonk 5y agoThis might be an ill-formed question given not knowing the specifics of the source code, but do you think Phoenix LiveView can be used to manage state through websockets vs the JSON payloads described in the article?
- gfodor 5y agoSorry I don’t really know enough about LiveView to give a good answer. The protocol involved here is a fairly unsophisticated game networking protocol sending delta updates of object properties and transforms at 10Hz or so, and takes the approach of ownership transfer to orchestrate which packets are authoritative. If a reader who knows LiveView understands what I just wrote, they may be able to answer :) (the library for Hubs doing this is networked-aframe)
- gavanwilhite 5y agoRock on Greg / Dom / John / all! Awesome seeing behind the scenes on all this.
- princevegeta89 5y agoI started dabbling with elixir in 2017. The platform is phenomenal in terms of performance and the preciseness you can write code with. The pains I've seen are - thinking everything in a "functional" way - ide support - the library ecosystem, though rich in selection, could use some more help. Functional thinking becomes easier the more time you spend on it. I've recently solved the ide part with VSCode and ElixirLS. I use Docker and I'm able to get all interpretation and dynamic compiling along with suggestions, warnings using the VSCode Remote Containers plug in. Overall, the platform seems to be growing and it is great to see big players taking some steps here.
- brainbag 5y agoDo you have a reference or repo somewhere for your Docker setup, please? Sounds excellent.
- princevegeta89 5y agoI can upload it to github and share it with you! Let me ping back later in the day
- brainbag 5y agoDid you happen to upload this?
- princevegeta89 5y agoSorry, I will share it with you tonight! thanks!
- toastal 5y agoThinking in a “functional way” is an upside and preferred by some and often a best practice by many (functional core, imperative shell crowd, much of the JS community post-React, etc.). It’s definitely a skill to have.
- fsiefken 5y agoI'd like to run Hubs Cloud on premises (my own home), but it's currently only offered as Digital Ocean droplet and Amazon https://hubs.mozilla.com/docs/hubs-cloud-intro.html https://hubs.mozilla.com/docs/hubs-cloud-intro.html I found some repositories here and there but it's all dated. I wondered if there is a more recent reticulum docker and installation document I could re-use and found the links below. If anyone has other tips, installation flows/scripts or pointers, feel free to share. https://sophiadigitalart.com/setup-your-own-hubs-server/ https://sophiadigitalart.com/setup-your-own-hubs-server/ https://github.com/mozilla/hubs https://github.com/mozilla/hubs https://github.com/xr3ngine-archive/mozilla-hubs-docker https://github.com/xr3ngine-archive/mozilla-hubs-docker https://gitlab.nautilus.optiputer.net/ar-noc/mozilla-hubs-docker https://gitlab.nautilus.optiputer.net/ar-noc/mozilla-hubs-do...
- gfodor 5y agoThere have been several attempts to try to dockerize the stack but none successful as far as I know. I did most of the work on packaging this so I’m not totally sure what is missing, but the droplet setup was close enough that I’m surprised nobody has cracked an all in one container image yet.