I've been collecting these for a while, and I think it's time to put them on display for all to appreciate. Here's the inner-workings of a twisted mind. ;-) Your challenge is to come up with funny language concepts of your own!
Something the Random module is missing:
[rbcode]
Sub Crash(extends r as Random)
#pragma NilObjectChecking false
if r.Number < .5 then
dim p as Ptr
p.Int32( 0 ) = 0
end if
End Sub[/rbcode]
Since there's the goto statement that lets you jump from one code locality to another via label, why not the comefrom statement? It lets you jump back.
In a bid to make REALbasic more low-level friendly, I propose we add ARM and MIPS assembly support to the language as well. Everyone who wants to get to the metal will be able to do so.
As a compliment to Hex, Oct and Bin, the Unary (1-based) global function:
[rbcode]Function Una( i as Integer ) as String
dim ret as String
for x as Integer = 0 to i
ret = ret + "0"
next x
return x
End Function[/rbcode]
Of course, since we have a serial control, we really should implement Serial.Eat as a way to purge the data buffers. It's a nice compliment to Serial.Flush, which happens later.
Speaking of complimenting functions, since we have Str to convert a number into a string, and Val to convert a string into a number, I want to see StrStr and ValVal. StrStr( 162 ) would return "One Hundred Sixty-Two" and ValVal( "One Thousand Ninety-Five" ) would return 1095. This is highly useful for those check-writing applications all the kids are making. As a corollary, there should be an option to work with roman numerals too.
I think a new round of deprecations and renamings are in order. OldREALDatabase should now become ReallyOldREALDatabase and REALDatabase should become SlightlyOldREALDatabase. After all, everyone should be using REALSQLDatabase instead.
Since there's a Speak function, why isn't there a Listen function which does the converse?
I second the listen function! And ASM would be cool.... If ASM wasn't so crazy already. ;)
:: grins :: the ASM would be cooler if it was an architecture REALbasic supported. ;-)
The unary function is similar to my Base Zero Converter program. It takes any number as an input. If the number is zero, the output is zero; if not, the output is NaN. Really useful, huh?
A trinary valued "boolean" ? true, false and maybe.
In addition to "returning" values we should be able to "take" values from anywhere any time. Kind of a "gimme that" way of programming :)
And if we're going to have goto, camefrom we might as well add in "come to". That way when you have no idea what's going on you can issue a "come to" and program execution will clean itself up and run normally.
And, for tracing bugs we need "went to". That way when you have no idea what's going on you can figure out where the hell things went wrong.
Norman, I once gave a trinary true-false question on an exam. The answers were: (a) True, (b) False, and (c) One of the above. Half the class got the question wrong because they thought (c) was a trick.
what was the question?
c would never be wrong as long as the question could be answered true or false
Actually, the StrStr and ValVal functions are implemented in a Java library (called ICU4J) by a device known as a RuleBasedNumberFormat. I have been meaning to write an RB implementation...