Live data from Hacker News

Yoga: A cross-platform layout engine

code.facebook.com

51–60 of 168 posts

Re: Yoga: A cross-platform layout engine

#51

I like the concept and the C# code is just hands down the best example out of all of them (yet another reason I miss coding in C#). I'm curious though, will this be eventually ported to JavaScript? Yeah yeah I know "flexbox is already on the web!" but if you could write a layout in this fashion versus using style sheets then you could take it and directly apply it to any of your applications (even if you have to conv…

They totally could have done it clean like this for Swift and I struggle to understand why they did it in the old Obj-C way: extension methods with yg_ prefix, static constants instead of enums, unnecessary configuration after instantiation.

Re: Yoga: A cross-platform layout engine

#53

Looks nice but the naming is wrong. We shouldn't expropriate well known names for tech solutions

I agree with you wholeheartedly about the naming. This is becoming a serious issue with many different things. Try to search for info about the visual studio "Code" editor for example. Facts and common sense are not fashionable in this age though unfortunately as evidenced by your (current) low vote on your comment.

vscode.

Also:

It's not a "fact" that such names are a bad choice. It's an opinion. Personally I prefer evocative names, and that requires – almost by definition – to reuse words already in use.

It's also not "fashionable" or "trendy". To quote Aristoteles: "The young people today are rotten to the core, or they would have never named this software 'R'".

The alternative is the pharmaceutical naming system which includes a review to ensure that names are not just unique, but unlikely to confuse even with bad handwriting. The result is an endless stream of forgettable, but pronounceable, UUIDs with too many 'Z's.

(... and "Plan B", which is probably my favorite example of evocative naming).

Re: Yoga: A cross-platform layout engine

#54
Okay, question: can it perform the following task elegantly?

Say, I build a declarative tree describing a layout, and I render it. Now I remove one item from the tree. Can the layout engine efficiently remove the item from the view, and... (now it comes) provide an animation for it? As in, the item slowly losing opacity, then the surrounding items moving closer together? (Or a different animation depending on settings).

Of course, the opposite should also be possible (i.e., inserting an item).

Implement this, and we're a step beyond CSS, because so far this has not been possible (elegantly) in CSS. I.e., remove the element from the DOM tree, and it is gone immediately (without the animation). And no amount of CSS can fix this.

Re: Yoga: A cross-platform layout engine

#55
Why not use parallelism? Parallel layout tends to be a major speed boost in our experience, and we have a parallel implementation of flexbox already. See Meyerovich 2010 [1] for the basic idea; you can adopt it to flexbox relatively easily.

Additionally, I'm a bit skeptical about the use of C here: this stuff tends to end up exposed to the user and security-sensitive.

[1]: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.207...

Re: Yoga: A cross-platform layout engine

#56
I'd love to see this defined as a formal spec so it might be implemented in JS. Having access to raw layout calculations in React applications would solve the need to peek at the DOM all the time in so many cases.

Re: Yoga: A cross-platform layout engine

#57
post #47

I like the concept and the C# code is just hands down the best example out of all of them (yet another reason I miss coding in C#). I'm curious though, will this be eventually ported to JavaScript? Yeah yeah I know "flexbox is already on the web!" but if you could write a layout in this fashion versus using style sheets then you could take it and directly apply it to any of your applications (even if you have to conv…

> will this be eventually ported to JavaScript? It's already cross-platform; cross-language would probably be a little much to ask :)

> It's already cross-platform; cross-language would probably be a little much to ask :)

I'm not sure I follow; it's supported in multiple languages already. Am I missing something?

Re: Yoga: A cross-platform layout engine

#58
post #42
post #35

Earlier quoted context omitted.

(Original author of css-layout here) I've spend a few months playing with Cassowary before working on css-layout and had long chats with its creator Greg Badros and the people behind https://gridstylesheets.org/ . Cassowary underlying abstraction is a linear inequation solver. So you give it a bunch of constraints of the form ax + by + cz + d ## There are two innovations in Cassowary: 1) There's a concept of strength…

HN Comments are ephemeral... this would make a nice blog post!

They may be harder to find, but HN comments are probably less ephemeral that most blogs (that is, HN comments are more long-lasting and at the same "permalink"... seems that plenty of blogs fall off the internet after a few years).

Re: Yoga: A cross-platform layout engine

#59

I like the concept and the C# code is just hands down the best example out of all of them (yet another reason I miss coding in C#). I'm curious though, will this be eventually ported to JavaScript? Yeah yeah I know "flexbox is already on the web!" but if you could write a layout in this fashion versus using style sheets then you could take it and directly apply it to any of your applications (even if you have to conv…

Hopefully it does get ported to javascript. In the meantime, if you happen to use react, https://github.com/necolas/react-native-web is a good way to use react-native's styling approach (which uses css-layout under the hood) on the web.
Post reply on HN