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

World: r3wp

[!REBOL3-OLD1]

BrianH
25-Jun-2009
[15784x2]
EQUAL? in R2 is level 1. Changing it to level 2 would break a lot 
of code, particularly for word equivalence :(
You need a NOT-EQUAL? action so you can have a != operator. Every 
op! maps to an action!, no exceptions.
Izkata
25-Jun-2009
[15786x2]
Mmk, I must have just never run across a case where I would have 
seen that by coincidence.
and I didn't know about the op! mapping
BrianH
25-Jun-2009
[15788]
Yeah, it's why there is no NOT-SAME? function - no operator needs 
it.
PeterWood
25-Jun-2009
[15789]
How do you convert a Map! to a Block! in R3? The obvious way doesn't 
seem to work:

>> a: map! [a 1 b 1 c 1]

== [a 1 b 1 c 1]

>> b: to block! a
== [map!]
Sunanda
25-Jun-2009
[15790]
You are missing a TO (or  a MAKE)
    a: TO map! [a 1 b 1 c 1]
    to-block a
    == [a 1 b 1 c 1]
PeterWood
25-Jun-2009
[15791]
Thanks, Sunanda
Maxim
25-Jun-2009
[15792]
version A62 just has to be a special version, it was released on 
my birthday  :-)
Ladislav
29-Jun-2009
[15793]
for Henrik (and others?): you can add your BUILD requirements/notes 
to http://www.rebol.net/wiki/Replacement
Pekr
29-Jun-2009
[15794]
A65 notes mention bind-of .... but A65 release does not know this 
function - it is undefined. So - what is 'bind-of?
BrianH
29-Jun-2009
[15795]
Whoops, typo. Fixed.
Ladislav
30-Jun-2009
[15796x5]
A question from Carl: 

Should #877 just cause an error (infinite cycle):

a: copy []
insert/only a a
copy/deep a
as far as I am concerned, this looks acceptable
Domain of EQUAL? EQUIVALENT? STRICT-EQUAL? and SAME?: currently they 
are declared to accept all values except for #[unset!] Any proposals 
for change?
>> b: tail [1 2 3]
== []

>> clear head b
== []

>> same? b b
== true

>> equal? b b
** Script error: out of range or past end
** Where: equal?
** Near: equal? b b

** Note: use WHY? for more about this error
the above was yet another domain-related example. I can imagine the 
EQUAL? example to yield TRUE as an alternative. Which one do you 
prefer???????
Anton
30-Jun-2009
[15801]
I think this is just about performance. SAME? has a simple job to 
do to see if two values are the same. EQUAL? investigates in more 
depth, and then discovers the range problem. This seems like a good 
implementation and I like the current behaviour.
BrianH
30-Jun-2009
[15802]
EQUAL? is used more often by newbies and people doing quick programming. 
Such people would be better served by the error.
Henrik
30-Jun-2009
[15803]
I'm considering the concept of neutral values: Empty blocks, empty 
strings, zero, true and generally what is default made with MAKE 
<type> [].

It comes from typing this alot:

	all [
		val
		block? val
		empty? val
	]

which would be equivalent to:

	neutral? val

It may be a bad idea.
sqlab
30-Jun-2009
[15804]
Why should  equal? b b yield a error?

Just because it gives back an error in R2, but there also b alone 
gives back an error.
The current behaviour in R3 is much better.
BrianH
30-Jun-2009
[15805]
It yields an error in R3 too. You *want* that error because it tells 
you that you have bad series references. You want to know that.
sqlab
30-Jun-2009
[15806]
No, it does not give an error in R3.

>>  b: tail [1 2 3]
== []

>> clear head b
== []

>> b
== []
BrianH
30-Jun-2009
[15807x2]
EQUAL? b b gives an error in R3, as does = and ==.
No "but there also" related to EQUAL? in your statement, so that 
was the assumed subject of  "The current behaviour in R3".
Ladislav
30-Jun-2009
[15809]
EQUAL? b b causes an error. The value of such an error is doubtful, 
taking into account, that e.g. the MOLD function accepts the series 
happily, in an incompatible manner. So, what is "more useful"? To 
cause or not to cause? My personal opinion is, that the value of 
causing the error is totally negligible even for the beginners. (the 
EQUAL? function is not meant to be used as the function supposed 
to be used for such checking)
BrianH
30-Jun-2009
[15810]
I'm not convinced that the lack of an error with the straight b reference 
is good either. It seems like a good error to throw.
Ladislav
30-Jun-2009
[15811]
If we examine the "nature" of the implementation of REBOL blocks, 
then we come to the conclusion (at least I do), that the "abstraction" 
is as follows: (at least when we examine the PICK function): a block 
is an "essentially unlimited" series of values, the majority of them 
are  #[none] s, except for a limited "segment", which may "contain" 
other values as well
BrianH
30-Jun-2009
[15812x3]
There is a lot of correct code that would assume that
>>greater-or-equal? length? head b index? b

If this is ever not the case and I try to retrieve a value from that 
reference before that condition is true again, that is a serious 
error. If you fill in the missing data before you attempt to retrieve 
anything, not an error.
So, either b is an error in R3, or INDEX? is an error (which might 
be the case).
So we could either have INDEX? be an error, or unstable. Which do 
you prefer?
Ladislav
30-Jun-2009
[15815]
PICK happily allows you to examine any position, so a code that works 
in a manner incompatible with PICK is violating the block design 
principle IMO
BrianH
30-Jun-2009
[15816]
I'm OK with declaring that bounds don't matter, and that INDEX? is 
not an error. The rationale for the new series bounds model was my 
idea, anyways. And having =, !=, == and !== (and their actions) not 
generate an error is consistent with that. Just taking the devil's 
advocate position :)
Ladislav
30-Jun-2009
[15817]
moreover, the INDEX? function does not show you an error.
Maxim
30-Jun-2009
[15818]
as long as the index can be used as such.  using an object for the 
index should raise an error.
Ladislav
30-Jun-2009
[15819x2]
using an object for the index should raise an error
 - you mean e.g. poke 4 index, when the index is "out"?
sorry, I mean poke block 4 index
BrianH
30-Jun-2009
[15821]
Ladislav, my point was that if bounds matter, INDEX? *not* generating 
an error (or changing its results) for an out-of-bounds index *is 
itself an error*. If bounds don't matter (except apparently for POKE), 
then INDEX? not changing its behavior is fine.
Ladislav
30-Jun-2009
[15822x2]
aha, so you examined the possibility to change the INDEX? behaviour 
as well
my experience tells: it is better to be able to find out what the 
value of INDEX actually is (even for debugging), than to obtain an 
error, which does not tell me where I actually am
BrianH
30-Jun-2009
[15824x3]
Yeah. However, consistently not caring about out-of-bounds on read 
seems more useful. We only care on write.
(that was in answer to your last message)
(AltME is slow for me today)
Maxim
30-Jun-2009
[15827x3]
henrik:  the neutral? is very usefull, python uses that as the false 
values.


when everything is coded using this it simplifies a lot of code, 
even more than using none.
I have often wondered what the name for the function would be.... 
'NEUTRAL?  is not bad!
(altme is fast here. (very))
BrianH
30-Jun-2009
[15830]
I prefer REBOL's false/none treatment to Python's, but that NEUTRAL? 
sounds good, especially if it also checked for unset values, and 
SERIES? instead of BLOCK?.
Maxim
30-Jun-2009
[15831x2]
its just different allows different optimisation of conditionals. 
 neutral? can be very usefull, especially for GUI handling code... 
where you usually don't care for the type, but only if a value is 
meaningfull.
my name for the function was:   meaningfull?
Henrik
30-Jun-2009
[15833]
I have not thought it through that much, other than figuring there 
would have to be a way to shorten that code to one step. I have compiled 
a list of neutral values for all types, that are capable of producing 
neutral values. Some can't, and I wonder what the response to NEUTRAL? 
would be there.