I've been thinking about various introspection possibilities lately,
partially because I've encountered places where they'd be useful and
partially because it's interesting.

I found module->exports and module->imports which will let me introspect a
module to see what it provides and consumes.  Unfortunately, the returned
values are just symbols and there's apparently no way to use the actual
functions dynamically.  (Short of eval, but that's evil.)

I've asked before and been told that there is no way to modify a namespace
after compilation time.  (In Perl, you can add a function to a remote
namespace like so:  *HTTP::URL::func_name = sub { ... })

Likewise, I haven't had much luck figuring out how to introspect
structures.  I can say (object-name strct) to get the name of the struct,
but I cannot find any way to answer the questions:

    - What are the names of your fields?
    - What are the accessor / mutator functions for your fields? [The
actual function, not just the name]

If this were a thing then I could create nicer printers for structures such
that they labeled their field names or created a representation equivalent
to the creation command.

What about functions?  Is there a way to answer the following questions?:

     - How many arguments do you require?
     - How many values do you return?
     - What is your contract?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to