Closed findmyway closed 4 years ago
I think get_
is not very Julian.
It is much more elegant to be able to call state(env)
than get_state(env)
. I agree that sometimes it is annoying but I personally think it is worth it. In the example you gave I would typically use
s
as a variable name. Also batch.state
could be state(batch)
. On other Julia project, I found that relying on fieldnames was harming composition with other packages.
Though I use C# & Java a lot at work. I hate the
get/set
stuff 😠 . But in some cases, I find they reduce some naming headaches.Let's say we want to define a
state(env)
function to get state from an environment. Butstate
itself is just a noun and people (including me) may writeAnd the similar goes for
actions
and some other methods.XRef: https://github.com/JuliaReinforcementLearning/CommonRLInterface.jl/issues/8#issuecomment-645645483
👍 = add
get_
prefix 👎 = withoutget_
prefix