World: r3wp
[Core] Discuss core issues
older newer | first last |
Steeve 11-Jul-2011 [1709] | because it says so |
Geomol 11-Jul-2011 [1710] | Ok, got it from Andreas' example. Multiple values. :) |
Andreas 11-Jul-2011 [1711x2] | C-style fallthrough. |
(I think that was the intention behind that particular behaviour.) | |
Geomol 11-Jul-2011 [1713] | yup, cute! :) |
Steeve 11-Jul-2011 [1714x2] | the syntax of switch evolved |
it was different back... | |
Geomol 11-Jul-2011 [1716] | Damn, now I have to change my own switch. ;) |
Andreas 11-Jul-2011 [1717x2] | Yes, I think back in 2.5 (or earlier), switch 'a [a 1] actually returned 1. |
Ah, that was still the case in 2.6, even. | |
Geomol 11-Jul-2011 [1719] | I'm behind schedule, since I haven't noticed this. |
Andreas 11-Jul-2011 [1720] | 2.7.2 it was: http://www.rebol.net/upnews/0008.html |
Maxim 11-Jul-2011 [1721] | the change to switch was a good thing... wasn't it also mezz code a wee back? IIRC this happened at the same time... and it made A LOT of code much faster. |
Ladislav 11-Jul-2011 [1722] | >> - 2 + - 2 ** Script error: - operator is missing an argument |
Maxim 11-Jul-2011 [1723] | is that in R3? |
Ladislav 11-Jul-2011 [1724] | in R3, the - operator is not unary |
Maxim 11-Jul-2011 [1725] | or should we say, there is no unary version of the - operator? |
Ladislav 11-Jul-2011 [1726] | That is false, actually |
Maxim 11-Jul-2011 [1727] | what is false? |
Ladislav 11-Jul-2011 [1728] | what you wrote |
Maxim 11-Jul-2011 [1729] | in R2 - can be either, no? |
Ladislav 11-Jul-2011 [1730] | in R2, the - operator is both unary and binary, and its arity is determined during interpretation |
Maxim 11-Jul-2011 [1731] | so what is the diferrence in R3? |
Ladislav 11-Jul-2011 [1732] | in R3, the - operator is not unary |
Maxim 11-Jul-2011 [1733] | well, that means there is only the binary version of the - operator. |
Ladislav 11-Jul-2011 [1734] | that is false, as I see it |
Maxim 11-Jul-2011 [1735x2] | tell me how : there is no unary version of the - operator != the - operator is not unary |
(I'm trying to understand what you mean... really) | |
Ladislav 11-Jul-2011 [1737] | 1) There are not unary version and binary version of the - operator in R2, there is just one - operator in R2, which is both binary and unary depending on the "situation" 2) The statement "there is no unary version of the - operator" may be true only if you state, that NEGATE is not a unary version of the - operator |
Maxim 11-Jul-2011 [1738] | ok, well, to me the negate function is not an operator, but I understand what you mean. |
Ladislav 11-Jul-2011 [1739] | I wrote: "...which is both binary and unary...", I could have written "...which is neither binary nor unary, since it does not have fixed arity, its arity being dependent on the situation..." |
Geomol 12-Jul-2011 [1740x2] | Would people miss unary minus in R3? |
Ladislav, do you mean "fixed parity"? And yes, there seem to be just one minus '-' in R2. If you redefine - with something like: set '- ... , then you don't have unary minus any longer. | |
Ladislav 12-Jul-2011 [1742x2] | 'Ladislav, do you mean "fixed parity"?' - no, I did mean "arity", not "parity" |
And, in R2, the - operator is, in fact, variadic, having neither arity 1, nor 2 | |
Geomol 12-Jul-2011 [1744] | I learned some new words, thanks! :) |
BrianH 12-Jul-2011 [1745x3] | Would people miss unary minus in R3? - Initial testers reported its lack as a bug. The bug was dismissed, since this was an intentional change. The benefits of the reduced ambiguity won them over once they got used to it. |
variadic - nice, I love precise words :) | |
There is a trick in R3 for variadic functions, but it only works for the last arguments of a function, not the first, and only when the function is called at the end of the block/paren/script. >> a: func [x [any-type!]] [type? :x] >> a ** Script error: a is missing its x argument >> a: func [:x [any-type!]] [type? :x] >> a == unset! >> a: func ['x [any-type!]] [type? :x] >> a == unset! The trick is to use a lit-word or get-word argument and allow it to accept unset! values. This is used mostly for console interactive functions like CD. | |
Maxim 12-Jul-2011 [1748] | that's neat |
BrianH 12-Jul-2011 [1749] | In R2, the first example would work too: >> a: func [a [any-type!]] [type? get/any 'a] >> a == unset! But in R3 that behavior is being discouraged on purpose, to make code easier to debug, so the alternate argument types are required. |
Ladislav 12-Jul-2011 [1750] | ...lit-word and get-word argument... - please stop using that misleading terminology. The former is, in fact a "partially evaluated argument", the latter is "unevaluated argument". See the documentation. |
Steeve 12-Jul-2011 [1751] | ... |
Ladislav 12-Jul-2011 [1752] | lit-word argument would need to be an argument that is a lit-word, etc. |
Steeve 12-Jul-2011 [1753] | it's hurting noone |
BrianH 12-Jul-2011 [1754] | I'll try, but the alternative terms aren't precise enough for me to remember. |
Ladislav 12-Jul-2011 [1755] | But the meaning is documented, so try to read the doc (it was Carl who documented it, not me) |
BrianH 12-Jul-2011 [1756] | Fair enough, I'll try. Those terms only work when you immediately follow them with code examples that display the precise meaning. Not a bad habit to stick to anyway :) |
Steeve 12-Jul-2011 [1757] | The declarative forms, like they are written in the specs of a function are trully lit-word! and get-word. I don't understand why you get so upset about that |
BrianH 12-Jul-2011 [1758] | I prefer to think of them as designations rather than descriptions. |
older newer | first last |