Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use string interpolation in Switzerland #204

Open
lunaneff opened this issue Jun 26, 2023 · 3 comments
Open

Can't use string interpolation in Switzerland #204

lunaneff opened this issue Jun 26, 2023 · 3 comments

Comments

@lunaneff
Copy link

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.

@ItzSveno
Copy link

+1

@Bytestorm5
Copy link

Just popping in to say thanks for the link

@ThePython10110
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants