operators !=

Aaron J. Seigo aseigo at kde.org
Mon Aug 25 05:47:24 UTC 2014


On Sunday, August 24, 2014 21.04:05 Samuel Gaist wrote:
> Hi,
> 
> There's something I'm currently not understanding about the != operator.
> 
> >From the doc:
>     val x != 3; // new variable x now equals 3
>     x != 3; // x is 3 (from above): success
> 
> That doesn't sound logic to me but I may be missing some background
> knowledge. Can somebody enlighten me ?

It's not you, it's me. That was a copy and paste error on my part.

This is actually one part of the syntax I'm not happy with yet ... '!=' is the 
antonym of '==' which is just '=' in funq; however, '=' is also assignment 
which facilitates pattern matching based assignment which is rather useful.

so if:

	var x = 3; // asigns
	x = 3; // confirms
	(x, var y) = [ 3, 4 ] // assigns 4 to y after confirming element 0 equals x

then to preserve symmetry:

	var x != 3; // assigns 
	x != 4; // confirms
	(x, var y) != [ 5, 4 ] // assigns y after confirming element 0 != x

This is nice and symmetric, but it feels rather more odd than the behavior of 
'=' to me, though I'm unsure if that is just because it is unusual to me or if 
it is really actually flaws in some way.

As usual, opinions / feedback welcome

.. and I'll fix the documentation in the git repository.

Oh, and I didn't get any time this weekend for working on these things; busy 
family weekend. This week is rather more open again though :)

-- 
Aaron J. Seigo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://kde.org/pipermail/funq-devel/attachments/20140825/47918e3f/attachment.sig>


More information about the Funq-devel mailing list