_why <why / ruby-lang.org> writes:

> I don't want to be indelicate and we can address this some other
> time.  Maybe a good place for an easter egg would be as a virtual
> global variable.  Global vars are a rather open namespace and if we
> kept the code in C none of the strings here would be allocated until
> needed.  I think ts would appreciate that efficiency, perhaps?
>
> Anyway, what do you think about an $ABOUT with a singleton?
>
>   $ABOUT = %{"Maybe because Ruby is a mansion, a backdoor is bigger than you expect."\n  - matz}
>   def $ABOUT.ts
>     %{"I know nothing, I just ask ruby what it do."\n  - Guy Decoux (1955 - 2008)}
>   end
>
> From [ruby-talk:20662] and [ruby-talk:5795], respectively.
>
> In ruby.c, this becomes:
>
>   static VALUE
>   rb_about_ts(VALUE self)
>   {
>     return rb_str_new2("\"I know nothing, I just ask ruby what it do.\"\n  - Guy Decoux (1955 - 2008)");
>   }
>   
>   static VALUE
>   rb_about()
>   {
>     VALUE about = rb_str_new2("\"Maybe because Ruby is a mansion, a backdoor is bigger than you expect.\"\n  - matz");
>     rb_define_singleton_method(about, "ts", rb_about_ts, 0);
>     return about;
>   }
>
> Then, in ruby_prog_init:
>
>   rb_define_virtual_variable("$ABOUT", rb_about, 0);
>
> _why
>

I like it.  It's a bit like "import this", but deeper.

-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org