Hacker Newsnew | past | comments | ask | show | jobs | submit | kayson's commentslogin

I'm very interested in (and a total novice in) cross platform GUI application development. Hadn't heard of GPUI, though I had heard of Tauri. I looked at the GPUI front page and saw this mess of almost-CSS method chaining... Surely there's a better way? This seems horrible to me.

> div() .flex() .flex_col() .gap_3() .bg(rgb(0x505050)) .size(px(500.0)) .justify_center() .items_center() .shadow_lg() .border_1() .border_color(rgb(0x0000ff)) .text_xl() .text_color(rgb(0xffffff)) .child(format!("Hello, {}!", &self.text)) .child( div() .flex() .gap_2() .child(div().size_8().bg(gpui::red())) .child(div().size_8().bg(gpui::green())) .child(div().size_8().bg(gpui::blue())) .child(div().size_8().bg(gpui::yellow())) .child(div().size_8().bg(gpui::black())) .child(div().size_8().bg(gpui::white())), )


IMHO Rust isn't a great language for describing UIs because it is too explicit in places that doesn't need to be for coding a UI. Which is why in Slint (another Rust UI framework) we opted for a DSL. The application logic stays in Rust, but the UI is described in a language designed for it.

Your example would look like this:

    export component Hello inherits Rectangle {
        in property <string> text: "World";
        width: 500px; height: 500px;
        background: #505050;
        border-width: 1px; border-color: blue;
        drop-shadow-blur: 15px; drop-shadow-color: #0008;
        VerticalLayout {
            alignment: center; spacing: 12px;
            Text { text: "Hello, \{root.text}!"; font-size: 20px; color: white; horizontal-alignment: center; }
            HorizontalLayout {
                alignment: center; spacing: 8px;
                for c in [#f00, #0f0, #00f, #ff0, #000, #fff]: Rectangle { width: 32px; height: 32px; background: c; }
            }
        }
    }
    
More on why we chose a DSL vs code in Rust: https://slint.dev/blog/domain-specific-language-vs-imperativ...

> Rust isn't a great language for describing UIs because it is too explicit in places that doesn't need to be for coding a UI.

That's is not about just Rust ... Any domain has its own optimal or sub-optimal language describing it. Criteria of optimality is a bit subjective of course. Like: INI, TOML, YAML, etc. are better (YMMV, again) for user facing configs than JSON or XML and so on.

I think that HTML is better for defining hierarchical UI structures and CSS and CSS selectors are (arguably again) better to define UI styling.

My Sciter[1] was initially using .FRM alike inputs (VisualBasic forms, good for IDE but bad for a human) but I quickly discovered that having styles, structure and code-behind-UI in single PL makes non-manageable mess. So Sciter uses HTML, CSS and JS we all familiar with. Not 100% match of course but good enough.

[1] https://sciter.com


I love Sciter, but the curse of Discord is bloated web.

They have no shame in deploying a 300 MB hot mess bundle.


My experience has been that DSLs don't scale well. For simple things they provide a veneer of ease-of-use but eventually they were an albatross with Chef just as they were with QML and Slint. With both Slint and various Qt bindings for Rust marshalling data between Rust and the UI is painful. With Slint you get the added bonus of things just not yet existing in the DSL. That's a result of both immaturity and a strong focus on mobile at the expense of desktop. But the result is same. gpui has a killer dock widget, QML has the primitives to approximate one, and it's pretty much a no-go with Slint (though there's a third-party dock widget for Slint it's written in C++).

Here's a more idiomatic version of the previous example. IME gpui (and iced) is a lot easier to extend than something with a DSL, and if you check out the gpui example you'll see that gpui provides convenient methods to get consistent styles vs the Slint example where you hardcode widths and sizes. Those hex color abbreviations give me a facial tic every single time.

    use gpui::{black,red,green,blue,yellow,white};

    let Self{text,..} = self;
    
    v_flex()
        .gap_3()
        .bg(rgb(0x505050))
        .size(px(500.0))
        .justify_center()
        .items_center()
        .shadow_lg()
        .border_1()
        .border_color(black())
        .text_xl()
        .text_color(white())
        .child(format!("Hello, {text}!"))
        .child(
            h_flex()
                .gap_2()
                .children(
                    [red(), green(), blue(), yellow(), black(), white()].map(|color|
                        div().size_8().bg(color)
                    )))

Slint is proprietary though, so that’s a dead end. I’m not going to use something which will inevitably be rug-pulled when you sell to private capital.

Slint is an open source, free software. The whole framework is on GitHub. A rug pull can't take back what's already released, and one could always fork if needed.

Btw, a rug pull can happen under even the most permissive licenses. As we've seen in the past with some project changing license or direction. That's more or less already happened with GPUI when Zed refocused development on its own needs rather than other GPUI users resulting in several forks.


I'm not sure it matters anymore unfortunately. I've vibe coded a few apps using gpui-kit and it works well. It helps that gpui-kit provides a number of high quality components (e.g. the data table is especially good). But even where it doesn't (e.g. log output) Opus 5.5 was able to easily write one that worked perfectly.

It even added ANSI colour support... which I am still on the fence about but it did make the very good point that it means the logging is exactly the same in GUI and CLI mode.


isn't that basically QML?

> Surely there's a better way?

I'd like to know it. I don't think that it can be substantially better. You have to compromise between the amount of customization you are allowed to do and the amount of options you have to pick values for.

I can't vouch for GPUI, I don't know how good its compromise is, but it bears enough similarities to other modern UI-toolkits. I don't think there is a better way, but if you know one, I'd like to know about it.

And, well, don't forget, it is a front-page example, that is not necessarily an example how one should compose their code, it demonstrates what you can do with GPUI. In real life code you'd probably move those children's construction into separate named functions, maybe you'd use some predefined styles to apply to individual elements, instead of picking fg/bg/text-colors, maybe sizes and some other attributes for each one explicitly, and maybe some other tricks.


One improvement could be a better way to group and elide units, e.g.

Instead of

.border_1().border_color(rgb(0x0000ff))

You get

.border(1 0x0000ff)

(guess, this can only be in a macro)

Or at least have "color" which understands that it's allied to border instead of having to repeat "border"

> I don't think that it can be substantially better

Don't give up too early, there is no way it can't be, we don't really have any good systems optimized for ergonomics to reach anything great


> .border(1 0x0000ff)

After 10 or so of those you'll start dreaming of

   border-left: 2px solid rgb(0 0 100%);
right?

If you're dreaming, why would you stop at that when you could dream of much more visually compelling solid left thick border in a single symbol

┠

or more explicitly

├2

that'd be perfectly paired with a dream-like visual designer that doesn't exist?


All a language needs to be good at expressing UIs is some sort of tail lambda syntax like Swift and Kotlin. It's the perfect way to express a tree structure (which is essentially all UI) while also being in a true programming language (as opposed to a markup language like XML).

This is basically what coding UI in Bevy was like before the `bsn!` macro

Well, keep in mind that you’re not expected to have the entire UI in one statement. You’re supposed to break this up into functions. That’s why stuff like Flutter and SwiftUI work.

Also, this is basically what Tailwind code looks like.


That's a result of the borrow checker meeting dev ergonomics. Method chaining/functional style ks extremely common. GPUI is also fairly low level, it lets you do a ton of things!

I'm never going to complain about SwiftUI again

HTML and CSS, for all their faults, are the best layout engine we have.

Someone needs close the loop and make an HTML/CSS to GPUI transpiler

You mean this? https://gpuix.dev

So, Blitz? It's by Dioxus Labs and converts HTML and CSS into native Rust rendering like GPUI.

Honestly I'd pick this over whatever is going on with tailwind.

On a more serious note I feel like it's not bad but could be improved if they managed to break it down by styling domain (sort of like SwiftUI).

Something along the lines of .flex(gap: 2).text(size: "xl", color: ...)


honestly I'm not sure why they didn't choose to define a curated subset of HTML/CSS and use a parser. That's what the code is defining anyway

One person's mess is another person's Tailwind

It is a pretty terrible title, but the article is interesting

I also found it interesting, and the title pretty much describe what happened? I don’t see the problem


I would hardly draw that conclusion from this paper. It's a meta analysis of a handful of studies with fairly low sample sizes, and it wasn't immediately clear that there was any controlling factor wrt amount consumed. There are also a lot of statements pointing out there was no statistically significant difference for various metrics...


That doesn't preclude their point from being true.


It definitely sounds like Claude.


The EE/IC Design part of me loves this for trying to build a community around what is typically a very opaque and secretive industry. The social justice / millenial part of me hates this for being funded by high frequency trading, of all things. What a colossal waste of resources.


>>The social justice / millenial part of me hates this for being funded by high frequency trading, of all things. What a colossal waste of resources.

It's more efficient now than it used to be - by which I mean the total taken by HFTs is lower than what people used to pay in spreads and commisions. Price discovery is better (you get closer to a fair price if you trade) and spreads are lower. The whole industry that used to prey on spreads and ignorance of retail investors is gone. What not to like about HFT?


The HFT industry creates an investment opportunity that's somewhat detached from business fundamentals. If you can trade on the volatility alone, you no longer need to pick investments based on their future prospects and behaviour.


The upwards money funnel?

Maybe they're both bad?


I work for an HFT (not Jane Street) so I am biased, but we (the HFT industry as a whole) are quite small compared to big tech.

I’d estimate the total global HFT revenue to be 100 billion dollars a year, which is less than Apple and a tiny percentage of all big tech combined.


I would love to talk more with you about HFT work :) i am working in one myself! Please email [email protected] if you wanna have a chat!


Last I checked, Apple makes arguably useful products like smartphones and laptops.

Though admittedly the former have turned into pocket attention black holes (and enragement/slot machines) and Apple itself created the scourge of public Facetime calls.


I know some people don't see these as benefits (compared to "useful products like smartphones"), but we do cause instrument pricing to be more accurate and a thinner buy/sell spread and greatly increase liquidity.


It might be helpful to explain in plain language what you mean by increasing liquidity. As I understand it, marginal spread reductions only marginally improve your ability to sell at or near a particular price, and they provide no benefit to you if no one is buying near your sell price, or if there aren't enough buyers available overall.

But it would be interesting to see some quantitative data on the effect.

Increasing volatility and enabling fast algorithmic trading may not be good things overall, even if some traders benefit.

And as I noted, if you care about fairness in an online game, usually you try to remove the penalty effects from long ping times (or the bonus effects from short ping.)


That's a bad thing. When transaction costs were high the market didn't own society as much.


How is this any more of an upwards money funnel than the prohibitively expensive spreads and commissions that hindered lay access to the markets?


what do you mean by bad? you want someone to be on the other side of every investment you make...for free? why don't you do this yourself?


There is a lot of value in markets being efficient and cheap to trade in. Someone needs to do the job. The cheaper the job is done the better.

Same goes for market making.

If someone is getting rich providing that service - great! Additional bonus is that it's usually very smart people getting the money.


>>The social justice / millenial part of me hates this for being funded by high frequency trading, of all things. What a colossal waste of resources.

HFT makes the market more efficient, just like the AI eliminating jobs makes business more efficient. It's been numbing watching HN gladly sacrifice it's own to the altar of AI over and over. There is no moral high ground.

Personally as a retail quant, it's really rewarding to build models that extract edge from the market using the very AI tools that have eliminated all hope of ever re-entering the tech-field absent being an entrepreneurial founder.


i remember trading a us stock twenty years ago, i don't live in the us, i used a discount broker, the flat commission was something like $20+percentage of trade. this was significantly after there had apparently a massive drop in costs.

there is some kind of amnesia that exists with things that used to cost massive amounts but are now close to free. it is just not possible to explain to someone that in the recent past, most people were just unable to own stocks because of costs.


HFT isn't necessary for cheap online trading. You can have bulk transactions execute once per day for very low cost and that's good enough for an efficient market. Companies spending billions to beat other bidders by milliseconds is just rent extraction with computers.


it isn't good enough for an efficient market. this is a common idea amongst people who have never traded. if it was possible to trade this way, it would happen already. this is how some non-equity markets trade. equities do not trade this way because people do not want it. the system we already have has ludicrously low costs.


> because people do not want it

No, it's because people who stand to make money off it want it.

Society is full of examples of things that people want and that would save money and make a lot of sense that are blocked by people rent seeking off the status quo. Free tax filing provided by the government is one particularly obvious example.


Of course...they want to make money off it so they exploit everyone...but no-one else wants to make money selling it cheaper...

No, the problem is that people see rent-seeking behaviour everywhere where it doesn't exist. If you think you can do it better...do it.


"Do it better" doesn't work for monopolies. A company offering trades at lower intervals doesn't work when the NYSE etc. controls the actual platform, the minimum fees, the granularity of transactions, etc.


HFT is zero sum whereas the resources could be invested in net positives for society


The core problem is that large numbers of people trade for effectively no good reason. Because of HFT, these people are now less screwed than they were previously. The "house" is competitive.

Yes, it's a profitable business for HFT. I'm not too bothered by that.

If you want to direct your ire somewhere, direct it at companies like Robinhood that are gamifying financial markets.


> Yes, it's a profitable business for HFT

Wait till you see what the exchanges make.


No more zero sum than two parties exchanging one thing for another.


I don't know what typical HFT margins actually look like, but is there a tangible benefit to markets being 1% more efficient?


Things are a bit cheaper. It's pretty diffuse, but then so are the supposed harms they perpetrate as well. HFT is realistically a tiny part of modern finance. Huge numbers of professional traders made in total much more money doing the same job before it was automated.


Yes, more liquidity is always good, and it’s a cascading effect of everyone competing to be a little more efficient than the next guy.


> more liquidity is always good

Strong disagree. Liquidity at the level of milliseconds means insider trading and other information disparity is more profitable and encourages people to make rash decisions on incomplete information rather than well informed decision.

I'd love go see any information that proves that trades at the millisecond level lead to measurable improvements over, say, trades executing once per hour.


They seem to lead to measurable improvements for HFT companies, who seem to benefit from incrementally faster information and execution, and high volume (which might be reduced if trades were hourly.)

It might be harder for HFT to make money if trades were processed in random order on the hour, though they would probably still have an edge.

Online games that care about fairness try not to turn into a competition for the lowest ping time.


Good outcomes for HFT companies doesn't mean good outcomes for the market.

The government abandoning free tax filing software is GREAT for Intuit - they make a lot of money off it. It's awful for the rest of the population and the country as a whole.


As I understand it, liquidity requires buyers, so middlemen (HFT) with a smaller spread than traditional brokers (because of speed and volume) might increase the number of buyers slightly. I'd like to see quantification for this oft-repeated claim of "increased liquidity", which seems fairly marginal at this point.


If the spread is 1% smaller, then someone saves 1%. Maybe.


There is an open source silicon community built around multi-project wafer shuttles that has nothing to do with HFT.


Do you mind sharing them and what they do?


Presumably Tiny Tapeout. https://tinytapeout.com/

They group dozens to hundreds of designs on one chip. The end result is that even hobbyists can afford to have their small ASIC on real silicon. It's still expensive but it's within reach of a serious enthusiast with a steady job.

https://app.tinytapeout.com/calculator The number of "devkits" is the number of chips you'll get, the number of tiles is the size of your design. You can see how many tiles current projects use here: https://app.tinytapeout.com/shuttles/ttsky26d


Yes, tiny tapeout.

There is also a FOSSi matrix chat group: https://element.fossi-chat.org/


thanks!


[flagged]


this reply isn't in good faith. OP is being self critical examining contradictions of living in complex interdependent societies. why are your queries so aggressively factional?


There is a very vocal minority of folks that when they come across a comment that at all looks like an opponent of ancap [1], they become unhinged, even in this case where the GP was being internally reflective about their own beliefs.

The irony has most likely circled their drain (which just goes into a creek anyways).

[1] https://en.wikipedia.org/wiki/Anarcho-capitalism


Which is especially ironic when they bring up an example like Cuba, where at least today, you can’t really say whether the policies or de facto sanctioning it receives are at fault for the current economic state.


they just said a planned economy where people's judgements of what is "valuable" allocate resources would not be a good idea, i dont see how that is "ancap" nor really all that wrong?


> You think you could do better by having a planned economy

Nobody mentioned that crazy scenario so why bring it up?

BTW the USA is already a planned economy.


I think they mean a planned economy in the sense of the Soviet Union. The USA is not that, not even close.


I don’t think Jane Street does high frequency trading. I think you might be thinking of Citadel or HRT. Jane Street is more of an old-school quant hedge fund, no?


Their bread and butter was, and as far as I know still is, trading in ETFs and ADRs. These things have a mechanism to create and redeem in exchange with underlying securities. This means one can make some money arbitraging differences between the bundle and components.

As this game got more competitive they seem to have branched out into other kinds of business including HFT.


The page says their hardware team builds the fastest trading systems on the planet. Jane Street does HFT.


It's even worse than just the same flight number. Both were at PHX, one landing, one taking off at the same time. Kudos to a clever ATC for preventing what could've been a catastrophe: https://youtu.be/93lLXNsWp9Q


The YouTube video you link to is actually about a separate incident from the one described in the article. The video is about an incident involving two AAL2482s near Phoenix; the article is about an incident involving two AA5083s near Providence.

It's the same idea though; one was inbound, the other outbound, and ATC had to distinguish between the two.

[edit: Corrected locations.]


The probability of it becoming a catastrophe was infinitesimally low with the existence of TCAS.


Not to mention the huge WTF factor of them being in different parts of their flight and the instant issues that would cause when the ATCs try to do anything with them.

"Hey why did you just tell a flight that's on approach to taxi"

"What do you mean they're right here?"

"No they're on final you twat"

"No this is Patrick"

????????

<issue straightened out>


I wonder if the same reverse code execution risk applies to the VSCodium extensions


I very much dislike this extension because it uses a built-in ssh client that is far from feature complete and does a lot of reinventing the wheel. Microsoft's extension uses the system ssh binary, as does https://open-vsx.org/extension/aergic/zygos-vscodium which I much prefer. After discovering the latter, I uninstalled VSCode and have fully moved to VSCodium.


In practice, if I don't use the terminal from inside the editor, what are the advantages of this extension compared to the other one?


Security of using a battle tested ssh binary vs whatever random javascript library is being used.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: