farleyknight/crystal-sdl — pull request #1 by asterite (2014-07-02 14:58:45+00:00)
Title: Use __DIR__ instead of File.dirname(__FILE__)

Hi @farleyknight !

This pull request is just an excuse to say: awesome!

The SDL bindings we have inside the libs directory in Crystal are just dummy: we just created them to try out the language and see if we could do an efficient raytracer and some other little programs. That's why it's incomplete and very naïve (we don't actually know much about SDL). So please continue your work and make a nice SDL wrapper, later send us a pull request and we'll gladly accept it (but eventually we'll put these libraries into their own repositories, once we have a dependency manager like bundler).

About the changes in this pull request: `__DIR__` is the same as `File.dirname(__FILE__)`, only shorter and more efficient:

* `__DIR__` is a string literal containing the directory name where the current file is located, so this is computed at compile-time, not runtime
* Since `__DIR__` is a string literal and we are interpolating it, there's actually no need to interpolate anything and the compiler joins all the string pieces for you. In the end, writing `#{__DIR__}/something` is exactly the same as hardcoding the full path without any computation done at runtime :-)