Fwd: operators !=

Samuel Gaist samuel.gaist at edeltech.ch
Mon Aug 25 09:06:23 UTC 2014


Forgot to reply to the mailing list…

Begin forwarded message:

> From: Samuel Gaist <samuel.gaist at edeltech.ch>
> Subject: Re: operators !=
> Date: 25 août 2014 09:17:03 UTC+02:00
> To: Aaron J. Seigo <aseigo at kde.org>
> 
> 
> On 25 août 2014, at 07:47, Aaron J. Seigo <aseigo at kde.org> wrote:
> 
>> 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.
> 
> You almost got me scared with that one ! :)
> 
>> 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
> 
> So if we expend this thing a bit, it might look like:
> var x != 3; 
> which would be the same as:
> var x = !0x03;
> which would translate to
> var x = 0xFB;
> 
> The final value would have to be corrected in the documentaiton to correspond to the default numeric type.
> 
> Sounds correct ?
> 
>> 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 :)
>> 
> 
> Nice :)



More information about the Funq-devel mailing list