Advent of Code

2015-12-01 Thread Regan Heath via Digitalmars-d
Hi all, Long time since I read/posted here but I saw this and thought it might be good PR for D: http://adventofcode.com/ Should also be fun. Ciao, Regan

Re: 'partial' keyword in C# is very good for project , what's the same thing in D?

2014-11-12 Thread Regan Heath via Digitalmars-d
On Mon, 10 Nov 2014 18:09:12 -, deadalnix wrote: On Monday, 10 November 2014 at 10:21:34 UTC, Regan Heath wrote: On Fri, 31 Oct 2014 09:30:25 -, Dejan Lekic wrote: In D apps I work on I prefer all my classes in a single module, as is common "D way", or shall I call it &q

Re: 'partial' keyword in C# is very good for project , what's the same thing in D?

2014-11-10 Thread Regan Heath via Digitalmars-d
On Fri, 31 Oct 2014 09:30:25 -, Dejan Lekic wrote: In D apps I work on I prefer all my classes in a single module, as is common "D way", or shall I call it "modular way"? Sure, but that's not the point of partial. It's almost never used by the programmer directly, and when it is used

Re: 'partial' keyword in C# is very good for project , what's the same thing in D?

2014-10-29 Thread Regan Heath via Digitalmars-d
On Wed, 29 Oct 2014 07:54:39 -, Paulo Pinto wrote: On Wednesday, 29 October 2014 at 07:41:41 UTC, FrankLike wrote: Hello,everyone, I've written some projects in C#,find the 'partial' keyword is very userful,which lets the auto codes in another single file,my codes are very easy to

Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function

2014-10-20 Thread Regan Heath via Digitalmars-d
On Sun, 19 Oct 2014 10:06:31 +0100, eles wrote: On Wednesday, 15 October 2014 at 14:42:30 UTC, Regan Heath wrote: On Thu, 09 Oct 2014 09:50:44 +0100, Martin Nowak wrote: Would this affect your code? Probably, but I have no D code of any size to care about. Would this change make you to

Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function

2014-10-15 Thread Regan Heath via Digitalmars-d
On Thu, 09 Oct 2014 09:50:44 +0100, Martin Nowak wrote: Would this affect your code? Probably, but I have no D code of any size to care about. Do you think it makes your code better or worse? Better. Is this just a pointless style change? Nope. Anything else? Only what you said in

Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function

2014-10-15 Thread Regan Heath via Digitalmars-d
On Sat, 11 Oct 2014 13:47:55 +0100, Martin Nowak wrote: https://github.com/D-Programming-Language/dmd/pull/4043#issuecomment-58748353 There has been a broad support for this on the newsgroup discussion because this regularly confuses beginners. There are also some arguments against it (par

Re: scope() statements and return

2014-10-08 Thread Regan Heath via Digitalmars-d
On Tue, 07 Oct 2014 14:39:06 +0100, Andrei Alexandrescu wrote: On 10/7/14, 12:36 AM, monarch_dodra wrote: Hum... But arguably, that's just exception chaining "happening". Do you have any examples of someone actually "dealing" with all the exceptions in a chain in a catch, or actually using t

Re: Program logic bugs vs input/environmental errors (checked exceptions)

2014-10-06 Thread Regan Heath via Digitalmars-d
On Mon, 06 Oct 2014 15:48:31 +0100, Jacob Carlborg wrote: On 06/10/14 15:45, Andrei Alexandrescu wrote: Knowledge doesn't have to be by type; just place data inside the exception. About the only place where multiple "catch" statements are used to make fine distinctions between exception types

Re: WAT: opCmp and opEquals woes

2014-07-28 Thread Regan Heath via Digitalmars-d
On Fri, 25 Jul 2014 21:38:33 +0100, Walter Bright wrote: On 7/25/2014 4:10 AM, Regan Heath wrote: Sure, Andrei makes a valid point .. for a minority of cases. The majority case will be that opEquals and opCmp==0 will agree. In those minority cases where they are intended to disagree

Re: WAT: opCmp and opEquals woes

2014-07-28 Thread Regan Heath via Digitalmars-d
On Sat, 26 Jul 2014 05:22:26 +0100, Walter Bright wrote: If you don't want to accept that equality and comparison are fundamentally different operations, I can only repeat saying the same things. For the majority of use cases they are *not* in fact fundamentally different. You're corre

Re: WAT: opCmp and opEquals woes

2014-07-25 Thread Regan Heath via Digitalmars-d
On Fri, 25 Jul 2014 09:39:11 +0100, Walter Bright wrote: On 7/25/2014 1:02 AM, Jacob Carlborg wrote: 3. If opCmp is defined but no opEquals, lhs == rhs will be lowered to lhs.opCmp(rhs) == 0 This is the sticking point. opCmp and opEquals are separate on purpose, see Andrei's posts. Sur

Re: D Users Survey: Primary OS?

2014-05-30 Thread Regan Heath via Digitalmars-d
Windows 7 x64

Re: Allocating a wstring on the stack (no GC)?

2014-05-09 Thread Regan Heath via Digitalmars-d
On Wed, 07 May 2014 19:41:16 +0100, Maxime Chevalier-Boisvert wrote: Unless I'm misunderstanding it should be as simple as: wchar[100] stackws; // alloca() if you need it to be dynamically sized. A slice of this static array behaves just like a slice of a dynamic array. I do need it to

Re: DIP61: redone to do extern(C++,N) syntax

2014-05-02 Thread Regan Heath via Digitalmars-d
On Fri, 02 May 2014 01:22:12 +0100, deadalnix wrote: On Thursday, 1 May 2014 at 10:03:21 UTC, Regan Heath wrote: On Wed, 30 Apr 2014 20:56:15 +0100, Timon Gehr wrote: If this is a problem, I guess the most obvious alternatives are to: 1. Get rid of namespace scopes. Require workarounds in

Re: DIP61: redone to do extern(C++,N) syntax

2014-05-01 Thread Regan Heath via Digitalmars-d
On Thu, 01 May 2014 11:03:21 +0100, Regan Heath wrote: On Wed, 30 Apr 2014 20:56:15 +0100, Timon Gehr wrote: If this is a problem, I guess the most obvious alternatives are to: 1. Get rid of namespace scopes. Require workarounds in the case of conflicting definitions in different

Re: DIP61: redone to do extern(C++,N) syntax

2014-05-01 Thread Regan Heath via Digitalmars-d
On Wed, 30 Apr 2014 20:56:15 +0100, Timon Gehr wrote: If this is a problem, I guess the most obvious alternatives are to: 1. Get rid of namespace scopes. Require workarounds in the case of conflicting definitions in different namespaces in the same file. (Eg. use a mixin template.) I'd pres

Re: DIP61: redone to do extern(C++,N) syntax

2014-04-30 Thread Regan Heath via Digitalmars-d
On Wed, 30 Apr 2014 10:20:22 +0100, Regan Heath wrote: Something else to think about. C# has the same problem and has solved it the following way.. [main.cs] using .. using CSTest_Test1; using CSTest_Test2; namespace CSTest { class Program { static void Main(string[] args

Re: DIP61: redone to do extern(C++,N) syntax

2014-04-30 Thread Regan Heath via Digitalmars-d
On Wed, 30 Apr 2014 05:03:58 +0100, Ola Fosheim Grøstad wrote: Wrong KISS: compiler internals over specification Indeed. I've been a C/C++ developer for ~16 years and I was confused several times reading this thread. The mix of D modules and C++ namespaces is the thing what needs to be k

Re: [OT] from YourNameHere via Digitalmars-d

2014-04-22 Thread Regan Heath via Digitalmars-d
On Thu, 17 Apr 2014 22:32:31 +0100, Steven Schveighoffer wrote: On Thu, 17 Apr 2014 17:29:47 -0400, Nick Sabalausky wrote: On 4/17/2014 8:51 AM, Steven Schveighoffer wrote: Every time I open one of these messages I get a huge pregnant 5-second pause, along with the Mac Beach Ball (hourg

Re: DIP60: @nogc attribute

2014-04-17 Thread Regan Heath via Digitalmars-d
On Wed, 16 Apr 2014 18:38:23 +0100, Walter Bright wrote: On 4/16/2014 8:01 AM, qznc wrote: However, what is still an open issue is that @nogc can be stopped by allocations in another thread. We need threads which are not affected by stop-the-world. As far as I know, creating threads via p

Re: DIP60: @nogc attribute

2014-04-17 Thread Regan Heath via Digitalmars-d
On Thu, 17 Apr 2014 14:08:29 +0100, Orvid King via Digitalmars-d wrote: I'm just going to put my 2-cents into this discussion, it's my personal opinion that while _allocations_ should be removed from phobos wherever possible, replacing GC usage with manual calls to malloc/free has no place in

Re: Poll - How long have you been in D?

2014-04-04 Thread Regan Heath
On Fri, 04 Apr 2014 03:10:14 +0100, dnewbie wrote: Please vote now! http://www.easypolls.net/poll.html?p=533e10e4e4b0edddf89898c5 See also results from previous years: - http://d.darktech.org/2012.png - http://d.darktech.org/2013.png I think we need a 10+ category now too :p R -- Using Ope

Re: protocol for using InputRanges

2014-03-28 Thread Regan Heath
On Fri, 28 Mar 2014 16:04:29 -, Chris wrote: On Friday, 28 March 2014 at 15:49:06 UTC, Regan Heath wrote: On Fri, 28 Mar 2014 14:15:10 -, Chris wrote: Earlier Walter wrote: "I don't like being in the position of when I need high performance code, I have to implem

Re: protocol for using InputRanges

2014-03-28 Thread Regan Heath
On Fri, 28 Mar 2014 16:30:36 -, John Stahara wrote: On Fri, 28 Mar 2014 16:23:11 +, Paolo Invernizzi wrote: On Friday, 28 March 2014 at 09:30:25 UTC, Regan Heath wrote: On Fri, 28 Mar 2014 08:59:34 -, Paolo Invernizzi wrote: For what concern us, everyone here is happy with

Re: protocol for using InputRanges

2014-03-28 Thread Regan Heath
On Fri, 28 Mar 2014 14:15:10 -, Chris wrote: Earlier Walter wrote: "I don't like being in the position of when I need high performance code, I have to implement my own ranges & algorithms, or telling customers they need to do so." I don't think there is a one size fits all. What if c

Re: protocol for using InputRanges

2014-03-28 Thread Regan Heath
On Fri, 28 Mar 2014 08:59:34 -, Paolo Invernizzi wrote: For what concern us, everyone here is happy with the fact that empty *must* be checked prior to front/popFront. This is actually not true. R -- Using Opera's revolutionary email client: http://www.opera.com/mail/

Re: Changing the behavior of the comma operator

2014-03-27 Thread Regan Heath
On Thu, 27 Mar 2014 11:45:50 -, Kagamin wrote: On Thursday, 27 March 2014 at 10:39:58 UTC, Regan Heath wrote: On Wed, 26 Mar 2014 22:02:44 -, Timon Gehr wrote: On 03/26/2014 05:19 PM, H. S. Teoh wrote: int x = 1, 5; // hands up, how many understand what this does

Re: protocol for using InputRanges

2014-03-27 Thread Regan Heath
On Thu, 27 Mar 2014 10:49:42 -, Marc Schütz wrote: On Thursday, 27 March 2014 at 04:17:16 UTC, Walter Bright wrote: On 3/26/2014 7:55 PM, Steven Schveighoffer wrote: OK, but it's logical to assume you *can* avoid a call to empty if you know what's going on under the hood, no? Then at tha

Re: protocol for using InputRanges

2014-03-27 Thread Regan Heath
On Thu, 27 Mar 2014 02:19:13 -, Steven Schveighoffer wrote: if(!r.empty) { auto r2 = map!(x => x * 2)(r); do { auto x = r2.front; ... } while(!r2.empty); } if(r.empty) return; auto r2 = map!(x => x * 2)(r); while(!r2.empty) { auto x = r2.front; ...

Re: protocol for using InputRanges

2014-03-27 Thread Regan Heath
On Thu, 27 Mar 2014 02:44:13 -, Daniel Murphy wrote: "Regan Heath" wrote in message news:op.xdb9a9v354x...@puck.auriga.bhead.co.uk... What guarantees range2 is longer than range1? The isArray case checks explicitly, but the generic one doesn't. Is it a prope

Re: Changing the behavior of the comma operator

2014-03-27 Thread Regan Heath
On Wed, 26 Mar 2014 22:02:44 -, Timon Gehr wrote: On 03/26/2014 05:19 PM, H. S. Teoh wrote: int x = 1, 5; // hands up, how many understand what this does? Nothing. This fails to parse because at that place ',' is expected to be a separator for declarators. Spectacularly pro

Re: protocol for using InputRanges

2014-03-26 Thread Regan Heath
On Wed, 26 Mar 2014 17:32:30 -, monarch_dodra wrote: On Wednesday, 26 March 2014 at 16:55:48 UTC, Regan Heath wrote: On Wed, 26 Mar 2014 16:38:57 -, monarch_dodra Not only that, but it's also a performance criteria: If you are iterating on two ranges at once (think "co

Re: protocol for using InputRanges

2014-03-26 Thread Regan Heath
On Wed, 26 Mar 2014 16:38:57 -, monarch_dodra wrote: On Wednesday, 26 March 2014 at 15:37:38 UTC, Steven Schveighoffer wrote: Yes, but when you know that empty is going to return false, there isn't any logical reason to call it. It is an awkward requirement. -Steve Not only that, bu

Re: protocol for using InputRanges

2014-03-26 Thread Regan Heath
On Wed, 26 Mar 2014 15:37:38 -, Steven Schveighoffer wrote: On Wed, 26 Mar 2014 11:09:04 -0400, Regan Heath wrote: On Wed, 26 Mar 2014 12:30:53 -, Steven Schveighoffer wrote: Gah, I didn't cut out the right rules. I meant the two rules that empty must be called b

Re: protocol for using InputRanges

2014-03-26 Thread Regan Heath
On Wed, 26 Mar 2014 12:30:53 -, Steven Schveighoffer wrote: On Wed, 26 Mar 2014 08:29:15 -0400, Steven Schveighoffer wrote: On Wed, 26 Mar 2014 06:46:26 -0400, Regan Heath wrote: IMO the rules should be something like: - r.empty WILL return false if there is more data available

Re: protocol for using InputRanges

2014-03-26 Thread Regan Heath
On Tue, 25 Mar 2014 23:22:18 -, Walter Bright wrote: On 3/25/2014 2:29 PM, Andrei Alexandrescu wrote: The range instance gets bigger and more expensive to copy, and the cost of manipulating the flag and the buffer is added to every loop iteration. Note that the user of a range can trivia

Re: Should we deprecate comma?

2014-03-25 Thread Regan Heath
On Tue, 25 Mar 2014 13:15:16 -, Timon Gehr wrote: On 03/25/2014 02:08 PM, bearophile wrote: Steve Teale: The only place I have tended to use the comma operator is in ternary expressions bool universal; atq = whatever? 0: universal = true, 42; I classify that as quite tricky code, it'

Re: Should we deprecate comma?

2014-03-24 Thread Regan Heath
On Mon, 24 Mar 2014 11:35:38 -, monarch_dodra wrote: On Monday, 24 March 2014 at 10:57:45 UTC, Regan Heath wrote: On Sun, 23 Mar 2014 20:56:25 -, Andrei Alexandrescu wrote: Discuss: https://github.com/D-Programming-Language/dmd/pull/3399 Would it have any effect on: int *p, q

Re: Should we deprecate comma?

2014-03-24 Thread Regan Heath
On Sun, 23 Mar 2014 20:56:25 -, Andrei Alexandrescu wrote: Discuss: https://github.com/D-Programming-Language/dmd/pull/3399 Would it have any effect on: int *p, q; R -- Using Opera's revolutionary email client: http://www.opera.com/mail/

Re: Should we deprecate comma?

2014-03-24 Thread Regan Heath
On Mon, 24 Mar 2014 02:50:17 -, Adam D. Ruppe wrote: int a = something == 1 ? 1 : something == 2 ? 2 : (assert(0), 0); FWIW I personally find this kind of code horrid. I would re-write to: assert (something == 1 || something == 2); int a = (something == 1 || something ==

Re: Handling invalid UTF sequences

2014-03-21 Thread Regan Heath
On Thu, 20 Mar 2014 22:39:50 -, Walter Bright wrote: Currently we do it by throwing a UTFException. This has problems: 1. about anything that deals with UTF cannot be made nothrow 2. turns innocuous errors into major problems, such as DOS attack vectors http://en.wikipedia.org/wiki/UTF-

Re: Good name for f.byLine.map!(x => x.idup)?

2014-03-19 Thread Regan Heath
On Tue, 18 Mar 2014 15:03:16 -, Dicebot wrote: On Tuesday, 18 March 2014 at 14:57:30 UTC, Regan Heath wrote: Why this fixation on "by"? lines allLines eachLine everyLine R range vs container. I expect file.lines to be separate fully allocated entity that can be assigned

Re: Good name for f.byLine.map!(x => x.idup)?

2014-03-18 Thread Regan Heath
On Mon, 17 Mar 2014 12:38:23 -, bearophile wrote: Dmitry Olshansky: f.lines? There is already a lines in std.stdio (but I don't use it much), search for: foreach (string line; lines(stdin)) Here: http://dlang.org/phobos/std_stdio.html Does this do the same as byLine or does it

Re: Good name for f.byLine.map!(x => x.idup)?

2014-03-18 Thread Regan Heath
On Tue, 18 Mar 2014 14:09:05 -, Dicebot wrote: On Tuesday, 18 March 2014 at 13:49:45 UTC, Steven Schveighoffer wrote: On Sun, 16 Mar 2014 12:58:38 -0400, Andrei Alexandrescu wrote: A classic idiom for reading lines and keeping them is f.byLine.map!(x => x.idup) to get strings instead

Re: Good name for f.byLine.map!(x => x.idup)?

2014-03-18 Thread Regan Heath
On Sun, 16 Mar 2014 16:58:38 -, Andrei Alexandrescu wrote: A classic idiom for reading lines and keeping them is f.byLine.map!(x => x.idup) to get strings instead of the buffer etc. The current behavior trips new users on occasion, and the idiom solving it is very frequent. So what t

Re: Final by default?

2014-03-14 Thread Regan Heath
On Fri, 14 Mar 2014 14:46:33 -, 1100110 <0b1100...@gmail.com> wrote: That's an awful lot of typo opportunities Quick! which one did I change!? Copy/paste. R -- Using Opera's revolutionary email client: http://www.opera.com/mail/

Re: Final by default?

2014-03-14 Thread Regan Heath
On Fri, 14 Mar 2014 10:22:40 -, 1100110 <0b1100...@gmail.com> wrote: On 3/14/14, 4:58, Regan Heath wrote: Maintenance is very slightly better too, IMO, because you add/remove/alter a complete line rather than editing a set of || && etc which can in some cases be a li

Re: Final by default?

2014-03-14 Thread Regan Heath
On Fri, 14 Mar 2014 11:37:07 -, Daniel Murphy wrote: "Walter Bright" wrote in message news:lfu74a$8cr$1...@digitalmars.com... > No, it doesn't, because it is not usable if C introduces any virtual > methods. That's what the !final storage class is for. My mistake, I forgot you'd s

Re: Final by default?

2014-03-14 Thread Regan Heath
On Thu, 13 Mar 2014 21:42:43 -, Walter Bright wrote: On 3/13/2014 1:09 PM, Andrei Alexandrescu wrote: Also let's not forget that a bunch of people will have not had contact with the group and will not have read the respective thread. For them -- happy campers who get work done in D da

Re: Final by default?

2014-03-14 Thread Regan Heath
On Fri, 14 Mar 2014 08:51:05 -, 1100110 <0b1100...@gmail.com> wrote: version (X86 || X86_64 || PPC || PPC64 || ARM || AArch64) { enum RTLD_LAZY = 0x1; enum RTLD_NOW = 0x2; enum RTLD_GLOBAL = 0x00100; enum RTLD_LOCAL = 0x0; }

Re: Philosophy of how OS API imports are laid out in druntime

2014-03-06 Thread Regan Heath
On Thu, 06 Mar 2014 11:40:55 -, Kagamin wrote: It can be a module pragma: pragma(restrictImportTo,"core.sys.posix.ucontext") module ports.linux.ucontext; Good idea, then the platform specific modules can only define the platform specific things. But, it means when maintaining them yo

Re: Philosophy of how OS API imports are laid out in druntime

2014-03-06 Thread Regan Heath
On Thu, 06 Mar 2014 11:17:36 -, Kagamin wrote: On Wednesday, 5 March 2014 at 17:16:34 UTC, Regan Heath wrote: It seems this will satisfy Walter without impacting Sean.. As I understand, the idea is that Sean get little trying to fix posix standard: the only way to check if the code

Re: Philosophy of how OS API imports are laid out in druntime

2014-03-06 Thread Regan Heath
On Wed, 05 Mar 2014 17:55:27 -, Iain Buclaw wrote: On 5 March 2014 17:16, Regan Heath wrote: On Tue, 04 Mar 2014 00:09:46 -, Walter Bright wrote: This is an important debate going on here: https://github.com/D-Programming-Language/druntime/pull/732 It has a wide impact, and so

Re: Philosophy of how OS API imports are laid out in druntime

2014-03-05 Thread Regan Heath
On Tue, 04 Mar 2014 00:09:46 -, Walter Bright wrote: This is an important debate going on here: https://github.com/D-Programming-Language/druntime/pull/732 It has a wide impact, and so I'm bringing it up here so everyone can participate. The disagreement here seems to boil down to

Re: Repost: make foreach(i, a; range) "just work"

2014-02-25 Thread Regan Heath
On Mon, 24 Feb 2014 17:58:51 -, Jesse Phillips wrote: On Monday, 24 February 2014 at 10:29:46 UTC, Regan Heath wrote: No, not good enough. This should just work, there is no good reason for it not to. R I have long since given up believing this should be in the language, I&#

Re: Repost: make foreach(i, a; range) "just work"

2014-02-24 Thread Regan Heath
On Fri, 21 Feb 2014 16:59:26 -, Justin Whear wrote: On Fri, 21 Feb 2014 10:02:43 +, Regan Heath wrote: On Thu, 20 Feb 2014 16:30:42 -, Justin Whear wrote: On Thu, 20 Feb 2014 13:04:55 +, w0rp wrote: More importantly, this gets in the way of behaviour which may be

Re: Repost: make foreach(i, a; range) "just work"

2014-02-24 Thread Regan Heath
On Fri, 21 Feb 2014 19:42:41 -, Jesse Phillips wrote: On Friday, 21 February 2014 at 16:41:00 UTC, Regan Heath wrote: and make this possible too: foreach([index, ]value; range) { } I understand the user interface is simple, but you created 3 statements about how it could be

Re: Repost: make foreach(i, a; range) "just work"

2014-02-21 Thread Regan Heath
On Fri, 21 Feb 2014 15:35:44 -, Jesse Phillips wrote: You've provided 3 schemes to support this feature. This suggest there are several "right" ways to bring this into the language, while you prefer 1 someone may prefer 3. Ignore the 3 schemes they were just me thinking about how what

Re: Repost: make foreach(i, a; range) "just work"

2014-02-21 Thread Regan Heath
On Fri, 21 Feb 2014 14:29:37 -, Steven Schveighoffer wrote: On Fri, 21 Feb 2014 06:21:39 -0500, Regan Heath wrote: On Thu, 20 Feb 2014 17:09:31 -, Steven Schveighoffer wrote: On Thu, 20 Feb 2014 11:07:32 -0500, Regan Heath wrote: Only if the compiler prefers opApply to

Re: Repost: make foreach(i, a; range) "just work"

2014-02-21 Thread Regan Heath
On Thu, 20 Feb 2014 17:09:31 -, Steven Schveighoffer wrote: On Thu, 20 Feb 2014 11:07:32 -0500, Regan Heath wrote: Only if the compiler prefers opApply to range methods, does it? It should. If it doesn't, that is a bug. The sole purpose of opApply is to interact with foreac

Re: Repost: make foreach(i, a; range) "just work"

2014-02-21 Thread Regan Heath
em to think. On Fri, 21 Feb 2014 02:34:28 -, Jesse Phillips wrote: On Thursday, 20 February 2014 at 11:15:14 UTC, Regan Heath wrote: I am posting this again because I didn't get any feedback on my idea, which may be TL;DR or because people think it's a dumb idea and they

Re: Repost: make foreach(i, a; range) "just work"

2014-02-21 Thread Regan Heath
On Fri, 21 Feb 2014 10:02:43 -, Regan Heath wrote: On Thu, 20 Feb 2014 16:30:42 -, Justin Whear wrote: On Thu, 20 Feb 2014 13:04:55 +, w0rp wrote: More importantly, this gets in the way of behaviour which may be desirable later, foreach being able to unpack tuples from

Re: Repost: make foreach(i, a; range) "just work"

2014-02-21 Thread Regan Heath
On Thu, 20 Feb 2014 16:30:42 -, Justin Whear wrote: On Thu, 20 Feb 2014 13:04:55 +, w0rp wrote: More importantly, this gets in the way of behaviour which may be desirable later, foreach being able to unpack tuples from ranges. I would like if it was possible to return Tuple!(A, B) f

Re: Repost: make foreach(i, a; range) "just work"

2014-02-20 Thread Regan Heath
On Thu, 20 Feb 2014 13:04:55 -, w0rp wrote: I don't think this is a good idea. Which part? The initial solution to my initial problem, or one of the 3 schemes mentioned? Say you have a class with range methods and add opApply later. Only the opApply delegate receives a type other t

Re: Repost: make foreach(i, a; range) "just work"

2014-02-20 Thread Regan Heath
On Thu, 20 Feb 2014 12:56:27 -, Marc Schütz wrote: IMO, any change needs to be both backwards-compatible (i.e., it should not only "just work", as you phrased, but existing code should "just keep working"), and forward-compatible, so as not to obstruct any potential improvements of tup

Repost: make foreach(i, a; range) "just work"

2014-02-20 Thread Regan Heath
I am posting this again because I didn't get any feedback on my idea, which may be TL;DR or because people think it's a dumb idea and they were politely ignoring it :p My original thought was that things like this should "just work".. auto range = input.byLine(); while(!range.empty) { rang

Side-Q: GC/ARC/Allocators - How many GC's

2014-02-04 Thread Regan Heath
How many GC's do we get, if we build a D application linking it to a D library statically, or dynamically, or by loading it at runtime? It seems to me, that one thing people really want in this discussion is to be able to select a single allocation strategy for their application, regardless

Re: Should this work?

2014-01-29 Thread Regan Heath
On Wed, 29 Jan 2014 10:42:08 -, Dicebot wrote: On Wednesday, 29 January 2014 at 10:13:44 UTC, Regan Heath wrote: I will go and check in docs in most case if I have not encountered it before. Check each time for every new aliases. I'd hate to have this overhead. Huh? Assumin

Re: Should this work?

2014-01-29 Thread Regan Heath
On Wed, 29 Jan 2014 06:49:30 -, Andrei Alexandrescu wrote: On 1/28/14 3:28 AM, Regan Heath wrote: On Mon, 27 Jan 2014 16:19:54 -, Andrei Alexandrescu wrote: Walter doesn't like writing libraries so when he first defined Phobos' string support he simply took the string fu

Re: Should this work?

2014-01-29 Thread Regan Heath
On Wed, 29 Jan 2014 09:52:01 -, Dicebot wrote: On Tuesday, 28 January 2014 at 11:26:39 UTC, Regan Heath wrote: No, you really don't. If you're writing string code you will intuitively reach for "substring", "contains", etc because you already know these

Re: Should this work?

2014-01-28 Thread Regan Heath
On Mon, 27 Jan 2014 16:19:54 -, Andrei Alexandrescu wrote: On 1/27/14 6:27 AM, Regan Heath wrote: On Sat, 25 Jan 2014 10:15:28 -, Peter Alexander wrote: Special cases are pure evil. There's nothing special about strings in this case. This is a tangent to my suggestion.

Re: Should this work?

2014-01-28 Thread Regan Heath
On Mon, 27 Jan 2014 14:34:30 -, Dicebot wrote: On Monday, 27 January 2014 at 14:27:42 UTC, Regan Heath wrote: On Sat, 25 Jan 2014 10:15:28 -, Peter Alexander wrote: Special cases are pure evil. There's nothing special about strings in this case. This is a tangent

Re: Should this work?

2014-01-27 Thread Regan Heath
On Sat, 25 Jan 2014 10:15:28 -, Peter Alexander wrote: Special cases are pure evil. There's nothing special about strings in this case. This is a tangent to my suggestion. I am arguing for domain specific language (aliases) where sensible, not domain specific functions. If canFind ca

Re: Should this work?

2014-01-24 Thread Regan Heath
On Fri, 24 Jan 2014 08:36:07 -, Stanislav Blinov wrote: On Friday, 24 January 2014 at 08:21:12 UTC, Jacob Carlborg wrote: On 2014-01-23 21:53, Andrei Alexandrescu wrote: I would expect "contains" to take a element and check if it exists in the range. I think "canFind" is just a wei

Re: Should this work?

2014-01-24 Thread Regan Heath
On Thu, 23 Jan 2014 20:53:01 -, Andrei Alexandrescu wrote: On 1/23/14 8:06 AM, Regan Heath wrote: This. Not my position. Rather I am suggesting we identify individual omissions (like std.string.contains) and add an alias. So that people don't have to struggle quite so much

Re: Should this work?

2014-01-24 Thread Regan Heath
On Fri, 24 Jan 2014 08:21:12 -, Jacob Carlborg wrote: On 2014-01-23 21:53, Andrei Alexandrescu wrote: Ionno. Just look at the current morass with https://github.com/D-Programming-Language/phobos/pull/1875. We have two names for the same function "canFind" and "any". Then we want to deprec

Re: Should this work?

2014-01-23 Thread Regan Heath
On Wed, 22 Jan 2014 19:39:14 -, Andrei Alexandrescu wrote: On 1/13/14 4:53 AM, Regan Heath wrote: On Fri, 10 Jan 2014 16:30:12 -, Andrei Alexandrescu wrote: The way I see it one learns a name for an algorithm (low cognitive load) and then uses it everywhere. This is not Go. Sure

Re: Should this work?

2014-01-20 Thread Regan Heath
On Fri, 17 Jan 2014 23:58:04 -, Marco Leise wrote: Am Fri, 17 Jan 2014 21:38:18 +0100 schrieb Marco Leise : Am Mon, 13 Jan 2014 11:40:19 - schrieb "Regan Heath" : > On Fri, 10 Jan 2014 19:47:07 -, H. S. Teoh > wrote: > > > On Sat, Jan 11, 2014 at 02:

Re: Non-null objects, the Null Object pattern, and T.init

2014-01-17 Thread Regan Heath
On Fri, 17 Jan 2014 05:29:05 -, H. S. Teoh wrote: Now, if we modify this sentinel to instead record the location of the code that first initialized it (via __FILE__ and __LINE__ default parameters perhaps), then we can set it up to print out this information at a convenient juncture, so tha

Re: core.sys.windows.windows and TCHAR

2014-01-13 Thread Regan Heath
On Mon, 13 Jan 2014 13:37:54 -, Olivier Pisano wrote: On Friday, 10 January 2014 at 14:02:13 UTC, Regan Heath wrote: IIRC wchar_t is actually UCS-2 (called Multibyte by devenv and various functions) which is a sub-set of UTF-16. So, calling a windows W function with wchar[] could

Re: Should this work?

2014-01-13 Thread Regan Heath
On Fri, 10 Jan 2014 16:30:12 -, Andrei Alexandrescu wrote: On 1/10/14 6:07 AM, Regan Heath wrote: On Fri, 10 Jan 2014 08:16:53 -, Andrei Alexandrescu wrote: On 1/9/14 11:56 PM, Jacob Carlborg wrote: On 2014-01-10 02:34, Manu wrote: Or just alias the functions useful for string

Re: Should this work?

2014-01-13 Thread Regan Heath
On Fri, 10 Jan 2014 19:47:07 -, H. S. Teoh wrote: On Sat, Jan 11, 2014 at 02:14:41AM +1000, Manu wrote: [...] One more, again here to reduce spam... 2 overloads exist: void func(const(char)* str); void func(const(char)[] str); Called with literal string: func("literal"); called with a

Re: core.sys.windows.windows and TCHAR

2014-01-13 Thread Regan Heath
On Sat, 11 Jan 2014 10:04:44 -, Kagamin wrote: On Friday, 10 January 2014 at 00:37:07 UTC, Adam D. Ruppe wrote: I know there's other win32 bindings we can download, but for just the common types, I like to use the built in aliases, and TCHAR, TSTR, etc., are common in copy/pasted MSDN co

Re: Componentizing D's garbage collector

2014-01-10 Thread Regan Heath
On Fri, 10 Jan 2014 09:56:45 -, Joseph Rushton Wakeling wrote: Can you recommend some good background reading for those of us who would love to have some input (or at least insight) to this, but don't yet have the theoretical understanding? IMO, the Microsoft documentation for the C# G

Re: Should this work?

2014-01-10 Thread Regan Heath
On Fri, 10 Jan 2014 08:16:53 -, Andrei Alexandrescu wrote: On 1/9/14 11:56 PM, Jacob Carlborg wrote: On 2014-01-10 02:34, Manu wrote: Or just alias the functions useful for string processing... I agree. It already has some aliases, converting to lower and uppercase. I wouldn't want

Re: Should this work?

2014-01-10 Thread Regan Heath
On Thu, 09 Jan 2014 17:25:13 -, Manu wrote: On 10 January 2014 03:17, Regan Heath wrote: On Thu, 09 Jan 2014 17:15:41 -, Regan Heath wrote: In other words, why can't we alias or wrap the generic routines in std.string What I meant here is why can't we alias o

Re: core.sys.windows.windows and TCHAR

2014-01-10 Thread Regan Heath
On Fri, 10 Jan 2014 00:37:06 -, Adam D. Ruppe wrote: Can we change this to alias wchar instead of char? While this would be a breaking change, the ASCII Windows functions are arguably always wrong to use with D since a D char* is NOT an ascii nor Windows encoded string, so any code i

Re: Should this work?

2014-01-09 Thread Regan Heath
On Thu, 09 Jan 2014 14:07:36 -, Manu wrote: This works fine: string x = find("Hello", 'H'); This doesn't: string y = find(retro("Hello"), 'H'); > Error: cannot implicitly convert expression (find(retro("Hello"), 'H')) of type Result!() to string Is that wrong? That seems to be how

Re: Should this work?

2014-01-09 Thread Regan Heath
On Thu, 09 Jan 2014 17:15:41 -, Regan Heath wrote: In other words, why can't we alias or wrap the generic routines in std.string What I meant here is why can't we alias or wrap the generic routines (from std.range, std.algo.. into aliases/functions) in std.string. R

Re: Windows DMD installer/VisualD still not detecting paths correctly

2014-01-07 Thread Regan Heath
On Sun, 05 Jan 2014 02:30:48 -, Manu wrote: Hmm, so I jigged it so it's able to find mspdb100.dll, but now link.exe complains: "The application was unable to start correctly (0xc07b)." That's weird. DLL load order on windows is a little weird. I suspec that that either mspdb100.dll

Re: readln() returns new line charater

2013-12-30 Thread Regan Heath
On Mon, 30 Dec 2013 13:51:46 -, Jakob Ovrum wrote: On Monday, 30 December 2013 at 12:36:15 UTC, Regan Heath wrote: Cue "empty vs null" theme music.. Empty vs null is not a factor here. It returns a string containing the line terminator(s) for an empty line, but an em

Re: readln() returns new line charater

2013-12-30 Thread Regan Heath
On Sat, 28 Dec 2013 17:42:23 -, Jakob Ovrum wrote: On Saturday, 28 December 2013 at 17:23:30 UTC, Jeroen Bollen wrote: Usually if you're working with a console though the input stream won't exhaust and thus the blocking 'readln' would be a better option, no? The blocking behaviour of

Re: What is the current point to empty/null associative arrays?

2013-12-03 Thread Regan Heath
On Mon, 02 Dec 2013 13:27:32 -, Cooler wrote: Stop hollywaring here. Yeah, we're not. I am simply expressing an opinion and I'm not really interested in the OP issue at this time. R

Re: What is the current point to empty/null associative arrays?

2013-12-02 Thread Regan Heath
On Sat, 30 Nov 2013 04:37:00 -, Peter Alexander wrote: On Friday, 29 November 2013 at 15:55:57 UTC, Regan Heath wrote: On Fri, 29 Nov 2013 09:51:05 -, Peter Alexander wrote: On Friday, 29 November 2013 at 09:39:57 UTC, Cooler wrote: On Friday, 29 November 2013 at 08:48:03 UTC

Re: What is the current point to empty/null associative arrays?

2013-11-29 Thread Regan Heath
On Fri, 29 Nov 2013 09:51:05 -, Peter Alexander wrote: On Friday, 29 November 2013 at 09:39:57 UTC, Cooler wrote: On Friday, 29 November 2013 at 08:48:03 UTC, Chris Cain wrote: On Friday, 29 November 2013 at 08:32:12 UTC, Cooler wrote: ... Try making fill array look more like this:

Re: try/catch idiom in std.datetime

2013-11-19 Thread Regan Heath
On Tue, 19 Nov 2013 03:29:48 -, Michel Fortin wrote: On 2013-11-18 23:42:13 +, "Jonathan M Davis" said: I understand this. The problem is that in some cases, in order to do the check, you have to do all of the work that the function you're trying to protect bad input from has to

Re: DIP 50 - AST macros

2013-11-13 Thread Regan Heath
On Tue, 12 Nov 2013 14:38:43 -, John Colvin wrote: On Tuesday, 12 November 2013 at 13:50:49 UTC, Jacob Carlborg wrote: auto person = Person.where(e => e.name == "John"); Translates to: select * from person where name = 'John' for those of us entirely unfamiliar with linq, what is th

Re: Everyone who writes safety critical software should read this

2013-10-31 Thread Regan Heath
On Tue, 29 Oct 2013 20:38:08 -, Walter Bright wrote: https://news.ycombinator.com/item?id=6636811 I know that everyone is tired of hearing my airframe design stories, but it's obvious to me that few engineers understand the principles of failsafe design. This article makes that abund

Re: Empty VS null array?

2013-10-28 Thread Regan Heath
point... :) On Fri, 25 Oct 2013 12:41:36 +0100, Kagamin wrote: On Monday, 21 October 2013 at 10:33:01 UTC, Regan Heath wrote: null strings are no different to null class references, they're not a special case. True. That's an implementation detail which has no meaning for business

  1   2   3   4   5   >