[REBOL] Re: to-path newline problem?
From: joel:neely:fedex at: 13-Aug-2001 1:37
Hi, Ladislav, Anton, and all!
Ladislav Mecir wrote:
> Hi Anton,
>
> > What do you people think of
> > the difference in the following two?
> >
> >
> > (1) Produce a nice path:
> >
> > to-path [hello there]
> > == hello/there
> >
> >
> > (2) Produce a broken path:
> >
> > to-path [hello
> > there]
> > == hello/
> > there
> >
> >
...
> > A bug?
>
Certainly a misfeature, if not a bug!
> The newline does no harm IMHO. In fact, the following holds:
>
> block1: [hello there]
> block2: [hello
> there]
> path1: to path! block1
> path2: to path! block1
> path3: to path! block2
> equal? :path1 :path2 ; == true
> equal? :path1 :path3 ; == true
> same? :path1 :path2 ; == false
> same? :path1 :path3 ; == false
> same? :path3 :path2 ; == false
>
>> b: [hello
[ there]
== [hello
there]
>> bp: to path! b
== hello/
there
>> ubp: to path! foreach c b [append [] to-word c]
== hello/there
>> equal? :bp :ubp
== true
>> mold :bp
== "hello/^/there"
>> mold :ubp
== "hello/there"
>> equal? mold :bp mold :ubp
== false
Well, it certainly defies my notion of EQUAL? to say that
one can have two values which are equal but MOLD unequally!
What's next? Do we have to add another function to our
user.r files ...
really-and-truly-equal: func [:x :y] [
to-logic all [
equal? x y
equal? mold x mold y
]
]
>> really-and-truly-equal :bp :ubp
== false
... and, of course, test with all possible datatypes as
arguments (and equality tests over all possible generic
transformations) to make sure we don't need another phrase
in the ALL block! ;-)
--
------------------------------------------------------------
Programming languages: compact, powerful, simple ...
Pick any two!
joel'dot'neely'at'fedex'dot'com