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

World: r3wp

[!REBOL3-OLD1]

BrianH
3-Jun-2009
[15067]
It still wouldn't replace money!, because the international standard 
syntax for specifying money uses a prefix, not a suffix.
Maxim
3-Jun-2009
[15068x2]
notice the inch handling ?
;-)
Steeve
3-Jun-2009
[15070x3]
it would, if instead of switch functions we'll use parse
it's the same idea, of having computed/values (with accessors)
But Carl don't like the idea
Maxim
3-Jun-2009
[15073x3]
no steeve, at that level, its the rebol lexical analyser.
we can't just but-in parser rules.  its a core level of the interpreter.
you can just use load/next in a parser rule... I've done it often 
and it works.
Steeve
3-Jun-2009
[15076x2]
it has nothing to do with the lexical analyser, we just need a new 
data type, to construct computed variables
internally, those variables would be sort of objects with methods
Maxim
3-Jun-2009
[15078]
but I would like a way to get invalid tokens loaded as invalid values... 
that way I'd use block parsing .  so far, I've been using string 
parsing about 90% of the time.  its a shame, since I'm loading stuff 
much more slowly than rebol could let me do it using its native loading.
Steeve
3-Jun-2009
[15079]
but behaving like regular variables
Maxim
3-Jun-2009
[15080x2]
we are talking about representing the lexical form of unit-like values 
here steeve, not the custom datatypes.
all OOP with accessors do exactly what you want.
Steeve
3-Jun-2009
[15082x2]
i'ts the same thing, you just need a specific method (ie. dispalyed-as) 
for the computed vars
yes i can do it with OOP, but i don't want to have to code stupid 
things like my-var/set, my-var/get
BrianH
3-Jun-2009
[15084]
But Carl don't like the idea

 - as I recall, changes in object semantics have been put off until 
 later, not permanently.
Maxim
3-Jun-2009
[15085x3]
 those variables would be sort of objects with methods

  that is exactly WHAT an accessor-enabled variable IS  , also known 
  as a datatype   ;-)
the accessors are just events... you have to know WHEN and WHAT to 
do with a variable...   It would be fun if generic objects allowed 
us to set accessors per instance, just like python allows it, but 
alas, Carl doesn't realise just how often this could be used to simply 
a vast array of code.
simply = simplify
BrianH
3-Jun-2009
[15088]
(repeating myself) As I recall, changes in object semantics have 
been put off until later, not permanently.
Steeve
3-Jun-2009
[15089]
i don't ask a new semantic for objects (with obvious drawbacks)
i ask for a new datatype, let the objects like they are
BrianH
3-Jun-2009
[15090]
All bound words are object fields or function context fields, so 
that is exactly what you are asking for.
Steeve
3-Jun-2009
[15091]
yep so do it now :-)
BrianH
3-Jun-2009
[15092]
put off until later, not permanently
Sunanda
3-Jun-2009
[15093]
Petr < has anyone problem, if money! datatype would be renamed to 
unit!>

Agreed ---- It seems likely that if money! had not existed in R2, 
none of us would be expecting R3's BCD datatye to be called money!

Given that so much of R3 is a break from R2, Let's make the small 
change [deliberate currency pun] and give it a better name.
We could keep money as a subtype of that.
BrianH
3-Jun-2009
[15094]
Since objects are the basis of all datatypes where words can be bound, 
we are focusing on the design of those other datatypes first so we 
get a better idea of the requirements for objects. Other datatypes 
like modules and tasks, for example.
Steeve
3-Jun-2009
[15095]
as-is!
(which mean nothing or all)
BrianH
3-Jun-2009
[15096]
?
Steeve
3-Jun-2009
[15097x2]
I was answering to Sunanda, a new name to replace money!
exact!
BrianH
3-Jun-2009
[15099x4]
Maxim's suggestion might work syntactically, but we would lose the 
money! syntax, which is the ISO standard syntax for currency. If 
we added a unit! type with Maxim's syntax we could use the same implementation 
internally for both money! and unit!.
They would just differ in syntax.
However, remember that there are limits to the number of possible 
distinct units loaded at once. The value doesn't have more than 1 
byte available to refer to a unit, which means 255 possible units 
in use when you subtract the unspecified unit.
Carl had a blog about this related to money! ...
Steeve
3-Jun-2009
[15103]
well, in some time, the dollar wil disappear, so we'll got one more 
unit free
BrianH
3-Jun-2009
[15104x2]
I'm just using money! and unit! as placeholder names for the two 
datatypes though. Final names should be decided. The money! name 
is a good one for the current money! syntax because the syntax matches 
the international currency syntax standard.
The $ is part of the ISO standard, as is the limit of 3 alphabetic 
characters preceeding it.
Maxim
3-Jun-2009
[15106]
quoting brian " the syntax matches the international currency syntax 
standard" well... to me that's resoved then .... lets call it currency! 
  :-)
BrianH
3-Jun-2009
[15107]
money! means the same thing and is shorter :)
Maxim
3-Jun-2009
[15108x2]
I've just looked up the terms in the dictionnary ... and money actually 
encompasses currency, so it actually is the more precise term here... 
 funny, I had the two words inversed in my head.
funny no one noticed the big lexical change proposed in my example 
unit-conversion example  ... or no one spotted it   ;-)
BrianH
3-Jun-2009
[15110]
I just translated the function to a more efficient method in my head. 
What is the lexical change you mention, aside from the unit syntax?
Maxim
3-Jun-2009
[15111x2]
I meant to say:  "no one argued about the .... "
note how inches are represented lexically... ;-)
BrianH
3-Jun-2009
[15113]
Oh, the unit syntax. There would be limits to what you could do, 
but the principle is sound. You probably wouldn't be able to do 1".
Maxim
3-Jun-2009
[15114]
hehe actually we could, but I understand that it woul make the lexical 
analyser that much more complex than it is already with the "" vs 
{} handling inside/outside of each other... adding the " to word 
would really make it complex. so I don't expect or specifically "want" 
it, just was wondering if some of you would react to it  ;-)
BrianH
3-Jun-2009
[15115]
The lexical analyzer has syntax priorities - some characters are 
delimiters, " being one of those.
Maarten
3-Jun-2009
[15116]
You need first-class functions to have continuations.