Dear Swift,
Oh, this is an intriguing challenge. Here are my humble thoughts on the matter.
Let us task some certain figure with a job. The job is simple. It is to look after a value. As an aside, we note that the figure and the value it is looking after are clearly not the same thing.
For the sake of the argument, let our figure be x
. As for its job, we will task it with looking after the meaning of life. In Swift, unless I am mistaken, we would give this figure its job in the following manner:
let x = 42
Splendid.
Now, we will imagine that this figure has been doing a fine job, but now the time has come for another figure to take up the task. Looking after the meaning of life is surely not easy. It seems inevitable that this task might need to be passed on to some other figure eventually.
At the same time, we also realise this: The meaning of life is quite a big deal. It is not something which can just, willy nilly, be copied about. It is substantial, and a rather tremendous thing.
So what we must do is quite clear. First, we need to prepare a new figure; for the sake of the argument, let this figure be y
. Then, when y
is ready, the moment will come. Upon that precise certain moment, x
must retire
. Furthermore, as x
retires we must assign the task to y
. From that moment on, y
, and not x
, must look after the meaning of life.
So now we know what to do, all that remains is to spell it all out. I suppose there are a few ways it might be done. So here are a few.
If we don't mind making Swift just a little bit bigger, we could say:
let y = retire x
If we don't mind peeking through the looking glass, we could say:
let y = retire(x)
For less drastic jobs, where no figure, perhaps, needs to take up the task, I agree that it seems quite natural for no figure to do it:
let _ = retire x
let _ = retire(x)
Or, quite simply:
retire x
If it turns out that the reason for the transition has nought to do with age, then perhaps x
could resign
instead:
let y = resign x
let y = resign(x)
In either case, whether it be to retire
or resign
, it is clear that x
is giving up the job.
To provide a balanced alternative (should we prefer convention over analogy), we could simply 'add value' to the term of art in some manner which makes the outcome of the process as clear as possible (remembering that the outcome of this 'function' is somewhat unusual, and so a little extra guidance for the poor human would surely not go astray).
let y = moveValue(from: x)
In such manner, all those hardened cases who type 'move' in their sleep can still write 'move' to their heart's content. I suspect that code completion will then take up the slack, and pop in all those extra characters, voila. We note also, that we are now being much more specific (compared with simply saying 'move'). The likelihood of treading on someone else's toes is substantially reduced.
In any case, it makes one nervous. Once the decision is made, it is hard to go back. What a wonderful adventure it is!
With my best regards.
Edit: Please note that after writing up this post, I have realised that using the word retire
has already been put forward by @Matt_McLaughlin (using a slightly different analogy). Needless to say, I think it's an idea worthy of serious consideration. Thanks Matt!