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

World: r4wp

[#Red] Red language group

Pekr
21-Aug-2012
[1159x2]
No side projects? Well, we will have to keep you alive via some donation 
from time to time then :-)
dynamic/shared libraries support? Ability to generate a DLL? Is it 
e.g. any prerequisite to come to Android, or just useful generally?
DocKimbel
21-Aug-2012
[1161x2]
I have a short-term customer project, but it's a week or so of work 
and I can work part-time on it.


I also have another webapp (cheyenne-based) project that I work on 
from time to time, I'll publish it when it will be fully functional, 
I'm pretty sure you'll like it. Currently only Kaj knows what it 
is about, as I started it last time I've visited him. ;-)
Ability to generate DLL, yes. It is a prerequisite for Android (and 
probably iOS/OSX) support.
james_nak
21-Aug-2012
[1163]
That sounds really great.
PeterWood
21-Aug-2012
[1164]
Having /* */ comments in Red/System would be a very good idea  for 
me. Boron uses /* */ for multilne comments.
DocKimbel
22-Aug-2012
[1165x5]
I think I should find a web page that compares multiline comment 
syntax for main languages to see if there's any good  alternative 
to the C way.
BTW, for those not following me on Twitter (raise your hand!), I 
just got my first Red/System DLL working on Windows. ;-)
So now, who wants to write R3 extensions in Red/System? ;-)
As Red/System compiler is written in R2, you could imagine a full 
toolchain library for R2 that could integrate Red/System deeply with 
R2, imagine:

>> foo: make-native [a [integer!] return: [integer!]][a + 1]
>> foo 123
== 124


MAKE-NATIVE here would compile the Red/System function, emit a DLL, 
load it and map the function back. ;-)
I don't receive notification emails anymore for the newly added github 
issues...If I activate Settings->Notification->Watching->Email, I 
get them again, but also from all others repo I'm watching...Is there 
a way to only get the notifications by email for the repos I'm owning?
james_nak
22-Aug-2012
[1170x2]
Does this help? https://github.com/blog/1204-notifications-stars
Someone else wrote:

So the 'solution' I found to this was to set up filters for the various 
repository emails by filtering on email list. The list filtering 
is mentioned here on the github blog: https://github.com/blog/967-github-secrets
(scroll down the page a bit).


I would then just forward the emails from selected repositories to 
the "correct" email address.
DocKimbel
22-Aug-2012
[1172]
Thanks for the links James, I'm watching and have starred my Red 
repo, so I should receive those notifications...
BrianH
22-Aug-2012
[1173x2]
R3 extensions in Red/System sound interesting. Does Red/System have 
some easy way to replicate what the R3 extension macros do with unions?
Have you done experiments in JIT compiling yet? R3's extension/command 
model is really easy to use to implement JIT compiled functions.
DocKimbel
22-Aug-2012
[1175]
R3 unions: I'm not familiar with R3 extension macros, got a link?


JIT compilation: not yet, but I guess it could be interesting to 
do it for R3 as an extension (not on my roadmap though).
BrianH
22-Aug-2012
[1176x3]
Not R3 unions, C unions. The arg type for R3 extension commands is 
a union, with the different potential datatypes being alternates.
The macros are defined in the headers that come with the R3 host 
kit.
A Red/System extension kit would need to replicate the functionality 
of the macros, to implement the datatypes involved.
Kaj
22-Aug-2012
[1179x2]
DLL: excellent! Does Windows not need PIC or something?
Unions: I had to match them for the SDL binding. Red/System doesn't 
have them, but I just define STRUCTs for each variety, and then cast 
a particular instance to the right one
DocKimbel
22-Aug-2012
[1181x2]
PIC is not required for Windows libraries. There's a relocation mechanism 
though, that I haven't implemented yet, to solve libraries loaded 
on overlapping memory areas.
Unions: I am not a big fan of them, if a better alternative exists 
in other languages, we might borrow it for Red/System?
Kaj
22-Aug-2012
[1183]
Not sure that's practical, as the main purpose would be to support 
C interfaces
DocKimbel
22-Aug-2012
[1184]
We could be ABI-compatible with C while using something different 
than C unions.
Kaj
22-Aug-2012
[1185]
That would be nice indeed
DocKimbel
22-Aug-2012
[1186x2]
I would prefer an elegant solution that covers both bitfields and 
unions.
In fact, if we could merge struct, unions and bitfield in a single 
concept, with a nice syntax, that would be the best option.
Kaj
22-Aug-2012
[1188]
Agreed, I always felt unions were a bit shaky, too
BrianH
22-Aug-2012
[1189]
Fortunately the R3 host kit unions are tagged, so they can be used 
a bit more safely. Most higher-level languages that implement this 
kind of thing do something basically equivalent to the Variant type 
of VB, COM and .NET; even Objective C, Smalltalk, most Lisp/Scheme 
languages, and REBOLs have variant types. A variant is basically 
a tagged union type underneath. Having a cleaner way to do this in 
Red/System would be good., perhaps something like the polymorphic 
types in most functional languages. Red itself could have a dynamic 
value type like REBOL, which is basically another variant type. Red/System 
should have a way to specify different variant types because the 
variants of different platforms tend to not be compatible with each 
other.
Oldes
22-Aug-2012
[1190x2]
There is no literal form for float32! datatype values, so why not 
use literal form used in C, mostly seen in GL functions like:  glColor3f( 
1.0f, 0.0f, 0.0f ); ?
Values like 1.0f could be recognized by loader and converted to (1.0 
as float32!)
DocKimbel
22-Aug-2012
[1192x4]
Brian: thanks for the input. 


Oldes: I think this has been discussed in same channel on Rebol3 
world long time ago. Basically, the problem is that it  breaks REBOL's 
syntactic rules (digits as first characters of a word are not allowed). 
Also, this kind of syntax looks cryptic, it's IMHO, and goes a bit 
in opposite direction of what REBOL wants to promote (readable syntax).


Maybe we can do some implicit casting when a float literal is passed 
as argument to a function expecting a float32!.
Preprocessing by loader: I think it's not doable because matching 
rules would be ambiguous (you wouldn't catch some typo errors for 
example anymore).
I'm giving a try to implicit float32! casting...
I've pushed the change in master branch, no regression it seems so 
it should be a safe change. Let me know if it works well for you.
Kaj
22-Aug-2012
[1196]
Nice! I've missed that. It will make parts of my OpenGL binding look 
much nicer
Oldes
23-Aug-2012
[1197]
Fine, I will try it and it could be even more elegant solution. Anyway, 
when you say it would break REBOL's synactic rules, does not your 
hexa format breaks it as well? Personaly I found very annoying to 
change many values like 0x00FF (usually in C's defines) into 00FFh. 
But I can live with that as I can always use some  converting script.
Pekr
23-Aug-2012
[1198]
I see no reason why Red/System could not support typically used 0xx00FF 
format ... IIRC, when designing R3, we were also thinking to extend 
the syntax to support more formats, but nothing concrete appeared 
...
DocKimbel
23-Aug-2012
[1199x4]
0x00FF format would kill pair! syntax, remember that Red/System is 
a dialect of Red and that Red will have pair!.
Hexa format: you're right and I hope to fix that once we rewrite 
Red/System in Red (then we'll have our own lexer instead of been 
limited by LOAD).
BTW, we can also decide that C-like hex format is more important 
than pair! syntax and find another literal form for pairs, but that 
would push us further away from REBOL (and clones) compatibility.
Pekr: from my little experience with lexers, I found it surprizingly 
difficult to design a set of consistent rules for a simple and readable 
syntax. If I had to design a new language syntax from scratch, this 
would probably be the hardest part.  Carl did a fantastic job when 
designing REBOL syntactic rules (even if it's not 100% perfect, R3 
did fix a lot of those issues).
Pekr
23-Aug-2012
[1203]
Ok then ... I think we have more iportant things to solve/design 
:-)
Rebolek
23-Aug-2012
[1204]
How do I generate DLL? I added #export but it stills create .EXE 
file. Should I just rename it, or is there some compiler switch?
DocKimbel
23-Aug-2012
[1205]
You need to use the WinDLL target: -t WinDLL
Rebolek
23-Aug-2012
[1206]
Thanks.
DocKimbel
23-Aug-2012
[1207]
Note that currently your exported function will have cdecl calling 
convention forced on them. I'll change the #export syntax  today 
to allow optional convention to be specified (default will still 
be cdecl).
Rebolek
23-Aug-2012
[1208]
So I build my first Red/System DLL, but R2 refuses to load it with: 
** Access Error: Cannot open builds/temp.dll as library.