• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[!REBOL3] General discussion about REBOL 3

GrahamC
16-Jan-2013
[507x6]
I'm trying to understand network schemes again, after a 3 year gap.
I've updated the time scheme and uploaded it to github here https://github.com/gchiu/Rebol3/blob/master/protocols/prot-time.r
As you can see, there's no error handling yet .. I thought there 
was a field in the scheme object to store errors but I've lost it.
Pavel used a read/lines to format the date in local date format. 
 I replaced that with write options
So, you can 

read time://time.nist.gov to get the date

or

write time://time.nist.gov [ GMT }

to get the date back in GMT.
We kept the http-error from Gab's prot-http.r until we figure out 
what to do about errors
Chris
16-Jan-2013
[513]
Read/Write appears to be awkward -- is there any planned replacement 
for read/custom?  I'd suggest that read/args (or read/params) would 
make more sense than write in the above example...
GrahamC
16-Jan-2013
[514]
Well, currently 'read doesn't have a custom refinement.  But I guess 
that can be added and then we can use that.
Chris
16-Jan-2013
[515]
I know, I'm just hoping there will be...
GrahamC
16-Jan-2013
[516]
But why would you want to diverge from R2's read/custom in favour 
of read/args?
Chris
16-Jan-2013
[517x2]
Could be quite elegant used alongside codecs.
Args (params, whatever) is more specific. read/custom is a bit woolly.
GrahamC
16-Jan-2013
[519x5]
where is 'read defined?
Just searching the sources now ...
https://github.com/rebol/r3/blob/master/src/boot/actions.r
So, is it just a case of adding the /args or whatever refinement 
there?
Should get some concensus on this as it will affect all the schemes, 
and may need a little rewriting of the http scheme which uses write 
to pass options
Chris
16-Jan-2013
[524x2]
I certainly see a read/args as being quite distinct in purpose from 
write.  I use it with my sandbox scheme (http://reb4.me/r/wrt) to 
filter directory contents.


 read/custom wrt://system/ [thru %.r] ; shows only rebol scripts in 
 this folder
	write wrt://system/ [thru %.r] ; means something else entirely
On the http scheme, it could be the difference between adding a query 
string to a GET request (read/custom), and adding post data on a 
POST/PUT request (write).
GrahamC
16-Jan-2013
[526x2]
with read you're expecting some content back, with write, you're 
not
Should we even use write in the http scheme?
Chris
16-Jan-2013
[528x2]
I'm appreciative of a return value from write. For example, on a 
hypothetical Twitter scheme, write twitter:// "My Tweet" would return 
the new tweet id.
Similarly most http write operations return a value of some kind.
GrahamC
16-Jan-2013
[530]
so, the http scheme should stick to read for sync ops
Chris
16-Jan-2013
[531]
I see read/get as synonymous, write/post or put, delete/delete.
GrahamC
16-Jan-2013
[532]
and HEAD ?
Chris
16-Jan-2013
[533]
info?
GrahamC
16-Jan-2013
[534]
the thing is that GET sends information and gets something back. 
 Same as POST.  What's the difference?
Chris
16-Jan-2013
[535x2]
Intent.
Content.
GrahamC
16-Jan-2013
[537]
But are we expecting the casual user to understand this?
Chris
16-Jan-2013
[538x2]
I believe it's more consistent.
A casual user of http, for sure : )
GrahamC
16-Jan-2013
[540x2]
So, if you're reading a HTTP form, you can either use GET or POST 
 ....
So, what is the user supposed to do ... use READ or WRITE ?
Chris
16-Jan-2013
[542]
GET/READ, POST/WRITE.
GrahamC
16-Jan-2013
[543x2]
Sounds like duplication
the http scheme author has to then support both methods of doing 
the same thing
Chris
16-Jan-2013
[545]
Not at all. Particularly if you consider the HTML form -- GET sends 
parameters in the URL, POST sends parameters in the body. And consider 
the usage of each: GET is usually some type of search/filter facility, 
POST is sending data to be stored.
GrahamC
16-Jan-2013
[546x2]
Well, I usually use POST to collect a token to allow me to proceed 
on the site
People don't like sending passwords in the URL
Chris
16-Jan-2013
[548]
For a developer, the intent is far clearer.

	read/custom http://google.com[q "Gordon Strachan"]

 write http://my-site.com[title "A Blog Post" content "Today I..."]
GrahamC
16-Jan-2013
[549x2]
It would be simpler if we just used 

GET and POST instead of read/write
Looks like it's time to setup one's own r3 build environment to test 
these things out
AdrianS
16-Jan-2013
[551x3]
Graham, would you prefer have functions for all HTTP methods (get, 
post, put, delete, head, options, trace, connect) ?
btw, is boot/host-init.r not meant to be used? Seems to be pretty 
much identical to mezz/prot-http.r minus the header. Is the first 
produced from the latter? If so, why is it checked in?
The last question is addressed at anyone who'd know...
GrahamC
16-Jan-2013
[554x2]
Adrian, the actors are used to provide a series abstraction on ports. 
 But as developers I think it might be clearer to have specific methods. 
 Otherwise you're reading the options block to see exactly what is 
being done.
though I guess we can always put wrappers around the read/write
BrianH
16-Jan-2013
[556]
Chris, WRITE dest block is the replacement for READ/custom.