On Tuesday, 17 April 2012 at 05:34:17 UTC, Kapps wrote:
On Monday, 16 April 2012 at 16:53:53 UTC, Walter Bright wrote:
On 4/16/2012 9:40 AM, Jacob Carlborg wrote:
Regardless of how the runtime reflection is generated, by a library or the
compiler, it needs to be available to all types.

Why?

(I can see the point for a dynamic language, but not a static one.)

Because you can't take into consideration every possible use for your code. You have to be liberal, because even ONE class forgetting to enable reflection will completely break someone's entire system. For example, you can't serialize just because ONE random collection forgot to enable reflection. As it is right now, the vast majority of the standard library would have to have reflection enabled because the use case is unknown. This is how it would be for most libraries as well. You don't know where your code will be used when writing a library, so you have to play it safe. Opt out is MUCH better than opt in. People who want reflection understand the costs associated with it. People who want reflection build programs where these costs are acceptable.

That's going WAY overboard. An argument can be made about subclass discovery, but it's pretty darn easy to make every aggregated type of a given reflected class be opted-in automatically and recursively.

Reply via email to