r/programming • • May 06 '19

Microsoft launches React Native for Windows

https://techcrunch.com/2019/05/06/microsoft-launches-react-native-for-windows/
187 Upvotes

114 comments sorted by

View all comments

Show parent comments

3

u/coderstephen May 07 '19

Except Python is a language/runtime, while React is a UI framework, so that comparison is unsatisfactory.

4

u/hiptobecubic May 07 '19

UI framework implemented in js... Which is a language/runtime.

3

u/hiptobecubic May 07 '19

Or if you can't zoom out enough to compare them, change it to "Qt native"

1

u/coderstephen May 08 '19

But it's not implemented in JS, at least in the case of React Native. React is more of an API/spec now, which may or may not be implemented in JS.

1

u/hiptobecubic May 09 '19

It literally says it is on the react native landing page.

1

u/coderstephen May 09 '19

I checked the landing page just now. Couldn't find it. All I found was

React Native lets you build mobile apps using only JavaScript.

Which tells you that all your code is written in JavaScript, but tells you nothing about how the framework itself is written. Checking GitHub language breakdown: https://github.com/facebook/react-native

  • 40.4% JavaScript

  • 24.6% Java

  • 14.3% Objective-C

  • 13.5% C++

Which is to be expected, because it is technically not possible to interface with native UI components using pure JavaScript, since the Android UI is a Java API, iOS is Objective-C, and so on.

1

u/hiptobecubic May 11 '19

I can't tell if you're trolling or just don't understand what a library or runtime is.

> Which tells you that all your code is written in JavaScript, but tells you nothing about how the framework itself is written.

Yes. Exactly. You write javascript. It runs that javascript in some javascript runtime, which is not "native" in any meaningful sense of the word, and uses the FFI to invoke additional code which is not written in javascript and not running in a javascript VM and might very well be "native" in the normal sense of the word. Literally all javascript works this way, not just react native. _Every_ interpreted language works this way. If that's the bar for being "native" then all code is native because at some point, it's causing the "real code" to be executed on a real physical processor in order to e.g. render "hello world" on your screen or send a packet over your network hardware.

Unless React Native is a _compiler_ that is reading javascript code and spitting out assembly that can be compiled into the appropriate instruction set for your machine, it's not any more native than any random javascript or python implementation. Being able to invoke a library written in C does not make your language "native."

1

u/coderstephen May 11 '19

I definitely don't intend to troll, I'm just trying to explain why I think my point of view is reasonable. So...

I can't tell if you're trolling or just don't understand what a library or runtime is.

Neither? My opinion is simply different than yours.

Judging by my brief poking around in the repo, there seems to be a lot more than thin FFI wrapper code going on here. Again, less than half of the react-native project is written in JS. I'm not sure why you think it's unfair to say that the project is not written in just JS.

It runs that javascript in some javascript runtime, which is not "native" in any meaningful sense of the word

All I'm saying is that the name "React Native" seems fair to me, because the project itself is not pure JS. Indeed, a substantial portion of it isn't. I'm not saying that the JS code itself is native. Because the "React Native" framework is a lot bigger than either some JS code or even a JS VM, but also includes a substantial amount of native code as well that is part of the framework's behavior, then I think the native label makes sense.

Unless React Native is a compiler that is reading javascript code and spitting out assembly that can be compiled into the appropriate instruction set for your machine, it's not any more native than any random javascript or python implementation.

This seems like a very strict view of "native". It sounds like you are saying that if an application isn't 100% native binary code, then it isn't native. You're free to use that definition, you do you and all, but I'm not sure anyone else defines it that way.

1

u/coderstephen May 11 '19

An interesting additional thought: We often distinguish between "native" apps vs web apps. Maybe "React Native" is using native in that sense of the word. Because of course, by a 100% strict definition, even native Android apps aren't native because they use Java, which runs in a VM.