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

World: r3wp

[!REBOL3]

Ladislav
14-Nov-2010
[6103x2]
Which means, if I understood you well, that your favourite behaviour 
is:

    use [a] [type? get/any 'a] ; == unset!

as well as

    do has [a] [type? get/any 'a] ; == unset!

, the current behaviour

    use [a] [type? get/any 'a] ; == none!

and

    do has [a] [type? get/any 'a] ; == none!

being the second best only?

and

type?
(sorry for the cut'n paste mess at the end)
Anton
14-Nov-2010
[6105]
... Yes... but, if on a scale of 0 to 100, where 0 is unset! is my 
exclusive favourite and 100 is none! is my exclusive favourite, then 
my preference is about 49, with an uncertainty of ±10.
So I don't think my vote should count for much. :)
Andreas
14-Nov-2010
[6106]
+1 for consistency between /local and USE. Do not care much if the 
initialisation value used is none! or unset!.
Ladislav
14-Nov-2010
[6107]
So, assuming that it is "impossible to change the FUNC variable initialization 
convention", I count: USE3:USE2 = 4:0
Kaj
14-Nov-2010
[6108]
Please don't make REBOL into Haskell ;-)
Ladislav
14-Nov-2010
[6109x2]
Am I to understand, that some of the USE3/USE2 variants would do 
that?
Or, did you mean another property?
BrianH
14-Nov-2010
[6111x3]
+1 for R3's USE. Uninitialized variables aren't really as much of 
a problem when:
- They are declared right there where you can see them.

- They are initialized to a known value that you can rely on or test 
for.
And if we are really concerned with initializing the values, we can 
just use LET, even if we have to add it ourselves.
Oh, and -1 for "change the FUNC variable initialization convention". 
The same arguments apply to function variables.
Ladislav
14-Nov-2010
[6114]
USE3:USE2 = 5:0
Sunanda
14-Nov-2010
[6115]
Is this simply a variant of known existing issues; and, if so, is 
it what R3 intends?

    if all [return none][print "I was printed"]
        R3: ==I was printed
        R2: == ** Throw Error: Return or exit not in function

Ditto with BREAK, EXIT
BrianH
14-Nov-2010
[6116x4]
Crap, that affects IF too? I'll write up a ticket.
Wait, no, that is just #1509.
Nope, right the first time.
Darn, I had to look at the types-of to be sure. It's #1509.
Sunanda
14-Nov-2010
[6120]
Thanks, Brian, That was quick -- you know your error codes!
BrianH
14-Nov-2010
[6121]
Only the top dozen most important ones.
Sunanda
14-Nov-2010
[6122]
Ah, there will _always_ be a top 12.
Kaj
14-Nov-2010
[6123x2]
Am I to understand, that some of the USE3/USE2 variants would do 
that?
Just a joke, because the talk here is awfully mathematic, while REBOL 
is based more on English
BrianH
14-Nov-2010
[6125]
The words of REBOL are based on English. The semantics are based 
on math (though not always arithmetic).
Kaj
14-Nov-2010
[6126]
Ah, so I was right that you would like REBOL to become Haskell
BrianH
14-Nov-2010
[6127]
Haskell is based on some of the same math, but mostly different math. 
More lambda calculus, less (I don't remember the name for the math 
of languages with state modification).
Ladislav
14-Nov-2010
[6128x3]
Brian: "And if we are really concerned with initializing the values" 
- actually, I am not. I am more like one of those wanting to have 
it the same way in functions as well as in other locals. (like Henrik, 
Oldes, Anton, Andreas). That is currently the same in USE, which 
I do not object against. This way, only object (and module) fields 
are currently initialized to #[unset!], although in the newly proposed 
LET we can choose. BTW, it looks to me, that it is good, that LET 
can accept any-word!, i.e. be more flexible than USE.
On the other hand, I am not sure, whether it is a good idea to allow 
empty VARS block in LET - that looks like a user error to me.
(if I do not need any local variables, then I do not need to call 
the function creating them)
BrianH
14-Nov-2010
[6131x3]
Empty vars or values blocks, like all of the other assignment-related 
characteristics of LET, serves the same purpose that they do in SET. 
Remember, a lot of the time LET will be used on data, not just inline 
words and values. Sometimes you want to screen for #[unset!], because 
being screened for is the whole point to that datatype, so setting 
it should be an option like it is with SET. Other times the words 
will be collected from the body, such as with COLLECT-WORDS/set. 
It is not necessarily an error if there are no words - it depends 
on the programmer's intention.
Doing a block with set-words set to a local context and initialized 
to none: let collect-words/set block none block. Still correct if 
there are no set-words.
Yeah, working with any-word! is good. I first read any-type!, so 
that is why I rehashed the unset argument, sorry.
Ladislav
15-Nov-2010
[6134x2]
My note to the "rehashed #[unset!] argument": I like the "The whole 
point of #[unset!] is to trigger errors" formulation. Nevertheless, 
it is broken in a big way by USE and function contexts. Only any-object 
contexts adhere to this convention now, so it is an error to write.:

context [
    print a
    a: 1
]

, while a corresponding

use [a] [
    print a
    a: 1
]

would be an error in R2, but not in R3 anymore, while

do has [a] [
    print a
    a: 1
]

was not an error even in R2.


Therefore,  "The whole point of #[unset!] is to trigger errors" is 
true, but, as demonstrated, the #[unset!] value is sneakingly losing 
its point to the extent, that it is becoming negligible. BTW, this 
is one more "arms race", which a protection measure is losing when 
confronted with the freedom of a programmer to write code he likes 
to write. The previous victim of this race in the datatype space 
seems to be the #[none!] value (at least to me).


I do not object, since due to the changes the #[unset!] value is 
becoming more of an annoyance, than a useful bug protection. And, 
there are other benefits, like increased compatibility between USE 
and functions, exactly as the discussion revealed, as well as the 
fact, that the protection was never as useful as it was planned to 
be.
What I see as the only problem of #[unset!] losing this arms race 
is the fact, that we will still have "debris" in programs like GET/ANY, 
SET/ANY, LET/ANY, even after the resons to have them become sneakingly 
nonexistent.
BrianH
15-Nov-2010
[6136x3]
Yeah, but I'm still glad to have unset for exactly the reason it 
was intended for. Though the new unset in R3 is the unbound variable, 
which is even more useful.
I need some error to trigger to point me to my typos :)
I suppose you would consider the unbound variable errors to be the 
next round of the arms race though. It is getting to be a tiresome 
metaphor :(
Ladislav
15-Nov-2010
[6139x3]
Maybe I surprise you, but not. The reason why is, the unbound variables 
are not a "new datatype to enforce something", they are an existing 
datatype used for a reasonable purpose, and not starting a new round 
of "war" introducing some GET/WHATEVER.
But, being at it, there is one annoyance I perceive:


1) the variables bound to a function context don't cease to exist 
even when the function is not running
2) code like:
    f: func [/a]['a]
    block: [a]
    bind block f

do not work, while I can do such a bind on my own without needing 
any permission:
    change block f
So, this is clearly just an annoyance, and not a useful feature.
and, being at it, yet another annoyance of exactly the same kind 
is:

o: make object! [me: 'o]
error? try [bind 'self o] ; == true
bind [self] o; == [self]

, i.e. again, one can bind as wished, so the "feature" is just meant 
to be annoying, not useful
Gregg
15-Nov-2010
[6142]
+1 for consistency.
Maxim
15-Nov-2010
[6143]
+1 for consistency, as long as functions keep their implicit initialization 
to none.  


to me this is a feature, one which I have relied on in all my REBOLing.
Gregg
15-Nov-2010
[6144]
Yes, the none behavior makes sense, for USE as well, because you 
have told it you expect certain words to be used.
Ladislav
15-Nov-2010
[6145]
USE3:USE2 = 7:0
ChristianE
15-Nov-2010
[6146]
8:0
BrianH
15-Nov-2010
[6147x2]
Pleasantly surprised, thanks :)
About the annoyance, that is a side effect of two things combined:

- Starting with R2 we got direct binding, rather than dynamic binding, 
for a 30X speedup IIRC.

- Starting with R3 we got stack-relative contexts for functions, 
for security, task safety and better recursion safety.


You can't have the words in functions lose their bindings once the 
function returns because they will need those bindings the next time 
the function is called, and you can't rebind because definitional 
binding depends on the order of binding operations. So instead the 
context becomes invalid. It's an annoyance, sure, but it is more 
of an understandable side effect of some *extremely* useful features.
GrahamC
15-Nov-2010
[6149]
Do we need an oid type?  For instance this is my OID 1.2.826.0.1.3680043.8.1178.
BrianH
15-Nov-2010
[6150]
What is that used for? And do you do math with it?
GrahamC
15-Nov-2010
[6151x2]
it's like an ip address but it's used for real world objects
http://en.wikipedia.org/wiki/Object_identifier