New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C#: Public method should be started with a capital letter #1664
Comments
Mogre used a custom wrapper generator, which was tailored to Ogre and thus allowed to generate idiomatic C# code. On the other hand, we now use SWIG which also handles Python and Java for us and is Ogre agnostic. Therefore the generated bings read just like C++ - this is also true for Python and Java BTW. This does not mean, that the situation cannot be improved. I am sure one can achieve most of these things with SWIG as well. However, I do not use C# at all right now, so for one I dont know how idiomatic code should look like and this is not a priority for me. Feel free to dig into the SWIG docs and open a PR: http://www.swig.org/Doc3.0/SWIGDocumentation.html |
alright, can you guys upgreade the Mogre Wrapper? |
on the other hand, the Microsoft Guidlines advise against capitalizaton: properites have to be declared manually using
https://github.com/swig/swig/blob/master/Lib/typemaps/attribute.swg but would work in other languages like Python too. |
no. we use SWIG now. |
@AndreKamplingORGADATA as a active user of the C# bindings, what is your view on "Capitalization of Public Methods"? On the one hand, it would make code more C# like and more compatible with old MOGRE code - on the other hand it will break your code and violates the MS interop guidelines. |
@paroj Another thing, |
In our company we follow the Naming Guidelines from Microsoft when it comes to C#. From my personal opinion I like the "Native interoperability best practices" @paroj have posted. But if you see code with other naming conventions it's immediately clear that it's interop code. Breaking standards is not a nice thing, but I think the pros outweight the cons. Another thing beside capitalization are properties. You have no properties in C++. But if argue, keep it as it is, you should leave a getter method a method and not convert it into a property. Another view would be that the Swig wrapper hides the interoperability and therefore the regular naming guideline of the C# language would apply. But in my opinion the interoperability border begins where the "real" C# code begins, where we call the wrapper functions. A colleague of mine argues differently, by saying the interoperability border is where the language change. In summary, in my opinion |
I think the most important thing is that SWIG C# is C# code, not C++ code, it looks weird if it doesn't follow the C# guideline, and it is very difficult to switch the codes from Mogre to SWIG C#, if you guys don't change the codes by following the C# guideline. Don't forget that Mogre use |
As I wrote, it's a question about where to draw the border. You will find people aguing pro and other against... |
The methods generated by SWIG should be started with a capital letter
and many things should use Propety to do it rather than use method (For example, getSingleton() should be
Singleton(property)
orInstance(property)
)Can you reference the
Mogre
project?The text was updated successfully, but these errors were encountered: