The Geekiest Hello World

Patrick Jayet
Jun 11, 2009 · 1 min read

Folks, I think that I have found (one of) the geekiest hello world out there. Implemented in Groovy using the dynamic interception of method calls. Here it goes:

class Hello {
Object invokeMethod(String name, Object arguments) {
System.out.println "hello $name!"
}
}
def hello = new Hello()
hello.john()
hello.you()
Which produce the following output:hello john!
hello you!
I suppose the same mechanism can be used with Ruby (and some other dynamic languages).

XRB’s Blog

Random thoughts of a Software Engineer

Patrick Jayet

Written by

Polyglot (FR, DE, EN, ES), polyglot programmer (Java, Groovy, Ruby, Swift, Objective-C, Scala, Python, O’Caml) polyglot methodologist (Scrum, Kanban, Lean).

XRB’s Blog

Random thoughts of a Software Engineer