From: matthew@... Date: 2018-03-04T23:26:19+00:00 Subject: [ruby-core:85924] [Ruby trunk Feature#4824] Provide method Kernel#executed? Issue #4824 has been updated by phluid61 (Matthew Kerwin). For what it's worth, I think `__main__` is best, or `main?` if we're moving away from underscores for source-level metacode. "Executable" is such an overloaded term, and "executed" is weird (isn't all code executed?); the convention of a single "main" entry point has been around for a long time now. ---------------------------------------- Feature #4824: Provide method Kernel#executed? https://bugs.ruby-lang.org/issues/4824#change-70779 * Author: lazaridis.com (Lazaridis Ilias) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: ---------------------------------------- The current construct to execute main code looks not very elegant: ~~~ruby if __FILE__ == $0 my_main() # call any method or execute any code end ~~~ With a `Kernel#executed?` method, this would become more elegant: ~~~ruby if executed? #do this #do that my_main() end ~~~ or ~~~ruby main() if executed? ~~~ This addition would not break any existent behaviour. -- https://bugs.ruby-lang.org/ Unsubscribe: