Avoid partial record accessors #27

Open
opened 2020-05-31 23:32:24 +02:00 by schmittlauch · 0 comments
Owner

Record types with multiple constructors, where some accessor functions only work on some of the constructed values, can fail at runtime: Using the accessor function on a value not holding that attribute throws a RecSelError exception.

A better design is to avoid partial records at all.

Idea for refactoring ActionPayload:

  • use one concrete type per payload variant
  • create a sum type of all variants for referencing the payload in FediChordMessage
Record types with multiple constructors, where some accessor functions only work on some of the constructed values, can fail at runtime: Using the accessor function on a value not holding that attribute throws a `RecSelError` exception. A better design is to avoid partial records at all. Idea for refactoring `ActionPayload`: - use one concrete type per payload variant - create a sum type of all variants for referencing the payload in `FediChordMessage`
schmittlauch added the
refactoring
label 2020-05-31 23:32:24 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: schmittlauch/Hash2Pub#27
No description provided.