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

World: r3wp

[!REBOL3-OLD1]

Steeve
28-May-2009
[14458x2]
See this line of code i do to rebuild a draw block in area-tc (it's 
called thousand times when the style is scrolled)


    out-style: insert insert insert insert insert insert insert insert 
    out-style
					'pen color/2 'fill-pen color/2 'box

     as-pair abs-x 7 as-pair (f/x * length? str) + abs-x 7 + f/y 3

Insane ;-)
it's slower than a reduce, but it's save memory, a lot.
BrianH
28-May-2009
[14460x2]
Seriously, post that code to the blog comments right away, with the 
COMPOSE/into equivalent. We need examples.
Actually, I''d use REDUCE/into for that one - too few lit-words.
Steeve
28-May-2009
[14462x2]
yep
Actually, i'd do a test and choose the faster ;-)
BrianH
28-May-2009
[14464]
out-style: reduce/into ['pen color/2 'fill-pen color/2 'box as-pair 
abs-x 7 as-pair (f/x * length? str) + abs-x 7 + f/y 3] out-style
Steeve
28-May-2009
[14465]
*est
BrianH
28-May-2009
[14466]
The REDUCE/into should be about as fast as REDUCE, but with less 
overhead.
Steeve
28-May-2009
[14467]
i talked about REDUCE vs COMPOSE
Maxim
28-May-2009
[14468]
but you insert example is just a chain... it gets insane when you 
also have offsets, cause you want to insert into sub-blocks  ;-)
BrianH
28-May-2009
[14469]
Yeah, REDUCE/into and COMPOSE/into were designed to replace chained 
inserts or appends. They're pretty common in optimal code.
Maxim
28-May-2009
[14470]
yes steeve, please do post your chained insert example  vs brian's 
reduce/into example
Steeve
28-May-2009
[14471x2]
ok ok, don't push me, i go
;-)
done
BrianH
28-May-2009
[14473]
Cool :)
Though now I wish I had word-wrapped my version :(
Steeve
28-May-2009
[14474]
yep, i saw that but too late
Pavel
28-May-2009
[14475]
Steeve I've just read the changes to A55 released today. It seems 
write/port errors patched. So Block sheme can be upgraded for quicker 
file updates?
Pekr
28-May-2009
[14476]
51 fixes/enhancements, unbelievable this happens in the REBOL land 
:-)
Henrik
28-May-2009
[14477]
perhaps it's a bit too many fixes for one release. one part of chat 
is mysteriously broken right now.
Pekr
28-May-2009
[14478]
Henrik - I just use: chat .... n .... lm :-)
Henrik
28-May-2009
[14479]
oh, 'lm has been updated. Nice.
Pekr
28-May-2009
[14480]
ah, load-plugin .... what a bad name once again. Why load or import 
does not handle it internally? ('import is used in the blog article)
BrianH
28-May-2009
[14481x2]
That sounds like an internal function that hasn't been put in a module 
yet. There is a similar function MAKE-MODULE.
You don't call make-module - MAKE calls it.
Pekr
28-May-2009
[14483]
Good thing is, that Carl asked us to not use plugins yet, which might 
mean, that the code is already in there :-)
BrianH
28-May-2009
[14484]
But I can't say for certain, as that part of the plugin interface 
isn't documented yet.
Pekr
28-May-2009
[14485x2]
I just re-read docs about plugins and devices, and I still wonder 
what is the main difference? Are devices just for I/O? Because devices 
do use commands too. But - devices just don't define new functions, 
whereas plugins might do.
Brian - what needs to be implemented for utypes? Do you think we 
will get them for 3.0?
BrianH
28-May-2009
[14487]
A:

1) They are different concepts, but devices may be implemented in 
plugins.

2) Devices wrap host or hardware things. These things include stuff 
needed for I/O, graphics, etc.
3) Well, plugins for start :)
4) Yes, absolutely.
Pekr
28-May-2009
[14488]
thanks. I just have a little problem understanding 1), but never 
mind. So plugins are superset, the ability to extend environment. 
And as they can contain REBOL code, C code, they can contain even 
Device in itself? Well, it will be better to wait for API docs probably, 
to see some real-life examples ....
BrianH
28-May-2009
[14489]
Basically, the difference between plugins and devices is that pluugins 
are code that wraps code, while devices are objects that wrap hardware.
Pekr
28-May-2009
[14490]
As for 4) - I know you guys find them important (utypes). But what 
will we gain having the ability to do our own datatypes? btw - having 
own datatype will have to fulfill some needs, as for e.g. utype will 
have to be able to react to some functions?
BrianH
28-May-2009
[14491]
Plugins are pretty much modules, but with the possibility of native 
code.
Henrik
28-May-2009
[14492]
do devices wrap hardware directly like a real device driver or does 
it wrap the underlying OS driver?
BrianH
28-May-2009
[14493]
We need utypes for host interoperability, to replace rebcode, and 
more. A utype will need to be able to react to the actions, just 
like a type
Dockimbel
28-May-2009
[14494]
Re 1): Pekr, it's the same difference than driver vs library for 
an OS.
BrianH
28-May-2009
[14495]
Henrik, yes, in theory either. R3 is built like an OS.
Pekr
28-May-2009
[14496]
But - I can imagine having library containing functions to handle 
mouse, but Amiga had device for each, which allowed it to function 
in a more async way ...
BrianH
28-May-2009
[14497]
Right. R3 is built like an OS. And designed by the same guy who designed 
*that* OS. It might follow a similar model.
Henrik
28-May-2009
[14498]
this will probably be most useful on embedded or specialized hardware 
for now
BrianH
28-May-2009
[14499]
The device will have associated functions, but those functions might 
be defined in a plugin. Or not.
Dockimbel
28-May-2009
[14500]
R3 devices wrap OS API (or third-parties API), no direct hardware 
access, that's way too costly to achieve.
BrianH
28-May-2009
[14501]
Too costly on host OSes, you mean. Some host OSes provide APIs that 
structure hardware access, like the Direct* APIs. Devices could use 
those. Or if R3 is just running on a bootloader (as proposed in Wildman), 
the device functions would access hardware directly.
Pekr
28-May-2009
[14502x2]
Brian - ticket #588 does not crash here. It just takes lots of time 
and resources to display 20x9999999 size button :-)
it is related to other bug, which is marked as Tested already. We 
should close this one probably too ...
BrianH
28-May-2009
[14504x2]
OK, I'll mark it as tested for the same alpha.
Done.
Dockimbel
28-May-2009
[14506]
About #564 and blog#207: I'm a little lost, is option 3 already implemented 
in alpha55?
BrianH
28-May-2009
[14507]
No, most of 2 is already implemented.