Taking inspiration from Javascript prototypes, I had the idea of a language where every instance can be used as a class. Before I potentially reinvent the wheel, I would like to ask if there is a language already using this concept://To declare a Class, extend the base class (in this case, Type)Type(Weapon,{price:0});//Same syntax to inherit; simply extend the parent:Weapon(Sword,{price:3});Weapon(Axe,{price:4});Sword(Katana,{price:7});Sword(Dagger,{price:3});//And the same to create an instance:Katana(myKatana,{nickname:Leon});myKatana.price; // 7myKatana.nickname; // Leon// An operator to return children of a class;Sword_; // [Katana, Dagger]// An operator to return array of descendants;Sword__; // [Katana, Dagger, myKatana]// An operator to return array of parents;Sword^; // Weapon// Arrays can be used as elementsSword__.price += 1; //increases price of Sword's descendants by 1mySword.price; //8// And to access specific element (using its name instead of index)var name = mySwordKatana_[name]; // [mySword]Katana_[name].nickname; // LeonHas this kind of approach been already studied/implemented?
Any language where every class instance is a class too?
programming languages;object oriented;class