You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/09/01 19:11:15 UTC

[GitHub] [netbeans] mbien commented on pull request #4522: Adding inline type hint for 'var' variables

mbien commented on PR #4522:
URL: https://github.com/apache/netbeans/pull/4522#issuecomment-1234678398

   > I think this moves from a technical review to a philosophical question. I don't think the IDE should make decisions what is "a right way" to code. If a team/person decides, to use `var` without thinking about it and relies on its IDE to read it, it is its decision.
   
   Yes! If the IDE shouldn't make the decision we should keep it disabled by default (it is enabled since NB 15). I approved this PR too - from a technical perspective I have no complains.
   
   "Good defaults" are very important, esp for NetBeans which has traditionally been an IDE which needed only a few clicks before it was ready to go. Having this fairly intrusive hint enabled by default, does already make a decision for the user how var should be used. To not make this decision ahead of time, we should reconsider having this enabled by default at the very least. (and maybe explore better ways how to aid with var-readability problems if there is demand)
   
   if var is used to reduce "ceremony" (again taking the words from the jep), having this inline hint enabled **would make it an anti-feature**. Since it displays the type in the exact situations **where you truly don't care about the type** or want to hide it due to verbosity. While at the same time incentivizing the use in trivial situations, like the `getRoot()` example I gave above where var + inline hint is more verbose than java 8.
   
   The language feature was certainly not implemented with the intention that the IDEs would one day add the type right next to the keyword again (by default) - this negates it's purpose - its there to hide the type.
   
   If a team wants to use it that way, fine, but I don't think this is a good default that is all I am trying to say :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists