Path datatype! craziness
Just have a look at this example. It talks for itself
>> x: 'some-word/'and-lit-word/#I55ue/USD$123.45/email@addre.ss/:var/(paren thesis 123)/1.2.3.4/-2x+3/#"A"/protocol://host/path?bull=shit&cant_escape:/ == some-word/'and-lit-word/#I55ue/USD$123.45/email@addre.ss/:var/(paren thesis 123)/1.2.3.4/-2x3/#"A"/protocol://host/path?bull=shi... >> foreach e x [print [e type? e]] some-word word and-lit-word word I55ue issue USD$123.45 money email@addre.ss email var get-word paren thesis 123 paren 1.2.3.4 tuple -2x3 pair A char protocol://host/path?bull=shit&cant_escape:/ url
I'm not sure yet where could I use this ability of specifying diverse (but not all kind of) datatypes concatenated by slashes into a series! instead of using blocks. Maybe until 2-3 elements and certain datatype! combinations would look more "natural" this way compared to the bracketed and space separated version?
string! and block! types can't be path elements, although the paren! type can. Interesting... All of them are series!
>> foreach e [(asd 123) "asd" [blk]][print [e series? e]] asd 123 true asd true blk true
2987 views and 1 response
-
Aug 16 2011, 1:28 AMHostile Fork responded:Interesting study, and the kind of thing I wish seemed more "purposeful" as a design instead of just the leftovers of the parsing logic. I kept tripping over things that surprised me considering what I *thought* I could do in Rebol, demonstrated by cases like this:
foo: to-path [a b c]
== a/b/cbar: to-path [a/b c]
== a/b/cfirst foo
== afirst bar
== a/bmold foo
== "a/b/c"mold bar
== "a/b/c"It seems whenever I start to get excited about some aspect of Rebol (like its ability to reflect and stringify its source code) then these things pop out. It's not clear what you can take for granted or not. Since they don't offer a good grounding guide for experienced programmers to grasp issues like "why paths are aliased so easily, and what mindset should I use to avoid trouble," it looks not very well thought-out.
I started a guide here but couldn't get much traction on changes or help with it: