GulfOfMexico icon indicating copy to clipboard operation
GulfOfMexico copied to clipboard

Can't use string interpolation in Switzerland

Open lunananananananana opened this issue 2 years ago • 3 comments

The Swiss franc doesn't have an official symbol like the dollar or euro do, and therefore DreamBerd can't be fully used in Switzerland. This issue is of special importance, as the Swiss franc is, according to Wikipedia, the 8th most traded currency, and the first on the list without a symbol.

Because it doesn't have a symbol, it's usually written using the ISO 4217 currency code: 12.35 CHF (CHF is sometimes also written before the value), or if it's in a context where the currency can be assumed (such as a physical store), one of these conventions is used depending on value:

  • value below 1: -.95
  • integer value: 399.-
  • any other value, sometimes also used instead of the above formats: 12.34

We also can't fully agree on the decimal separator; some places use a dot, others use a comma.

Because of this, and because it likely also applies in other countries, I suggest the following syntax for string interpolation be added:

const const name = "world"!
print("Hello {name} CHF!")! // any ISO 4217 alphabetic currency code should work, whether numeric codes (such as 756 for CHF) should work is up for debate
print("Hello CHF {name}!")!
print("Hello {name}.-!")!
print("Hello -.{name}!")!
print("Hello {name}.{name}!")! // if the variable names differ, it should throw a syntax error

Each of these should print the string Hello world!.

Additionally, because smallest coin for the Swiss franc is worth 0.05 CHF, I'd suggest rounding the value to a multiple of 0.05 if the value is a float. Because I doubt we could agree on whether to round away from 0, towards 0, or to the nearest multiple, I suggest a compromise where we round left instead (what that means is up for debate).

For the implementation in #74, the full, up-to-date list of ISO 4217 currencies can be found at https://www.six-group.com/en/products-services/financial-information/data-standards.html, in both Excel and XML formats.

lunananananananana avatar Jun 26 '23 07:06 lunananananananana

+1

ItzSveno avatar Jun 30 '23 09:06 ItzSveno

Just popping in to say thanks for the link

Bytestorm5 avatar Jun 30 '23 22:06 Bytestorm5

I suggest a compromise where we round left instead (what that means is up for debate)

"Rounding up for debate." Does that imply that it will round up but people will debate about whether that's a good thing?

ThePython10110 avatar Jul 06 '24 18:07 ThePython10110