Open inkydragon opened 4 days ago
I don't see an issue with the inconsistency - the julia function is explicit in its documentation that it handles Unicode punctuation (consistent with the domain of Char
) while the C++ function is concerned with the C locale setting (which, as your reference points out, by default considers +
to be punctuation). This may or may not be the same thing.
I don't think there was any claim that this was an issue, just that explicitly pointing out the discrepancy might be a good idea.
I don't think there was any claim that this was an issue,
Well, Github calls this type of ticket an issue, so what else should I call it? 🤷
just that explicitly pointing out the discrepancy might be a good idea.
Yes, and I was agreeing with/reaffirming OP that the two functions aren't even intended to do the same thing. Why should we point out that a similar function in a different programming language has different behavior? Should we also clarify that eval
only evaluates julia expressions, and not LISP expressions?
From reading the two documentations, it should already be plainly clear that the two have different behavior.
This came out a bit wrong - what I mean is that IMO there shouldn't be any expectation that the two functions behave the same, given the already existing differences in documentation between the two. So I'm partly questioning what such an additional text would add 😅
I think having the exact same name as the C function does make it nice to be clear to the user that they aren't the same specifically
julia> c = '-' '-': ASCII/Unicode U+002D (category Pd: Punctuation, dash)
Just pointing out that this is technically because that's not minus, but dash (although we do canonicalize them for julia input). That said, they are different characters:
julia> ispunct('−')
false
I think it would make sense to comment on this explicitly in the ispunct
docs.
Should be an easy PR if someone wants to take a stab.
Not sure if this is a bug. This seems intentional, but the
ispunct
in julia is inconsistent with the behavior of the C function of the same name, which is confusing.Perhaps a warning could be added to clarify the inconsistency with C.
https://en.cppreference.com/w/cpp/string/byte/ispunct
And more chars: