<div dir="ltr">In TR I mostly see types with a leading capital letter which generally avoids such conflicts.<div><br></div><div><div>#lang typed/racket</div><div><br></div><div>(define-type Coords (Pairof Real Real))</div>
<div style>(define-type Velocity Real)</div><div>(define-type Color (U 'Red 'Blue 'Green))</div><div>(define-type VehicleModel (U 'Ford 'Lada))</div><div><br></div><div>(struct: Vehicle-State ([position : Coords]</div>
<div> [velocity : Velocity]))</div><div><br></div><div>(struct: Vehicle ([state : Vehicle-State]</div><div> [color : Color]</div><div> [model : VehicleModel]))</div>
</div><div><br></div><div style>(define: velocity :Velocity (Vehicle-State-velocity (Vehicle-state v)))</div><div><br></div><div style>Also easier to glance read with cases such as ...</div><div style> (Vehicle-State-state vs)</div>
<div style>(Vehicle-state v)</div><div style><br></div><div style>FWIW I camel-case my types. VehicleState vs. Vehicle-State. </div><div style><br></div><div style><br></div><div style>I've never thought it through but one day I've had a passing thought about the some sort of l-struct macro which creates/associates generics "Lens" getter/setters to the defined structure.<br>
</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 13, 2013 at 3:38 PM, Dmitry Pavlov <span dir="ltr"><<a href="mailto:dpavlov@ipa.nw.ru" target="_blank">dpavlov@ipa.nw.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Danny, I would not treat this problem as similar to<br>
the helper() function name conflict you mentioned.<br>
Having two structures referring to each other<br>
in the same module is a much lesser sin than<br>
having two equally named things in the same module.<br>
<br>
So I would prefer to solve this with a proper naming<br>
convention within a module, rather than putting each<br>
struct inside its own module.<br>
<br>
<br>
Stephen, thanks for the tip about the #:constructor-name.<br>
I think I may use that. Another solution, which just<br>
came to my head, is naming the structure<br>
vehicle/state instead of vehicle-state.<br>
<br>
Best regards,<br>
<br>
Dmitry<br>
<div class="HOEnZb"><div class="h5">____________________<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>