On Wed, Jun 6, 2012 at 6:53 AM, Raphael B. <lists / ruby-forum.com> wrote:
> Bartosz Dziewoski wrote in post #1063320:
>> The encoding has to be set *before the file is even parsed*. So
>> obviously you can't use a regular method call to do this; this
>> basically forces you to create new syntax for setting the encoding.
>> However, you also want to keep backwards compatibility when possible 
>> so you make that new syntax look like comments for older Ruby
>> versions. Bam, you've got a magic encoding comment.
>>
>> -- Matma Rex
>
> Thanks for your answer.
> That could be achieved (though not on a per file basis) with the -K
> flag, but I've read the -K flag could become deprecated, and that magic
> comments are the future. I don't understand how comments can get such an
> importance in source code, and I want to learn more because I'm
> suspecting I am missing something.

Ruby's hardly alone in having semantically significant comments. I
seem to recall something in Java comments that has actual meaning not
just to javadoc but to the compiler (though I can't recall what it
is).