World: r3wp
[!REBOL3]
older newer | first last |
Ladislav 22-Jan-2011 [7257] | ist - read as "is not", please, I messed the cut and paste, sorry |
BrianH 22-Jan-2011 [7258] | As long as they behave the same, sure, why not? Words have pointers and integers don't, but they both keep with the behavior of that group. |
Ladislav 22-Jan-2011 [7259] | Nonetheless, if you like you can think of all value slots as being references, but these are not necessarily references in the C pointer sense. - correct, I do not want to say, they are references in the C pointer sense, that should be emphasized". |
BrianH 22-Jan-2011 [7260] | Right. This is all an elaborate way of pointing out that we don't actually disagree on how things work :) |
Ladislav 22-Jan-2011 [7261] | I guess, that I owe a little more to the readers, so here is an example illustrating what I actually mean: let's define a block as follows: a-block: [[1] [2]] at the present state, it is obvious, that first a-block and second a-block are not identical illustration: same? first a-block second a-block ; == false now, let's use the CHANGE function: change/only next a-block first a-block a-block ; == [[1] [1]] due to the way we did it, and due to reflexivity of identity, first a-block and second a-block yield the same value, after this operation ("the same" in the sense, that there is only one value, which happens to be the value both expressions yield.) since first a-block and second a-block are two expressions yielding just one value, we conclude (as a consequence of that), that the respective value is not contained in the first slot of the A-BLOCK block (if it were "contained" in there we could not be able to see, that the value is actually not "contained" in there) Usíng the same approach for any other REBOL value, we can demonstrate, that no value is "contained" in "value slot". Since we *can* find out "Which value is the first a-block value?" there is only one conclusion we can make: using the first a-block expression we can refer to the value (this is why I use the words "reference", "refer"), but that does not mean, any other "reference" cannot "refer" to that value as well, thus the value "is not contained", but just "referenced". |
BrianH 22-Jan-2011 [7262] | Another (less useful) way to look at it is to say that no value is really the same as or identical to any other value, only to itself (the same value slot). But since that's a useless way to look at it, we instead compare the bits of the different value slots and if they match we then say that they are the SAME? (or IDENTICAL?, depending on how many bits we are comparing). Expediency for the win! |
Ladislav 22-Jan-2011 [7263x4] | Another (less useful) way to look at it is to say that no value is really the same as or identical to any other value...Expediency for the win! - yes, that is where the expediency is what should win, exactly as you pointed out. |
(We need to have the documentation mentioning Rebol values, compare results of different expressions to find out whether they are identical or not, document whether some value is modified by some function, ...) | |
no value is really the same as or identical to any other value, only to itself (the same value slot). - well, the first part of the sentence is a law of logic - nothing can be identical with any other thing except for itself - which is true, and I even used that law to define the identity | |
The problem is only with the second part of the sentence, "trying" to identify Rebol values as "value slots", which is not useful, and wrong. | |
BrianH 22-Jan-2011 [7267x2] | And then you defined "value" to be something referred to by the value slot, not what was in the value slot, or the value slot itself. Without that definition, your definition of "identical" doesn't work. Which is why that was another way to look at it, the "other" in this case referring to way to look at what a value is and how to think of a value slot. |
I'm not saying that any of these definitions are wrong, but yours is more useful. | |
Ladislav 22-Jan-2011 [7269] | I should probably explain, why I added the "and wrong" part. I did it, since not all Rebol values are representable using 128 bits or less. In that case we must have more than 128 bits no matter how fervently we wish something else |
BrianH 22-Jan-2011 [7270x2] | Yeah. The main difference between what you are saying and what I'm saying is for that what you are referring to by values that don't fit in 128 bits, the values that are in the value slots are what I've been calling "reference values". Thus the distinction between "immediate" types and "reference" types. This is a similar situation to (primarily OOP) languages that make a distinction between boxed and unboxed values, except for us even the "unboxed" values are in a box: the value slot. Making this distinction lets us reuse the large amount of existing reasoning that has been applied to OOP languages. This is particularly helpful when we are trying to solve the same problems that many other languages are, but the existing research on those problems is being done by people working in those other languages. Finding comparable distinctions makes it easier to implement comparable solutions :) |
For instance, I'd hate to have to start from scratch in creating a concurrency model, especially when we can start from the Go model instead. | |
Andreas 22-Jan-2011 [7272] | > except for us even the "unboxed" values are in a box: the value slot. It's the extreme semantic overloading of "value", that is the problem here. :) |
BrianH 22-Jan-2011 [7273] | Isn't it always? It all depends on what you value i guess :) |
Andreas 22-Jan-2011 [7274x3] | Boxing is no good example in this case, as it describes something different. |
But the terminology underlying the boxing process actually is useful, namely value types and reference types. | |
The immediate! typeset in R3 captures (or at least tries to) the former. | |
BrianH 22-Jan-2011 [7277] | And we didn't make a typeset for the latter because not existing in the former is enough. |
Andreas 22-Jan-2011 [7278x3] | And Ladislav's "Identify" article is exceedingly useful in defining meaningful dimensions of the term "value" in REBOL's context. |
Specifying a "REBOL value" as the sum of it's attributes, for example. | |
One attribute common to all REBOL values being type. Other attributes being type-dependent. | |
BrianH 22-Jan-2011 [7281] | Yup. Works great until you try to use "value" in a sentence, because of English's ambiguity :( |
Andreas 22-Jan-2011 [7282x3] | Even the actual "payload data" of a REBOL value is a type-dependent attribute. |
(unset! or none! values having no such "payload data", for example.) | |
And now of course the problem is, that we refer to different entities as "value", depending on context. Amongst those entities often referred to as "value" are: - the "REBOL value", as defined above - the "payload data" of a "REBOL value" - the "value slot" implementation detail | |
Oldes 23-Jan-2011 [7285x3] | Is there a way how to mold error into nice looking string? |
I mean... I can do: >> if error? err: try [1 / 0][probe err false] make error! [ code: 400 type: 'Math id: 'zero-divide arg1: none arg2: none arg3: none near: [/ 0] where: [/ try] ] == false but what if I would like to form the error message to look like if the error is really evaluated: >> do err ** Math error: attempt to divide by zero ** Where: / try ** Near: / 0 | |
Can we have the error message formater available or is it hidden for some security or other reason? | |
Kaj 23-Jan-2011 [7288] | I format them myself |
Oldes 23-Jan-2011 [7289] | how... do you have a list of all available error ids? |
Pavel 23-Jan-2011 [7290x2] | is there any idea how to place an break point int code for debugging reason, and release it (continue)? |
int = into | |
Sunanda 23-Jan-2011 [7292] | Oldes - you can try to grab them out of here, but not sure how easy that will be: probe system/catalog/errors |
Oldes 23-Jan-2011 [7293x5] | thanks... that's what I was looking for. |
Pavel... I usually use ASK with any value/message as a break point while debugging. Or just PROBE is I don't need to stop the evaluation. | |
Sunanda: not so easy, require some binding. | |
So far I have this: my-attempt: funct[code /local val][ either error? set/any 'val try code [ val: to-object val do bind [ print rejoin [ "!! " val/type " error: " reduce system/catalog/errors/(val/type)/(val/id) #"^/" "!! Where: " val/where #"^/" ;"!! Near: " val/near #"^/" ] ] val false ][ :val ] ] my-attempt [debase #ff] my-attempt [1 / 0] but not perfect... the Near and Where info is modified :-/ | |
How to convert issue! to binary! in R3? I was using debase in R2, but it's not working anymore (I guess because of unicode). | |
Henrik 23-Jan-2011 [7298x2] | small observation: >> any-word? #a == true |
that is possibly why it no longer works. | |
Oldes 23-Jan-2011 [7300] | hm.. so debase/base next to-string #ff 16 |
Pavel 23-Jan-2011 [7301] | 2 Oldes Great idea thanks |
Maxim 23-Jan-2011 [7302] | Oldes, wasn't there a function in R3 which allows you to get the string from an error...directly? |
Oldes 23-Jan-2011 [7303] | I was using this function in R2: parse-error: func[ error [object!] /local type id arg1 arg2 arg3 where err-desc ][ type: error/type id: error/id where: mold get/any in error 'where either any [ unset? get/any in error 'arg1 unset? get/any in error 'arg2 unset? get/any in error 'arg3 ][ arg1: arg2: arg3: "(missing value)" ][ arg1: error/arg1 arg2: error/arg2 arg3: error/arg3 ] err-desc: system/error/:type rejoin [ "** " err-desc/type ": " reduce either block? err-desc/:id [ bind system/error/:type/:id 'arg1 ][ err-desc/:id ] newline "** Where: " where newline "** Near: " mold error/near ] ] >> f: does [1 / 0] >> if error? err: try [f][print parse-error disarm err] ** Math Error: Attempt to divide by zero ** Where: f ** Near: [1 / 0] In R3 the WHERE and NEAR report is different |
BrianH 23-Jan-2011 [7304] | Plus, there is a long-term CC ticket about the off-by-one Near for operator-generated errors. |
Oldes 23-Jan-2011 [7305] | Yes.. I just wanted to write, that the NEAR is the main problem. |
Kaj 24-Jan-2011 [7306] | I just have this: |
older newer | first last |