Home   Archive   Permalink



Ren/C News and Updates: 13-Aug-2015

I'm not sure exactly who reads what where. But of course @GregP, you or others are free to repost whatever you like where you see fit.
    
Here are a few updates on Ren/C:
    
== FFI STABILIZATION ==
    
After some work by @ShixinZeng, FFI support has sync'd to Ren/C's changes to be in working order for Windows and Linux, and @Maarten has built it for OS/X for the first time. This means ROUTINE!, STRUCT!, and CALLBACK! are available to use for interfacing with pre-built third party libraries. For example:
    
https://github.com/metaeducation/ren-c-test/blob/master/atronix/qsort.r
https://github.com/zsx/c2r3/blob/master/demos/gtk-demos/gtk-demo.reb
    
@Maarten is specifically experimenting with linking to routines from the Go language library:
    
https://golang.org/pkg/
    
== CUSTOM INFIX OPERATORS ==
    
Custom infix operators are now supported, via a function attribute. While Rebol2 used a block in the first position to indicate an attribute, e.g. func [[catch throw] arg1 arg2 ...] [...], Rebol3 is using TAG! for these kinds of things. So:
    
+: function [<infix> arg1 arg2] [add arg1 arg2]
    
It is called <infix> despite using a single-item lookahead for any number of arguments. That means it actually will be -postfix- if you only have one argument. If ? were to take three arguments and be 'infix', you could write X: CONDITION ? VAL1 VAL2 and get something like C's ?: operation.
    
While alternative names besides 'infix' were considered, none justified the lack of clarity for the main purpose. It may even be limited to arity-2 functions, so during this early phase please speak up if you get opinions on how it should work.
    
== CAN BUILD WITH CMAKE, OR WITH *NO MAKE AT ALL* ==
    
@ShixinZeng has worked out a Rebol script that will spit out a CMakeLists.txt file to drive the Rebol build. CMake has wide support and many features, and one important feature is to be able to generate project files for most popular IDEs. That means we will be able to push a button and load up Rebol's files all ready to edit and go in: Visual Studio, XCode, Qt Creator, KDevelop, CLion, etc...
    
(Note: Shixin is still working on this but it's available as a branch for early testers.)
    
At the same time, @earl has cooked up a script that uses CALL instead of any make at all. While you won't get any fancy IDE files out of the process, it means Rebol can drive its own build process via Rebol. It only supports full builds, but as a cross-platform solution it points to promising new directions of what Ren/C might be able to do in terms of a Red-like independence of toolchain. More on that soon...
    
== 'STABLE STACK' and other stability changes ==
    
You may be wondering what all the commits to Ren/C are about when the only 'new feature' you might perceive (vs. the features gleaned from Atronix/Saphirion) is custom infix operators. The answer is that focus has been on core infrastructure and futureproofing. Among the many systemic issues being tended is stack stability for call frames. There are explanations in the code itself for those interested enough to read it:
    
https://github.com/metaeducation/ren-c/blob/master/src/include/sys-stack.h
    
The presence of explanations points to another big push, which is not to merely fix problems, but to leave a wave of improvements for easier maintenance. Especially by people other than me. So the sooner people are feeling comfortable to get in and take on issues, the better.
    
== MATH DIALECT ==
    
Among Ren/C's several stated goals is to go ahead with decisions that have been made but have faced slow adoption. Examples of this will be on the rise, such as the incorporation of a MATH function from Gabriele Santilli. This means you can write:
    
>> math [1 + 2 * 3]
== 7
    
You can also ask it to do the processing but not run it via /ONLY (which Gabriele had called /TRANSLATE):
    
>> math/only [1 + 2 * 3]
== [add 1 multiply 2 3]
    
Whether the implementation is ideal or not, it is there to serve as an answer to those with that first challenge to Rebol about its expression precedence. The new answer is 'Rebol has a MATH dialect.' Show the process, then show the /ONLY variant. And *then* explain: 'But the basic rules are designed to be as simple as possible, to make writing that (and other dialects) as smooth as it can.'
    
== LENGTH? -> LENGTH and TYPE? -> TYPE-OF etc. ==
    
Early Rebol programmers find HEAD means 'get the head of a series' and HEAD? means 'is this series at the head position'. That drills in that the distinction of ? is that it is a LOGIC!-returning query. Yet with routines like LENGTH? and TYPE? you end up with areductio-ad-absurdum of '? means it is a function that returns a result'. This poor practice has unfortunately become entrenched in existing Rebol codebases.
    
Due to the entrenchment, the ?-based versions can't disappear overnight. But there are new -OF replacements, which are what should be used from here on out. The exception of LENGTH was added as a new 'keyword', as it was deemed just too ugly to have to type LENGTH-OF every time you wanted to get a length. Hence it joins the other 'words you *probably* shouldn't use for variable names' like NEXT or FIRST etc.
    
You can read about it on a new handy portability-guide Trello, being put together for Rebol2 => Ren/C and Rebol3 => Ren/C transitional issues:
    
https://trello.com/c/4OT7qvdu
    
And if you aren't using Ren/C yet and want a head start, just put some common include in your project that says:
    
unless value? 'LENGTH [LENGTH: :LENGTH? unset 'LENGTH?]
unless value? 'INDEX-OF [INDEX-OF: :INDEX? unset 'INDEX?]
unless value? 'OFFSET-OF [OFFSET-OF: :OFFSET? unset 'OFFSET?]
unless value? 'TYPE-OF [TYPE-OF: :TYPE? unset 'TYPE?]
unless value? 'SIGN-OF [SIGN-OF: :SIGN? unset 'SIGN?]
    
There are actually more of those to sort out, and if you have ideas for the names of others please chime in:
    
https://github.com/metaeducation/ren-c/pull/43
    
== AND MORE... ==
    
There is more, and the best way to keep up on it is to hang around StackOverflow chat, and to read the bookmarks list:
    
http://chat.stackoverflow.com/rooms/info/291/rebol-and-red/?tab=stars
    
Generally speaking, new 'features' are sent as pull requests on GitHub instead of just pushed as commits. I think you can subscribe RSS for that for github's metaeducation/ren-c master branch, somehow or another. (They are fed to the chatroom.)
    
== WHAT CAN *YOU* DO TO HELP? ==
    
Building Ren/C is easy. If it's not easy, we want to fix it so it is. If you haven't built it, do so. It should be simple.
    
https://github.com/metaeducation/ren-c/blob/master/make/makefile.boot
    
You don't have to know how to write C code to pitch in. There's a lot of Rebol in there. No improvement too small (if it's an improvement). Look at a recent patch from @rgchris to REWORD:
    
https://github.com/metaeducation/ren-c/commit/5dc4b48b5f45eb7ea729fba12882a0ed3ff3d37e
    
Or @Brett just eyeballing some code and spotting a mistake:
    
https://github.com/metaeducation/ren-c/commit/ce53889f144ff3ae4814ffe1af93846e6f6e3c6b
    
@draegtun pitched in a little about .gitignore, which was just commenting a git file to explain what policies might be used for it going forward:
    
https://github.com/metaeducation/ren-c/commit/51d1c88901d3696c7460d21290ba9c3d517fc9a6
    
So there's lots to be done, even if you don't want to dust off an old C book and see what you can do. But if you want to tackle a feature you'll find the comments are evolving and there's rapid support for your questions.

posted by:   Fork       13-Aug-2015/5:01:44-7:00



This is very exciting Fork. I hope it reduces the the barrier of entry for other C developers. Thank you for your work and communication!

posted by:   Nick       13-Aug-2015/23:07:29-7:00



Hi, thanks for the great work!
I am just curious, has anyone tried to build it on Emscripten? I have tried but failed due to some error about "llvm.umul.with.overflow intrinsics"

posted by:   forte       14-Aug-2015/0:10:15-7:00



Thanks Nick...
    
@forte To my knowledge no one has built it with emscripten, though a slightly modified original open-source Rebol has been. Feel free to join up on StackOverflow chat where we work through such things in "real-time":
    
http://rebolsource.net/go/chat-faq

posted by:   Fork       14-Aug-2015/4:00:54-7:00