Swift programmers frequently encounter programming problems that require writing lots of code. Writing code is hard and boring. From a pedagogical perspective, teaching people how to write lots of code takes up time that could be spent bikeshedding the syntax of an important new language concept, finishing that novel you always wanted to get around to, or feeding your carnivorous plants.
Introduction
I propose a new keyword spelled dowhatiwant. Many proposals have been written over the years to make Swift easier and more powerful. The problem is that they only tackle one feature at a time. The dowhatiwant keyword subsumes all of these features, presenting a much simpler and more comprehensive solution that drastically reduces the amount of code written as well as making the language much easier to understand. With less code, the chances of introducing bugs are greatly reduced, and with so little to complain about, even Siracusa might be sort of happy with it.
Motivation
Writing in code-maker make head hurt. Internet not help. But dowhatiwant do it for me.
Proposed solution
By writing the following code:
/*
Copyright 2019 my 90s Quake handle ^_sKuL_kULLeCtOr_^
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
dowhatiwant
At this point, the compiler generates the necessary code.
Detailed design
The details of the implementation are an implementation detail. Describing those details would violate the spirit of this pitch. Therefore, they are necessarily left up to the compiler team. They can update the implementation details whenever they want to take advantage of sick new technologies, leading to the illest apps. Your friends will be all, "How did you write this app?" and you'll give them a knowing wink, and they won't know why you did, but you will.
Source compatibility
I thought about this a little bit in the shower where I got my last five great ideas, and I couldn't think of anything that would break, so it's totes an additive feature.
Examples
The classic Currency Converter sample application can be replaced with the following:
dowhatiwant
Teachers will love the ease of grading assignments from students, which will typically take the form:
dowhatiwant
With this feature, responding to the hard problem of consciousness is no problem for the Swift compiler:
dowhatiwant
Errors are handled as follows:
dowhatiwant
dowhatiwant
^--------------- Error: I already did that.
Alternatives considered
Teaching programmers about algorithms, program design, and, what's that term called, first principles
This solution carries with it an enormous degree of time and energy overhead. Besides, a comprehensive playground that teaches these concepts, grades them, and charges the appropriate fees can be written as follows:
dowhatiwant
The credit card processing service can be written similarly.
Different spellings
A cursory survey of developers resulted in 5,472 alternate spellings, including but not limited to:
doitforme
doitnow
insertcodehere
makemycode
finishcopland
feedmeseymore
besuretohitsubscribeandSMASHthatlikebutton
followed by 5,465 comedy emoji spellings.
Effect on Swift itself
Naturally, with so little Swift code being written, the next step will be to deprecate the entirety of the language and encourage users to adopt the new keyword going forward, providing a migration step in Xcode to ease the transition. Future updates to the compiler can take advantage of the new language feature as follows:
dowhatiwant