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

World: r3wp

[Core] Discuss core issues

Ladislav
18-Aug-2011
[2182]
I can easily prove, that the extent of function locals is immaterial, 
when the behaviour of series in functions is examined.
Gabriele
18-Aug-2011
[2183x2]
that all helpers copy

 - in R3? Yeah, maybe the all should, though I still prefer to be 
 practical here. i've never had to copy the block passed to context 
 for eg.
So the block is copied

 - your conclusion is wrong. the object does not "keep" the block 
 it is made from. THIRD simply generates its output each time.
Geomol
18-Aug-2011
[2185]
Yeah, I discovered that. Confusing, I think.
Ladislav
18-Aug-2011
[2186x4]
i've never had to copy the block passed to context for eg.
 - many people never had, but:

* Cyphre fell into "the trap" when writing async code

* the code written for R3GUI has to use copying due to the way how 
it is implemented
The issue has been demonstrated on recursive code, since that is 
the simplest case, but the async code is more likely to suffer
In my opinion, when we have two possible ways: MAKE OBJECT! and CONTEXT, 
it is practical if they differ in their properties to offer some 
flexibility.
Regarding the "MAKE FUNCTION! does not copy" versus the "BODY-OF 
function does copy" there are very good reasons why this is the best 
alternative:


1) MAKE FUNCTION! is a "lower level" approach, which should give 
the greatest flexibility. Such flexibility is achieved by not copying 
the body, which allows a custom function generator using MAKE FUNCTION! 
to make some additional adjustments to the function after the function 
has been created by MAKE FUNCTION!. An example code using this advantage 
has been committed by me to rebol.org.


2) Since the BODY-OF function does copy, a user may give a "sensitive" 
function as an argument to a "less trusted" code without having to 
fear that the "less trusted" code would modify it to achieve undesirable 
effects. This is highly practical, and not a limitation, since the 
"original body" of the function can be made available if the creator 
of the function wishes.
Geomol
18-Aug-2011
[2190]
What about MAKE block! ? Does that include a copy? Will it in R3?
Gregg
19-Aug-2011
[2191]
John, it sounds like where you get confused, or think of things as 
bugs or design flaws, is when having your REBOL "That's funny!" moments, 
borne of deep tinkering. Aside from the "copy series in funcs" behavior, 
which I think bites many people at some point, your issues don't 
come from writing application code in REBOL and bumping up against 
REBOL's behavior. Rather, it seems that REBOL's implementation and 
design don't match your expecations in these cases, and you really 
want it to. :-)


The reason I asked about consequences is because you may want a change 
that affects other users negatively. Imagine REBOLers as being in 
one of two groups. Group A is the gurus. They have internalized REBOLs 
design, understand it deeply, and use BIND and recursive PARSE rules 
without fear. That group is very small. Group C contains everybody 
else, which includes people that don't know about using /local with 
funcs, and suggest REBOL should use  = for "assignment". They have 
never used USE, BIND, or many other functions, because they aren't 
sure how they work. Some of them know a little about series references, 
so they always use COPY to be safe. (Yes, group B exists too, but 
they are much more like C than A).


If REBOL were meant only for A users, it would be very different. 
As a designer, it seems pragmatic to make it so things work well 
for the B and C users who, when they hit a problem that requires 
advanced understanding, will work around issues with the bits they 
understand (and adding many COPY calls), no matter how inelegant. 
Group A users may suffer at their expense, but I'm OK with that, 
because I'm not one of them.
Geomol
19-Aug-2011
[2192]
When I go into discussion like this, it's mostly because I want to 
understand, what REBOL is. After using it for like 10 years, there 
are still areas, where I'm not sure, what's intentional and what 
isn't. Must of the problem (of understanding the REBOL behaviour) 
is because it's not officially well documented. ("Officially" I mean 
by Carl.) REBOL is still not set in stone, as I see it.
Ladislav
19-Aug-2011
[2193x2]
What about MAKE block! ? Does that include a copy? Will it in R3?
 - this is a funny question. The

    make block! []


expression does make a copy of the block given, both in R2 and in 
R3. The reason is quite simple: if it did not make a copy of its 
argument it would not make a block at all.
As you may verify, all MAKE calls actually make a new value, so it 
would be a violation of that rule
Geomol
19-Aug-2011
[2195]
Right, and I asked this question to test a general view, if MAKE 
should involve copy or not.
Ladislav
19-Aug-2011
[2196x2]
But, as you may see, there is another general rule in effect there
MAKE BLOCK! 10 does not make a copy of anything, yet it makes a new 
block as wished
Gabriele
19-Aug-2011
[2198]
Cyphre fell into 

the trap" when writing async code" - as it stands, async code is 
"too hard" in REBOL. (IMHO of course.)
Geomol
22-Aug-2011
[2199]
Can FIND find the datatype block! among blocks in a block? Boy, does 
that sound like a strange question? An example:

>> find reduce [[] [] block!] block!     
== [[] [] block!]


That's not the result, I'm after. I want FIND to return [block!], 
but that doesn't seem to be possible. Is there a trick?
Rebolek
22-Aug-2011
[2200x2]
I think you have to do it in two steps. First find datatype! and 
then check if that datatype is block!.
Or you may use PARSE.
Henrik
22-Aug-2011
[2202]
>> find reduce [[] [] block!] datatype!     
== none

That seems odd.
Geomol
22-Aug-2011
[2203x3]
Yeah, I was thinking along the same line, doing it in two steps. 
If one wants to make a mezzanine SWITCH, it'll be slow, I guess.
Henrik, yes, surpricing!
That works in R3 though, so must be missing in R2.
Henrik
22-Aug-2011
[2206]
http://www.rebol.net/cgi-bin/rambo.r?id=4332&
Dockimbel
22-Aug-2011
[2207]
Same issue with FIND on native! values: http://www.rebol.net/cgi-bin/rambo.r?id=4126&
Geomol
22-Aug-2011
[2208]
A sidenote about SWITCH: I often find myself needing a switch, where 
I look for datatypes, like:

	switch type? value reduce [
		integer! [...]
		word! [...]
	]


It works, but only if I include the REDUCE, else the words in the 
block are just words. I was thinking, if SWITCH should have a refinement 
telling it to reduce the block, or something. Do you have same kind 
of switch as me?
Henrik
22-Aug-2011
[2209x2]
geomol, use type?/word
that returns the type as a word. it seems to be made precisely for 
this scenario.
Geomol
22-Aug-2011
[2211]
ah, didn't notice type?/word, thanks! :)
Rebolek
22-Aug-2011
[2212]
I tried it only in R3, I'm not sure about R2
Geomol
22-Aug-2011
[2213]
So my original FIND can be solved with:

>> find [[] [] block!] to word! block!
== [block!]
Henrik
22-Aug-2011
[2214]
well, if the block is reduced elsewhere, that would be a problem.
Geomol
22-Aug-2011
[2215]
yes
Pekr
23-Aug-2011
[2216x2]
I have got a question of soon-to-join-us-here reboller, asking about 
the possibility to launch new rebol process, using lowered security.

launch "some-script.r" works
lanuch "--secure allow --script some-script.r" does not work

I think I might use 'call instead?
Hmm, strange. When I type: launch "-s some-script.r", then uninstall 
dialog box appears.
Endo
23-Aug-2011
[2218x2]
Yep there are some problems using launch I think.

launch {-s --noinstall} ;--> starts nre Rebol process in trace mode. 
just like I use -t option.
Strange..
>> launch/as-is {-s}
** Script Error: Feature not available in this REBOL
** Near: launch/as-is "-s"
Pekr
23-Aug-2011
[2220]
I suggested my friend to use: call "rebol.exe -si my-script.r"
Endo
23-Aug-2011
[2221]
better option I think as launch is really problematic.
Gregg
23-Aug-2011
[2222]
LAUNCH, RUN, and CALL make things confusing. I almost always use 
CALL now.
Henrik
24-Aug-2011
[2223x2]
Composing a lit-path:

>> f: [b d e f]
== [b d e f]
>> i: 2
== 2

It would be nice that instead of this:

>> compose 'f/(i)
== f/(i)

you would get:

== f/2
Doesn't work in R3 either.
Rebolek
24-Aug-2011
[2225]
I think that it should throw error, because 'compose should accept 
only block! value.
Henrik
24-Aug-2011
[2226x2]
lit-path is a series, so I think the argument is sound for the latter 
result.
It gets rid of a workaround, where I must store a path, where some 
values in the path can't be determined until storage, the moment 
where COMPOSE needs to act. The workaround is to create the path 
as a block, and then TO-PATH it on use.
Ladislav
24-Aug-2011
[2228x2]
>> f: [b d e f]
== [b d e f]

>> i: 2
== 2

>> my-path: rejoin [to path! [] 'f i]
== f/2
or, in R2:

    my-path: rejoin [#[path! []] 'f i]
Steeve
24-Aug-2011
[2230]
or
>> append to-path 'f i
Geomol
24-Aug-2011
[2231]
A fast way is:
>> to path! reduce ['f i]
== f/2

(Maybe the fastest?)