The on-wiki version of this newsletter can be found here:
https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2022-04-28

--
Once Wikifunctions launches, we currently plan to support implementations of functions in two programming languages, Python and JavaScript. But unfortunately, that doesn't mean that all the code out there, written in Python or JavaScript, will become readily available to be copied and used in Wikifunctions. The code has to fulfill certain requirements. In today's newsletter we will discuss these requirements, and what you can do to prepare code you want to make available through Wikifunctions.

First, it must be legal to bring the code in. As per the result of the community discussion, the code will be published under the Apache-2 license. If you wrote the code yourself, or otherwise own the rights to it, you are free to publish it in Wikifunctions. If you are taking the code from an existing open source project, you must make sure that it has a compatible license.

Second, the code must be “functional”. That means that, given a specific input, the code must always return the same output. In particular, that makes a number of classes of functions not available:

Some of these use-cases may be tackled after launch (e.g. in order to allow random results, or to use implicit arguments for functions such as “what is the current time?”), but these will require careful planning, discussion, and ultimately changes to the system.

These are further restrictions that Wikifunctions will initially have:

We are already planning to add more programming languages, but they will also have similar restrictions. Both JavaScript and Python, as well as many other languages, allow top-level functions to be defined. For other languages, such as Java or Smalltalk, we would need to define a slightly different pattern in order to interact with the functional interface that Wikifunctions provides. Whenever we add a language, the process will involve a design step in which we will discuss the appropriate mappings. We also plan to document how further programming languages can be added so that the effort becomes predictable.

This post has no examples and no how-to, but rather describes the requirements for implementations. In the following weeks, we will follow up with one or more posts that examine a few patterns and examples on how code from libraries could be reused within Wikifunctions.

Thanks to Mahir256 for providing comments on earlier drafts of this newsletter.