Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Replace unibool with uniprop-bool in S15 #119

Open
samcv opened this issue Dec 16, 2016 · 3 comments
Open

RFC: Replace unibool with uniprop-bool in S15 #119

samcv opened this issue Dec 16, 2016 · 3 comments

Comments

@samcv
Copy link
Contributor

samcv commented Dec 16, 2016

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 samcv changed the title RFC: Replace unibool from S15 and replace with uniprop-bool RFC: Replace unibool with uniprop-bool in S15 Dec 16, 2016
@samcv
Copy link
Contributor Author

samcv commented Dec 25, 2016

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.

@AlexDaniel
Copy link
Member

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.

@samcv
Copy link
Contributor Author

samcv commented Dec 25, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants