← Back to team overview

kicad-developers team mailing list archive

Re: Miscellaneous stuff

 

On Sun, Apr 28, 2013 at 11:40:07PM -0500, Dick Hollenbeck wrote:
> Client code is simply that which makes calls to an interface, a class user.
> 
> I don't see a problem if an interface is richer than its clients need.

Since you changed the specifications (an angle can be arbitrary) the
client needs to know it too. It's called type contravariance.

Example:
Client uses int, interface was using int. Interface now uses doubles.

- Client get an angle from an object and stores it (incorrectly) in an
  int. Could be useful.
- Client take that angle (which is now truncated) and gives in to
  another object (which expects a double). Perfectly fine.

*However* data was lost in the process. And in C that's a perfectly
legal thing to do (some compiler warns, I don't think gcc does)

So you have to check clients, too.

-- 
Lorenzo Marcantonio
Logos Srl


Follow ups

References