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

World: r3wp

[Red] Red language group

Kaj
8-Aug-2011
[2871]
TYPED would also do
Gregg
8-Aug-2011
[2872]
TYPED sounds good, based on a glance at the docs.
Kaj
8-Aug-2011
[2873x2]
I can now draw a pixel on an SDL screen in a format of 32 bits per 
pixel
Humble beginnings, but I've had a series of issues already
Gregg
8-Aug-2011
[2875]
Getting the basics working is sometimes the hardest part.
Dockimbel
9-Aug-2011
[2876x2]
I had TYPED in my short-list, so I guess it would be a better choice 
for a single word.
Now that variable arguments and RTTI are available, I have re-designed 
the basic screen printing functions. I have inserted a _ character 
in front of all PRIN-* functions, as they should not be used anymore 
in the general case (I might drop them completly later if they are 
not useful anymore). 


Before releasing it, I would like to get some feedback first. Now 
only the polymorphic PRINT and PRINT-WS (inserting spaces) functions 
should be needed. LF, CR, TAB, SPACE have been declared, so can be 
freely used in print blocks (or anywhere else). Variadic and typed 
functions have now a relaxed syntax, allowing to pass a single argument 
without enclosing [ ] brackets.

PRINT: print one or several arguments one after each other.

PRINT-WS: print one or several arguments, inserting a space character 
between each arguments.

Here how it looks now:

* printing without newline

    print "hello"
    print 123
    print ["hello" 123 tab "world"]

* printing with newline

    print ["hello" lf]
    print [123 lf]
    print ["hello" 123 tab "world" lf]

* printing with space inserted

    print-ws ["hello" 123 "world"]
    print-ws ["hello" 123 tab "world" lf]
Kaj
9-Aug-2011
[2878x2]
Very nice. This takes Red/System a step beyond C
The only thing I'm not wild about is the print-ws name. Do you think 
something like print-wide would be too long?
Dockimbel
9-Aug-2011
[2880x2]
Well I consider PRINT-WS already too long, but -WIDE is nicer, so 
it might be a good alternative.
I use a lot of PRIN-* functions every day for debugging purpose, 
so this new, much more powerful PRINT alternative, will save me a 
few hundred keystrokes each day (just not having to type PRIN NEWLINE 
anymore makes me happy). :-)
Kaj
9-Aug-2011
[2882]
:-) It also reads a lot more elegant
Dockimbel
9-Aug-2011
[2883]
Indeed.
Endo
9-Aug-2011
[2884x2]
In PureBasic, there are Print and PrintN functions. PrintN adds new-line 
to the end.
For Print-ws, what about Print-Form ?
we can use PrintN for single argument: PrintN "Hello" --> Print ["Hello" 
lf]
Dockimbel
9-Aug-2011
[2886x2]
I considered PRINT-FORM but I've found it not meaningful enough. 
PRINT-WIDE is a better hint at what the function does.
I will publish these changes tomorrow morning and will bump the version 
number, as they would break most of existing scripts. I will write 
a blog entry to describe the changes.
Kaj
9-Aug-2011
[2888]
Did you do any performance improvements? I just updated after a bit 
over a month and my SDL test, drawing a gradient, is a lot faster 
:-)
Pekr
9-Aug-2011
[2889]
I wonder why we use lf, instead of a newline. Then we add a description 
to the doc, something like lf adds a newline :-)
Kaj
9-Aug-2011
[2890]
LF is shorter, and newline was already defined
Dockimbel
10-Aug-2011
[2891]
Did you do any performance improvements?

 I did a few small code optimizations, but they should not have noticeable 
 effects. Maybe your code relies on a tight loop that benefited from 
 them?
Pekr
10-Aug-2011
[2892]
btw - what's the resolution re floating support in Red/System? Kaj 
is now trying to port SDL, so I wonder if for the gfx (which was 
not planned to be the RED's target),it will be the necessity,or not?
Dockimbel
10-Aug-2011
[2893]
Floating point support will come to Red/System when the float! Red 
datatype will be implemented.
Pekr
10-Aug-2011
[2894]
And float is planned, right?
Dockimbel
10-Aug-2011
[2895x2]
Of course, there is just a lot of other feature that are much higher 
in priority.
features
Kaj
10-Aug-2011
[2897x3]
Basic SDL does not require floats yet, so I have some room left to 
grow :-)
What's becoming a problem first is the lack of 16 bits integers. 
They're in structs and arrays, so I have to do trickery now to access 
them
Maybe I imagined the speed improvement. My previous experiments were 
the night before, and I don't have those executables anymore
Pekr
10-Aug-2011
[2900]
Will Arduino support bring us an ARM support? Hmm, maybe not - it 
seems to be an Atmel, not ARM?
Kaj
10-Aug-2011
[2901x2]
The small Arduinos are AVR, the bigger Netduinos are ARM
The first embryonic support for both is already done, if I'm not 
mistaken
Dockimbel
10-Aug-2011
[2903x2]
Arduino boards use AVR 8-bit MCU (microcontroller), the Netduinos 
use a 32-bit MCU equivalent to an ARMv4 IIRC. The port for AVR 8-bit 
has started but it is still highly experimental. The ARM port started 
by Andreas targets ARMv5 architecture IIRC.
16-bit integers: Red/System does not need them, but interfacing with 
external libraries might require it, especially for struct members. 
I wonder if adding support for a int16! pseudo-datatype, only limited 
to struct members would be hard to add...Will have a look at it, 
once all the current pending tasks will be done.
Pekr
10-Aug-2011
[2905]
as for "pending tasks" - is there any list,of what is being currently 
worked on, other than the website roadmap?
Kaj
10-Aug-2011
[2906x2]
16 bits arrays also need to be manipulated, with 16 bits access and 
pointer arithmetic
Lots of external functions take 16 bits arguments. Are they 16 or 
32 bits on the stack?
Dockimbel
10-Aug-2011
[2908x2]
For IA-32 CPU, it is always 32-bit on stack.
List of tasks: yes, on my paper notebook. They usually cover 1 to 
3 days of work and are updated frequently.
Pekr
10-Aug-2011
[2910x2]
so still mostly working on Red/System, to be powerfull enough to 
write RED in?
I just wonder - if Carl would decide one day to "port" R3 to Red/System, 
would it mean, that the resulting executable would run at the target 
platforms supported by Red/System?
Dockimbel
10-Aug-2011
[2912]
Mostly working on Red now (memory allocator is done, tokenizer will 
start soon), but some Red/System improvements and fixes are still 
needed.
Pekr
10-Aug-2011
[2913]
Where you will write stuff like devices (in R3 terminology), events, 
tasking/threading, simply a native stuff? As a RED/System? Or will 
it be RED itself (will not it be slow then?) I just would like to 
understand it a bit :-)
Dockimbel
10-Aug-2011
[2914x2]
R3 -> Red/System: not sure if it would be an advantage or not. Currently, 
from a performance POV, C is still faster. (Think about current Red/System 
as C without optimizations turned on).
The "native" layer in Red is Red/System, so almost all that stuff 
will be coded in Red/System with some interfacing layer in Red.
Pekr
10-Aug-2011
[2916]
Aha, so Red/System is just a general REBOL/C like language. We still 
need to wrap native functionality/libraries, to get tasking, events, 
etc. Btw - do you plan to utilise liboop, libevent, pthreads libraries, 
or will you write everything from scratch/your (REBOL) way?
Dockimbel
10-Aug-2011
[2917x2]
Tasking

 will be brought by actor! datatype which will use a pool of OS threads 
 underneath. I am not sure what you mean precisely by "events". Liboop 
 and libevent are nice libraries, but probably overkill for Red, so 
 I will implement similar low-level OS bindings specifically for Red 
 (probably merged in the actor abstraction). For OS threads, I will 
 pick up the API provided natively by each OS.
Kaj, do you have already some gfx demo to show using Red/System + 
SDL or are you preparing something for the Software Freedom Day?
Kaj
10-Aug-2011
[2919x2]
Just a lame gradient, but I'm preparing for SylCon, September 3
Do you need one?