{"id":680,"date":"2020-04-20T08:52:00","date_gmt":"2020-04-20T14:52:00","guid":{"rendered":"https:\/\/www.great-white-software.com\/blog\/?p=680"},"modified":"2020-04-16T20:19:56","modified_gmt":"2020-04-17T02:19:56","slug":"var-dim-both-or-neither","status":"publish","type":"post","link":"https:\/\/www.great-white-software.com\/blog\/2020\/04\/20\/var-dim-both-or-neither\/","title":{"rendered":"Var, dim, both. Or Neither ?"},"content":{"rendered":"\n<p>Recently there was a blog post on Xojo&#8217;s blog from Wayne Golding about how 2019r2 and newer accept VAR as a keyword to declare a variable. And they still accept the older DIM.<\/p>\n\n\n\n<p>There are some issues with VAR IF you ever have to move your code to an older version. I know a lot of developers of commercial software that have to do this so they can continue to support their clients running older versions of various operating systems. <\/p>\n\n\n\n<p>These people have stayed with the older DIM so they can easily move their code simply.<\/p>\n\n\n\n<p>Adding VAR as a keyword has some issues though. While I agree that VAR is an awful parameter or variable name there is code that has used it that now suddenly won&#8217;t compile.<\/p>\n\n\n\n<p>One thing I asked for was rather than adding a new keyword, with all the issues that can bring, that we just <a href=\"http:\/\/feedback.xojo.com\/case\/56803\">NOT have to put a DIM or VAR<\/a>. Then we could write<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dim foo as integer\nvar bar as double\nd as date<\/code><\/pre>\n\n\n\n<p>In a compiler there is usually a &#8220;grammar&#8221; &#8211; a set of rules  for what the compiler considers valid code and what it doesn&#8217;t. And somewhere in Xojo&#8217;s grammar there is a rule that says a variable declaration has to look a specific way. (This is a wild assed guess on my part not actual code since I do not have the code for this)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>variableDecl :\n      DIM listofVariablesAndTypes\n    | VAR  listofVariablesAndTypes\n<\/code><\/pre>\n\n\n\n<p>and <em>listofVariablesAndTypes<\/em> is additional rules for how to declare one or more variables with default values in a single line. Making this grammar rule<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>variableDecl :\n      DIM listofVariablesAndTypes\n    | VAR  listofVariablesAndTypes\n    | listofVariablesAndTypes<\/code><\/pre>\n\n\n\n<p>(or something like this) would make it so DIM and VAR are not required.<\/p>\n\n\n\n<p>I&#8217;d find it handy.<\/p>\n\n\n\n<p>How about you ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently there was a blog post on Xojo&#8217;s blog from Wayne Golding about how 2019r2 and newer accept VAR as a keyword to declare a variable. And they still accept the older DIM. There are some issues with VAR IF you ever have to move your code to an older version. I know a lot &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.great-white-software.com\/blog\/2020\/04\/20\/var-dim-both-or-neither\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Var, dim, both. Or Neither ?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-680","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/comments?post=680"}],"version-history":[{"count":2,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/680\/revisions"}],"predecessor-version":[{"id":682,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/680\/revisions\/682"}],"wp:attachment":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/media?parent=680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/categories?post=680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/tags?post=680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}