-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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#: Renames to follow .NET naming conventions #69547
Conversation
57da7d4
to
40b0ecf
Compare
modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/Marshaling.cs
Outdated
Show resolved
Hide resolved
modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotClassNameAttribute.cs
Show resolved
Hide resolved
c347d5c
to
3766159
Compare
ccfd30c
to
4b01ff1
Compare
e7839eb
to
d8cf926
Compare
400d13f
to
b8b25c2
Compare
0385d11
to
a827064
Compare
Renamed C# types and members to use PascalCase and follow .NET naming conventions.
a827064
to
1aceaca
Compare
Thanks! |
It seems a little redundant to me to prefix anything in the Godot namespace with Godot just for the sake of avoiding ambiguity. Perhaps a "using alias directive" would be better suited for avoiding ambiguities like this? While I would likely prefer to use using Godot;
using System;
using GodotObject = Godot.Object; Alternatively, I believe this would also work: using Godot;
using System;
using Object = Godot.Object; |
@Zhersi Adding those aliases for each file is too annoying. And if you happen to forget it, you could be using the wrong class by accident. Additionally, it's about readability as well (it's hard to know which Because of all that, often in our own code I tend to explicitly write godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs Lines 618 to 619 in 47ca2f2
|
@neikeq I agree that having to use aliases for each file can be annoying, which is why I also prefer to explicitly write My main issue is that I find it needlessly verbose (and redundant) to prefix for example I would much rather the Godot prefix be removed, in favor of letting users figure out how to resolve any potential ambiguities on their own. |
I would like to throw my voice into this as well by agreeing with @Zhersi on the matter of redundancy- One potential solution to having to define an alias for each file would be to make use of Global Using Directives. This allows one to define the alias in a single file that will then be used throughout the entire project without having to worry about the redundancy or aliasing: Another potential solution would be to rename |
Thanks for introducing me to "global using directives"! In regards to renaming |
|
I didn't go with I have at least the following issues with global using directives:
Honestly, messing with global aliases in someone else's project just sounds wrong to me. At the end of the day, the redundant naming in |
Thanks for taking the time to respond again @neikeq! I cannot help but ask if something should be renamed just to avoid it having an identical name to something in another namespace. Is not some of the point of namespaces to allow for exactly this to be the case in the first place? Renaming What about other ambiguities such as:
Should these also be renamed (potentially prefixed "Godot")? My personal opinion is that it would be better to revert the names of |
The .NET naming guidelines recommend avoiding type name conflicts (e.g.: 2 types with the same name in different namespaces that are often used together). See the Namespaces and Type Name Conflicts section of the guidelines:
Since the We should also avoid names of types in namespace that are often used together with the For the The only types that I agree should probably also be renamed are About the See the .NET General Naming guidelines:
Therefore, I think since the type represents a Godot Object and not any other kind of Object, it makes sense to me to call it |
Thanks for clarifying @raulsntos! |
my bad... sorry I was wrong :( (deleted old post) System Numerics uses Pascal fields too. |
Godot.Object
toGodotObject
to avoid ambiguity withSystem.Object
.Godot.Thread
toGodotThread
to avoid ambiguity withSystem.Threading.Thread
.Godot.System
toGodot.System_
to avoid ambiguity with theSystem
namespace. We don't define a class namedSystem
but third-party modules could.Renamed Godot structs
AABB
Aabb
Rect2i
Rect2I
RID
Rid
Vector2i
Vector2I
Vector3i
Vector3I
Vector4i
Vector4I
Renamed Godot classes
AESContext
AesContext
AudioStreamWAV
AudioStreamWav
CPUParticles2D
CpuParticles2D
CPUParticles3D
CpuParticles3D
CSGBox3D
CsgBox3D
CSGCombiner3D
CsgCombiner3D
CSGCylinder3D
CsgCylinder3D
CSGMesh3D
CsgMesh3D
CSGPolygon3D
CsgPolygon3D
CSGPrimitive3D
CsgPrimitive3D
CSGShape3D
CsgShape3D
CSGSphere3D
CsgSphere3D
CSGTorus3D
CsgTorus3D
CurveXYZTexture
CurveXyzTexture
DTLSServer
DtlsServer
EditorSceneFormatImporterFBX
EditorSceneFormatImporterFbx
EditorSceneFormatImporterGLTF
EditorSceneFormatImporterGltf
EditorVCSInterface
EditorVcsInterface
EncodedObjectAsID
EncodedObjectAsId
Generic6DOFJoint3D
Generic6DofJoint3D
GLTFAccessor
GltfAccessor
GLTFAnimation
GltfAnimation
GLTFBufferView
GltfBufferView
GLTFCamera
GltfCamera
GLTFDocument
GltfDocument
GLTFDocumentExtension
GltfDocumentExtension
GLTFDocumentExtensionConvertImporterMesh
GltfDocumentExtensionConvertImporterMesh
GLTFLight
GltfLight
GLTFMesh
GltfMesh
GLTFNode
GltfNode
GLTFSkeleton
GltfSkeleton
GLTFSkin
GltfSkin
GLTFSpecGloss
GltfSpecGloss
GLTFState
GltfState
GLTFTexture
GltfTexture
GLTFTextureSampler
GltfTextureSampler
GPUParticles2D
GpuParticles2D
GPUParticles3D
GpuParticles3D
GPUParticlesAttractor3D
GpuParticlesAttractor3D
GPUParticlesAttractorBox3D
GpuParticlesAttractorBox3D
GPUParticlesAttractorSphere3D
GpuParticlesAttractorSphere3D
GPUParticlesAttractorVectorField3D
GpuParticlesAttractorVectorField3D
GPUParticlesCollision3D
GpuParticlesCollision3D
GPUParticlesCollisionBox3D
GpuParticlesCollisionBox3D
GPUParticlesCollisionHeightField3D
GpuParticlesCollisionHeightField3D
GPUParticlesCollisionSDF3D
GpuParticlesCollisionSdf3D
GPUParticlesCollisionSphere3D
GpuParticlesCollisionSphere3D
HMACContext
HmacContext
HTTPClient
HttpClient
HTTPRequest
HttpRequest
InputEventMIDI
InputEventMidi
JNISingleton
JniSingleton
JSON
Json
JSONRPC
JsonRpc
MultiplayerAPI
MultiplayerApi
MultiplayerAPIExtension
MultiplayerApiExtension
Object
GodotObject
ORMMaterial3D
OrmMaterial3D
PacketPeerDTLS
PacketPeerDtls
PacketPeerUDP
PacketPeerUdp
PCKPacker
PckPacker
RDShaderSPIRV
RDShaderSpirV
ResourceUID
ResourceUid
SkeletonModification2DCCDIK
SkeletonModification2DCcdik
SkeletonModification2DFABRIK
SkeletonModification2DFabrik
SkeletonModification3DCCDIK
SkeletonModification3DCcdik
SkeletonModification3DFABRIK
SkeletonModification3DFabrik
StreamPeerGZIP
StreamPeerGZip
StreamPeerTCP
StreamPeerTcp
StreamPeerTLS
StreamPeerTls
TCPServer
TcpServer
Thread
GodotThread
UDPServer
UdpServer
UPNP
Upnp
UPNPDevice
UpnpDevice
VisualShaderNodeCurveXYZTexture
VisualShaderNodeCurveXyzTexture
VisualShaderNodeScreenUVToSDF
VisualShaderNodeScreenUVToSdf
VisualShaderNodeSDFRaymarch
VisualShaderNodeSdfRaymarch
VisualShaderNodeSDFToScreenUV
VisualShaderNodeSdfToScreenUV
VisualShaderNodeTextureSDF
VisualShaderNodeTextureSdf
VisualShaderNodeTextureSDFNormal
VisualShaderNodeTextureSdfNormal
WebRTCDataChannel
WebRtcDataChannel
WebRTCDataChannelExtension
WebRtcDataChannelExtension
WebRTCMultiplayerPeer
WebRtcMultiplayerPeer
WebRTCPeerConnection
WebRtcPeerConnection
WebRTCPeerConnectionExtension
WebRtcPeerConnectionExtension
XMLParser
XmlParser
ZIPPacker
ZipPacker
ZIPReader
ZipReader