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

World: r4wp

[#Red] Red language group

Rebolek
2-Aug-2012
[840]
Doc, have a look at http://box.lebeda.ws/~rebolek/sintezar.zip

Compile file %sintezar.reds and see function ADSR in %env.reds. Even 
when I pass TRUE, EITHER always executes FALSE block. I tried to 
simplify it, but I wasn't succesfull, so it's bit bigger project 
than just few lines, sorry :)
Kaj
2-Aug-2012
[841]
Looks interesting. I can see how you're finding those expression 
bugs. :-) This is a really nice example of how Red/System can replace 
C
PeterWood
2-Aug-2012
[842]
Have you tried swapping the order of the arguments for adsr to see 
if it makes any diffrence? especially putting the  adsr! argument 
in the last position..
DocKimbel
3-Aug-2012
[843x2]
Rebolek: thanks, I've reproduced the issue and I'm searching for 
the cause.
I've just pushed a fix for your issue. I know correctly get the TRUE 
block being executed when it should.
Jerry
5-Aug-2012
[845]
Doc, Not to rush you, just curious about the progress of Red and 
its Unicode support. Unicode is very important here in China. :-)
DocKimbel
5-Aug-2012
[846x2]
Red: I'm still working on both the compiler and the minimal runtime 
required to run simple Red programs. I have only the very basic datatypes 
working for now, no objects (so no ports) yet. I not yet at the point 
where I can give an accurate ETA for the first alpha, but I hope 
to be able to provide that ETA in a week.


Red string! datatype will support Unicode (UTF-8 and UTF-16 encoding 
internally). I haven't implemented Unicode yet, so if some of you 
are willing to provide efficient code for supporting Unicode, that 
would greatly speedup Red progress. 

The following functions would be needed (coded in Red/System):

- UTF-8 <=> UTF-16 LE conversion routines

- (by order of importance) length?, compare (two strings), compare-case, 
pick, poke, at, find, find-case
- optinally: uppercase, lowercase, sort


All the above functions should be coded both for UTF-8 and UTF-16 
LE.
Porting existing C code to Red/System is fine as long as:
- the C source code license allows it.
- the used C algorithms are fast and light on memory usage.
Arnold
5-Aug-2012
[848]
Please take some time to give good thought about this kind of things 
and specifying in more detail what is needed, so other people get 
a chance to help out with doing a little programming for Red (/system). 
While not everybody is a topgun like yourself, there is a lot of 
legwork that could be taken out of your hands.
DocKimbel
5-Aug-2012
[849x2]
In case, you wonder why Red needs both UTF formats, well, it's simple, 
 Windows and UNIX worlds use different encodings, so we need to support 
both. Red will use by default UTF-8 for string values, but on Windows 
platform, it will convert the string to UTF-16 on first call to an 
OS API, and will keep that encoding later on (and avoid the overhead 
of converting it each time). 


We might want to make the UTF-16 related code platform-depend and 
not include it for other platforms, but I think that some text processing 
algorithms might benefit from a fixed-size encoding, so for now, 
I'm for including both encoding for all targets.


It will be also possible for users to check and change the encoding 
of a Red string! value at runtime.
Arnold: sure, if someone is willing to take some of these coding 
tasking, I'll be happy to provide more detailed requirements.
Arnold
5-Aug-2012
[851]
This is exactly the point! If you look in the archives you will notice 
some remarks by Carl where he was disappointed in that others didnot 
pick up some tasks. Okay first of all REBOL being not open source 
it makes no sense helping documenting stuff but there is no chance 
to do this kind of thing if there is no info of what exactly is to 
be done, as an outsider you are always one step behind and if you 
invest precious time into some work only to discoved they already 
did this. This is not an invite to do anything.
DocKimbel
5-Aug-2012
[852]
Do you think that my above description of the needs is not enough 
for you to decide if you want to do it or not?
BrianH
5-Aug-2012
[853x2]
Keep in mind that even UTF-16 is not a fixed-size encoding. Each 
codepoint either takes 2 or 4 bytes.
UTF-32 (aka UCS4) is a fixed-size encoding. It's rarely used though.
DocKimbel
5-Aug-2012
[855x2]
Brian: right!
New branch pushed for namespaces/contexts support:

https://github.com/dockimbel/Red/commit/3f02688d00bfb69ba67342c3ebf661ebd17505f2

(see example code in the commit logs)
Kaj
5-Aug-2012
[857]
Exciting :-)
DocKimbel
5-Aug-2012
[858x2]
I was pretty sure you'd like that. ;-)
Please do not post tickets for this branch, the implementation is 
still incomplete.
Kaj
5-Aug-2012
[860x2]
It's really nice, and puts Red/System definitively above C
What exactly does it mean that cross-referencing is not yet supported?
DocKimbel
5-Aug-2012
[862x2]
For example: 
    a: context [c: 123 d: b/e]
    b: context [e: 456  f: a/c]

cannot be compiled currently.
I could live without that feature for Red compiler, but it will help 
it be cleaner and easier to debug. Currently, I'm using prefixes 
to mark contexts for variables and function calls in Red compiler 
output code, I hope to be able to remove them and use contexts instead 
once I merge this new branch.
Kaj
5-Aug-2012
[864x2]
I was hoping the demands for Red would push more REBOL features into 
Red/System :-)
We'll get two great languages for the price of one, and one is already 
here
PeterWood
5-Aug-2012
[866]
That's fantastic.
Kaj
5-Aug-2012
[867x4]
Will it be possible to put #import's in a context?
Will there be something like USE or BIND to compile code referencing 
a particular context?
use gtk [view [label "dialect"]]
use [gtk zmq] [
	view label "dialect"
	send "message"
]
DocKimbel
6-Aug-2012
[871x2]
Yes, it will be possible to declare imported functions in contexts.
For your USE propoposition, that would be nice indeed. I'll look 
into it once contexts will be fully implemented.
Kaj
6-Aug-2012
[873]
Cool, thanks
DocKimbel
8-Aug-2012
[874]
Kaj: since latest commits in `namespaces` branch, you can now do:

ctx: context [
    #import [
        LIBM-file cdecl [
            sin: "sin" [
	    x           [float!]
	    return: [float!]
	]
        ]
    ]
]

print ctx/sin 1.0

;-)
Endo
8-Aug-2012
[875]
Cool!
Kaj
8-Aug-2012
[876]
Great!
Rebolek
9-Aug-2012
[877]
Is it/would it be possible to pass context as an argument to a function?
DocKimbel
9-Aug-2012
[878]
No, contexts in Red are not values, they don't exist at run-time.
Rebolek
9-Aug-2012
[879]
ok, thanks
DocKimbel
9-Aug-2012
[880]
sorry, I meant Red/System, in Red, contexts (wherever functions, 
objects or modules) are first class values.
Endo
9-Aug-2012
[881x2]
So, how scripting support wiil work?
oops, sorry I meant your previous comment: "they don't exist at run-time."
DocKimbel
11-Aug-2012
[883]
<from !Cheyenne group>


I'll have a look emitting the executable in the working directory 
this afternoon.
Kaj
11-Aug-2012
[884]
In Syllable, I repackage Red and Cheyenne in a package with a Unix-like 
structure, such as a separate subdirectory for the executable, but 
it gets cluttered because they find all their other files related 
to that executable. Actually, that's the way we want it to work for 
Syllable Desktop GUI applications, but for a console program that 
needs to be in the system path, you need the Unix structure with 
separate search paths for separate subdirectories
DocKimbel
11-Aug-2012
[885]
FEAT: added new WITH keyword for locally specifying implicit namespaces.

Usage: with <ns> [<body>]

    <ns>    : one or several block-enclosed namespace(s)

    <body> : code to execute within one or several implicit namespace

Example: 

    a: context [b: 123]
    with a [print b]
Kaj
11-Aug-2012
[886x2]
Nice, WITH would have been my other choice :-)
I suppose the first context has the highest priority?
BrianH
11-Aug-2012
[888x2]
I would expect that the nearest nested WITH would have priority.
So WITH would be like DO IN a [...] in R3.