
Apple is patenting Swift features - maxdesiatov
https://forums.swift.org/t/apple-is-indeed-patenting-swift-features/19779
======
oflannabhra
Chris Lattner has commented on the OP:

\-----

Disclaimer: I'm not an apple employee and not am not lawyer, this is just my
understanding of the situation having spent lots of time talking to lawyers
and other experts about this:

I agree with much of the sentiment that software patents are often silly and
the system is broken in many ways. This patent is a reasonable example of that
(patenting syntactic sugar for monads, really?). I have no idea if there is
prior art, but I wouldn't be surprised. For sake of discussion, lets assume
the patent is valid.

Even if I and others don't like it, the software patent system exists. As is
pointed out upthread, one of the major reasons that Swift uses the Apache 2
license is to provide more certainty for the community w.r.t. licensing and
patents. An additional bonus of the Apache 2 license is that the open source
project as a whole benefits from companies having and contributing their
patents under the terms of the license: to say more directly, it is good for
the Swift project that Apple has this patent and has contributed it to the
project.

The reason for this is the Apache patent revocation clause 1, the end of
bullet 3:

>If You institute patent litigation against any entity (including a cross-
claim or counterclaim in a lawsuit) alleging that the Work or a Contribution
incorporated within the Work constitutes direct or contributory patent
infringement, then any patent licenses granted to You under this License for
that Work shall terminate as of the date such litigation is filed.

This basically says that if someone sues someone else over Swift then they
lose access to the patents contributed to the project, and are therefore
subject to countersuits. This is a significant part of the protection that the
Apache license provides (it is a big deterent to lawsuits in general) but it
only has teeth if there are actually patents in play!

The LLVM.org community is actively working on a multi-year relicensing effort
specifically to achieve these sorts of projects for LLVM as well.

-Chris

\-----

Am I misreading this to mean that if _Apple_ sues someone for infringement
over the patents they have been granted, they immediately lose those patents?

~~~
lmilcin
What you misread is that the patent is awarded to Apple, not Swift. Apple is
not being released under Apache 2 license and Apple is not restricted to using
the patent only for Swift. If they decide tomorrow to have another language
that is not being released under Apache 2 license then there is nothing
stopping them from using this feature as the patent is already theirs.

Also, has anybody noticed that every single language in existence borrows
features from some other language FOR FREE? If all languages started patenting
their features then we soon will be completely boggled with lawsuits or unable
to invent new, better languages as they will not be able to use already
established convenient features.

There are only this many simple convenient ways to denote programming language
features. There is limited number of single character operators and ways you
can organize them. Granting patents to single characters is just stupid.

~~~
fnord123
> What you misread is that the patent is awarded to Apple, not Swift. Apple is
> not being released under Apache 2 license and Apple is not restricted to
> using the patent only for Swift. If they decide tomorrow to have another
> language that is not being released under Apache 2 license then there is
> nothing stopping them from using this feature as the patent is already
> theirs.

This is wrong. The license says:

>3\. Grant of Patent License. Subject to the terms and conditions of this
License, each Contributor hereby grants to You a perpetual, worldwide, non-
exclusive, no-charge, royalty-free, irrevocable (except as stated in this
section) patent license to make, have made, use, offer to sell, sell, import,
and otherwise transfer the Work, where such license applies only to those
patent claims licensable by such Contributor that are necessarily infringed by
their Contribution(s) alone or by combination of their Contribution(s) with
the Work to which such Contribution(s) was submitted.

'Each Contributor heareby grants to you, ... licence ... to use ... the Work
....'

However, I am very much not a lawyer. Like Chris, I do talk to IP lawyers as
part of my work.

~~~
lmilcin
The issue is you cannot make a language that uses the feature. It doesn't
matter if you are user of Swift or not. The license only grants you the
ability to use the patented feature as long as you are using it as part of the
licensed software.

------
fabianhjr
Just to bring clarity on what has been patented on one of the patents:

    
    
        Monad Maybe where
            Nothing  >>= _ = Nothing
            (Just x) >>= f = f x
    

Those three lines, implementing the Maybe Monad/bind operation, are
commonplace in all functional languages. (They just called it Optional instead
of Maybe and "chaining" instead of "bind"/>>=)

( [https://docs.swift.org/swift-
book/LanguageGuide/OptionalChai...](https://docs.swift.org/swift-
book/LanguageGuide/OptionalChaining.html) )

EDIT:

The second one linked is a package manager —
[https://patents.google.com/patent/US9329841B2/en?oq=9%2c329%...](https://patents.google.com/patent/US9329841B2/en?oq=9%2c329%2c841)

The third one is "a programing language that combines elements from C and
Objective-C", sounds like a broad claim on swift —
[https://patents.google.com/patent/US9329844B2/](https://patents.google.com/patent/US9329844B2/)

~~~
pnw_hazor
Your example can be implemented in many different ways. This patent claims one
or more ways but not all of them.

1\. A non-transitory computer-readable medium with instructions stored
therein, the instructions, when executed by a processor, cause the processor
to perform operations comprising:

receiving a first request to compile a first set of program instructions coded
in a first high-level language, the first high-level language a C language
based object-oriented programming language;

receiving a second request to compile a second set of program instructions
related to the first set of program instructions, the second set of program
instructions coded in a second high-level language including object-oriented
elements and procedural elements, wherein the second set of program
instructions includes a data type provided by the second high-level language
to indicate absence of a value of any type;

compiling the first set of program instructions and the second set of program
instructions using a modular compilation system including multiple front-end
compilers, the first set of program instructions compiled into a first
intermediate representation of the first set of program instructions and the
second set of program instructions compiled into a second intermediate
representation of the second set of program instructions;

linking the first and second intermediate representations; and

compiling the first and second intermediate representations using a back-end
compiler that is specific to a target processor.

------
saagarjha
I'm having a hard time getting a clear picture what this actually entails. I
am in violation if I reimplement Swift without forking the project (i.e. a
"clean room reimplementation")? If I'm designing my own language, am I no
longer allowed to include optional chaining? If so, I'm pretty disappointed
with this direction, since it runs counter to the entire point of accessible
programming languages, including many of the ideas that Swift itself uses.
Imagine if there were patents on C: software development would be far further
behind than it is today, because nobody would be able to make a compiler for
it or reuse its syntax or features in any new programming languages. I'm not
seeing any benefits aside from a vague "it protects Swift users from patent
trolls", but I'm not sure I understand how this argument works.

~~~
maxdesiatov
Exactly this, thank you for summarizing this so well! I've tried to clarify
this exact point at Swift Forums, but I haven't seen even a clarifying answer
from anyone in the core team on this point. Everyone says "it protects Swift",
but looks like this protection comes at a cost of the overall ecosystem.

~~~
dom96
And this is one very real reason to avoid languages owned by huge companies
like Google's Go and Apple's Swift. They can and will do evil things, instead
of supporting them please consider supporting smaller languages which are
often just as good or better as Swift/Go.

~~~
saagarjha
Such as? Many of the newer languages I’m seeing, notably Swift and Go, but
also TypeScript, ReasonML, and Rust have their development backed by one
corporation.

~~~
niutech
Such as Julia ([https://julialang.org/](https://julialang.org/)), which is
general-purpose and open-source.

~~~
gcb0
> julialang.org > no mention of "license" > "Julia is a NumFocus project"

it is a non-profit corporation, but still a corporation. Whose life depend on
donations from the owners of the other languages you compared julia against.

------
dmos62
These patents seem to be a countermeasure against patent trolls, since the
code uses the Apache license. Quoting from link:

> Apache license gives the right to use patents required to use the code
> (assuming the original author had those rights), and the code implementing
> optional chaining in the compiler is Apache licensed. So, the only thing
> Apple having a patent on optional chaining does is to stop frivolous suits
> from patent trolls. It can't be used for any kind of nefarious power play by
> Apple, which is what OP was worried about.

~~~
hdra
Thats not the only thing, no? Doesn't it also prevent e.g. other
people/company from including that feature in their own programming language
that doesn't use Swift at all?

~~~
riskable
Yes. This, exactly.

By patenting this language feature Apple has very clearly stated that they are
"making a claim of ownership" as it were of this feature across all languages
and non-derivative implementations.

...which is a perfect example of why software patents shouldn't exist in the
first place. One could implement this feature in any number of novel, unique
ways therefore the patent is nothing more than a claim on a _broad concept_
rather than _a specific implementation_ (which is what patents are supposed to
cover).

The paradox of patents on software is this: If the patent covers what it's
supposed to cover (a specific implementation) the patent will be useless
because anyone could implement what amounts to the same thing using different
methods, languages, whatever. If the patent covers _a broad concept_ it will
prevent anyone from using it or _innovating in that entire domain_ until the
patent expires. Completely defeating the purpose of having patents in the
first place. It will also likely (after millions upon millions of dollars
wasted in lawsuits) be ruled invalid as being _overly broad_.

Software patents are inherently a bad idea and should be done away with.

~~~
solarkraft
Can't you make a pretty similar argument about all types of patents?

~~~
naringas
it wouldn't be quite the same because software does not have physical material
properties. IMO this difference is crucial.

~~~
pnw_hazor
So-called software patents are always drafted as machines that can perform the
claimed actions. These machines are comprised of one or more hardware
components, including some hardware components that can execute machine
readable instructions.

(There really is no such thing as a software patent.)

~~~
pbhjpbhj
In Europe we do manage to make that distinction, though it is nuanced, and it
specifically excludes the "program on a media" or "program in the physical
memory of a computer" methods of trying to make all software appear to be
physically technological.

~~~
pnw_hazor
True, through many well-drafted US "software patents" can be successfully
prosecuted in the EU without too much trouble.

------
uberman
I don't quite understand.

The patent (9,952,841) seems to be about the language swift.

There _is_ mention about language features describing the language, but I
don't see a specific claim to any of them.

"optionals chaining" (the feature that everyone is alarmed about) is just one
of the features listed. Other features mentioned include an "IDE" and
"unicode" as well as support for "functions".

Am I missing something? Where is the claim on an specific language
characteristic?

~~~
DannyBee
IP lawyer here. You should ignore everything but the claims, and see what the
claims say.

So stare at
[https://patents.google.com/patent/US9952841B2/en](https://patents.google.com/patent/US9952841B2/en)

and look only at the claims.

To me, that set of claims is ... worrying

~~~
2_listerine_pls
Could you recomend me a book or course on how to file an utility patent? I
took a mooc explaining the overall process but it lacks details.

~~~
DannyBee
You really really really don't want to do this if you can avoid it.

It's not because there is magic here, it's because the set of rules,
regulations, and interpretations to follow is voluminous.

The document you want is called the MPEP.
[https://www.uspto.gov/web/offices/pac/mpep/index.html](https://www.uspto.gov/web/offices/pac/mpep/index.html)

This covers the rules/regulations/interpretations/etc that they will expect
you to know/follow, and examiners to know/follow. In that sense, it literally
does cover everything you'd need to know to do this right, and how the
examiner/etc will look at your patent application, etc. It's even
understandable by normal human beings and goes to great lengths to explain its
reasoning and the case law that supports their views.

However, it's also thousands of pages.

Now, it's definitely possible and in my experience, examiners are fairly nice
to pro-se applicants and try to be helpful.

But this would really be a thing you'd want to have to spend a significant
amount of time doing. For the vast majority of people, it's much more
effective to hire someone who will charge a fixed fee.

(for a single person filing a patent for the firs time, you'd qualify as a
micro-entity, so most of your fees would be the lawyer/agent for sure)

But, if you decide to do it, that's the document you want.

(And just as a disclaimer: i don't make a living patenting stuff and think
patents in general hurt a lot more than they help. So i'm really not the type
to tell you to go spend money on a patent lawyer if i can avoid it)

------
duncanawoods
Can we setup the equivalent of
[https://www.openinventionnetwork.com/](https://www.openinventionnetwork.com/)
for programming language design?

If the patents are to defend the language then they should have no issue
donating them to a dedidicated org which gives transparent and iron clad
guarantee that they can never be used aggressively. If not, I expect them to
pop in the next Apple vs. X thermonuclear ligigation where any and every bit
of IP gets used as a weapon.

If we can't fix software patents in the courts then it might come down to us
the devs to reject any language or API that doesn't sign up to into the
appropriate non-agression pact. We need something similar for API copyright
too. We are on a bad path right now where the big orgs have every incentive to
be less open and more litigious.

~~~
thekingofh
Apache License 2.0 is as good as donating it. Just now, nobody can sue anyone
else for that design feature.

Edit: actually, see below.

~~~
solomatov
IANAL, but as far as I understand Apache 2.0, it grants patent license only in
cases which were used in the original code, not universally.

~~~
thekingofh
You know what. I looked again at the license. I think this is the first time
I've noticed a flaw in the Apache 2.0 license. I think you are right. Derived
works is described as: "Derivative Works" shall mean any work, whether in
Source or Object form, that is based on (or derived from) the Work and for
which the editorial revisions, annotations, elaborations, or other
modifications represent, as a whole, an original work of authorship. For the
purposes of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of, the
Work and Derivative Works thereof."

------
nonsince
This feature wasn’t even invented in Swift, the fact that a patent was granted
on it shows the sorry state of technical policy making

~~~
swiley
I think American patents changed some time in the past decade to match how
they’re done in the rest of the world; The first person to patent the thing
gets the rights completely regardless of the time or person the implementation
is associated with.

~~~
brlewis
Prior art still invalidates patents AFAIK. Unless there's some recent Fed
Circuit decision that changes that.

------
WalterBright
This is why the D programming language is Boost licensed. Many other languages
are adopting D features we could have patented, but did not and will not.

------
thekingofh
It looks like there is an unintended consequence of the Apache License 2.0 of
allowing a company to patent some functionality, and the only way to acquire
that patent is to keep your implementation as a close fork of the original
derived work. The question is, whether or not the patent grant for just using
swift (downloading and running it), can cover other development work that is
not associated with swift. If not then Apache License 2.0 actually seems to
paradoxically reinforce the situation it is trying to avoid by tying
implementation and copyright directly to patents, thereby boosting patents as
a way to squash other open source projects. Any comment by an Apache person
would be greatly appreciated.

~~~
fnord123
>3\. Grant of Patent License. Subject to the terms and conditions of this
License, each Contributor hereby grants to You a perpetual, worldwide, non-
exclusive, no-charge, royalty-free, irrevocable (except as stated in this
section) patent license to make, have made, use, offer to sell, sell, import,
and otherwise transfer the Work, where such license applies only to those
patent claims licensable by such Contributor that are necessarily infringed by
their Contribution(s) alone or by combination of their Contribution(s) with
the Work to which such Contribution(s) was submitted. If You institute patent
litigation against any entity (including a cross-claim or counterclaim in a
lawsuit) alleging that the Work or a Contribution incorporated within the Work
constitutes direct or contributory patent infringement, then any patent
licenses granted to You under this License for that Work shall terminate as of
the date such litigation is filed.

Apple is a Contributor. They have given a patent grant on their contributions.
If they didn't contribute something to Swift and they sue Swift other
contributors for making a patent violation or their non-contributions, then
all patent grants for Apple disappear and other contributors can sue Apple for
anything that Swift uses that was patented.

IANAL.

------
judge2020
Patent text:
[https://patents.google.com/patent/US9952841/en](https://patents.google.com/patent/US9952841/en)

I don't see how options chaining is specifically reserved, it's a patent on
the entirety of Swift by the looks of it.

~~~
basil-rash
Yes... I really don't understand what all the FUD is about. I don't think most
people here have read the actual text. Otherwise we'd have people complaining
that Apple is trying to patent things like two stage compilation.

------
empath75
[https://patents.justia.com/patent/9952841](https://patents.justia.com/patent/9952841)
This is the actual patent. I'm having a very difficult time understand what
their actual claims are -- can someone explain it?

~~~
pnw_hazor
Read the claims section. That is what this patent protects.

------
skrowl
As if Apple isn't a big enough threat to tech by designing their software to
be incompatible with everyone else's hardware, now they want to spam
technology patents on a PROGRAMMING LANGUAGE. This is a horrible idea and only
serves to stifle innovation.

Please keep it in mind next time you purchase a laptop, smartphone or tablet!

------
mikece
Let's see if I have this right: Apple is patenting concepts in Swift then
licensing it under Apache 2 in order to protect users of the language from
patent trolls.

So they are patenting something for our protection?

~~~
petecox
Apache will only protect the particular implementation, viz. LLVM.

It does open the door for gcc to inadvertently develop similar functionality
and get sued. Not that there's, afaik, a cleanroom implementation of Swift.

------
carterschonwald
Monads and do notation as prior art. Boring

~~~
davidgrenier
Thank you, I was wondering if they had patented a half-assed version of
monads.

~~~
carterschonwald
option chaining definitely is that. seen in both swift and rust. and I guess
in some styles of javascript too afaik

------
hyperpallium
I'm not using Swift, so I don't get rights conferred by the Apache license.

I make a language with "Apple's" claimed invention. ( _EDITED_ )

Apple sues me.

~~~
favorited
No. Did you look at the patent? "Optional chaining" is not one of the patent's
claims.

The patent is about building a compiler out of 2 modular front-ends – each
taking an input language (one being an OO language based on C), generating the
appropriate IR, and handing the IR to a backend.

It goes on to specify that one of the integrated frontends does more compile-
time safety checking, calling out bounds-checking and optionals, and the other
doesn't (because it is specifically based on C).

~~~
hyperpallium
No, I went by the posted link. It does't alter my point.

------
norswap
I'm left dreaming of a future when we have to pirate programming languages.

------
kazinator
Lisps that return _nil_ for _(car nil)_ are implementing "optional chaining".

yes, it chains:

    
    
       (cadar nil) -> nil ;; the nil object doesn't have a "car"
    
       (cadar '((b c))) -> c
    
       ;; i.e.
       (car (cdr (car '((b c))))) -> c
    

This is exactly like, in Swift-like syntax, doing '((b c)).car?.cdr?.car?
where the ? indicates "don't blow up if it's nil", except the "don't blow up"
is built into _car_ and _cdr_.

This freedom was introduced in InterLisp, quite a few years before Jobs and
Wozniak got together in a garage to make the Apple I.

If you want prior art, there it is.

Another prior art, related to this, is the Null Object Design Pattern, which
is very similar.

In Common Lisp, this pattern (like many others) disappears because `nil` is
the element of a `null` class, to which we can specialize methods. So in other
words, we can make

If we have a method called _position_ that normally returns the position of an
_object_ , if we specialize the method to the _null_ class we can make
_(position nil)_ do something.

In Java-like OOP languages we would have a specific NullWhatever class that
implements the same Whatever abstract interface/base as an ActualWhatever.
Thus we then have an optional Whatever because code that takes a Whatever can
take a NullWhatever or an ActualWhatever.

Yet another prior art is the use of sentinel objects instead of null pointers:
for instance doubly-linked lists that have a special node, not considered part
of the list, that is the predecessor of the first, and successor of the last.
Then the code operating on lists neither blows up with a null access, nor does
it have to check for nulls. Statements like node->prev->next = node always
work.

 _" The single event that had the most influence on the creation of the League
[for Programming Freedom] was Apple's lawsuits against Microsoft about
supposed copyrights violations of the look and feel of the Macintosh in the
development of Windows."_

[https://en.wikipedia.org/wiki/League_for_Programming_Freedom](https://en.wikipedia.org/wiki/League_for_Programming_Freedom)

~~~
pnw_hazor
You are talking about language features.

The patent protects how a compiler implements some features in a multi-target
environment. Nothing to do with optional chaining.

------
norswap
We're building tanks but we promiiiiise we'll only ever use them for defense!

------
niutech
OMG, the U.S. patent system is so crazy and people are so scared of being sued
for any dumb reason. Why don't you change it? I am glad that I live in the
E.U., where the situation is saner.

------
cannabis_sam
Patents are so literally rent-seeking that I cannot fathom why people support
them.

------
Dotnaught
Does this have any implications for Google's effort to integrate Swift into
Fuchsia?

------
slyrus
So they're claiming (values) and &optional but in C?

------
pnw_hazor
One strategy behind patenting open sourced inventions is to protect the users
of the open source product.

~~~
maxdesiatov
Could you please provide an example? From what specifically have any patents
protected users of an open source product? I know plenty of examples when
patents were used to harm the users, the most notorious one being Oracle and
Java. But I don't remember a single case where users of an open source product
were protected from anything with a patent owned by a big for-profit company,
would be happy to know a concrete example that shows that this protection
outweighs the risk of a company harming open source users.

------
coldtea
> _This is very disturbing. It 's like Apple has gone insane. Computer
> languages are not supposed to be owned by any company. We learned this
> mistake with Java and APIs. Computer languages are supposed to be a part of
> the Commons, owned by everyone for the benefit of humanity, not the benefit
> of a greedy corporation._

Who "learned that"? The public (devs, etc) already knew and wanted that.

Companies however, have been patenting their languages and techniques since
OS/360 or earlier (IBM, Oracle, MS, Google, and so on). So it's not as if
"Apple has gone insane" at all, all big players do it. And not because they
want to sue either -- you also need them to not be sued yourself oftentimes...
(if Apple doesn't patent e.g. their "Optionals chaining" technique mentioning,
what's to stop e.g. Oracle doing it and suing them?)

~~~
JKCalhoun
> what's to stop e.g. Oracle doing it and suing them?

Can you imagine every Swift app has to be deleted because of a competing
patent claim?

Anyone remember LZW?
[https://en.wikipedia.org/wiki/Lempel–Ziv–Welch#Patents](https://en.wikipedia.org/wiki/Lempel–Ziv–Welch#Patents)

------
shmerl
Classic Apple hoarding software patents. Even if they don't use them, this
looks like a threat move. Patenting programming language features is just
sick.

Questions in that thread:

 _> 1\. If a separate open-source programming language under Apache 2.0
license implements an optional chaining feature, would it be a violation of
the patent then?_

 _> 2\. What if there's a separate implementation of a Swift compiler
developed from scratch independently from Apple, does mean that it's not able
to implement optional chaining without licensing the patent?_

 _> 3\. Here's the most interesting part: let's say there's a fork of a Swift
compiler that significantly diverged and is developed independently from
Apple. It seems to me that forks like these still don't violate the patent,
otherwise any GitHub fork with unmerged PRs would be a violation. But let's
say Google's fork no longer wishes to contribute its changes upstream, at what
point does this separate development could trigger a patent violation? Does
amount of divergence have any impact, let's say 90% of the codebase changes?
Does the name of project matter, if someone names their fork as "Sparrow", not
"Swift" is it considered a patent violation at this point if there's no
license and royalties paid for optional chaining?_

~~~
pnw_hazor
They have not patented any programming language features.

They have patented one or more ways to implement some programming language
features.

Read the claims, that is what is protected. Do one step differently and you
are golden.

~~~
shmerl
That doens't make it any less sick really (as applies to all software
patents). But it's especially sick in the context of programming languages.

~~~
pnw_hazor
It is clear that you, like many commenters in this thread, have very little,
if any, understanding of US patent law.

This patent is a nothing burger.

Don't take it personally. Patent law is about the most complex area of law.
Most tech press blows it too.

~~~
shmerl
Patent law that allows software patents is already seriously messed up and
urgently needs fixing. When it allows patenting programming languages, it's
outright sick.

~~~
pnw_hazor
Software based inventions aren't special, they are just new to the game.

~~~
shmerl
They are special enough to cause serious harm to progress if patented. This
was demonstrated many times. Since the whole point of patents is to promote
progress, software patents should not exist.

------
scriptproof
The future of Apple seems uncertain. Some says it is the beginning of the end.

[https://www.forbes.com/sites/stephenmcbride1/2019/01/21/the-...](https://www.forbes.com/sites/stephenmcbride1/2019/01/21/the-
end-of-apple/)

Maybe the rescue plan is to become a patent troll?

