Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider turning bb-browser into a Single Page Application based on Elm? #4

Closed
EdSchouten opened this issue Mar 8, 2019 · 8 comments
Labels
enhancement New feature or request

Comments

@EdSchouten
Copy link
Member

EdSchouten commented Mar 8, 2019

Buildbarn Browser currently uses Go templates to generate static HTML pages. This worked out all right for things like build actions, but for build events this is less than ideal. For build events, we eventually want contents to update dynamically. There is also some quadratic expansion we should only do on the client side on demand (e.g., output files for an action).

In theory, Elm would be a pretty good language for writing such a web application. It allows us to get the dynamic updates of build events implemented in a robust way. I already took a stab at implementing a rules_elm for Bazel. Unfortunately, I haven't been very successful at that, because the Elm compiler is strongly integrated with Elm's package manager, meaning it can't easily do fully isolated and reproducible builds.

@EdSchouten
Copy link
Member Author

We're making some progress here. rules_elm now basically works. I can build Elm code through Bazel properly now, meaning that we can mix a Go backend implementation with an Elm frontend.

A couple of days ago I created the elm branch. It now contains some boilerplate code for serving a single-page web app. Next step is to actually learn Elm so I can start rewriting bb-browser.

@ShalokShalom
Copy link

How did you get this working? I am coming from the point of people who like to free the Elm package system up to a little. How did you achieve that?

@mickael-carl
Copy link
Member

@ShalokShalom: you can take a look at rules_elm, using elm_repository you can manage your project dependencies. For an example usage, as pointed out by @EdSchouten, you can take a look at the elm branch of this repository, namely the WORKSPACE file, and this build file to see how to build an Elm application using those rules.

@mickael-carl mickael-carl added the enhancement New feature or request label Aug 3, 2019
@EdSchouten
Copy link
Member Author

Even though we should consider switching to an SPA in the future, I no longer think that Elm is the right choice for this. Marking this as closed.

@ob
Copy link

ob commented Sep 1, 2021

I no longer think that Elm is the right choice for this.

Can you elaborate? What made you change your mind?

@EdSchouten
Copy link
Member Author

EdSchouten commented Sep 6, 2021

Sure! I think that Elm both as a language and as a design pattern is pretty awesome. It is a great fit for bb-browser. What I think is pretty bad about Elm is that the project seems to move at a glacial pace. For example, consider this PR for elm/url that I sent out 2.5 years ago. It still hasn't been merged.

What's really annoying is that the Elm compiler also restricts the use of certain language features to packages with author elm. This means that you can't just go ahead and fork some standard library package and add the features you want, as you won't be able to publish it under that name. The Elm compiler also doesn't provide any facilities for running patched versions of external libraries, or loading source code from alternative locations. This means that you can't easily use that PR that I linked above. You have to actually wait for the Elm folks to merge it. Furthermore, all Elm projects in the world will effectively be unbuildable if https://package.elm-lang.org/ ever goes down, as the Elm compiler doesn't allow you to override the package site.

With rules_elm I somewhat managed to work around this by manually crafting some binary metadata files that the compiler normally stores between invocations. The structure of these files I was only capable of discovering by reading Elm compiler source code, but I don't think that's a sustainable solution. There's a fair chance the next version of Elm will use a different file format.

In my opinion, Elm should be seen as being "Open Source Software" only in the literal sense. It is not free software, nor is it a community project. Sure, Buildbarn is also not a true community project. Sometimes things get proposed by members from the community that receive pushback from my side. Unlike Elm, I'm not trying to dictate how people use Buildbarn.

@aaahrens
Copy link

Frankly (this is coming from someone who's been using elm since 2013), I wouldn't use elm. There's been 0 movement on a lot of things, including no private repos, as you've mentioned. Elm has left a really nasty taste in a lot of people's mouths after their PR fiasco.

React is ridiculously simple now with typescript and hooks being mainline, and it would increase surface area on people who could contribute.

@ob
Copy link

ob commented Sep 14, 2021

Thank you for your responses @EdSchouten and @aaahrens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants