Re: glm::length(glm::vec) and glm::vec::length (and naming choice by kronos)

Hello list, Groovounet,

I have been debating the same thing as the guy who posted here: 180191-glm-length(glm-vec)-and-glm-vec-length

and how to avoid problems in our projects related to using the member function length(), as intuitively many users are going to assume this is the same as glm::length( vec ). I realize it is now part of the GLSL standard, but my question is why did they choose this name? Why not size(), like the STL standard? Or even a sizeof( vec ) method, which seems to me to be more in line with the the rest of GLSL’s functional style. Perhaps I should be asking this on some khronos forum, but I’m not sure which one is most appropriate.

As an aside, I was going to ask if it were possible to add a compile time flag to disable the length() member functions, but I see this would be difficult because it is used in the implementations.

Thanks for your time,
Rich

[QUOTE=reakin;1260991]Hello list, Groovounet,

I have been debating the same thing as the guy who posted here: 180191-glm-length(glm-vec)-and-glm-vec-length

and how to avoid problems in our projects related to using the member function length(), as intuitively many users are going to assume this is the same as glm::length( vec ). I realize it is now part of the GLSL standard, but my question is why did they choose this name? Why not size(), like the STL standard? Or even a sizeof( vec ) method, which seems to me to be more in line with the the rest of GLSL’s functional style. Perhaps I should be asking this on some khronos forum, but I’m not sure which one is most appropriate.

As an aside, I was going to ask if it were possible to add a compile time flag to disable the length() member functions, but I see this would be difficult because it is used in the implementations.

Thanks for your time,
Rich[/QUOTE]

Probably that was totally arbitrary. “length” also appears here and there in the OpenGL API specification and that’s pretty much inconsistent.

For GLM, I haven’t done it yet but this is something being considered for 0.9.6.

Thanks,
Christophe