Re: boolean over multiple variables

2010-01-26 Thread Bill Baxter
On Tue, Jan 26, 2010 at 6:16 PM, Nick Sabalausky wrote: >>"Bill Baxter" wrote in message >>news:mailman.34.1264542189.4461.digitalmars-d-le...@puremagic.com... >>On Tue, Jan 26, 2010 at 1:21 PM, bearophile >>wrote: >>> Nick Sabalausky: Aside from that being how Python does it, why do you se

Re: boolean over multiple variables

2010-01-26 Thread Rainer Deyke
bearophile 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 integer arrays > is quite longer than 30-50 items, pe

Re: boolean over multiple variables

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

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 fro

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: 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 d

Re: boolean over multiple variables

2010-01-26 Thread Nick Sabalausky
"bearophile" 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, but until you

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; void

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() { t

Re: boolean over multiple variables

2010-01-26 Thread Bill Baxter
On Tue, Jan 26, 2010 at 1:21 PM, bearophile 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 integer arrays is qu

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 f

Re: boolean over multiple variables

2010-01-26 Thread BCS
Hello Nick, "Pelle Månsson" 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 preferable? I see b

Re: boolean over multiple variables

2010-01-26 Thread Nick Sabalausky
"Pelle Månsson" 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 preferable? I see both ar

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 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 lik

Re: boolean over multiple variables

2010-01-26 Thread Pelle Månsson
On 01/26/2010 01:02 AM, Nick Sabalausky wrote: "strtr" 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 || var == d) i