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...

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

Unknown said...

This is a comprehensive and helpful list, about Health Care. 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

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 .

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

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

ahmed said...

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

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

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

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.
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

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

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

Gianna Lopez said...

If you are having a tough time dealing with your academic tasks, don’t overthink. Just go ahead and hire an expert who suits your requirement. You can find professionals offering their services at affordable charges easily. So, money will never act as a barrier to the academic online assignment help you need. Try it for once and then decide how it worked for you.

Moviesflix said...

Haldiram Franchise is a well-established sweet and savory brand and becoming a franchisee of Haldiram would be a golden opportunity for all those who are interested to start a Haldiram franchise in India. The brand Haldiram is popular in more than 23 countries apart from India.

haldiram franchise

dabur franchise

keven john said...

Thanks for sharing this nice blog!I have go through all the content of this blog.This is really helpful and informative for me and all the readers.We are offering an online Dissertation Data Analysis Help at a cheap price.

Courses said...

Really this article is truly one of the best in article history and am a collector of old "items" and sometimes read new items if i find them interesting which is one that I found quite fascinating and should be part of my collection. Very good work!
Data Scientist Course in Gurgaon

Neena07 said...

If you are a student and you have no time to prepare for your online exam. then don't get panic and no need to go anywhere just click Online exam help in uk. we will provide you with the best quality exam help buy now this service at an affordable price.

pinoy logo said...

Pinoy station by Pinoyflix is a free stage where you can see free TV projects without a doubt.

alexmorgan said...

C and C# are two most prominent languages from the ages and everyone is confused that which one is best and for that I have written the article which will clear your mind in selecting the best from these two languages so it must read article for you if you are beginner and looking for starting the career into these languages.Click here and check out the article of difference between C and C#

wowcigarette said...

Why on body told me about this blog before? I rellay love your posts. Thank you. Such amazing information. I am Jennifer, I like go shopping at crystal stores near me with my friends at weekend.

DrKhaleelullah said...

Wonderful Blog. Thanks for detailed information.

Best Orthopedic surgeon in hyderabad

havardss23 said...

Sense of Beauty by Cecilie Mikkelsen ble startet opp i mars 2019 da jeg hadde studert estetisk injeksjonssykepleie på Amabilis academy. I noen år har jeg arbeidet i klinikk som
Visit here :- LingaDore

Ranu singh said...

RAYNA INDUSTRIES incorporated in the year 2013 and ISO 9001:2008 Certified organization is a pioneer in the field of LED based Lighting Systems and has been engaged in manufacturing and exporting of LED based Lighting Systems. Click here :-100w flood light

rajeshe23 said...

Founded in 2018, Adventure Mania is one of the most trusted travel partner in India. It has around 4.8 rating on google (as of June 2022). We cater to all type of travel enthusiast across the globe.
Visit here :- rajasthan trip package

ajay singh said...

I am Mohua, the food blogger. Cooking is my passion. I love learning new recipes and experiment them to make a new and unique dishes. I believe if you have a tasty food, your mood will be good.
I have learnt many old recipes from my mother and grandmother and have given those recipes a modern touch. Anything we do by our heart always gives a positive result.
Now a days I am looking forward to many new recipes from food articles, and recipe books of my grandmother. I have also found many new tricks and techniques by which you can prepare delicious recipes very easily. Here I am going to share all the things I have learnt. Hope you all will also enjoy this technique of cooking those recipes. Come again and again to learn more unique techniques and recipes.

Visit here curd calories 1 cup

rahulsih23 said...

I really likes the way you articulate and express your point

click here :- tourist visa

sahana singh said...

I like your comment thanks for sharing.
fixing Water purifier in Nagpur

Sonu singh said...

thank you for this useful informations amd i found something is interesting here. plz visit here :- car rental in coimbatore

jacobsglenn said...

I find the information in this post to be very valuable. If you need help with your dissertation, dissertation expert are available to help. Thanks to their suggestions and assistance, your dissertation will be of a standard that beyond your expectations. I would definitely advise you to use their services if you wish to succeed academically as a student.

VRS Software said...
This comment has been removed by the author.
Chaitanya said...

Very informative blog post. Thanks Again. Great.
Docker And Kubernetes Online Training
SAP SD Online Training
SAP CS Online Training
SAP EWM Online Training

Bharathi said...

Thank you for this excellent post. I always appreciate high-quality content, and your post is truly superb. The ideas presented are fantastic, and the content provides valuable information in various forms.Here is sharing some Python Certification Training journey information may be its helpful to you.
Python Certification Training

Horizon Garage Door said...

When it comes to garage door repair in Howard County, trust the experts at Howard county garage door repair. We are a locally owned and operated company with years of experience serving the community. Our technicians are highly trained and certified, and we only use high-quality parts and materials for all our repairs.

We understand that a malfunctioning garage door can be a major inconvenience, which is why we offer prompt and reliable service to get your door back on track as quickly as possible. Don't let a broken garage door disrupt your daily routine - contact us today for all your garage door repair needs.

char lieave said...

The team at Marketing management assignment help truly understands the complexities of the subject matter. Their in-depth knowledge and practical insights helped me gain a better understanding of marketing management concepts, which I could apply to future projects and in my professional career.