Gallium – Build Desktop Applications in Go and HTML
github.com
github.com
Go needed a GUI, but this?
5.3M Qt5Core.dll
5.6M Qt5Gui.dll
820K Qt5Network.dll
3.2M Qt5Qml.dll
2.9M Qt5Quick.dll
307K Qt5Svg.dll
5.3M Qt5Widgets.dll
(It still might be possible to strip out Gui and Widgets though.)Unlike all the other X11 extensions, the GLX "protocol specification" doesn't define a network protocol. It defines C functions bolted on to Xlib for setting up GL contexts. In many use cases, there probably is no network at all -- just direct rendering.
I don't know what the situation is on other platforms, but I guess it is similar: OpenGL is exposed as some C-based library.
- QtQuick is "the standard library for writing QML applications." [1], providing: Models, Layouts, GraphicalEffects, States, etc. Conveniences and building blocks to build GUIs with QML.
- QML itself is a declarative language totally different from HTML. Bindings are done with JS (by the way, a specific, custom implementation of it), yes, but there's no HTML anywhere.
- Qt also provides the WebEngine module [2], which is an in-house packaging of Chromium. If you use this instead of QML to build your GUI, then yes you're in almost-vanilla "HTML+JS" land. But this is not QtQuick.
But we could have a compilable document language with DOM-like bindings and an event loop in Go. It's a lot harder to implement than HTML + JS, though, which already provide that for free.
It's based on OpenGL ES.
Ivy was made with GO mobile which is a collection of bindings for android/ios only.
I think there's opportunity in packaging this as a system installed & independently updated dynamically linked library much like WebView is updated on Android KitKat onwards. Eg. a single "system" Chromium component that's installed centrally & used by multiple programs much like Microsoft Runtime DLLs on Windows.
The performance improvement has basically come from the massive market that web is and consequently Google, FF and MS optimizing their JS and rendering engines (plus Moore's law)
I find that this phrase irks me quite a lot these days. Feels like it's at every corner of software development waiting to pounce and ensure thoroughly mediocre results.
There's something to be said about, "don't let the perfect be the enemy of the good" but at the same time, "good enough", especially when it comes to UI speed/responsiveness and UX quality, feels like a massive cop out. Isn't there a middle ground somewhere that doesn't call for such huge concessions?
We've already solved fragmentation in the native UI space, with GUI toolkits like GTK and Qt. If someone extended those to mobile devices, then we'd have something a lot less terrible than HTML5/CSS/JS, which performed a lot better.
That's the issue.
With this, my / will reach terabytes.
There's two things why not: cheap isn't free, and "elegancy principle": Don't build shitty hacks, build software that's easy to maintain, as minimal as possible, and will be used for decades.
The same reason security libraries are distributed independently so that they can be automatically updated without the program using them being re-compiled & re-released. On the Android platform, Chromium WebView updates far more frequently than the apps that depend on it & includes security patches on update.
RAM in not as plentiful, nor are level-3, level-2 and level-1 cache. having a second copy or almost-copy of a library can increase utilization of any of them.
Why why would I want to use Go on the integration side, and still have to use JS within the webpage? Most Electron apps I've seen have a slim wrapper of code in their main file to just initialize native things. Why is it better or easier to do that in Go instead of in JS?
Probably, you wouldn't. But it's not quite surprising if users of GopherJS and Go would prefer Go over JS, is it?
(Obviously this is a ideological argument rather than a practical one because most projects don't have the budget for devs to do that much prep work like learning a new language, but practicality is boring. :) )
This can be useful if, for example, you want to deploy this as a commercial software and do some checking against piracy...
Which leads to: there's still no licence attached to this cool project ;)
Just stop it and give up on DRM.
Of course, this is a minor complaint on modern systems...
https://github.com/mgutz/chromeapp
chrome app <- websockets -> go service
The real killer-feature of Electron et. al. is only having one browser version to test against. I think embedding CEF is definitely the right call.
This is actually not based on CEF, btw, but on libchromiumcontent (the Electron alternative to CEF).
As annoying as callbacks can be, they do fit the model basic GUI model very well: user clicks on something, the system calls the corresponding funciton. And indeed I see a lot of that sort of thing in the README.
Does that mean goroutines will fade into the background in Gallium?
concurrent tasks =/= asynchronous tasks.
A big difference is that Go doesn't force you to write asynchronous code for I/O operations, JS engines like nodejs do and it's a pain in the ass. Go only says : "If you want to write concurrent code you can do that", while NodeJS or browsers say :"Any I/O operation needs to be asynchronous and explicit".
If I call an API in Go, I don't have to care whether the computation will be executed in the same thread or not, or in 10 different threads, provided concurrency is encapsulated the right way. There is no amount of async/yield/promise that can mask any I/O operation with Nodejs on the other hand.
> As annoying as callbacks can be, they do fit the model basic GUI model very well:
This is a design decision. Gallium could have used channels instead of callbacks.
Node also has a full set of 'normal' synchronous I/O operations (although they were added later after the async stuff).
It will act the same when it's sync vs async.
It would be a horrible idea to await everything, but it would work.
Those are callbacks for event-driven programming.
But there's nothing about them that makes it a great abstraction for asynchronous tasks in general, and even less so for concurrency tasks. They are a low level abstraction that should be used as an implementation detail.
To clarify, they do not fall into the the strictest definition of green threads[1].
> [2]: As of Go 1.5, the default value of GOMAXPROCS is the number of CPUs (whatever your operating system considers to be a CPU) visible to the program at startup.
Prior to 1.5, the default value was '1' but could be changed.
> GUI model [...] Does that mean goroutines will fade into the background in Gallium?
The main concern at the moment seems to be wrapping the underlying APIs. However, I see channels being used for great effect further down the line:
var ui chan uiFunc = // ...
button1Click := make(chan ClickEvent)
go func() {
for evt := range button1Click {
ui <- func() { textBox1.setText("Button clicked!") }
}
}()
button1.onClick(button1Click)
I presume this also applies to interacting with the V8 ABI, seeing as JS is inherently single-threaded.[1]: https://golang.org/pkg/runtime/#GOMAXPROCS [2]: http://dave.cheney.net/tag/gomaxprocs
Chromium is also an element, but if I named a third OSS project "Chromium" (first: [1], second: [2]), I bet people would complain.
Windows and apple are common words in the English language, but I bet I couldn't name my software project either of those.
Context is important when deciding whether a name is appropriate or not.
Package up servo with DOM api via C ffi and you'll have my attention.
Even if someone started a project like this they likely wouldn't be done until it gets a stable release anyway.
> The executable itself is 2.2M [...] Bundle 95MB [...]
> https://www.reddit.com/r/golang/comments/53tw4p/a/d7x2a91
People feared when many former Node.JS developers migrated to Go because they would probably migrate the same principles from the JavaScript community (NPM and the dependency hell). Now people will fear the migration of Electron-like applications to the Go ecosystem. I am glad that more and more web developer are stepping forward and contributing their skills to create desktop applications, but I still cannot wrap my head around the idea that embedding a giant non-efficient webview in every project is a good idea. At this point, a computer with +16GB RAM will feel like using one with only ~6GB because of the amount of Chromium instances open in the background.
Someone reported yesterday a problem in the SublimeText3 issue tracker [1][2] stating that after the automatic update to the latest version the software started to consume a lot of RAM and CPU, but then he explained that (while using a Mac) he had ST open for several months, WTF!!! He should be graceful that you could keep ST open for more than a week, try that with an Electron-based application like Atom and you will cry. Now imagine this scenario with the future Go+Electron-like applications in the following months.
[1] https://github.com/SublimeTextIssues/Core/issues/1387
[2] https://forum.sublimetext.com/t/sublime-3124-eat-up-my-cpus/...
It's not ideal, but everything generally comes down to cost benefit analysis with time being a major contributor to cost. That's the entire reason that so many startups have been using Ruby despite it's non-ideal performance. Soon as you get a steady revenue stream from users taking the time to optimize to something else makes sense.
Granted, Elixir is shifting that formula quite a bit now since you can get those Ruby-like levels of productivity and time savings without the long term expectation of refactoring headaches.
That is what I went back to doing in these last three years (Forms/WPF/Android/iOS/WP) and couldn't be happier to have regained some sanity away from the Web world, fad of the day with browsers bended to pretend native UIs.
},
},
},
})
}
Is there a way to write this more clearly? }}}})}"Both Electron and Gallium use Chromium under the hood, and in fact some of the C components for Gallium were ported from Electron."