From: Florian Gilcher Date: 2008-05-24T00:38:51+09:00 Subject: Re: Prevent ruby constant variables from changing? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On May 23, 2008, at 2:56 PM, Mark Wilden wrote: > On May 22, 2008, at 11:33 PM, Florian Gilcher wrote: > >>>> If you noticed, class names are constants. As you can change >>>> classes at runtime, constants must be changable. >>>> Actually overwriting Constants emits a warning. A you should >>>> program warnings-free, that should be no problem :). >>> >>> Sure, you can change classes at runtime, but should you be able to >>> change which object is referenced by a class name? I haven't heard >>> of that before. Do you have a real-world example of someone doing >>> that? Just curious. >>> >>> ///ark >>> >> >> "Hot code replace" comes to my mind. Completely reloading a class >> while keeping the system running. There, it makes sense to >> completely obliterate the old class. > > You're not really loading a different class - you're just updating > the current class, which could be done more tediously by redefining > its methods and reinitializing its attributes. But I see what you > mean, and you're right. > > ///ark > "Updating" is a bit of a wild guess in a language where a class can change during runtime. I cannot easily "update" a class in ruby as there is no good possibility to determine the delta between a class and the version you want to update to. So usually, the practicable approach really is to delete the class an completely reload it. Regards, Florian Gilcher -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkg25EkACgkQJA/zY0IIRZbGBACcCLW1HrlAfABN6KDuJ13S8zuf GrkAni0AB1yamnIVz6U5A9Bc3kEQIf1F =HWyr -----END PGP SIGNATURE-----