Questions about fltk.rs

Please keep in mind that I am still pretty much a novice to both Rust and the coding scene in general.

My current project requires that a decent GUI text editor be included in the code. Most likely I will have to develop it enough that it will work in WYSIWIG mode. After doing a lot of searching, it seems that the fltk.rs crate will be the most helpful, so I’ve been spending a lot of time watching videos and looking through the documentation in hopes that I can learn it well enough to use it in my project. One of the nicest features of the documentation is that one can go to github and find a long list of examples. Two of those examples are actually text editors written using fltk and one of those seems to be just what I want. Nice. Here’s a link to the example I’m talking about.

Question #1: What is and isn’t kosher when using code written by someone else? I will need to modify that code referenced above if I am to use it, but it will likely provide the base from which I work. Is it okay for me to use it this way?

Standard disclaimer: I am not a lawyer.

In general, code is copyrighted the moment it is written. That means that you do not have any right to use someone else's code in any capacity by default. Not even if it is posted publicly. Keep in mind that whilst "fair use" is a thing, it is not a concrete right. Fair use is a defense, which means it doesn't come up until you've been sued for copyright infringement and you're in front of a judge, and there is no rigid standard for deciding what is and is not fair use. That will be decided by the judge/jury, so you cannot safely depend on it unless you're willing to go to court. If in doubt, retain a lawyer.

This is where licenses come in. A license does give you rights to use code. The specific rights you get depend on the license. Using someone else's code requires that you first determine how that code is licensed, and then consider whether the license gives you the permissions you need.

Again, to emphasise: I am not a lawyer. All of this is my best-effort understanding, and it's what I would feel comfortable doing for myself, but if you really want to be certain, you will have to find and talk to an actual copyright lawyer.

In the specific case of the source file you linked, there is no license listed in the file itself. That's less than ideal, and an explicit notice would be clearer.

However, if you check the root directory, you'll find the LICENSE file for the fltk repository. My assumption is that this license covers the contents of the repository unless otherwise specified.

This file is a copy of the MIT license. It is one of the simplest and most permissive licenses. It lets you use the covered code as you please, provided you include a notice with all distributions with a copyright notice (i.e. giving credit for the code you used), and a copy of the license. It also explicitly disclaims all warranties possible (i.e. if the code runs over your dog, it's your problem, not the author's).

You will want to become familiar with at least the basic meaning of the common licenses. There's quite a few resources you can look at; search for something like "common open source licenses explained".

If you're using that example as a starting point, you'd want to include a notice like "Portions copyright © 2021 The fltk-rs Authors." or similar with your project as well as a copy of the license itself (including both in source form, and compiled form). But that's also true of any dependencies you use. There are things like cargo license that can help with identifying how your dependencies are licensed.

3 Likes

So, I understand that I will need to include the right citations and be careful to adhere to the license, but my main concern is whether this is something that is okay and common practice. I mean, if I simply copy this code and modify the elements I need to modify to make it fit my project, am I stepping out of line? Doing that will be a huge step toward completing that project, but I don't want to overstep the boundaries for the sake of convenience. Where's the right and wrong here?

That's the way I'd see it too. In my own jurisdiction (Germany), I'd feel comfortable just assuming this without consulting a lawyer, even :slight_smile:

How about opening an issue on the repository and asking the author for clarification? Even if the above assumption doesn't hold, he's the one who could give you an exemption (also, he's very active and friendly ;))

I guess the possibility of this is exactly one of the goals of open-source (not only GPL-like, but MIT-like too) - "if something's missing, feel free to make your own modifications, as long as you pay the necessary credit to the original".

I obviously can't speak for anyone other than myself, but here's how I personally look at it: examples are written to be used. If someone writes example code for their own library and then objects to people using it, then I would feel they've rather missed the point. Forget thinking twice, I wouldn't think once about using a provided example as a starting point for my own code.

When I release something as open source, I do so understanding I will not know how the code is used, who it is used by, or what it will be used for. I also understand that even if something I wrote ended up being used for something I object to[1], well that's just too damn bad. I set the conditions when I gave the code out, and I can't go and retroactively change my mind.

If an example is licensed under MIT, then I feel there is no moral (and certainly no legal) problem with my taking it and using it however I please, provided I satisfy the requirements of the license.

In general, I feel like the open source community largely operates on a "ask for forgiveness, not permission" basis. Without that, it'd be much harder to do things like fork projects, or make unsolicited improvements.


  1. e.g. creating an LLM-powered Teddy Ruxpin that uses sophisticated algorithms to wait until a child's parents are absent and then flood them with targeted ads and political misinformation. ↩︎

1 Like

This discussion has been good and this answer tends to satisfy me best. Thanks for chiming in on this topic, everyone.

That's not a bad suggestion. It would be good for me to interact with the author anyway. Thanks.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.