Re: [Seed7-users] Object Comparison Broken?
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
|
From: Thomas M. <mer...@gm...> - 2025-11-13 09:24:56
|
Hey Zachary, For struct types the = and <> operators are not automatically defined. If you want these operators you need to define them yourself. E.g.: const func boolean: (in Box: box1) = (in Box: box2) is return box1.x = box2.x and box1.y = box2.y; const func boolean: (in Box: box1) <> (in Box: box2) is return not box1 = box2; This allows that some fields of the struct are not considered for equality. E.g.: In time.s7i the time comparison = does not consider timeZone and daylightSavingTime. Normalizing values before doing the actual comparison would also be an option. I will consider a way to quickly define the simple case where all elements are compared for equality. Best regards Thomas |