220 points · by scapbi · 12y ago · 108 comments
Would it be possible, long term, to use Qt? I mean switch the current components to be based on Qt and then, over time, actually start using Qt?
It's getting there, but I've only really done any real coding in anger in the last 5 months and this is a 25 year code base...
I notice the Linux APIs call GTK which, while I can understand the logic of, I rather liked the Qt Go Bindings I played around with last year.
And yes, this is still rather incomplete (I'm surprised it's getting so much attention this early!); please feel free to make suggestions!
> What random formatting?
Primarily here I saw a lot of arbitrary indentation. As far as I can tell, everything would be fixed by a gofmt -w...https://github.com/andlabs/ui/blob/master/button.go#L16-19
https://github.com/andlabs/ui/blob/master/area_unix.go#L35-3...
https://github.com/andlabs/ui/blob/master/area_unix.go#L107
https://github.com/andlabs/ui/blob/master/area_unix.go#L200
https://github.com/andlabs/ui/blob/master/area_unix.go#L329-...
https://github.com/andlabs/ui/blob/master/grid.go#L18-26
> What unidiomatic naming conventions?
Primarily here I saw a lot of underscores, which are never used in pure Go. Some of that maybe is due to Cgo conventions, but some of it isn't.or lines 10-12 of this file: https://github.com/andlabs/ui/blob/master/area_darwin.go
those were the first to files I picked.
I have no comment on organization--something I struggle with.
(wakeup doesn't run with the current version though, missing window w in args, but that's an easy fix..)
So from 10 minutes of looking at it and getting wakeup built, I've learned some new Go stuff. Thanks for that! :)
Granted, there are some quite complex systems out there where generics could deliver truly valuable type safety. I doubt all the systems that are that complicated really need to be.
The likelihood that a programming language feature will be over/mis-used is directly proportional to how nifty it is.
Specifically, how?
EDIT: Surprisingly, programmers do a lot of this "just knowing." You'd think that a supposedly quantifiable field would have more, quantification. Going by "guts" is particularly bad in big enterprises, where decisions are often more about politics than about quantifiable results.
The only real issue is that the things you shove into Objective-C containers must themselves be Objective-C types, which means using NSNumber and NSValue everywhere for raw C types. The new Objective-C @literal and @(expression) syntax, however, should make such code cleaner in the future...
Your post is a good post.
GTK+ on Windows doesn't really have a particularly good reputation among myself and some of the people I know, and I didn't know native GTK+ for Mac was a thing until very recently.
It's written by the same guy who made the awesome MongoDB driver for Go, so I have high hopes!
It's extremely rare to see a cross-platform GUI on OS X that doesn't feel like it's just a reskinned Windows or GTK+ app, which makes it cumbersome to use.
And yet, it's exactly like you say. It has nothing to do with the base widgets. The problem is that to look native on OS X, you have to use widgets that only exist on OS X, like their merged titlebar+toolbar that changes and resizes the entire window content used on preferences dialogs, or the blue left navigation sidepanel, or the big question mark button, or the segmented control, or the color selection popup menu with the wide color boxes in each list item, or the combo box zoom setting in one segment of the status bar.
And then your labels have to be right-justified while the controls are left-justified against those. You have to add about three times as much spacing between widgets as on other platforms. You have to have a single menubar that's outside the main window, and always has a "program name" menu where your preferences option has to be, a view menu, a window menu, and a help menu.
You have to be sure to tie in to all the OS X only things like AppleScript, Core(Image, Audio, ...), dialog sheets that slide down on a window and then are only modal to just that one window, etc. Your message boxes can't have titles anymore, but everywhere else expects one.
Even if you tried to add the extra spacing and hack in those OS X only widgets to Windows and Linux, then the Windows/Linux versions would be super hideous and unnatural. By the time you customize all of that, the code's a bigger mess than just making two separate GUIs. Defeats the entire purpose of using a cross-platform toolkit.
Bottom line is that Apple just does way too much stuff differently to be able to craft a cross-platform app that looks great everywhere with no platform-specific customizations.
And now Metro, Gnome 3, Unity and KDE 4/5 are trying to go in entirely different directions as well. And iOS and Android are big targets now, too. Sadly, the dream of write-once, run-anywhere and look nice is dead.
Looking and feeling native involves so much more than just using native controls.
wxWidgets and SWT are about as native at it can be in a cross platform GUI library. I don't see why you'd need a screenshot of the go library, it would look the same as a typical wxWidgets or SWT app, which is to say, it uses native controls, but might not be designed according to the "common" UI conventions of the platform.
If this code works and is tested on OS X, Windows, and Linux, then one would assume the author has at least one test implementation, so it wouldn't be too far of a stretch to screenshot it, especially given that cross-platform toolkits have never, in my experience, actually looked or felt native on OS X.
.net itself is what you're thinking of.