Closed geoffreylitt closed 8 years ago
@Arafatk @chrhansen @sebastiandeutsch would love your thoughts on this PR.
In particular, one minor question I have is how important we think it is to try to match the Python API in the details. As a very small example, I think datatype
might be slightly more Rubyish than dtype
as an argument keyword. But dtype
is used in the Python version, so that might be less surprising for people used to the Python.
My general thought is that it's worth aligning naming with the Python version where possible. I imagine that this would make it easier to do things like copy-paste a Stack Overflow snippet and make fewer changes to get it running in Ruby, which might help adoption. On the other hand, obviously there are going to be significant differences no matter what, and it would be nice for the end result to feel nicely idiomatic to use in Ruby.
I think it all depends how we want to pass the variables and we have two options here:
def variable(name, data, type)
classic variable passing. Here I actually don't care if the variable is named datatype
or dtype
since when I use it I actually only pass the values for it.def variable(data, dtype: nil, name: nil)
here you work with keyword arguments but it means when you call it you have to explicitly name it.I think that 2. is more ruby idiomatic.
If we do 2. I'm also in favour that we name it datatype instead of dtype.
@geoffreylitt First of all, thank you for making this cleaner and more python like. The tests seem nice too.
As for your question, I would recommend that we use naming convention similar to python for simplicity and ease of use. We may not follow this at a few places but mostly following similar naming convention would be convenient for developers.
Thanks
The Python API allows name and datatype as optional parameters when creating a variable or a constant, making these declarations much more concise in typical cases. This changes the Ruby API to take those as optional parameters to more closely mirror the Python.