Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Is it best practice to access module methods with a dot (.) or the scope resolution operator (::)?
I know both work and I understand the purpose of ::, I would just like to know which to favour when accessing module methods and why.
Note: There is a related question here which goes into this topic, but not into which is better form.
Both work but the Calling Methods docs suggest that you should use :: for namespaces:
You may also use :: to designate a receiver, but this is
rarely used due to the potential for confusion with ::
for namespaces.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I have a Go package that declares and uses some constants in file1.go. Now I add a new file to the package, file2.go, which refers to constants in file1.go.
Would you move the shared constants into a new file, like consts.go, since they don't "belong" to one file or the other? Or do you leave them in file1.go and assume that someone looking at file2.go can use their IDE or editor or grep to locate the shared constants?
Using const.go file is an idiomatic way, see Go standard library.
For example see: math/const.go
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
close() seems to be a reserved keyword for channels. Seems a bit strong to make it a built-in, when it could just be a method on a channel, no? Like when creating and closing a file?
I guess the same could be asked for len()?
close is a function that takes a channel as a parameter. Just like new and make, they are functions, and you can name local variables or functions like them.
Keywords are language constructs like struct, type, if, else ...
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Very basic but can any one tell me what are the new JVM arguments introduces in Java8?
I am not able to find any concrete list over net.
I know about a few of them only (that I got to use), like:
-parameters (for named parameters)
Since the addition of meta-space, these were added (used only a few of them)
InitialBootClassLoaderMetaspaceSize
MaxMetaspaceExpansion
MaxMetaspaceFreeRatio
MaxMetaspaceSize
MetaspaceSize
MinMetaspaceExpansion
MinMetaspaceFreeRatio
UseLargePagesInMetaspace
And one about lambda usage:
-Djdk.internal.lambda.dumpProxyClasses = /Some/Path
I only vaguely know about these two:
MinHeapFreeRatio
MaxHeapFreeRatio
I am absolutely sure there are many more...
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Are there any objects in ruby that don't respond to to_s?
The question isn't meant to ask whether it is possible to create one, which I know can be done by undef_method. Feel free to explain details, including caveats of undefining.
The BasicObject class does not define a to_s method, so any instance of that class would not have a to_s method.
We should never specialize a subclass, since the subclass would not attend to the parent expectation anymore, have a look in the Liskov Substitution Principle.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a project I am working on that is written in Python. The variable/class/function/everything names do not adhere to the Python style guide.
example: a variable might be called myRandomVariable instead of the proper: my_random_variable
My question is, is it worth combing through all the code (around 10,000 lines) to fix all the naming convention problems or should I just say, 'the heck with it -- it works'?
Thanks
Edited to give example
Just because there is a Python style guide, it does not mean that all Python code should adhere to it. The most important thing to consider in a code base is that it's consistent with itself, at LEAST on a per-file basis, preferably across the project!
I would vote for your second option. They are just styles. Everyone will have their own style. You don't need to be in compilance with defined styles to say your product is great.