multiscale / muscle3

The third major version of the MUltiScale Coupling Library and Environment
Apache License 2.0
25 stars 13 forks source link

Improve Message construction syntax #155

Closed maarten-ic closed 1 year ago

maarten-ic commented 1 year ago

Fixes #146, #125

Update Python examples to use Message(t, data=...) instead of Message(t, None, ...)

maarten-ic commented 1 year ago

@LourensVeen Please decide if we should do something with the C++ warning: Class 'Message' has a constructor with 1 argument that is not explicit.

LourensVeen commented 1 year ago

Hmm. instance.send(10.0) looks like we're sending the value 10.0, but it would actually send an empty Message with a timestamp at 10.0. That's really unintuitive. If we make it explicit, people would have to write instance.send(Message(10.0)), which to be honest doesn't look much better. On the other hand, C++ doesn't have named arguments, so there's not much we can do about that.

Ah, but in a real model, it would actually read instance.send(t_cur) or something, which would make it clearer that it's a timestamp. So it's between that and instance.send(Message(t_cur)).

Kind of a toss-up, but I think explicit is better than implicit, so the BDFL is going to pronounce that the constructor should be explicit and the users should write instance.send(Message(t_cur)). Make sense?