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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Jun 6 13:31:17 EDT 2014

I think we can get them in this sense: 

> > (arity-includes? (procedure-arity (case-lambda [(x) x][(x y) x][(x y z) x])) 1)
> #t
> > (arity-includes? (procedure-arity (case-lambda [(x) x][(x y) x][(x y z) x])) 3)
> #t
> > (arity-includes? (procedure-arity (case-lambda [(x) x][(x y) x][(x y z) x])) 4)
> #f

but I agree that it is of questionable value. -- Matthias





On Jun 6, 2014, at 1:23 PM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:

> On 2014-06-06 06:31:27 +0100, Matthew Flatt wrote:
>> Sorry for being so late to the discussion, but I agree that something
>> like `class-constructor-arity` and `class-constructor-arity-includes?`
>> should be added to `racket/class`.
> 
> Are those even possible to implement?
> 
> After all, I can construct a class that has 2 init arguments on
> Wednesday and has 3 on Friday (by checking the date and then using
> different `super-new` calls in the branches).
> 
> Cheers,
> Asumu



Posted on the users mailing list.