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

World: r3wp

[!REBOL3 Schemes] Implementors guide

Maxim
12-Aug-2010
[2124]
access to RIF?
Pavel
12-Aug-2010
[2125]
Graham I like to write a scheme for my mini RIF implementation yes 
maxim
Maxim
12-Aug-2010
[2126]
direct DB table access using read/write would be VERY powerfull  
:-)
Pavel
12-Aug-2010
[2127]
Ie write number to port get record back, write record to port get 
number back for the very beginning
Andreas
12-Aug-2010
[2128x2]
make-scheme [
	name: 'foo
	title: "FOO Protocol"
	spec: make system/standard/port-spec-head []
	actor: [
		open: func [port [port!]] [
			print 'open
make-scheme [
	name: 'foo
	title: "FOO Protocol"
	spec: make system/standard/port-spec-head []
	actor: [
		open: func [port [port!]] [
			print 'open
		]
		read: func [port [port!]] [
			print 'read
		]
	]
]

f: open foo://bar.baz
read f
hmm, ignore the first duplicate part of the paste
Pavel
12-Aug-2010
[2130]
good andreas muchas gracias you know I'm a beginner
Graham
12-Aug-2010
[2131]
There's a typo there .. FOO should be RIF  :)
Pavel
12-Aug-2010
[2132x2]
should a file to be implemented into read for real reading? (how 
to)
into read actor
Andreas
12-Aug-2010
[2134x2]
yes. you can just use normal READ to read from a file within the 
read actor
if you want to keep a file open, you can keep port-local state in 
port/state
Pavel
12-Aug-2010
[2136x2]
OK thanks I'll try my own, anyway is there any distinction if fileport 
is open/closed? after close the information is still open
ie port looks the same open or closed and open? returns true,  more 
the port cannot be deleted/removed currious
Graham
12-Aug-2010
[2138]
What's the current state of RIF?
Andreas
12-Aug-2010
[2139x2]
CLOSE on a foo port will be a no-op, unless you implement a close 
actor.
Same for OPEN?.
Pavel
12-Aug-2010
[2141x2]
graham I've commented it in DB chat , to be honest I thin Carl would 
do it better but I cannot wait more
andreas missunderstanding when f: open %file close f open? f returns 
true
Graham
12-Aug-2010
[2143]
we can't wait for Carl to do everything .. just have to be prepared 
to discard our work if he rewrites it!
Pavel
12-Aug-2010
[2144]
exact
Graham
12-Aug-2010
[2145]
you'd write your own 'open? actor
Pavel
12-Aug-2010
[2146x2]
only for open more files at once
my RIF needs to work with double files simoutaneously
Andreas
12-Aug-2010
[2148]
Pavel, not for me:

>> f: open %.vimrc 
>> open? f
== true
>> close f
>> open? f
== false
Pavel
12-Aug-2010
[2149x3]
I'll check it
you are right but then f cannot be unset (removed) but I can live 
with it
andreas your open wont do its job I'm sorry
Steeve
13-Aug-2010
[2152]
Check this http://sites.google.com/site/rebolish/Home/idx.r
Pavel
13-Aug-2010
[2153]
thanks steve for inspiration, may I know why you use actor* and not 
regular actor?
Steeve
13-Aug-2010
[2154]
several reasons
Pavel
13-Aug-2010
[2155]
Anyway I'm partially succesfull with rif:// scheme, I can open multiople 
files from port: open rif://data/file, I can close multi files with 
clos port, I can write port to-binary "some record". What is difficult 
is to pass argument (number of wanted record) to read actor. it seems 
read acor accept only port. Any hint?
Steeve
13-Aug-2010
[2156x2]
I use copy and copy/part to real several records
I don't use read as actor because of that
Pavel
13-Aug-2010
[2158x2]
It is only different name of function or has it some deeper reason? 
(read malfunction?)
Inside is read/seek/part used of course
Steeve
13-Aug-2010
[2160]
deeper reason, you can't add refinement to existing functions (overlapped 
as actors).
I just think copy is more suited to do so (because of /part)
Pavel
13-Aug-2010
[2161x2]
For RIF more suitable names would be PUT/GET as in basic key-value 
stores (memcache f.e.) I can try this convention
Anyway many thanks Steve for hints!
Andreas
13-Aug-2010
[2163]
You can also use the /seek and /part refinements to pass arguments 
to your READ actor.
Steeve
13-Aug-2010
[2164]
My convention is to simulate the behavior of a standard block (I 
called my schemle virtual-block).

So it's the main reason why I don't use read or write but copy/append 
instead
Pavel
13-Aug-2010
[2165x2]
Seems the standard functions are overloaded somehow even when you 
writes your own, (because you want different functionality of course) 
aah deep lake, deep lake
Steeve your virtual block is more persisten block isnt it? ;)
Steeve
13-Aug-2010
[2167x2]
true
there are lot of rooms for improvement in my code, perhaps some day...
Pavel
13-Aug-2010
[2169x4]
OK I'll try to finish simple rif:// scheme and update rif.r in rebol.org 
thanks guys for hepl! Documentation should be improved in file schemes, 
there is almost nothink.
nothing sorry
Another curriosity when I defined actors put/get when used port returns 
error message "no put actor"
Anyway when defined /seek refinement the sheme start to work as expected
Graham
13-Aug-2010
[2173]
I don't think you can define your own actors ...