bloom-lang / bud

Prototype Bud runtime (Bloom Under Development)
http://bloom-lang.net
Other
854 stars 60 forks source link

BudCollection#schema is confusing #245

Closed jhellerstein closed 12 years ago

jhellerstein commented 12 years ago

It is handy in a state block to reuse the schema of a previously-defined collection, but using BudCollection#schema does not preserve the key dependencies. E.g.:

  state do
    table :orig, [:kee] => [:wal]
    table :oops, orig.schema
    table :yeps, orig.key_cols => orig.val_cols
  end

The table oops has key [:kee, :wal], rather than [:kee]. But the table yeps is annoying to type, so it's easy to introduce bugs by doing what oops does.

neilconway commented 12 years ago

Yep, this is definitely confusing. How about:

  1. Change BudCollection#schema to return key => vals (input schema)
  2. Add BudCollection#cols to return the list of column names in the collection's schema. This is nicely symmetric with the existing key_cols and val_cols methods.
jhellerstein commented 12 years ago

concur on the proposed solution.

neilconway commented 12 years ago

Okay -- I can take a crack at implementing it.

michaelficarra commented 12 years ago

I opened pull request #247, which should mostly take care of this issue.

neilconway commented 12 years ago

Merged #247 with additional fixes -- this should be fixed.