[swift-evolution] Proposals: (1) Forbidding custom `==` for value types, (2) `dispatch` keyword, (3) `default`-result for methods with `Self`, and (4) Poor-Mans-Existentials
Johannes Neubauer
neubauer at kingsware.de
Tue Jul 19 01:07:08 CDT 2016
> Am 19.07.2016 um 00:27 schrieb Xiaodi Wu <xiaodi.wu at gmail.com>:
>
>
>
> On Mon, Jul 18, 2016 at 5:15 PM, Johannes Neubauer <neubauer at kingsware.de> wrote:
>
>
> Von meinem iPhone gesendet
>
> Am 18.07.2016 um 23:46 schrieb Xiaodi Wu <xiaodi.wu at gmail.com>:
>
> There are a lot of papers and books around in (scientific) literature about generics, inheritance (e.g. fragile base class problem), the billion dollar mistake `null`, off-by-one, just to mention a few, and Swift addresses a lot of these problems already (some better and some not as good). I would like to propose an option how we can narrow a problem space and you talk about magic and constraining freedom.
>
> I use "magic" to mean functionality built into the compiler that cannot be expressed in Swift itself. Without behaviors, attributes require magic, and because there is no syntax in Swift that can make every function named `==` call a function named `===`, that too will require magic. I am not sure why you are putting words in my mouth; I have never used the word "freedom.“
I just did a de Morgan operation on „no constraint“ and phrased this „freedom“. I didn’t want to put anything in your mouth. I do not want to be personal at all.
But operations like object initialization and many more (using 2-phase initialization in order to reduce fragile base class problem) are not expressed in Swift either. == is really deeply integrated into the language and is really a million (or more) dollar problem in other languages (look at Java „pyrofessional" books for example). They cannot change it radically, because they both have no value types yet and need backward compatibility. Swift has the chance to not repeat the mistakes of other languages. I just want to help since I have a lot of experience in language design (especially DSLs).
More information about the swift-evolution
mailing list