Jump to content

Wikifunctions:Project chat/Archive/2025/12

From Wikifunctions

Wikifunctions & Abstract Wikipedia Newsletter #229 is out: And the name is Abstract Wikipedia

There is a new update for Abstract Wikipedia and Wikifunctions. Please, come and read it!

In this issue, we share the final results of the naming contest for Abstract Wikipedia, we share two demos about new Wikifunctions features, we talk about Wikidata components in Wikifunctions, and we take a look at the latest software developments.

Want to catch up with the previous updates? Check our archive!

Enjoy the reading! -- User:Sannita (WMF) (talk) 11:02, 4 December 2025 (UTC)

This section was archived on a request by: Sannita (WMF) (talk) 16:03, 18 December 2025 (UTC)

Wikifunctions & Abstract Wikipedia Newsletter #230 is out: How to write better error messages

There is a new update for Abstract Wikipedia and Wikifunctions. Please, come and read it!

In this issue, we share an essay on how to write better error messages, on improving which we focused in the last months.

Want to catch up with the previous updates? Check our archive!

Enjoy the reading! -- User:Sannita (WMF) (talk) 12:01, 12 December 2025 (UTC)

I really appreciate the updates and the work on error message handling 🤩 So9q (talk) 22:57, 13 December 2025 (UTC)
This section was archived on a request by: Sannita (WMF) (talk) 16:03, 18 December 2025 (UTC)

Proposed conventions for all kinds of labels

I've just made a bunch of proposals at WT:Naming conventions, in separate threads because I'm sure some will be more controversial than others. Essentially all I've done is broken down my own personal style into self-contained points. I have taken inspiration from others in the community though, like the Ruby-style '?' suffix that I saw on a couple functions. YoshiRulz (talk) 21:51, 1 December 2025 (UTC)

@YoshiRulz: Thanks. I've replied to a bunch of your proposals, but you've already started a "vote" it seems on all of them, which seems premature? Jdforrester (WMF) (talk) 14:45, 2 December 2025 (UTC)
Forgive me for being out of line, I've never had the need or want to participate in policymaking on a Wikimedia project before. "Up to now, everything had been in order." YoshiRulz (talk) 16:33, 2 December 2025 (UTC)
Don’t worry. You’re not out of line. I suspect we’ll get round to commenting on your suggestions before we feel inclined to vote on them, but if anyone wants to agree without commenting, that will be fine. GrounderUK (talk) 16:43, 2 December 2025 (UTC)
@YoshiRulz: Yup, not a problem, just didn't want you to take it as a criticism that I'm not voting immediately! :-) Jdforrester (WMF) (talk) 15:42, 3 December 2025 (UTC)

American / British / etc. English

So what's the plan for spelling on Abstract Wikipedia? It seems to me that Wikidata already does a good thing by having words like "color" be defined in en-CA/GB/US rather than just "en". Will AW potentially have functionality to display content in the user's language, so that "color" will show up as "colour" on en-GB language and "color" on en-US? Or will everything just default to Canadian English since its language code is higher up alphabetically :)???? </facetious> rae5e <talk> 15:41, 8 December 2025 (UTC)

It had better! Wikifunctions does… honestly… For an example, please see [“driving licence”(en-gb), …] ↤ Q205647 (Z26565). GrounderUK (talk) 15:48, 8 December 2025 (UTC)
Of course, “en” is widely abused on Wikidata for “en-us”, so most varieties of English will have “en-gb” above “en” for their fallback, I imagine. Australian for “color”, for example. GrounderUK (talk) 15:58, 8 December 2025 (UTC)
Perhaps we should ask Wikidata to deprecate it then? This would force user to choose, which might result in higher data quality. 😀 So9q (talk) 22:59, 13 December 2025 (UTC)
Also note that there is already a mechanism in MediaWiki for spelling variants, it's just not used on enwiki for some reason. YoshiRulz (talk) 17:01, 8 December 2025 (UTC)

Making a "List of functions filtered by their Implementations" page

There's already a "List of functions filtered by their Tests", adding one for implementations can help fill gaps for empty functions which have test cases but no implementations, or even functions which have neither. B0oredman (talk) 03:57, 7 December 2025 (UTC)

+1 So9q (talk) 11:49, 7 December 2025 (UTC)
Please see phab:T404897 and feel free to comment there! GrounderUK (talk) 12:10, 7 December 2025 (UTC)
And award tokens to show support. So9q (talk) 23:02, 13 December 2025 (UTC)
You can find what you are asking for on the new statistics page for functions. So9q (talk) 21:35, 14 December 2025 (UTC)

Question regarding a few low level stuff

I’ve experimented with creating a Rust interpreter for Wikifunction. For, now, I’ve been able to run some tests (Z8130), but I’ve now been focused on reify/abstract and this kind of introspection function.

My questions are:

  1. When should references should be substituted? If I run Z805/Reify by passing a function as its first argument, it does appear to dereference the function. However, the function have an identity, which I expect should result in either an infinite recursion (and no result) or a function call that would further process the reify lazily. But I see neither of that is done, and it instead reify the reference as if it would be another object. (ps: I originally expected reify to not be recursive)
  2. In the json representation, when are string supposed to be replaced by references? For now, my implementation only dereference stuff in limited circumstance. But not all strings are references, and apparently not all non-reference string are in Z6/String, such as shown in Z15796, which directly have a "Wikifunctions" string that is not in a Z6, yet appears as would a JSON-serialized reference (that is, "{"Z20K2": {"Z1K1": "Z7", "Z7K1": "Z805", "Z805K1": "Wikifunctions"}"), but on this same data, the type Z7 specify that Z7K1 should be a function, and not a string. Do I need to have knowledge of the expected type to correctly know whether it is a reference or not? (ps: It appear that the "reference" implementation appear to not be sure, seeing Z15886, thought in this case, it’s an arbitrary object)
  3. (added later) How should I handle the potential case that an object has extra keys? For example, what if a Z6 object contain a Z9 key for some reason? Should it be impossible to set such a key, as it is absent from the type, and so not a legal (and dropped whenever attempted)? Should I throw an exception? Or maybe I should just consider my object as key/value map that may contain arbitrary value? My guess is they are kept, as that’s how arguments are passed in a function call.

I am also a bit confused at how exactly I should handle function call. For now, I recurse thought the ZObject of the function to run, replacing argument reference, but without following Z9 references. I can persist the argument across the references, given they reference which function they are linked to, but what would happen in case of recursive call to a function? They just override them? Or is that an invalid notation?


ps: the source code, if anyone is curious. I see a Rust interpreter is already in production. I’ll take a look at it. Maybe some idea could be embedded there. See the source code

Among other, proc_macro for constructing reference whose (data structure-level validity) is checked at compile time, the way data is stored, and how I handle reference. I’ll take a look at the source whenever my wikimedia developer account get validated.

Thanks. Marius851000 (talk) 12:49, 14 December 2025 (UTC)

Interesting! I added a link to it on the Tools page So9q (talk) 21:56, 14 December 2025 (UTC)
So, in regard to 1, I now have the suspicion that references get dereferenced when passed as a function argument. Which appear to cause some weirdness when calling Z109/validate reference. I suspect it validate not the reference, but the referenced when called from a Z7/function call. I also observe that leaf can have a "void" type. That's gonna make yhings more complicated. (Ah! No! They are just a reference to a unit type. But wouldn't that cause problem, as it appear to have no identity unlike boolean, which mean it might be problematic to tell this is a void when dereferenced?) Marius851000 (talk) 07:51, 15 December 2025 (UTC)
From the new test case I made at Z30601, it appear void is indeed really just a "is unit type" check. A bad thing, in my opinion. (unless if "Unit" is renamed to "void type". In which case it would be sound). I’ll mention that on the object talk page Marius851000 (talk) 08:23, 15 December 2025 (UTC)
I’ve attempted to explain on its talk page why I believe the view expressed in Arbitrary Unit object is void (Z30601) is incorrect. In due course, I expect to see the test case altered to align with that version of the truth, one way or another. Thanks also for your previous comments and questions, which I’ll respond to when I have more time. GrounderUK (talk) 10:57, 15 December 2025 (UTC)
Perhaps you found a bug?
See https://www.wikifunctions.org/wiki/Wikifunctions:Project_chat#c-Marius851000-20251215082300-Marius851000-20251215075100 vs Z17184 So9q (talk) 10:57, 15 December 2025 (UTC)
Now that I got my clarification on a bunch of type related things, I'll probably rewrite that interpretor.
I haven't clarified all the details, but I plan to go with strict type checking, both for native type and data-specified types (althought there is the question of how validator function integrate with that, and how to manage partially defined data).
I'll probably at least think about using garbage collection. For my previous implementation, object where most of the time only valid for the duration of their function call. Which work well for recursive function call. Marius851000 (talk) 14:45, 15 December 2025 (UTC)
Oh! And regarding that "Rust executor", it appear that it is just here to run the WASM Python and Javascript code, and that I am doing is more akin to an orchestrator (even thought I don’t plan into passing those code into a subprocess). I’ll be posting further note and this kind of think into my user page. Marius851000 (talk) 07:28, 16 December 2025 (UTC)
Question 1. In general, references should be de-referenced immediately, unless enclosed in a Quote (Z99) object. The real question is how far that de-referencing goes. I take it to be a single substitution step: a reference to a Persistent object (Z2) is replaced by the object identified by its Z2K2, but references within that object are not themselves de-referenced at this stage.
On that basis, calling Reify (Z805) with a reference to false (Z42) does not yield a reified reference broadly equivalent to {"Z1K1":"Z9","Z9K1":"Z42"}. Instead, it yields a reification of the object obtained by de-referencing Z42, which is {"Z1K1":"Z40","Z40K1":"Z42"}. The references to Z40 and to Z42 remain as references. In other words, the result is broadly equivalent to {"Z1K1":{"Z1K1":"Z9","Z9K1":"Z40"},"Z40K1":{"Z1K1":"Z9","Z9K1":"Z42"}}. GrounderUK (talk) 13:12, 17 December 2025 (UTC)

Use of "is identity"

I was wondering for a while why does Key (Z3) had an "is identity" key (something I could not find documentation for). I had recently implemented an ZObject equality function for the unit test (thought it’s a generic function, so could be used in any of the equality function once I get around implementing function call), and I had quite some issue to prove objects are different with infinite recursion. I eventually assumed a persistant object couldn’t persist a Reference (and so just compare the Zid they point to), but that was forgetting that I haven’t assumed that persistent object couldn’t contain a function call (that could return a reference).

Luckily, identity avoid infinite recursion. If I have two object with each one having an identity key, I can get the reference of the identity, executing any function call on the way (outside of Typed List/Pair and the like, that get lowered to an internal representation of such type) and then compare the two reference if they are the same. (hmm... How to handle typed list/pair is probably another special case, but that’s a question for later)

Oh! And Strings too. But strings get converted to it’s own internal representation, so it’s just a matter of marking them as primitive type whose a simple struct-level inequality is enought to demonstrate they are not the same.

Marius851000 (talk) 11:13, 17 December 2025 (UTC)

Please see Wikifunctions:Representing identity#Proposal 3: A Boolean key. GrounderUK (talk) 11:47, 17 December 2025 (UTC)

Wikifunctions & Abstract Wikipedia Newsletter #231 is out: We wish you a happy new Gregorian year!

There is a new update for Abstract Wikipedia and Wikifunctions. Please, come and read it!

In this issue, we showcase some templates using Wikifunctions functions on several projects, and we wrap up work for this Gregorian year, wishing you happy holidays.

The updates will resume in the week of January 14, so if you feel like you want more, you can always read the previous updates in our archive!

Enjoy the reading! -- User:Sannita (WMF) (talk) 16:01, 18 December 2025 (UTC)

Can’t reproduce test with function call, maybe test result outdated?

I’ve recently created reduce function, Composition: recursive (Z30662), but it appear the test cases, as shown in Reduce Function (Z876) does not validate, while I can reproduce at least order of pairing (((0,1),2),3) for Reduce Function (Z13427) using the call implementation feature on the page. My guess is that they are outdated, as one of my previous implementation had the same error (when I put the initial object as the type of an empty object rather than the object itself). I’m not sure where to report that (on Phabricator directly?), but I’m not even sure it’s an error in the first place. Marius851000 (talk) 15:25, 18 December 2025 (UTC)

It sounds like it might be a case of phab:T406784. Feel free to add a comment there. GrounderUK (talk) 15:52, 18 December 2025 (UTC)
The recursive implementation now passes both tests. GrounderUK (talk) 14:47, 28 December 2025 (UTC)

re: Function categorisation/documentation template

(In lieu of phab:T260953.) The thread with my suggestions got archived, so I just went ahead and drafted up the template. It's modelled on Wikidata's but I ended up writing it from scratch. YoshiRulz (talk) 23:32, 28 December 2025 (UTC)

Super nice work 🤩 So9q (talk) 12:46, 4 January 2026 (UTC)

Wikifunctions and the Abstract Language / functions helping

I think I have a bit of a crazy idea. I watched the video of the volunteer corner, Denny talking and demonstrating how to develop the basic wikifunctions for language generator.

One thing I could feel is that's it's hard keeping track of what is happening into the different layers of functions, switching back and forth to the different pages and tests.

Then I thought about the idea of a "Wikifunction Spreadsheet" and I think it could be a great help actually in that task !

Instead of the "One function per page" you put one function call per cell, and a sequence of composition into the adjacent cells. On another cell you can try another function connecting the results of the previous cells to try and compare all on the same page.

You put the tests (maybe even imported from the function tests itself) in different columns and copy the "composition formula" into the columns as we can copy formulas in a traditional spreadsheet to see the intermediate results into the rows, see at which step it breaks if you split the composition into smaller formula that uses the results of the previous step on the previous line …


It might not be that much work to implement into Wikifunctions as the formula editor and the views for the datatypes are already implemented ?

@DVrandecic (WMF) @Jdforrester (WMF) @VIGNERON what do you think ? (ping the people who participated) TomT0m (talk) 19:29, 6 December 2025 (UTC)

Oh, I like a lot the idea of tracking what is happening inside a composed function, seing the result of each sub-functions. I'm not sure to fully understand the spreadsheet formating and/or analogy, but I'm definitely in agreement with the underlying idea. Cheer, VIGNERON (talk) 09:23, 7 December 2025 (UTC)
My idea was to use an actual Spreadsheet. But instead of the usual string inputs in the cells for data, you'd use typed Wikifunctions datatypes inputs, and instead of traditional spreadsheet functions you can compose to create formulas, you can use any wikifunctions. You could use usual cell reference for functions inputs.
To decompose a function for debugging, you can replace a function with its composition implementation in the UI, or something like that. And you highlight a part of the composition and the UI let you replace it with a cell reference in the formula, and move that part of the composition to that cell. That way the extracted cell with this subformula will show the intermediate result.
In the same spirit you want to see if you can replace a function with another in a composition ? You do the previous operation to extract that function in a cell. You copy everything like in a traditional Spredsheet, down in the next row. You get another cell for another intermediate result. Change the function in the copy of the extracted cell in the new row with the new function. Compare the results.
Want to test with a bunch of test lexemes input for exploratory work ? Enter them in a column, In the next column adjascent to the first one, with the cell in the left referenced as an input parameter, enter your composition as a formula. Copy it down …
Just ideas. It seems that it would be a cool UI principle for testing different things, as a lot of people knows a bit about spreadsheets, it's flexible, and we can push the concepts further with more advanced datatypes on Wikidata than usual, and their input and views are already coded in the software. TomT0m (talk) 09:48, 7 December 2025 (UTC)
I really like your idea and I am interested in using it as I am using spreadsheets a lot. In the past I experimented with converting spreadsheet functions into source code in a programming language. I wrote a program to convert some common Spreadsheetfunctions into source code in R. With the program you can read a file in the Flat ods-Format a text version of the .ods-Format a Spreadsheet file format. As an output you get the source code in R what will calculate the same result. So far it works not every time as the program is in an experimental state. You can find the source code of this program here at the Wikimedia Gitlab Instance. If you are interested in testing it I can try to help with the installation. There is an overview page with mappings of Spreadsheetfunctions to Wikifunctions functions at Wikifunctions:Excel functions and Wikifunctions:OpenFunctions. I think mapping the already existing spreadsheet functions to the Wikifunctions functions can help making it easier to convert an function implementation in a Spreadsheet into a Wikifunctions function. Hogü-456 (talk) 18:33, 7 December 2025 (UTC)
@TomT0m Are you interested in working on it further. I hope it can help more people to contribute to Wikifunctions. It seems difficult to me writing functions at the moment in Wikifunctions. Hogü-456 (talk) 22:18, 27 December 2025 (UTC)
Unfortunately I'm focused on something else right now, I won't really work on it in the near future. TomT0m (talk) 14:57, 17 January 2026 (UTC)