Jump to content

Wikifunctions talk:Valuable

From Wikifunctions

A function that takes a list of strings, and outputs a formatted list in German

@Jdforrester (WMF): Such function will still be useful. If we have a function that takes a list of strings and a language, and outputs a formatted list in that language, such a function may have a large number of conditional branches and is not easy to manage. The upper level function should instead only be a delegate and call more specific function which will have a clearer maintainers. GZWDer (talk) 18:32, 8 August 2023 (UTC)Reply

Such a lower-level function should take a list of German strings, not a list of strings. It should always be clear from the types what kinds of input are expected. Jdforrester (WMF) (talk) 18:33, 8 August 2023 (UTC)Reply
@GZWDer I've added your version for clarity; does that help? Jdforrester (WMF) (talk) 18:34, 8 August 2023 (UTC)Reply
Oh, the "formatted list" example is not very relevant, since many language have similar structure for list (only separator is different; though some language are exceptions); However, in many cases if you want function to handle every languages without delegation, this will result in a very complex function. Also, currently we do not support partial implementations, which means every implementation must handle all kinds of combinations of parameter (instead of one implementation for English and one for German). GZWDer (talk) 18:41, 8 August 2023 (UTC)Reply