4 ms·
If Apple is indeed granted the patent on Swift's optional chaining (as was recently posted https://forums.swift.org/t/apple-is-indeed-patenting-swift-features/1
by hsavit1 8y ago
If Apple is indeed granted the patent on Swift's optional chaining (as was recently posted https://forums.swift.org/t/apple-is-indeed-patenting-swift-features/19779 https://forums.swift.org/t/apple-is-indeed-patenting-swift-f... ), we wouldn't see this in future Javascript, would we?
- k__ 8y agoIs it even a useful feature? Will it lead to many JS bugs simply disappearing and applications getting more stable or will it just obfuscate bugs in the long run?
- realharo 8y agoPresumably people will only use it in situations where null (or undefined, or however it works) is a valid and expected value for a particular property. In TypeScript, these properties would explicitly have a `MyType|null` or `MyType|undefined` type.
- deleted 8y ago[deleted]
- spiritcat 8y agoRoughly speaking, one less place where we need to use lodash. "or will it just obfuscate bugs in the long run?" Probably. :shrug emojii: But more stable in the sense of turning hard crashes into UI quirks.
- evv 8y agoI'm no lawyer, but I think the Apache2 license on Swift would mean that the JS community has access to the patent. https://github.com/apple/swift/blob/master/LICENSE.txt https://github.com/apple/swift/blob/master/LICENSE.txt TC39 (who defines Javascript) is a collaboration of several companies, so I'm not sure who Apple could/would even sue if this was proposed and adopted for JS. I doubt we would see legal activity over it.
- mrmr1993 8y agoI would have thought that Coffeescript's optional chaining, present at least as early as v1.0 in 2010[0], would have counted as prior art. [0]: https://github.com/jashkenas/coffeescript/blob/1.0.0/lib/parser.js https://github.com/jashkenas/coffeescript/blob/1.0.0/lib/par...
- realharo 8y agoGroovy had the same feature well over a decade ago[1] (at least in 2005) and other languages possibly even before that. Swift was first announced in 2014. Swift's is also tied to their `Optional<T>` wrapper type, any potential JS implementation would be more like Groovy's. [1] https://web.archive.org/web/20050815012153/http://groovy.codehaus.org:80/Statements https://web.archive.org/web/20050815012153/http://groovy.cod... , bottom of the page
- tirpen 8y agoThat sounds like a truly ridiculous patent! Optional chaining is just another syntax for the Maybe-monad, surely? Which has been around since 1998 at least (When Haskell 1.3 added monads)