[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Why Ruby doesn't have some xor operator?

Pavel Smerk

8/15/2006 4:22:00 PM

Hello,

#{subj} --- not only (False|True|Nil)Class#^, but some general one, like
the and and or are. May be also ^^ with higher precedence.

P.
4 Answers

Robert Klemme

8/16/2006 9:46:00 AM

0

On 15.08.2006 18:22, Pavel Smerk wrote:
> Hello,
>
> #{subj} --- not only (False|True|Nil)Class#^, but some general one, like
> the and and or are. May be also ^^ with higher precedence.

What semantic do you expect that operator to have? If you want it for
boolean XOR you can do

>> class Object
>> def ^(x) self && !x or !self && x end
>> end
=> nil
>> "roo" ^ false
=> true
>> "roo" ^ true
=> false
>>

Fixnum still works

>> 1 ^ 2
=> 3

Kind regards

robert

Christian Neukirchen

8/16/2006 12:12:00 PM

0

Pavel Smerk <smerk@fi.muni.cz> writes:

> Hello,
>
> #{subj} --- not only (False|True|Nil)Class#^, but some general one,
> like the and and or are. May be also ^^ with higher precedence.

When would that be useful?

> P.
--
Christian Neukirchen <chneukirchen@gmail.com> http://chneuk...

Daniel Martin

8/16/2006 1:12:00 PM

0

Pavel Smerk <smerk@fi.muni.cz> writes:

> Hello,
>
> #{subj} --- not only (False|True|Nil)Class#^, but some general one,
> like the and and or are. May be also ^^ with higher precedence.

I'll note that I find the "and" and "or" operators primarily useful
for the fact that they short-circuit (that is, the right hand side
doesn't get evaluated unless it needs to be) and because they always
return one of their arguments.

Note that neither of those properties can hold with an xor operator.
You obviously can't short-circuit, and secondly what do you return
when both arguments are true? nil or false?

dan dungan

10/1/2008 7:19:00 PM

0

Hi Mike,

A combobox can display multiple columns.

A textbox can hold the data entry.

I'd look here for form design tutorial
http://www.contextures.com/ti...


I search these websites when I need ideas:
http://www.cpearson.com/excel/Mai...
http://spreadshee...

Dan