Designing sruby (Secure Ruby) - Use ivars (@balance) or Storage class (storage.balance) for (Blockchain) State?

Gerald Bauer <[email protected]>
Newsgroups gmane.comp.lang.ruby.general
Message-ID <CAAxEZd9OGNOVWViEwVE8MFnHeT62yWHW0CLTWVnq0chfjTug3g@mail.gmail.com>
Hello,

   If anyone follows along about the new ruby variant / flavor called sruby
   - Small, Smart, Secure, Safe, Solid & Sound (S6) Ruby.

  Here's a language design choice: How to track the contract's
(blockchain) state?

  a) Let's (re)use ruby's ivars (object instance variables) e.g.:

  def initialize
    @owner   = msg.sender
    @counter = 0
    @bets      = Mapping.of( Integer => Bet )
  end

  or b) let's use a more "explicit" Storage class e.g.:

  def initialize
    storage[:owner]   = msg.sender
    storage[:counter] = 0
    storage[:bets]    = Mapping.of( Integer => Bet )
  end

  or c) something completly different.

What's your take? a) b) or c).
Help design the future of ruby on the blockchain world computer :-).

  Cheers. Prost.

PS: New to (Secure) Ruby Programming?

Free recommended (online) papers & books and contracts include:

- The "Red Paper" about sruby [1] - Small, Smart, Secure, Safe, Solid
& Sound (S6) Ruby - The Ruby Programming Language for Contract /
Transaction Scripts on the Blockchain World Computer - Yes, It's Just
Ruby
- Programming Crypto Blockchain Contracts Step-by-Step Book / Guide
[2]. Let's Start with Ponzi & Pyramid Schemes. Run Your Own Lotteries,
Gambling Casinos and more on the Blockchain World Computer...
- Safe Data Structures (Array, Hash, Struct) [3] - Say goodbye to null
/ nil (and maybe) and the Billion-Dollar mistake. Say hello to zero
and the Billon-Dollar fix.
- Ruby Sample Contracts for the Universum Blockchain/World Computer Runtime [4]

[1] https://github.com/s6ruby/redpaper
[2] https://github.com/s6ruby/programming-cryptocontracts
[3] https://github.com/s6ruby/safestruct
[4] https://github.com/s6ruby/universum-contracts

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.