#131 closed defect (released)
Ruby bindings don't support @stem.apply()
Reported by: | Richard Boulton | Owned by: | Olly Betts |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.0 |
Component: | Xapian-bindings | Version: | SVN trunk |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #118 | Operating System: | All |
Description (last modified by )
Ruby is meant to support the Stem.operator() call by renaming it to Stem.apply(). However, this renaming doesn't seem to work: Stem.apply() isn't found.
Looking at the generated code, Ruby provides access to operator() with a call() method: ie, @stem.call() works with Ruby, @stem.apply() doesn't.
I would guess this is a bug in Swig, since it seems to be ignoring the "%rename(apply) operator();" line in xapian.i
Change History (8)
comment:1 by , 18 years ago
Blocking: | 118 added |
---|
comment:2 by , 18 years ago
rep_platform: | PC → All |
---|
comment:3 by , 18 years ago
I think this renaming of operator() to call is SWIG trying to provide a functor like interface in Ruby, so this may be "not a bug" (or "not the bug reported").
My understanding of Ruby isn't great though, and I'm struggling to find something which tells me how this is meant to work...
comment:4 by , 18 years ago
For what it's worth, the rename to call is happening because of line 29 of Lib/ruby/rubyopers.swg in the swig source tree:
%rename(call) *::operator();
In combination with line X of Source/Modules/ruby.cxx:
Setattr(special_methods, "call", "call");
Hmm - a quick bit of reading google results leads me to believe that "call" is the standard name for a message saying "call this object" - but I've only found this hinted at in a FAQ for teaching Python programmers Ruby. We really need a proper Ruby programmer to tell us what's right, I think.
comment:5 by , 18 years ago
I've mailed Paul Legato, the Ruby guru who originally contributed the Ruby bindings.
comment:6 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Paul says:
"call() would definitely be more idiomatic than apply() in
Ruby"
So I've added a note to the Ruby bindings documentation and I'm closing this bug.
comment:7 by , 17 years ago
Operating System: | → All |
---|---|
Resolution: | fixed → released |
Fixed in 1.0.0 release.
comment:9 by , 17 years ago
Description: | modified (diff) |
---|---|
Milestone: | → 1.0.0 |
Marking this as blocking release 1.0.0 since we don't want people to start relying on the @stem.call() method, and we want to deprecate @stem.stem_word() so we can remove it in sync with the C++ interface for release 1.1.0.