Open nvoynov opened 9 years ago
I'll take a look later this week.
dean
Dean Wampler, Ph.D. Typesafe "Functional Programming for Java Developers", "Programming Scala", and "Programming Hive" - all from O'Reilly twitter: @deanwampler, @chicagoscala http://typesafe.com http://polyglotprogramming.com
On Mon, Oct 6, 2014 at 8:32 AM, Nikolay Voynov notifications@github.com wrote:
Hello, colleagues.
I'm trying execute next code from the basic example
require 'aquarium' include Aquarium::Aspects
class Foo def foo 'foo' end end
Aspect.new :around, :calls_to => :all_methods, :on_types => [Foo] do |joint_point, object, *args| p "Entering: #{join_point.target_type.name}##{join_point.method_name} for object #{object}" result = join_point.proceed p "Leaving: #{join_point.target_type.name}##{join_point.method_name} for object #{object}" result # block needs to return the result of the "proceed"! end
foo = Foo.new foo.foo
and have next console output
d:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/aquarium-0.5.1/lib/aquarium/aspects/aspect.rb:402: warning: redefining `object_id' may cause serious problems d:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/aquarium-0.5.1/lib/aquarium/aspects/aspect.rb:403: stack level too deep (SystemStackError)
It possible to get worked aspectr code for Ruby 1.9.3p545?
— Reply to this email directly or view it on GitHub https://github.com/deanwampler/Aquarium/issues/41.
I'm afraid I won't have time to look at this for a few weeks. I'm on a busy travel schedule at the moment.
I'm not working with Ruby anymore, so it takes me several hours to update my tools, etc., etc., just to get started. In fact, I'm looking for people to take over the project...
Anyway, the github code is a bit newer than than the last 0.5.X release. It might already fix your issue. Also, from your stack trace, it appears to be using 1.9.1 gems, instead of 1.9.3 gems.
https://github.com/deanwampler/Aquarium
Sorry I can't address this right away.
dean
Dean Wampler, Ph.D. Typesafe "Functional Programming for Java Developers", "Programming Scala", and "Programming Hive" - all from O'Reilly twitter: @deanwampler, @chicagoscala http://typesafe.com http://polyglotprogramming.com
On Wed, Oct 8, 2014 at 8:03 AM, Dean Wampler notifications@github.com wrote:
I'll take a look later this week.
dean
Dean Wampler, Ph.D. Typesafe "Functional Programming for Java Developers", "Programming Scala", and "Programming Hive" - all from O'Reilly twitter: @deanwampler, @chicagoscala http://typesafe.com http://polyglotprogramming.com
On Mon, Oct 6, 2014 at 8:32 AM, Nikolay Voynov notifications@github.com wrote:
Hello, colleagues.
I'm trying execute next code from the basic example
require 'aquarium' include Aquarium::Aspects
class Foo def foo 'foo' end end
Aspect.new :around, :calls_to => :all_methods, :on_types => [Foo] do |joint_point, object, *args| p "Entering: #{join_point.target_type.name}##{join_point.method_name} for object #{object}" result = join_point.proceed p "Leaving: #{join_point.target_type.name}##{join_point.method_name} for object #{object}" result # block needs to return the result of the "proceed"! end
foo = Foo.new foo.foo
and have next console output
d:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/aquarium-0.5.1/lib/aquarium/aspects/aspect.rb:402: warning: redefining `object_id' may cause serious problems
d:/apps/Ruby193/lib/ruby/gems/1.9.1/gems/aquarium-0.5.1/lib/aquarium/aspects/aspect.rb:403: stack level too deep (SystemStackError)
It possible to get worked aspectr code for Ruby 1.9.3p545?
— Reply to this email directly or view it on GitHub https://github.com/deanwampler/Aquarium/issues/41.
— Reply to this email directly or view it on GitHub https://github.com/deanwampler/Aquarium/issues/41#issuecomment-58371970.
Hi @nvoynov, you might need to apply options :method_options => :exclude_ancestor_methods it becomes like this:
Aspect.new :around, :calls_to => :all_methods, :on_types => [Foo], :method_options => :exclude_ancestor_methods do |joint_point, object, *args|
p "Entering: #{join_point.target_type.name}##{join_point.method_name} for object #{object}"
result = join_point.proceed
p "Leaving: #{join_point.target_type.name}##{join_point.method_name} for object #{object}"
result # block needs to return the result of the "proceed"!
end
Without that constraint Aspect try to redefine every method on ancestor chain. How about we make that constraint by default when "all_methods" is used @deanwampler ?
Hello, colleagues.
I'm trying execute next code from the basic example
and have next console output
It possible to get worked aspectr code for Ruby 1.9.3p545?