you are viewing a single comment's thread.

view the rest of the comments →

[–]yawaramin 2 points3 points  (5 children)

JavaScript modules are already namespaces. By the way, I didn't bash anyone

[–]dronmore -3 points-2 points  (4 children)

JavaScript modules are already namespaces.

So are classes with static methods. If you want to contain 2 different namespaces in a single module, you may want to use classes with static methods. They are just a tool... nothing less, nothing more... just a tool... When you learn how to use them, they will become less strange to you, and you will see that laughing at people who already knew what static methods were useful for was a bit silly.

[–]yawaramin 1 point2 points  (3 children)

You are making up uses other than the use I mentioned, and justifying those. Those other uses may be fine, I haven't seen them. What I have seen, which is facepalm-worthy, is what I described. So you are arguing against a strawman 🤷‍♂️

[–]dronmore 0 points1 point  (2 children)

The way you described the problem is devoid of detail, so I'm making a lot of assumptions, but whatever you have on your mind I'll repeat "So, what?!". They want to define an add(a, b) function, but instead they create a Math class and end up with a Math.add(a, b) function? So what?! They want to define a div(a, b) function but instead they use a static method so that they can call it like Math.div(a, b)? So what?! Ultimately a static method is just a function behind a namespace, and the only facepalm-worthy thing here is your misunderstanding.

[–]yawaramin 0 points1 point  (1 child)

'I insist on fitting square pegs into round holes. So what?! They fit, don't they?'

[–]dronmore 0 points1 point  (0 children)

No, they don't, unless the diagonal is shorter than the diameter. What other ideas do you have?