What are the main differences in dynamic language object models such as Smalltalk, Ruby, and Python?

I have plunged into the understanding of the Ruby object model in recent weeks and although until now I have only been a user of the fruits of a ruby ​​and python object in the past, I was curious how these things can differ in other languages.

A few years ago I touched a small squeak. Smalltalk often appears as a reference object-oriented language, so I am interested in this. The ruby ​​object model does not distinguish between objects and classes; the existence of a singleton object makes each object a prototype extensible when necessary. Since I know all these things that are defined as a meta-object protocol. These things make life easier than other less or non-dynamic languages, such as C ++ or Java.

Please, could you give me an idea of ​​how dynamic languages, especially smalltalk, python and ruby, differ in the implementation of the meta-object protocol?

+3
source share
2 answers

Python - , , , ( ) " " ( , , , , , , , " " , , ). (getattr, setattr, __getattr__, __setattr__,...) , , " " .

, a, Python, a.b ( ) : Python ( ), a.b () , , .., a.b. ( ) a.b, : a.b(), .

Ruby ( , Python ) " " - ( c=a.b , a.b(); b , a, , ). , (, - ), , .

Smalltalk , Ruby, "-" ( "" ), ( " " ).

+2

Python Smalltalk, , - , . Smalltalk ( , Dolphin Smalltalk ) . , Python , , ( __ , , ___). , - , - , . Python , .

, , . , , : -)

+2

Source: https://habr.com/ru/post/1728281/


All Articles