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

World: r3wp

[Red] Red language group

Dockimbel
23-May-2011
[1525x2]
Well, it is a bit late now as Red/System implementation is reaching 
its end. I am trying to stick as close as possible to the REBOL syntax 
we are used to, if you have better propositions for the syntax, I 
am ready examine them, but I would like to finish on Red/System and 
start working on upper layers, unless you want me to polish Red/System 
for the next months and start working on Red 6 months later than 
I planned?
I would like also to remind you that Red/System will be re-implemented 
entirely in Red at some point, so we'll have a second chance to fix 
design and implementation issues/limitations if necessary.
BrianH
23-May-2011
[1527x2]
It's not a problem.
The pointer! [...] syntax does make sense as a shortcut for struct! 
[value [...]] in function specs - that type equivalence was the important 
part of the earlier argument, not syntax issues. The only place that 
the syntax looks weird is in AS calls, where otherwise expression 
rules would apply. I'll look over the specs later this evening and 
see if there's anything really weird-looking.
Dockimbel
23-May-2011
[1529x2]
You mean that you would prefer writing it without outer brackets 
for type casting (like: as pointer! [integer!] ...)?
(as proposed by meijeru on the ML)
BrianH
23-May-2011
[1531x2]
No, I mean that pointer! [integer!] would be exactly the same type 
as struct! [value [integer!]] - type equivalence between pointer! 
and struct!. This would make the pointer! type a syntactic sugar 
shortcut for a subset of the struct! type. That is the semantic portion 
of what you wanted me to write down for you in a google groups post 
so you could refer to it when you were implementing that suggestion. 
There were also syntactic issues, but those don't matter as much.
This was long before meijeru got on the Red google group.
Dockimbel
23-May-2011
[1533]
Right, I think I should add it as a note in the specification draft.
BrianH
23-May-2011
[1534]
I've been busy lately so I haven't read the latest couple spec drafts. 
Must catch up and comment, quick before you finalize things.
Dockimbel
23-May-2011
[1535]
I will push new specification changes and fixes tonight. I have added 
a type casting matrix for all possible type combinations. I am currently 
  implementing the missing cases.
BrianH
23-May-2011
[1536]
Do you make a distinction between implicit and explicit type casting? 
Does Red/System have any implicit type casting at all yet?
Dockimbel
23-May-2011
[1537x2]
Yes, it does an implicit type casting for math and bitwise operations 
on the second argument.
I have pushed the changes for the type casting matrix support (both 
in docs & implementation). I need to add proper tests to cover that 
tomorrow.
Kaj
24-May-2011
[1539]
4.6.6 of the spec now says that the official type for a void pointer 
is integer! but this leads to type mismatches with null
Dockimbel
24-May-2011
[1540]
Null is currently of type pointer! [integer!], I need to get it back 
inside the compiler to make it polymorphic. Just use 0 for integer! 
or handle! (if you've defined it) in the meantime.
Kaj
24-May-2011
[1541x5]
I would like to introduce my second Red binding, for the standard 
C library:
http://red.esperconsultancy.nl/Red-C-library
So far I have bound 25 functions and written two higher level wrappers
I've used it to implement printing of integers in the examples for 
the 0MQ binding
Doc, feel free to use any of it that you need in Red
PeterWood
24-May-2011
[1546x3]
You can print integers in Red/System
Just include this - https://github.com/dockimbel/Red/blob/master/red-system/tests/quick-test/prin-int.reds
May not be clever but it prints integers.
Kaj
24-May-2011
[1549x2]
I know, but this is a solid solution, and there are 26 more functions 
:-)
I've bound all memory management functions, most of the string processing 
functions and a few system interfacing functions
PeterWood
24-May-2011
[1551]
Looks good and will also act as a good example.
Kaj
24-May-2011
[1552]
Thanks
Dockimbel
25-May-2011
[1553]
Kaj, thanks for the contribution. I have planned to wrap some of 
the memory manipulation functions too as soon as I finish the work 
on aliasing and type casting.
PeterWood
26-May-2011
[1554]
Hats off to Kaj!
 - from Miejeru on the Red Google Group
Kaj
26-May-2011
[1555]
Thanks :-)
Kaj
27-May-2011
[1556]
Red can load library functions with different calling conventions, 
but which convention does the emitter generate for its own functions? 
Cdecl?
Dockimbel
27-May-2011
[1557]
Internal functions: stdcall
Kaj
27-May-2011
[1558]
Wouldn't it be better for compatibility to use cdecl?
Dockimbel
27-May-2011
[1559]
I am not sure about the argument order, though...it might be opposite 
of stdcall
Kaj
27-May-2011
[1560x2]
I doubt it, because so far I have been able to interchange them. 
The differences must be very small
For porting the cURL binding, I will need callbacks. I'm sure cURL 
on most systems expects them to be cdecl
Dockimbel
27-May-2011
[1562]
cdecl for internal functions is only required for callbacks from 
external app, so I planned to add it for internal functions that 
are exported.
Kaj
27-May-2011
[1563]
OK, when is that plannned?
Dockimbel
27-May-2011
[1564]
In a not-too-distant future :-) I don't have precise ETA for that 
as it is not required for Red building. I will add that feature when 
working on the DLL building mode, so probably one of the next weekends 
(maybe on June, 4-5 if there's no other urgent tasks).
Kaj
27-May-2011
[1565]
Great, thanks
Dockimbel
27-May-2011
[1566]
I wanted also to add PIC code generation, so I am not sure which 
one I'll do first. What do you think?
Kaj
27-May-2011
[1567]
By DLL building mode, do you mean having Red generate shared libraries?
Dockimbel
27-May-2011
[1568]
Precisely.
Kaj
27-May-2011
[1569]
Brilliant
Dockimbel
27-May-2011
[1570x2]
PIC support will be required for that.
I thought about implementing PIC support first and testing it using 
Syllable's executables.
Kaj
27-May-2011
[1572x2]
For DLL, you need PIC. I can use callbacks before that, so I'd say 
the order is cdecl, PIC, DLL
That would be nice, too, but it's quite possible that executables 
can already run on Syllable if they can be generated at the right 
start address
Dockimbel
27-May-2011
[1574]
Ok, I have no personal priorities for these tasks, so I'll take yours.