Aw shucks, discovered an issue
    
    
    db.withTransaction:
      t["fuz"] = "buz"
      if false:
        t.commit
      # does not add anything
      # transaction not ended, program blocks
    
    
    Run

Statically ensuring a tagged proc is called in all code paths seems more 
trouble than it's worth.

@Araq's approach really is simple to implement (like old Unix tools 😉) Maybe 
with different naming? "hopefully obvious" might work as well as "hopefully 
familiar"...
    
    
    # (a)
    db.readonly:
      t["fuz"] = "buz"
      # always adds reset
    
    db.writable:
      t["fuz"] = "buz"
      # always adds commit
    
    
    Run

Or perhaps supershort, familiar and autochoose (no manual `commit`/`reset`)
    
    
    # (b)
    with db:
      t["foo"] = bar
    
    
    Run

Or the same by default with more control
    
    
    # (c)
    type Mode = enum[auto, readonly, writable]
    with db:
      t["foo"] = bar
      # commits
    
    with db readonly:
      t["foo"] = bar
      # resets
    
    
    Run

The agony. 

Reply via email to