Computer Science Canada

Why I find Rebol virtually incomprehensible

Author:  wtd [ Sat May 10, 2008 11:20 am ]
Post subject:  Why I find Rebol virtually incomprehensible

I've tried to grok this language before, but I have to say, the lack of syntax really throws me off, and it doesn't even have Lisp's nice parentheses to indicate precendence.

Author:  rizzix [ Sat May 10, 2008 2:45 pm ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

Yea, makes me wonder how they managed to write a compiler for it.

Author:  btiffin [ Sat May 10, 2008 5:13 pm ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

Smile Different eh? Takes an open mind and a little time.

No one has written a compiler yet. The arity parser (meaning arguments have to be evaluated before functions are called) in conjunction with "Relative Expression" (a word only has meaning when bound to a context) makes a compiler fairly difficult. With the open source hosting of R3, we may see someone attack the problem, but it's not high on REBOL Technologies priority list.

For instance
REBOL:
add 1 2
causes REBOL to make, load and detect that the global ADD needs two arguments. So REBOL changes from left to right scanning to right to left. The arguments need to be established before the ADD can be evaluated. 1 and 2 are pretty obvious as integer!, get stacked and ADD is called. Even "global" is a misnomer. It is the default REBOL system context, not really the global context.

I'll post more, but I'm being pestered to play with the little one and her mom is finally getting a chance to take a nap. More soon.

Cheers.

Author:  rizzix [ Sat May 10, 2008 5:24 pm ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

Well I don't know the language, but from your description it doesn't seem too bad -- to create a compiler i.e. It has a very simple syntax, but has a whole lot of ridiculous semantics.

Author:  btiffin [ Sat May 10, 2008 8:27 pm ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

wtd @ Sat May 10, 2008 11:20 am wrote:
I've tried to grok this language before, but I have to say, the lack of syntax really throws me off, and it doesn't even have Lisp's nice parentheses to indicate precendence.


Ahh, but it does. REBOL is based on series! Series of values. String! being series of char! binary! being series of bytes, but in the main it comes down to block! Blocks are series of values, any loadable values, and are surrounded by brackets.
REBOL:
[this is a block of words]
{what follows is a block of number! data, but in this string I can put anything including what REBOL would see as unloadable info such as $100,23,23,23.12xwe}
[1 2 3 $10 3.1415927]

I highlighted loadable as REBOL's lexical scanner won't load $10,23,1. That is invalid money! and the loader will throw a syntax error. Nothing stops "$10,12,1" as a string!, but it can't be in a block! as a REBOL value. Anyway slowly getting to the point. Along with block! is paren! A paren! is an immediate block, that is surrounded by parentheses.
code:
>> 10 * 3 + 2
== 32
>> 10 * (3 + 2)
== 50
>> 3 + 2 * 10
== 50
>> 3 + (2 * 10)
== 23
conceptually paren! allows programmer control over precedence, but it does so by immediately evaluating the code before resuming the regular make, load, do sequence. Not by complicating the lexical scanner in any C sense of the LEX/YACC BISON meaning that we are all used to, but simply by invoking the evaluator.

A biggy in REBOL is that block! information is not evaluated until told to. In the above example, I could have used [1 2 3 $10 pi] but the pi is just a word in the block.
code:
>> probe [1 2 3 $10 pi (10 + 2)]
[1 2 3 $10.00 pi (10 + 2)]
== [1 2 3 $10.00 pi (10 + 2)]

Note how the $10 was converted, that was by the make/load, not the evaluator and is part of the REBOL loadable datatype rules. The literal word pi was not, nor was the paren! expression - it is still in a block, waiting for a programmer to decide if it is code or data.
code:
>> probe reduce [1 2 3 $10 pi (10 + 2) [pi]]
[1 2 3 $10.00 3.14159265358979 12 [pi]]
== [1 2 3 $10.00 3.14159265358979 12 [pi]]

I forced the block evaluation with reduce, and the first pi is a defined word in the REBOL system context, so it gets reduced to it's value. The pi in the inner block is still data waiting for someone to tell it what's what in terms of the code is data and data is code concept, even with the first level of reduction going on.

block! and brackets is also the way of coding in control flow.
REBOL:
if 3 > b [print "b is less-equal to 3"]


Anyway, I could talk about REBOL for days and days and days; I love it. But I'll stop now.

Cheers

Author:  btiffin [ Sat May 10, 2008 8:38 pm ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

I reread my first post ... I was rushing to go play. An "open mind" was a poor choice of words. Everyone here on compsci.ca (that I've bumped into so far) is open minded. What I really meant was "free your mind of what has come before" Smile REBOL is different. That difference is what allows it the power in a small package but can also rub the wrong way in those areas where smart people have experience and know how.

wtd; you may be at more of a disadvantage for this, as your expertise and deep understanding with other languages can get in the way. That can be hard to get round when exposed to REBOL. I was fairly lucky, as my years of experience and bias was Forth, and Forth to REBOL isn't as much of a stretch as deep C/C++ to REBOL. (Umm, not that I really know, having never lived in your shoes ... hope you know what I mean).

Apologies for anyone that read that "open mind" comment more literally than what I meant while I was rushing and excited to talk REBOL. Smile

Cheers

Author:  btiffin [ Sat May 10, 2008 8:56 pm ]
Post subject:  Re: RE:Why I find Rebol virtually incomprehensible

rizzix @ Sat May 10, 2008 5:24 pm wrote:
Well I don't know the language, but from your description it doesn't seem too bad -- to create a compiler i.e. It has a very simple syntax, but has a whole lot of ridiculous semantics.

Ahh, but those ridiculous semantics are necessary for REBOL to be what it is. Smile There are issues with REBOL, sure, but once you come to grips and terms with the problems, a vast ocean of potential opens up. And some of the few people that I converse with that actually "get" REBOL don't even call it a language. It's a system to them. I hope to get there someday. Google Gregg Irwin for some good insights by one of my heroes.

I know a lot of people don't really care that much anymore, but REBOL/Core comes in a 160K executable. REBOL/View is just 600K and REBOL/Command (the commercial edition with all the ODBC and other professional layers) is only 700K.

Sorry, once again, I could spew for days and days. Love REBOL.

By the way, most of our work occurs in a REBOL application called Altme (Alternate messaging). Our main world is by invitation only, keeping a very high SNR so most of the REBOL buzz is hidden and doesn't show up on the Public web. Anyone that is interested, I can get you in. Smile

Cheers

Author:  henrikmk [ Sun May 11, 2008 2:41 am ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

Hi, Brian. Smile

I'll talk about REBOL in the practical ways that makes me love this language and why I code REBOL applications and tools full time:

- Dialects. Different language domains that you define to generate code or build an easy API for a database query language. I have an HTML dialect, an installer dialect, DB query dialect, various code builder dialects, dialects that are layered on top of other dialects...
- It pays off to build exactly the tools you need, rather than searching for tools that almost do what you need. It's that fast to code in. It never makes sense, when you first hear about it, I know.
- More often than not, you don't build a tool in REBOL "because you can", but "because it makes sense".
- Development time of many apps are less than a day. Some are less than a week.
- Due to the speed of development, REBOL is excelllent for prototyping.
- I built my development pipeline from after the editor (I use TextMate for editing) through script processing, through deployment and right to the final installed application including the installer itself entirely in REBOL.
- Code size is small. My installer system is 4707 bytes including code header, comments and proper syntax. Each install script is about 1 k.

I can tell you a lot of absurdly strange stories about how people react to the language once they see the result of some work I helped them with, ranging from "it's fake" to "that's a nice mockup.... wait..." to "are we already done?".

Side effects of small code sizes:

- Code is easy to maintain.
- Very high number of cases where you write code that works correctly the first time you run it.
- Download a program that is smaller than a standard webpage like this one. You can serve scripts like normal HTML pages and run them directly in the REBOL console without extra plugins. Imagine how fast a 25 kb script starts from the web.
- No need for complicated IDEs that "help" you maintain the code or "help" you write correct code. Notepad or the built-in editor is enough.
- Less typing! Smile

OK, so the bad things about REBOL:

- Few people are using it, perhaps because it's so different and nobody got fired for using Java or C#.
- Some things are badly designed, like the port system which makes certain file and network operations very slow.
- Single threaded.
- GUI system is very sparse although it's functional.
- Sound is very simple.
- The entire app is closed so if you want bugfixes, be prepared to wait months or years for them.
- No real debugger facilities. It can be argued whether you need them when writing small scripts, but for larger apps, it would be nice to have.
- Some parts are poorly documented, since documentation is closed.
- Some features like DLL access are Pro only, which means you need to pay for them.

But, every point above, (except the first one) are going to be fixed in the next version under development now.

REBOL 3:

- Encapsulation in other apps in other languages, as it can be delivered as a DLL file.
- Direct hardware access through a new open device model.
- 8 years of accumulation of design flaws in REBOL 2 are fixed.
- Every part is open, except the very core. More developers are working on it now.
- Many more built-in dialects.
- Highly advanced and complete GUI system. More artist friendly to write skins to.
- Modules for better separation of code for large projects and for better security.
- Virtual assembly sublanguage called Rebcode.
- Documentation wiki that is growing fast.
- Mediatypes (if you know AmigaOS datatypes, same thing)
- Unicode support everywhere.
- General speed increases everywhere.
- Even smaller code size due to rethinking every single function in the language and adding new functions. Some things that require 10 lines of code in REBOL 2 can be done in 1 line in REBOL 3.
- No Pro version. All free as in beer.

Author:  btiffin [ Sun May 11, 2008 12:06 pm ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

Henrik; Welcome to compsci. This is the board that gave me the idea to restart the Forum chat last month. Smile The ops and mods here do an awesome job.

Everyone else; Henrik is one of the REBOL superstars. He'll probably blush reading that, as rebols are a mild folk in the main with not a whole lot of arrogance in the community. I mentioned that we should maybe start up an Agile project to develop a Forum package and while we discussed it, Henrik had an early implementation ready and coded up in a few days. Now I've gotta do my part and try and document what has gone on so far. I hope his list of pros and cons will urge a few of the august members of this board to give REBOL a first or second look. http://www.rebol.com As you can see, those that like it, love it.

Cheers

Author:  Clayton [ Sun May 11, 2008 12:38 pm ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

I have given REBOL a look at, but I have very similar gripes to wtd. The way my mind works (and this is very personal), I need to be able to look at something and know logically what is going on. The lack of any sort of way to show precedence in any REBOL code that I have seen is very hard for me to swallow. Let's take this example from here

code:
REBOL [
    Title: "Digital Clock"
    Version: 1.3.3
    Author: "Carl Sassenrath"
    Purpose: {A simple digital clock.}
]

f: layout [
    origin 0
    b: banner 140x32 rate 1
        effect [gradient 0x1 0.0.150 0.0.50]
        feel [engage: func [f a e]
                        [set-face b now/time]]
]

resize: does [
    b/size: max 20x20 min 1000x200 f/size
    b/font/size: max 24 f/size/y - 40
    b/text: "Resize Me"
    b/size/x: 1024 ; for size-text
    b/size/x: 20 + first size-text b
    f/size: b/size
    show f
]

view/options/new f 'resize
resize
insert-event-func [
    if event/type = 'resize [resize]
    event
]
do-events


Things like this:

code:
b: banner 140x32 rate 1
Are what throw me off. The fact that I have no idea what is an argument, and what is a function on it's own makes me reluctant to continue with REBOL.

My $0.02

Author:  btiffin [ Sun May 11, 2008 2:47 pm ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

Smile Ahh, but you taken those first steps. For an article I wrote when I was just getting into it, wide-eyed and amazed (umm, still)

http://www.rebol.org/cgi-bin/cgiwrap/rebol/art-display-article.r?article=lf019t

But, just a short explanation.

b: is a set-word! (think variable assignment)
banner is a VID dialect word that creates a graphical face (widget) for what REBOL calls a style, in this case a banner
the 140x32 is a REBOL pair! datatype that the Visual Interface Dialect uses to size (x by y) a face
and the rate 1 is another VID dialect sequence that sets a timer to fire every 1 second. The handler of that timer is in the face feel (widget action handler) with
VID:
feel [engage: func [f a e]
                        [set-face b now/time]]


That engage function will be called once a second.

It really is the power of REBOL, The Relative Expression part. Any word can be a powerful function, a piece of data etc. Those pieces of data can be part of a powerful dialect or perhaps simply an integer!.

But it does mean
code:
>> a b c


a little hard to quick grok without the context of what has gone before. Is a a function? b an integer! and c just plain old literal c? Depends. But that power is awesome and reading REBOL does become fairly easy after a few goes. Not one perhaps, maybe three. And in the main, a REBOL program is a few pages at most. So groking an entire app is nothing compared to weeding through pages and pages of C/C++ with separate headers and buried libraries. Plus REBOL has console HELP for literate programming and a SOURCE function for source code listings of everything. Smile

Cheers

And sorry, if I seem pushy. REBOL is too cool and I get excited.

Cheers

Author:  wtd [ Sun May 11, 2008 2:58 pm ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

I am currently finding this the gentlest introduction.

A small note, btiffin: showing how to do really high-level stuff in just a few lines is a great way to get people to take note of your favorite programming language. However if you intend to really get people interested you have to help them get to the point where they can write code in it themselves.

That means that not only should the size of the code be small, but the concepts each sample explores must be suitably small, and easy to understand. Perhaps especially they must be linked in some way to concepts from other languages that the programmers in question already understand.

Find a common ground, then show how Rebol can improve upon that.

Author:  btiffin [ Sun May 11, 2008 5:22 pm ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

Thanks wtd, that's good advice. I really would like to be a "good" REBOL evangelist. But I perhaps flail and froth at the mouth a little too much when I get excited about it. Smile

You've given me a few ideas on the next batch of tutorials. Being in the field for so long, I sometimes forget the days when I could not tie my computer shoe laces. Try forgetting how to tie your shoelaces. It's hard. Smile But, teaching someone how to tie shoelaces is an important step.

I'll try writing up a few smaller docs, focused on a single concept and comparing those to other more mainstream languages. Then expand into the higher levels.

Then hopefully, I'll teach myself how to more effectively demonstrate REBOL to those that are already pros in the field (or have at least moved beyond shoe laces and are now tying Bowlines and Shroud knots in their sleep) like many of the members here.

More soon.

Cheers

Author:  wtd [ Sun May 11, 2008 8:23 pm ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

btiffin @ Mon May 12, 2008 3:47 am wrote:
So groking an entire app is nothing compared to weeding through pages and pages of C/C++ with separate headers and buried libraries. Plus REBOL has console HELP for literate programming and a SOURCE function for source code listings of everything. Smile


Keep in mind that at least in this community you're not pitching Rebol to a bunch of people who think C and C++ are the end-all and be-all of programming. You're talking to people who know languages that allow for short code that does a lot, and who have used interactive run-time environments with lots of helpful tools. We've developed a taste for both dynamically and statically-typed functional programming.

And we still find reasons to balk at Rebol. You may find yourself in for quite a challenge.

Author:  btiffin [ Sun May 11, 2008 11:35 pm ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

wtd wrote:
And we still find reasons to balk at Rebol. You may find yourself in for quite a challenge.

Hope you don't mind, but I'm going to keep trying. Smile I do take it as a challenge; both in attempting to convince coders that I've grown to respect of REBOL's merits, and, to teach myself proper ways of evangelizing my language of choice.

As you may have noticed in your Beeper exercise, I enjoy programming in just about any language, but remain convinced that REBOL, in the main and excluding systems level, is the most productive general purpose environment available, with a dash of fun thrown in for good measure.

Cheers

Author:  btiffin [ Mon May 12, 2008 12:08 am ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

Another of my heroes from the REBOL community pointed out this REBOL in 10 steps introduction.

Cheers

Author:  wtd [ Mon May 12, 2008 12:39 am ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

btiffin @ Mon May 12, 2008 12:35 pm wrote:
wtd wrote:
And we still find reasons to balk at Rebol. You may find yourself in for quite a challenge.

Hope you don't mind, but I'm going to keep trying.
[/quote]

Feel free. I did not mean to discourage you.

Author:  btiffin [ Mon May 12, 2008 1:25 am ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

wtd @ Mon May 12, 2008 12:39 am wrote:
btiffin @ Mon May 12, 2008 12:35 pm wrote:
wtd wrote:
And we still find reasons to balk at Rebol. You may find yourself in for quite a challenge.

Hope you don't mind, but I'm going to keep trying.

Feel free. I did not mean to discourage you.
Nope, that won't happen. I'm too dense to be discouraged. Smile When it comes to REBOL at least. Your comments are only making me think a little deeper and a little harder on where REBOL stands in the grand scheme.

If you can put any faith in the TIOBE index, REBOL is somewhere below the top 50 and above 100. The last entry they show is 0.07% percent of the market. That leads me to extrapolate that REBOL is used by less than 1 in 10,000 programmers. Potentially far less. So rebols could double tomorrow and still only be 2 in 10,000. Lots and lots of wiggle room.

And whoa! I just looked at the May index, C++ swapped (down) with Visual Basic. Hmmm. And Pascal shot up nicely. But the headline is PowerShell approaching top 20? It's listed at 36th. Hmmm. Aprils headline was LUA hype is over. And now its up in the top 20 again. Me thinks there is some voodoo in their calculations, and bias in the headlines. Smile

http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html for those I just made curious, but I always just google "tiobe index" to find the page.

Cheers.

Author:  rizzix [ Mon May 12, 2008 1:36 am ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

Wow, that Pascal is crazy.

Author:  r691175002 [ Mon May 12, 2008 1:54 am ]
Post subject:  Re: Why I find Rebol virtually incomprehensible

I haven't used many non standard languages (I generally stick with Java, C++ and a variety of scripting languages and such) and I find that most programming languages are similar enough in general structure that if you know one, you can decipher most others with a 5 minute syntax tutorial and some form of API reference. Rebol just proved me wrong.

Author:  PaulButler [ Mon May 12, 2008 9:41 pm ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

I think REBOL looks interesting. I have been learning Factor, which has somewhat similar syntax (but completely different semantics, from the looks of it), so it's not the syntax that puts me off.

For me, it's the closed nature of it. Learning a new language well takes a fair investment of time, and I would rather not have to rely on a single company to ensure that my investment didn't become irrelevant.

Author:  gregg.irwin [ Mon May 12, 2008 10:14 pm ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

I'm a (biased) REBOL guy. Here are some thoughts based on my experience. Not to "convince" anyone, just to share.

REBOL tricked me initially, in that I thought it worked like most other languages. It took me a while to see how wrong I was, because there is a nice facade to make you comfortable if you've programmed before. What you like, or don't, about it probably applies to other languages as well. e.g., the lack of syntax.

It helped me to think in terms of Logo and Forth, but I also didn't get the whole free ranging evaluation thing for quite a while. and I was initially very put off by the lack of normal math op precedence. Then I went through the "code is data, data is code" phase, and that got me a little further along. After a much longer time, I got that there is no code, there is only data...and sometimes that data is evaluated in a particular context. That was a big step forward for me.

I came to REBOL from VB, having always been a BASIC hound. I've used, and tinkered with, a lot of languages, using those that click well in my head, and most don't. I'm not a CompSci, FP kinda guy, being partial to simple, human-friendly languages and one-based sequences.

Things that attracted me originally were the built-in GUI system, the wide array of data types, the small size, and the fact that you can create standalone EXEs with virtually no dependencies. Later I found the PARSE function. After that, there was no turning back. Smile

I've also found enormous value in having my data format be the same as my programming language. That may be one of the best, and least marketed, things about REBOL. When people want to compare it to other languages, I offer up that they need to compare it to lanugage-Z + XML, because of REBOL's role as a data format.

REBOL has holes--much more in the tool and interop areas than in the design of the language itself--but so does everything else. I can do what I need 98.5% of the time with REBOL, and that's important to me. I prefer to specialize, rather than use a multitude of tools for different aspects of an app.

It's certainly not for everyone, but I'll be one very sad guy if I ever have to stop using it.

Author:  gregg.irwin [ Mon May 12, 2008 10:28 pm ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

As far as learning REBOL, I encourage people to play around in the console, using HELP and SOURCE, and experimenting with all the data types. If you've only ever had 6 or 8 to choose from, it's really fun to see that it recognizes URLs, email addresses, tags, money, pairs, tuples (as in IP addresses or colors), dates, times, etc. And it's important to know how they work. If you just make everything strings, you're wasting most of REBOL's power.

Two things are very important to get comfortable with: 1) the four basic word types, and 2) blocks.

For folks like those here, i.e., advanced thinkers, once you have a handle on those concepts, then play around with controlling evaluation. And when you start feeling cocky, play with controlling evaluation when calling functions.

For less advanced users, I suggest building some *simple* GUIs, to get a feel for the LAYOUT dialect. And use CONTEXT to create objects to group and structure things. For those coming from other languages, it's important to keep in mind that REBOL's object model is prototype based, not class based. REBOL is much more about messaging and dialects than it is about objects.

Happy REBOLing!

Author:  wtd [ Mon May 12, 2008 11:48 pm ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

A suggestion to the Rebol folks posting here: take a look at the Io programming language. I think you may like what you find.

Author:  syntax_error [ Tue May 13, 2008 12:03 am ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

I just briefly looked at the Io syntax, and its very clean, much more easier to follow then REBOL, but then again, I am still in grade 10, not much exposure to other language semantics, just my 2 cents.

Author:  gregg.irwin [ Tue May 13, 2008 1:09 am ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

Io does have a lot going for it. I looked at it a few years ago. I also like elements of E and Erlang quite a lot.

I use REBOL for production work, including deployable desktop apps with GUIs, and embeddability isn't important to me, so I didn't spend too much time with it. I didn't think I'd be able to use it for real.

I'll give it another look. Thanks for the reminder.

Author:  wtd [ Tue May 13, 2008 1:15 am ]
Post subject:  RE:Why I find Rebol virtually incomprehensible

Highly dynamic, small number of unifying concepts, minimal syntax, small performant implementation... it seems like a good fit to me.


: