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

World: r3wp

[Core] Discuss core issues

Graham
12-Sep-2005
[1899]
what happened to Rebol's pattern matching in files?

I used to be able to do 

load %*.html 
well, that was valid in the year 2000.
Anton
13-Sep-2005
[1900]
I guess it was decided not to automatically assume the filesystem 
uses those wildchars ? Interesting. I honestly can't remember that.
Graham
13-Sep-2005
[1901]
I note that RT's documentation for the wild chars in SQL still makes 
a reference to REBOL's wild chars of * ...
Pekr
13-Sep-2005
[1902x2]
Hi .... as me and my friend use RebDB, we currently have to simulate 
'join functionality. I gave the idea a little thought, and I remembered, 
there are Rebol natives as 'union and 'intersest. They even do work 
with /skip refinement ..... and we miss that 'join functionality. 
Would it be difficult to add such functionality to work with blocks 
for 'union, or have a new native? I have an example:

; structure - name, last name, address, zip code

table1: [ "Petr" "Krenzelok" "Navsi 645" "739 92"  "Johny" "Handsome" 
"Dreamland 777" "777 77"]

; structure - age, place of birth
table2: [ 33 "Trinec" 38 "Some town"]

join-block/skip table1 table2 4 2


Do you think it would be usefull functionality to have as a native? 
Would be fast and would give us db 'join functionality to some extent 
....
'intersect I meant :-)
Volker
13-Sep-2005
[1904]
Something older by Brett: http://www.codeconscious.com/rebol/rebol-scripts.html
http://www.codeconscious.com/rebol/scripts/array-tools.r
Ladislav
13-Sep-2005
[1905x2]
hi, do you find this behaviour natural?
spec: [
	a: 1
	block: [do [a]]
]

o1: make object! spec
o2: make object! spec
o2/a: 2
do o1/block
do o2/block
JaimeVargas
13-Sep-2005
[1907]
Thats actually surprising... IMHO it shouldn't happen.
Ladislav
13-Sep-2005
[1908]
It looks that I should post it to Rambo, then
Cyphre
13-Sep-2005
[1909]
Looks like a bug.
Ladislav
13-Sep-2005
[1910x2]
another presentation of the same effect:
objects: []
loop 2 [
	append objects make object! [a: 1 block: [a]]
]
objects/2/a: 2
do objects/1/block ; == 2 !
Chris
13-Sep-2005
[1912]
It looks like the context for the nested [a] in the spec gets set 
while creating an object.
Ladislav
13-Sep-2005
[1913]
the behaviour is caused by the fact, that MAKE doesn't copy the SPEC 
argument
Chris
13-Sep-2005
[1914x2]
; After pasting the first example, I can:
reduce last last spec
; == 2
Sorry, == [2]
JaimeVargas
13-Sep-2005
[1916]
The is the kind of side effects are quite dangerous, imo the current 
behaviour seems like a bug and breaks the least surprise premise.
Chris
13-Sep-2005
[1917]
Or doesn't deep copy.
Sunanda
13-Sep-2005
[1918x2]
strange isn't it?
same? o1/block o2/block
== true
But if you change the spec to
  block: copy [do [a]]

They are no longer the same, but still return the same value. Odd!
Chris was ahead of me there -- a working solution is
  block: copy/deep [do [a]]
Chris
13-Sep-2005
[1920x2]
You would need to copy/deep.
:o)
Ladislav
13-Sep-2005
[1922]
yes, that is true, I wrote a similar example to my Bindology article 
quite some time ago, where it was "clashing" with recursion. Here 
it is a problem even without recursion
JaimeVargas
13-Sep-2005
[1923]
Should programmers concern about copy/deep when creating new objects 
from a spec? It seems strange that they do.
Ladislav
13-Sep-2005
[1924x2]
As the interpreter is working now, they should, at least in case 
of recursive code or objects with variables having block values
The easiest rule is to write make object! copy/deep spec instead 
of make object! spec
JaimeVargas
13-Sep-2005
[1926]
But is this appropriate, why not just have copy/deep by default on 
make object! ?
Ladislav
13-Sep-2005
[1927x3]
the reason was, that it is slowing down the interpretation in cases 
it isn't necessary
(I would say, that it can be considered "premature optimization"?)
(or machine time optimization at the cost of human time?)
JaimeVargas
13-Sep-2005
[1930]
Why not add a section on the wikibook about "side effect" in Rebol, 
this and other idioms are a must know not only for beginners and 
experts.
Ladislav
13-Sep-2005
[1931]
right
JaimeVargas
13-Sep-2005
[1932x2]
I think if rebol slows you down, specially with such a subtle problem 
then new programmers may not adopt it. (It will for them look buggy 
or confusing).
It can take a lot of time to find the problem of your code is not 
logic but a side effect of the language implementation.
Chris
13-Sep-2005
[1934]
Perhaps it could come under 'Gotchas' -- it's not a bug so much as 
a 'feature' of Rebol values and contexts?  Just as much as 'copy 
does not automatically 'copy/deep...
Ladislav
13-Sep-2005
[1935x2]
regarding the behaviour: I think, that it might be optimal to have 
a function like CONTEXT deep copying by default with eventual /no-copy 
refinement?
It would be *much* better to suggest the beginners to always use 
CONTEXT instead of MAKE OBJECT! and be safe IMO
Gregg
13-Sep-2005
[1937]
I agree that hidden things like this can be dangerous, but how many 
of us have actually had a problem with it (this issue) in our applications?
Ladislav
13-Sep-2005
[1938]
I did
Gregg
13-Sep-2005
[1939]
My view is that Carl made this a conscious choice, knowing that advanced 
users could do their own copy/deep when they need to, and it won't 
come up most of the time anyway.
JaimeVargas
13-Sep-2005
[1940]
We have encounter a lot of Gotchas in our development, and part of 
the reason we are slowed down many times.
Gregg
13-Sep-2005
[1941]
Yes, but you're a special case Ladislav. :-)
JaimeVargas
13-Sep-2005
[1942]
We are coding cutting edge stuff. Callbacks, Sophisticated Async 
Networking and others.
Ladislav
13-Sep-2005
[1943]
well, but my suggestion regarding CONTEXT isn't very aggressive, 
is it?
Gregg
13-Sep-2005
[1944]
Right, and I agree that this kind of thing should absolutely be documented, 
but I also think I understand why it works this way.
JaimeVargas
13-Sep-2005
[1945]
So if new users start to code complex applications they hit the problems 
that are not well documented and not easy to catch.
Ladislav
13-Sep-2005
[1946]
context: func [
    "Defines a unique (underived) object."
    blk [block!] "Object variables and values."
][
    make object! copy/deep blk
]
Gregg
13-Sep-2005
[1947]
And, yes, I think it might be OK for CONTEXT to do a copy on the 
spec; I wouldn't even add the no-copy option,.
Ladislav
13-Sep-2005
[1948]
:-)