Thursday, 6 June 2013

Livecode Vs Rebol


LiveCode is a new language created by the RunRev company. The idea was to create a simple high level languages and cross-platform. At the present the same code run on Windows, Linux, MaxOS, Android and iOS.
Initially Livecode name was "Revolution Runtime" and the logo was this:

Did you notice how was similar to the rebol one here?

Initially LiveCode was closed source and very expensive (about $500 to use it). Fortunately RunRev company accepted community request to make it open source and raised a kickstarter campaign to reach $ 500'000. They reached over $ 750'000 and one moth ago a free opensource version was released.
You may download it from http://livecode.com/download/
I'll show you LiveCode below in the post, but my first impression is that RunRev knows Rebol very well and assimilated all main values of it improving them, creating a more web 2.0 language. They offer support, hosting, a free forum (based on PHPbb), youtube videos. Even the LiveCode source is made in C and objectiveC like Rebol. Some commands and syntax remember Rebol way (do, first, second, last, compress, try, ask, sort, foreach, ...) .
First of all the download is about 50 times bigger than Rebol, because it includes IDE, a PDF guide, a sort of script market, encapper and many other features. Let's see the following video example:


In order to compare LiveCode, I tried to reproduce the same advanced rebol script in Livecode. It was hard, since LiveCode programming way is very different from Rebol way. Even if they both share a similar syntax, the main difference is LiveCode force you to use its IDE, LiveCode IDE doesn't produce a script file totally intelligible, it produces a single text file that is a mix of binary and text, but you must use LiveCode IDE to edit it, otherwise it will be corrupted; on the other hand your personal code is mantained as is, so you can easily recover it with copy and paste. The text part is what you add as your code, the binary part is all the GUI elements with their properties.
So using rebol you use just your keyboard to write your script, test it, rewrite your script; using LiveCode you use mouse and keyboard, navigate through IDE tab panels, but you see immediately the result.
Another important difference are variables scope, it can be as rebol, but a good practice is to associate always to a graphic element, otherwise debugging can be an hell.
Most important of all is that the scripts code can be (quite only) inside any GUI element, so can be difficult to inspect all the code at glance. On the other hand productivity on "hostile environments" such as Android or iOS (iPhone and iPad) becomes matter of minutes.

Let's see some code examples:

RebolLiveCode
myVar: 2put 2 into myVar

as you can see Rebol is more concise than LiveCode

RebolLiveCode
myObj/myProp: 2 set myVar of button "MyObj" to 2

LiveCode doesn't have simple object, but every GUI elements has properties like Rebol Object.


RebolLiveCode
myArr/1: 2 put 2 into myArr[1]


RebolLiveCode
if exists? %myfile.txt [alert "found"] if there is a file "myfile.txt" then
answer "found"
end if

LiveCode is an high level language very similar to Rebol, here the results for the same purpose:



In Rebol I had to write about 333 lines of code, in LiveCode I had to write about 76 lines for the same result.

The strengths of LiveCode are:
  • support
  • forum
  • large audience (LiveCode users now are about 62'000, while Rebol users are just 42)
  • open source
  • fully supported on every OS (mobile included)
  • very GUI oriented
  • Web 2.0 developers
  • very high level languag

Here are the LiveCode lacks:

  • binary format of source script (even if they are in part intelligible)
  • syntax too long (sometime you'll regret Rebol refinemets)

If you are looking for a Rebol well supported replacement, you should try LiveCode.

6 comments:

  1. Having experimented with LiveCode I had 2 major problems. The first is: the syntax is sooo weird that sometimes it is almost impossible to look the right stetement up. This is (at least in the beginning) very time consuming. The second problem I had was that the error reporting sometimes is *very* weak. E.g. a program has no syntax errors, but LiveCode simply refuses to execute a given statement????????
    For me Rebol is the clear winner. And yes, I had high hopes for LiveCode :-(

    ReplyDelete
    Replies
    1. About syntax you are right, it's very (too) long.
      About error handling is the same of Rebol now. Cryptic the same way :-)

      Delete
  2. Please tell me, why Rebol code should be 333 lines, whereas LiveCode only 76 lines? I simply sohehow can't believe it, unless there is something hidden in LiveCode objects, e.g. premade GUI for the purpose given. Btw - have you seen the code of simple Rebol calculator? Pretty tiny ...

    ReplyDelete
    Replies
    1. I chose a "medium complexity" script for comparing in order to see a real case. I was indulgent with Rebol, since Supercalculator script needs RebGUI and it make the effective rebol script 6'140 lines!
      However these calculator can perform correctly long complex calculus in a single line, like 2*sin(45)/3+5.
      Rebol way to evaluate algebraic operation is wrong, for example for rebol 2+3*4=20 (the correct result is 14), so you need to write about 100 lines just for correct it, then you have to write for the GUI, and then all the rest. LiveCode permit to write just for the rest. GUI is made with drag and drop operations. The total time between typing or using drag and drop can be quite the same, but it's easier for a beginner. Moreover the LiveCode IDE inform you of all properties of a GUI elements, in Rebol you have to try to guess about them.

      Delete
    2. So as I have thought - wrong perceptions, wrong conclusions. Rebol evaluates expressions its way. That's like finding something LiveCode does differently, creating 300 lines of adaptations, and stating, that the code is longer.

      Delete
  3. I'm sure there are a heck of a lot more than 42 Rebol users; they just haven't found the place to register online as such

    ReplyDelete