Jump to content

Talk:Abstract Wikipedia/Updates/2023-11-16

Add topic
From Meta, a Wikimedia project coordination wiki
Latest comment: 1 year ago by GrounderUK in topic String subtypes

String subtypes

[edit]

String subtypes are strings. Examples are French infinitive verb form, Breton lexeme, Chemical symbol, (“Arabic”, “Roman”, …) numeral, musical pitch class. All instances of such types are strings but not all strings are instances of a given type. It seems to me that all that is needed to support such types is a validator that can distinguish valid instances from other strings. As well as being the validator for a type, the validator can also be used to convert valid strings into an instance of the relevant type. This is trivial by composition, but it would be worth considering whether to make this standard behaviour, such that a validator emits an instance of the relevant type when its input is a valid value (and an error otherwise). GrounderUK (talk) 13:58, 24 December 2023 (UTC)Reply