[racket] How to get arity of make-object? Found answer

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Tue Jun 10 12:03:41 EDT 2014

On 2014-06-09 11:22:59 +0200, Laurent wrote:
>    Given that it's easy enough to create a /new/ class on Wednesday that has
>    3 arguments instead of 2, doesn't it make sense to constrain a given
>    existing class to have a fixed structure? (just asking)
>
>    Maybe it could also allow for some optimizations.

I agree, it would be nice (especially for contracts & Typed Racket) if
`super-new` calls were only allowed in fixed positions such as the
top-level of a class.

That should also prevent weird dynamic initialization like in my
example. Also, the macro could use that information to record the actual
init arguments in the class so that reflective operations could query
for them.

>    I wonder if such a additional constraint would break anything in the
>    existing code.

It looks like the majority of uses of `super-new` are at the class
top-level in the Racket code base. I bet it would break one or two weird
examples though.

Cheers,
Asumu

Posted on the users mailing list.