Tuesday, March 24, 2009

Is Reia an object oriented language Joe Armstrong could actually like?

Short answer: no! Long answer: he might hate it less than the others.

Erlang creator Joe Armstrong is no fan of OOP. He says it sucks! Oof! As someone who is building an object oriented language on a platform pioneered by Joe, I feel I'm at least obligated to respond to his concerns. Due to its strong Erlang influences Reia's object system ends up working a lot different than most other OOP languages so in some ways this does address some of his concerns.

Let's look at them:

Objection 1: Data structure and functions should not be bound together

So first, a confession: Reia's "builtin" types (which I'll get to later) are guilty of this. So -1 on my Joe score.

However, Reia's objects are more than just data structures. This is certainly a complaint about OOP which holds for most languages: "object" is really a fancy word for "a big chunk of state" and sending an object a "message" is really some more high falloting verbeage for "making a function call". In this regard OOP ends up seeming pretty imperative: it's just a big fancy facade for calling functions which probe and mutate state.

Similar concerns were noted by Clojure author Rich Hickey in his article On State and Identity. He notes that in most languages objects don't have real identities beyond their state and that OOP at its core is very much an imperative affair.

In Reia, all objects are Erlang processes and operate concurrently. Each object has a life of it's own... it's not just some lifeless chunk of data sitting somewhere in RAM, completely at the mercy of whatever modifications some random thread may throw at it.

Calling a method is more than just a function call. It uses messages... not goofy metaphorical messages but real, first-class messages. Presently Reia's objects are built on gen_server, so invoking a method on an object performs an RPC on the remote object.

Self-ascribed OOP creator Alan Kay is practically obsessed with messages. He once wrote: "I thought of objects being like biological cells and/or individual computers on a network, only able to communicate with messages (so messaging came at the very beginning -- it took a while to see how to do messaging in a programming language efficiently enough to be useful)." What he began with messages in Smalltalk would eventually be boiled down to function calls in most successor OOP languages (with C++ being perhaps the most infamous example).

Reia does not follow in this tradition, but maintains a very message-centric view of OOP which is more akin to what Alan Kay originally had in mind. I've also read that Alan Kay has claimed that not making objects concurrent was one of his greatest mistakes, although I don't have a specific citation on that one (if someone knows please leave me a comment).

Erlang vis-a-vis the actor model and its outgrowth from Smalltalk certainly embodies similar concepts.

Objection 2: Everything has to be an object

Well, this is an easy one to answer: everything doesn't have to be an object! I'm sure any Rubyist readers are groaning on that one. Pretty much every language I see coming out of other Rubyists follows this paradigm. Reia doesn't.

Reia has three fundamental types of entities: builtins, processes, and objects. Objects can be thought of as a type of process, but all objects respond to a common base set of messages. Reia's objects can thus address a particular concern of Rich Hickey's about actor-based systems:
"You can't observe anything without its cooperation/coordination - making ad-hoc reporting or analysis impossible, instead forcing every actor to participate in each protocol."
Reia implements an inheritance system, which means that you can group the protocols that you want a given set of objects to respond to together into superclasses. All objects will, at the very minimum, respond to the set of methods defined in the Object superclass.

You can certainly do the same in Erlang by placing common functionality into a "superclass" module. Reia just gives it first-class syntax and does some of the thunking a bit more automatically.

Reia also provides processes, which are for all intents and purposes identical to Erlang processes. For some reason many OO purists have messaged me asking if this is necessary and suggesting I rip it out. Reia does provide asynchronous features as part of its object system... it has (or rather, will have) equivalents for gen_server:cast and gen_server:reply. Given this, they argue, who needs processes?

I think these people don't understand that gen_server is not a one-size-fits-all solution. Since I'm building a language on top of Erlang it would be silly not to expose the full power of its messaging system and try to force everything into gen_server-shaped boxes. Reia goes the opposite route and provides processes which are virtually identical to Erlang. Reia even has the same "!" syntax for sending messages, and it works on objects as well as processes.

Reia's builtin types are made out of plain old immutable Erlang terms. They are not objects themselves. With a little bit less "throw objects at the problem" they can serve to represent all kinds of things. My hope would be programmers use builtins more and objects less than they would in a typical OOP language.

Objection 3: In an OOPL data type definitions are spread out all over the place

Guilty as charged... take another point off my Joe score. Next!

Objection 4: Objects have private state

Also guilty. However, I hope Reia gets some bonus points in this regard for the way it implements its private state. Behind the scenes Reia's representation of "instance variables" is a pure functional one. The compiled form has the "instance variable" state (represented as a dict) enter a method (now a function) as an argument. The state is versioned throughout the compiled form, so wherever there is potential for change it's bound to a new label. When the method completes the final state is returned.

Because this state is represented in a pure functional form behind the scenes it means Reia retains some of the benefits it brings in Erlang. For example: private state is transactional, as the object's true state isn't actually updated until method dispatch has completed, in the same way a gen_server's state isn't updated until one of the handle callbacks has returned with the new state.

It also means the scope of private state is limited. Any cases I've encountered (such as lambdas) where I cannot implement state modifications in a simple, pure functional form I've avoided it. Lambdas are able to access the private state (which they close over at the time they're declared) but they are not allowed to modify it.

This approach has been more complex than alternatives like just giving the process dictionary a first class syntax. I could've done that. However, compiling to a pure functional form really helped me see the corner cases where the state was trying to creep into strange scopes. The current implementation has precise semantics about state flow and works in a way not too far distant from how an Erlang programmer would actually write it.

What's the point?

I think that question is pretty much the sentiment of Joe's article. Is OO actually useful? Given certain technical drawbacks (i.e. side effects) introduced by hidden state it becomes more difficult to make the same statements about a Reia object that you could about an Erlang gen_server (and destructive assignment doesn't help things). Is there actually some value objects bring to the table?

The merits of objects aren't technical, in my opinion. I think they're a good model for certain types of people to conceptualize problems. Lots of people really like them. Joe tried it and said it felt "wrong" but for many it does feel "right" in some way.

Fortunately, for the people who think it feels "wrong" there's this great language called Erlang you can use...

What does Joe Armstrong actually think about Reia?

I saw Joe Armstrong was asked about Reia in an Erlang Inside interview, here's what he had to say:
"I haven’t tried it - I don’t like mutable anything"
D'oh! Oh well. I'm afraid you won't be seeing a single-assignment Reia. I'll save that for another post, though.


phil pirj said...

How about Reia - any thoughts about this language? It has mutable variables, among other things…

JA: I haven’t tried it - I don’t like mutable anything


Ooops :)

phil pirj said...

While developing with Reia i felt i don't miss OOP at all.
Everything i did can be re-made with pure module syntax using Hash as data.

Jörg W Mittag said...

Since I was the one who made that Alan Kay claim in the first place, I should probably follow up on that … I think it might have been somewhere inside this talk from Intel Research Berkeley's Programming Systems Seminar Series, titled Could Computing be simpler than it seems to be? (The STEPS Project towards the Reinvention of Computing). It's basically a progress report about the STEPS project by Alan Kay himself (the project is partially sponsored by Intel, IIRC).

However, I'm not sure that this video is where I heard it. I'll keep looking.

Fabian said...

The more pertinent question is whether Louis Armstrong would like it.

Unknown said...

Hopefully I'll get around to hacking with Reia shortly. Erlang's vm is the dogs bollocks.

Shawn said...

Tony, since you brought up Rich Hickey's essay on state, do you have any thoughts on the effects of 2-message blocking reads and the serialization of reads and writes on same-process efficiency and protocol design?

Vijay Kandy said...
This comment has been removed by the author.
Vijay Kandy said...


"I've also read that Alan Kay has claimed that not making objects concurrent was one of his greatest mistakes, although I don't have a specific citation on that one (if someone knows please leave me a comment)."

According to Alan Kay, the key is messaging – not classes or objects. He regrets not implementing messaging in Smalltalk/Squeak as he intended. This is what he had to say about objects and messaging:

Smalltalk is not only NOT its syntax or the class
library, it is not even about classes. I'm sorry that I long ago coined the
term "objects" for this topic because it gets many people to focus on the
lesser idea.

The big idea is "messaging" -- that is what the kernal of Smalltalk/Squeak
is all about (and it's something that was never quite completed in our
Xerox PARC phase).

Read the complete email here:
Vijay Kandy

P.S: The previous comment had some HTML formatting problems so, I deleted it.

Unknown said...

Very good write-up. I definitely appreciate this website. Continue the good work!
Devops Online Training
Adobe cq5 Training
Dell Boomi Training

Unknown said...

Good and Interesting... thanks for sharing your views...

Java Training in chennai

nagendra said...

Hey, joe armstrong would like. MaxCure is one of best orthopedic hospitals in Hyderabad.

Unknown said...

Interesting one. Keep up good work.
At Queen's NRI Hospitals - Vishakapatnam Providing 360 degrees treatment for Heart Care .

Unknown said...

Good And Interesting. Thanks to the author. keep up good works.

Best Medicine for all types of Cancers

Curclear Syrup for Diabetes, Ulcers, Arthritis

Unknown said...

Good article. Interesting. We are here to help all who are suffering from cancer diseases with
Best Medicine for Cancers. Click on for Good Natural Remedy for Cancers.


Unknown said...

My rather long internet look up has at the end of the day been compensated with pleasant insight to talk about with my family and friends.

java training in bangalore

Prateek Barn said...

avriq India

Unknown said...

Hi, i think that i saw you visited my web site so i came to “return the favor”.I am attempting to find things to enhance my site!I suppose its ok to use some of your ideas!!Nice tips dear. Thanks for sharing it.. Orthopedic Hospital in Hyderabad

Unknown said...

This is a comprehensive and helpful list, about Health Care. Orthopedic Surgeon in Hyderabad

Unknown said...

Nice tips dear. Thanks for sharing it. I get lot's of beautiful tips clip in dental care Bariatric Surgery in Hyderabad

mariablack said...

Pc Optimization
Windows Installation
Data Recovery

rajatwebtrackker said...

Hello friends, my name is Rajat and I work as the head of digital marketing in Delhi. I am affiliated with many MNC’s Software developers. If you are talking about the best educational institution in Delhi,Webtrackker help me get the best educational institute in Delhi.we are you offering some best services in our institute.with 100% job offers are available .

Best Php Training Institute in Delhi
Php Training in delhi
php Training center in delhi

Best Java Training Institute in delhi
Best Java Training in delhi
java Training center in delhi

linux Training center in delhi
Best linux Training Institute in Delhi
linux Training in delhi

Web Designing Training center in delhi
Best Web Designing Training institute in delhi
Web Designing Training in delhi

Oracle Training Institute in delhi
Oracle Training in Delhi
Oracle Training center in Delhi

blue prism Training Institute in delhi
blue prism Training in Delhi
blue prism Training center in Delhi

Automation Anywhere Training center In delhi
Automation Anywhere Training Institute In delhi

rpa Training Institute in delhi
rpa Training in Delhi
rpa Training center in Delhi

hadoop Training center in delhi
Best hadoop Training institute in delhi
hadoop Training in delhi

Unknown said...

Looking forward to reading the plethora of articles that you've linked to here on Health Care. Best Heart Hospital in Hyderabad

shabnam praveen said...

Call girls in Kolkata
Call girls in Chandigarh
Call girls in Chandigarh
Call girls in Gurgaon
Call girls in Chandigarh
Call girls in Chandigarh

shabnam praveen said...

Call girls in Lucknow
Call girls in Guwahati
Call girls in Mumbai
Call girls in Jaipur
Call girls in Jaipur
Call girls in Jaipur
Call girls in Bangalore

Unknown said...

Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up. Orthopedic Surgeon in Hyderabad

arrowtricks said...

Pretty! This was a really wonderful post.

iOS Training in Bangalore
Java Training in Bangalore

Infocampus said...

thanks for sharing...

Java Training in Bangalore
Java Training in Bangalore
Java Training in Bangalore
Java Course in Bangalore
Java Training in Bangalore
Java Training in Bangalore
Java Training in Bangalore
Java Training in Bangalore
Java Training in Bangalore

Advanced java Training in Bangalore
Advanced java Courses in Bangalore
Advanced java Training Center in Bangalore
Advanced java Classes Bangalore
Best Advanced java Training in Bangalore
Best Advanced java Training in Marathahalli
Advanced java Institute in Marathahalli
Advanced java Courses in Bangalore Marathahalli

Shanthi Cabs said...

Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live. I have bookmarked more article from this website. Such a nice blog you are providing ! Kindly Visit Us @ Best Travels in Madurai | Tours and Travels in Madurai

siska said...

agen domino online

Unknown said...

Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work

DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.

Good to learn about DevOps at this time.

devops training in chennai | devops training in chennai with placement | devops training in chennai omr | devops training in velachery | devops training in chennai tambaram | devops institutes in chennai | devops certification in chennai

Ankit Varma said...

I really likes the way you articulate and express your point. Nice job java training in patna

Tally courses in patna

Infocampus said...

Hi, I do think this is a great site. I stumbledupon it ;)
Python Training in Bangalore ,
Angularjs Training in Bangalore ,
Angular 2 Training in bangalore ,
Best Angularjs Institute in bangalore ,
Angular 5 Training in bangalore .

Itools Mobile Service said...

Thanks for shared this article. You are providing very nice post. Kindly Visit us @ Iphone Service Center in Tnagar | Lenovo Mobile Service Center in Tnagar | Moto Service Center in Tnagar

Ram Niwas said...
This comment has been removed by the author.
Rithi Rawat said...

Very nice post here thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.

machine learning course fees in chennai
machine learning training center in chennai
machine learning with python course in chennai
machine learning course in chennai

Robotic Process Automation Tutorial said...

Really useful information. Thank you so much for sharing.It will help everyone.Keep Post. RPA training in chennai | RPA Uipath training in chennai | RPA training in Chennai with placement

Diya shree said...

Thank you for sharing your article. Great efforts put it to find the list of articles which is very useful to know, Definitely will share the same to other forums.

best openstack training in chennai | openstack course fees in chennai | openstack certification in chennai | openstack training in chennai velachery

service care said...

I am amzaed by the way you have explained things in this post. This post is quite interesting and i am looking forward to read more of your posts.
redmi service center near me
mi service center
redmi service center
xiaomi service centre chennai

spot said...

Excellant your post and blog.
It’s amazing in support of me totruly have a blog site, which will be valuable meant for my knowledge. Thanks admin
Transcription in USA
Transcription in USA
Transcriptions in US
Medical Transcription in USA
Medical Transcription Companies in USA
best Medical Transcription Companies in USA
Medical Transcription Services USA
Transcription companies in USA
Transcription services in USA
transcription companies in us
Transcription USA
General Transcription companies in US
Medical Transcriptionist in us

ahmed said...

مؤسسة مكافحة النمل الابيض بالدمام تقدم لكم بعض المميزات المخصصة بمبيد بايفلكس :
يُعد مبيد بايفلكس هو المبيد الافضل لإبادة النمل الابيض وهذا لأنه متدني السمية للأشخاص .شركة مكافحة حشرات بسكاكا
شركة رش مبيدات بسكاكا
المبيدات الحشرية الكيميائية
افضل شركة مكافحة حشرات

DedicatedHosting4u said...

Hey, very nice site. I came across this on Google, and I am stoked that I did. I will definitely be coming back here more often. Wish I could add to the conversation and bring a bit more to the table, but am just taking in as much info as I can at the moment. Thanks .


repairtechsolutions said...

I couldn’t resist commenting. Exceptionally well written!

bookmarked!!, I love your website!

best mobile service center in marathahalli

Samsung Galaxy Note 8 authorized service center in banglore

oppo Reno authorized service center in marathahalli

oneplus 5 service center in banglore

realme U1 service center in banglore

Diya shree said...

Good job and thanks for sharing such a good blog You’re doing a great job. Keep it up !!

Python Training in Chennai | Best Python Training in Chennai | Python with DataScience Training in Chennai | Python Training Courses and fees details at Credo Systemz | Python Training Courses in Velachery & OMR | Python Combo offer | Top Training Institutes in Chennai for Python Courses

Diya shree said...

I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.

blue prism training in chennai | blue prism training in velachery | blue prism training and placement | best training institute for blue prism | blue prism course fee details | Best Blue Prism Training in Credo Systemz, Chennai | blue prism certification cost | blue prism certification training in chennai | blue prism developer certification cost

Prwatech said...

I Got Job in my dream company with decent 12 Lacks Per Annum salary, I have learned this world most demanding course out there in the current IT Market from the big data training in bangalore Providers who helped me a lot to achieve my dreams comes true. Really worth trying Freelance seo expert in bangalore

sweety rupa said...

nice articles Nose reshaping cost in hyderabad

sravanthi said...

This post was very interesting and informative. thanks a lot for sharing such great article.best gynecologist doctors in guntur

Dr.KishoreReddy said...

bone cancer specialist in hyderabad
bone cancer treatment in hyderabad
orthopedic surgeons in hyderabad

Ram Niwas said...
This comment has been removed by the author.
Lili Jonath said...

Permainan slot yang paling banyak diminati oleh semua orang, tentunya disitus kami dengan permainan slot terlengkap, pastinya akan membuat kalian betah permainan slot apa yang kalian dulu mainkan tentunya akan ada disini. silahkan kunjungi situs kami

download vivo apk

aplikasi slot vivo

download aplikasi vivo

download aplikasi slot vivo

aplikasi vivo android

aplikasi vivo ios

apk slot vivo

cara login vivo slot

link login slot vivo

download aplikasi vivo slot

vivoslot deposit pulsa

vivo slot deposit pulsa

vivo slot deposit via pulsa xl

vivo slot deposit via pulsa telkomsel

slot vivo deposit pulsa

slot vivo deposit pulsa xl

slot vivo deposit pulsa telkomsel

deposit slot pakai pulsa telkomsel

agen resmi slot vivo

cara withdaw vivo slot

withdraw slot vivo indonesia

agen slot deposit via pulsa

Anirban Ghosh said...

On the off chance that individuals that compose articles thought increasingly about composing incredible material like you, more perusers would peruse their substance.
SAP training in Mumbai
Best SAP training in Mumbai
SAP training institute Mumbai

BestTrainingMumbai said...

It's invigorating to discover such unique substance in an in any case duplicate feline world. Much obliged to you to such an extent.
SAP training in Kolkata
Best SAP training in Kolkata
SAP training institute in Kolkata

CloudLearn ERP said...

If people that form articles considered making staggering material like you, more perusers would scrutinize their substance.
SAP training in Mumbai
Data Science training in Mumbai
Best data science training in Mumbai

vita Louis said...

Never enough about knowledge
Education is very good and many knowledge

mike bara said...

read about how to activate syw account activate.syw.accountonline.con

Faizal said...

I very Exciting for each and every visit of your site...Thanks for such a interesting Articles about Education,Big Thumbs up for your Efforts.
Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

Saurabh Dev said...

Such an amazing blog with new updates. I love to learn more about this topic. Waiting for more like this.
Machine Learning course
Machine Learning course in Chennai
Machine Learning Training in Chennai
Machine Learning Certification
Machine Learning Online Certification
Machine Learning Certification
Machine Learning Training Online

Sumi Dany said...

I read this blog, Nice article...Thanks for sharing and waiting for the next...
Tableau Training in Chennai
Tableau Training in Bangalore
Tableau Course in Bangalore
Appium Training in Chennai

John said...

حامد همایون
I very Exciting for each and every visit of your site...Thanks for such a interesting Articles about Education,Big Thumbs up for your Efforts.
بهنام بانی

charujohn said...

valuable blog thanks for sharing it...waiting for the next update.

QTP Training in Chennai
UFT Training in Chennai
Automation testing training in chennai
Photoshop Classes in Chennai
Mobile Testing Training in Chennai
photoshop courses in bangalore
UFT Training in Chennai

Rathoredesign said...

NIFT Institutes

NID Portfolio Samples

Best Coaching Institute For NIFT In Lucknow

Best Coaching Classes For NIFT In Lucknow

NIFT Coaching Institute In Lucknow

NIFT Online Training

How To Get Admission In CEED

NID Workshops 2020

CEED Entrance Exam Form

NID Prelims

Bob Swiming said...

Play online casino at 928bet ​​website, new members receive a 50% bonus immediately. Live casino system is very good.

augustwalker said...

These techniques can fix the HP Envy 4500 Error Code oxc4eb827f for you: power resetting, impairing the firewall, or utilizing the printer investigator.

sravs said...

The way you have explained is very good. keep posting also check Best Hospitals in Aurangabad

Talentedge said...

Marketing and Communications are on great demand. If you want to get your dream job in this field, then come to Talentedge. It provides you with the best source to find marketing and communication courses. Visit here for details

Data Science Programs said...

I was very happy to find this site. I really enjoyed reading this article today and think it might be one of the best articles I have read so far. I wanted to thank you for this excellent reading !! I really enjoy every part and have bookmarked you to see the new things you post. Well done for this excellent article. Please keep this work of the same quality.
Data Science Course in Bangalore

Ritesh Singh said...

Visit Bharat Go Digital Academy to learn the digital marketing skills in India.

Aerocity Service said...

Paharganj Escorts
Dwarka Escorts
Russian Escorts Noida
Russian Escorts Delhi
Karol Bagh escorts
Delhi Escorts Service
Escorts in Delhi
Call girls in Delhi
Delhi escort
Aerocity Escorts

R1se Hluoluo said...

Semarang sekarang memiliki simbol tujuan rekreasi baru. Semenjak trending akhir 2019 lalu, Dusun Semilir Ecopark semakin ramai didatangi oleh kami. Tempat rekreasi ini ada di Kecamatan Ngempe dan Kecamatan Bawen, Kabupaten Semarang, Jawa Tengah. https://jelajah-indonesia.net/ Kekhasan bangunan yang lain dibandingkan rekreasi lain yang pantas untuk didatangi waktu berlibur datang.

Bangunan di sini berupa stupa Candi Borobudur yang memiliki 2 lantai. Lantai pertama adalah pusat oleh-olehan, sewaktu-waktu lantai ke-2 adalah tempat makan. Tidak itu saja, Dusun Semilir mengangkat ide perdesaan yang asri.

Unknown said...

You can live a happy and fulfilled life in Chandigarh and still feel the beauty and charm of Chandigarh. Escort Must Hire Chandigarh will help you do just that. It will be a memorable and unforgettable experience.
ESCG News Of Independent escorts In Chandigarh