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

World: r3wp

[!REBOL3 Schemes] Implementors guide

BrianH
27-Jan-2010
[1913]
No, it supposes that you are refactoring your modules so that the 
reusable code is getting exported from a reusable code module, then 
imported into your specific module.
Graham
27-Jan-2010
[1914]
The module author can not possibly know what users might want to 
reuse
BrianH
27-Jan-2010
[1915]
Then provide the source. Making things safely reusable takes planning. 
Providing the source doesn't (or at least not as much).
Graham
27-Jan-2010
[1916]
Say I wanted to create a http header, I would naturally want to use 
Gab's make-http-request function that is not exported
BrianH
27-Jan-2010
[1917x2]
Say you wanted to create an HTTP header, and it had nothing to do 
with HTTP. Are you sure you want to create the same header? Or are 
you sure that you don't actually want to extend the existing http 
scheme? The author isn't psychic.
Making code reusable takes planning. If you want to reuse code safely, 
do the planning. Or copy and paste.
Graham
27-Jan-2010
[1919]
And we arrive at a situation where you end up duplicating code everywhere
BrianH
27-Jan-2010
[1920]
Not really. You could do the planning, and refactor. Even Gabriele's 
code, since he provided the source.
Graham
27-Jan-2010
[1921]
But we lack the sources to recompile the core with our refactored 
code
BrianH
27-Jan-2010
[1922x2]
We can replace a protocol in memory if need be. Or load one from 
host code. Or better yet, fix the source in DevBase.
Right now I would rather see duplication, so we can get a better 
idea of what needs to be reused.
Graham
27-Jan-2010
[1924x2]
Well, I don't want to see all the code duplication we have in r2
every script defining digits as a bitset even though it's already 
defined in one of the schemes
BrianH
27-Jan-2010
[1926x2]
We're in the planning phase when it comes to scheme infrastructure 
(not port infrastructure). I want to tweak/redo the scheme dialect, 
but there haven't been enough examples of schemes yet to see what 
needs to be done. Perhaps making a protected collection of standard 
bitsets would be a good idea, but who can say for sure at this point?
You'll help out a lot there, apparently :)
BrianH
28-Jan-2010
[1928]
For that matter, the exports of the http scheme weren't planned by 
Gabriele at all. There was no module system when he wrote it, and 
system exports didn't work yet when Carl put it in a module, so there 
were no code exports. And for that matter, reuse was unnecessary 
because there was only one scheme. Assume that the code needs refactoring.
Graham
28-Jan-2010
[1929x4]
I'd like to ask how we might manage the download of a large file 
by thehttp protocol
Actually I just tried downloading a 16Mb file and it timedout in 
R3 but downloaded okay in R2.
So, it seems you need to open the port instead, and then modify the 
timeout
Maybe what should happen instead is that if you receive other than 
xml, text, then the data should be streamed a file and a file! returned 
instead ( like Cheyenne does with html uploads ) ...
Pekr
28-Jan-2010
[1933]
BrianH: I think that there is now bunch of examples of schemes, so 
it might start to become apparent, what is needed :-)
BrianH
28-Jan-2010
[1934]
After the first of the month, that's the plan.
Graham
28-Jan-2010
[1935x2]
There are a few schemes now but they're basicall all written by me 
... so I don't think there's much variety there.  Others have commented 
that the awake handler should be as small as possible and to keep 
the state machine outside ...
If anyone is interested .. this is the "bug" I came across

http://developer.amazonwebservices.com/connect/thread.jspa?threadID=41782&tstart=0


I had to change my to-iso8601 function to add the extra precision 
required.
eFishAnt
29-Jan-2010
[1937x2]
aha, cool, those links I was looking for!
(ports, schemes, etc)... I did get my product mostely working in 
R3 (large % networking) up to about 90% and to be honest, I didn't 
put much time into the porting R2 -> R3 yet.
Graham
29-Jan-2010
[1939]
Where's the video codec you did??
eFishAnt
29-Jan-2010
[1940]
I need to port it to the latest R3.  There was a point where the 
GC got changed and the real-time performance went crazy, and I want 
to blend it into the new architecture...so I don't want to put out 
something that requires an old R3 alpha...and the dialect is not 
100% clean...guess I'm being kind of a Carl here...not ready for 
prime-time yet.
BrianH
29-Jan-2010
[1941]
This is the best place we have now to discuss SSL on R3.
Andreas
29-Jan-2010
[1942x2]
Fine with me
How would I implement a ssl:// port scheme in the hostkit, that behaves 
just as tcp:// does, but allowing me to hook the native actors (open, 
mainly)
BrianH
29-Jan-2010
[1944]
The tcp:// scheme is defined in the host kit, as are all native schemes.
Andreas
29-Jan-2010
[1945x2]
no, only the tcp device is defined in the hostkit
how the device is wired up to the tcp:// scheme, is somewhere else
BrianH
29-Jan-2010
[1947]
That's all you need. The scheme is a stub.
Andreas
29-Jan-2010
[1948x2]
And where is that stub?
How is it wired to the tcp device?
BrianH
29-Jan-2010
[1950x2]
Just a few lines of mezz code in mezz-ports.r
make-scheme [
	title: "TCP Networking"
	name: 'tcp
	spec: system/standard/port-spec-net
	info: system/standard/net-info ; for C enums
	awake: func [event] [print ['TCP-event event/type] true]
]
Andreas
29-Jan-2010
[1952x2]
ok
How does this connect to the hostkit device?
BrianH
29-Jan-2010
[1954]
If I knew how to do this, it would be done already. Learning how 
is on my todo list, but I'm hoping someone else (like you) gets to 
it first.
Andreas
29-Jan-2010
[1955x3]
hehe
fair enough :)
I know that we have a array in host-device.c that lists all devices
BrianH
29-Jan-2010
[1958]
I only know that it can be done, not how (yet).
Andreas
29-Jan-2010
[1959x2]
I doubt that it can be done without changes to one of the binary 
blobs
I assume that somewhere there is a mapping between indices into this 
array to names like 'tcp
Steeve
29-Jan-2010
[1961]
maybe including a row device allowing to build our own datagrams 
would be the best :-)
Andreas
29-Jan-2010
[1962]
in reb-device.h we have an enum for those indices