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

World: r3wp

[Core] Discuss core issues

Gabriele
22-Sep-2006
[5398]
a path with one element is useless indeed. you cannot create it normally; 
it's like words with a space, or issues with a space, and so on. 
they exist, but they are not "valid" in a strict sense.
Anton
23-Sep-2006
[5399x2]
%/C/
Pretty useless directory path - it's only got one element.
Gabriele, oops about the none.
Henrik
23-Sep-2006
[5401]
I see the problem.  A path can represent different things, so if 
your path is not representing anything yet, then REBOL won't know 
how to deal with it as opposed to setting a word with 'set.
Anton
23-Sep-2006
[5402x5]
No, wait a minute, this code is what I meant (just changes the first 
line):
obj: make object! []
path: [obj]
code: reduce [to-set-path path 'make to-path path [new: 123]]
print code/1/1 = 'obj
?? code
do code
?? obj
OBJ seems not to have been changed by doing the code.

Gabriele has seen that a set-path! with only one element doesn't 
work, but you can use a set-word! instead, because they're conceptually 
the same, and they look the same:
>> to-set-path path
== obj:
>> to-set-word path/1
== obj:
So this seems to work:

 code: reduce [either 1 = length? path [to-set-word pick path 1][to-set-path 
 path] 'make to-path path [new: 123]]
Hmm.. I think I agree with Gabriele - the path with one element molds 
just like a word, so it would not load back correctly. Mold/all could 
be made to handle 1-element paths specially, writing the datatype 
eg:  #[path! [obj]]  Is it worth it, though ?
Henrik
23-Sep-2006
[5407x4]
well, it does seem to work, but it's only the first step of a few 
more. I hope it'll be worth it :-)
no, actually it doesn't work. I may be attacking the wrong problem. 
whenever I need to use the set-path part of your code, it, just like 
before, doesn't work.
the to-set-path part, sorry
so it's not a one-element-path problem but a "simple" issue of binding 
the path to the right context.
Volker
23-Sep-2006
[5411x2]
BTW you can manipulate a path like a block. And it may help to use 
'in.
But still ugly.
Anton
23-Sep-2006
[5413]
Henrik, what would rel-obj look like after issuing this ?
	add-relation [users male "Joe" age-group "Senior"]
Henrik
23-Sep-2006
[5414]
make object! [
	users: make object! [
		male: [
			"Joe"
			make object! [
				age-group: ["Senior"]
			]
		]
	]
]
Gregg
23-Sep-2006
[5415x2]
%/C/ actually has more than one element. %/ only has one element, 
in the file sense, but it also has a special meaning. A path with 
one element is just a value, most likely a word.
That said, I don't think they would be entirely useless, but the 
need for them seems very small.
BrianH
23-Sep-2006
[5417]
%/C/ is a file! not a path!
A file! is a string type.
Gabriele
24-Sep-2006
[5418]
the first element of a path! must be a word! (i'm not aware of any 
other ways to build a path, except for using make path! directly), 
and there must be a second element.
Anton
24-Sep-2006
[5419]
:) I understand Brian, it was just my first retort. :) Of course, 
a 1-element path! would be indistinguishable from a word!
Henrik
25-Sep-2006
[5420x3]
I'm trying to log into an FTP server with \ in the user name. Is 
that legal to use? I've tried a few different clients and only Total 
Commander will accept it. Rebol will not accept it as a valid URL, 
unless the \ is removed.


The problem is that the webhost Talkactive apparently use \ in all 
their usernames...
seems that Cyberduck can log in too
that's a bit of a problem
Pekr
25-Sep-2006
[5423]
then just merge \ with urlchars
Henrik
25-Sep-2006
[5424]
how?
Pekr
25-Sep-2006
[5425x4]
try the following:
net-utils/url-parser/user-char: union net-utils/url-parser/user-char 
make bitset! #"\"
well, at least it worked for merging @ and # in ....
or simply use non one-liner - use port spec ... the limitation is 
there only with url format ....
Henrik
25-Sep-2006
[5429x3]
amazing. it works.
but what is going on? :-)
so it changes which chars are legal in an URL?
Pekr
25-Sep-2006
[5432x2]
yes
I have patched my user.r and never care once again
Henrik
25-Sep-2006
[5434]
is this in RAMBO or not generally something that would be considered 
a good idea?
Pekr
25-Sep-2006
[5435]
no, RT claimed that their url parser is ok, according to RFC ....
Henrik
25-Sep-2006
[5436x2]
well, it's a problem if you want to access certain webhosts, then...
if \ breaks something in the URL parser, then it would be a problem 
of course, but then again, you can't rely that much on the FTP system 
in rebol
Pekr
25-Sep-2006
[5438x2]
it is the same as my email adress contains dot, - it is not according 
to RFC, but used so often, the parser has changed IIRC
I prefer out-of the box functionality, and not a strick adhering 
to standards, if the usage is pretty common ...
Anton
25-Sep-2006
[5440]
That's a problem with FTP in general. There are some servers which 
break the standard (which is also open to interpretation in some 
areas). RT's url parser is doing the correct thing, but supporting 
FTP in the real-world means also dealing with "rogue" standard-breaking 
servers. You could argue that if RT includes FTP in the language 
they should go the whole way with it to prevent dashed expectations. 
On the other hand, you can see rebol is more about breaking with 
the past and coming up with new, more modern (and hopefully more 
reliable) protocols. (Of course, it is possible to have both.)
Henrik
25-Sep-2006
[5441]
I would suggest an FTP powerpack then with as many bells and whistles 
as possible.
Anton
25-Sep-2006
[5442x2]
I would check out FTP-Gadget, which was open-sourced by Reichart. 
(Where did I get it..? Qtask .. ?)
So, I expect there to be a number of servers supported by FTP-Gadget.
Gabriele
25-Sep-2006
[5444x2]
henrik, use a block, not a url, i.e. open [scheme: 'ftp user: "\\\" 
...]
anyway, the problem is that rebol decodes percent-encoded characters 
in urls way too early, otherwise you would just encode the problematic 
char. (block format is still easier imo)
Graham
28-Sep-2006
[5446]
is it faster to load a string to see if it is a date, or try make 
date! and catch the error to peform the alternate action ?
Oldes
28-Sep-2006
[5447]
I do error? try [date: to-date date]