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

World: r3wp

[!REBOL3 Extensions] REBOL 3 Extensions discussions

jocko
29-Nov-2009
[367x2]
Yes, of course it is a solution, but not a clean on in my case

in fact, you cannot know, from inside the C part of the code, the 
real number of arguments send to the function.
RXA_COUNT returns the number of arguments defined by the prototype 
of the function, not the actual one
Gabriele
29-Nov-2009
[369]
Jocko... you know... it has never been possible in REBOL to define 
functions with a variable number of arguments...
Rebolek
29-Nov-2009
[370]
it is possible, but usefull only in console
jocko
29-Nov-2009
[371]
that is why I was thinking of refinements
BrianH
29-Nov-2009
[372]
The method of calling with refinements is currently awkward. That 
is one of the problems that is intended to be addressed in the near 
future in further revisions of the extensions api.
jocko
29-Nov-2009
[373]
thanks, ... I hope that another (awkward) item will be callbacks.
Robert
29-Nov-2009
[374]
It works but it's only done via position, so you don't get the name 
of the refinement. This rule is an unnecessary dependency from Rebol 
code to C code.
jocko
29-Nov-2009
[375]
Ok, I understand ...
BrianH
29-Nov-2009
[376]
Same as APPLY, actually. Fortunately the C implementation and the 
REBOL declaration are bundled together, so you tend to be the one 
setting the positions in the first place. This makes the whole process 
easier.
jocko
29-Nov-2009
[377]
Ok, I see
BrianH
29-Nov-2009
[378x2]
However, don't expect such awkwardness to continue for much longer. 
This is just version 11 :)
11 -> 1 (stupid keyboard)
Robert
29-Nov-2009
[380x2]
May be, but that's what's available at the moment.
Is there anyway to do a callback? Or trigger R3 to do something? 
At the moment I use a localhost port for this.
BrianH
29-Nov-2009
[382x2]
Not at the moment. That is as good a method as any for now. Maxim 
has beeen doing some research on this, and the device model is supposed 
to solve this problem in the long run.
Some parts of R3 are more alpha than others - the extension model 
is one of these.
Robert
29-Nov-2009
[384]
That's bad because it's IMO an enabler and promoter for R3. As long 
as the GUI is missing, at least R3 can be used on the server with 
extensions.
BrianH
29-Nov-2009
[385x3]
The API is versioned for exactly this reason. Carl came up with enough 
of an extensions API to actually function and to let people experiment 
with various techniques to make it better. Carl is not the only designer 
of R3 - we all help, and need to. We can't know how to design the 
extensions API until we get an idea of how it will need to be used.
I'm not as much help in this as I'd like, since the current API is 
just fine for what I need to do - at least until we get device extensions. 
Maxim has been more help, since his needs aren't met by the current 
system. If you are writing a database API, your experience will likely 
help refine the model too.
R3 needs feedback about the kinds of problems that only arise from 
use. Without that feedback, design stalls.
Maxim
29-Nov-2009
[388x2]
I have been waiting for extensions for a decade, and its almost there.
a lot of stuff depends on the improvement of extensions and addition 
of device extensions.  not just for me but for Carl also.

Unfortunately I am not at liberty right now to tell what that is, 
but I can assure you extensions will have to improve in the short 
term because a new player (company) in the REBOL community needs 
this, already.


this company might become one of the levers to propel REBOL into 
adoption in (several) very large corporations (fortune 500) & scientific 
organisations around the world, so RT has vested interest into doing 
as much as it can to make this happen... and right now... the host 
code and extensions is the key to most of it.
Graham
29-Nov-2009
[390]
The Vatican keeps popping up!
BrianH
29-Nov-2009
[391]
Don't be silly - everyone knows the Vatican uses LOLCODE :)
Graham
29-Nov-2009
[392]
Using Roman numerals has always been a challenge for their coding.
Ashley
30-Nov-2009
[393]
It's that damn i word (for I I X ...)!
Gabriele
30-Nov-2009
[394]
Rebolek, that is not really true - the function still takes a fixed 
number of argument, and you're just passing a unset! value to some 
of them (which is a side effect of R2 passing unset! at the end of 
the block, i think R3 does not even do that)
Rebolek
30-Nov-2009
[395]
Gabriele, you're right that it's just a R2 side-effect and it's true 
that it does not work in R3. Not that I miss it.
Micha
3-Dec-2009
[396]
Could someone write gzip compress and decompress functions for rebol3 
extensions? what the cost would be?
Graham
3-Dec-2009
[397x2]
There's already zip for R2 ...
Check the rebol.org library
Rebolek
4-Dec-2009
[399]
I thought about writing extension for zlib, but haven't started anything 
yet. But it should be easy I think.
Maxim
6-Dec-2009
[400]
you can always use the zlib code in putty.  its MIT licensed  :-).
Robert
7-Dec-2009
[401x2]
Doing a R3 extension for this would be a no-brainer if the gzip code 
is simple to call. Getting the data to/from Rebol is easy.
But I must say that I currently use my time on getting SQLite up 
& running for R3. So far works already very good.
BrianH
7-Dec-2009
[403]
Robert, if you are good at C macros and have a good idea about how 
to improve things, make suggestions. Good safe methods for bulk copying 
of string or binary data into the REBOL values to be returned, or 
from values passed in would be great. Look at the existing extension 
source for an idea about how the current macros work. Safety is a 
priority here, so don't forget the bounds checking.
Pekr
7-Dec-2009
[404x4]
Interesting comments in R3 Chat about Commands, Extensions, DELECT 
etc.
Ok, so I've not yet provided everything that you'll need to do it. 
I divided the
 extensions release into a few stages:

1. simple - 
just simple access to commands and args
2. series - access to series 
values of various types
3. objects - access to objects (of all types)
4. 
codecs - support for codecs
5. host-lib - ability to bundle extensions 
with the host-lib itself.

So, I need to get you a bit more... in 
fact along the lines that you mention.
Re #6156: Pekr, we ARE NOT giving up on dialects!! There are many 
dialects in RE
BOL, and it is one of the main concepts.

What we 
are doing is removing the strong overlap in DELECT and COMMAND. If 
you l
ook at the DELECT method, it is a small subset of full dialects. 
It implements a
 form of function with optional arguments.

So, it's 
better to move that code into COMMANDS, and allow them to work that 
way
. This makes it much easier for people to learn and use. Even 
me!

Also, REBOL/Services will use this same method, because COMMANDS 
are not limited
 to just extensions... ah the secret is out: COMMANDS 
can also be attached to a
context, making them generally useful in 
REBOL code.

I will check the blog comments to make sure it's not 
misunderstood.
Please could someone translate to me, what does it mean that COMMANDS 
can be attached to a context, and that it will make them useful in 
REBOL code? :-)
Maxim
7-Dec-2009
[408x3]
The way I see it is  that the code inside a command probably can 
be late bound to a context, rather than the global context, as it 
is now.


when extensions will support objects, this can be pretty powerfull, 
since commands can become virtual and private methods for an object 
where the data is stored in a stuct in the binary (C) side... 


which is EXACTLY what I need for liquid, where I need rebol dispatchers 
but native data storage, so it can scale to hundreds of billions 
of nodes, and yes I already have the solution for the storage/memory 
engine if Carl can give me the means.   :-D
I already found a way to make callbacks extension callbacks in the 
current host distribution, even if nothing in the current rebol native 
code supports it  :-D


will be testing this out tonight and will report on this... I hope 
my idea works.  this would reactivate the OpenGL project along with 
other stuff on the backburner.
oops... one too many callbacks in previous sentence.. hehe
BrianH
7-Dec-2009
[411]
It's the dispatch. Right now with extensions, when you make a command! 
it makes a function that is dispatched by a function in the extension 
based on a number (which you can think of ay a key), to code that 
handles the command (the value associated with the key). In theory 
this is not that different from an object! grabbing data from one 
of its slots based on the keyword you pass it. Apparently commands 
will be able to dispatch to objects soon, and the functions assigned 
to slots of that object will handle the command code.


The DELECT dialect model was based on rebcode, mostly on its JIT 
binding. DELECT added the out-of-order, possibly optional argument 
handling to the dialect decoding phase, but the dispatch phase was 
mostly left out (I commented on this at the time). The command! type 
has the dispatch model, but uses the function call model for calling 
the commands. The overlap that Carl mentions is in the mapping of 
keys to command handlers.


If you unify the command mapping models between DELECT and command!, 
then that code can be shared. This means that the DELECT function 
could do the out-of-order dialect decoding, then dispatch the operations 
as commands. Values of the command! type would continue to be called 
like regular functions in DO code or by APPLY, and then dispatch 
using the same dispatch code as above. On the other end, commands 
would either dispatch to objects (including modules perhaps) or extensions.


By the sound of it, this might also allow the command! type to serve 
as a method pointer, but we'll have to wait to see about that :)
Maxim
7-Dec-2009
[412]
they would be globally bound, but still, usefull  I wonder how extension 
re-entry from a callback will react , if it even works... the stack 
can get a mighty mangled hehe    :-)
BrianH
7-Dec-2009
[413]
That was in reply to Pekr, btw.
Maxim
7-Dec-2009
[414x2]
btw... I wish there more host <-> r3lib hooking.   I really wish 
he'd push some of the extension handling code into the host.  right 
now there is no real extension code within the host, and there is 
no integration possible from new runtime features into the extension... 
basically, the extensions are running blind.
just a single place where we can put data which is accessible by 
extensions.  that would already make the host that much more usefull, 
especially for testing new host models or devices.  which add new 
possibilities for extensions.


the event device is also not useable for my specific task and I'm 
not sure I can really play around with it without breaking the r3lib 
<-> host integrity... testing will provide clues, I guess.
BrianH
7-Dec-2009
[416]
He has said that having extensions in the host is part of the planned 
model - check R3 chat.