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 Foo.new(42).

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!

64 comments:

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

mariablack said...

Pc Optimization
Windows Installation
Data Recovery

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

anosh said...

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

Juliana Kho said...

cara daftar sabung ayam s128
bluebet66
cbet judi online
m.scr88.com
login osg777

daftar joker123 slot online

lymacsau said...

Great post, thanks for sharing!

Hương Lâm với website Huonglam.vn chuyên cung cấp máy photocopy toshiba cũ và dòng máy máy photocopy ricoh cũ uy tín, giá rẻ nhất TP.HCM

dadyar said...

Maybe this site will also help you
golbarg-neda.mihanblog

Mirty Birds said...

Hey Thanks for Sharing here is my site Ganesh Gaitonde

Nannie Co Pam said...

IEEE Project Domain management in software engineering is distinct from traditional project deveopment in that software projects have a unique lifecycle process that requires multiple rounds of testing, updating, and faculty feedback. A IEEE Domain project Final Year Projects for CSE system development life cycle is essentially a phased project model that defines the organizational constraints of a large-scale systems project. The methods used in a IEEE DOmain Project systems development life cycle strategy Project Centers in Chennai For CSE provide clearly defined phases of work to plan, design, test, deploy, and maintain information systems.


This is enough for me. I want to write software that anyone can use, and virtually everyone who has an internet connected device with a screen can use apps written in JavaScript. JavaScript Training in Chennai JavaScript was used for little more than mouse hover animations and little calculations to make static websites feel more interactive. Let’s assume 90% of all websites using JavaScript use it in a trivial way. That still leaves 150 million substantial JavaScript Training in Chennai JavaScript applications.

Jatinbis said...

Got these Buzz Hippy

steve said...


تنظيف منازل بالدمام تنظيف منازل بالدمام
تنظيف منازل بالاحساء تنظيف منازل بالاحساء
تنظيف منازل بمكة تنظيف منازل بمكة
تنظيف منازل بجدة تنظيف منازل بجدة
تنظيف منازل بالمدينة المنورة تنظيف منازل بالمدينة المنورة

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.

gyaan said...




Each of the women associated with our agency is strictly professional when it comes to rendering her services to her clients.Female Escorts in Aerocityhere at our escort agency make sure that their talents are such that they will never fall short of giving the best of services to their clients. Check our other Services...
Female Escorts in Aerocity
Female Escorts in Aerocity
Female Escorts in Aerocity
Female Escorts in Aerocity
Female Escorts in Aerocity

customized gifts for him said...

linen cushion covers uk
geometric pillow colorful
pillow of solid rock

niramay said...

https://gbwhatsapp.one/
gbwhatsapp

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
http://199.192.31.54/

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

GBWhatsApp

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.

MARIA GIRGIS said...



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

Best Affordable Audiophile Headphones.

MARIA GIRGIS said...



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. http://10bestgloves.com/

Antonio said...

It is a website which offers 8 ball pool coins, https://poolcoinshop.com/

Antonio said...

You shared a very nice piece of information

Steven Salvatore said...

where is the wps pin on my hp printer WPS Pin stands for the “Wi-Fi Protected Setup”, it is a 8 digit number that is generated by HP printer for wireless connection with routers.

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.
https://whatsappinstalling.com/fmwhatsapp-apk-download/

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

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

escorts
escorts
escorts
escorts
escorts
escorts
escorts
escorts

RealTime Vlog said...

Compress PDF
Compress MP4
Famous Converter

jasonbob said...

jordan shoes
kevin durant
yeezy boost 350 v2
golden goose
yeezy 500
lebron james shoes
curry 7 sour patch
curry shoes
cheap jordans
golden goose shoes

james said...

Thanks for the detailed article on this topic. I would like to see more such awesome articles from you. Download GBWhatsApp APK

Ana Watson said...

Thank you for sharing this. It was helpful. Keep sharing such things.
Also checkout COC MOD Apk.

Thomya_Patlacha. said...

Thanks for sharing this valuable piece of information. Keep sharing more such awesome articles in the future. Goodbye! Download FMWhatsApp APK

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.

LOKI said...

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free FMWhatsApp

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 mcafee.com/activate |
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 ?

jane smith said...

Hiya very cool web site!! Man ...Superb .. I’ll bookmark your site and take the feeds additionally?
McAfee is quick and easy to install.
www.mcafee.com/activate
McAfee cloud security
disable McAfee notification

jane smith said...

How to access NETGEAR router login using the nighthawk app?
NETGEAR router login
NETGEAR router setup
NETGEAR Nighthawk setup
NETGEAR WiFi extender setup

sophiajack said...

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

Alexa said...

Today we will review FMWhatsApp , 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.

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.

Gate Norms said...

Thanks for your valuable post, Really nice and very informative. Forget the password of your existing account? Without wasting time, get back your lost password using Roblox Password Finder. Let's move forward with the solution.

Unknown said...

Canon IJ Network Tool you to watch out for the points mentioned below considerably:
If you want a LAN setup for your printer, you should have the required connectivity equipment such as Network Access Point (Router/ Modem), LAN Cable etc.To get your IJ Network tool to work, you first need to check your printer’s connectivity via LAN connection. Next, check your LAN cable carefully.Canon IJ Printer Utility you can alter your printer’s ink cartridge settings according to your requirements. If any ink cartridges get empty, you can continue to print with other available cartridges after changing the settings.

Unknown said...

ij.start.canon
is the manufacturer site to download Canon printer drivers. Install and set up Canon Printer from https: //ij.start.canon and obtain high-quality printing documents straightforwardly.

https//ij.start.cannon is actually the official site of ij start canon that helps you install the latest printer drivers and software. Visiting http //ij.start.cannon
provides you a complete list of all canon printers where you’ve to select your printer model and download the correct setup file

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.com/ijsetup | canon.come/ijsetup , wireless connection, USB, and a few components.

jack smith said...

ij.start canon helps to set up canon printer. It’s the online support platform to download and install canon printer drivers, firmware, and software ij.start.canon , Canon IJ Network Tool

Unknown said...

download relevant printer software from ij start cannon site. We offer the required data to configure, utilize and install your Canon products on your Windows PC canon is completely safe and secure. ij.start.canon |
ij.start.cannon

shaunagrant said...

The device has the ability to cut from delicate stuff to the tougher ones. It not only reduces your efforts in performing the cutting jobs but also gets the job done in fewer minutes. Overall, it is a time and energy savior that serves you with its versatility Cricut.com/setup | Cricut setup | cricut.com setup | cricut.com setup windows

olivia said...

You can use the default gateway tplinkrepeater.net 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.
tplinkrepeater.net

olivia said...

To begin with, the netgear orbi login process, input the default gateway Orbilogin.net 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.
orbilogin.com

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.