Jump to content

Talk:Abstract Wikipedia/Pre-generic function model

Add topic
From Meta, a Wikimedia project coordination wiki

Rationale: Why does Z5 have a Z5K1 and a Z5K2?

[edit]

The Z5K1 seems redundant, as it should be the Z5K2.Z1K1 always. So why does it exist?

This is a way to give a small hierarchy of errors.

Every error is always a Z5. That helps to capture all errors always and easily. But now how do I capture a well-formedness error?

So, here's an error:

I ask for the tail of the empty list (Z812(Z13), it should respond with a Z510 (list is empty).

Now I ask { Z1K1: Z6, Z6K2: "x" }, and this is not wellformed. It should return a { Z1K1: Z5, Z5K1: Z502, Z5K2: { Z1K1: Z502, Z502K1: Z532, Z502K2: ... }}

So we see it is an error (Z5), it is a well-formedness error (Z502), and the error is that there is no Z6K1 on the object (Z532). We can capture the error-code on any of these levels - whether you are only interested in Z532s, or in all well-formedness errors, or even all errors.

Alternative 1: no explicit type

[edit]

Have Z5K1 be an instance directly. If we want to know if an error is a well-formedness error, let's annotate the instance of Z50, i.e. Z50 would have a key that points to well-formedness. So if you want to figure out if an error is a wellformedness error, when you see a Z5, you ask for Z5K1.Z1K1.Z50K2 and check if that is Z502.

Alternative 2: Z5 points directly, but then we still have the hierarchy below

[edit]

Just means a bit less uniformity. --DVrandecic (WMF) (talk) 00:38, 27 February 2021 (UTC)Reply

First, I note that the (post-generics) function model uses Z15 for error type, rather than Z50. I confess, I don’t really understand the question (as expressed). An actual error returns an object whose type is (axiomatically) an error type. Such an error is an instance of a Z5/Error, which is (therefore) a Z4/Type (as the function model states). In parallel with Z4/Type, we should expect a K1 identity (Z5K1/error type) and K2 keys (Z5K2/error value). The Z5K2 will ultimately be the “generic” evaluation of the function called to handle the (actual) error; pre-generics, it’s just a well-formed Z1. Alternative 1 seems invalid. Although, in theory, the actual error could simply result in a Z1, I don’t see how that Z1 could be a Z5. In effect, the Z50 has then become the Z4/Type, so there is no Z5K1 at all (it’s simply the value of what would otherwise be the Z5K2, isn’t it? E.g. { Z1K1: Z502, Z502K1: Z532, Z502K2: ... }}.) I don’t understand what Alternative 2 is proposing.--GrounderUK (talk) 12:24, 3 March 2021 (UTC)Reply