What exactly happened to (our) MONEY?

What has happened to money! datatype?

>> to money! 12,95
== $12

It is the same for 12.95 that also loses the 95 cents.

To shortly get back to the MONEY! type.

Some thoughts summed up:

Money has a currency
Currency (often) has a symbol
Money can have decimals

Money of different currency cannot be added together

If the money currency knows decimals, often better known as cents, this info is kept too.

Let's say in the next line spec is a block or an integer value 1, this could be the case:

amount: make money! spec

>> amount
== make money! [
    curr: "USD"
    symbol: "$"
    dec: 2
    value: 100

Above is a possible representation of 1 US Dollar.

One can argue that the symbol and the decimals are specific for the "USD" and thus this info should not be kept in a redundant way like above. And I agree. Above merely constitutes an example of what to take into account.

If for example interest is calculated and compound interest especially, the bank will round the interest to the cent each year and calculate next periods interest given the resulting amount, not the fractions. (Remember a story about a restaurant at the end of time where you can eat if you once put a cent into an account and compound interest did the rest? That won't work because the interest will never add another cent.)
Long story short, you only need to keep an amount to the cent, so an integer value will do just fine, no decimal / floating point needed, only shift the decimal point / comma some positions.

You can keep a default currency and a currency table so people can set their defaults and also would be able to add Monopoly money or other game currency.

And unlike above what actually is shown when amount is requested:

>> amount
== $1.00

And depending on settings this could become

>> amount
== EUR 1,00

>> amount
== €1,00

That is my 2 cents here :wink:

That doesn't happen in the web REPL or my local builds. So you might investigate why it's happening in yours. Take it as a debugging challenge.

The principle question I have about the MONEY! datatype is really about how the $ character can be used for more interesting dialecting purposes. So if anything, it's usage for currency representation is a bit of a thorn.

I just updated the R3N repository to the latest status on Metaeducation and that fixed this MONEY! issue.

The use of the $ sign as currency symbol is limiting. Completely agree on that. On this side of the pond we have a euro sign that has its own troubles. The euro sign is on my keyboard(s) right on the 5/% key, but I cannot type it, unless I set the keyboard layout to UK but I won't because who know what other keys may not function any longer.

But back to the $. I have recently seen the $ sign used as a double delimiter $$ So perhaps the $ could be made of use when not in combination with a number value?

So how to free up the $ symbol?


USD1.10 <-- choose to set a currency 'string' / marker in some setting

Not money!:
$ 'followedbywhitespace

You guys are more creative than I am...