<div dir="ltr"><div>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)<br>

</div><div>Maybe it could also allow for some optimizations.<br><br></div><div>I wonder if such a additional constraint would break anything in the existing code.<br></div><div><br></div>Laurent<br></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Mon, Jun 9, 2014 at 8:33 AM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu" target="_blank">mflatt@cs.utah.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="">At Fri, 6 Jun 2014 13:23:15 -0400, Asumu Takikawa wrote:<br>
> On 2014-06-06 06:31:27 +0100, Matthew Flatt wrote:<br>
> > Sorry for being so late to the discussion, but I agree that something<br>
> > like `class-constructor-arity` and `class-constructor-arity-includes?`<br>
> > should be added to `racket/class`.<br>
><br>
> Are those even possible to implement?<br>
><br>
> After all, I can construct a class that has 2 init arguments on<br>
> Wednesday and has 3 on Friday (by checking the date and then using<br>
> different `super-new` calls in the branches).<br>
<br>
</div>Good point! The `make-object` function doesn't check arities or<br>
argument names in advance; it has to wait to see what a initialization<br>
expressions do.<br>
<br>
I think we could add a function that reports argument information for<br>
simple classes, where "simple" is based on the relevant class<br>
expressions conforming to syntactic constraints. The constraints would<br>
be a simplified (and documented) variant of the constraints that are<br>
currently used to determine whether use-before-definition checks are<br>
needed for accesses of a field's classes.<br>
<br>
Is argument information useful enough to do that?<br>
<div class="HOEnZb"><div class="h5"><br>
____________________<br>
  Racket Users list:<br>
  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></blockquote></div><br></div>