Saturday, June 5, 2010

Reia: Immutable objects at last!

When I started creating Reia, I was originally skeptical of the "everything is an object" concept seen in languages like Smalltalk and Ruby.  This was partially inspired by Erlang creator Joe Armstrong's hatred of object oriented programming.  However, the more I used Erlang and increasingly saw Erlang's solutions for state encapsulation like records and parameterized modules as increasingly inadequate, the more I looked to objects to provide a solution.

Moments ago I committed the remaining code needed to support instance variables within Reia's immutable objects.  You can view an example of Reia's immutable objects in action.  If you're familiar with Ruby, you'll hopefully have little trouble reading this code:

>> class Foo; def initialize(value); @value = value; end; def value; @value; end; end
=> Foo
>> obj = Foo(42)
=> #<Foo @value=42>
>> obj.value()
=> 42

One caveat: Reia uses Python-style class instantiation syntax, i.e. Foo(42).  Rubyists should read this as

So what are immutable objects, exactly?  They work much like the traditional objects you're used to using in Ruby.  Howevever, unlike Ruby, Reia is an immutable state language.  This means once you create an object, you cannot modify it.  The constructor method, which borrows the name "initialize" from Ruby, has the special ability to bind instance variables within a particular object, however once that initialize method completes and the object is created, no changes can be made.  If you want to modify the instance variables, you'll have to create a new object.

Reia will eventually support objects whose state is allowed to change.  These will take the form of concurrent objects, which is the original design goal I had in mind with Reia.  Mutable objects take the form of Erlang processes, and more specifically Erlang/OTP gen_servers, which do not share any state with other concurrent objects and communicate only with Erlang messages.  Going forward, my goal is to make all of the Reia built-in types into immutable objects, allowing user-defined immutable objects, and also allowing concurrent objects whose state can change (albeit in a purely functional manner).

If you've been following me so far, I hope you can sense how concurrency affects Reia's state management model:
  • Sequential objects have immutable instance variables
  • Concurrent objects will have mutable instance variables
This is similar to the state management compromise Rich Hickey chose in the Clojure language.  In Clojure, by default all state is immutable.  However, Clojure employs Software Transactional Memory for concurrency, and inside of Clojure's STM transactions (i.e. where concurrency enters the picture) state becomes mutable.

There's still a lot to be implemented in Reia's object model.  I intend to support polymorphism through simple class-based inheritance, and the code needed to support that is partially in place.  I'd like to support Ruby-style mix-ins.  Once these features are all in place, I intend to completely rewrite the core types, reimplementing them all as immutable objects.

All that said, if you're interested in Reia and would like to start hacking on it, Reia could really use a standard library of objects, and the requisite code is now in place to facilitate that.  I would encourage anyone with an interest in Reia to clone it on github and start implementing the standard library features you will like.  The standard library needs all sorts of things, particularly wrappers for things like files, sockets, ETS tables, and other things which are already provided by the Erlang standard library.

Don't worry too much about making mistakes.  Just send me a pull request and I'll incorporate your code, review it, and make changes where I see issues.  I'd like to prevent the standard library from snowballing into the monster the Ruby standard library is presently, so if you have a feature you'd like to see incorporated, ping me on it (through github is fine) and I'll let you know if I think it should be incorporated.

I'm actively trying to recruit the open source community to build Reia's standard library, so if you're interested, start hacking!


Knodi said...

amazing, cant wait to use it.

jbaker said...

I've tried to get it running on Windows several times, but to no avail. Great work though!

قمم التميز said...

شركة عزل اسطح
شركة كشف تسربات المياه بالرياض
خدمات عزل الاسطح من الخدمات التى فى حاجة الية فى المكان فاذا اراد ان تقوم باعمال العزل لاى اسطح فى المصانع – المنازل – الفلل ... وغيرها وتبحث عن افضل الخدمات التى تساعد فى الوصول الى افضل ما تتمنى ان ترى علية النتائج فعليك ان تتعاون مع شركة قمم التميز التى تحقق اعلى مستوى من العزل بالاعتماد على افضل المواد المخصصة فى القيام باعمال العزل والتى استطاعت ان تتاكد ان اعمال العزل التى تتم بالخيش المقطرن والسيلتون من افضل الخدمات المثالية المميزة التى تحقق اعلى مستوى من العزل دون ان يؤدى الى ظهور اى عيب فى اعمال العزل . كشف تسربات المياه
لا تكتفى شركة قمم التميز بالقيام باعمال العزل فى منطقة معينة بل تسعى الى الوصول الى اى مكان فى شرق الرياض – جنوب الرياض – غرب الرياض – وسط الرياض من اجل ان تحقق خدمات العزل لجميع عملاء الشركة الكرام . كشف تسربات المياه بالرياض
تهتم شركة عزل اسطح بالقيام باعمال العزل الحرارى من خلال الاعتماد على افضل الطرق المثالية وافضل الخدمات المميزة فى القيام باعمال العزل بالاضافة الى ان الشركة تهتم باعمال الكشف الدورى من فترة الى اخرى من اجل ان يتم التحقق ان اعمال العزل تمت كما هو مطلوب فى المكان . شركة كشف تسربات بالرياض
كشف تسربات المياه
كشف تسربات المياه شرق الرياض
تسربات المياه مشكلة تؤدى الى التعرض الى عدد من المشكلات الاخرى ، فالاهمال فى تسربات المياه يؤدى الى التعرض الى الكثير من المشكلات التى نحن فى غنى عنة فاذا تعرض الى التسربات وتعرضت الى ظهور عدد من المشكلات الاخرى مثل سقوط الدهانات والتعرض الى مشاكل الرطوبة فعليك ان تتواصل وتتعاقد مع شركة قمم التميز المخصصه فى اعمال الكشف عن تسربات المياه والتى تحقق افضل ما تتمنى ان ترى علية المكان من خلال القيام بالاتى :- كشف تسربات المياه غرب الرياض
1- الاهتمام باحدث الاجهزة المخصصة فى اعمال الكشف وبالاضافة الى التعرف على اساليب الكشف التى تتلائم مع مكان التسرب .
2- الاعتماد على العمالة المدربة الكاملة التى تحقق افضل مستوى من النتائج من خدمات التنظيف والكشف والاصلاح والتى تحقق افضل ما تتمنى ان ترى علية المكان .
3- الاهتمام بخدمات التنظيف بعد ان تتم اعمال الاصلاح .
كشف تسربات المياه غرب الرياض

اذا اراد ان تقوم باعمال الاصلاح والتخلص من التسربات المتواجدة فى المكان بالاضافة الى البحث عن الاسباب التى ادتت الى التعرض الى تلك المشكلة حتى لا تحدث مرة اخرى فعليك ان تتعاون مع شركة قمم التميز المتخصصة فى اعمال كشف تسربات المياه شمال الرياض
عن تسربات المياه والتخلص من مشاكل التسربات .

shina said...

cctv camera for home
Pestveda | Pest Control
Termite control
Surveillancekart | CCTV System
cctv installation services
best home security camera system

Mirty Birds said...

Hey Thanks for Sharing here is my site Ganesh Gaitonde

Jatinbis said...

Got these Buzz Hippy

Susan said...

Im thankful for the blog article.Much thanks again. Really Great. Pikdo is an Instagram Online Viewer that you can easily browse users, location, followers, hashtags, popular contents, statistics and much more.

IDNPlay DominoBet Domino99 AudiDomino said...

Dominobet raih kejayaan anda dengan tangan keberuntunganmu
Domino99 bermain melalui pc dan mobile dengan lancar tanpa kendala
AudiDomino IDNPlay uang asli, live time dan bertarung lawan pemain judi online asli lainnya

RobertDeLong said...

Looking for the Best LED Monitor Under 10000?
We at NiamIndia covers best gaming monitor under 10000 including the Buying Guide of the product.

Mom is Love said...


Priya Chakraborty said...

Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well.
FMWhatsApp APK

Jitendra said...

I am professional Gamer working for Foriza Horizon as a Senior Consultant. i love to play games on Tablet. Here is the Best Motherboard for i9 9900K for PC.

Jitendra said...

I am professional Gamer working for Foriza Horizon as a Senior Consultant. i love to Play Games on my PC. Here is my Blog How to Solve Netflix Error Code UI 800 3.

kate said...

Are you looking for the
Top Rated Bluetooth Headphones.
Top Rated Bluetooth Headphones under 300
After reviewing and testing multiple headphones we have curated a list of the 7 best bluetooth headphones under 300 that you should consider in 2020.Let’s look at the 7 best bluetooth headphones under 300.


I am an Interior Designer by Profession. I love to listen to music. Here is my Blog about

Best Affordable Audiophile Headphones.


I am an Interior Designer by Profession. I love to listen to music. Here is my Blog about

Best Affordable Audiophile Headphones.

Antonio said...
This comment has been removed by the author.
Antonio said...

This is amazing site for Gloves and Clothes.

Antonio said...

It is a website which offers 8 ball pool coins,

Antonio said...

You shared a very nice piece of information

Insta Follower said...

Hi! I simply would like to give you a big thumbs up for the great info you have got here on this post. I will be returning to your website for more soon.

Visit on this: Buy Instagram Video Views

Unknown said...

Hi. Its Impressive. Instagram is Very Platform For Using.

Ana Watson said...

Thanks for sharing this post, it was very impressive and helpful. Waiting for your new post. Also checkout Nulls Clash.

Escorts Service Kolkata said...


Aftab Shaikh said...

Thank you so much for sharing this. Would love to see more of these in the future. Keep up the good work! Keep sharing such awesome stuff.

Ana Watson said...

Your posts are always unique that I am very impressed with this. Thanks. Also try MLBB MOD APK.

KevinRhodes234 said...

Your website is very attractive and useful. Try the latest version of GBWhatsapp Apk

Julion said...

Truly a wonderful article. I got interested after reading few lines and then read it all. Thank you for sharing it. I look forward to more such blogs.
Regards, fmwhatsapp

jane smith said...

McAfee programming gives the digital security services to ensure your hardware information.Install mcafee from |
Keep yourself secure with McAfee security .
McAfee activate on your computer.
How to Uninstall or disable McAfee WebAdvisor ?
What is McAfee Safe Connect VPN ?
How to login to McAfee account ?
How to know when does my McAfee Subscription Expire ?

sophiajack said...

Remember to temporarily disable antivirus software and firewall on your PC before starting the Netgear extender setup process. mywifiext

Online Duplicate Bills said...

Hi thanks forsharing, Today we will review FMWhatsApp apk , which is a modified App of the original WhatsApp. This article will highlight the features, pros, and cons. So, you must pay attention if you want to grab an interesting read.

Unknown said...

Visit ij.start canon | ij.start.cannon and find out the best way to download Canon printer drivers. Canon printers are ideal for every situation wherever you need a document, paper, or photo print or even if you wish to scan, fax, and do more.

All-in-one Canon Inkjet printers are suitable for home, business, school, and others to improve productivity. You can easily set up your Canon printer through drivers from | canon.come/ijsetup , wireless connection, USB, and a few components.

olivia said...

You can use the default gateway to access the web interface for the Tp-link repeater or extender. This page helps in viewing and configuring the advanced wireless settings of the repeater. Get in touch with our experts at the end on the toll-free number if you wish to have detailed information on the login and the setup process. You can also refer to the website for the same.

olivia said...

To begin with, the netgear orbi login process, input the default gateway in the address bar of the browser. Make sure that the browser you are using is compatible. You can also take the help of the Orbi app and access the login page for the Orbi device. If you have any issues with the login and the setup process, get in touch with our experts at the end via the toll-free number.

Shawn Abi said...

Preferably the Amazing & Attractive Women Leather Jackets For Fashion Oriented Beautiful Women would be in a more conventional variety (dark, dim, burgundy, or winter white — for reasons unknown camel doesn't appear to do it for me) yet don't preclude a tomfoolery tone. Red is bubbly for these special seasons.

netgearorbilogiin said...

Do you need something better to speed up your internet connection? Do not worry anymore. Netgear offers the most powerful Orbi router with advanced features. This makes it easy to connect to Netgear Orbi without any hassle. It has strong security and parental controls that make browsing safe for your child. You can find more information here, for example how to access and You can also learn the setup process on like the Orbi app. You can then use the troubleshooting steps to troubleshoot the issue and update the router firmware.

orbiroutersetup said...
This comment has been removed by the author.
orbiroutersetup said... beginning. For Wi-Fi connections, look for the Wi-Fi network name (SSID) along with the username and password printed on the front of the Orbi satellite router. Netgear is the URL where you can connect to the Orbi netgear network. accesses the installation page by entering this web address at the top of your browser.

Unknown said...

Thanks for the marvelous posting! I truly enjoyed reading it, you may be a great author.
Netgear router firewall and its functions
How to Hide the WiFi name of Netgear AC1600 Router?

nighthawkroutersetup said...

It’s really a great and useful piece of information.
I am satisfied that you shared this useful information with us.
Thank Admin!!
Which Netgear Routers Support Bridge Mode
How To Fix Netgear Router Orange Light? said...

This is a great tip especially to those fresh to the blogosphere.

routerssetups said...

This is a great tip especially to those fresh to the said...

This is a great tip especially to those fresh to the blogosphere.
A must read post!

Alexa Echo Setup said...

As important as it is to set things up in a true fashion is to connect to the network by using the Asus Router Login feature. For more information on the Asus router login, reach out to our team now.

Linksys Smart WiFi Login said...

The default web address linksyssmartwifi helps users access the network settings so the Linksys E8450 Setup is hassle-free.

The web address can also be used as an alternative to the default IP address which most users use to access the login page. For more information on the Linksys E8450 setup page access, log in to our website.

Muhammad Bilal said...

Wonderful Post! Keep it up

สล็อต พีจี said...

โปร สล็อต pg slot จากเว็บสล็อตออนไลน์ PG-SLOT.GAME ที่ยกเกมสล็อตออนไลน์จากค่ายดังมาอย่างหลากหลายค่ายเกม เช่น pg slot jili joker และอื่นๆอีกมากมายในเว็บเดียว มาแรง 2022

ทดลองเล่นromax said...

"เว็บสล็อตเกมออนไลน์ เล่นได้ไม่มีอั้น สล็อตแตกง่าย รวมทุกค่าย จ่ายเต็มไม่มีหัด เว็บมาใหม่ดีที่สุด 2023 """"superslot เครดิตฟรี 50 ล่าสุด
"" สล็อตเกมออนไลน์ทำเงินง่าย ทำเงินได้ไวที่สุด เล่นได้ไม่มีขั้นต่ำ สล็อตไม่มีจำกัด "

matthewu said...

Thanks for sharing this post. I got information on this site. Keep sharing.
Abogado Trafico Fredericksburg Va

Sruthi Karan said...

Such a wonderful post and really glad to read this blog, keep update here! I need more unique post about this article...
Abogado DUI New Kent Virginia

SMS BOMBER said...
This comment has been removed by the author.
SMS BOMBER said...

Very interseting blog. If you want to learn How unlimited SMS Bomber work
, visit this