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

World: r3wp

[!REBOL3-OLD1]

Henrik
6-Feb-2009
[10604]
I better let BrianH respond to that one. I'm not sure how LOAD has 
changed since early R3 versions.
Pavel
6-Feb-2009
[10605]
In early public Alpha the GOB demo has been running nicely
BrianH
6-Feb-2009
[10606x2]
LOAD has gotten more compatible, but I left the reference to LOAD-JPEG 
alone. If there is no more LOAD-JPEG function that is good to know, 
since the whole reeason for that function was to give us something 
until the media loaders were done.
You're right, it's gone. The new GUI uses Draw for its elements, 
so the loss might not have been noticed. I'll check.
Henrik
6-Feb-2009
[10608]
It's not entirely bliss yet, as there are problems with MAKE IMAGE!. 
Hence the strange blueish checkerboards in my screenshots of color 
sliders.
BrianH
6-Feb-2009
[10609]
Are you using REBOL to make the screen shots?
Henrik
6-Feb-2009
[10610x3]
No, this is internal to REBOL. RGB values are incorrect in the image 
data that is produced from MAKE IMAGE!.
it should be in curecode somewhere.
#504
BrianH
6-Feb-2009
[10613]
Please check. I need help testing graphics bugs - I'm not that good 
at recreating them. I'm much better with core bugs.
Henrik
6-Feb-2009
[10614]
it doesn't really need any graphics as you can study the problem 
in console :-)
BrianH
6-Feb-2009
[10615]
Yup, the problem still exists in current builds. Reviewed.
Henrik
6-Feb-2009
[10616x2]
also #505 and #503 should be reviewed
(also possible from console)
BrianH
6-Feb-2009
[10618x2]
Just did, and they look related. I think MAKE IMAGE! is hosed - it's 
probably a good thing we don't have LOAD-JPEG at this point.
As an alternative to DIR-EXISTS? and FILE-EXISTS? we could change 
EXISTS? so it returns more information.

; R3 version:
exists?: func [

    "If a file or URL exists returns 'file or 'dir, otherwise none."
    target [file! url!]
][
    select attempt [query target] 'type
]

; R2 version:
exists?: func [

    "If a file or URL exists returns 'file or 'dir, otherwise none."
    target [file! url!]
][
    unless error? try [
        target: make port! target
        query target
    ] [

        either 'directory = target/status ['dir] [target/status] ; To work 
        around a current incompatibility
    ]
]


EXISTS? could still be used in conditional code, with the exception 
of AND and OR, but would have more info if you need it.
Anton
6-Feb-2009
[10620]
(And AND and OR could still be done with ALL and ANY, probably what 
I would use in preference anyway.)
BrianH
6-Feb-2009
[10621]
I've almost never seen EXISTS? used with AND or OR, though I rarely 
see AND or OR anyways. You can always use FOUND? or TRUE? if you 
want to turn it into a logic value :)
Gregg
7-Feb-2009
[10622]
There are a couple *? funcs that don't return logic!, but the trailing 
? nearly always indicates a simple predicate. I can see how this 
might be useful, but also how it could trip you up. I can't complain 
too much though, since I've written my own *? mezzanines that don't 
return logic!.
Gabriele
7-Feb-2009
[10623x3]
my logic for xxx? is that it either means is-xxx? or get-xxx
eg. length? instead of get-length
(you are "asking" the object in both cases. "are you xxx?" or "what 
is your xxx?")
Geomol
7-Feb-2009
[10626x2]
I've always found AND and OR not very rebolish, maybe because they 
can be infix (operators), where ALL and ANY are prefix (like functions). 
And you often need parenthesis, when used infix:

>> or 1 = 2 2 * 2 = 4
== true
>> 1 = 2 or 2 * 2 = 4
** Script Error: Expected one of: logic! - not: integer!
** Where: halt-view
** Near: 1 = 2 or 2
>> 1 = 2 or (2 * 2 = 4)
== true
Somehow I feel better about ANY:

>> any [1 = 2 2 * 2 = 4]
== true
Oldes
7-Feb-2009
[10628]
and ANY is faster!
BrianH
7-Feb-2009
[10629]
Well, we really need the information returned by the EXISTS? function 
above, and my last attempt to get that information out in a R2-R3 
compatible way (the above *-EXISTS? functions) got a lot of complaints 
(mostly from Gregg, as I recall). This is hopefully a less annoying 
change, and is compatible now even without the 'dir tweak if you 
check against 'file instead.


My opinion of the *? functions that are meant to be predicates is 
that they should be usable as predicates, but don't necessarily need 
to be simple predicates. As long as you can use them in IF statements, 
they're fine. We have methods to convert from REBOL truth values 
to logic! if we need to.
[unknown: 5]
7-Feb-2009
[10630]
I don't understand the problem with the functions we have regarding 
this in 2.7.6.  Can someone summarize the issue?
BrianH
7-Feb-2009
[10631x2]
Sure. In REBOL 2 there are 2 functions, EXISTS? and DIR?, that check 
for whether a file! refers to an existing file and whether the existing 
file is a directory, respectively. Both of these functions wrap around 
QUERY, a low-level native that works very differently between R2 
and R3, mostly because of the port model change. In addition, DIR? 
has a design shortcoming in R2 (mentioned in CureCode ticket #602) 
and both DIR? and EXISTS? share the same bug in QUERY in R3 (#606, 
affects #602 and #604).

All of these combine into a few problems:

- People who want to write file and directory management code that 
is portable between R2 and R3 have trouble doing so.

- Bugs of the kind mentioned in #602 are not likely to be fixed in 
R2, so we have to consider DIR? broken for non-existing directories.

- Using both DIR? and EXISTS? means two QUERY calls, which has overhead, 
particularly for networked files.

- Attempts to get around this using QUERY require completely different 
code in R2 and R3, so wrappers would be nice.


As it specifically relates to 2.7.6, for people who don't care about 
forwards compatibility, there is only one problem:
>> DIR? %nonexistingdirectory/
== false  ; Should be true, unlikely to change
Also, R2 and R3 could use a standard function that does the opposite 
of DIRIZE. Current proposed names are UNDIRIZE or FILEIZE.
[unknown: 5]
7-Feb-2009
[10633x2]
Why do we need an undirize when it is already so simply to do such?
>> a: %directory/
== %directory/
>> trim/with a "/"
== %directory
BrianH
7-Feb-2009
[10635]
It is simple, as is DIRIZE (look at the source), but we still need 
it.
[unknown: 5]
7-Feb-2009
[10636]
Sounds like bloat to me.
BrianH
7-Feb-2009
[10637]
No bloat in R3. Modules get rid of the bloat. If you don't want it, 
don't include it.
[unknown: 5]
7-Feb-2009
[10638x2]
Just seems there is better to focus on than that.
How about working on fixing it so we can modifiy the dates on directories. 
 That would be way more important.
BrianH
7-Feb-2009
[10640]
Who says I'm focusing on it? It was less than 5 minutes of work.
[unknown: 5]
7-Feb-2009
[10641]
Yeah but doesn't sound like your done to me.
BrianH
7-Feb-2009
[10642x2]
With undirize? I am done.
I can't fix problems like modifying the date on directories - that 
is native code, and I just work on mezzanines.
[unknown: 5]
7-Feb-2009
[10644x2]
I sure hope all these mezzanines don't get distributed with REBOL. 
 Because even if they are still distributed as a package with the 
main bin then it is still bloat.
Rather, there be a separate distribution for just the main bin and 
then the mezzaines.
BrianH
7-Feb-2009
[10646]
When native code is released, I can work on it. The people who currently 
work on native code don't work on what I work on - that is why I 
work on it, so they can focus on what they need to. Division of labor.
[unknown: 5]
7-Feb-2009
[10647x2]
Seems were getting to many mezzaines for simply tasks.  Were gonna 
be a laughing stock.  LOL.
don't take that seriously - after all I run a mezzanine thread on 
my site.
BrianH
7-Feb-2009
[10649]
We only include the mezzanines we use, and I wouldn't suggest something 
unless there is already a need for it. Your TRIM/with code is wrong, 
btw, we only trim the last / and from a copy at that.
[unknown: 5]
7-Feb-2009
[10650]
My trim was only an example of the ease at which we can perform tasks 
related to this.
BrianH
7-Feb-2009
[10651]
R3 will be less bloated than R2, but you are still missing something: 
you say "the main bin" which assumes that R3 will be distributed 
in a single monolithic binary like it is in R2. Not doing that is 
the reason for the split of the host code. Build your own monolith 
if you like, including whatever functions you need.
[unknown: 5]
7-Feb-2009
[10652]
Well that would be nice.  We shall wait and see.
BrianH
7-Feb-2009
[10653]
The point to making these mezzanines is to make them *well*. The 
fileize code above is the least you can write that does what the 
function is supposed to do. If this is not the case, improve it. 
We are improving REBOL by writing these functions, as they give us 
insight into how the system can be improved - look at the difference 
between the two EXISTS? functions above for an example of this. Simple 
code that you could inline if you need to is what we want.