Problem in OO design: Will it be possible to reuse a contracts' code with a cloned/new memory space?

I've been thinking about how to implement Object Oriented design in Ethereum using the idea that an object is a contract and you send messages to it with the name of the method you would like to call.

I'd like to be able to instantiate new objects from old ones. I.e. if know a deck of cards exists at address 2e28fa9..., I'd like to be able to do something like "create_contract_from_old(2e28fa9...)" and have a brand new deck of cards.

I know this isn't possible in the current protocol, but is something like it planned?


  • LukeDLukeD Member Posts: 23
    As a follow up:

    Can I pass data to a contract's init code? If I could reuse code to implement objects (and hopefully type checking via code inspection) as above, it would also be nice to be able to treat the init code as a constructor of the object.
  • LukeDLukeD Member Posts: 23
    Never mind, I realized that since a contract has access to its own code that it can copy itself. My question about init blocks still stands (though Serpent doesn't seem to support passing data at contract creation).

    This thread can be closed/deleted.
Sign In or Register to comment.