[racket] naming structs that are members of other structs

From: Dmitry Pavlov (dpavlov at ipa.nw.ru)
Date: Wed Feb 13 12:47:38 EST 2013


I just figured that there is a thing in Racket coding style
that bothers me from time to time. That thing have never arised
in C-style languages.

Say I want to have a "vehicle" struct. Also, I would like to keep
its physical state in a separate structure. It seems natural
to call it "vehicle-state". Also it seems natural to have a
"state" member in the "vehicle" structure which refers to that
separate structure. Here we go:

(struct vehicle-state
   (position velocity))

(struct vehicle (state color model))

module: duplicate definition for identifier in: vehicle-state

The message is perfectly understandable. Yet the situation seems
common (at least for C++ programmers who switched to Racket),
and it would be good to know what are the common guidelines
to avoid it. Different capitalization in naming? Inheritance?

Best regards,


Posted on the users mailing list.