r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Pekr
19-Aug-2007
[4146x2]
well, look - we've got BCD for the money, right? so there is the 
solution for those who need it. But i would vote for another kind 
of expressing units, more general. IMO money! is the most useless 
datatype in REBOL. My proposition really is 123'456.123[unit], where 
'unit would be of no meaning to not complicate things - simply 123[USD] 
+ 123[EUR] would be 246[USD] - the first occurance of the unit.
I can even imagine unit conversion table, so that we could get even 
USD + EUR result .... and if expression would contain some non transferrable 
units, e.g. USD + kg, then error would be raised ...
Geomol
19-Aug-2007
[4148]
Write that down somewhere (other than only here). When the DocBase 
go public, there could be a place there for new ideas and suggestions.
Gabriele
19-Aug-2007
[4149x6]
[...] can't be done
kg$123 is not that bad - other languages have much weirder syntax.
maybe, we can do 123#kg but i don't see a big improvement here.
kg#123 may be possible too.
or 123$kg
rebol has very few "special" characters. so you'd have to pick between 
# $ %.
Pekr
19-Aug-2007
[4155]
or we just could state, that $ is simply a unit char. And rename 
datatype from money! to unit! :-)
Gabriele
19-Aug-2007
[4156x6]
% is already used by percent! is is out of the question.
R2:
>> kg$100
== KG$100.00
so, yes, it's already that wa.
way.
maybe 123kg can be made to work, but, i don't know if it would create 
problems.
Pekr
19-Aug-2007
[4162]
that could mean some deeper changes to parser probably, no? Well, 
that is not much of an issue ....
Gabriele
19-Aug-2007
[4163x4]
>> 123kg
** Syntax Error: Invalid integer -- 123kg
** Near: (line 1) 123kg
syntax error means that we have a free spot in the parser there :-)
but, we should be careful with something like that, as it can get 
very confusing.
kg123 is a word for example.
Pekr
19-Aug-2007
[4167]
we already use # in many datatypes, no? hex, binary, special notation 
of #[none], some possible binary conversion functions were suggested 
as 16#{} etc.
Gabriele
19-Aug-2007
[4168]
yes, as i said, i think only # $ and % are "special" for the parser, 
so that you have to pick there. carl picked # for a lot of things 
because $ and % carry meaning.
Pekr
19-Aug-2007
[4169]
kg#123 and kg$123 sound equal to me. It is just that the datatype 
is called money! Dunno if english unit! term would be more descriptive/general 
...
Gabriele
19-Aug-2007
[4170x2]
#123 is an issue so kg#123 would mean that you always have to specify 
a unit... and a space by mistake becomes a subtle bug.
ok, so you basically just want to rename money! to unit! or something 
like that.
Pekr
19-Aug-2007
[4172]
yes, if BCD in general would be usefull for other things than money 
and bank apps meaning, then it could be the right time to do so. 
I was inspired by dictionary! to map! rename, so it seems the team 
is open to ideas in that regard....
Gabriele
19-Aug-2007
[4173]
yes, but dictionary does not break compatibility, money! would (view 
scripts don't run in r3 but core scripts may run quite well)
Pekr
19-Aug-2007
[4174x2]
I don't agree to that argument though. Even core will change, protocols, 
schemes are different, and btw - what about missing hash? I remember 
using hash, but I never used money! IMO money! is the least used 
datatype in REBOL :-)
but the issue is not really that big, so I can live with money!, 
although it will be kind of weird, if I will use it for weight or 
other unit, when the need of BCD would arise ..... well, maybe I 
will not even need BCD, so .... :-)
btiffin
19-Aug-2007
[4176]
Petr; I use money! all the time with the contruction accounting scripts. 
 Bosses love it, until I have to pummel them for using commas in 
big money! and with construction projects it doesn't take long to 
get to a monkey.
PeterWood
19-Aug-2007
[4177x2]
Gabriele: Why not leave money! just as it is for compatibility for 
the people who want to use it and introduce a Fixed! type. (I didn't 
call it BCD because apparently it isn't). The following behaviour 
(modelled on IBM 360) would be ideal:

>>fixed-dec: 1.98F2
== 1.98
>>type? fixed-dec
== fixed!
>>print fixed-dec
== 1.98
>> probe fixed-dec
== 1.98F2
>>2F2 / 3F2
== 0.66
>>2F2 / 3F2 + 0.005F3
== 0.67
To keep Brian's construction bosses happy you could allow the use 
of  thousand separators eg
>>fixed-dec: 1,000F2
== 1,000.00
Gabriele
20-Aug-2007
[4179x2]
changing how money is implemented does not break compatibility.
also, it's not bcd, but it's not fixed point either. it is 26 decimal 
digits floating point.
Pekr
20-Aug-2007
[4181x2]
why "standard" BCD aproach was not adopted? Is it binary represented 
or not? I mean - can we be sure that some weird rounding will not 
happen, and that the number stays allways the same?
I second fixed! datatype name .... or I propose unit!
Gregg
20-Aug-2007
[4183]
I'm sure there will be notes about why standard BCD was not used.
amacleod
20-Aug-2007
[4184]
vv.v,xc                         ,gbbokgtokio98tttttttttttttttttttttttttttttttttttttttttttttt8oolllllllllllllllk
Kaj
20-Aug-2007
[4185]
Hi Junior! :-)
Pekr
20-Aug-2007
[4186]
:-)
Henrik
20-Aug-2007
[4187]
I see another rebol coder coming up
Kaj
20-Aug-2007
[4188]
Could be a cat in the bag...
Pekr
20-Aug-2007
[4189]
so we'll finally get regular expressions engine in R3 :-)
Gabriele
20-Aug-2007
[4190x2]
petr: because this the current money! format is faster and takes 
less space (you can't pack 26 bcd digits in a rebol value otherwise)
it's still decimal (not binary) so no rounding problems when converting 
from string to internal representation.
Pekr
21-Aug-2007
[4192x4]
When will we be able to comment on new VID? I have found out link 
to docs. But I also don't want to open some discussion here, when 
other ppl might not be informed. The trouble is, that just because 
we are not let in in the early state of development, we might miss 
the influence on what the new VID will all be about ....
And I fear one things - it will all be cooked behind the scenes, 
and we will be presented with result. So far we were told to trust 
what the group comes up with, but I really wonder, what that group 
of 20 or so testers is doing, if docs contain things like using "-" 
char for "no value to change" meaning, instead of none :-)
I read every VID related doc more than 5 times, and I am only slowly 
starting to get the idea behind it :-) So I wonder - is new VID conceptually 
so complicated, or there is still not enough docs to get the idea? 
:-) There are already things I like a lot, but there are also some 
worries, although those migh show as minor. Maybe some better explanation 
(more docs) will help the situation ...
So far the most precise docs in View area are Cyphre's draw docs. 
Well, those are mostly a reference. I also like make-gobs doc.