[Issue 16183] [REG2.068] compile-time string concatenation fails with CTFE and char[] literal involved

2016-07-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16183 Walter Bright changed: What|Removed |Added Keywords||CTFE

[Issue 16243] wrong C++ argument passing with empty struct and 6 integers

2016-07-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16243 Walter Bright changed: What|Removed |Added CC|

Re: Overflows in Phobos

2016-07-26 Thread Walter Bright via Digitalmars-d
On 7/26/2016 10:24 PM, Shachar Shemesh wrote: Most D programmers, however, expect the program not to continue executing past an assert(false). They might see it as a bug. Hence my question whether that means D is not meant for programming in privileged mode. Obviously, HALT means any

Re: Overflows in Phobos

2016-07-26 Thread Shachar Shemesh via Digitalmars-d
On 27/07/16 08:03, deadalnix wrote: On Wednesday, 27 July 2016 at 03:31:07 UTC, Adam D. Ruppe wrote: On Wednesday, 27 July 2016 at 03:13:38 UTC, Shachar Shemesh wrote: Does that mean D isn't meant to be used to develop code that will run in Ring-0? assert(0) is never supposed to actually

Re: Overflows in Phobos

2016-07-26 Thread deadalnix via Digitalmars-d
On Wednesday, 27 July 2016 at 03:31:07 UTC, Adam D. Ruppe wrote: On Wednesday, 27 July 2016 at 03:13:38 UTC, Shachar Shemesh wrote: Does that mean D isn't meant to be used to develop code that will run in Ring-0? assert(0) is never supposed to actually happen... Though, I do think it might

Re: Overflows in Phobos

2016-07-26 Thread Adam D. Ruppe via Digitalmars-d
On Wednesday, 27 July 2016 at 03:13:38 UTC, Shachar Shemesh wrote: Does that mean D isn't meant to be used to develop code that will run in Ring-0? assert(0) is never supposed to actually happen... Though, I do think it might be better to make it output `forever: hlt; jmp forever;` which I

Re: Overflows in Phobos

2016-07-26 Thread Shachar Shemesh via Digitalmars-d
On 27/07/16 00:56, Walter Bright wrote: What the assert(0) actually does is insert a HALT instruction, even when -release is used. The spec is poorly worded. Does that mean D isn't meant to be used to develop code that will run in Ring-0? Or do we treat it as a feature that kernel mode

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Charles Hixson via Digitalmars-d-learn
On 07/26/2016 12:53 PM, Adam D. Ruppe via Digitalmars-d-learn wrote: On Tuesday, 26 July 2016 at 19:30:35 UTC, Charles Hixson wrote: It looks as if the entire file is stored in memory, which is not at all what I want, but I also can't really believe that's what's going on. It is just mapped

Re: Remove stuff from a template mixin

2016-07-26 Thread Gorge Jingale via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 22:23:37 UTC, Jerry wrote: On Tuesday, 26 July 2016 at 19:02:32 UTC, Gorge Jingale wrote: I might want to actually use Add internally in B so I can add some elements behind the scenes, I do not want to expose it to the outside world though. There are no way to

Re: Why D isn't the next "big thing" already

2016-07-26 Thread Gorge Jingale via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 15:11:00 UTC, llaine wrote: Hi guys, I'm using D since a few month now and I was wondering why people don't jump onto it that much and why it isn't the "big thing" already. Everybody is into javascript nowadays, but IMO even for doing web I found Vibe.d more

Re: D-Man culture

2016-07-26 Thread solidstate1991 via Digitalmars-d-announce
And now, there's even a female (more precisely, a moe-anthropomorphic version) mascot made by me. Feel free to create derivatives. http://ziltoid1991.deviantart.com/art/DLang-chan-624180895?ga_submit_new=10%253A1469578950 http://www.pixiv.net/member_illust.php?mode=medium_id=58107541

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread ketmar via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 16:35:26 UTC, Charles Hixson wrote: That's sort of what I have in mind, but I want to do what in Fortran would be (would have been?) called record I/O, except that I want a file header that specifies a few things like magic number, records allocated, head of free

Re: Why D isn't the next "big thing" already

2016-07-26 Thread tsbockman via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 15:11:00 UTC, llaine wrote: I'm using D since a few month now and I was wondering why people don't jump onto it that much and why it isn't the "big thing" already. D2 is under active development. Bugs get fixed, bottlenecks get optimized, and features get added or

[Issue 15907] Unjustified "is not visible from module" deprecation warning when using getMember trait

2016-07-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15907 Ali Cehreli changed: What|Removed |Added CC||acehr...@yahoo.com ---

Re: Remove stuff from a template mixin

2016-07-26 Thread Jerry via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 19:02:32 UTC, Gorge Jingale wrote: I might want to actually use Add internally in B so I can add some elements behind the scenes, I do not want to expose it to the outside world though. There are no way to remove things from an template directly. But you could

Re: Overflows in Phobos

2016-07-26 Thread Walter Bright via Digitalmars-d
On 7/26/2016 7:28 AM, Timon Gehr wrote: According to the language documentation, the patch does not fix the problem. https://dlang.org/spec/expression.html#AssertExpression "The expression assert(0) is a special case; it signifies that it is unreachable code. [...] The optimization and code

Re: Overflows in Phobos

2016-07-26 Thread Jack Stouffer via Digitalmars-d
On Tuesday, 26 July 2016 at 21:53:48 UTC, Walter Bright wrote: On 7/26/2016 8:24 AM, Robert burner Schadek wrote: A perfect example for an item for your action list. Anybody can work on this! That's the point! Put it on the list so people know.

Re: Overflows in Phobos

2016-07-26 Thread Walter Bright via Digitalmars-d
On 7/26/2016 8:24 AM, Robert burner Schadek wrote: A perfect example for an item for your action list. Anybody can work on this!

Re: Search elemnt in Compile-time Argument List of strings

2016-07-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/26/16 4:58 PM, ParticlePeter wrote: On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer wrote: void processMember( T, ignore... )() { foreach( member; __traits( allMembers, T )) { // this is a compile-time list, so it's a static foreach. foreach(i, arg; ignore ){ // i

Re: Search elemnt in Compile-time Argument List of strings

2016-07-26 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 21:20:18 UTC, ParticlePeter wrote: ... First of all there seems to be a typo, it should not be: else static if(i + 1 == arg.length) ignore must be used instead of arg, as arg.length is the length of a string: else static if(i + 1 == ignore.length) if ignore is

Re: Search elemnt in Compile-time Argument List of strings

2016-07-26 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 21:01:19 UTC, Ali Çehreli wrote: On 07/26/2016 01:58 PM, ParticlePeter wrote: On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer wrote: ... void processMember( T, ignore... )() { foreach( member; __traits( allMembers, T )) { // this is a compile-time

Re: @gc attribute for bypassign @nogc

2016-07-26 Thread bitwise via Digitalmars-d
On Tuesday, 26 July 2016 at 14:51:21 UTC, jmh530 wrote: On Tuesday, 26 July 2016 at 01:07:27 UTC, Chris Wright wrote: @nogc conflates "doesn't allocate memory from the GC heap because I don't want my application to use the GC at all" with "doesn't cause GC collection pauses". The latter

Re: Why D isn't the next "big thing" already

2016-07-26 Thread phant0m via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 15:11:00 UTC, llaine wrote: Hi guys, I'm using D since a few month now and I was wondering why people don't jump onto it that much and why it isn't the "big thing" already. Everybody is into javascript nowadays, but IMO even for doing web I found Vibe.d more

Re: Search elemnt in Compile-time Argument List of strings

2016-07-26 Thread Ali Çehreli via Digitalmars-d-learn
On 07/26/2016 01:58 PM, ParticlePeter wrote: On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer wrote: ... void processMember( T, ignore... )() { foreach( member; __traits( allMembers, T )) { // this is a compile-time list, so it's a static foreach. foreach(i, arg; ignore ){

Re: Search elemnt in Compile-time Argument List of strings

2016-07-26 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer wrote: ... void processMember( T, ignore... )() { foreach( member; __traits( allMembers, T )) { // this is a compile-time list, so it's a static foreach. foreach(i, arg; ignore ){ // i is the index into the ignore tuple

Re: @gc attribute for bypassign @nogc

2016-07-26 Thread bitwise via Digitalmars-d
On Tuesday, 26 July 2016 at 02:49:59 UTC, ketmar wrote: On Tuesday, 26 July 2016 at 02:42:52 UTC, bitwise wrote: Something like @warngc could work nicely. It could function exactly as @nogc with the exception that it issued warnings instead of errors. i don't think that it will be added,

Re: Search elemnt in Compile-time Argument List of strings

2016-07-26 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer wrote: ... Thanks a lot for this really cool and detailed explanation (upvoting!). It's a bit weird to work on these compile-time things, but they are so cool when you look at what is available in std.meta and std.traits :)

Re: Check of point inside/outside polygon

2016-07-26 Thread Gorge Jingale via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 19:08:09 UTC, H. S. Teoh wrote: On Tue, Jul 26, 2016 at 06:39:58PM +, Gorge Jingale via Digitalmars-d-learn wrote: On Tuesday, 26 July 2016 at 17:38:43 UTC, Suliman wrote: > I have arbitrary polygon. I need any solution. Performance > is does not matter at

Re: Search elemnt in Compile-time Argument List of strings

2016-07-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/26/16 3:30 PM, ParticlePeter wrote: I want to generate one function for any struct data member, but also want to be able to skip few of the members. The first part works, but I have some trouble with the skipping. I pass the struct type and a Compile-time Argument List of strings as

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/26/16 3:30 PM, Charles Hixson via Digitalmars-d-learn wrote: On 07/26/2016 11:31 AM, Steven Schveighoffer via Digitalmars-d-learn wrote: Now, C i/o's buffering may not suit your exact needs. So I don't know how it will perform. You may want to consider mmap which tells the kernel to link

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 19:30:35 UTC, Charles Hixson wrote: It looks as if the entire file is stored in memory, which is not at all what I want, but I also can't really believe that's what's going on. It is just mapped to virtual memory without actually being loaded into physical

Re: Search elemnt in Compile-time Argument List of strings

2016-07-26 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 19:30:18 UTC, ParticlePeter wrote: // Second approach, get warnings for every skipped member // and every line after the return statement: // Warning: statement is not reachable void processMember( T, ignore... )() { foreach( member; __traits( allMembers, T )) {

Search elemnt in Compile-time Argument List of strings

2016-07-26 Thread ParticlePeter via Digitalmars-d-learn
I want to generate one function for any struct data member, but also want to be able to skip few of the members. The first part works, but I have some trouble with the skipping. I pass the struct type and a Compile-time Argument List of strings as template arguments to a template function,

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Charles Hixson via Digitalmars-d-learn
On 07/26/2016 11:31 AM, Steven Schveighoffer via Digitalmars-d-learn wrote: On 7/26/16 1:57 PM, Charles Hixson via Digitalmars-d-learn wrote: Thanks. Since there isn't any excess overhead I guess I'll use stdio. Buffering, however, isn't going to help at all since I'm doing randomIO. I know

Re: Overflows in Phobos

2016-07-26 Thread Steven Schveighoffer via Digitalmars-d
On 7/26/16 2:44 PM, Timon Gehr wrote: On 26.07.2016 17:44, Johan Engelen wrote: The compiler can assume it is unreachable code, but it has to keep it, That makes no sense. Those two statements are mutually exclusive. I thought that assert(0) means that the compiler does not need to check

Re: Check of point inside/outside polygon

2016-07-26 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jul 26, 2016 at 06:39:58PM +, Gorge Jingale via Digitalmars-d-learn wrote: > On Tuesday, 26 July 2016 at 17:38:43 UTC, Suliman wrote: > > I have arbitrary polygon. I need any solution. Performance is does not > > matter at current moment. > > A polygon is made up of lines. For a

Re: Remove stuff from a template mixin

2016-07-26 Thread Gorge Jingale via Digitalmars-d-learn
I might want to actually use Add internally in B so I can add some elements behind the scenes, I do not want to expose it to the outside world though.

[Issue 16210] std.utf.byUTF can be made into a bidirectional range

2016-07-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16210 Jack Stouffer changed: What|Removed |Added Depends on||16323 --

[Issue 16323] New: std.utf.decodeBack

2016-07-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16323 Issue ID: 16323 Summary: std.utf.decodeBack Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1

[Issue 16323] std.utf.decodeBack

2016-07-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16323 Jack Stouffer changed: What|Removed |Added Blocks||16210 --

Remove stuff from a template mixin

2016-07-26 Thread Gorge Jingale via Digitalmars-d-learn
Is there a way to remove functions and fields that a mixin template adds? I use mixin templates to create other types contents, like struct A { mixin Stuff(); } But Sometimes I only want some of the stuff. struct B { mixin Stuff(); @disable Add(); } B is like an A but doesn't have the

Re: typeid() on class instances discards immutable

2016-07-26 Thread Timon Gehr via Digitalmars-d
On 25.07.2016 17:48, Cauterite wrote: I noticed that for some class `T`, `typeid(new immutable(T)) != typeid(immutable(T))`. The immutability is lost in the object's typeinfo, but retained in the class's typeinfo. See: https://dpaste.dzfl.pl/f04d41ff2986 Is this intended behaviour or a bug? I

Re: Overflows in Phobos

2016-07-26 Thread Timon Gehr via Digitalmars-d
On 26.07.2016 17:44, Johan Engelen wrote: On Tuesday, 26 July 2016 at 14:28:48 UTC, Timon Gehr wrote: According to the language documentation, the patch does not fix the problem. https://dlang.org/spec/expression.html#AssertExpression "The expression assert(0) is a special case; it signifies

Re: Check of point inside/outside polygon

2016-07-26 Thread Gorge Jingale via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 17:38:43 UTC, Suliman wrote: I have arbitrary polygon. I need any solution. Performance is does not matter at current moment. A polygon is made up of lines. For a point to be inside a convex polygon, it must be to the "right" of all the lines with clockwise

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/26/16 1:57 PM, Charles Hixson via Digitalmars-d-learn wrote: Thanks. Since there isn't any excess overhead I guess I'll use stdio. Buffering, however, isn't going to help at all since I'm doing randomIO. I know that most of the data the system reads from disk is going to end up getting

Re: Check of point inside/outside polygon

2016-07-26 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jul 26, 2016 at 05:38:43PM +, Suliman via Digitalmars-d-learn wrote: > I have arbitrary polygon. I need any solution. Performance is does not > matter at current moment. In that case, maybe you'd want to look at: https://en.wikipedia.org/wiki/Vatti_clipping_algorithm Note,

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Charles Hixson via Digitalmars-d-learn
On 07/26/2016 10:18 AM, Steven Schveighoffer via Digitalmars-d-learn wrote: On 7/26/16 12:58 PM, Charles Hixson via Digitalmars-d-learn wrote: Ranges aren't free, are they? If so then I should probably use stdfile, because that is probably less likely to change than core.stdc.stdio. Do you

Re: Template argument deduction for class templates adopted in cpp17

2016-07-26 Thread deadalnix via Digitalmars-d
On Tuesday, 26 July 2016 at 05:12:13 UTC, mogu wrote: Link: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0091r1.html And we have DIP40: http://wiki.dlang.org/DIP40 Is someone there to renew it in new DIPs repo? T.T I'd like to see that move forward, but the way this DIP is doing

Re: Check of point inside/outside polygon

2016-07-26 Thread Suliman via Digitalmars-d-learn
I have arbitrary polygon. I need any solution. Performance is does not matter at current moment.

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/26/16 12:58 PM, Charles Hixson via Digitalmars-d-learn wrote: Ranges aren't free, are they? If so then I should probably use stdfile, because that is probably less likely to change than core.stdc.stdio. Do you mean slices? When I see "f.rawRead([0 .. 1])" it looks to me as if unneeded

Re: question about conditional operator (?:)

2016-07-26 Thread Ali Çehreli via Digitalmars-d-learn
On 07/26/2016 06:41 AM, Richard wrote: From http://wiki.dlang.org/Operator_precedence In case it's useful to others, I explain that table a little bit here (associativity, unordered operators, and the precedence of =>): http://ddili.org/ders/d.en/operator_precedence.html Ali

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Charles Hixson via Digitalmars-d-learn
On 07/26/2016 05:31 AM, Steven Schveighoffer via Digitalmars-d-learn wrote: On 7/25/16 9:19 PM, Charles Hixson via Digitalmars-d-learn wrote: On 07/25/2016 05:18 PM, ketmar via Digitalmars-d-learn wrote: On Monday, 25 July 2016 at 18:54:27 UTC, Charles Hixson wrote: Are there reasons why one

IEEE Spectrum: The Top Programming Languages 2016

2016-07-26 Thread Hugo via Digitalmars-d-announce
Hi, The subject says most about it, the link is down below [1]. What I find interesting about this interactive ranking is that you can play around with the weighing of the data sources. Also: D is the only language categorised as being used for web and embedded, but not for mobile or

Re: Check of point inside/outside polygon

2016-07-26 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jul 26, 2016 at 01:32:00PM +, Suliman via Digitalmars-d-learn wrote: > Ideally I need algorithm that can return bool if one polygon > overlapped/intersected by another. But I do not know math. Are you talking about triangles, or general polygons? Are the polygons convex or arbitrary?

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Charles Hixson via Digitalmars-d-learn
On 07/25/2016 09:22 PM, ketmar via Digitalmars-d-learn wrote: On Tuesday, 26 July 2016 at 04:05:22 UTC, Charles Hixson wrote: Yes, but I really despise the syntax they came up with. It's probably good if most of your I/O is ranges, but mine hasn't yet ever been. (Combining ranges with random

Re: Overflows in Phobos

2016-07-26 Thread Johan Engelen via Digitalmars-d
On Tuesday, 26 July 2016 at 14:28:48 UTC, Timon Gehr wrote: According to the language documentation, the patch does not fix the problem. https://dlang.org/spec/expression.html#AssertExpression "The expression assert(0) is a special case; it signifies that it is unreachable code. [...] The

Re: Overflows in Phobos

2016-07-26 Thread Robert burner Schadek via Digitalmars-d
A perfect example for an item for your action list.

Re: Our docs should be more beautiful

2016-07-26 Thread Robert burner Schadek via Digitalmars-d
** RANT ON ** A perfect example for an item for your action list. And it pretty much looks like the syntax the wiki is using already. I bet you a drink at next years DConf that it will take you at least 10 minutes to find and reread this thread next time you create a vision document just to

Why D isn't the next "big thing" already

2016-07-26 Thread llaine via Digitalmars-d-learn
Hi guys, I'm using D since a few month now and I was wondering why people don't jump onto it that much and why it isn't the "big thing" already. Everybody is into javascript nowadays, but IMO even for doing web I found Vibe.d more interesting and efficient than node.js for example. I

Re: An IO Streams Library

2016-07-26 Thread Johannes Pfau via Digitalmars-d
Am Sun, 24 Jul 2016 13:03:01 + schrieb Martin Nowak : > On Sunday, 7 February 2016 at 00:48:54 UTC, Jason White wrote: > > I'm interested in feedback on this library. What is it missing? > > How can be better? > > I think making the actual read/write/open/accept/et.al.

Re: @gc attribute for bypassign @nogc

2016-07-26 Thread jmh530 via Digitalmars-d
On Tuesday, 26 July 2016 at 01:07:27 UTC, Chris Wright wrote: @nogc conflates "doesn't allocate memory from the GC heap because I don't want my application to use the GC at all" with "doesn't cause GC collection pauses". The latter can have a @assumenogc annotation that works -- you call

Re: An IO Streams Library

2016-07-26 Thread Johannes Pfau via Digitalmars-d
Am Mon, 25 Jul 2016 13:10:42 + schrieb ikod : > On Sunday, 7 February 2016 at 00:48:54 UTC, Jason White wrote: > > I see the subject of IO streams brought up here occasionally. > > The general consensus seems to be that we need something better > > than what Phobos

Re: Overflows in Phobos

2016-07-26 Thread ketmar via Digitalmars-d
On Tuesday, 26 July 2016 at 14:28:48 UTC, Timon Gehr wrote: "The expression assert(0) is a special case; it signifies that it is unreachable code. [...] The optimization and code generation phases of compilation may assume that it is unreachable code." so specs should be fixed. i bet

Re: question about conditional operator (?:)

2016-07-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, July 26, 2016 13:41:39 Richard via Digitalmars-d-learn wrote: > On Tuesday, 26 July 2016 at 13:19:54 UTC, ag0aep6g wrote: > > Operator precedence is different from what you think. `a ? b : > > c = d` means `(a ? b : c) = d`. But you want `a ? b : (c = d)`. > > So you need parentheses

Re: Overflows in Phobos

2016-07-26 Thread Timon Gehr via Digitalmars-d
On 26.07.2016 00:17, Walter Bright wrote: In poking around in Phobos, I found a number of cases like: https://github.com/dlang/phobos/pull/4655 where overflow is possible in calculating storage sizes. Since allocation normally happens in @trusted code, these are a safety/security hole.

Re: question about conditional operator (?:)

2016-07-26 Thread Richard via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 13:19:54 UTC, ag0aep6g wrote: Operator precedence is different from what you think. `a ? b : c = d` means `(a ? b : c) = d`. But you want `a ? b : (c = d)`. So you need parentheses around `p+=1`. Or just go with `if` and `else`. It's clearer anyway. From

Check of point inside/outside polygon

2016-07-26 Thread Suliman via Digitalmars-d-learn
Ideally I need algorithm that can return bool if one polygon overlapped/intersected by another. But I do not know math. After some googling I found topic on SO[1] about point inside/outside polygon. It's not directly what I need, but as temporal solution would be enough. Maybe somebody

Re: question about conditional operator (?:)

2016-07-26 Thread ag0aep6g via Digitalmars-d-learn
On 07/26/2016 03:09 PM, Richard wrote: if(n%p==0) n/=p; else p+=1; [...] However, if I replace the content of the for loop with the ?: operator, the program is not correct anymore (largestPrimeFactor(4) now returns 3): [...] n%p==0 ? n/=p :

Re: question about conditional operator (?:)

2016-07-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 13:17:27 UTC, Adam D. Ruppe wrote: (n%p==0) ? n/=p : p+=1 ; And actually, using ?: with /= and += is kinda bizarre. I think you are better off leaving this as if/else since the point of this is the assignment rather than the return value.

Re: question about conditional operator (?:)

2016-07-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 13:09:28 UTC, Richard wrote: n%p==0 ? n/=p : p+=1 ; Try (n%p==0) ? n/=p : p+=1 ; I'm pretty sure the order of operations (precedence rules) puts ?: above ==.

Re: question about conditional operator (?:)

2016-07-26 Thread Cauterite via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 13:09:28 UTC, Richard wrote: Hello all, try using some parentheses: (n%p==0) ? (n/=p) : (p+=1) ;

question about conditional operator (?:)

2016-07-26 Thread Richard via Digitalmars-d-learn
Hello all, I've got a program that correctly computes the largest factor in the prime decomposition of a positive number: * import std.math std.stdio; ulong largestPrimeFactor(ulong n) { for(ulong p=2; p<=sqrt(cast(real)n); ) {

Re: Template argument deduction for class templates adopted in cpp17

2016-07-26 Thread Steven Schveighoffer via Digitalmars-d
On 7/26/16 1:12 AM, mogu wrote: Link: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0091r1.html And we have DIP40: http://wiki.dlang.org/DIP40 Is someone there to renew it in new DIPs repo? T.T I think this should be forwarded. It's a very nice thing, and having C++ adopting it

Re: Expression template

2016-07-26 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 10:35:12 UTC, Etranger wrote: I'll have time 2 months from now as I'm getting married in 2 weeks :) Congratulations!

Re: randomIO, std.file, core.stdc.stdio

2016-07-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/25/16 9:19 PM, Charles Hixson via Digitalmars-d-learn wrote: On 07/25/2016 05:18 PM, ketmar via Digitalmars-d-learn wrote: On Monday, 25 July 2016 at 18:54:27 UTC, Charles Hixson wrote: Are there reasons why one would use rawRead and rawWrite rather than fread and fwrite when doiing

Re: Assert question

2016-07-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 12:13:02 UTC, DLearner wrote: What is the recommended way of identifying which assert has been triggered? If you compile with -g, run the program in a debugger. It will tell you. If you compile and do NOT use -release, the error message automatically printed by

Re: Assert question

2016-07-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/26/16 8:13 AM, DLearner wrote: Suppose a program contains several points that control should not get to. So each such point is blocked by assert(0). What is the recommended way of identifying which assert has been triggered? Is one allowed anything like 'assert(0,"Crashed at point A");',

Assert question

2016-07-26 Thread DLearner via Digitalmars-d-learn
Suppose a program contains several points that control should not get to. So each such point is blocked by assert(0). What is the recommended way of identifying which assert has been triggered? Is one allowed anything like 'assert(0,"Crashed at point A");', where the message goes to stderr?

Re: D APT repository fails

2016-07-26 Thread Luis via Digitalmars-d
On Monday, 25 July 2016 at 18:20:13 UTC, lqjglkqjsg wrote: On Monday, 25 July 2016 at 15:51:50 UTC, Zardoz wrote: I keep seeing along this last month many problems with the D APT repository. There is any one cheeking the health of these repository ? Now I get an error with

Re: Expression template

2016-07-26 Thread Etranger via Digitalmars-d-learn
On Saturday, 23 July 2016 at 23:55:44 UTC, ag0aep6g wrote: On 07/23/2016 01:05 PM, Etranger wrote: [...] To avoid the string mixin, you can let VecExpression take an alias of the mixin template (Vec_impl/VecSum_impl) and the list of arguments: [...] Thanks ! that's way much cleaner and

Re: Expression template

2016-07-26 Thread Etranger via Digitalmars-d-learn
On Sunday, 24 July 2016 at 10:53:41 UTC, Ilya Yaroshenko wrote: On Saturday, 23 July 2016 at 11:05:57 UTC, Etranger wrote: [...] Yes, but it is more complicated in terms of multidimensional and generic abstraction. First we need to finish and test general matrix multiplication [2]. [...]

Re: Static ternary if

2016-07-26 Thread Cauterite via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 00:54:59 UTC, Michael Coulombe wrote: If that's ok, then try out std.traits.Select or std.traits.select: https://dlang.org/phobos/std_traits.html#Select Damn, I looked real hard for that template, I knew it existed. I expected it to be in std.meta though.

Re: Trouble using 'sort'

2016-07-26 Thread Bahman Movaqar via Digitalmars-d-learn
On 07/26/2016 11:42 AM, drug wrote: > Another option is `makeIndex` (std.algorithm.sorting) and then sorting > of that index. That's an interesting option; at least I don't have to touch the range. Thanks. -- Bahman

Re: Trouble using 'sort'

2016-07-26 Thread Bahman Movaqar via Digitalmars-d-learn
On 07/26/2016 10:41 AM, Jonathan M Davis via Digitalmars-d-learn wrote: >> So it may be something about what kind of range I'm passing to `sort`. >> Am I right? > > sort requires a random access range. Without knowing exactly which > algorithms your using, I can't say for sure that that's the

Re: Trouble using 'sort'

2016-07-26 Thread drug via Digitalmars-d-learn
26.07.2016 09:11, Jonathan M Davis via Digitalmars-d-learn пишет: It's frequently the case that if you want to sort a range, you have to call array() on it to convert it to an array, and then you can sort the array. - Jonathan M Davis Another option is `makeIndex` (std.algorithm.sorting) and

Re: New Diet template engine almost complete, ready for comments

2016-07-26 Thread Puming via Digitalmars-d-announce
On Tuesday, 26 July 2016 at 05:54:39 UTC, Sönke Ludwig wrote: Am 26.07.2016 um 05:22 schrieb Puming: [...] A real runtime solution would require a D runtime interpreter or JIT compiler. There would be an alternative solution based on compiling each template to a shared library and then

Re: New Diet template engine almost complete, ready for comments

2016-07-26 Thread Rory McGuire via Digitalmars-d-announce
On Tue, Jul 26, 2016 at 7:54 AM, Sönke Ludwig < digitalmars-d-announce@puremagic.com> wrote: > [snip] > and on Linux the Gold linker should be used for speed, but then it should > be almost as good as a runtime solution. > Note on using Gold on linux. You can use lflags "-fuse-ld=gold", to get

Re: Trouble using 'sort'

2016-07-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, July 26, 2016 10:11:43 Bahman Movaqar via Digitalmars-d-learn wrote: > On 07/26/2016 09:35 AM, Bahman Movaqar wrote: > > I have a range which is the result of a couple of chained range > > > > operations, and each element is: > > Tuple!(string, "product", double, "price") > > > >

Re: New Diet template engine almost complete, ready for comments

2016-07-26 Thread Rory McGuire via Digitalmars-d-announce
On Tue, Jul 26, 2016 at 7:54 AM, Sönke Ludwig < digitalmars-d-announce@puremagic.com> wrote: > Am 26.07.2016 um 05:22 schrieb Puming: > >> On Monday, 25 July 2016 at 09:29:38 UTC, Sönke Ludwig wrote: >> >>> The Diet template language is aimed at providing a way to define >>> procedurally