www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23361] New: std.uni.normalize should be pure

https://issues.dlang.org/show_bug.cgi?id=23361

          Issue ID: 23361
           Summary: std.uni.normalize should be pure
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: Ajieskola gmail.com

-----------
 safe pure auto fun()
{ import std.uni;
  return "a\u0308".normalize;
}
-----------

Errors, with both nightly and stable DMD:
onlineapp.d(3): Error: `pure` function `onlineapp.fun` cannot call impure
function `std.uni.normalize!(NormalizationForm.NFC, char).normalize`

There is nothing in `normalize` that should alter global state, so this should
compile.

I'm classifying this as major, because this is the only way to normalize
Unicode strings in D without a DIY or third-party library. The function not
being available in pure code is a serious hinderance.

--
Sep 23 2022