<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx</link><description>[This post is part of a series, " wish-list for future versions of VB "] 
 
 IDEA: Have different syntax for assignment "=" or ":=", versus comparison "==". Currently "=" is used for both. Bill McCarthy writes, "To determine which one it means, you</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#10254633</link><pubDate>Mon, 09 Jan 2012 17:02:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10254633</guid><dc:creator>VBer</dc:creator><description>&lt;p&gt;Www.freeiteducation.com to learn VB&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10254633" width="1" height="1"&gt;</description></item><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#10114569</link><pubDate>Wed, 12 Jan 2011 08:52:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10114569</guid><dc:creator>Shimmy Weitzhandler</dc:creator><description>&lt;p&gt;It&amp;#39;s never gonna happen, we all know that so why waste on explanations, I do think it would be a good idea (potentially this would allow production of the assigned value like in C#, and so implementation of ++x/x++ (dec/inc pre/post) operators).&lt;/p&gt;
&lt;p&gt;But I guess there are things that you can&amp;#39;t just change.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10114569" width="1" height="1"&gt;</description></item><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#9975990</link><pubDate>Wed, 10 Mar 2010 04:06:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9975990</guid><dc:creator>Kyralessa</dc:creator><description>&lt;p&gt;I'm not a fan of this idea. &amp;nbsp;VB is VB, and this is just the way it does assignment and equality. &amp;nbsp;The confusing lambda examples at the beginning aren't, in my opinion, a result of the = serving two purposes, but the poor syntactical way lambda expressions were implementing in VB .NET.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9975990" width="1" height="1"&gt;</description></item><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#9971556</link><pubDate>Tue, 02 Mar 2010 15:53:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9971556</guid><dc:creator>Simon Geering</dc:creator><description>&lt;p&gt;This is one of the things that is doing my nut trying learning C#. If your a VB guy it is just obvious what is meant by = based on the context. &lt;/p&gt;
&lt;p&gt;My vote would be that there is no need for == and =, this is one time to keep things as is.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9971556" width="1" height="1"&gt;</description></item><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#9969204</link><pubDate>Thu, 25 Feb 2010 11:54:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9969204</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;The idea of somehow distinguishing the two types of = via rendering seems good. &amp;nbsp;Perhaps the IDE could simply use different colour-coding for each type of =, but they could continue to be displayed and used as a single = sign as at present.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9969204" width="1" height="1"&gt;</description></item><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#9969201</link><pubDate>Thu, 25 Feb 2010 11:52:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9969201</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;Surely VB is VB and people shouldn't try to alter its syntax to match C#'s or Delphi's.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9969201" width="1" height="1"&gt;</description></item><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#9964022</link><pubDate>Tue, 16 Feb 2010 03:37:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9964022</guid><dc:creator>Kevin Ryall</dc:creator><description>&lt;p&gt;I don’t like inline assignment, but separate operators for assignment and equality would definitely make code more readable – I’ve never liked the VB way of overloading the meaning of the = operator. It’s probably too late to change this now though – even with full backwards compatibility, it would just create confusion.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9964022" width="1" height="1"&gt;</description></item><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#9963340</link><pubDate>Sun, 14 Feb 2010 20:58:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9963340</guid><dc:creator>Đonny</dc:creator><description>&lt;p&gt;My vote FOR inline assignments.&lt;/p&gt;
&lt;p&gt;In fact VB currently treats assignment as statement not as expression. I like the possibility to treat assignment as expression (something that produces value and we can then work with the value.&lt;/p&gt;
&lt;p&gt;Well it might be confusing a little, but this is as well:&lt;/p&gt;
&lt;p&gt;Dim x = a = b&lt;/p&gt;
&lt;p&gt;For compatibility of existing code, we cannot change meaning of the = operator to become assignment in all contexts. I suggest leaving behavior of = unchanged and introducing a new assign operator for inline assignment. The best chois is IMO :=, but I'm afraid it cannot be used because of possible confilicts when passing parameters by name like this:&lt;/p&gt;
&lt;p&gt;Sub DoSomething(ByVal x%)&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;Sub Test()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim x = 5&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;DoSomething(x := 7) 'What does it mean?&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;So, we can introduce other operator like &amp;quot;&amp;lt;-&amp;quot;.&lt;/p&gt;
&lt;p&gt;To avoid confusion, we can also introduce a new operator for comparison ==.&lt;/p&gt;
&lt;p&gt;Maybe we can also introduce a new operators === and !== (or &amp;lt;!&amp;gt; or &amp;lt;&amp;lt;&amp;gt;&amp;gt; ? ;see JavaScript or PHP).&lt;/p&gt;
&lt;p&gt;Dim a$ = &amp;quot;&amp;quot;&lt;/p&gt;
&lt;p&gt;Dim b$ = Nothing&lt;/p&gt;
&lt;p&gt;Dim c = a = b 'Dim c As Boolean = True&lt;/p&gt;
&lt;p&gt;Dim c = a == b 'True&lt;/p&gt;
&lt;p&gt;Dim c = a === b 'False&lt;/p&gt;
&lt;p&gt;Dim c = a &amp;lt;- b ' a = b : Dim c As String = Nothing&lt;/p&gt;
&lt;p&gt;'Late binding:&lt;/p&gt;
&lt;p&gt;Dim xc As Object = &amp;quot;x&amp;quot;c&lt;/p&gt;
&lt;p&gt;Dim xs As Object = &amp;quot;x&amp;quot;&lt;/p&gt;
&lt;p&gt;Dim c = xc = xs 'True&lt;/p&gt;
&lt;p&gt;Dim c = xc == xs 'True&lt;/p&gt;
&lt;p&gt;Dim c = xc === xs 'False&lt;/p&gt;
&lt;p&gt;Dim c = xc &amp;lt;&amp;gt; xs 'False&lt;/p&gt;
&lt;p&gt;Dim c = xc &amp;lt;!&amp;gt; xs 'True&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9963340" width="1" height="1"&gt;</description></item><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#9963076</link><pubDate>Sat, 13 Feb 2010 12:51:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9963076</guid><dc:creator>MarkJ</dc:creator><description>&lt;p&gt;No inline assignment please, it causes too many bugs due to it being misread. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9963076" width="1" height="1"&gt;</description></item><item><title>re: Req7: Have separate syntax for assignment "=" and comparison "=="</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/12/req7-have-separate-syntax-for-assignment-and-comparison.aspx#9963005</link><pubDate>Sat, 13 Feb 2010 04:17:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9963005</guid><dc:creator>Jonathan Allen</dc:creator><description>&lt;p&gt;Thank you! &lt;/p&gt;
&lt;p&gt;I know it may seem odd to be grateful for not getting a feature, but mixing assignments and expressions is just begging for trouble.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9963005" width="1" height="1"&gt;</description></item></channel></rss>