
9 Aug
2006
9 Aug
'06
2:44 a.m.
Albert Lai wrote:
Let's have a fun quiz! Guess the mainstream languages in question:
Spoilers for the quiz
0. What language would allow
4["hello world"]
when a normal person would just write
"hello world"[4]
This is a classic C misfeature.
1. What language, supporting a kind of both parametric polymorphism and subclass polymorphism, allows and actually features such a class declaration as
class Enum
{ ... }
I have to guess here. Java.
2. What language allows you to test primality in constant runtime? That is, move all the work to compile time, using its polymorphism.
C++, also a classic feature. There are even books that discuss this technique, and I believe a SPJ paper referring to it.