Live data from Hacker News

Yoga: A cross-platform layout engine

code.facebook.com

91–100 of 168 posts

Re: Yoga: A cross-platform layout engine

#91

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…

I wonder why they didn't use new in C#, maybe they are under realtime constraint with unity on oculus and they use a pool.

Re: Yoga: A cross-platform layout engine

#92

Earlier quoted context omitted.

Just curious, when/why would you want to code UI layout in C# vs using a template ?

Hmm good question. The last time I did C# I did a little WPF and mostly Win or Web Forms so I'm not sure what the state of creating GUIs with C# / .Net is. If this technique affords me better cross platform support then it likely makes sense to use it but as far as using it versus a template I'm not really sure.

c# is generally for back end logic. UI's are generally done using templates on web/wpf/winforms platforms. Especially on the web it makes little sense to do layouts in c#

Re: Yoga: A cross-platform layout engine

#93

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 has been ported already.

https://www.npmjs.com/package/css-layout

Oddly enough there's no git repository. Only the npm package has the pure JS code. And the last release was from last year. Fortunately it looks it was easy to port, if one needs a more recent version.

Re: Yoga: A cross-platform layout engine

#94
post #62

One thing I've thought about recently is Facebook's Patent grants, and it's one thing that makes me uneasy about using any open source technology from Facebook like React (I currently do but am thinking to move to Preact because of the nicer MIT license and that it's analogous to React in many ways) because they're generally given a patent grant. I'm not a lawyer so I don't know if the grant would hold up in court si…

There's a deeper issue here I think (IANAL). If there is anything in Facebook's patent portfolio that is indeed "a patent owned by Facebook that is necessarily infringed by the [React] Software standing alone," then using Preact, which implements the same functionality using similar algorithms, may very well infringe on that patent. And... if a release of your software does not use React itself in favor of Preact, you were never given a license in the first place to that patent, so you'd be even more vulnerable to Facebook enforcing their IP rights!

If you sue a company with competent lawyers, their defensive patent portfolio will be unleashed on you to the greatest extent possible, whether you intentionally infringed or not. If you use technology similar to Angular and sued Google, you'd be in a similar position. Facebook's patent grants simply codify this, and so they've taken the blame for something that was always hanging over every developer's head with any patented software anywhere.

https://en.wikipedia.org/wiki/Software_patents_and_free_soft...

Re: Yoga: A cross-platform layout engine

#95
I wonder why the new C implementation is faster on Android than the old Java implementation, even though the former comes with some overhead for JNI and the inability for the ART ahead-of-time compiler to do any cross-module optimziation between Java and native code. Is it because C has structs, which java still doesn't have?

Re: Yoga: A cross-platform layout engine

#96

Earlier quoted context omitted.

Just curious, when/why would you want to code UI layout in C# vs using a template ?

Hmm good question. The last time I did C# I did a little WPF and mostly Win or Web Forms so I'm not sure what the state of creating GUIs with C# / .Net is. If this technique affords me better cross platform support then it likely makes sense to use it but as far as using it versus a template I'm not really sure.

XAML is the state of the art, which is cross-platform thanks to Xamarin.Forms.

Re: Yoga: A cross-platform layout engine

#97
> Yoga also does not support styling properties that have no impact on layout, such as color or background properties.

Does that mean that Yoga is too low level to be used directly by application developers? Who's the intended audience?

Re: Yoga: A cross-platform layout engine

#98
post #62

One thing I've thought about recently is Facebook's Patent grants, and it's one thing that makes me uneasy about using any open source technology from Facebook like React (I currently do but am thinking to move to Preact because of the nicer MIT license and that it's analogous to React in many ways) because they're generally given a patent grant. I'm not a lawyer so I don't know if the grant would hold up in court si…

Maybe I'm misunderstanding the license terms but I feel like this is a bit of a "Maserati Problem", at least, if you are not competing directly with Facebook. If you are worried you might want to sue Facebook for patent infringement some day, you could still use React today and switch to Preact or some other library "just in time".

Just because you are not competing with Facebook today does not mean that Facebook will not be competing with you tomorrow.

Re: Yoga: A cross-platform layout engine

#100
post #62

One thing I've thought about recently is Facebook's Patent grants, and it's one thing that makes me uneasy about using any open source technology from Facebook like React (I currently do but am thinking to move to Preact because of the nicer MIT license and that it's analogous to React in many ways) because they're generally given a patent grant. I'm not a lawyer so I don't know if the grant would hold up in court si…

Yes, given two libraries A and B, which are equal in all respects except one is encumbered with vague licensing talk, pick the one without! It's a good engineering practice, and it will ensure that we, as a community, evolve towards zero-licensing libraries.
Post reply on HN