Projects

Ticket #207 (new defect)

Opened 3 years ago

Last modified 14 months ago

Kernel#framework calls global #copy method while loading Cocoa.

Reported by: eloy.de.enige@… Owned by: lsansonetti@…
Priority: blocker Milestone: MacRuby 1.0
Component: MacRuby Keywords:
Cc:

Description

This is something I stumbled across when playing with Rake. I have isolated it to the following:

% macirb
irb(main):001:0> module Kernel
irb(main):002:1> def copy(*args) p args; end
irb(main):003:1> end
=> nil
irb(main):004:0> framework "Foundation"
=> true
irb(main):005:0> framework "Cocoa"
[]
[]
[]
[]
[]
[]
=> true

It also breaks if the arity of the #copy method is specified:

% macirb
irb(main):001:0> module Kernel
irb(main):002:1> def copy(one_arg); end
irb(main):003:1> end
=> nil
irb(main):004:0> framework 'Cocoa'
ArgumentError: wrong number of arguments (0 for 1)
	from (irb):4:in `framework'
	from (irb):4
	from /usr/local/bin/macirb:12:in `<main>'

So it seems like something is being evaluated which calls a #copy method while loading frameworks.

Change History

Changed 3 years ago by lsansonetti@…

This is because Kernel is included in NSObject and that the new method conflicts with -[NSObject copy]. MacRuby should not try to override these methods.

Changed 14 months ago by vincent.isambart@…

  • milestone set to MacRuby 1.0
Note: See TracTickets for help on using tickets.