Classes does not override toString() methods
MichalPem opened this issue · 4 comments
Hi thank you for your work this library.
Please consider overriding toString() methods for useful debugger informations.
Hi Michal,
Sure, what you have in mind?
Hi Giuseppe thank you for response.
Overriding toString method is widely implemented. It provides a simple, convenient mechanism for debugging classes during development. It's also widely used for logging, and for passing informative error messages to Exception constructors and assertions.
(http://www.javapractices.com/topic/TopicAction.do?Id=55)
Current behaviour
Imagine this code
println(Vec2d(0.0,0.0))
current output is
glm.vec2.Vec2d@1fa268de
Expected output
Vect2d [0.0,0.0]
I believe overriding could be done in Vec2t class Vect2d is unfortunately final so I in cant be implemented in overriding class and it is also not possible implement toString() thru extension functions..
Please consider adding function
override fun toString() : String = "Vect2 [$x,$y]"
to Vec2t class (and similar to Vect3)
Let me know if I can help you with that.
Many thanks, Michal
I just pushed
Sorry for the delay but I had other things in the way
Anyway, I also sent you an invitation, so that you can directly test and change if needed
also, we should have something similar for matrices and I was thinking even a println()
method retrieving via reflection the variable name and printing the components.. what do you think?
I'd consider this resolved
If this is not the case, don't hesitate to re-open