bloom-lang / bud

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

deferred error when using @ in a non-channel collection #241

Closed jhellerstein closed 12 years ago

jhellerstein commented 12 years ago

It is currently possible to use the location-specifier syntax in collections that are not channels; Bud does not complain. E.g.:

  state do
    table :wrong, [:@col] => [:val]
    table :right, [:snoopy] => [:woodstock]
  end
  bloom do
    stdio <~ (wrong*right).pairs(:col => :snoopy)
  end

The state block parses OK, but the rule in the bloom block fails--- Bud complains somewhat cryptically that it cannot find a column of the name :col in collection wrong. It would be more helpful to produce the error on the invalid state declaration.

neilconway commented 12 years ago

Current behavior seems reasonable to me:

require "rubygems"
require "bud"

class LocMissing
  include Bud

  state do
    channel :ch, [:addr, :cnt]
  end
end

c = LocMissing.new
c.run_fg
ruby ~/t1.rb
/Users/neilc/.rvm/gems/ruby-1.8.7-p352/gems/bud-0.0.5/lib/bud/collections.rb:677:in `initialize': Missing location specifier for channel 'ch' (Bud::BudError)
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p352/gems/bud-0.0.5/lib/bud/state.rb:98:in `new'
    from /Users/neilc/.rvm/gems/ruby-1.8.7-p352/gems/bud-0.0.5/lib/bud/state.rb:98:in `channel'
    from /Users/neilc/t1.rb:8:in `__state5__LocMissing'
...
neilconway commented 12 years ago

Closing; if you have a test case that still exhibits a problem, please re-open.

neilconway commented 12 years ago

Can you provide a test case, please? As far as I can tell this is not a bug.

jhellerstein commented 12 years ago

There is a test case in the original issue. It should issue an error on the state block ("illegal use of '@' in non-channel collection"), not the bloom block.

neilconway commented 12 years ago

Yes, that is precisely the current behavior.

neilconway commented 12 years ago

Sorry to be dense, just realized I was misparsing the complaint here -- yes, this still needs to be fixed. Will do so shortly.