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

World: r3wp

[Core] Discuss core issues

Graham
19-Sep-2005
[2094x3]
Better to have something expressive like 'negate than obscure symbol 
combinations.
Remember that Rebol is meant to be read like english.
memory copy operations are always source -> destination.
Geomol
19-Sep-2005
[2097]
I use negate several places in Canvas, e.g. to calculate the angle 
of an ellipse:

canvas/effect/draw/2: negate arccosine ((u/x * v/x) + (u/y * v/y)) 
/ divisor
Graham
19-Sep-2005
[2098]
that does not +- my argument.
Geomol
19-Sep-2005
[2099]
Graham, are they?
WRITE destination value
destination -- (Type: file url object block)
     value -- (Type: any)
Ladislav
19-Sep-2005
[2100]
NEGATE looks quite ugly to me:
    mod negate n scale
the
    mod +- n scale
looks more readable (to me again)
Geomol
19-Sep-2005
[2101]
But maybe write isn't considered a mem operation, even if destination 
is an object or block? Well, I'm not sure.
Ladislav
19-Sep-2005
[2102]
When there are both ABS and ABSOLUTE, I would prefer to have both 
+- and NEGATE too
Geomol
19-Sep-2005
[2103x2]
CHANGE series value

Change seem to have destination first aswell. Didn't Carl write a 
blog about it at some time?
Some say tomato and some say tomahto
Some say potato and some say 
potahto
Tomato, tomahto, potato, potahto
Oh, let's call the whole 
thing off
Ladislav
19-Sep-2005
[2105]
:-)
Geomol
19-Sep-2005
[2106x2]
I'm sure, Carl wrote something about the order of arguments somewhere, 
but can't find it!?
Like a "function arguments guideline"? Doesn't it ring a bell?
Gabriele
19-Sep-2005
[2108]
Ladislav: the short form for negate was intended to be -, but of 
course that can have its own problems. +- is not very readable to 
me though, as i wouldn't immediately associate it with negate.
Ladislav
19-Sep-2005
[2109x2]
well, there is a character used on calculators:  #"±", but I am not 
able to write it on Czech keyboard
OTOH, - isn't a shortcut for negate. Cf:
    a * negate x
Romano
19-Sep-2005
[2111]
> x: 2
== 2
>> 2 * negate x
== -4
>> 2 * - x
== -4
>> 2 - - x
== 4
>> 2 - negate x
== 4
>>
Ladislav
19-Sep-2005
[2112x2]
right, I picked wrong example, but anyway, - is not a NEGATE shortcut:
>> 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
[2142x2]
So it is: verb main-object modifiers (or other objs)
(Rather than direction of evaluation flow or direction of human reading 
flow.)