old-design-docs icon indicating copy to clipboard operation
old-design-docs copied to clipboard

RFC: Replace unibool with uniprop-bool in S15

Open samcv opened this issue 8 years ago • 3 comments

The current spec says uniprop returns the narrowest numerical type for numerical properties and boolean for boolean properties, and returns Str for all other properties.

It also mentions a unibool function. At the moment we have uniprop-bool, uniprop-int, uniprop-str in Rakudo, but they are not in the docs or Roast. I think the only useful one of these we might want to keep would be the uniprop-bool function, which could be used to check the absence of a property. This code below shows an example I think makes logical sense, and is also currently what Rakudo does.

'a'.uniprop-bool('Numerical_Type') #> False
'a'.uniprop-bool('Hangul_Syllable_Type') #> False
'a'.uniprop('Numerical_Type') #> None
'읔'.uniprop('Hangul_Syllable_Type') #> NVT

See discussion here: https://irclog.perlgeek.de/perl6/2016-12-16#i_13751405 @jnthn

samcv avatar Dec 16 '16 19:12 samcv

Nobody has commented yet, can anybody weigh in? @perl6/perl6

If no objections I would like to update the spec and add some tests into roast for this.

samcv avatar Dec 25 '16 06:12 samcv

To be honest, I'm not sure I understand what is going to happen after this change.

I think the only useful one of these we might want to keep would be the uniprop-bool function, which could be used to check the absence of a property.

Can't we have something that is more consistent with the rest of the language? For example, uniprop can return an undefined value in case of the absence of a property. Or we can add :exists or something like this.

AlexDaniel avatar Dec 25 '16 12:12 AlexDaniel

Well, just :exists is pretty vague when you want to return whether or not the property is True or False. Could be other wording, but there should be an easy way to check if 'a'.uniprop('Numerical_Type') #> None 'a'.uniprop-bool('Numerical_Type') #> False

All the different enumerated properties have mostly different values for codes without the property OR which have been explicitly specified as having that value.

:exists, well that codepoint does have said property, and returning undefined for standard uniprop would not be correct.

samcv avatar Dec 25 '16 18:12 samcv