Live data from Hacker News

React Native for Windows and Mac

microsoft.github.io

431–440 of 505 posts

Re: React Native for Windows and Mac

#431
post #422

Earlier quoted context omitted.

A lot of these "packages" are just silly though. Among the horde of dependencies in that web is `number-is-nan`. Behold its awesome functionality: https://www.npmjs.com/package/number-is-nan Want Array#filter/map/reduce? Why that'll be three separate packages: https://www.npmjs.com/package/array-filter https://www.npmjs.com/package/array-map https://www.npmjs.com/package/array-reduce It just seems to be the culture o…

The purpose of that kind of package is to provide a standalone implementation of a function. To criticize this organization, you would need to understand why people find that to be valuable and show a better approach. You’re attributing it to “culture” but there may be deeper, less arbitrary reasons. Look up “ponyfill” if you are interested in learning about it.

Wouldn’t the alternative simply be bigger libraries grouped around common functionality or extension points? Like jQuery or similar (only an example, not sure what is hip today).

I’d rather trust a fairly big library with an organized open source group behind it than thousands of small libraries by unknown developers.

Re: React Native for Windows and Mac

#432
post #396

Earlier quoted context omitted.

V8, Chromium and Blink are an Open Source projects that Google is one of the main contributors to, but they're not 'Google'. If Google went away tomorrow, V8, Chromium and Blink would still exist, and Microsoft would be able to use all projects.

Sure they are open source projects, but the majority of dev work is done on Google's dime. Google employs many of the most important people in these projects. Sure the code will still be there if Google gives up, but will anyone have the capacity to step up and maintain them?

Yes. Microsoft would hire them, and already is doing do.

There's plenty of commits to V8 from outside Google. Blink is a fork of a fork of a twenty year old project.

Re: React Native for Windows and Mac

#433
post #396

Earlier quoted context omitted.

V8, Chromium and Blink are an Open Source projects that Google is one of the main contributors to, but they're not 'Google'. If Google went away tomorrow, V8, Chromium and Blink would still exist, and Microsoft would be able to use all projects.

The problem isn't the projects going away, more so that Microsoft has no control over where those projects are headed. If Electron moves in a direction that works well for Google but not so well for Microsoft, they can't do much about it unless they want to pick up maintaining a full fork.

Google doesn't care about Electron, much like they don't care about node.js, despite those projects relying on tech Google contributes to. Whereas Microsoft does care about Electron.

Re: React Native for Windows and Mac

#434

Earlier quoted context omitted.

VSCode is a great example. We’ve already established that the average joe out there doesn’t care about whether an app is implemented in electron or not. But VSCode’s success at the expense of every other editor out there indicates that even developers don’t care that much. The important thing is features - which VSCode has, and the speed at which those features are developed and deployed on all platforms - where VSCo…

Because some things being good does not mean we shouldn't criticize the bad ones.

No, criticise whatever you want.

I'm just saying users don't care. They'll still use software that has the features they're looking for, on the platforms they use, as long as performance is acceptable.

I'm pushing back against the idea that performance nuts on HN who won't install a single electron app are somehow representative of the population at large.

Re: React Native for Windows and Mac

#435
post #332

Earlier quoted context omitted.

VSCode is a great example. We’ve already established that the average joe out there doesn’t care about whether an app is implemented in electron or not. But VSCode’s success at the expense of every other editor out there indicates that even developers don’t care that much. The important thing is features - which VSCode has, and the speed at which those features are developed and deployed on all platforms - where VSCo…

The day Microsoft releases Rust support for Visual Studio, VSCode gets kicked out of my PC. Also, I wonder how much the Electron love overlapps with VSCode, after all many of those developers were pushing for Atom before VSCode was born.

I expect things to go the other way. Visual Studio will eventually be phased out for VSCode or something like it.

I think Microsoft chose Chromium for Edge mostly because they have big plans for Electron.

Re: React Native for Windows and Mac

#436
post #411

Earlier quoted context omitted.

> `null` is only rarely used in JS, `undefined` is by far the more common one, and of course the types reflect which one is a possible value, so it's not like you can miss it by accident. That's not true, `undefined` is not even a keyword or type, `null` is what you would use if you wanted to specify a variable has "no value" in JS or JSON (again because `undefined` isn't a Type). The "undefined" value is only for sp…

Regarding the `if`, it only makes sense to test for things that the type actually contains. So if I have a type `User|undefined`, testing `if (user === undefined || user === null)` is pointless, as `null` is not part of that type. It would be different if it were. Similarly, it makes no sense to test a variable of `User` type for value `false`, like it would if the type were `User|boolean`, or even `User|false` which…

> So if I have a type `User|undefined`, testing `if (user === undefined || user === null)` is pointless, as `null` is not part of that type.

It's very relevant, your TypeScript definition is meaningless at runtime when it's executed JS where all TypeScript's type information is erased, the only checks are relevant are the runtime JS type checks.

> `if (user === undefined || user === null)` is pointless

Right, it is verbose & unecessary, so is only testing for `if (user === undefined)` which is inadequate and I don't know anyone who'd use it since using the recommended `if (user == null)` is shorter and more complete for testing if any value is not `null` or `undefined`. If you're validating JSON you should know that there is no `undefined` type in JSON, but any value could be `null`.

> From my experience, it is much more common to deal with `undefined` in the JS ecosystem, whether that is by omitting properties from objects, or explicitly assigning/returning `undefined` somewhere.

If a type want's to declare that property exists but doesn't have a value it would be `null`, which is also the only option you have in JSON to do so.

Your TypeScript definitions are for your code structure and API description so you can benefit from its static analysis, but you should be aware they do nothing at runtime where all Type annotations are erased so if you try to define your Vue component with an optional property, e.g:

    class MyComponent extends Vue
    {
        p1?:string;
        p2 = null;
    }
It gets stripped away completely but setting a null value instead will ensure the property exists and is made reactive:

    var MyComponent = /** @class */ (function (_super) {
        __extends(MyComponent, _super);
        function MyComponent() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            _this.p2 = null;
            return _this;
        }
        return MyComponent;
    }
It's important to know what guarantees TypeScript does for you, what effects the type annotations have and what their behavior is at runtime.

Re: React Native for Windows and Mac

#437
post #436

Earlier quoted context omitted.

Regarding the `if`, it only makes sense to test for things that the type actually contains. So if I have a type `User|undefined`, testing `if (user === undefined || user === null)` is pointless, as `null` is not part of that type. It would be different if it were. Similarly, it makes no sense to test a variable of `User` type for value `false`, like it would if the type were `User|boolean`, or even `User|false` which…

> So if I have a type `User|undefined`, testing `if (user === undefined || user === null)` is pointless, as `null` is not part of that type. It's very relevant, your TypeScript definition is meaningless at runtime when it's executed JS where all TypeScript's type information is erased, the only checks are relevant are the runtime JS type checks. > `if (user === undefined || user === null)` is pointless Right, it is v…

Yes, it is theoretically possible for a TypeScript type to be "wrong" and the underlying variable to have a different type.

But there are only a few ways in which that can happen:

- a bug in type definitions - a JS library with .d.ts files which "lie" about the actual types - this is no different than any other bug in a library, needs to be reported and fixed. In my experience, such bugs are not very common (I've yet to encounter one).

- non-validated external data (JSON coming from HTTP) - like I said, you have to validate external data (or assume that anything can be anything). You kinda have to do it in all languages, though ones with reflection and a deserializing library can do that somewhat automatically and throw a runtime error if the deserialization fails (although that is not full validation).

- incorrect explicit casts and using `any` - e.g. `const a: number = ('asdf' as any)`, but less stupid and more accidental. This is a bug in the casting code, similar to doing an incorrect `reinterpret_cast` in C++. There is usually little reason to do explicit casts in TypeScript code, outside of very small isolated pieces of code.

Which means you generally don't have to worry about any of this. Relying on those guarantees is good enough for 99+% of situations (I mean, some people even use dynamically typed languages and survive without doing tons of checks on every other line of code).

---

Testing stuff which is not expected (by the specified type) to be `null` for `null` is just as pointless as testing it for the number 10. There is just no "valid" way for the `null` to have gotten there (just like the number 10). It would be extremely paranoid and only add noise to the code.

If there is a valid way, then the type needs to be `T|null` (and then you need to test it), not `T`, otherwise it's a bug. For TypeScript code, this will be checked automatically, for JS library type definitions, it needs to be made correct manually.

Regarding JSON and undefined, you can omit properties in JSON. E.g. sometimes have {"user": {"name": "Bob", "email": "bob@example.com"}}, and sometimes just {"user": {"name": "Bob"}} without the email. Such an optional "email" can of course be expressed in TypeScript, and can be tested as `=== undefined`, which will return true if it's not there. And such a pattern of omitting properties from objects (not just JSON) is much more common in JS than assigning `null` to stuff.

You are much more likely to find a JS object where some property is sometimes there and sometimes not there but never `null`, than an object where it is always there but sometimes `null`. That's what I mean when I say `undefined` is much more common than `null` in the JS world. But neither is a problem, you just need to have types which correctly describe what values the properties can contain.

---

So typically none of this is a problem in practice, as long as you have correct type definitions for the JS libraries which you use (i.e. there is no bug in them, just like there should be no bugs in the library itself) and don't do funky casts with `any`.

Re: React Native for Windows and Mac

#438
post #197

Earlier quoted context omitted.

Until your first update. I assume you didn’t work on anything that has been released?

What happens when you do the first update? Have you used Expo?

Its not so bad. He is referring to RN updates, e.g. from 0.61.5 to 0.62

Its annoying, but I succeeded in upgrading in one project in about 1 hour. Just basically comparing the example code diff on github.

perhaps older version had more changes and weren't documented as well.

irrelevant comment: I hate Expo as it fails to be a helpful abstraction on top RN.

Re: React Native for Windows and Mac

#439
post #176

Earlier quoted context omitted.

Go can easily within a year fade away to be replaced with something else. Remember MongoDB?

MongoDB still seems to be around and kicking?

I'm still a MongoDB cerificated developer. The popularity has dropped as with the amount of positions available.

There may come a time when this applies to Go.

Re: React Native for Windows and Mac

#440
post #360

Earlier quoted context omitted.

Let me tell you a story... I was at a crossroads in 2008. I had been developing mostly in C for a decade and decided to pivot to being your standard “Enterprise Dev”. I had a choice between moving my career to C# or Java. I chose C# partly because of the bad stench of the cross platform Java IDEs at the time. Give me VS or Xcode any day over a Java based IDE. Photoshop definitely isn’t using a non native runtime. I d…

Have you heard about our lord and savior, vs code? People are choosing it over full blown vs. Also, I haven’t seen many happy xcode devs.

VS Code is winning because it's multiplatform and has great support for lots of languages. I'd say it's the best choice for 95% of programmers.

But for writing C# apps in a Windows computer, the old VS was already miles ahead back in 2010. It is a really good product. It had RAD tools, testing, deployment, source control, database migrations, all wrapped in a very snappy and convenient GUI that I still don't think VS Code replaces properly. As much as I love the command line and unix philosophy, there was something about such a complete IDE that made me very productive. All IMO of course.

However I strongly believe that VS Code will get better and better with time and be able to fully replace old VS even for this use case in the future.

Post reply on HN