Re: Persistent list

2015-11-13 Thread Ali Çehreli via Digitalmars-d
On 11/13/2015 03:10 PM, Andrei Alexandrescu wrote: > at http://dpaste.dzfl.pl/0981640c2835 > * Lines 11-12: I came to terms with the notion that some types cannot be > made immutable. Could constructor qualifiers help in such cases? I would like to hear war stories and experiences from others

Re: DMD is faster than LDC and GDC

2015-11-13 Thread Ali Çehreli via Digitalmars-d
On 11/12/2015 11:50 AM, Ali Çehreli wrote: I would love to be convinced. :) Can someone come up with a reduced example please? On 11/12/2015 03:59 AM, Daniel Kozak wrote: > for (i=0; i < 100; ++i) { > fmttable(table); > } I think what we are seeing here is more due to

Re: Signed integer overflow undefined behavior or not?

2015-11-13 Thread Ali Çehreli via Digitalmars-d
On 11/13/2015 12:30 AM, Ola Fosheim Grøstad wrote: > On Friday, 13 November 2015 at 06:46:37 UTC, Ali Çehreli wrote: >> Since it's UB in C and C++, I've heard that both clang and gcc do >> remove code branches if they can prove that there will be signed >> overflow. I don't know how or whether tha

Re: Signed integer overflow undefined behavior or not?

2015-11-12 Thread Ali Çehreli via Digitalmars-d
On 11/12/2015 10:00 PM, Walter Bright wrote: > On 11/12/2015 4:43 PM, Ali Çehreli wrote: >> So the question is, do we support twos complement only, hence signed >> overflow is >> defined as wrap, > > Yes. I see no reason to support 1's complement. It's official! :) > It's worth checking how LDC

Signed integer overflow undefined behavior or not?

2015-11-12 Thread Ali Çehreli via Digitalmars-d
I searched but I could not find a definitive answer. I am pretty sure this thread will turn into yet another about what it should be, but I need an answer soon before updating my book to be review by Russel Winder, who will not give it a good mark before I get this part right. :) Quoting from

Re: DMD is faster than LDC and GDC

2015-11-12 Thread Ali Çehreli via Digitalmars-d
I would love to be convinced. :) Can someone come up with a reduced example please? On 11/12/2015 03:59 AM, Daniel Kozak wrote: > for (i=0; i < 100; ++i) { > fmttable(table); > } I think what we are seeing here is more due to the unused side-effect in the loop, where co

Re: ACCU 2016 conference

2015-11-11 Thread Ali Çehreli via Digitalmars-d
On 11/11/2015 05:11 AM, Russel Winder via Digitalmars-d wrote: Perhaps you can influence some people at ACCU to review that and other D books. :) Get a printed copy sent to me, and I'll do a formal review for ACCU. Woo hoo! :) Let me fix a couple of accuracy problems first. ;) Others: If y

Re: ACCU 2016 conference

2015-11-08 Thread Ali Çehreli via Digitalmars-d
On 11/08/2015 11:00 AM, Russel Winder via Digitalmars-d wrote: Only 1 week left to send in submissions proposing sessions for ACCU 2016: http://accu.org/index.php/conferences/accu_conference_2016/accu2016_cal l_for_sessions Given people are preparing proposals for DConf, preparing proposals for

Re: Automatic method overriding in sub-classes

2015-10-26 Thread Ali Çehreli via Digitalmars-d
On 10/26/2015 04:25 PM, Tofu Ninja wrote: ## class A { void foo(this T)() { writeln(T.stringof); } void bar(auto override this T)() { writeln(T.stringof); } } class B : A {} void main() { A a = new A(); a.foo(); // prints "A" a.bar()

Re: My experience from learning Polish language

2015-10-24 Thread Ali Çehreli via Digitalmars-d
On 10/24/2015 04:15 AM, Cauterite wrote: On Saturday, 24 October 2015 at 11:01:24 UTC, grumpyalittle wrote: My name is Daisy and I was on Erasmus program in Poland. During This looks like spam to me. Of course spam but it's pretty amusing. :) It must have happened like this: - Polish langua

Re: Will code for master title

2015-10-19 Thread Ali Çehreli via Digitalmars-d
On 10/19/2015 12:20 PM, ParticlePeter wrote: > Last ingredient I would need for such a plan is an academic primary > adviser. Two names come to mind: - Chuck Allison uses D when teaching functional programming at Utah Valley University: https://www.youtube.com/watch?v=ymoIx3klQ6M - Carl S

DoxyPress support for D

2015-10-13 Thread Ali Çehreli via Digitalmars-d
Barbara Geller and Ansel Sermersheim's CppCon 2015 talk has a very brief mention of D: https://www.youtube.com/watch?feature=player_detailpage&v=hQphBQMwk7s#t=2440 They ported Doxygen to C++11 with great effort and named the result DoxyPress. - Since D already has ddoc, do we need DoxyPress

Re: -> and :: operators

2015-10-09 Thread Ali Çehreli via Digitalmars-d
On 10/09/2015 05:19 AM, Ola Fosheim Grøstad wrote: > On Friday, 9 October 2015 at 04:15:42 UTC, Ali Çehreli wrote: >> Go feature where you just type a dot after a pointer and the language >> is so great that it works! You don't need to type (*p).member. Isn't >> Go awesome! >> >> I responded "yep,

Re: -> and :: operators

2015-10-08 Thread Ali Çehreli via Digitalmars-d
On 10/08/2015 08:41 PM, Walter Bright wrote: These, of course, are C++ operators that are replace with the . operator in D. But when I translate C++ code to D, sometimes these operators get left behind, and sometimes I simply reflexively type them into D code. The error message coming out of dmd

Re: how to do iota(0,256) with ubytes ? (cf need for iotaInclusive)

2015-10-08 Thread Ali Çehreli via Digitalmars-d
On 10/08/2015 07:43 PM, Timothee Cour via Digitalmars-d wrote: also, workarounds involving: iota(0,256).map!(a=>cast(ubyte)a) are neither pleasant nor efficient On Thu, Oct 8, 2015 at 7:41 PM, Timothee Cour wrote: how to do iota(0,256) with ubytes ? and more generally: iota with 'end' parame

Re: Categorizing Ranges

2015-10-07 Thread Ali Çehreli via Digitalmars-d
On 10/07/2015 09:15 AM, Mike Parker wrote: On Wednesday, 7 October 2015 at 15:43:44 UTC, Ali Çehreli wrote: Something like shortening, minimizing? Ali How about reductive? That's what I had in mind when I started thesaurusing for the other two. :) Ali

Re: Categorizing Ranges

2015-10-07 Thread Ali Çehreli via Digitalmars-d
On 10/07/2015 08:06 AM, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Itera

Re: Fibers and Ranges

2015-10-04 Thread Ali Çehreli via Digitalmars-d
On 10/04/2015 04:40 PM, Freddy wrote: --- import core.thread; import std.conv; import std.stdio; void formatStuff(P)(P put, int stuff) { put("a"); put("b"); put("c"); put(stuff); foreach (i; 0 .. 10) { put(i ^^ stuff); } } auto formatRange(alias sub,

Re: Shout out to D at cppcon, when talkign about ranges.

2015-10-01 Thread Ali Çehreli via Digitalmars-d
On 10/01/2015 01:37 AM, Walter Bright wrote: > Update: found it on web.archive.org! > > https://web.archive.org/web/20050427085507/http://rangelib.synesis.com.au/ > > Anyhow, this is what I could dig up in an hour or so. Thank you for mining for that. From the days that I used to frequent com

Re: Shout out to D at cppcon, when talkign about ranges.

2015-09-30 Thread Ali Çehreli via Digitalmars-d
On 09/30/2015 08:02 AM, Ali Çehreli wrote: > if H. S. Teoh or I could go to the conference. Oops! I've mixed up the years. I did go to DConf 2014 but not DConf 2015. Still... :) Ali

Re: Shout out to D at cppcon, when talkign about ranges.

2015-09-30 Thread Ali Çehreli via Digitalmars-d
On 09/29/2015 06:45 PM, deadalnix wrote: https://www.youtube.com/watch?v=mFUXNMfaciE From http://wiki.dlang.org/Component_programming_with_ranges Congrat H. S. Teoh Yay! :) I almost gave the same talk! This talk could have been a part of DConf 2014 if H. S. Teoh or I could go to the confere

Re: Stroustrup is disappointed with D :(

2015-09-23 Thread Ali Çehreli via Digitalmars-d
On 09/23/2015 05:16 AM, Nemanja Boric wrote: On Tuesday, 22 September 2015 at 21:28:27 UTC, Ola Fosheim Grøstad wrote: I tried to determine the actual author. It was not easy and I still don't know. :) Me neither. I'm getting the impression that I am looking at a wall of guidelines-graffiti.

Re: Stroustrup is disappointed with D :(

2015-09-22 Thread Ali Çehreli via Digitalmars-d
On 09/22/2015 12:52 PM, Ola Fosheim Grøstad wrote: On Tuesday, 22 September 2015 at 19:38:35 UTC, Ali Çehreli wrote: C++'s approach is better from the point of view of corretness. However, it is slower because the object's vtbl pointer must be stamped several times during construction. (I am not

Re: Stroustrup is disappointed with D :(

2015-09-22 Thread Ali Çehreli via Digitalmars-d
On 09/22/2015 11:58 AM, Tourist wrote: "D disappointed me so much when it went the Java way". https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#to-do-unclassified-proto-rules It's something about virtual calls, but I didn't understand what he means. What does he mean?

Re: Overview of D User Groups?

2015-09-16 Thread Ali Çehreli via Digitalmars-d
On 09/16/2015 11:56 AM, qznc wrote: Is there an overview of D user groups somewhere? There is one in Berlin and one in the Valley, apparently. Walter participates in the Cpp group in Seattle or something, if I remember correctly. If a Meetup group happens to list the right keywords (topics?) t

Re: Better lambdas!!!!!!!!!!

2015-09-10 Thread Ali Çehreli via Digitalmars-d
On 09/10/2015 10:55 AM, Prudence wrote: > How bout this: > > void myfunc(double delegate(int i, int z, float f)) {} > > > myfunc((int i, int z, float f) { return i*z*f; } } > > vs > > myfunc({ return i*z*f; }) // Names of parameters are inferred from > signature. Considering other features

Re: Dazz new description for D

2015-08-31 Thread Ali Çehreli via Digitalmars-d
On 08/31/2015 01:09 AM, Russel Winder via Digitalmars-d wrote: > Seems like the sound byte has become the "we can't read that sentence, > it is too long, and contains insufficient mispelt words". One does > wonder at the attention span of the post-texting generation, seems > like about 3ms. The h

Re: Casting double to ulong weirdness

2015-08-24 Thread Ali Çehreli via Digitalmars-d
On 08/24/2015 11:06 AM, rumbu wrote: > BTW, 1.2 and 12.0 are directly representable as double 12 is but 1.2 is not. > In C++: > > printf("%.20f\r\n", 1.2); > printf("%.20f\r\n", 12.0); > > will output: > > 1.2000 > 12. > > Either upcasting to real is the wron

Re: Passing parameters to thread functions

2015-08-15 Thread Ali Çehreli via Digitalmars-d
On 08/15/2015 05:22 AM, D_Starter wrote: > I haven't found anything useful on the library description so > far. In addition to the posted documentation links, I have the following chapters that may be helpful. - Message Passing Concurrency http://ddili.org/ders/d.en/concurrency.html - Dat

Re: TCP Socket Client Example

2015-08-14 Thread Ali Çehreli via Digitalmars-d
On 08/14/2015 07:06 AM, Kingsley wrote: Hi Does anyone have some examples of making a client socket connection to a host on a port and parsing the incoming data in some kind of loop. --K A recent thread with yet another example: http://forum.dlang.org/post/mmhlsp$2p4e$1...@digitalmars.com

Re: Wiki article: Starting as a Contributor

2015-08-04 Thread Ali Çehreli via Digitalmars-d
On 08/04/2015 07:02 AM, Andrei Alexandrescu wrote: a whole section on "Typical Contributor Workflow". -- Andrei In case there are others that don't know, "git co" in that section is an alias to "git checkout": http://stackoverflow.com/questions/14489109/how-to-alias-git-checkout-to-git-co

Re: Wiki article: Starting as a Contributor

2015-08-03 Thread Ali Çehreli via Digitalmars-d
On 08/03/2015 02:25 PM, Andrei Alexandrescu wrote: I had to set up dmd and friends on a fresh Ubuntu box, so I thought I'd document the step-by-step process: http://wiki.dlang.org/Starting_as_a_Contributor Along the way I also hit a small snag and fixed it at https://github.com/D-Programming-L

Re: assert(0) behavior

2015-08-03 Thread Ali Çehreli via Digitalmars-d
On 08/03/2015 04:57 PM, Steven Schveighoffer wrote: > At the very least, assert(0, "message") should be a compiler error, the > message is unused information. Agreed. How about dumping the message to stderr as a best effort if the message is a literal? Hm... On the other hand, undefined behavi

Re: Working with pdf

2015-07-30 Thread Ali Çehreli via Digitalmars-d
On 07/30/2015 08:39 AM, tcak wrote: > I had started developing a module to create PDF files based on > version 1.5 specification, but it had started being too complex to > handle I looked at that option for my book, which is written in DDOC to generate HTML. Yes, PDF and layout issues in genera

Re: ReturnType and overloaded functions

2015-06-12 Thread Ali Çehreli via Digitalmars-d
On 06/12/2015 06:44 PM, Freddy wrote: > Why not just use templates? The question is about overloaded functions. Ali

Re: ReturnType and overloaded functions

2015-06-12 Thread Ali Çehreli via Digitalmars-d
On 06/12/2015 05:04 PM, ketmar wrote: On Fri, 12 Jun 2015 16:32:37 -0700, Ali Çehreli wrote: On 06/12/2015 04:25 PM, Yuxuan Shui wrote: When there are multiple overloaded functions, whose return type will I get when I use ReturnType? Is there a way I could choose a specific function by its par

Re: ReturnType and overloaded functions

2015-06-12 Thread Ali Çehreli via Digitalmars-d
On 06/12/2015 04:25 PM, Yuxuan Shui wrote: When there are multiple overloaded functions, whose return type will I get when I use ReturnType? Is there a way I could choose a specific function by its parameter types? I am curious about the answer myself but there is the workaround of passing the

Re: Asked on Reddit: Which of Rust, D, Go, Nim, and Crystal is the strongest and why?

2015-06-10 Thread Ali Çehreli via Digitalmars-d
On 06/10/2015 09:34 AM, Joakim wrote: On Wednesday, 10 June 2015 at 16:22:51 UTC, Idan Arye wrote: Wasn't LLVM supposed to solve that, being a "virtual machine" for compilation to low level native code? May still be possible, Apple just announced that the default format to submit apps for iOS

Re: It may be useful to allow declaring variables without type

2015-06-10 Thread Ali Çehreli via Digitalmars-d
On 06/10/2015 10:49 AM, Atila Neves wrote: > On Wednesday, 10 June 2015 at 17:38:45 UTC, Binarydepth wrote: >> On Wednesday, 10 June 2015 at 17:32:18 UTC, Atila Neves wrote: >>> On Wednesday, 10 June 2015 at 17:04:20 UTC, Binarydepth wrote: I think that it could be useful to declare variable

Asked on Reddit: Which of Rust, D, Go, Nim, and Crystal is the strongest and why?

2015-06-09 Thread Ali Çehreli via Digitalmars-d
http://www.reddit.com/r/programming/comments/396c95/of_the_emerging_systems_languages_rust_d_go_nim/ Ali

Re: pure format

2015-06-04 Thread Ali Çehreli via Digitalmars-d
On 06/04/2015 10:02 AM, Oleg B wrote: > I think toString for float must be pure, but in practice it's not. > > import std.stdio; > import std.string; > string test( float abc ) pure { return format( "abc: % 6.3f", abc ); } > void main() { writeln( test( 13.3 ) ); } > > $ rdmd purefmtfloating.d >

Re: Bad Sound Quality on Livestreamed Videos

2015-05-31 Thread Ali Çehreli via Digitalmars-d
On 05/30/2015 08:37 AM, John Colvin wrote: On Saturday, 30 May 2015 at 14:12:10 UTC, Per Nordlöw wrote: The livestreaming videos just published are really frustrating to watch because lots of stuttering in speech about once every 20 seconds or so and sometimes difficult to here what people say.

Re: strange bug with unions?

2015-05-29 Thread Ali Çehreli via Digitalmars-d
On 05/29/2015 12:55 AM, seen wrote: I don't know why but when using a template union with a static ubyte array i get bizarre results! module main; import std.stdio; private union ByteConverter(T) { ubyte[T.sizeof] bytes; That's a fixed-length array (aka static array), which has value sem

Re: DConf 2015 livestreaming day 1: post feedback here

2015-05-27 Thread Ali Çehreli via Digitalmars-d
On 05/27/2015 05:54 PM, Andrei Alexandrescu wrote: John Colvin's experiment is great and we want to make it a full success. Please post here feedback and suggestions for tomorrow's DConf streaming. Thanks! -- Andrei Thank you for doing this! The slides will be easier to read if the camera can

Re: D casually mentioned and dismissed + a suggestion

2015-05-14 Thread Ali Çehreli via Digitalmars-d
On 05/14/2015 03:20 PM, Dragos Carp wrote: Dragos [1] http://funkwerk-itk.com/funkwerk_itk_de/imagepool/jobs/SoftwareEntwickler.pdf Added: http://wiki.dlang.org/Jobs Ali

Re: dmd build instructions from source don't work anymore

2015-05-11 Thread Ali Çehreli via Digitalmars-d
On 05/11/2015 10:23 AM, Timothee Cour via Digitalmars-d wrote: > I notice CC is set to 'g++' in posix.mak which is untypical (instead > of gcc for example) That is required because although all implementation files are C++, they have extension .c. If CC were gcc, it would assume C compilation.

Re: Header Files

2015-05-10 Thread Ali Çehreli via Digitalmars-d
On 05/10/2015 09:11 AM, bitwise wrote: > On Sunday, 10 May 2015 at 01:00:31 UTC, bitwise wrote: >> Is there really no way to preserve the directory structure when >> creating .di files? >> Bit > > Why hello, Bitwise! I believe the '-op' flag is what you're looking for! > >Bitwiser Wow! Wal

Re: Header Files

2015-05-09 Thread Ali Çehreli via Digitalmars-d
On 05/09/2015 06:18 PM, bitwise wrote: > I'm not sure I understand what you mean, but my point is, that as is, > this feature of DMD is broken. Arguably broken but compared to other tools it behaves in the same way. > If people are successfully using dmd -H right now, they must not be > using p

Re: Header Files

2015-05-09 Thread Ali Çehreli via Digitalmars-d
On 05/09/2015 07:01 AM, bitwise wrote: ./main.d ./pack/foo.d ./pack/sub/bar.d dmd main.d pack/foo.d pack/sub/bar.d -ofTest -H This dumps all the *.di files into the output directory ignoring the directory structure. Is there some rational for it being this way? Wouldn't it be much more useful

Re: Sneak preview into std.allocator's porcelain

2015-05-07 Thread Ali Çehreli via Digitalmars-d
On 05/07/2015 02:18 AM, Brian Schott wrote: On Thursday, 7 May 2015 at 02:28:45 UTC, Andrei Alexandrescu wrote: http://erdani.com/d/phobos-prerelease/std_experimental_allocator_porcelain.html Andrei *Reads module name* "...toilets? Oh. Wait. I thought dishes and tea cups. :) > This is is

Re: type switch

2015-05-05 Thread Ali Çehreli via Digitalmars-d
On 05/04/2015 03:48 PM, Dennis Ritchie wrote: > I've been thinking. In D you can write a similar design to the generic > functions or somewhere, use static if: > > // - > static if (is(T == short) || is(T == int) || is(T == long)) { > // do anything > } else static if (is(T == real)) { >

Re: error with std.range.put - readN

2015-05-04 Thread Ali Çehreli via Digitalmars-d
On 05/04/2015 07:33 AM, Baz wrote: > int[] src = [1,2,3]; > int[] dst = [0]; In addition to what others said, even if dst had room for two elements, it would lose the newly added element due to a popFront() called implicitly during put()'ting. int[] dst = [0, 0];// <-- Has

Re: Closure capture loop variables

2015-04-30 Thread Ali Çehreli via Digitalmars-d
On 04/30/2015 05:55 AM, Vladimir Panteleev wrote: > D closures should work in the same way as, e.g., JS closures. Try > rewriting the program in JavaScript. If it behaves in the same way, it's > not a D bug. Right. I remember Seth Ladd's Dart language presentation at the local ACCU in Silicon

Re: Is this a bug in return type inference?

2015-04-26 Thread Ali Çehreli via Digitalmars-d
On 04/26/2015 12:32 PM, Meta wrote: import std.random; auto test(int n) { if (n >= 0 && n < 33) { return int(0); } else if (n >= 33 && n < 66) { return float(0); } else { return real(0); } } void main() { auto n = unif

Re: A valid code that won't run?

2015-04-24 Thread Ali Çehreli via Digitalmars-d
On 04/24/2015 10:26 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= " wrote: You need to link against libcurl explicitly, it doesn't happen automatically: dmd -L-lcurl test.d Another option is to add it to the source: pragma(lib, "curl"); Then it finds the library on the system and links with it.

Re: [OT] C# 6.0 ?. null propagation operator

2015-04-20 Thread Ali Çehreli via Digitalmars-d
On 04/20/2015 03:18 PM, rumbu wrote: On Monday, 20 April 2015 at 21:22:53 UTC, deadalnix wrote: On Monday, 20 April 2015 at 20:09:59 UTC, rumbu wrote: .. I fail to understand Atila example. Just to be sure: C#: var roleName = userManager.CurrentUser?.GetRole()?.Name; D (Jakob): auto roleNa

Re: How about appender.put() with var args?

2015-04-15 Thread Ali Çehreli via Digitalmars-d
On 04/15/2015 12:09 PM, "=?UTF-8?B?Ik3DoXJjaW8=?= Martins\" \"" wrote: Hi! I use Appender a lot, and find it ugly to write this all the time to efficiently construct strings: app.put("foo"); app.put(var); app.put("bar"); How about this instead? app.put("foo", var, "bar"); Agreed. If a diff

Re: Which D IDE do you use?(survey)

2015-04-12 Thread Ali Çehreli via Digitalmars-d
On 04/12/2015 10:49 AM, Dicebot wrote: > it is exactly the same experience on my dev machine and via > remote shell I love Emacs's tramp mode. If I can access a host, say with ssh, then I can open any remote file locally, without needing to do anything specially other than using a URL syntax.

Re: Silicon Valley D Meetup needs blood

2015-04-09 Thread Ali Çehreli via Digitalmars-d
On 04/09/2015 12:57 PM, Walter Bright wrote: nwcpp.org also usually offers pizza as well. A sponsor will bring in pizza, and in exchange they spend a few moments pushing their agenda (which is usually recruiting). We have been offering pizza and beer as well. Perhaps that's what we should be m

Silicon Valley D Meetup needs blood

2015-04-09 Thread Ali Çehreli via Digitalmars-d
Fresh or otherwise... :) We need speakers, topics, ideas, and anything else that you can think of to have a useful group. A paragraph of whining follows... We had a great start in January with one full length presentation by Andrei and two lightning talks by deadalnix and another member. Unf

Re: Template argument deduction from a function call question

2015-04-01 Thread Ali Çehreli via Digitalmars-d
On 04/01/2015 11:27 AM, Dzugaru wrote: > This code does work when you provide second (non-default) argument to > function, and doesn't if you do not (no way it can deduce E solely from > checks I assume). > > My version, in constract, works when you do not provide second argument > and doesn't if

Re: Template argument deduction from a function call question

2015-04-01 Thread Ali Çehreli via Digitalmars-d
On 04/01/2015 11:15 AM, John Colvin wrote: >> Instead of using >> ElementType!S in the parameter list, introduce a third one (E), which >> you check in the template constraint: >> >> ElementType!S aggregate(alias func, S, E)(S list, E accum = E.init) >> if(is (E == ElementType!S) &&

Re: Template argument deduction from a function call question

2015-04-01 Thread Ali Çehreli via Digitalmars-d
On 04/01/2015 10:57 AM, Dzugaru wrote: > ElementType!S aggregate(alias func, S)(S list, ElementType!S accum = > ElementType!S.init) > if(is(typeof(func(accum, accum)) == typeof(accum))) { [...] > } I can't explain exactly why that doesn't work. However, I've discovered a number of times that re

Re: Question about opSlice

2015-03-17 Thread Ali Çehreli via Digitalmars-d
On 03/17/2015 09:29 AM, John Colvin wrote: On Tuesday, 17 March 2015 at 13:57:18 UTC, Ilya Ivanov wrote: [snip] I recently did a full Array2D with slicing and non-contiguous views etc and found that it was quite a nightmare getting all this stuff correct. I think your mistake is that opSlice ne

Re: Defining a single opCast disables explicit cast to base interfaces

2015-03-16 Thread Ali Çehreli via Digitalmars-d
I forgot to mention that this discussion is carried over from the D.learn newsgroup: http://forum.dlang.org/thread/uwuvqurfqbetypdlw...@forum.dlang.org Ali

Defining a single opCast disables explicit cast to base interfaces

2015-03-16 Thread Ali Çehreli via Digitalmars-d
The following program compiles fine: interface I {} class B : I {} class C : B { int i; } void main() { auto c = new C; auto i = cast(I)c;// compiles auto b = cast(B)c;// compiles } Let's add an unrelated opCast to C: class C : B { int i; int opCast(T : int)

Re: Post increment and decrement

2015-03-14 Thread Ali Çehreli via Digitalmars-d
On 03/14/2015 03:23 PM, deadalnix wrote: > But, for some reason, the topic come up again and again from C++ devs > that have no idea the optimization guys solved the issues for years now. If we are talking about C++, it is not possible to not take that copy for user-defined types. Due to separa

Re: Post increment and decrement

2015-03-11 Thread Ali Çehreli via Digitalmars-d
On 03/11/2015 10:23 AM, welkam wrote: > Observation Nr. 1 > People prefer to write var++ instead of ++var. > > Observation Nr. 2 > Because of observation Nr. 1 and other reasons compilers became good at > removing code that is not needed making var++ and ++var to produce the > same code if return

Re: Parallel Merge Sort

2015-03-04 Thread Ali Çehreli via Digitalmars-d
On 03/04/2015 03:23 PM, Ali Çehreli wrote:> On 03/04/2015 02:18 PM, Josh wrote: > > > now say A[] was = [90, 50, 33, 72, 35] > > > > and by the end of the function B[] = [33, 50, 72, 90, 35] > > > > > > now we call swap(A,B) and A would now = [33, 35, 50, 72, 90] > > > > and somehow the 3

Re: Parallel Merge Sort

2015-03-04 Thread Ali Çehreli via Digitalmars-d
On 03/04/2015 02:18 PM, Josh wrote: > now say A[] was = [90, 50, 33, 72, 35] > > and by the end of the function B[] = [33, 50, 72, 90, 35] > > > now we call swap(A,B) and A would now = [33, 35, 50, 72, 90] > > and somehow the 35 moves in front of the 50. Not for me. I think there is bug in the a

Re: What is going on here?

2015-03-04 Thread Ali Çehreli via Digitalmars-d
On 03/04/2015 07:43 AM, Steven Schveighoffer wrote: On 3/4/15 8:43 AM, Shachar Shemesh wrote: I'd expect A's destructor to run, which does not seem to be the case. I believe destructors are not run when you throw inside a constructor. So plan to deallocate if the ctor throws: a = A(var + 1)

Re: Cannot instantiate a std.container.Array of a class with a init() function member.

2015-03-02 Thread Ali Çehreli via Digitalmars-d
On 03/02/2015 09:48 AM, H. S. Teoh via Digitalmars-d wrote: The compiler should reject members named 'init' because .init already has a special meaning in the language. Existing issue: https://issues.dlang.org/show_bug.cgi?id=12545 Ali

Re: Broken Timsort

2015-02-24 Thread Ali Çehreli via Digitalmars-d
On 02/24/2015 02:54 PM, Josh wrote: I've noticed that std.algorithm.sort uses Timsort for stable sorting, but as I don't know much about the implementation in D, someone more knowledgeable may be able to answer this. It appears that there is a bug in the Python and Java implementations of Timsort

Re: Is D's TimSort correct?

2015-02-24 Thread Ali Çehreli via Digitalmars-d
On 02/24/2015 11:20 AM, ketmar wrote: On Tue, 24 Feb 2015 10:47:19 -0800, Ali Çehreli wrote: Some implementation out there are buggy: http://www.reddit.com/r/programming/comments/2wze7z/ proving_that_androids_javas_and_pythons_sorting/ Ali p.s. and yes, `TimSortImpl` is broken. Thanks

Re: Is D's TimSort correct?

2015-02-24 Thread Ali Çehreli via Digitalmars-d
On 02/24/2015 11:15 AM, ketmar wrote: > and it's interesting what complications templates can bring. testing > templates is relatively hard now, 'cause programmer must ensure that > every path is instantiated (i'm constantly hitting by the bugs in my > templates due to missing some codepathes).

Is D's TimSort correct?

2015-02-24 Thread Ali Çehreli via Digitalmars-d
Some implementation out there are buggy: http://www.reddit.com/r/programming/comments/2wze7z/proving_that_androids_javas_and_pythons_sorting/ Ali

Re: [NEEDING HELP] Translation of Ali Cehreli's book in French

2015-02-17 Thread Ali Çehreli via Digitalmars-d
On 02/17/2015 09:31 AM, Raphaël Jakse wrote: > So far, I translated 48 chapters, and I began the 49th. Thank you Raphaël, it's been an amazing effort of yours! If I count correctly, that makes 56% completed. (Yay! Ali is back to counting percentages... :) ) > My work is versioned here: > > S

Re: Proposal : aggregated dlang git repository

2015-02-08 Thread Ali Çehreli via Digitalmars-d
On 02/08/2015 10:33 PM, Dicebot wrote: > Trivial proof of concept : https://github.com/Dicebot/TestDlangAggregated Great idea. I've been using the following one just to keep up-to-date with git head dmd and Phobos: https://github.com/carlor/dlang-workspace Ali

Re: dlang.org redesign n+1

2015-01-21 Thread Ali Çehreli via Digitalmars-d
On 01/21/2015 07:00 AM, Ali Çehreli wrote: On 01/21/2015 06:46 AM, Sebastiaan Koppe wrote: > Just for fun and proof-of-concept I went ahead and forked the dlang.org > site. I basically took the `do-what-everybody-else-is-doing` approach: > > http://dlang.skoppe.eu I love it! While you're

Re: dlang.org redesign n+1

2015-01-21 Thread Ali Çehreli via Digitalmars-d
On 01/21/2015 06:46 AM, Sebastiaan Koppe wrote: > Just for fun and proof-of-concept I went ahead and forked the dlang.org > site. I basically took the `do-what-everybody-else-is-doing` approach: > > http://dlang.skoppe.eu I love it! I seriously think that this kind of modern look will help with

Re: The ugly truth about ddoc

2015-01-18 Thread Ali Çehreli via Digitalmars-d
On 01/18/2015 06:18 PM, Andrei Alexandrescu wrote: A general plea about ddoc: Please don't change its behavior; a whole book depends on how it behaves. :) There were silent changes in the past, which made me find workarounds and change the way I use ddoc. Ali

Re: no size yet for forward reference for nested structures

2015-01-15 Thread Ali Çehreli via Digitalmars-d
On 01/15/2015 06:56 AM, zeljkog wrote: This compiles: import std.container; class Node { DList!Node children; } So does using an 'interface', which may be more desirable in some cases: import std.container; interface Iface {} class Node : Iface { SList!Iface children; } void main

Re: no size yet for forward reference for nested structures

2015-01-14 Thread Ali Çehreli via Digitalmars-d
On 01/14/2015 07:39 AM, ketmar via Digitalmars-d wrote: On Wed, 14 Jan 2015 07:09:44 -0800 Ali Çehreli via Digitalmars-d wrote: Reduced: import std.container; class Node { SList!Node children; } void main() {} Error: class deneme.Node no size yet for forward reference I wonder why

Re: no size yet for forward reference for nested structures

2015-01-14 Thread Ali Çehreli via Digitalmars-d
On 01/14/2015 02:53 AM, ketmar via Digitalmars-d wrote: > On Wed, 14 Jan 2015 10:41:07 + > qqiang via Digitalmars-d wrote: > >> template PowerHeap(T) { >> import std.container : SList; >> >> private alias PowerForest = SList!PowerNode; >> >> private final class PowerNode {

Re: no size yet for forward reference for nested structures

2015-01-14 Thread Ali Çehreli via Digitalmars-d
First a reminder that this sort of question is more suitable to the D.learn newsgroup. On 01/13/2015 10:41 PM, qqiang wrote: > The following code: > ```D > template PowerHeap(T) { > import std.container : SList; > > private alias PowerForest = SList!PowerNode; > > private final c

Re: Foreach, return not exist the function.

2015-01-11 Thread Ali Çehreli via Digitalmars-d
On 01/11/2015 12:25 PM, Zaher Dirkey wrote: > reproduce example here > http://dpaste.dzfl.pl/13fb453d0b1e That link doesn't work for me. (?) Does opApply return the delegate's return value ('b' below)? import std.stdio; struct S { int opApply(int delegate(int) dg) { foreach (i

Re: allMembers returns no members for a package

2014-12-19 Thread Ali Çehreli via Digitalmars-d
On 12/19/2014 06:05 AM, ketmar via Digitalmars-d wrote: my search-fu sux. maybe someone with better skills will provide the links. Searching for 'allMembers package' found the following bug. :) https://issues.dlang.org/show_bug.cgi?id=11595 Ali

Re: D Meetup in SF?

2014-12-05 Thread Ali Çehreli via Digitalmars-d
On 12/05/2014 12:15 AM, Shammah Chancellor wrote: I didn't notice a D meetup group in SF. Is anyone else in here interested in doing something like this once a month? -S. I am interested but Tuesdays are not good for me. Do you mean San Francisco proper, or more South? Andrei wanted to start

Re: Keeping a dynamic sorted range

2014-11-07 Thread Ali Çehreli via Digitalmars-d
On 11/07/2014 06:11 AM, bearophile wrote: (This is a partial repost from a recent D.learn thread.) In Phobos we have SortedRange and assumeSorted, but I do find them not very good for a common enough use case. The use case is to keep a sorted array, keep adding items to it (adding larger and la

Re: "The D Programming Language: Getting Started" event

2014-11-04 Thread Ali Çehreli via Digitalmars-d
On 11/04/2014 02:46 PM, Ali Çehreli wrote: On 11/04/2014 01:39 PM, nemo wrote: (a bit late) A nice initiative to promote the D programming language: http://bucharest.techhub.com/events/the-d-programming-language-getting-started- Bad link or not public yet? Ali I think that was my Thunderb

Re: "The D Programming Language: Getting Started" event

2014-11-04 Thread Ali Çehreli via Digitalmars-d
On 11/04/2014 01:39 PM, nemo wrote: (a bit late) A nice initiative to promote the D programming language: http://bucharest.techhub.com/events/the-d-programming-language-getting-started- Bad link or not public yet? Ali

Re: Does search work at all in forum?

2014-11-04 Thread Ali Çehreli via Digitalmars-d
On 11/04/2014 11:11 AM, tcak wrote: I don't remember anytime the search box of forum worked at all. All pages load really quickly, but when I want to search anything, it waits for a while (Firefox indicates something request is going), then stop, and nothing happens. Example I would search for "

Re: Trivial (but not bikeshed please) question of style…

2014-10-28 Thread Ali Çehreli via Digitalmars-d
On 10/28/2014 06:41 AM, "Ola Fosheim Grøstad" " wrote: On Tuesday, 28 October 2014 at 08:15:58 UTC, Russel Winder via Digitalmars-d wrote: parent.send(result) or: send(parent, result) as being idiomatic D code? I cannot speak for idioms, but this is a good example of how UFCS fails

Re: Blaming the D language

2014-10-21 Thread Ali Çehreli via Digitalmars-d
On 10/21/2014 11:06 PM, thedeemon wrote: A[B] freshCleanAA; aa = freshCleanAA; (where A[B] denotes the type of aa) That's it! Alternative: A[B] aa; aa = aa.init; Ali

Re: example of pointer usefulness in D

2014-10-21 Thread Ali Çehreli via Digitalmars-d
On 10/21/2014 01:15 PM, bearophile wrote: Ali Çehreli: - References to any local data because 'ref' is only for parameters and return types. int a; int b; int* r = (condition ? &a : &b);// r must be a pointer *r = 42; Regarding this example, this works: void main() {

Re: example of pointer usefulness in D

2014-10-21 Thread Ali Çehreli via Digitalmars-d
On 10/21/2014 05:22 AM, edn wrote:> Could someone provide me with examples showing the usefulness of > pointers in the D language? They don't seem to be used as much as in C > and C++. A pointer is the only sensible option for the following: - References to any local data because 'ref' is only

Re: UFCS in C++

2014-10-13 Thread Ali Çehreli via Digitalmars-d
On 10/13/2014 01:53 AM, Peter Alexander wrote: Looks like Bjarne has proposed UFCS for C++ http://isocpp.org/files/papers/N4174.pdf No mention of D though... Actually, there are references to D in that article. One of those is even about considering D as an "alternative". An excerpt from pag

No TypeTuple expansion for assert?

2014-10-03 Thread Ali Çehreli via Digitalmars-d
I know that assert is not a function but it would be nice to have. import std.exception; void foo(T...)(T args) { // Compiles: enforce(args); // DOES NOT COMPILE: // assert(args); // Must expand manually: assert(args[0], args[1]); } void main() { foo(true, "hi"); }

Re: On exceptions, errors, and contract violations

2014-10-03 Thread Ali Çehreli via Digitalmars-d
On 10/03/2014 10:40 AM, Sean Kelly wrote: > an API has no idea how important its proper function is to the > application writer. Agreed. Further, an API has no idea whether its caller is a "user" or a "library". (I will expand below.) > If a programmer passes out of range arguments to a math

Re: scope() statements and return

2014-10-02 Thread Ali Çehreli via Digitalmars-d
On 10/02/2014 07:17 PM, Shammah Chancellor wrote: Per the documentation (http://dlang.org/statement.html) scope statements are not precluded from returning, but DMD does not allow for it. Should the documentation be updated? -S Can you show a piece of code. The following quote says "may not e

<    1   2   3   4   5   >