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

World: r3wp

[Core] Discuss core issues

Ladislav
19-Sep-2005
[2113]
>> 5 - 2
== 3
>> 5 negate 2
== -2
Romano
19-Sep-2005
[2114x2]
only in rare case
you need absotutely negate instead of -
Ladislav
19-Sep-2005
[2116]
OK, this case looks rare to you, how about this case:
    add 5 negate x ...
    add 5 - x
Romano
19-Sep-2005
[2117]
rare case , at least for me,  in my experience, and you can always 
use

add 5 ( - x )

which is also more fast
Ladislav
19-Sep-2005
[2118x2]
yes, I can, it just needs parentheses, i.e. may be considered less 
readable (a matter of taste, I think)
e.g. Carl is preferring to use NEGATE instead of parenthesized - 
AFAICT
Geomol
19-Sep-2005
[2120]
Taking the example with add, 5, negate and x, we can write:
add 5 negate x
add 5 (- x)
5 + negate x
5 + (- x)
+ 5 negate x
+ 5 (- x)


and using Ladislav's +-: :negate, you can change negate to +- in 
the above. In REBOL there're really many ways to write even the simplest 
thing.
Romano
19-Sep-2005
[2121]
also:
5 + - 2
Geomol
19-Sep-2005
[2122]
And if x is negative:
5 + - -2
:-)
Romano
19-Sep-2005
[2123]
I think that was a wrong choice to permit the use of op! like action!
Geomol
19-Sep-2005
[2124]
This last one is just not as readable as: 5 + negate x
(I think)
Carl
19-Sep-2005
[2125x3]
This is a *very* tricky thing in REBOL!
It was a difficult decision to allow it.
>> - 10
== -10
>> 5 + - 10
== -5
Geomol
19-Sep-2005
[2128]
It is? :-) It's good to have choices, when it comes to expressing 
yourself.
Carl
19-Sep-2005
[2129]
In fact, supporting unary minus slows down REBOL, because it is a 
single "special case" condition within the evaluation processs.
Geomol
19-Sep-2005
[2130]
oh, hmm a hit on performance may not be so good.
Ladislav
19-Sep-2005
[2131]
what do you personally think about using +- as a shortcut for NEGATE?
Tomc
19-Sep-2005
[2132]
I am not fond of the idea of using plusminus for negate.  I have 
seen tilde used to denote negation and would perfer something visably 
distinct
Geomol
19-Sep-2005
[2133]
Carl, didn't you write some guidelines for the order of arguments 
to functions at some time? That destination arguments should be first, 
source later.
Ladislav
19-Sep-2005
[2134]
tilde is not very accessible using the Czech keyboard
Romano
19-Sep-2005
[2135]
it is the context which select - as
1) unary minus (- 2)
2) subtract op!  (2 - 3)
3) subtract action! (- 2 3)
- is a monster! :-)
Ladislav
19-Sep-2005
[2136]
:-)
Carl
19-Sep-2005
[2137x4]
WRT +-  It seemed to me that there was another good reason to give 
that other meaning.
It is possible to imagine a "range" or "interval" datatype that may 
need +- word.
Regarding order of arguments:
The fundamental rule is an abstraction - it is this: the primary 
"focus" or "object" of the function or action is first.
Geomol
19-Sep-2005
[2141]
Makes sense.
Carl
19-Sep-2005
[2142x3]
So it is: verb main-object modifiers (or other objs)
(Rather than direction of evaluation flow or direction of human reading 
flow.)
Shells often use: verb source destination
Geomol
19-Sep-2005
[2145]
Carl, I ask, because I'm writing REBOL-versions of some of the old 
Amiga graphics.library functions. BltBitMap e.g., in the Amiga version, 
the arguments are: source bitmap, source position, destination bitmap, 
destination position, mask, etc...
Should I turn source and destination around in a REBOL version?
Carl
19-Sep-2005
[2146]
In that case, when source and destination are of equal weight, then 
you can apply other rules.
Geomol
19-Sep-2005
[2147x2]
Or rather: what would you do?
ok
Carl
19-Sep-2005
[2149]
It depends on if you want to keep it true to the Amiga order, or 
if you are creating something new.
Geomol
19-Sep-2005
[2150x2]
I plan to let the functions be available to other developers, so 
I was wondering, what people would feel as the right 'REBOL' way.
My idea is, that it's new, but Amiga developers should recognize 
it.
Carl
19-Sep-2005
[2152x4]
In the example you show above... it seems good.  The source bitmap 
could be considered the primary object, although the dest is also 
very important.
Romano, yes, it is a monster!
Neg for negate may be simplest. We already have abs for absolute.
And, it seems that there are people pushing for sin (sine), cos (cosine), 
tan, etc.
Romano
19-Sep-2005
[2156]
I should remember that the doc of the original functions are in source-destination 
order, so for me is a good idea to make the same in Rebol,  there 
a direct map of OS function and OS doc on rebol functions
Geomol
19-Sep-2005
[2157]
Yeah, I should probably keep the order of the arguments, as they 
are in the Amiga version, so it'll be recognizable. Thanks! :-)
Graham
19-Sep-2005
[2158x5]
The word browser is nice, but I spend most of my time in the console. 
 How about a man command that looks up the manual pages on the net, 
and dumps them to the console?
And since the console responds to escape sequences, we could even 
have some formatting ?
I thought tags were a special form of strings ...
However, this appears not to be the case ...

>> probe rejoin [ "<html>" "testing" "</html>" ]
<html>testing</html>
== "<html>testing</html>"
>> probe rejoin [ <html> "testing" </html> ]
<htmltesting</html>>
== <htmltesting</html>>
>> html: ""
== ""
>> repend html [ <html> "testing" </html> ]
== "<html>testing</html>"