Abstract Wikipedia/Updates/2023-10-04
◀ | Abstract Wikipedia Updates | ▶ |
Arguments made easier
editAs of today, referencing arguments has become considerably easier.
What does this mean?
editEvery function has arguments.[1] When creating a composition to implement a function, you need to be able to reference the arguments of the function. For example, let's look at the function that generates the regular German verb form for the second person plural: it takes one argument, the infinitive form of the verb, e.g. “denken” (to think), reduces it to the stem of the word, e.g. “denk”, and adds the letter “t” to get e.g. “denkt” (as in “ihr denkt”, “you think”). So the composition looks as follows:
join strings( stem German verb( Argument reference( infinitive ) ), “t” )
… or see Figure 2 for the expanded view.
In this composition, there is one function call embedded in another. The inner function call, which returns the German stem, has an argument reference to the infinitive. This means that the argument with which the function is being called will be placed right in this place. Therefore, if you call the function with the argument “denken”, it turns into this function call:
join strings( stem German verb( “denken” ), “t” )
Then, by evaluating the inner function call, you get:
join strings( “denk”, “t” )
And this finally evaluates to the result, “denkt”.
Figure 3 shows the status of the composition at the point where everything but the argument reference has been entered.
At this point, you have to expand the infinitive argument for the function call for stem German verb. You do this by clicking the sideways-chevron (">"
) next to the label “infinitive”. This expands the fields, showing the type and mode and the (still empty) value (see Figure 4).
Now you switch the input mode from a literal String to an Argument reference (Figure 5). And this is where the previous workflow diverges from the new workflow.
How did it work?
editFigure 6 shows the previous status after selecting Argument reference. You were presented with an empty field labeled “key id”, and the field expected the editor to type in the key ID. What makes this worse is that the page did not show you the key ID anywhere (I usually copied it from the URL). The key ID is the ZID of the function you are implementing, plus a suffix for the position of the key you are looking for. In this case, since you were implementing Z11272 and there was only one key, the key ID was Z11272K1. You had to type that in, and were then able to publish the implementation (see Figure 7).
How does it work now?
editLast week we had our internal "Fix-It" week, where we focus on technical debt and smaller, but irritating, tasks. One of the projects that our colleague Genoveva tackled was to improve this workflow: once you have chosen “Argument reference”, instead of an empty text field for which you had to look up and write in a key reference, it now shows a dropdown field (see Figure 8).
Clicking on that dropdown field reveals the list of relevant arguments (see Figure 9). You select the argument (see Figure 10). Now you can even collapse the infinitive field into a single field, making the view even more compact (see Figure 11).
Why does it matter?
editWe want to make contributing functions, tests, and implementations as easy as possible. We believe that in order to achieve the goal of sharing a comprehensive library of natural language generation functions for hundreds of languages, we will need a lot of people to edit functions, tests, and implementations on Wikifunctions.
We followed a number of principles when improving this workflow: we reduced the cognitive workload necessary to complete the task, we hid identifiers from one more place in the user interface, and we made it considerably easier to complete the task on mobile devices. We hope that this will help with our goal of allowing more people to contribute to Wikifunctions effectively.
Congratulations to Genoveva for engineering, Amin for Design, and the team for working on and landing this improvement. Thank you all!
Notes
edit- ↑ It is possible to have functions with no arguments in Wikifunctions, e.g. nullary true, but such functions are of limited practical use.