{"id":404,"date":"2012-05-04T20:00:25","date_gmt":"2012-05-04T18:00:25","guid":{"rendered":"http:\/\/misto.ch\/?p=404"},"modified":"2012-05-04T20:00:25","modified_gmt":"2012-05-04T18:00:25","slug":"detecting-and-naming-boolean-parameters","status":"publish","type":"post","link":"https:\/\/misto.ch\/de\/2012\/05\/04\/detecting-and-naming-boolean-parameters\/","title":{"rendered":"Detecting and Naming Boolean Parameters"},"content":{"rendered":"<p>After a <a href=\"https:\/\/groups.google.com\/forum\/#!msg\/scala-internals\/5VhsT3PhcSg\/4TWXKA3XuuUJ\">recent discussion\u00a0on the Scala-Internals mailing list<\/a>\u00a0on the pros and cons of methods that take boolean arguments, the consensus was that they should always be passed as named arguments. The compiler doesn&#8217;t enforce this, so it&#8217;s up to us IDE and tools developers to provide a solution. The code-analysis branch for the Eclipse Scala IDE can now warn you of such boolean arguments that are passed to Scala methods:<\/p>\n<p><a href=\"https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-409\" title=\"unnamed_bool_1\" src=\"https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_11.png\" alt=\"\" width=\"453\" height=\"169\" srcset=\"https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_11.png 453w, https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_11-300x112.png 300w\" sizes=\"auto, (max-width: 453px) 100vw, 453px\" \/><\/a><\/p>\n<p>The warning comes with a quick-fix that inserts the parameter name:<\/p>\n<p><a href=\"https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-406\" title=\"unnamed_bool_2\" src=\"https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_2.png\" alt=\"\" width=\"433\" height=\"197\" srcset=\"https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_2.png 433w, https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_2-300x136.png 300w\" sizes=\"auto, (max-width: 433px) 100vw, 433px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-407\" title=\"unnamed_bool_3\" src=\"https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_3.png\" alt=\"\" width=\"447\" height=\"160\" srcset=\"https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_3.png 447w, https:\/\/misto.ch\/wp-content\/uploads\/2012\/05\/unnamed_bool_3-300x107.png 300w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/a><\/p>\n<p>Of course, the competition isn&#8217;t sleeping either, the IntelliJ Scala plug-in just got a <a href=\"http:\/\/blog.jetbrains.com\/scala\/2012\/05\/04\/new-intentions\/\">bunch of new Intentions<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After a recent discussion\u00a0on the Scala-Internals mailing list\u00a0on the pros and cons of methods that take boolean arguments, the consensus was that they should always be passed as named arguments. The compiler doesn&#8217;t enforce this, so it&#8217;s up to us IDE and tools developers to provide a solution. The code-analysis branch for the Eclipse Scala [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,27],"tags":[28,38],"class_list":["post-404","post","type-post","status-publish","format-standard","hentry","category-infoq","category-scala","tag-code-analysis","tag-scala"],"_links":{"self":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/posts\/404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/comments?post=404"}],"version-history":[{"count":0,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/posts\/404\/revisions"}],"wp:attachment":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/media?parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/categories?post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/tags?post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}