News for hackers. Stuff that matters.
Re:Why static languages suffer from complexity by jim-jim-jim on Wednesday January 19, 2022 @06:34PM (#30002039)
In addition to what others have said about just passing two parameters, there also row types, where the signature of `calculate_price` can be specified to accept any record that has the two required fields.
Re:Why static languages suffer from complexity by mratsim on Thursday January 20, 2022 @04:17PM (#30015172)
Isn't that duck type?
Re:Why static languages suffer from complexity by jim-jim-jim on Friday January 21, 2022 @07:28PM (#30031780)
I don't write Python, but I think row level typing is stricter. Both the names and types of the record fields would have to satisfy the function signature, so the quacking is only honored on field names. Where dynamic languages will of course accept floats where ints are called for, etc, quacking all the way down.

The point of my original comment was to suggest that some of the flexibility offered by duck typing can be achieved in FP, so they should seem similar.

I would still just pass the fields as two parameters.