Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Flow with TypeScript to avoid Facebook’s BSD Patents License #6411

Closed
PatrickJS opened this issue Aug 20, 2017 · 23 comments
Closed

Comments

@PatrickJS
Copy link

What problem does this feature solve?

Flow in under Facebook’s BSD Patents License and this project was built with it

What does the proposed API look like?

TypeScript which has the Apache License 2.0

@yyx990803
Copy link
Member

yyx990803 commented Aug 20, 2017

Flow is used only as a dev dependency, and flow syntax is stripped in the built files, so for end users of Vue (e.g. consuming from NPM) there is nothing related to Flow in the distributed code, which doesn't make them affected by Flow's license in any way.

The only concerning case would probably be someone forking Vue and thus using the source code directly - but even so, flow's own code (governed by its license/patent grant) is not distributed in any way either. I doubt that the mere usage of Flow's syntax is subject to its license.

I think this is a valid concern, but at this moment the logistic costs of migrating can be blocking factor. Maybe someone on the team who are familiar with both Flow/TS can evaluate how much effort that entails.

/cc @HerringtonDarkholme @ktsn @octref

@PatrickJS
Copy link
Author

PatrickJS commented Aug 20, 2017

That makes sense. What's interesting is that jsx is under Creative Commons Attribution 4.0 International License while Flow isn't really clear. If Vue.js does end up migrating to TypeScript I can also help with that effort.

@nickmessing
Copy link
Member

Considering the fact that typescript team members are interested in Vue (#5887) I would vote for migrating to TypeScript. However, I use flow on day-to-day basics and there is one great feature that I miss in TypeScript (probably more if I do some research). In flow you can use Return type of a function, in TS you cannot.

@HerringtonDarkholme
Copy link
Member

HI @gdi2290 , I think @yyx990803 has clear reasoning here. Let me explain some technical issue here.

Migrating to TypeScript is doable, but requires many changes at once.

We cannot use allowJS option in TS, because TS doesn't accept type annotation in JS as flow does. That means we will need to migrate in one single shot, including building system changes.

TS and Flow still have many subtle syntax differences. These differences are small, but ubiquitous. e.g. https://github.com/vuejs/vue/blob/dev/flow/compiler.js#L4 ?string in flow is string | undefined | null in TS.

Other potential issues might be TS/Flow's checking rules. e.g. Flow allows if (o.nonExist) { use(o.nonExist) } while TS does not. I don't know how much code will be impacted until trying to migrate.

@PatrickJS
Copy link
Author

I created an issue in Flow and they say it's under Facebook’s BSD+Patents License
facebook/flow#4661

most of the syntax for TypeScript and Flow are similar and in some cases TypeScript allows you to be more strict. If the TypeScript is interested in vue then perhaps vue can request some features in Flow that @nickmessing mentioned

@nickmessing
Copy link
Member

@gdi2290, All features I could find are already requested in the issues but looks like TypeScript team is really busy and they need to clear that 2.5k issues backlog :)

@refi64
Copy link

refi64 commented Aug 20, 2017

Forgive the random outside opinion, but would this really be worth it? Seems like the only benefit would be a potential licensing "problem" that doesn't really affect anything outside of Vue itself...

@nickmessing
Copy link
Member

@kirbyfan64, as @HerringtonDarkholme said, it's obviously too much human effort and need to be done during a big code freeze and most probably we don't have that much human effort available, but this is still open for discussion.

@manisenkov
Copy link

@yyx990803

...so for end users of Vue (e.g. consuming from NPM) there is nothing related to Flow in the distributed code

Actually whole src folder is distributed with NPM package as it is

"src",

However, not sure if this could be treated as something Flow-related for the end user.

@LinusBorg
Copy link
Member

LinusBorg commented Aug 24, 2017

I would be suprised to find that Facebook has any patent on their type annotation syntax, considering that this has been done before.

And since you are not actively using neither Flow nor the vue source files, you are not using anything flow-related anyway.

@russellr922
Copy link

@LinusBorg Flow's license is BSD with Patents, same as React:

The license granted hereunder will terminate, automatically and without notice,
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
directly or indirectly, or take a direct financial interest in, any Patent
Assertion: (i) against Facebook or any of its subsidiaries or corporate
affiliates, (ii) against any party if such Patent Assertion arises in whole or
in part from any software, technology, product or service of Facebook or any of
its subsidiaries or corporate affiliates, or (iii) against any party relating
to the Software. Notwithstanding the foregoing, if Facebook or any of its
subsidiaries or corporate affiliates files a lawsuit alleging patent
infringement against you in the first instance, and you respond by filing a
patent infringement counterclaim in that lawsuit against that party that is
unrelated to the Software, the license granted hereunder will not terminate
under section (i) of this paragraph due to such counterclaim.

Which in my opinion, means that any proprietary product you develop, Facebook can come in and develop the same thing without any fear of lawsuit. Because if you do file suit and you are using Flow (or React or any other BSD+Patent licensed Facebook software on GitHub) your license to use the software terminates, invalidating any proprietary claims you may have had.

TL;DR; yes, I think using the Flow syntax alone does impact Vue.js from a legal standpoint, but I'm not a lawyer, this is just my opinion.

@LinusBorg
Copy link
Member

LinusBorg commented Aug 24, 2017

Because if you do file suit and you are using Flow (or React or any other BSD+Patent licensed Facebook software on GitHub) your license to use the software terminates, invalidating any proprietary claims you may have had.

But you are not using Flow, are you? Nothing in Vue's code that you use contains any hint of Flow.

The fact that we (the Vue maintainers) used Flow in our build process to create these files, all while we had/have a licence to Flow, is of no concern to you. You are not using Flow or any of it's patented technologies (if there are any, no one could find applications so far).

Every other interpretation would be crazy, because it would mean that people who do not use the patented technology could get legal problems because of a product they use that was once build with those patents while it was legal. That's crazy. If that's true you should stop writing software alltogether because you can be sued for anything and everything any second.

That would mean that if someone held a patent to something used in webpack, you would have to stop using your already built files because they were once built with webpack while it was still legal.

@russellr922
Copy link

@LinusBorg, you may be right, like I said I'm not a lawyer or an expert in law. I just think their licensing goes against the general nature of open source, it's dumb that these types of threads and considerations even need to exist.

@corbinu
Copy link

corbinu commented Aug 24, 2017

I will say if we do decide to convert over I would be happy to help have had a lot of success/practice lately converting projects over and I am helping as much as I can on the eslint TypeScript compatibility work. I would be for this for a lot of reasons including the patent issues but understand if the majority/core team is not.

@sandangel
Copy link

sandangel commented Aug 26, 2017

How about Vue 3.0 with codebase rewriting in TS and has full TS support like Angular?

@PatrickJS
Copy link
Author

PatrickJS commented Aug 26, 2017

I'm down for Vue 3.0 being TypeScript then we can take learnings from Polymer 3
https://github.com/Polymer/polymer/blob/3.0-preview/lib/utils/async.js
https://github.com/Polymer/polymer/blob/3.0-preview/lib/utils/render-status.js

@amritk
Copy link

amritk commented Sep 6, 2017

I would be interested in helping convert to typescript as well if needed.

@khaled-nuur
Copy link

khaled-nuur commented Sep 11, 2017

doesn't it causes longer learning curve + more Angular-like nature?

starting with longer time waiting for the first update(Vue3). due to all Vue team learning, and experimenting this new technology. yes the coming ones may become faster.

because it makes TS must learnt technology before diving to Vue.js + it loses Vue one of it's greatest points over Angular and React (the shorter learning time), so I am against the idea of migrating TS

@PatrickJS
Copy link
Author

@khaled-nuur typescript would only be used for vue's source code similar to Flow which doesn't mean you need to use it. You still need to learn about types with Flow just as you would with TypeScript the difference is that one has more support and a bigger community

@corbinu
Copy link

corbinu commented Sep 11, 2017

@khaled-nuur Also my understanding is that Angular really tries to enforce full typing when you use TypeScript which to me is pretty silly as I feel like its ability to choose when and where to type is one of its strengths. For example I don't tend to type my application code much but when I break something into a module or component I type it just as I document it. That way 5 months from now when I make an application change I don't need to go reread that component. If that makes any sense. My understanding is Angular kinda more forces you into all or nothing

@PatrickJS
Copy link
Author

Here's an article about how "JavaScript libraries should be written in TypeScript". Just because the codebase is TypeScript doesn't mean the application developer needs to use TypeScript. Angular is more or less targeting enterprise developers which largely benefit from a TypeScript codebase. They also doubled down on decorators which looks better in TypeScript compared to ES6 so their code examples would always look better in TypeScript. They also support ES6 and ES5 but don't really advertise it much

// Angular es5 syntax
(function (app) {
    const AppComponent = ng.core
        .Component({
            selector: "my-app",
            template: "<h1>My First Angular 2 App</h1>"
        })
        .Class({
            constructor: function constructor() {}
        });

    app.AppModule = ng.core.NgModule({
        imports: [ng.platformBrowser.BrowserModule],
        declarations: [AppComponent],
        bootstrap: [AppComponent]
    }).Class({
        constructor: function constructor() {}
    });
}(window.app || (window.app = {})));

vs typescript

@Component({
  selector: "my-app",
  template: "<h1>My First Angular 2 App</h1>"
})
class AppComponent {
}

@NgModule({
  imports: [BrowserModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
class AppModule {}

Vue's codebase doesn't really mention that it's using a typed language so all of problems people are mentioning for TypeScript in this repo are already there with Flow. Even if Vue uses TypeScript they don't need to use decorators. If Vue did the API would look the same for example

https://github.com/kaorun343/vue-property-decorator
https://github.com/vuejs/vue-class-component

@mroch
Copy link

mroch commented Sep 22, 2017

we're going to be relicensing Flow under MIT: https://code.facebook.com/posts/300798627056246

hope this relieves the concerns here!

@yyx990803
Copy link
Member

@mroch wow, big news! I guess this can be closed for now then ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests