Re: boolean over multiple variables

2010-01-26 Thread Pelle Månsson
On 01/26/2010 01:02 AM, Nick Sabalausky wrote: strtrst...@spam.com wrote in message news:hjd6t1$be...@digitalmars.com... This may be is a very basic question, but is there a way to let me omit a repeating variable when doing multiple boolean operations? if ( var == a || var == b || var == c

Re: boolean over multiple variables

2010-01-26 Thread Robert Clipsham
On 22/01/10 21:55, strtr wrote: This may be is a very basic question, but is there a way to let me omit a repeating variable when doing multiple boolean operations? if ( var == a || var == b || var == c || var == d) if ( var == (a || b || c || d) ) /** * Untested code, it works something

Re: boolean over multiple variables

2010-01-26 Thread bearophile
Pelle MÃ¥nsson: I think in should work for keys in an associative array and for values in a regular array. This is how it works in python. opIn_r for normal arrays is something very natural. One of the very few persons that doesn't like it is Walter. Maybe I can create a small poll to see

Re: boolean over multiple variables

2010-01-26 Thread Nick Sabalausky
Pelle Månsson pelle.mans...@gmail.com wrote in message news:hjmmod$1io...@digitalmars.com... I think in should work for keys in an associative array and for values in a regular array. This is how it works in python. Aside from that being how Python does it, why do you see that as

Re: boolean over multiple variables

2010-01-26 Thread BCS
Hello Nick, Pelle Månsson pelle.mans...@gmail.com wrote in message news:hjmmod$1io...@digitalmars.com... I think in should work for keys in an associative array and for values in a regular array. This is how it works in python. Aside from that being how Python does it, why do you see that

Re: boolean over multiple variables

2010-01-26 Thread bearophile
Nick Sabalausky: Aside from that being how Python does it, why do you see that as preferable? Because: 1) linear searches in an array are damn common. I don't remember the results of my benchmarks, but until your integer arrays is quite longer than 30-50 items, performing a linear search is

Re: boolean over multiple variables

2010-01-26 Thread Bill Baxter
On Tue, Jan 26, 2010 at 1:21 PM, bearophile bearophileh...@lycos.com wrote: Nick Sabalausky: Aside from that being how Python does it, why do you see that as preferable? Because: 1) linear searches in an array are damn common. I don't remember the results of my benchmarks, but until your

Default Delegate Parameter

2010-01-26 Thread Jesse Phillips
For the following code I get the bellow error. I'm wondering if I should be reporting a bug, or if creating default delegates is correctly prevented? .\defltdg.d(10): Error: delegate defltdg.__dgliteral3 is a nested function and cannot be accessed from main import std.stdio; void main() {

Re: Default Delegate Parameter

2010-01-26 Thread BCS
Hello Jesse, For the following code I get the bellow error. I'm wondering if I should be reporting a bug, or if creating default delegates is correctly prevented? .\defltdg.d(10): Error: delegate defltdg.__dgliteral3 is a nested function and cannot be accessed from main import std.stdio;

Re: boolean over multiple variables

2010-01-26 Thread Nick Sabalausky
bearophile bearophileh...@lycos.com wrote in message news:hjnmdl$166...@digitalmars.com... Nick Sabalausky: Aside from that being how Python does it, why do you see that as preferable? Because: 1) linear searches in an array are damn common. I don't remember the results of my benchmarks,

Re: boolean over multiple variables

2010-01-26 Thread bearophile
Nick Sabalausky: I don't see how any of that argues against the idea of making in always operate on the elements and having a different method for checking the keys. I have already done my best with those words, so... :-) AA elements are its keys, that are a set. In Python3 if you have a dict

rt_attachDisposeEvent: the apparent magic behind std.signals

2010-01-26 Thread Gareth Charnock
I was looking at the std.signals code in svn to find out how the magic of the observer class not needing to inherit anything was done and I was somewhat disappointed to see rt_attachDisposeEvent. Is this function standardised or exposed anywhere? I can think of cases where being able to listen

Re: Default Delegate Parameter

2010-01-26 Thread Jesse Phillips
BCS wrote: Hello Jesse, For the following code I get the bellow error. I'm wondering if I should be reporting a bug, or if creating default delegates is correctly prevented? .\defltdg.d(10): Error: delegate defltdg.__dgliteral3 is a nested function and cannot be accessed from main

Re: boolean over multiple variables

2010-01-26 Thread Nick Sabalausky
Bill Baxter wbax...@gmail.com wrote in message news:mailman.34.1264542189.4461.digitalmars-d-le...@puremagic.com... On Tue, Jan 26, 2010 at 1:21 PM, bearophile bearophileh...@lycos.com wrote: Nick Sabalausky: Aside from that being how Python does it, why do you see that as preferable?

Re: boolean over multiple variables

2010-01-26 Thread Bill Baxter
On Tue, Jan 26, 2010 at 6:16 PM, Nick Sabalausky a...@a.a wrote: Bill Baxter wbax...@gmail.com wrote in message news:mailman.34.1264542189.4461.digitalmars-d-le...@puremagic.com... On Tue, Jan 26, 2010 at 1:21 PM, bearophile bearophileh...@lycos.com wrote: Nick Sabalausky: Aside from that being