<div dir="ltr">Sorry for the private email instead of public, I always seem to miss the reply-all button. I did get it to work, but it felt off. If it were to actually be added to typed racket, it might be better to have some sort of standalone form like (define-type-arg-convention number Number) which lets all your functions assume any arguments named "number" have type Number. Less messy, and you can implement the camel-case default on top of that, while also letting you implement different conveniences. I could also name x y z to be of type Number, or n and m to be of type Natural, without specifically needing the types X Y Z N or M. This might be trickier, but it's definitely doable. Also, I was confused about why my first attempt wasn't working - turns out I messed up my macro and that's what the issue I was having initially was. Typed Racket does indeed expand first and then type-check.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 6:29 PM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
We exchange email off-line and Jack figured out what he wanted. It might be neat to add it to TR.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
On Oct 7, 2014, at 9:24 PM, Alexander D. Knauth wrote:<br>
<br>
><br>
> On Oct 7, 2014, at 2:38 PM, Jack Firth <<a href="mailto:jackhfirth@gmail.com">jackhfirth@gmail.com</a>> wrote:<br>
><br>
>> I read a tweet about someone wistfully wishing there was some sort of "the" operator in a typed non-parensy language such that one could write something like this:<br>
>><br>
>> Customer someFunc(the customer) { ... }<br>
>><br>
>> and have it mean:<br>
>><br>
>> Customer someFunc(Customer customer) { ... }<br>
>><br>
>> Basically, an operator to take care of the common case where the variable name is just the lower-camel-case form of the type. As a Racket fan, I wanted to see if I could do this with a macro in Typed Racket. After some mucking around I had a form that handled the syntax correctly, but I couldn't use it in typed racket because the type checker and type annotations run as macros *before* my macro expands.<br>
><br>
> I thought typed racket expanded first and then type-checks?<br>
><br>
>> As I read further, it seems to be the case that macros in typed racket are a very thorny problem and an area of open research. So is it currently possible to implement a "the" operator like the one shown above in typed racket? And if so, how would it be done?<br>
>> ____________________<br>
>> Racket Users list:<br>
>> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
</div></div></blockquote></div><br></div>