Joel Drapper 🇬🇧🇺🇦
banner
joel.drapper.me
Joel Drapper 🇬🇧🇺🇦
@joel.drapper.me
2.1K followers 980 following 2.5K posts
I’m a Ruby/TypeScript/CSS engineer at @plane.com and based in the UK. https://joel.drapper.me I’m building a Ruby/SQLite serverlesslessness framework. I also maintain @phlex.fun. Signal: joeldrapper.01
Posts Media Videos Starter Packs
Pinned
If the Rails Foundation tried to take Rails from its maintainers, I would stand up for the maintainers, despite my political differences.

Rails is not owned by the Rails Foundation in the same way RubyGems projects were not owned by Ruby Central.

And neither are legitimately owned by Ruby Core.
Maybe we should move them into a ruby-snippets extension?
Reposted by Joel Drapper 🇬🇧🇺🇦
Any thoughts on a way to disable snippets?
Reposted by Joel Drapper 🇬🇧🇺🇦
Today's free Phlex on Rails video is all about rendering, which is very polymorphic in Phlex.

Partials, strings, values, components, component classes, and collections all Just Work™ when passed into the `render` method.
Rendering
This video course teaches you how to use Phlex to build high quality Rails frontends that you can use with existing Erb apps or go all-in and build from the ground up with components. Phlex brings san...
beautifulruby.com
I’m sad it won’t be getting frozen string literals by default.
It hits that branch of the case but then the second pattern should fails so the result should be false.

Looks like it is a regression.
I shared a bit more detail about the morphing algorithm in Morphlex here. I also released Morphlex 1.0. joel.drapper.me/p/morphlex/
Better DOM Morphing with Morphlex
joel.drapper.me
Bundler is happy to look for gems in .node_modules and being a node package means we can have it provide CSS and JavaScript too.
I think it’s fine to keep them together. But it can make sense to separate them.

At work our generic components are shared between multiple apps so we keep them in a gem that we install as a node package. 😂
Instead of morphing from top to bottom, Morphlex looks ahead to find the best matches in the old DOM.

This means if you’re morphing to a tree with one element removed, the only DOM operation will be to remove that element. Same with adding an element and sorting existing elements.
Related to this, there’s a library called ArkType that is a runtime type checker that helps your static type checker know what’s going on. This feels like a very good direction to me.

arktype.io
ArkType
TypeScript's 1:1 validator, optimized from editor to runtime
arktype.io
In either case you’re having to work around the fact that your program doesn’t know anything about types and your type system doesn’t know much about your program.
If you do that, someone else could unintentionally change this code in a way that calls your example method with undefined.
You either have to give the type checker hints (e.g. by doing a runtime check that the type checker can see by hand). Or you say, “I know what I’m doing.” and add a bang to allow unsafe indexing into the array.
A simple example form TypeScript. One program knows that `list[0]` is a string. And you, the human also know. But the other program (the type checker) doesn’t.
One program is the type checker, the other program is your program. They both evaluate the same source code and do completely different things with it, and they cannot communicate with each other.

It’s why you have to keep giving the type checker hints about what it can’t know.
We plan to build a static component in the LSP that can give you auto completions and even catch some errors. But the main thing will be what is true at runtime. We can’t get away from Ruby being dynamic.
My sense at the moment is that the disconnect here is that dynamic type systems have never felt integrated in the syntax, the language.

If you have that, it feels way more cohesive than a two-program static system.
The other side to this is that static type systems are a second program that runs from the same source code but can’t directly communicate with the other program. That’s a lot of mental overhead.
In a language like TypeScript it works so well. I’m not convinced Ruby can get there or even should. TypeScript works because it’s universally adopted. Seems like it’s a bigger language than JavaScript.