Ferreteria/v0.6/sys/Registry: Difference between revisions
(Created page with "{{fmt/title|Registries|different types and how they work}} There are two primary types of "registriy", '''class''' and '''object'''. Both of these are basically just arrays in which stored items follow a specific rule-set. ==Class Registry== * '''Purpose''': You have a set of classes (clade-family) for handling a situation, but the exact class to be used depends on circumstances (and may be extended by applications) -- so you need a list of alias-strings (class-slugs) wh...") |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{fmt/title|Registries|different types and how they work}} | {{fmt/title|Registries|different types and how they work}} | ||
There are two primary types of " | There are two primary types of "registry": '''class''' and '''object'''. Both of these are basically just arrays in which stored items follow a specific rule-set. In general, though, you have a list of things -- either '''classes''' or '''objects''' -- where the specific thing needed depends on ''context'' and ''identity''. | ||
The exact means of determining the ''context'' is perhaps the piece with the most variation in how it is implemented. It can be done by separate Registry classes or by using a "class slug" in a master-array. | |||
The ''identity'' is simpler: the Registry (assuming the context is already specified) accepts a slug-string and returns the thing requested. | |||
* {{l/ | ==Pages== | ||
* {{l/ | * {{l/sub|class}} registry | ||
== | * {{l/sub|object}} registry | ||
{{ | ==Notes== | ||
==={{fmt/date|2025|10|16}}=== | |||
I think the way this needs to work is that we should have two main clades for each registry-type: | |||
# Main registry | |||
# Per-class-slug roster: | |||
#* Roster for class-names | |||
#* Roster for objects | |||
...except that on further thought, I don't really see the need for a central Registry to handle sub-registries. I think that may have come about for two reasons: (1) this functionality was first handled with a Globals singleton class, which then had to be refined to allow overrides, and (2) I needed some way to control the class-context for where the list was stored (e.g. if A has podlings B, C, and D, but we want A to be the "registrar" via a static member-array, how can we be sure each subclass isn't creating its own static array? I don't think it works that way, but there was enough uncertainty that it seemed wise to ''explicitly'' define where each podling-class registers itself). | |||
...but I think if, instead of a registry-slug, we have a static registry object, it should be possible to ensure that it's not being replicated improperly. | |||
Latest revision as of 17:01, 16 October 2025
|
Registries different types and how they work
|
There are two primary types of "registry": class and object. Both of these are basically just arrays in which stored items follow a specific rule-set. In general, though, you have a list of things -- either classes or objects -- where the specific thing needed depends on context and identity.
The exact means of determining the context is perhaps the piece with the most variation in how it is implemented. It can be done by separate Registry classes or by using a "class slug" in a master-array.
The identity is simpler: the Registry (assuming the context is already specified) accepts a slug-string and returns the thing requested.
Pages
Notes
2025-10-16
I think the way this needs to work is that we should have two main clades for each registry-type:
- Main registry
- Per-class-slug roster:
- Roster for class-names
- Roster for objects
...except that on further thought, I don't really see the need for a central Registry to handle sub-registries. I think that may have come about for two reasons: (1) this functionality was first handled with a Globals singleton class, which then had to be refined to allow overrides, and (2) I needed some way to control the class-context for where the list was stored (e.g. if A has podlings B, C, and D, but we want A to be the "registrar" via a static member-array, how can we be sure each subclass isn't creating its own static array? I don't think it works that way, but there was enough uncertainty that it seemed wise to explicitly define where each podling-class registers itself).
...but I think if, instead of a registry-slug, we have a static registry object, it should be possible to ensure that it's not being replicated improperly.