Should We Keep The Comma'd DECIMAL!/MONEY! Format?

When first seeing Rebol, I thought there was an interesting line of argumentation in "commas and periods are so visually similar, they shouldn't do different things in the language."

This made it seem like not much of a sacrifice to allow comma to mean the same thing as period. Having been to Montreal and seeing for myself that you can go places where things cost $1,95 and not $1.95 then I could see that someone out there in the world would find it useful...even if I did not.

But I'm completely sold on the COMMA! value type now.

This doesn't necessarily mean dropping comma support in numbers. Because the rule for COMMA! is that there have to be spaces. And I've already taken 1. away as a DECIMAL! so that you have to write 1.0, hence there's no ambiguity in 1, - you would have to write 1,0

So What Harm Does It Do?

Main "harm" is that it doesn't allow more compressed COMMA! forms:

[1,2,3]  ; can't write this
[1, 2, 3]  ; have to write this

I'm not too bummed about that. We might also say that internal commas are tolerated for things like URL! and ISSUE! and FILE!, but not terminal commas.

%foo,bar  ; loads as [%"foo,bar"]
 %foo, bar  ; loads as [%foo, bar]

There's more potential for accidents. People might write:

[1,2]  ; let's say they meant [1, 2] (INTEGER! COMMA! INTEGER!)

...and instead of getting an error they'd get [1.2] (DECIMAL!)

Outside of that you've got people writing things in different ways for relatively little value. People from the weird places that use this format already know they're weird, and have to adjust for nearly every other language. Why choose this particular battle for expression, when there's so much else to be worried about?

I Don't Have Strong Feelings

The only time I ever thought about it was when I brainstormed that we might use comma as the only format for DECIMAL! so that 1.2 could be a TUPLE! of integers...which I didn't care so much about because I don't use DECIMAL! hardly ever in scripting languages. But other people do, and want the familiar format. So we're now looking at 1x2 as being a two-element integer tuple, a.k.a. a PAIR! (there would no longer be decimal pairs, but given that Red doesn't support those either, that supports my observation that they seem more trouble than they are worth.)

The default will be to just let the format stick around, I guess.

2 Likes

I've never used commas in those values, but it's probably better to have someone else weigh in for a more global/international perspective.

From this side of the Atlantic, I say it is much better to drop the dot as decimal separator. The use of the hardly visible dot as thousands separator is of course much better. But it is probably what you have been learned from a young age that makes it a sentimental point.
The phrase in every COBOL program in the world (except for the US) is DECIMAL POINT IS COMMA.
It was a wise viewpoint of Carl to acknowledge this use overseas. It made the acceptance of the language elsewhere much easier and kept attention long enough to notice all kinds of other well thought out points, and make it stand out as not just any other 13 in a dozen languages that keep popping up.
As I see it, a thing with 2 or more comma's is no decimal, as are comma's followed by space, There could be a dispute on ,5 being half. but that may also be a convention that the language says it must be 0,5 (or 0.5). Besides the 1.5 decimal and the 1.2.3 tuple are also coexisting.
So [1,2] is a block! containing a decimal!
So keep is a definitive yes for me.

2 Likes