Here's a brief list of things I find wrong with REALbasic (assuming that RB is a programing language for the casual programmer who doesn't want to invest a lot of time in learning a more complicated language such as C++ with all its pitfalls).
Compiler and Language
- Integer expressions:
- Integer literals (numbers) in expressions are always assumed to be signed. This is bad when comparing a unsigned value with a literal - it gives a nonsense warning, besides the more critical issue next:
- Comparing an unsigned with a signed integer value of same bit size leads to always a signed comparison. This is bad because it can give logically wrong results, such as here:
dim ui as UInt32 = 4200000000 // a very big, positive, number
if ui >= 0 then
// yes, it's positive to RB as well
// no, RB thinks this is not the case
end Guess what - RB thinks that "ui >= 0" is not true. Which has its reason within the compiler - which is not an excuse, though!
- No overflow detection: You can write numeric nonsense and RB won't tell you when you get wrong results this way. For example:
dim si as Integer = -1
dim ui as UInt32 = si This stores a positive value in ui, which is not what the casual programmer might expect. It would be better if the user would be notified of this glitch, e.g. via an exception, so that he doesn't use the wrong value further, creating wrong results, with no idea where they came from (well, there's the new warnings system, which, however, create so many more useless warnings that you cannot really use it in a bigger project without going through a lot of pain to keep your list of warnings clean).
Here's another such example:
dim b1, b2 as UInt8
b1 = 200
b2 = 100
if b1+b2 = 300 then beep This won't beep. While in this case the experienced programmer may quickly figure out what is going on here, the types of b1 and b2 might be defined somewhere else, making it very difficult to find the source of this not working as one might expect.
- Here is another example that combines the above problems with integer expressions and overflows (as brought up Jan 2009 by Markus Winter on the NUG mailing list):
dim x as double = 12345678901234567890
s = Format(x, "-#.##########") produces
-6101065172474983424. instead of
- ByRef parameters: RB 4.5 used to allow to pass any L-value to a ByRef parameter. The new compiler, though, only allows unqualified names to be passed, meaning that one can pass a class' property as x, but not as me.x. And the error message compiler gives for this, i.e. that one cannot pass expressions to a ByRef parameter, is nonsense. The inofficial explanation for this rule ("you cannot pass anything with a dot in it to a ByRef parameter") was that it would be an easier rule to understand for RB users. WTF?!
... more to come(?)