Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Apr 22, 2019 at 11:50 AM by GeoffreyFreudenberg for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by GeoffreyFreudenberg · Apr 22, 2019 at 02:00 AM · garbage-collectiongcgarbage collectionkeywords

Is it possible to change the definition of '~' from that of a destructor/finalizer and into that of an underscore '_' ?

Hey all. Just kind of a silly question here. I want to use ~ to demarcate my variables, nothing super important, but I did some reading and saw that it's used as a finalizer/deconstructor for garbage collection. It sounds like something I would most likely never use, so I was wondering if it was possible to override the definition of the tilde symbol and change it to be the equivalent of an underscore, so I can put it in front of variables. Is this impossible, or a very bad idea?

Thanks to anyone who can help, or just telling me what a stupid idea it is, haha

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by DiegoSLTS · Apr 22, 2019 at 03:02 AM

That's no possible, you can't replace symbols. I don't know if it's a "bad" idea, but it is really weird trying to modify basic syntax of a language.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Apr 22, 2019 at 03:48 AM 0
Share

Right, in addition to the destructor it's also the unary bitwise not / complement operator. So no, it's definitely not possible. I just wonder for what kind of "demarcating" one would use the ~ character ins$$anonymous$$d of _. They actually look quite similar and can easily be mistaken. So it would counteract the actual goal. What kind of variables do you want to demarcate ? Just give them meaningful names. The only things you may want to distinguish are private vs public variables. I generally use the "old" m_VarName style for private member variables. $$anonymous$$ethod arguments I almost always prefix with an "a" (for argument).

Follow this Question

Answers Answers and Comments

106 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Firebase garbage collection bug, trigger GC manually ? ,Firebase garbage collection bug, trigger GC manually 0 Answers

Questions About Allocations - Arrays - Structs and so on 1 Answer

Windows GC problems... 0 Answers

Is generational garbage collection enabled in Unity 5.5? 1 Answer

how does houses in the nature deal with garbage and other kinds of waste 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges