Scripsit ille »Josef ‘Jupp’ Schugt« jupp@gmx.de:
- Rudolf Polzer; 2003-07-04, 09:43 UTC:
Scripsit ille »Robert Klemme« bob.news@gmx.net:
In fact we both made an error here: you need a factory and a
helper class (both sub classes of Human) to create a new Human.
Which Ruby doesn’t support: an object cannot be created without
using a constructor.
Well, the correct terminus technicus in this case is creator, not
constructor.
Hm… really?
I thought the creator calls the constructor.
An instance of Human is made by a creator that
(depending on circumstances) takes up to two instances of Human to
form a new instance of Human as in (for details see Gen 2 and Gen 4):
adam = Human.new()
eve = Human.new(adam)
kain = Human.new(adam,eve)
The single-argument form not requires h.gender == male as can be seen
from
jesus = Human.new(mary)
Hm… that is, jesus is created the same way as eve? Seems like it should
rather be
jesus = Human.new(God, mary)
Note the capitalization: God is a constant, an instance of a singleton
class. It’s normally not created directly but using wrapper classes
like Jahwe, Allah, maybe even KamiSama (well, the exact class name can
only be written in multi-byte character codings, but how to uppercase
the first character then to make it a constant?). There’s at least one
such wrapper class per religion. Some people even call their personal
God wrapper class instance “root”, which has the advantage of it being
modifiable (lower case). [1]
But all of these are local variables. A global ($) variable pointing
directly or indirectly to some God reference seems to not exist, which
explains why there are so many different religions.
So how is the “first” object created?
That question does exist as long as philosophy. I think that we are
not expected to solve this here:
Maybe in a C module? It should be possible to “manually” create a Ruby
object from inside C code, without using a constructor.
[1]: Some people think God is the world’s root but forgot His password,
losing all control over it. But as long as nobody finds a local[3]
root exploit[2], there shouldn’t be any big problems with that.
[2]: The US for example seem to be looking for one extensively.
[3]: Hm… how would a REMOTE root exploit look like then?