Re: default '==' on structs

2011-02-03 Thread Lars T. Kyllingstad
On Wed, 02 Feb 2011 17:35:50 +0100, spir wrote: On 02/02/2011 04:20 PM, Lars T. Kyllingstad wrote: On Wed, 02 Feb 2011 15:55:53 +0100, spir wrote: Hello, What are the default semantics for '==' on structs? I ask this because I was forced to write opEquals on a struct to get expected

Re: Accessing this of containing class

2011-02-03 Thread Jacob Carlborg
On 2011-02-03 07:21, Jonathan M Davis wrote: On Wednesday 02 February 2011 21:26:00 Mandeep Singh Brar wrote: Hi, Is there a method to access this reference of the container class from an inner class. i.e. class A { class B { methodM() { callAnotherM(A::this or A.this); } } }

Re: Accessing this of containing class

2011-02-03 Thread Jonathan M Davis
On Thursday 03 February 2011 00:38:08 Jacob Carlborg wrote: On 2011-02-03 07:21, Jonathan M Davis wrote: On Wednesday 02 February 2011 21:26:00 Mandeep Singh Brar wrote: Hi, Is there a method to access this reference of the container class from an inner class. i.e. class A { class

Re: default '==' on structs

2011-02-03 Thread spir
On 02/03/2011 09:09 AM, Lars T. Kyllingstad wrote: On Wed, 02 Feb 2011 17:35:50 +0100, spir wrote: On 02/02/2011 04:20 PM, Lars T. Kyllingstad wrote: On Wed, 02 Feb 2011 15:55:53 +0100, spir wrote: Hello, What are the default semantics for '==' on structs? I ask this because I was forced

Re: higher-order funcs for ranges (with usual interface)

2011-02-03 Thread spir
On 02/03/2011 08:41 AM, Lars T. Kyllingstad wrote: On Wed, 02 Feb 2011 18:38:02 +0100, spir wrote: I guess the only solution would be for the compiler to support a kind of reange type syntax? I'm not sure I understand what you mean here. Perhaps you're looking for something like concepts,

Re: higher-order funcs for ranges (with usual interface)

2011-02-03 Thread Lars T. Kyllingstad
On Thu, 03 Feb 2011 13:05:00 +0100, spir wrote: On 02/03/2011 08:41 AM, Lars T. Kyllingstad wrote: On Wed, 02 Feb 2011 18:38:02 +0100, spir wrote: I guess the only solution would be for the compiler to support a kind of reange type syntax? I'm not sure I understand what you mean here.

std.regex bug? My regex doesn't match what it's supposed to.

2011-02-03 Thread Alex Folland
I'm using std.regex from Phobos 2, which I heard was relatively new. My regex is supposed to match a time to start playback in a game replay's file name (usually user-written). It's very adaptive and works perfectly on http://regextester.com but doesn't match properly with Phobos. I wrote a

Re: higher-order funcs for ranges (with usual interface)

2011-02-03 Thread spir
On 02/03/2011 01:17 PM, Lars T. Kyllingstad wrote: Why the reluctance to use template constraints? They're so flexible! :) I cannot stand the is() idiom/syntax ;-) Dunno why. Would happily get rid of it in favor of type-classes (built eg as an extension to current interfaces). For instance,

Re: Associative array and ranges

2011-02-03 Thread Steven Schveighoffer
On Wed, 02 Feb 2011 05:11:34 -0500, Nrgyzer nrgy...@gmail.com wrote: Hey guys, I have an associative array like this: T[hash_t] myArray; (T means the template type). Is there any chance to cast/convert this array to an indexed array or is it possible to iterate over specific indices? I know

Re: higher-order funcs for ranges (with usual interface)

2011-02-03 Thread Lars T. Kyllingstad
On Thu, 03 Feb 2011 13:53:44 +0100, spir wrote: On 02/03/2011 01:17 PM, Lars T. Kyllingstad wrote: Why the reluctance to use template constraints? They're so flexible! :) I cannot stand the is() idiom/syntax ;-) Dunno why. Would happily get rid of it in favor of type-classes (built eg as

Re: default '==' on structs

2011-02-03 Thread Steven Schveighoffer
On Wed, 02 Feb 2011 11:35:50 -0500, spir denis.s...@gmail.com wrote: On 02/02/2011 04:20 PM, Lars T. Kyllingstad wrote: I think the compiler does a bitwise comparison in this case, meaning that it compares the arrays' pointers instead of their data. Related bug report: Thank you, Lars.

Re: Accessing this of containing class

2011-02-03 Thread Steven Schveighoffer
On Thu, 03 Feb 2011 03:43:43 -0500, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday 03 February 2011 00:38:08 Jacob Carlborg wrote: On 2011-02-03 07:21, Jonathan M Davis wrote: On Wednesday 02 February 2011 21:26:00 Mandeep Singh Brar wrote: Hi, Is there a method to access this

Re: ANSI to UTF8

2011-02-03 Thread teo
On Mon, 31 Jan 2011 17:08:33 +, Janusch wrote: Hello! I'm trying to convert ANSI characters to UTF8 that but it doesn't work correctly. I used the following: void main() { writeln(convertToUTF8(ä)); } string convertToUTF8(string text) { string result;

Re: std.regex bug? My regex doesn't match what it's supposed to.

2011-02-03 Thread Alex Folland
I figured something out, at least. I had forgotten to use backslashes before the hyphens in the [...]s. That makes the matches link together as expected, but it still doesn't make s(ec(ond)?)? match sec like it should. It just matches s. For example, with std.regex, the following regex

Re: Associative array and ranges

2011-02-03 Thread Nrgyzer
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel Nrgyzer: Is there any chance to cast/convert this array to an indexed array or is it possible to iterate over specific indices? I know that there is something like next() for the foreach-statement but when the array contains

Re: std.regex bug? My regex doesn't match what it's supposed to.

2011-02-03 Thread Alex Folland
I figured out the bug. Inside a set of square brackets, \s doesn't match whitespace. It matches s instead. I'm uncertain exactly how the ECMA-262 part 15.10 regular expression specification is meant to handle that situation.

Re: std.regex bug? My regex doesn't match what it's supposed to.

2011-02-03 Thread Stanislav Blinov
03.02.2011 18:03, Alex Folland пишет: I figured out the bug. Inside a set of square brackets, \s doesn't match whitespace. It matches s instead. I'm uncertain exactly how the ECMA-262 part 15.10 regular expression specification is meant to handle that situation. It does match for me:

Re: Associative array and ranges

2011-02-03 Thread Steven Schveighoffer
On Thu, 03 Feb 2011 09:35:44 -0500, Nrgyzer nrgy...@gmail.com wrote: == Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel Nrgyzer: Is there any chance to cast/convert this array to an indexed array or is it possible to iterate over specific indices? I know that there is

Re: Associative array and ranges

2011-02-03 Thread Nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 03 Feb 2011 09:35:44 -0500, Nrgyzer nrgy...@gmail.com wrote: == Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel Nrgyzer: Is there any chance to cast/convert this array to an indexed array or is it

Re: Associative array and ranges

2011-02-03 Thread Steven Schveighoffer
On Thu, 03 Feb 2011 10:41:16 -0500, Nrgyzer nrgy...@gmail.com wrote: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 03 Feb 2011 09:35:44 -0500, Nrgyzer nrgy...@gmail.com wrote: == Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel Nrgyzer: Is there any

Re: std.regex bug? My regex doesn't match what it's supposed to.

2011-02-03 Thread Alex Folland
On 2011-02-03 10:21, Stanislav Blinov wrote: 03.02.2011 18:03, Alex Folland пишет: I figured out the bug. Inside a set of square brackets, \s doesn't match whitespace. It matches s instead. I'm uncertain exactly how the ECMA-262 part 15.10 regular expression specification is meant to handle

Re: Associative array and ranges

2011-02-03 Thread Nrgyzer
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 03 Feb 2011 10:41:16 -0500, Nrgyzer nrgy...@gmail.com wrote: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 03 Feb 2011 09:35:44 -0500, Nrgyzer nrgy...@gmail.com wrote: == Auszug aus

Re: Associative array and ranges

2011-02-03 Thread Stanislav Blinov
03.02.2011 19:34, Nrgyzer пишет: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel This only works if you rarely remove elements (removal in an array is an O(n) operation). -Steve I already thought about using an dynamic array like T[] (which contains all elements that should

Re: std.regex bug? My regex doesn't match what it's supposed to.

2011-02-03 Thread Stanislav Blinov
03.02.2011 19:08, Alex Folland пишет: On 2011-02-03 10:21, Stanislav Blinov wrote: 03.02.2011 18:03, Alex Folland пишет: I figured out the bug. Inside a set of square brackets, \s doesn't match whitespace. It matches s instead. I'm uncertain exactly how the ECMA-262 part 15.10 regular

Re: Associative array and ranges

2011-02-03 Thread Nrgyzer
== Auszug aus Stanislav Blinov (bli...@loniir.ru)'s Artikel 03.02.2011 19:34, Nrgyzer пишет: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel This only works if you rarely remove elements (removal in an array is an O(n) operation). -Steve I already thought about using

Re: Associative array and ranges

2011-02-03 Thread spir
On 02/03/2011 04:29 PM, Steven Schveighoffer wrote: Again, I'm not sure what the point is of starting in the middle of the array. Are you expecting something different from a hashtable? Maybe what he needs is a plain Lisp-like symbol table (in D, an array of (key value) pairs)? Denis --

Re: Associative array and ranges

2011-02-03 Thread spir
On 02/03/2011 04:41 PM, Nrgyzer wrote: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel On Thu, 03 Feb 2011 09:35:44 -0500, Nrgyzernrgy...@gmail.com wrote: == Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel Nrgyzer: Is there any chance to cast/convert this array

Re: default '==' on structs

2011-02-03 Thread Steven Schveighoffer
On Thu, 03 Feb 2011 12:52:28 -0500, spir denis.s...@gmail.com wrote: Side-questions: is it written somewhere dmd interns string literals? If yes, where? Is this supposed to be part of D's spec or an implementation aspect of dmd? String literals are immutable, which means the compiler is

Re: higher-order funcs for ranges (with usual interface)

2011-02-03 Thread spir
On 02/03/2011 02:25 PM, Lars T. Kyllingstad wrote: On Thu, 03 Feb 2011 13:53:44 +0100, spir wrote: On 02/03/2011 01:17 PM, Lars T. Kyllingstad wrote: Why the reluctance to use template constraints? They're so flexible! :) I cannot stand the is() idiom/syntax ;-) Dunno why. Would happily

Re: Accessing this of containing class

2011-02-03 Thread Ary Manzana
On 2/3/11 10:29 AM, Steven Schveighoffer wrote: On Thu, 03 Feb 2011 03:43:43 -0500, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday 03 February 2011 00:38:08 Jacob Carlborg wrote: On 2011-02-03 07:21, Jonathan M Davis wrote: On Wednesday 02 February 2011 21:26:00 Mandeep Singh Brar

Re: Accessing this of containing class

2011-02-03 Thread Jonathan M Davis
On Thursday, February 03, 2011 10:36:29 Ary Manzana wrote: On 2/3/11 10:29 AM, Steven Schveighoffer wrote: On Thu, 03 Feb 2011 03:43:43 -0500, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday 03 February 2011 00:38:08 Jacob Carlborg wrote: On 2011-02-03 07:21, Jonathan M Davis

Re: Accessing this of containing class

2011-02-03 Thread Steven Schveighoffer
On Thu, 03 Feb 2011 13:53:22 -0500, Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday, February 03, 2011 10:36:29 Ary Manzana wrote: On 2/3/11 10:29 AM, Steven Schveighoffer wrote: I have noticed that, is that a bug? I always thought it strange, since outer is a keyword, that you

Re: default '==' on structs

2011-02-03 Thread spir
On 02/03/2011 07:00 PM, Steven Schveighoffer wrote: On Thu, 03 Feb 2011 12:52:28 -0500, spir denis.s...@gmail.com wrote: Side-questions: is it written somewhere dmd interns string literals? If yes, where? Is this supposed to be part of D's spec or an implementation aspect of dmd? String

Re: Associative array and ranges

2011-02-03 Thread Stanislav Blinov
On 02/03/2011 08:01 PM, Nrgyzer wrote: == Auszug aus Stanislav Blinov (bli...@loniir.ru)'s Artikel 03.02.2011 19:34, Nrgyzer пишет: == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel This only works if you rarely remove elements (removal in an array is an O(n) operation).

Re: std.regex bug? My regex doesn't match what it's supposed to.

2011-02-03 Thread Jesse Phillips
Alex Folland Wrote: The problematic string: Guaton_at_9min59sec.WAgame Might I suggest using a simpler regex? It gives the ability to do better error checking/reporting. Instead of adding all the misspellings for minute and second, just capture those locations as words and analyze them

Re: Associative array and ranges

2011-02-03 Thread Stanislav Blinov
On 02/04/2011 01:19 AM, Stanislav Blinov wrote: On 02/04/2011 12:48 AM, bearophile wrote: Stanislav Blinov: Nrgyzer: Ah, okay... I already tried some things with [0..i] ~ [i + 1..$] but there was always an error and I thought, it must be done more simply. There is no possible simplier way