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

World: r3wp

[!REBOL3 Schemes] Implementors guide

Graham
6-Jan-2010
[222]
I think you mean WETAN?
BrianH
6-Jan-2010
[223]
Yeah. I'd like the literate programming to stay if we can manage 
it, because otherwise we'll have to reorganize the code from scratch. 
Reorganizing it from existing source would be easier.
Graham
6-Jan-2010
[224x3]
http://www.colellachiara.com/soft/MD3/emitters/wetan.r
and http://www.colellachiara.com/soft/MD3/emitters/wetan.html
google is your friend ...
I use LEO for my literate programming needs
BrianH
6-Jan-2010
[227]
I use the code story model.
Graham
6-Jan-2010
[228]
So, are you reviewing all the networking code now?
BrianH
6-Jan-2010
[229]
Documentation in the code itself using comments, and you structure 
the code for human reading. To any programmer of a language that 
is designed for readability - like REBOL - reading the flow of the 
code is like reading a story. You can understand it immediately.


Reading a literate programming document is like reading a manual 
though, so unless it has story or essay structure it will be difficult 
to understand. Reading the code generated by literate programming 
is like reading a stack of 3.5 index cards that were going to be 
used as research for a story or essay, but were instead just taped 
together at random. The overall structure of the code and every hint 
of the author's intentions are lost.
Graham
6-Jan-2010
[230]
Looks like everything is opened in binary mode as there are no refinements 
yet to 'open.


So, to implement a line oriented protocol like pop, do we read until 
we get a CRLF pair?
BrianH
6-Jan-2010
[231x3]
I am reviewing the networking code now, in my available time.
Yes.
There won't be a string-mode refinement to open.
Graham
6-Jan-2010
[234x2]
shame ..
so used to doing read/lines on a text file
BrianH
6-Jan-2010
[236]
OPEN has the refinements it is going to have. The port model of R3 
is lower-level than R2. Higher-level stuff is handled in the schemes.
Andreas
6-Jan-2010
[237]
read/lines is already there in R3
BrianH
6-Jan-2010
[238x3]
READ is going to have a /text refinement, but not OPEN.
OPEN is lower-level than READ.
Sorry, READ/string, not READ/text (I forgot the proposal was renamed).
Graham
6-Jan-2010
[241]
The daytime:// protocol must be the very easiest to implement ... 
how would that be done under R3?
Graham
7-Jan-2010
[242]
Gregg you haven't finished the docs on schemes in the wiki !
Gregg
7-Jan-2010
[243]
I'm sure there was a reason Graham, or I just forgot, or...
Graham
7-Jan-2010
[244x4]
hehe ..
It looks like termites have been thru it http://www.rebol.net/wiki/Schemes:Notes
so many gaps in it
If Carl wants community involvement .. the docs need to get better 
....
Maxim
7-Jan-2010
[248]
docs are PART OF community involvment.
Graham
7-Jan-2010
[249]
Name one person in the community who could write this document ...
Maxim
7-Jan-2010
[250]
sorry I should have put a bit more meat in my message... this doesn't 
apply to this specific page but to all of REBOL documentation (especially 
R3).  


There doesn't seem to be anyone interested in taking charge of the 
documentation.


AFAICT, I'm not sure people realize that Carl does expect the community 
to be a big player in the documentation. 


this is more a constatation than criticism.  I don't know how it 
plays out in Open source language communities, but it seems to me 
that there is always a little gang which ends up being the documentation 
krew... seems we lack this fiber in our community.
Steeve
7-Jan-2010
[251]
Graham, a scheme less guy
Maxim
7-Jan-2010
[252x2]
but a few of us could contribute to schemes... a few of us have actually 
written schemes... there also was a great tutorial on rebol forces 
about schemes.   maybe that could be used as the basis for this page.
note ... this is an R2 page.
Graham
7-Jan-2010
[254x4]
Note, I referenced a R3 page on schemes
This is hereby declared a R2 free zone
I've had a go at this the simplest of schemes and can't get it working 
... 

http://rebol.wik.is/Rebol3/Schemes/Daytime
I grabbed stuff from Carl's demos and Gabriele's http protocol
Steeve
7-Jan-2010
[258]
it's normal. you don't open any tcp port
Graham
7-Jan-2010
[259x3]
eh?
I try this

read daytime://time-a.nist.gov
It says the port gets opened but the awake function is not triggered
Steeve
7-Jan-2010
[262x3]
yes but your actors (open and/or read) must create a tcp port thru 
the host
a scheme is only a wrapper above a tcp connection
(or upd)
Graham
7-Jan-2010
[265]
I know ..
Steeve
7-Jan-2010
[266]
So you have to do a open tcp://host somewhere in your code
Graham
7-Jan-2010
[267]
Oh ... I didn't create the port ...
Steeve
7-Jan-2010
[268]
yes
Graham
7-Jan-2010
[269]
ok, it will have to wait till my tv program finishes now
Steeve
7-Jan-2010
[270x2]
give me some minutes, i will write it
make-scheme [
	name: 'daytime
	title: "Daytime Protocol"
	awake: func [event /local port] [
		print ["=== Client event:" event/type]
		port: event/port
		switch event/type [
			lookup [
				print "DNS lookup"
				open port
			]
			connect [
				print "connected" 
				read port
			]
			read [
				close port
				return true ; quits the awake
			]
		]
		false
	]
	actor: [
		;open: func [port [port!]][port]
		read: func [
			port [port!] /local con
		][
			con: open rejoin [tcp:// port/spec/host ":13"]
			con/awake: :awake
			wait con
			to-string con/data
		]
	]
]

probe read daytime://time-a.nist.gov

=== Client event: lookup
DNS lookup
=== Client event: connect
connected
=== Client event: read
{
55203 10-01-07 07:51:23 00 0 0 282.6 UTC(NIST) *
}