Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Add shorthand aliases for primitive types #3790

Closed
wants to merge 2 commits into from
Closed

Conversation

ryuukk
Copy link

@ryuukk ryuukk commented Mar 26, 2022

I have them in a personal module, but i am tired of importing that module everywhere

I think having them in object.d is a nice idea, even though i'd like the language to support that out of the box like every other languages out there, but i don't know how to do that, unfortunately

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @ryuukk! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3790"

Copy link
Member

@ibuclaw ibuclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit? Users already know these are fixed sized types, that doesn't need to be made clearer.

@ryuukk
Copy link
Author

ryuukk commented Mar 26, 2022

What's the benefit? Users already know these are fixed sized types, that doesn't need to be made clearer.

It's consistent, less typing, it is clear, and for people who want to learn the language, it's straight forward too, lets you add more types and follow same consistent scheme (cent, SIMD)

@dkorpel
Copy link
Contributor

dkorpel commented Mar 26, 2022

i'd like the language to support that out of the box like every other languages out there

Not C, C#, C++ or Java.

It's consistent, less typing, it is clear, and for people who want to learn the language

Walter has already explained why he's against it: https://forum.dlang.org/post/sq65vr$1huq$1@digitalmars.com

But even if the proposed names are better, introducing synonyms does not make the language easier, because it introduces the question which one to use.

lets you add more types and follow same consistent scheme (cent, SIMD)

No, the current convention of typeNN (e.g. float4) doesn't work with e.g. f32, which results in f324.

@ryuukk
Copy link
Author

ryuukk commented Mar 26, 2022

Not C, C#, C++ or Java.

They are dying languages

Walter has already explained why he's against it

That doesn't mean he is right about it, we can disagree with him

introducing synonyms does not make the language easier, because it introduces the question which one to use.

i can understand that, that is a good point

No, the current convention of typeNN (e.g. float4) doesn't work with e.g. f32, which results in f324.

f32x4

Things would be easier if we could have some sort of global aliases/types like custom object.d

@ryuukk
Copy link
Author

ryuukk commented Mar 30, 2022

Anyone else? i'd rather see this be closed asap if nobody wants it than stay open and me waiting for an opinion

Alternatively i could instead lobby for a way to get global aliases instead (via global module C# global using, or C/C++ PCH ), please let me know

Thanks!

@dkorpel
Copy link
Contributor

dkorpel commented Mar 30, 2022

I'm going to close this because I see no way this gets in like this.

  • The existing names are well-established in D
  • Walter prefers them over the proposed alternative
  • We both agree that having multiple names is bad for everyone

If you still want to pursue this, maybe when ideas for D3 comes up or C/C++/C#/Java are not top 10 languages anymore, feel free to propose this again. I suggest to post in the newsgroup in that case, that's more visible than a pull request discussion.

@dkorpel dkorpel closed this Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants