mirah / dubious

A Web Framework Written in Mirah for running on AppEngine
Apache License 2.0
121 stars 13 forks source link

circular dependencies not allowed #29

Open hakunin opened 13 years ago

hakunin commented 13 years ago

Dubious should support circular dependencies between files.

Example of circular dependency I'd like to have:

class MetricsSuite
  def app(app:Webapp)
    @app = app
    self
  end

  def self.for_app(app:Webapp)
    new.app(app)
  end
end

class Webapp < Model
  def self.register(title:String)
    app = new.title(title).on_register
    app.save
    app
  end

  def on_register
    MetricsSuite.for_app(self).install
    self
  end
end
baroquebobcat commented 13 years ago

If we changed the compilation step to just give all the files to the Mirah compiler at once, this should work because it will figure out the dependencies at compile time. The problem currently is that I think we don't do that.