Page MenuHomePhabricator

Onechar to char conversion
Open, p3: NextPublic


What is the exact feature or behavior required?

Conversion function from onechar to char.

One or more example use cases for the feature, including sample expected input and output.

There's a situation in SIMPLEXpress that might be better rewritten as a switch case, but because onechar doesn't convert to char, it doesn't work at all. (no suitable conversion function from "onechar" to "char" exists)

An explanation of why the feature is needed. This is important to prioritization. “It would be nice if...” takes a backseat to “This common scenario doesn’t work without...”.

Being able to convert from a onechar to a char where possible (presumably this would be much more difficult on a character outside of char's range) makes as much sense as being able to convert from onestring to std::string.

Any initial ideas you have on implementation (if applicable).


Task Type
Proposed Urgency
3: Major
g3: Major
Triage Friction
r3: Moderate
Volatility (Caught At)
Not a Bug
Not a Bug/Unknown

Event Timeline

jcmcdonald changed the task status from Proposed to Open.Dec 3 2020, 3:53 PM
jcmcdonald triaged this task as p3: Next priority.
jcmcdonald changed Gravity from Triage Gravity to g3: Major.
jcmcdonald changed Relativity from Triage Relativity to r3: Moderate.
jcmcdonald added a subscriber: jcmcdonald.

At a glance, this seems like a good idea. My only concern is, it's quite hard to convert to a char when you have a very high probability of failure. I suppose if I could raise an exception when it doesn't fit into a char, and I require explicit downcasting, it might be doable.