Hi Russell,

good to hear from you. Look, you are confusing two things:
1. There is a REBOL type called path!
2. Hierarchical Filesystems commonly refer to a notation that specifies a
hierarchy of directories (or folders) as a path, i.e. c:\windows\system.

The REBOL user's guide sometimes speaks of paths in the sense that they
have the type path! and sometimes speaks of paths in the sense of a
filesystem.

>
>Also, from User's Guide, it appears 'path is broader than your definition
>(which considers only the block as a root). A path could be of type file! as
>in "src/unix/main.c", to cite Chapter 4
>

A path in the sens of 2 above, yes, in the sense of 1 above no. A value of
type path! cannot be used in order to access the file system. The value
must be of type file! However, a value of type file! may access a file
system path.

The example you cite in Chapter 4 is not REBOL code:

>> type? src/unix/main.c
** Script Error: src has no value.
** Where: type? src/unix/main.c

An expression that generates an error message is not a good example for a
value that has the REBOL type path!. It's a good example for code that will
generate an error message. I don't think I need to revise my statement,
since it is being challenged with example code that REBOL rejects.

>If a file name ends with "/" it denotes a directory, but is of both type
>dir! and type file!.

There is no type dir!

>> help file!
file! is word of value: file
>> help dir!
No information on dir! (word has no value)

The word dir? does not test a value for whether it has a type dir!. There
is no such type. 

Help says:
>> help dir?
Returns TRUE if a file or URL is a directory.
Arguments:
    target --  (file url)
>> 

So, dir? accepts values of type file! or url! and returns true if they
happen to be a directory. 

Imagine a function gtz?

>> gtz?: func [x (number!)] [ x > 0 ]
>> gtz? 3
== true
>> gtz? 0
== false
>> gtz? -1
== false
>> 

The above dialog does not mean that 3 has the type gtz!, 3 continues to
remain an integer! type, even if gtz? returns true. Same thing with dir?.
Just as gtz? returns true, dir? returns true, the type of the value,
however, is not dir!, its file! or url!, just the type of 3 is integer! and
not gtz!.


>So far I've not been able to create an entity with a value that is of type =
>path.

Weird. My previous email contained an example. Here's another one:

>> a: [b [c [ d "here's the string contained at path a/b/c/d"] ] ]
== [b [c [d "here's the string contained at path a/b/c/d"]]]
>> a/b/c/d
== "here's the string contained at path a/b/c/d"

>> path: make path! [a b c d]
== a/b/c/d
>> path
== "here's the string contained at path a/b/c/d"
>> 

Hope this helps,

Elan

Reply via email to