Archive for the 'fantom' Category


find out fantom’s classpath

You can use this command to see what is Fantom’s classpath:

fan compilerJava::ClassPath


from Ruby to Fantom:introspection

Hopefully, you know about the Fantom programming language. It’s an extraordinary language I discovered about 4 days ago. I’m hooked on it. It looks so very similar to Ruby, it’s lightning fast, and you have a lot of fun writing it. Oh … by the way, it’s a mix of static-dynamic typing, so you get compile-time checking. How great is that ?

Anyway, enough with the introduction. Let’s get to the good part:

Let’s assume this Ruby code:

a = "geo,blog"

Sometimes, in the “wild”, you don’t have access to certain object’s docs. Many languages have introspection mechanisms. Ruby and Fantom are two of them. I know that in this case,a is a String, and we kinda know what it’s methods are … but what would we do if we didn’t? Here’s what:

methods = a.methods
methods.each {|m| puts m}

and this will print all of that object’s methods.

Here’s how we’d do the same thing in Fantom:

a := "geo,blog"
Type.of(a).methods.each |m| { echo(m) }

Blog Stats

  • 215,481 hits