Re: questions around mutating range algorithms, const, and return ref

2018-01-28 Thread Ali Çehreli via Digitalmars-d-learn
On 01/28/2018 02:52 PM, aliak wrote: > Hello, I'm trying to write a function called "pull" that, given 2 > ranges, "pull"s the values from range 2 out of range 1. I'm not sure if > I'm doing it correctly though, and I have some questions so any help is > appreciated. This is what I have: > > ref p

Re: parallelism

2018-01-28 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Sunday, 28 January 2018 at 04:44:23 UTC, thedeemon wrote: On Saturday, 27 January 2018 at 20:49:43 UTC, Arun Chandrasekaran wrote: But really I'm not sure why you want static foreach here I was just trying to see if static foreach can be used here, but well, you showed that it's not requi

Re: enforce (i > 0) for i = int.min does not throw

2018-01-28 Thread Seb via Digitalmars-d-learn
On Sunday, 28 January 2018 at 19:17:49 UTC, Steven Schveighoffer wrote: On 1/27/18 9:50 AM, ag0aep6g wrote: Wow, that looks really bad. Apparently, dmd implements `i < 0` as a `i >> 31`. I.e., it shifts the bits to the right so far that only the sign bit is left. This is ok. But it impleme

Re: Looks like wrong error message

2018-01-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, January 28, 2018 16:08:17 H. S. Teoh via Digitalmars-d-learn wrote: > On Sun, Jan 28, 2018 at 10:53:39PM +, welkam via Digitalmars-d-learn wrote: > > On Sunday, 28 January 2018 at 20:42:52 UTC, Jonathan M Davis wrote: > [...] > > > > However, you're not going to get an error messag

Re: Looks like wrong error message

2018-01-28 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Jan 28, 2018 at 10:53:39PM +, welkam via Digitalmars-d-learn wrote: > On Sunday, 28 January 2018 at 20:42:52 UTC, Jonathan M Davis wrote: [...] > > However, you're not going to get an error message that says anything > > like "the arguments aren't the same type." The compiler doesn't >

Re: Looks like wrong error message

2018-01-28 Thread welkam via Digitalmars-d-learn
On Sunday, 28 January 2018 at 20:42:52 UTC, Jonathan M Davis wrote: There is nothing incorrect about the error message. The compiler looked at all of the functions in the overload set, and it found none that matched. The reason that it found none that matched was because it couldn't find any

questions around mutating range algorithms, const, and return ref

2018-01-28 Thread aliak via Digitalmars-d-learn
Hello, I'm trying to write a function called "pull" that, given 2 ranges, "pull"s the values from range 2 out of range 1. I'm not sure if I'm doing it correctly though, and I have some questions so any help is appreciated. This is what I have: ref pull(R1, R2)(return ref R1 r1, R2 r2) { im

Re: rdmd main.d leads to Segmentation fault

2018-01-28 Thread Timoses via Digitalmars-d-learn
On Saturday, 27 January 2018 at 21:04:07 UTC, Kagamin wrote: On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote: Program received signal SIGSEGV, Segmentation fault. 0x00432e04 in _d_dso_registry () (gdb) bt #0 0x00432e04 in _d_dso_registry () #1 0x00431c63 in ?? () #2 0x0045c08b in __

Re: rdmd main.d leads to Segmentation fault

2018-01-28 Thread Timoses via Digitalmars-d-learn
On Saturday, 27 January 2018 at 01:23:44 UTC, Fra Mecca wrote: On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote: Hey, simple hello world crashes with segfault: [...] Where did you get the D toolchain? Got it from here: http://d-apt.sourceforge.net/ with $ apt-get install dmd-compi

Re: assert and enforce both compiled out with -release

2018-01-28 Thread Ali Çehreli via Digitalmars-d-learn
On 01/28/2018 11:31 AM, Steven Schveighoffer wrote: >> Fixed it through the "Improve this page" link on that Phobos page: >> >>https://github.com/dlang/phobos/blob/master/std/exception.d >> >> Ali > > Hm... it appears that you committed directly to the branch. Even if > changing docs, you sho

Re: Looks like wrong error message

2018-01-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, January 28, 2018 20:02:48 welkam via Digitalmars-d-learn wrote: > Error says that it cant deduce function from argument types but > in reality it fails to meet function template constraints. In > this case !is(CommonType!(staticMap!(ElementType, > staticMap!(Unqual, Ranges))) == void) >

Looks like wrong error message

2018-01-28 Thread welkam via Digitalmars-d-learn
Error says that it cant deduce function from argument types but in reality it fails to meet function template constraints. In this case !is(CommonType!(staticMap!(ElementType, staticMap!(Unqual, Ranges))) == void) In human terms it means that arguments are not the same type. Is this require b

Re: D generates large assembly for simple function

2018-01-28 Thread welkam via Digitalmars-d-learn
On Sunday, 28 January 2018 at 14:33:04 UTC, Johan Engelen wrote: Careful with these comparisons guys. Know what you are looking at. Wise words

Re: vibe.d compatible with d3 or pixieJS

2018-01-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/28/18 11:45 AM, Mark wrote: Hello! As the title suggests, I'm looking for the answer to this question. I've searched / asked it on the vibe forums, but nobody has answered. vibe.d is a server, and it serves javascript just fine. I've experimented with vibe, and I would like to build a d

Re: assert and enforce both compiled out with -release

2018-01-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/27/18 9:31 AM, Ali Çehreli wrote: On 01/27/2018 05:52 AM, kdevel wrote: > https://dlang.org/phobos/std_exception.html#enforce states: > > | Also, do not use enforce inside of contracts (i.e. inside of in and > out blocks > | and invariants), because they will be compiled out when compil

Re: enforce (i > 0) for i = int.min does not throw

2018-01-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/27/18 9:50 AM, ag0aep6g wrote: Wow, that looks really bad. Apparently, dmd implements `i < 0` as a `i >> 31`. I.e., it shifts the bits to the right so far that only the sign bit is left. This is ok. But it implements `i > 0` as `(-i) >> 31`. That would be correct if negation would alwa

vibe.d compatible with d3 or pixieJS

2018-01-28 Thread Mark via Digitalmars-d-learn
Hello! As the title suggests, I'm looking for the answer to this question. I've searched / asked it on the vibe forums, but nobody has answered. I'm not familiar enough with JS frameworks / vibe to really know how this would (not) work together. I've experimented with vibe, and I would lik

Re: Efficient way to pass struct as parameter

2018-01-28 Thread Marco Leise via Digitalmars-d-learn
Am Wed, 3 Jan 2018 10:57:13 -0800 schrieb Ali Çehreli : > On 01/03/2018 10:40 AM, Patrick Schluter wrote: > > On Tuesday, 2 January 2018 at 23:27:22 UTC, H. S. Teoh wrote: > >> > >> When it comes to optimization, there are 3 rules: profile, profile, > >> profile. I used to heavily hand-"opt

Re: D generates large assembly for simple function

2018-01-28 Thread Johan Engelen via Digitalmars-d-learn
On 01/27/2018 11:42 AM, Matt wrote: Godbolt link: https://godbolt.org/g/t5S976 Careful with these comparisons guys. Know what you are looking at. Rust does not eliminate setting the framepointer register, and so it looks "bad" [1]. Clang also sets the framepointer for macOS ABI regardless of

Re: std_exception.html#enforce: example does not compile

2018-01-28 Thread Seb via Digitalmars-d-learn
On Saturday, 27 January 2018 at 21:27:44 UTC, kdevel wrote: On Saturday, 27 January 2018 at 20:33:46 UTC, Jonathan M Davis wrote: Shall I file a bug report? Yes. https://issues.dlang.org/show_bug.cgi?id=18319 Thanks. Addressed and already merged: https://github.com/dlang/phobos/pull/6080

Re: assert and enforce both compiled out with -release

2018-01-28 Thread rjframe via Digitalmars-d-learn
On Sun, 28 Jan 2018 00:59:12 +, lobo wrote: > On Saturday, 27 January 2018 at 22:53:37 UTC, Ali Çehreli wrote: >> On 01/27/2018 10:33 AM, kdevel wrote: >> >>> I suggest the deletion of the sentence "Use assert in contracts." >> >> Done. >> >> Ali > > Wait, no this isn't right, is it? Enforce