Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Tuple and array string outputs are confusing in cultures that use a comma as the decimal point #272

Description

Here is the output of displaying some tuples and arrays as strings in the German (de-DE) culture, which uses a comma as the decimal point:

let x = (1.1, 1, 1);
let y = [1.1, 1.0, 1.0];
Message($"{x}");
Message($"{y}");

(1,1, 1, 1)
[1,1,1,1]

It is difficult to tell what the real value of the tuple is, and is actually impossible to tell what the real value of the array is (it's not an array of 4 ints). Intuitively we expect the string output of Q# tuples and arrays to follow Q# syntax, which is why I think using the invariant culture here probably makes sense.

As a note, C# has the same problem with tuples (Q# tuples end up calling C#'s ValueTuple.ToString in the end):

> var x = (1.1, 1.0, 1.0);;
> System.Console.WriteLine(x);;
(1,1, 1, 1)

This is related to #160, but that is probably more easily fixed by setting the current culture to the invariant culture for the duration of the test.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions