After working with both languages a great deal, I’ve come to the realization that JavaScript is the language in common use that’s most akin to REBOL. There’s still a very wide gulf, but there are enough similarities to make it worth a mention. (Not much more than a mention, though.)
At first glance, JavaScript and REBOL don’t look much alike, even when the code is doing the same thing.
// JavaScript function foo(s) { return s + 'foo'; }
; REBOL foo: func [s [string!]] [ rejoin [s "foo"] ]
We can start to make them look a little more similar if we put the JavaScript inside an object literal and the REBOL inside a block. We’ll also omit the type specifier from the REBOL function, since JavaScript has no equivalent.
{ foo: function(s) { return s + 'foo'; } }
[ foo: func [s] [ rejoin [s "foo"] ] ]
(I should point out that a block and an object literal are not equivalent, but their capabilities overlap a little bit. REBOL’s blocks are much more powerful.)
And that’s about as far as we can go with that. Anyway, it’s not lexical similarity that concerns me here, but functional similarity. For instance, both languages are scripting languages in the sense that they are not (usually) compiled. No big deal there. That’s true of a long list of languages.
However, both languages are prototype languages, and that’s certainly not true of a lot of languages.
function Foo() { this.watusi = 3; } function Bar() { this.watusi = 4; } Bar.prototype = Foo;
In REBOL, it’s similar, although in my opinion slightly more elegant, even if its syntax looks a bit strange to the curly bracers.
foo: make object! [watusi: 3] bar: make foo [watusi: 4]
The serialized form of both languages is the language itself. In JavaScript, the JSON format is often used as a way to communicate between client and server. A very similar thing can be done with REBOL, although it has no specific name. (There really isn’t any need to have a special name or notation in REBOL. It’s just REBOL. In fact, being used for messaging is one of the fundamental things REBOL was designed to do.)
{ // JavaScript object literal orderno: 37, items: [22, 873, 14] // A list of order item numbers }
What you see above is exactly what the server would transmit. We’d use it in JavaScript by assigning it to a variable.
var order = getOrder(); // getOrder() returns the object literal specified above alert(order.orderno);
Here’s one REBOL equivalent (of a great many). Here’s what we’d transmit:
orderno: 37 items: [22 873 14]
And here’s how we might use it:
order: get-order print order/orderno
The reason I didn’t place the REBOL “object literal” inside a block is because it isn’t necessary. When the string is read from the server, the LOAD function will automatically place it inside a block. GET-ORDER would be implemented something like this:
get-order: does [ make object! load http://localhost:999/foo ]
In this particular case I tried to make the REBOL look as close to the JavaScript as I could to emphasize their similarities. I would probably implement the above very differently in REBOL under ordinary circumstances, although there’s nothing wrong with how it was done here. Because REBOL has DSLs and the evaluation of blocks is deferred (unlike JavaScript’s object literals), we have quite a few more options.
Another similarity is that both languages allow functions to be passed as arguments.
function callF(f) { f(); } callF(function(){ alert('called!'); });
call-f: func [f [any-function!]] [ f ] call-f does [print "called!"]
Both languages are amazingly nimble, although in a flexibility contest REBOL would win easily. It can do everything JavaScript can do and then some. Everything except manipulate the DOM, that is.
Some REBOLers comment here:
ReplyDeletehttp://www.rebol.org/aga-display-posts.r?post=r3wp424x4064
Wow amazing article, I have added your blog to my rebol's blog:
ReplyDeletehttp://reboltutorial.com/rebol-network/
It's a beginner's blog for beginners :)
"However, both languages are prototype languages, and that’s certainly not true of a lot of languages."
ReplyDeleteLua is a lot like JavaScript.
Yes, Lua is an interesting language. I like it. But it's still true that not very many languages are prototype languages.
ReplyDeletebut what good is this rebol thing ? its not like they can take a generic JW Player
ReplyDeletehttp://www.longtailvideo.com/support/jw-player-setup-wizard?example=247
and HD stream and control that H.264 video content like the JavaScript generating page can from their rebol web one liners or even their pro web server things.
and even IF they could somehow cobble something together to wrap around the stream H.264 jw-player , it seems the few rebol dev's capable have ZERO Interest in anything remotely graphical or video streaming related judging by the Total lack of any example video scripting apps.
how many years have they been around ? and not one simple fully working streaming video plug-in or stand alone example to be found, were as every one and his dog knows you want Food embedded HD video on your site, use jw-player and JavaScript.
didn't their rebol leader and his mate Dave something or other once make the worlds best home video hardware and software OS or something,shame their users cant even bother to write a few working video apps like every one else on the net seems to want to use....
i guess from the masses of reply's then, that rebol's just a page filler for some extra cash, and everyone just continues to use JavaScript to make their real cash ;)
ReplyDeleteI think you've missed the point, Mr. Anonymous. I'm not comparing REBOL and JavaScript in terms of their market success or employment potential. I'm comparing them syntactically, purely for language enthusiasts. Believe it or not, there are people who like programming languages merely because they are interesting in some way.
ReplyDeleteSo this isn't about "cash". I know a number of languages with which I can and do make plenty of money: C#, JavaScript, Objective-C, and so on. While I hope that I can one day make money with REBOL, it will never be as a client-side browser scripting language. I like REBOL because I find its syntax interesting. That's it.
oh well that's fine then, in that context yes it seems interesting.
ReplyDeletei thought id go and actually look at what scripts are available as it was today.
its shame most/many example scripts fail in some nasty way when you open rebol view (any version available) shell window and
do http:// a direct url to most of the scripts found here though
http://www.rebol.org/st-topic-details.r?tag=//ui
i would have thought someone that cared would have fixed that basic problem at some point.
do http://www.rebol.org/view-script.r?script=area-scroll-style.r
as just one example, it doest look good when simple example scripts fail, or worse crash the rebol view script interpreter.
p.s i do like your work, and don't mean to offend if i did.
i came across this while trying to find a simple connect and annonimous chat IRC channel were rebol people might hang out.
ReplyDeleteits odd but there isn't one, and you need to register for all the chat options i could find, very odd, but no matter.
http://github.com/jankom/RebToStatic
an alpha/beta Compiler from Rebol to JavaScript. — Read more
some readers might be interested in it here i assume.
fake rolex watches
ReplyDeletemichael kors handbags
christian louboutin
pandora uk
michael kors outlet online
adidas
pandora charms sale clearance
adidas superstar trainers
nfl jerseys cheap
coach outlet online
xushengda0323
: COMPLETELY RENEWED!Party App gives you the complete dutch Party agenda on your iOS device. downloadthefilefast.date From Tag Games: At the end of a hard week have you ever wanted to just let loose and smash some stuff up.
ReplyDeletePlease note:Paying via InApp-Purchase for the full version is a one-time payment. Visit my site IF YOU LOVE THIS GAME AND WANT TO SEE MORE PLEASE RATE US.
ReplyDeleteSet the drumming timer for up to infinity and listen in meditation or while performing everyday tasks. download pdf - If you plan to take a taxi and need to figure out how much the price is, we have this function included as well.
ReplyDeleteReceive high street discounts for regular trackingAWESOME PHOTO COMPARISON TOOLS:- Try on your before photo for size. download software It's easy to view a video in one page while reading an article in the other.
ReplyDeleteThis is really great work. DO My C programming Homework Thank you for sharing such a useful information here in the blog.
ReplyDeleteReally i appreciate the effort you made to share the knowledge. This is really a great stuff for sharing. Keep it up. write my essay for me Thanks for sharing.
ReplyDeleteOddly enough, the sidebar didn't get the same treatment as the rest of the browser. download videos The search result would give information about their address, phone no, rating and URL (if one has).
ReplyDeleteEnabled the ability to delete messages, items on your watchlist or offers. downlodable ebooks At first the police -- and even the women -- refuse to take the threats seriously.
ReplyDeleteIn addition, the current LIFEmee website can be used simultaneously with the new iphone application. shotokan karate syllabus pdf What's more, C#--the language designed from the ground up for programming the Microsoft .
ReplyDeletecavaliers jerseys
ReplyDeletecheap oakley sunglasses
harden shoes
bottes ugg
adidas superstar shoes
uggs outlet
cheap jordan shoes
coach factory outlet online
ray ban sunglasses outlet
ugg boots
mt0816
It seems simple but some of the combos are harder than you might think. download torrent As the most notable commander, you have to face them.
ReplyDeleteAesops classic bedtime fable, The Ant and the Grasshopper, teaches kids important lessons of hard work paying off. downloadgoodfilesonline.top After completing each level, feed your hungry frog as many flies as you can in 30 seconds.
ReplyDeleteThe longer you drag, the further the tongue will stick out. Visit my site Written with the latest, most advance programming languages and techniques, including Microsoft .
ReplyDeleteNo unreadable text, no endless scrolling on a tiny screen. downloadfastplease.xyz Selected as one of Travel and Leisures "Best Travel Apps" of 2010.
ReplyDeleteHigher percentages will unlock silver and gold achievements. http://gooddownloadtorrenttoday.us Section Bookmarks: You can save 12 sections of your choice; like skipping the bridge passages or setting the section that you want to learn.
ReplyDeleteFrom Tarequl Hasan: 80s Music Radio Recorder offers the best 80s music available in the world. downloadfromthisblog.gdn Dozens of different enemies and objects to interact with.
ReplyDeleteMovement: Will only continue execution when the device is tilted or accelerated in any direction. topdownloadwarezcatalog.us 2 - Added zombie mode - Removed drunken man - Reduced Lite version&'s limit.
ReplyDeleteThe Godking's successful coup has left Kylar's master, Durzo, and his best friend, Logan, dead. downloadtorrentfromnora.online Le club investit le Stade Yves du Manoir, le stade Sabath tire sa rvrence la premire, mais continuera daccueillir les autres quipes du MHR.
ReplyDeletePull in people for work or play as and when you need them. http://topdownloadfilesdatabase.us It provides children with the possibility to express their ideas and feelings.
ReplyDeleteThanks to this information wonderful
ReplyDeleteشركة مكافحة حشرات بخميس مشيط
شركة مكافحة حشرات ببريدة
شركة مكافحة حشرات بالقصيم
شركة مكافحة حشرات بأبها
شركة مكافحة حشرات بجازان
شركة مكافحة حشرات بنجران
youtube.com
ReplyDeleteiphone
Philips
servis
service
service
www.ninonurmadi.com
Panasonic
ninonurmadi.com
We find lots of learning after reading this very useful article .
ReplyDeletejust information we only provide information for those who need it. tree service
ReplyDeleteشركة مكافحة حمام بالرياض
ReplyDeleteتركيب شبك حمام بالرياض
مكافحة الحمام والطيور بالرياض
شركة تركيب طارد حمام بالرياض
شركة مكافحة حمام بالرياض
ReplyDeleteتركيب شبك حمام بالرياض
مكافحة الحمام والطيور بالرياض
شركة تركيب طارد حمام بالرياض
20 public general, science and technology university is published the guccho university admission result
ReplyDeleteonline on gstadmission.ac.bd. Students will need ssc and hsc roll number, board, passing year information to check the result.
National University Honours 4th Year Result 2021 has Been Published very soon. As a NU 4th Year Student, You Might be Search For NU Honours 4th Year Result their official website & our website available it.
ReplyDeleteDSHE is published the All Subject Class 10 Assignment Answer 2022 for all week on assignment.examresulthub.com.
ReplyDeleteWant to check the all assignment work and answer, make sure to follow the below subjectwise links:
DSHE is published the SSC Assignment Answer 2021 for Class 10 for three weeks. lets check the assignment work with answer.
Thanks for sharing the article.
ReplyDelete.
ReplyDeleteكنبة الوضعيات
كرسي مكتب مريح
كنبة المتزوجين
ساعات رجاليه
نظارات شمسية رجالي
سبرديلة للبنات
كرسي اطفال سيارة
كرسي استرخاء رخيص
كرسي مساج كهربائي
Jackpot City choegomachine.com accepts all major bank cards, properly as|in addition to} e-Wallets like Skrill and Neteller. Payouts are quick by trade requirements, whereas each transaction use 128-bit SSL encryption know-how. There’s no better way to improve your bankroll than utilizing a bonus at an online on line casino.
ReplyDeleteIn case the purpose complete of the first two playing cards is the same as} eight or 9, the Player who hits this score is the one who 1xbet wins the hand. Once the vendor locations two playing cards on every half of} the desk, it’s time to calculate the points and determine the value of every hand. If a hand exceeds 10, 10 is then subtracted from the hand. Neither the Dealer nor the participant determine if a third card is drawn.
ReplyDeletecarbontvpbr is the go-to destination for PBR fans who seek an unmatched and comprehensive viewing experience. With its thrilling collection of videos, highlights, documentaries, and series, Carbon TV offers an all-encompassing platform that encapsulates the thrilling world of bull riding. Whether you're a devoted follower of PBR or a curious newcomer, Carbon TV guarantees an exhilarating and captivating journey into the world of Professional Bull Riding.
ReplyDeleteLooks like a pretty cool place to visit.
ReplyDeletesuch a good work
ReplyDelete