Oldes / Rebol-issues

Issue tracker for https://github.com/oldes/Rebol3
4 stars 0 forks source link

money! miss components #250

Open Siskin-Bot opened 4 years ago

Siskin-Bot commented 4 years ago

Submitted by: Geomol

>> m: DKK$1
== DKK$1.00

>> first m
** Script error: cannot use pick on money! value

Imported from: CureCode [ Version: alpha 31 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:none ] Imported from: https://github.com/rebol/rebol-issues/issues/250

Comments:

Rebolbot commented on Aug 29, 2007:

Submitted by: admin

For R2 doc, http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.4


Rebolbot commented on Jan 20, 2009:

Submitted by: BrianH

Money currently doesn't support currency designators in R3, so I can't run the example code. If the currency designator syntax was removed intentionally, there is no reason for FIRST to work.


Rebolbot commented on May 14, 2009:

Submitted by: Carl

See this note: http://www.rebol.net/r3blogs/0201.html


Rebolbot mentioned this issue on Jan 12, 2016: pick (and first/second) and poke still allow money! for their value type function to retrieve/set currency in money! value


Rebolbot added the Type.bug on Jan 12, 2016


Hostilefork added Type.bug and Ren.important on Mar 22, 2018


Oldes commented 3 years ago

Currency component is already implemented in Red language. It has fixed list with 170 currency ids system/locale/currencies/list:

[AED AFN ALL AMD ANG AOA ARS AUD AWG AZN
 BAM BBD BDT BTC BGN BHD BIF BMD BND BOB
 BRL BSD BTN BWP BYN BZD CAD CDF CHF CKD
 CLP CNY COP CRC CUC CUP CVE CZK DJF DKK
 DOP DZD EGP ERN ETB ETH EUR FJD FKP FOK
 GBP GEL GGP GHS GIP GMD GNF GTQ GYD HKD
 HNL HRK HTG HUF IDR ILS IMP INR IQD IRR
 ISK JEP JMD JOD JPY KES KGS KHR KID KMF
 KPW KRW KWD KYD KZT LAK LBP LKR LRD LSL
 LYD MAD MDL MGA MKD MMK MNT MOP MRU MUR
 MVR MWK MXN MYR MZN NAD NGN NIO NOK NPR
 NZD OMR PAB PEN PGK PHP PKR PLN PND PRB
 PYG QAR RED RON RSD RUB RWF SAR SBD SCR
 SDG SEK SGD SHP SLL SLS SOS SRD SSP STN
 SYP SZL THB TJS TMT TND TOP TRY TTD TVD
 TWD TZS UAH UGX USD UYU UZS VES VND VUV
 WST CFA XAF XCD XOF CFP XPF YER ZAR ZMW]

It does not allow custom currencies:

>> CZK$1
== CZK$1.00
>> XXX$1
*** Syntax Error: (line 1) invalid money at XXX$1
*** Where: case
*** Stack: load 

It does not allow math with not same currencies:

>> add USD$100 NZD$100
*** Script Error: USD$100.00 not same denomination as NZD$100.00
*** Where: add
*** Stack:  

It allows integer with money math:

>> 10 + USD$100
== USD$110.00
>> 10 * USD$100
== USD$1000.00