Hi all,

As part of the PHP binding I'm working on, I need to rename (or
discard) a couple member functions from the existing C++ messaging API
(this is to work around a specific SWIG / PHP limitation - see
https://sourceforge.net/tracker/?func=detail&aid=3168531&group_id=1645&atid=101645
for more info).

The methods affected are:
* qpid::messaging::Receiver::fetch
* qpid::messaging::Receiver::get
* qpid::messaging::Session::nextReceiver

In all three cases, the problem is that there exists two overloaded
versions of the function - one that takes an object reference, and
returns a bool result, while the other returns an object and throws an
exception on errors (I'm sure you're all familiar with the differences
between those overloads).

Anyway, due to the SWIG / PHP limitation mentioned above, we need to
rename one of each overloaded pair of methods in the generated PHP
wrapper.

So, for example, we might rename the "throwing" version of
nextReceiver such that we end up with the following (pseudo) methods
in PHP:

bool Session::nextReceiver(Receiver &, Duration) throws();
Receiver Session::nextReceiverThrows(Duration) throws(NoMessageAvailable);

(that's how they could look just to PHP scripts - I'm not talking
about changing anything in the C++ API itself).

So, we need to decide which overloads to rename, and how.

The top level options are:
1. we rename just one of each pair, such as the nextReceiverThrows
example above, keeping one of the overloads with the existing method
name.
2. we rename both overloads, for example nextReveiverBool and
nextReceiverThrows.
3. we "ignore" one of the overloads, meaning that one of each pair of
overloaded methods will simply not exist in the PHP binding.

Personally, I prefer option 1 - just renaming one of each overloaded
pair of member functions (though I don't mind option 3 either).

Assuming we go with 1 (or 3), we would then need to decide: will we
rename (or ignore) the "throwing" versions, or the bool-return
versions (we should, IMO, be consistent for all three problematic
overloads).

Personally, I think we should rename the bool-return versions, because:
a. I prefer using the throwing versions, so would prefer to keep their
current method names the same; and
b. all of the messaging examples (that I've looked at so far) use the
throwing versions, so by keeping those method names unchanged, the PHP
examples can most-closely relfect the official cpp examples.

Also, assuming we agreed to rename the bool-return versions (or the
throwing versions, for that matter), then we'd need to choose the new
names.  Some examples I can think of:

* getBool, fetchBool, nextReceiverBool
* getIfAny, fetchIfAny, nextIfAny
* getMessage, fetchMessage, next

I'm not really sold on any of those suggestions though... hopefully
someone will have some better ideas :)

Thoughts? Opinions? :)

Paul.
----
http://colby.id.au

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscr...@qpid.apache.org

Reply via email to