www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20511] New: Can't format JSONValue to OutputRange due to safe


          Issue ID: 20511
           Summary: Can't format JSONValue to OutputRange due to  safe
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Consider the following code:

import std.format : formattedWrite;
import std.json : JSONValue;
import std.range : nullSink, OutputRange, outputRangeObject;

void main()

This should compile, but it instead produces an error. This is caused by
std.json.toJson being ` safe`.

toJson can not be  safe, because it calls arbitrary output range code.

Jan 16 2020