World: r3wp
[!REBOL3-OLD1]
older newer | first last |
Oldes 13-Feb-2007 [2046] | but I understand, that if would be inconsistent with other Rebol actions like [abs negate ...] |
Maxim 13-Feb-2007 [2047x2] | but these are not ops. they are functions. |
maybe its time REBOL had a better support for ops. | |
Oldes 13-Feb-2007 [2049x2] | I really don't know if there is any advantage, that (add a 5) doesn't change the value of a. But I'm not expert so will let the decision on someone else. |
I'm sure I never used (a: add a 1) | |
Maxim 13-Feb-2007 [2051] | exactly. so current add is just useless luggage. |
Oldes 13-Feb-2007 [2052x2] | and using (a: add a 1) is slower than (a: a + 1) so I really would like to change it. |
the only advantage is that I can write 10 * add a 1 instead of 10 * (a + 1) - but as it's slower, why I should do it? | |
Ladislav 13-Feb-2007 [2054x2] | Maxim: "geomol and others... INC with lit-words is seriously flawed in actual use ... a: inc a..." If I understood you well, you are saying, that you don't like an expression of the type: inc 'a, since the 'a looks unnatural to you. How about inc pick [foo bar] 1 then? |
...or inc first [foo] ? | |
Maxim 13-Feb-2007 [2056] | what is: inc pick [foo bar] 1 or rather, how often/when is this going to be used? |
Oldes 13-Feb-2007 [2057x2] | I have nothing against lit-words. But maybe would like more inc a to increment a and change the value of a as well. |
what would be faster: inc some/object/some/value or some/object/some/value: inc some/object/some/value ? | |
Ladislav 13-Feb-2007 [2059] | inc (evaluate_something) : if you cannot use it, then the language's orthogonality is "impaired" (the language is referentially nontransparent, there are places, where you cannot put/evaluate an an expression |
Maxim 13-Feb-2007 [2060] | in this case: inc pick [foo bar] 1 there is nothing stopping inc from changing foo or bar also just like you? |
Ladislav 13-Feb-2007 [2061] | do not understand your question... |
Maxim 13-Feb-2007 [2062x2] | I just ask why inc A would behave differently than inc 'A |
obviously, if A contains something else than a scalar, an error is raised. | |
Ladislav 13-Feb-2007 [2064x3] | because it is exactly the same case as in: a: 1 equal? a 1 ; == true , where we don't want to compare the variable with one, but the result of the expression (a), which is one |
if we had: equal?*: func ['value1 'value2] [equal? :value1 :value2], then such a function would be totally useless | |
...since >> equal?* a 1 == false | |
Maxim 13-Feb-2007 [2067] | yes... but equal is a function... not an op ;-) |
Ladislav 13-Feb-2007 [2068x3] | what? equal? is a prefix version of the = op |
to be understood: I am not against side effects (changing the value of a variable), I am against nontransparency "impairing" the language | |
Maxim: I guess, that your anti lit-word contribution does not take this into account, does it? type? 'a ; == word! | |
Maxim 13-Feb-2007 [2071] | well type? evaluates 'a right? which really is a word... Am I right? |
Oldes 13-Feb-2007 [2072x2] | I'm not agains lit-word . But if I understand Maxim, he is scared, that in most cases we would use inc 'a because that's what at least the way I would used it - to change value of a |
and to be correct, I would need to for example to change it in object: inc some/object/a | |
Maxim 13-Feb-2007 [2074] | and inc 'a complicates other things ... |
Oldes 13-Feb-2007 [2075] | I really don't like, that now I have to write some/object/a: some/object/a + 1 |
Maxim 13-Feb-2007 [2076x2] | exactly what Oldes just illustrates |
but I understand what Ladislav means by inc 'a in evaluating 'a means increment the word which 'a points to. | |
Henrik 13-Feb-2007 [2078] | remove the inc 'a thing. Why would we need to check for lit words? it complicates things. |
Oldes 13-Feb-2007 [2079] | Yes, I understand it as well. So I was asking if we can than have inc some/object/'a (which I found quite cryptic) |
Maxim 13-Feb-2007 [2080] | whereas inc a means increment the content which is stored in a. which could be a word, in which case, it will change the content of that word directly. |
Ladislav 13-Feb-2007 [2081x2] | Maxim: "...I understand what Ladislav means by inc 'a in evaluating 'a means increment the word which 'a points to" - actually not, I see it differently. INC 'a means, that before the INC obtains the argument value, an expression is evaluated and its value supplied as an argument. *if* you disallow that, then you disallow expression evaluation |
and the funny thing is, that the lit-arguments don't disallow evaluation of all expressions, since the expressions of the :a type are evaluated! | |
Oldes 13-Feb-2007 [2083x2] | I give up... I'm lost in theory :-) |
just give me something better than: some/object/some/value: some/object/some/value + 1 | |
Ladislav 13-Feb-2007 [2085x2] | lost in theory? It is simple. INC is supposed to be a function. It either allows evaluation expression using normal argument, or it disallows expression evaluation using lit-argument. |
what I say is bad is to disallow expression evaluation, since REBOL is an expression - based language, as you may recall | |
Oldes 13-Feb-2007 [2087] | Ok, that I understand. |
Ladislav 13-Feb-2007 [2088x2] | that still may mean you may be able to write: inc 'a/b |
(but don't forget about complications, when A is a function!) | |
Geomol 13-Feb-2007 [2090] | There might be options to solve the path situation: inc some/object/some/'value inc some/object/some/('value) or maybe inc '(some/object/some/value) Just suggestions. If you think, "inc a" should change a, then think about these, that we have today: negate a - a ; unary minus abs a Also many math functions, like: exp a log-e a etc. Why don't all those change a? |
Ladislav 13-Feb-2007 [2091] | I guess it is a rhetorical question, but allow me to answer: because we need NEGATE, EXP, etc. to be able to process a result of a REBOL expression |
Geomol 13-Feb-2007 [2092] | :-) |
Ladislav 13-Feb-2007 [2093] | like exp (a + b) |
BrianH 13-Feb-2007 [2094x2] | Oldes, how about: inc 'some/object/some/value or: increment 'some/object/some/value 5 The second version of my functions without the lit-word formal parameters will do just fine. |
I already solved the path situation. Read the code. | |
older newer | first last |