Can anyone explain in simple terms what the hell "Reflection" is supposed to be?
Professor was too lazy to teach properly.
Name:
Anonymous2008-11-24 19:06
ENTERPRISEself-modifying code
Name:
Anonymous2008-11-24 19:08
Reflection sends you to the weird and wonderful world behind the looking glass. Going the other way is called reification, making you real again.
Name:
Anonymous2008-11-24 21:01
Reflection is what LISP had since the very beginning.
It's when your program can have access to its own internal structures.
Name:
Anonymous2008-11-24 21:32
Rad SICP.
Name:
Anonymous2008-11-24 22:03
Reflect on your knowledge, young grasshopper, before you attempt to venture forth into reflection.
Name:
Anonymous2008-11-25 0:55
emax
Name:
Anonymous2008-11-25 2:16
The laws of physics aren't physical objects themselves; the type int is not an integer. Similarly, the rules and entities of a programming language that determine how programs work are not values in those programs. Reflection crosses that border by introducing objects that represent concepts from a higher level, providing a program with knowledge about the language it's in and itself. Examples: Reflection could let a program ask values for their types or for operations defined on them, or it could let a program manipulate its own symbol table.
Name:
Anonymous2008-11-25 2:22
>>8
What if you were building a debugger, or a code obfuscator?
Name:
Anonymous2008-11-25 8:05
Not OP - but, example of what reflection is used for?
>>10
In general, any run-time binding of code -- frex, to make a plug-in, where you inform your code of the new library, and it interrogates it for types that it is interested in (e.g. find all public concrete types implementing interface IMyPlugIn, which have default constructors), which your app can then use.
You could create a reusable component that takes any kind of object, iterates over all the properties of that object, and displays the name of the property and its value to the user.
At runtime the executing code doesn't care about what your objects property names are. It is of no use to the executing code. With reflection, at runtime you can get those names and the properties values by name.
>>14
The disassembly wouldn't have symbol names, unless the debug symbol table is present. But even so, it wouldn't be accessible from the program, not by direct means anyway.
HIBT?
Um, to answer the OP's question in an over-simplified manner, it's when you can get the type of a variable as a string or something where the program itself can use it. It's an ugly hack, you should only use it for debugging and use the polymorphic capabilities of your language instead.
Name:
Anonymous2008-11-26 19:17
The pleasure of being cummed inside
Name:
Anonymous2008-11-26 19:32
>>19 over-simplified manner
You should have stopped there. Variable types? What the fuck, man, what the fuck?
Name:
Anonymous2008-11-26 21:02
Reflection: You get what you ask for.
Name:
Anonymous2008-11-27 2:47
Reflection: when a monkey looks in a mirror, no philosopher looks out.
Name:
Anonymous2008-11-27 3:55
Reflection: the change in direction of a wavefront at an interface between two different media so that the wavefront returns into the medium from which it originated.
Name:
Anonymous2008-11-27 4:12
Reflection: what you see is what you've got.
Name:
Anonymous2008-11-27 4:30
>>21
Um, it's called RTTI. Learn about it. Thank you.
Reflection is serious thought or consideration : he doesn't get much time for reflection. An idea about something, esp. one that is written down or expressed.
In software, a program that can query its own structure.
for (Method each : self.getClass().getMethods()) {
System.out.println(each.getName());
}
The ability to change its own structure at runtime is called HOT CODE SWAPPING.
x := Class new.
x superclass: Class.
x methodDictionary: MethodDictionery new.
x setFormat: Class format.
x primitiveChangeClassTo: oroboros basicNew.
[ x class = oroboros ] assert.
Name:
Anonymous2008-11-27 15:53
>>26
No, it's called "If type information were the sum total of reflection no one would want it."
The Sussman Awesome b The Ginger who that kid who did nothing great c Leah Culver she is terrible at programming d RMS how does he break down in tears and run as fast to compile besides.