Posted: 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.
Sponsor Sponsor
rizzix
Posted: 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.
btiffin
Posted: Sat May 10, 2008 5:13 pm Post subject: Re: Why I find Rebol virtually incomprehensible
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.
rizzix
Posted: 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.
btiffin
Posted: 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.
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.
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
btiffin
Posted: 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" 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.
Cheers
btiffin
Posted: 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. 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.
Cheers
henrikmk
Posted: Sun May 11, 2008 2:41 am Post subject: RE:Why I find Rebol virtually incomprehensible
Hi, Brian.
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!
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.
Sponsor Sponsor
btiffin
Posted: 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. 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
Clayton
Posted: 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
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
btiffin
Posted: Sun May 11, 2008 2:47 pm Post subject: Re: Why I find Rebol virtually incomprehensible
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)
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.
Cheers
And sorry, if I seem pushy. REBOL is too cool and I get excited.
Cheers
wtd
Posted: 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.
btiffin
Posted: 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.
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. 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
wtd
Posted: 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.
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.
btiffin
Posted: 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. 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.