I can't agree more, Kevin. Putting vtables in global space was an
absolutely atrocious idea. What if you want to write a Database class, and
then subclass it with virtual methods? Sorry, you can't use it in your Find
routines. This is infuriating.
I raised this issue in January, and the only response I got was: sorry,
there's really no reason you'd need to use virtual methods in a
non-standard launch code. I still heartily disagree.
Late binding is one of the key C++ features that enables polymorphism, and
polymorphism is one of the key reasons to use an object-oriented language.
Any reasonably complex application -- and there are plenty of them for the
Palm these days -- can benefit from object-oriented stuff *at all times*.
Implementing Find is nontrivial for a reasonably complex application, and
can therefore benefit from virtual functions.
By the way, has anyone else run into exception callback problems? Suppose
you have a Database class, and that class can throw an exception (arguably
a better way to handle errors). Suppose in order to draw a cell in a table,
you need to use the Database class (or a class that uses the Database
class). Watch out that you don't throw exceptions, because they'll throw
right through you (C callbacks truncate exception headers).
C++ is significantly hamstrung on the Palm.
Regards,
Ben Flaumenhaft
>I think one of the problems with a C++ framework for the PalmOS is the
>inability to access globals in some circumstances. If you had a framework
>from which you derived subclasses for forms or other objects, and that
>framework required virtual functions (which it almost certainly would in
>order to abstract out base classes from derived classes), then you run into
>difficulties with the framework operating from launch codes that don't have
>globals available.
>
>Let's fix that problem first!
>
>As you write more and more Palm applications, you develop modules that can
>be reused, in whole, in other projects. If you write these modules with the
>same consideration for encapsulation and data hiding that C++ gives you,
>they are pretty useful and loosely coupled to the programs in which they are
>used (they are good objects).
>
>C++ is not going to solve all your problems, but good OO design (even with a
>C implementation [and, yes it can be done, though some things are a bit more
>painful]) will help you out quite a bit.
>
>My $0.02.
>
>Kevin
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>> Sent: Tuesday, September 21, 1999 5:58 PM
>> To: [EMAIL PROTECTED]
>> Subject: Re: C++ SDK wanted!
>>
>>
>>
>>
>> >Still no match for classes...
>>
>>
>> Why not? Let's not get into an "Is too!" "Is not!" kind of
>> argument. Support
>> your statements.
>>
>>
>> >why common.cpp if it's c code?
>>
>>
>> I didn't say it was C code. I'm just trying to counter your
>> (implied) argument
>> that you can't write re-usable modules when the Palm OS API
>> is described in C.
>>
>>
>> -- Keith
>>
>>
>>