Re: POD

2013-01-15 Thread deadalnix
On Saturday, 29 December 2012 at 14:24:41 UTC, Andrei Alexandrescu wrote: On 12/29/12 4:03 AM, Dmitry Olshansky wrote: P.S. I'm starting to hate the special nature of struct constructors: they can't have 0-arguments, now they disallow POD, what next? Yes, constructors should not influence the

Re: Exceptional coding style

2013-01-15 Thread monarch_dodra
On Tuesday, 15 January 2013 at 07:38:01 UTC, Jacob Carlborg wrote: On 2013-01-14 22:40, H. S. Teoh wrote: Stream operators are teh eviil. Overloading << and >> for I/O was a horrible design decision. Operator overloading should be reserved for numeric types. But then again, Stroustrup didn't h

Re: Exceptional coding style

2013-01-15 Thread 1100110
On 01/14/2013 06:13 PM, H. S. Teoh wrote: On Tue, Jan 15, 2013 at 12:57:17AM +0100, Timon Gehr wrote: On 01/15/2013 12:26 AM, mist wrote: [...] - I generally can understand less at once than can possibly fit with 9th font size on 24 inch screen. In my experience, the screen is always too sma

Re: Exceptional coding style

2013-01-15 Thread Mehrdad
On Tuesday, 15 January 2013 at 08:29:59 UTC, monarch_dodra wrote: Just because there is something better today doesn't mean they were a mistake. I'm not sure if they /were/ but they certainly /are/... no? Okay, how many of these streambuf methods are you familiar with? For me that's probabl

Re: Function scope arguments

2013-01-15 Thread deadalnix
On Monday, 14 January 2013 at 17:52:32 UTC, bearophile wrote: Maybe this thread shows the need for some design work, see the comments by Hara: http://d.puremagic.com/issues/show_bug.cgi?id=8695 What's the meaning of "in" function arguments? What are the purposes of "scope" for function argume

Re: Function scope arguments

2013-01-15 Thread bearophile
deadalnix: I still have some trouble to figure out the proper definition of it. And what can't be defined clearly is probably not understood enough to create a feature. While "scope" is probably not the most important feature to work now in D (const/immutable issues, and shared issues are po

Re: Exceptional coding style

2013-01-15 Thread FG
On 2013-01-15 08:24, Tavi Cacina wrote: Am 15.01.2013 01:55, schrieb Stewart Gordon: vec.erase(std::remove(vec.begin(), vec.end(), val), vec.end()); That piece of code is correct. http://en.wikipedia.org/wiki/Erase-remove_idiom All thanks to a terrible naming decision... It's not remove but

Re: Exceptional coding style

2013-01-15 Thread FG
On 2013-01-15 09:29, monarch_dodra wrote: I still prefer "writeln" over "writefln". While writefln issafe, you can still botch the amount of args, and or flag types, in which case writefln will throw. Writeln never throws (due to a code error). What about the argument that a format string makes

Re: Exceptional coding style

2013-01-15 Thread mist
On Monday, 14 January 2013 at 23:48:14 UTC, bearophile wrote: And extra vertical spaces are like semantic formatting tools for plain text - can group related blocks perfectly and speed up reading. The idea of not wasting lines doesn't go against the idea of adding blank lines to create code p

Re: Function scope arguments

2013-01-15 Thread Artur Skawina
On 01/15/13 00:07, Timon Gehr wrote: > 'scope' is supposed to restrict escaping references, but it is not entirely > clear what that means, and how to make it powerful enough. Eg. what if part > of a structure can be freely escaped, such as the contents of an array of > Objects, but not the arra

Re: Exceptional coding style

2013-01-15 Thread Russel Winder
On Mon, 2013-01-14 at 11:24 -0800, Walter Bright wrote: > Quite a nice read on the coding style used in Doom. > > http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code?post=56177550 On the other hand I don't like some parts of the style he is putting forward as good. Go has an

Re: Exceptional coding style

2013-01-15 Thread mist
On Monday, 14 January 2013 at 23:57:18 UTC, Timon Gehr wrote: This generally comes up as an argument in these discussions, but I don't buy it. Not all development is done on a desktop with a huge screen. And even then, there is always something to put on it. What window manager are you using?

Re: Exceptional coding style

2013-01-15 Thread mist
Well, probably I am playing "good vision nazi" here, as 12 font size seems HUGE to me, far beyond the comfort zone.

Re: Exceptional coding style

2013-01-15 Thread Chris
On Tuesday, 15 January 2013 at 10:47:19 UTC, mist wrote: On Monday, 14 January 2013 at 23:48:14 UTC, bearophile wrote: And extra vertical spaces are like semantic formatting tools for plain text - can group related blocks perfectly and speed up reading. The idea of not wasting lines doesn't g

Re: Exceptional coding style

2013-01-15 Thread Artur Skawina
On 01/15/13 00:37, bearophile wrote: > Walter Bright: > >> http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code?post=56177550 > > From the article: > >> [Side note: John Carmack has stated that static analysis tools >> revealed that their common bug was incorrect parameter mat

Re: Exceptional coding style

2013-01-15 Thread Simen Kjaeraas
On 2013-58-15 11:01, Russel Winder wrote: On Mon, 2013-01-14 at 11:24 -0800, Walter Bright wrote: Quite a nice read on the coding style used in Doom. http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code?post=56177550 On the other hand I don't like some parts of the style

Re: Function scope arguments

2013-01-15 Thread deadalnix
On Tuesday, 15 January 2013 at 10:58:17 UTC, Artur Skawina wrote: Different problem - lifetime. One approach would be to disallow escaping them (which in this case includes returning them) unless the compiler is able to do the right - ie the body of the function is available. Somewhat unorthodo

Re: The rfind challenge

2013-01-15 Thread FG
On 2013-01-15 06:51, Andrei Alexandrescu wrote: If r is a forward range but not better, this is rather simple: R rfind(R, E)(R range, E element) { for (;;) { auto ahead = range.save.find(element); if (ahead.empty) return range; range = ahead; } } That

Re: Exceptional coding style

2013-01-15 Thread Artur Skawina
On 01/15/13 12:21, bearophile wrote: > Artur Skawina: > >> Library territory. There's no need to put this in a D compiler. > > One of the threads about possible ways to allow to implement that in library > code: > > http://forum.dlang.org/thread/nxhsgwliuwdgidaou...@forum.dlang.org > > >> Exc

Re: Function scope arguments

2013-01-15 Thread Artur Skawina
On 01/15/13 12:48, deadalnix wrote: > On Tuesday, 15 January 2013 at 10:58:17 UTC, Artur Skawina wrote: >> Different problem - lifetime. One approach would be to disallow escaping >> them (which in this case includes returning them) unless the compiler is >> able to do the right - ie the body of th

Re: The rfind challenge

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 1:31 AM, H. S. Teoh wrote: Hmm. What about introducing a new primitive takeUntil, that returns the initial segment of the range until a given predicate becomes true? Then you could implement rfind thus: auto rfind(alias pred, R)(R range) if (isBidirectionalRang

Internal and external iteration, fibers

2013-01-15 Thread bearophile
The author of the experimental language Magpie is very intelligent (in past I have read a very nice blog post about the unusual bootstrapped type system of Magpie). Here he nicely discusses well known things: http://journal.stuffwithstuff.com/2013/01/13/iteration-inside-and-out/ Reddit thread

Re: The rfind challenge

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 2:20 AM, monarch_dodra wrote: On Tuesday, 15 January 2013 at 05:51:16 UTC, Andrei Alexandrescu wrote: R rfind(R, E)(R range, E element) { for (;;) { auto ahead = range.save.find(element); if (ahead.empty) return range; range = ahead; } } I'd hardly call that an ideal solution >:( Th

Re: The rfind challenge

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 6:53 AM, FG wrote: On 2013-01-15 06:51, Andrei Alexandrescu wrote: If r is a forward range but not better, this is rather simple: R rfind(R, E)(R range, E element) { for (;;) { auto ahead = range.save.find(element); if (ahead.empty) return range; range = ahead; } } That example cre

Re: The rfind challenge

2013-01-15 Thread monarch_dodra
On Tuesday, 15 January 2013 at 12:56:43 UTC, Andrei Alexandrescu wrote: On 1/15/13 2:20 AM, monarch_dodra wrote: On Tuesday, 15 January 2013 at 05:51:16 UTC, Andrei Alexandrescu wrote: R rfind(R, E)(R range, E element) { for (;;) { auto ahead = range.save.find(element); if (ahead.empty) return

Re: Function scope arguments

2013-01-15 Thread bearophile
Artur Skawina: 'lazy' args are already problematic enough. (there's currently no way to mark them as non-escaping, A future "scope lazy" annotation? Bye, bearophile

Re: The rfind challenge

2013-01-15 Thread Timon Gehr
On 01/15/2013 12:53 PM, FG wrote: On 2013-01-15 06:51, Andrei Alexandrescu wrote: If r is a forward range but not better, this is rather simple: R rfind(R, E)(R range, E element) { for (;;) { auto ahead = range.save.find(element); if (ahead.empty) return range;

Re: The rfind challenge

2013-01-15 Thread Timon Gehr
On 01/15/2013 02:30 PM, Timon Gehr wrote: /+pure+/ R tail(R)(R r)out(result){ assert(result=={ auto a=r; a.popFront(); return a; }()); }body{ auto a=r; a.popFront(); return a; } Obviously, this should be /+pure+/ R tail(R)(R r)out(result){

Re: The rfind challenge

2013-01-15 Thread FG
On 2013-01-15 14:30, Timon Gehr wrote: That is buggy too. Thanks for adding the necessary check for element being at position 0.

Re: Exceptional coding style

2013-01-15 Thread Timon Gehr
On 01/15/2013 11:57 AM, mist wrote: Well, probably I am playing "good vision nazi" here, as 12 font size seems HUGE to me, far beyond the comfort zone. It's just preference. I do not have any problems with font size 9.

Re: Transitioning to the new Release Process

2013-01-15 Thread foobar
On Saturday, 12 January 2013 at 12:20:21 UTC, Johannes Pfau wrote: Am Sat, 12 Jan 2013 09:22:27 +0100 schrieb "foobar" : [...] Regarding pull requests targeting master, the current model *is* geared around that. Most contributions _should_ go to master (aka devel) and go through the full pro

Re: Transitioning to the new Release Process

2013-01-15 Thread foobar
On Monday, 14 January 2013 at 10:33:56 UTC, mist wrote: On Saturday, 12 January 2013 at 12:30:05 UTC, Johannes Pfau wrote: Am Fri, 11 Jan 2013 18:54:12 +0100 schrieb "mist" : Short comment about cherry pick - it is only bad in sense that it creates separate untrackable commit with same content

Re: Exceptional coding style

2013-01-15 Thread monarch_dodra
On Tuesday, 15 January 2013 at 13:55:53 UTC, Timon Gehr wrote: On 01/15/2013 11:57 AM, mist wrote: Well, probably I am playing "good vision nazi" here, as 12 font size seems HUGE to me, far beyond the comfort zone. It's just preference. I do not have any problems with font size 9. I do not

Re: Function scope arguments

2013-01-15 Thread Timon Gehr
On 01/15/2013 01:44 PM, Artur Skawina wrote: On 01/15/13 12:48, deadalnix wrote: On Tuesday, 15 January 2013 at 10:58:17 UTC, Artur Skawina wrote: Different problem - lifetime. One approach would be to disallow escaping them (which in this case includes returning them) unless the compiler is ab

Re: Exceptional coding style

2013-01-15 Thread renoX
On Tuesday, 15 January 2013 at 11:43:20 UTC, Simen Kjaeraas wrote: On 2013-58-15 11:01, Russel Winder wrote: On Mon, 2013-01-14 at 11:24 -0800, Walter Bright wrote: Quite a nice read on the coding style used in Doom. http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code?pos

Re: Exceptional coding style

2013-01-15 Thread Artur Skawina
On 01/15/13 14:25, bearophile wrote: > Artur Skawina: > >> You can't both avoid template bloat *and* statically check the arguments. > > In a well designed statically compiled language you don't need to instantiate > templates and let them generate binary code to statically verify a condition.

Re: Function scope arguments

2013-01-15 Thread Artur Skawina
On 01/15/13 15:09, Timon Gehr wrote: > On 01/15/2013 01:44 PM, Artur Skawina wrote: >> On 01/15/13 12:48, deadalnix wrote: >>> On Tuesday, 15 January 2013 at 10:58:17 UTC, Artur Skawina wrote: Different problem - lifetime. One approach would be to disallow escaping them (which in this cas

Re: Exceptional coding style

2013-01-15 Thread dennis luehring
Not really; prettiffiers works for 99% of the code and mess the remaining 1%, that's why it is better to "force" programmers to use one style and not relying on a tool.. ok but one can argue that having an coding standard defined by the community (like design and syntax of D) plus an standard (

Re: Exceptional coding style

2013-01-15 Thread bearophile
Artur Skawina: static assert(checkArgs!A(fmt), "Invalid or unsupported printf args"); A template constraint is better, I think. You can't get any less overhead than this; not even when using a "well designed statically compiled language".< Maybe if you compile that with dmd and you look i

Re: Exceptional coding style

2013-01-15 Thread Russel Winder
On Tue, 2013-01-15 at 15:07 +0100, monarch_dodra wrote: […] > > I do not know of any editor that does not support "ctrl + scroll" > to change the font sizes on the fly. Emacs, VIM,… […] > Your editor's font size should not be statically dictated by a > single number. It depends on whether you

DConf 2013 Call for Submissions: deadline on January 28

2013-01-15 Thread Andrei Alexandrescu
Hello everyone, We're a couple of weeks inside the Call for Submissions for DConf 2013, and so far we have collected a few strong proposals but indeed only a few. I would like to extend an appeal to the talented participants on this newsgroup to consider making a talk proposal. At this point

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 11:23:40AM +0100, FG wrote: > On 2013-01-15 09:29, monarch_dodra wrote: > >I still prefer "writeln" over "writefln". While writefln issafe, you > >can still botch the amount of args, and or flag types, in which case > >writefln will throw. Writeln never throws (due to a code

Re: DConf 2013 Call for Submissions: deadline on January 28

2013-01-15 Thread mist
I'd also like to mention that now video recordings are planned and thus actual audience is a lot wider than just conference visitors.

Re: Exceptional coding style

2013-01-15 Thread mist
On Tuesday, 15 January 2013 at 15:49:34 UTC, Russel Winder wrote: On Tue, 2013-01-15 at 15:07 +0100, monarch_dodra wrote: […] I do not know of any editor that does not support "ctrl + scroll" to change the font sizes on the fly. Emacs, VIM,… […] Your editor's font size should not be statica

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 12:01:46PM +0100, Chris wrote: [...] > The spacing section is exactly the coding style I use, and omitting > the curly braces will rather sooner than later lead to more work. > Also, "a function should only do one thing" has proven to work for > me. Although there might be a

Re: Exceptional coding style

2013-01-15 Thread Artur Skawina
On 01/15/13 16:27, bearophile wrote: > Artur Skawina: > >> static assert(checkArgs!A(fmt), "Invalid or unsupported printf args"); > > A template constraint is better, I think. Not necessarily, if you want helpful error messages. >> You can't get any less overhead than this; not even when using

Re: Function scope arguments

2013-01-15 Thread Timon Gehr
On 01/15/2013 04:03 PM, Artur Skawina wrote: On 01/15/13 15:09, Timon Gehr wrote: On 01/15/2013 01:44 PM, Artur Skawina wrote: On 01/15/13 12:48, deadalnix wrote: On Tuesday, 15 January 2013 at 10:58:17 UTC, Artur Skawina wrote: Different problem - lifetime. One approach would be to disallow

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 03:07:08PM +0100, monarch_dodra wrote: > On Tuesday, 15 January 2013 at 13:55:53 UTC, Timon Gehr wrote: > >On 01/15/2013 11:57 AM, mist wrote: > >>Well, probably I am playing "good vision nazi" here, as 12 font size > >>seems HUGE to me, far beyond the comfort zone. > > > >I

Re: DConf 2013 Call for Submissions: deadline on January 28

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 11:00 AM, mist wrote: I'd also like to mention that now video recordings are planned and thus actual audience is a lot wider than just conference visitors. Thanks! I meant to mention this when starting the message but forgot. It is our opportunity, privilege, and obligation to addre

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 11:56:34AM +0100, mist wrote: > On Monday, 14 January 2013 at 23:57:18 UTC, Timon Gehr wrote: > >This generally comes up as an argument in these discussions, but I > >don't buy it. Not all development is done on a desktop with a huge > >screen. And even then, there is always

Re: Exceptional coding style

2013-01-15 Thread Russel Winder
On Tue, 2013-01-15 at 17:02 +0100, mist wrote: […] > monospaced fonts everywhere to rule them all! :) Monospace fonts are an aberration of the typewriter era. All text, including code, should be displayed in proportional fonts, in my case Ocean Sans Std on my machines. -- Russel. ==

Re: Exceptional coding style

2013-01-15 Thread monarch_dodra
On Tuesday, 15 January 2013 at 16:17:27 UTC, H. S. Teoh wrote: On Tue, Jan 15, 2013 at 03:07:08PM +0100, monarch_dodra wrote: On Tuesday, 15 January 2013 at 13:55:53 UTC, Timon Gehr wrote: >On 01/15/2013 11:57 AM, mist wrote: >>Well, probably I am playing "good vision nazi" here, as 12 >>font s

Re: Exceptional coding style

2013-01-15 Thread mist
On Tuesday, 15 January 2013 at 16:31:05 UTC, Russel Winder wrote: On Tue, 2013-01-15 at 17:02 +0100, mist wrote: […] monospaced fonts everywhere to rule them all! :) Monospace fonts are an aberration of the typewriter era. All text, including code, should be displayed in proportional fonts,

Re: Exceptional coding style

2013-01-15 Thread mist
On Tuesday, 15 January 2013 at 16:22:19 UTC, H. S. Teoh wrote: On Tue, Jan 15, 2013 at 11:56:34AM +0100, mist wrote: On Monday, 14 January 2013 at 23:57:18 UTC, Timon Gehr wrote: >This generally comes up as an argument in these discussions, >but I >don't buy it. Not all development is done on a

Re: Exceptional coding style

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 11:33 AM, mist wrote: On Tuesday, 15 January 2013 at 16:31:05 UTC, Russel Winder wrote: On Tue, 2013-01-15 at 17:02 +0100, mist wrote: […] monospaced fonts everywhere to rule them all! :) Monospace fonts are an aberration of the typewriter era. All text, including code, should be

Re: Exceptional coding style

2013-01-15 Thread Russel Winder
On Tue, 2013-01-15 at 17:33 +0100, mist wrote: […] > :O You are probably the very first programmer I have encountered > so far that prefers proportional fonts for code. I need some time > to even try to imagine how this may look. Use an editor like GEdit and change the font to a proportional one

Re: Exceptional coding style

2013-01-15 Thread Russel Winder
On Tue, 2013-01-15 at 11:49 -0500, Andrei Alexandrescu wrote: […] > I, too, prefer proportional fonts in code and tried hard to use them in > TDPL. I couldn't find a reasonable way to make them work in > LaTeX/listings (indentation and vertical align are pervasive issues) and > besides there are

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
On Tuesday, 15 January 2013 at 05:51:16 UTC, Andrei Alexandrescu wrote: (Warning: this assumes a fair bit of background with ranges and the STL.) We've had a long-standing weakness of ranges when compared with STL iterators: in a find() call we get to access the balance of the range from the

Re: Exceptional coding style

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 11:59 AM, Russel Winder wrote: LaTeX and listings works fine with proportional fonts for me. What problem were you having. In book code samples you need frequently to align things vertically (e.g. comments): int a = 42; // the meaning of everything a += 0.1; // error! cannot

Re: The rfind challenge

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 12:03 PM, Phil Lavoie wrote: Pseudo: original = range.save resPos = range.retro.find return Range.merge( resPos, original ) //DOES NOT WORK The problem with this solution is that: Retro returns a different range type and it would be more complicated to have the merge function work wit

Re: Exceptional coding style

2013-01-15 Thread mist
On Tuesday, 15 January 2013 at 16:51:34 UTC, Russel Winder wrote: On Tue, 2013-01-15 at 17:33 +0100, mist wrote: […] :O You are probably the very first programmer I have encountered so far that prefers proportional fonts for code. I need some time to even try to imagine how this may look. Use

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
The order of the range returned is the same as the one received. Not true. It should default to the genuine bidirectional range's direction. If it was reversed before calling rfind we could: let the user reverse the result again or add the possibility to query the range to know it it's already

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
On Tuesday, 15 January 2013 at 17:14:32 UTC, Andrei Alexandrescu wrote: On 1/15/13 12:03 PM, Phil Lavoie wrote: Pseudo: original = range.save resPos = range.retro.find return Range.merge( resPos, original ) //DOES NOT WORK The problem with this solution is that: Retro returns a different range

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
return original.reversed ? res : res.reverse; And correcting again, invert both to: return original.reversed? res.reverse: res;

Re: Exceptional coding style

2013-01-15 Thread F i L
sorry if this has already been posted, but Phoronix did an article on John Carmack's words as well, and the forum discussion has a bit of talk about D in it (specifically how it compares to C++). http://phoronix.com/forums/showthread.php?76719-John-Carmack-s-Comments-On-C-C#post306255

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 04:30:55PM +, Russel Winder wrote: > On Tue, 2013-01-15 at 17:02 +0100, mist wrote: > […] > > monospaced fonts everywhere to rule them all! :) > > Monospace fonts are an aberration of the typewriter era. > > All text, including code, should be displayed in proportional

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 05:30:34PM +0100, monarch_dodra wrote: > On Tuesday, 15 January 2013 at 16:17:27 UTC, H. S. Teoh wrote: > >On Tue, Jan 15, 2013 at 03:07:08PM +0100, monarch_dodra wrote: [...] > >>I always change the font size of my editor, depending on how > >>concentrated I am, my position

Re: Function scope arguments

2013-01-15 Thread Artur Skawina
On 01/15/13 17:12, Timon Gehr wrote: > On 01/15/2013 04:03 PM, Artur Skawina wrote: >> On 01/15/13 15:09, Timon Gehr wrote: >>> On 01/15/2013 01:44 PM, Artur Skawina wrote: On 01/15/13 12:48, deadalnix wrote: > On Tuesday, 15 January 2013 at 10:58:17 UTC, Artur Skawina wrote: >> Differ

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 05:31:04PM +0100, mist wrote: > On Tuesday, 15 January 2013 at 16:22:19 UTC, H. S. Teoh wrote: [...] > >Heh. On the contrary, I find ssh to be a pleasant experience. Most > >GUI-heavy editors are so painfully inefficient to use that I find > >VT100 emulators far more pleasan

Re: The rfind challenge

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 2:20 AM, monarch_dodra wrote: auto l = cutBefore(a, b); //Gets the part of a that is before b auto r = cutAfter(a, b); //Gets the part of a that is after b I think cutBefore is sufficient. No? Ideas for better names? Andrei

Re: The rfind challenge

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 12:24 PM, Phil Lavoie wrote: Ok then, imagine we use @reverse, @reversed and @merge primitives: That's too many. Simpler approaches? Andrei

Re: Exceptional coding style

2013-01-15 Thread Artur Skawina
On 01/15/13 18:52, H. S. Teoh wrote: > Probably. And it's probably the reason I dislike today's trend of > half-height^W^W I mean, half-width, monitors: I always work with > maximized windows, and I don't like overly long lines, so resizing the > font to approximately 80 columns at 1920x1080 would

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 10:58:47AM +, Russel Winder wrote: [...] > Go has an extreme position on this, there is one and only one style of > code that is acceptable, the one defined in the gofmt program that is > used to format all Go code. I happen not to like some parts of it, but > I live wit

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 07:06:05PM +0100, Artur Skawina wrote: > On 01/15/13 18:52, H. S. Teoh wrote: > > Probably. And it's probably the reason I dislike today's trend of > > half-height^W^W I mean, half-width, monitors: I always work with > > maximized windows, and I don't like overly long lines,

Re: Exceptional coding style

2013-01-15 Thread Russel Winder
Andrei, On Tue, 2013-01-15 at 12:09 -0500, Andrei Alexandrescu wrote: […] > In book code samples you need frequently to align things vertically > (e.g. comments): > > int a = 42; // the meaning of everything > a += 0.1; // error! cannot assign double to int That sort of alignment is nigh

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
Ok, so to sum it up: rfind should return the same type as provided. Its direction (popFront()) should be the same. auto rfing( Range, E )( Range r, E e ) if (blablabla) { auto original = r.save; //This is to remember the end of the orginal range. r.reverse; //Reverse it. The range keeps tra

Re: The rfind challenge

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 07:54:12AM -0500, Andrei Alexandrescu wrote: > On 1/15/13 1:31 AM, H. S. Teoh wrote: > >Hmm. What about introducing a new primitive takeUntil, that returns the > >initial segment of the range until a given predicate becomes true? Then > >you could implement rfind thus: > > >

Re: The rfind challenge

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 06:03:06PM +0100, Phil Lavoie wrote: [...] > An addition to this solution could be another new primitive: > reverse: > > Pseudo: > original = range.save > reversed = range.reverse //Permanently invert start an end. I > think this is feasible for all bidirectional ranges

Re: Exceptional coding style

2013-01-15 Thread Wyatt
On Tuesday, 15 January 2013 at 16:51:34 UTC, Russel Winder wrote: I really cannot understand the obsession computing people have with using monospace fonts, I just assume it is a hang over from the line printer era which created a mindset that most people do not challange. As soon as computers

Re: Exceptional coding style

2013-01-15 Thread Wyatt
On Tuesday, 15 January 2013 at 18:10:00 UTC, H. S. Teoh wrote: I shall start a new trend of ultra-high monitors! About time more people showed up to this party... ;) Make sure you're getting a panel with VESA mount; many monitors even at the fairly-high end of the spectrum have cheap stands

Re: The rfind challenge

2013-01-15 Thread monarch_dodra
On Tuesday, 15 January 2013 at 17:57:07 UTC, Andrei Alexandrescu wrote: On 1/15/13 2:20 AM, monarch_dodra wrote: auto l = cutBefore(a, b); //Gets the part of a that is before b auto r = cutAfter(a, b); //Gets the part of a that is after b I think cutBefore is sufficient. No? Ideas for better n

Re: Exceptional coding style

2013-01-15 Thread H. S. Teoh
On Tue, Jan 15, 2013 at 06:11:46PM +, Russel Winder wrote: [...] > On Tue, 2013-01-15 at 12:09 -0500, Andrei Alexandrescu wrote: > […] > > In book code samples you need frequently to align things vertically > > (e.g. comments): > > > > int a = 42; // the meaning of everything > > a += 0.1;

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
On Tuesday, 15 January 2013 at 18:19:48 UTC, H. S. Teoh wrote: On Tue, Jan 15, 2013 at 06:03:06PM +0100, Phil Lavoie wrote: [...] An addition to this solution could be another new primitive: reverse: Pseudo: original = range.save reversed = range.reverse //Permanently invert start an end. I

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
bool empty() { return _start is null || _end is null; } //The This would have to be corrected. I agree that there are too many primitives.

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
And, if ever needed, popBack could become this: void popBack( R )( ref R r ) if( isReversibleRange!R ) { auto reversed = r.reverse.popFront(); r = reversed.reverse; }

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
Continuing with reversible ranges: struct ForwardRange { _start; _end; BackwardRange reverse() { return BackwardRange( _end, _start ); } } struct BackwardRange { _start; _end; //guess what reverse is. } That would give the power to mimick bidirectional ranges (see post on popBack befor

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
It'd be nicer if we could use an operator, but this is wishful thinking: auto r = r2.jumpTo( d2 ); //r2d2, yes. Equivalent to: auto r = r2[ d2 .. $ ]; Or: auto r = r2[ d2 ... ]; Again, wishful thinking.

Re: The rfind challenge

2013-01-15 Thread Phil Lavoie
On Tuesday, 15 January 2013 at 19:11:43 UTC, Phil Lavoie wrote: It'd be nicer if we could use an operator, but this is wishful thinking: auto r = r2.jumpTo( d2 ); //r2d2, yes. Equivalent to: auto r = r2[ d2 .. $ ]; Or: auto r = r2[ d2 ... ]; Again, wishful thinking. What about startOn instea

Re: Function scope arguments

2013-01-15 Thread David Nadlinger
On Tuesday, 15 January 2013 at 16:12:41 UTC, Timon Gehr wrote: No, there is no way to get a heap allocated closure from a lazy parameter. […] I think the behaviour has always been the same (at least with DMD). This is a hole in SafeD – please file it as such if it isn't in Bugzilla already

Re: Internal and external iteration, fibers

2013-01-15 Thread Sean Kelly
On Jan 15, 2013, at 4:52 AM, bearophile wrote: > The author of the experimental language Magpie is very intelligent (in past I > have read a very nice blog post about the unusual bootstrapped type system of > Magpie). Here he nicely discusses well known things: > > http://journal.stuffwithstuf

Re: The rfind challenge

2013-01-15 Thread FG
On 2013-01-15 19:00, Andrei Alexandrescu wrote: That's too many. Simpler approaches? Let me give an outside perspective of someone that doesn't work with D all day. For forward ranges the original method is fine, but for bidirectional r and e I would expect the following code to somehow just

Re: The rfind challenge

2013-01-15 Thread monarch_dodra
On Tuesday, 15 January 2013 at 19:44:39 UTC, FG wrote: On 2013-01-15 19:00, Andrei Alexandrescu wrote: That's too many. Simpler approaches? Let me give an outside perspective of someone that doesn't work with D all day. For forward ranges the original method is fine, but for bidirectional r

Re: Exceptional coding style

2013-01-15 Thread FG
On 2013-01-15 17:00, H. S. Teoh wrote: reading the format string alone says nothing about what meaning is intended. What is found in a what? Also, it doesn't let you vary the word order correctly. Nor does it let you perform inflection correctly. For true ease of translation, you need: 1) Logic

Re: The rfind challenge

2013-01-15 Thread FG
On 2013-01-15 21:14, monarch_dodra wrote: This is why I'd like to find a way to cut bidirectional ranges: Not just for r* functions, but also for our everyday functions: As you can see, we don't have any way to "findBefore" and store the result in a BR. Ouch. As a user of D, I agree with you tha

Re: The rfind challenge

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 2:07 PM, Phil Lavoie wrote: Continuing with reversible ranges: I don't think .reverse will take us far enough. Won't work with arrays which kinda puts a monkey wrench into everything. r1.before(r2) works much better: R rfind(R, E)(R r, E e) { auto original = r.save; for (; !r

Re: DConf 2013 Call for Submissions: deadline on January 28

2013-01-15 Thread Adam D. Ruppe
What's the daily schedule of the conference look like? Is it a 9-5 deal each day?

Re: Exceptional coding style

2013-01-15 Thread Stewart Gordon
On 15/01/2013 01:11, Timon Gehr wrote: I assume you are using thunderbird, because that changed its layout fairly recently. You can fix this by right-clicking on the button -> 'Customize...' IIRC. But for some strange reason, getting rid of the Reply button gets rid of it when viewing email a

Re: Building dmd from source guid

2013-01-15 Thread monarch_dodra
On Thursday, 6 December 2012 at 20:23:44 UTC, monarch_dodra wrote: On Thursday, 6 December 2012 at 20:11:52 UTC, Dmitry Olshansky wrote: The fact that curl is not shipped by default sucks. And the link is at the very bottom of http://dlang.org/download.html is not handy. Anyway here it is:

Re: DConf 2013 Call for Submissions: deadline on January 28

2013-01-15 Thread Andrei Alexandrescu
On 1/15/13 4:01 PM, Adam D. Ruppe wrote: What's the daily schedule of the conference look like? Is it a 9-5 deal each day? Yes, and we'll probably have a reception dinner one night. Andrei

Re: Exceptional coding style

2013-01-15 Thread Stewart Gordon
On 15/01/2013 07:24, Tavi Cacina wrote: That piece of code is correct. http://en.wikipedia.org/wiki/Erase-remove_idiom I must have misread the documentation on cplusplus.com. I'd somehow made out that it returns an iterator that skips over the "removed" values. So the semantics of remove a

  1   2   >