From: gabriele renzi Date: 2005-07-20T16:20:55+09:00 Subject: Re: Ruby/Rails as a starter language? Hal Fulton ha scritto: > Daniel Amelang wrote: > >>> In Java, classes aren't objects. >> >> >> >> Sorry Hal: >> >> http://java.sun.com/docs/books/tutorial/reflect/class/index.html >> >> I'm also sorry if I am one of may to point this out. Maybe I'll be the >> first... >> >> I mean this in a very friendly way, BTW :) See, that smiley face is so >> I don't get on your bad side. Here's another :p > > > Haha, it takes more than that to get on my bad side. > > My Java is admittedly weak, but my impression is that this > is just reflection -- i.e., there are objects that correspond > to classes even though they aren't classes. > > Am I mistaken? Care to explain better? I can't see the difference from "x is_a object" and "x has an object as representation". Anyway with a Class instance you can do most of the stuff you can do with ruby i.e. querying/calling methods, fields, create objects and so on. You could even create new classes at runtime through custom ClassLoaders. Java's reflection is in no way as fun as ruby but it is quite more powerful than one can first think. Oh, and the funny thing is that using reflection almost kills any static type check ;)