• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

DocKimbel
23-Feb-2013
[5599]
The interpreter is able to detect if a function has been compiled 
to native code and run the native code version, so in the above case, 
the interpreter overhead is very small, and a JIT-ed version wouldn't 
run noticeable faster. The real place where the JIT-compiler will 
make a big difference is for functions created at runtime, that would 
otherwise need to be interpreted.
Kaj
24-Feb-2013
[5600x3]
I wasn't concerned about performance here, just compatibility
If you write a script for the interpreter, and it contains function 
references with arguments, it would run in the interpreter, but not 
in the compiler
If you write it for the interpreter, that's probably because it can't 
be executed by the compiler, but in the future, you would probably 
want to have it JIT compiled
DocKimbel
25-Feb-2013
[5603]
Actually, we could just make the compiler recognize such case and 
generate a call to the interpreter without you having to specify 
DO. The drawback would be that all subsequent values in that block 
level, would be passed to the interpreter too, as the compiler can't 
determine the expression boundaries. I'm not very fond of such option, 
but it is a possibility.
Kaj
25-Feb-2013
[5604]
That's interesting, too. The compiler could issue an optimisation 
warning
DocKimbel
25-Feb-2013
[5605]
Actually, this is supposed to be the compiler fallback strategy for 
cases that are not statically solvable. I haven't needed it so far, 
and I'll try to push the compiler as far as possible before implementing 
it.
DocKimbel
27-Feb-2013
[5606]
Just in case Red followers haven't noticed, we now have REDUCE and 
COMPOSE fully implemented in Red (both in compiler and interpreter).
Gregg
27-Feb-2013
[5607]
Thanks for the reminder Doc!
DocKimbel
28-Feb-2013
[5608]
Refinements evaluation is now supported by the Red interpreter.
NickA
28-Feb-2013
[5609]
Timely
Bo
1-Mar-2013
[5610x2]
Has anyone successfully read in a jpg into Red or Red/System yet?
I'm talking about converting it to a bitmap, like R2 does.
DocKimbel
1-Mar-2013
[5612]
Bo, have you looked into ImageMagick binding for Red/System yet? 

https://github.com/dockimbel/Red/blob/master/red-system/library/lib-iMagick.reds
Bo
1-Mar-2013
[5613]
Yes.  But I was hoping for something that would simply return a flat 
binary representation.
DocKimbel
1-Mar-2013
[5614]
You could write a Red/System wrapper over http://libjpeg.sourceforge.net/
Pekr
1-Mar-2013
[5615]
you mean, something like R2's image! datatype?
Bo
1-Mar-2013
[5616]
@Pekr: Yes.
DocKimbel
1-Mar-2013
[5617]
If your wrapper is good enough, there's a great chance that your 
code would be included in Red at some point.
Bo
1-Mar-2013
[5618]
@Doc: I may have to consider that.
Pekr
1-Mar-2013
[5619]
Doc - that's interesting questions indeed. What attracted ppl to 
Rebol, was, that it was a complete package. So no problem with tonnes 
of libraries out there, plus wrappers, but curious to know, if you 
still think, that some common standard would be nice to have ... 
well, it would be even better to have ports for many things, plus 
schemes, plus codecs below :-)
DocKimbel
1-Mar-2013
[5620x2]
common standard
 for what precisely?
What attracted ppl to Rebol, was, that it was a complete package
 Who said that Red will not be a complete package too??
Bo
1-Mar-2013
[5622]
@Pekr: That's one of the things that attracted me to Rebol.  I didn't 
like to have to specify every library file that I wanted to link 
to and have all these dependencies...just one package with everything 
in it.
Pekr
1-Mar-2013
[5623x2]
for many things we are used to ... so that Red is able to read bmp.jpg 
png, play basic sound, do compression/decompression ....
well, Bo, explained it better. I am not saying that you are not planning 
it, I was just asking, if it is planned, because other point of view 
might be, that we will get some very core funcionality, plus millions 
of nice wrappers, but that would make a different feeling ...
Bo
1-Mar-2013
[5625]
Or at least like the Rebol SDK where you can easily include the major 
components you want, and the granularity to remove ones you don't 
want, like the View subset.
DocKimbel
1-Mar-2013
[5626]
For Red, it will rather work as R2 SDK where you just import the 
modules you need to build your binary. We would also provide a console 
binary with all or most of modules included by default (like the 
fat binaries from the SDK).
Bo
1-Mar-2013
[5627]
I like the way the R2 SDK worked.  You could include a whole subgroup 
of functionality or just component-by-component.
Kaj
1-Mar-2013
[5628x3]
As we discussed before, you can get JPEG data from the GDK binding, 
but you have to finish the struct definition
Any framework that supports more than one image format will have 
its own internal format. That goes for R2, SDL, GDK, ImageMagick 
and any other framework you could bind to
If you bind to LibJPEG directly, you'll have to devise your own internal 
format once you add support for another image type
Bo
1-Mar-2013
[5631]
@Kaj: I'm trying to get the JPG data without having X11 installed. 
 If I were to do something with LibJPEG directly, I would try to 
make it look like the R3 image! datatype.
Kaj
1-Mar-2013
[5632x2]
Are you sure GDK has a dependency on X?
Looks like it
Bo
1-Mar-2013
[5634]
I was pretty sure GDK required X.
Kaj
1-Mar-2013
[5635x4]
Yeah, I checked and I'm not sure, but it's very entangled
You could compile GDK on DirectFB instead of X, but it would be a 
lot of work
You could make a binding with SDL-Image to have fewer dependencies
A binding with DirectFB or Enlightenment just for the images would 
also be less massive
Bo
1-Mar-2013
[5639x2]
Thanks for those ideas, Kaj!  I'm thinking it may be better just 
to wrap libjpeg.
I don't have a lot of experience with C and library bindings, but 
I've done a bit and I can give it a shot when I have a bit of time.
Bo
2-Mar-2013
[5641x2]
Sometimes, I'm such a dunce!  Something Kaj said in the past hit 
me as I lay awake in bed at 4:45am this morning.  IIRC, he said that 
Red/System could be used to extend R3.  My problem is that I need 
to perform some advanced processing on jpg images.  I wanted to do 
this natively in Red/System, but had issues getting the jpgs loaded 
into bitmap form.  R3 can already load jpgs into bitmap form, so 
why not  call a Red/System compiled executable to do the processing?
Thanks so much, Doc, for making R3 easy to extend using a Rebol-like 
compiled language!
Thanks so much, Kaj, for your insight and foresight!
Kaj
2-Mar-2013
[5643x4]
If that's your purpose, then yes, that would be a nice combo
Just this week I checked that the Red-R3 bridge works with the updated 
dyn-lib-emitter branch of Red
There are still various bugs in R3, though. You seem to need the 
latest build from Andreas, and R3 corrupts tuples passed across the 
bridge
On the other hand, weren't you doing this on Raspberry Pi? The Red 
dyn-lib-emitter branch and thus the bridge are currently only available 
for Windows
Bo
2-Mar-2013
[5647]
That will be a problem.  Maybe I'll have to pass the data using slower 
semaphores.
DocKimbel
2-Mar-2013
[5648]
Function building and evaluation now supported by the interpreter. 
Here's how it looks like from the Red console:

red>> foo: func [a b][a * b]
== func [a b][a * b]
red>> foo 3 4
== 12