Immutable Ruby

T

Trans

I was thinking about Erlang a bit today, the fact that it's objects
are all immutable and it's usefulness to concurrency. So I began to
wonder, what would an Immutable Ruby look like?

* Would it make setter methods effectively pointless?
* Overall, would it help or hurt efficiency/speed?
* Would it ruin Ruby's elegance?
* No more #<< :(
* No more Symbol vs. String!!! :)
* Is such a thing even possible?

T.
 
T

Trans

To find out what it would be like replace every
=A0 =A0Blah.new(arg1,arg2...)
=A0 =A0 with
=A0 =A0Blah.new(arg1,arg2...).freeze

Almost. From my understanding Immutable objects can have internal
changing state as long as it is never exposed to the outside world.
For instance, memoize is a good example.

Am I right about that?

T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top