Re: Why D isn't the next "big thing" already
On Sunday, 31 July 2016 at 10:11:46 UTC, LaTeigne wrote: On Saturday, 30 July 2016 at 12:24:55 UTC, ketmar wrote: On Saturday, 30 July 2016 at 12:18:08 UTC, LaTeigne wrote: it you think that you know the things better than somebody who actually *lived* there in those times... well, keep thinking that. also, don't forget to teach physics to physicians, medicine to medics, and so on. i'm pretty sure that you will have a great success as a stupidiest comic they ever seen in their life. also, don't bother answering me, i won't see it anyway. https://forums.embarcadero.com/thread.jspa?messageID=831486 Again an evidence of your super ego. You think that your own experiences stand for everybody while it's actually representing anything byt you, which is quite near from the nil. He clearly suffers from NPD. I believe this is due to ignorance of experience. With such little real world experience one conjures up their own fabricated sense of reality that revolves around themselves. Such people lack the ability to understand others experiences and write them off because they do not coincide with their own. It's a form of the god complex, yet clearly these people are not god and generally not even that intelligent, experienced in life , etc, or happen just to be good at one thing which they treat as the only thing that matters; which is illogical and insane but very convenient for them.
Template Inheritance
I like to build structures using template mixins because one can pick and choose functionality at compile time, but still have a relationship between different types. It would be really nice if one could sort of test if a template mixin was "mixed" in(or ideally, struct S : SomeTemplate (template inheritance)). While one can overcome a lot of the issues by doing static checking(e.g., does IsSomeTemplate compile or other introspective like checks), it is a bit messy and clutters up the code. Does anyone do stuff like this and have a nice elegant way?
Re: Why D isn't the next "big thing" already
On Wednesday, 27 July 2016 at 10:41:54 UTC, ketmar wrote: On Wednesday, 27 July 2016 at 10:39:52 UTC, NX wrote: Lack of production quality tools like? no, "refactoring" and other crap is not "production quality tools", they are only useful to pretend that you are doing something useful, so you will look busy for your boss. Do you ever get tired of your ego? You know, evolution supports that people like you are a dying breed. How does that feel? I bet it makes you feel good? I bet you live an awesome life, I don't know where you find time to stroke your ego so much though? Why don't you go live in a cave? That way you don't use any tools like a computer, or a car, or electricity... cause those all just get in the way of what's really important. Eagerly awaiting your response. P.S., I have a prediction, that you won't response intelligently.
Re: Remove stuff from a template mixin
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 remove things from an template directly. But you could however generate a new type which does not carry the specified members. This requires two steps: *The member filtering part *Generation part For the masking part take a look at https://forum.dlang.org/post/nn8gj8$6s5$1...@digitalmars.com What you basicly do is that you iterate the members and based on some condition filters out the members you don't want. Then for generating you have to handle functions and fields. For fields a string concatenated with other strings fields is probably good enough. Something like this: "typeof(" ~ fullyQualifiedName!Aggregate ~ "." ~ memberName ~ ") " ~ member;" That seems like a lot of work just to remove some elements. Creating a whole new template. I think using additive composition would be easier and more directly(a few lines of code to split the template), and I guess is the more natural way.
Re: Why D isn't the next "big thing" already
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 interesting and efficient than node.js for example. I agree that you have to be pragmatic and choose the right tools for the right jobs but I would be interested to have other opinion on thoses questions. I think it is because D has some fundamental problems. It is a risk to use software that is not proven to be safe, effective, and easy to use. The fact there are so many bugs(and many are big blockes) in D says something about D, it matters not how fast they are fixed. It forces you in to a certain mold. All that power it has is attractive, but much of it is hot air if you can't get it off the ground in any serious professional way. The larger the project one works on the more likely one will run in to bugs, the more complex the language is the slower it understand the problems, and the more limited tools one has, the slower it is. So, D has many things going against it compared with well establish languages. Because businesses care about the $$$, it matters what they use. D covers a lot more ground than almost any other compiler out their but it doesn't cover any of it will except in a few cases(the things that make it attractive). So, you can see D as a sort of dried up waste land desert with a few nice palm trees growing here and there and a few scorpions. C++, say, is a very lush forest with many tree dwelling monkeys. Which environment would you rather use? Sure, there is potential in the desert, it has nice hot sand, so if you like that, you'll be in paradise... also if you like palm trees(and most people in the D forum like palm trees... or scorpions, they can be a tasty treat every now and then). Ok, maybe a bit exaggerated, but point is most people don't like the desert and D is like a desert, but not as extreme. To actually prove why would require about 158 MIT students, a 10M$ grant, and a time machine. Do you have any of that?
Re: Check of point inside/outside polygon
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 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 orientation. [...] Unfortunately he wants to handle arbitrary polygons that are not necessarily convex. T The example was for convex, the method using intersections was for general polygons that do not have self-intersections. Convex polygons have 0 intersection numbers.
Re: Remove stuff from a template mixin
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.
Remove stuff from a template mixin
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 ability to add. While I could do something like move the Add function to another template, it gets messy quickly because all I want to do is remove a feature, not create a hierarchical system like oop. I tried making add private, but b.Add() still calls Stuff.Add.
Re: Check of point inside/outside polygon
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 orientation. One way for this to work is simply draw a line segment from each vertex to the point and compare it to the number of intersections with other lines. The number of intersections must be odd for it to be inside the polygon. Think of a regular polygon, any point inside will have no other line segments between it and the point. All intersection values will be 0. So, for each n vertices we have n line segments, we must the find the number of intersection points for the other n-1 line segments. This reduces the problem to line segment intersection but is of the order O(n^2), but works in general.
Re: Static ternary if
On Monday, 25 July 2016 at 22:27:11 UTC, Cauterite wrote: On Monday, 25 July 2016 at 02:15:12 UTC, Gorge Jingale wrote: Is there a static ternary if? (A == B) ? C : D; for compile type that works like static if. You can pretty easily make your own; template staticIf(bool cond, alias a, alias b) { static if (cond) { alias staticIf = a; } else { alias staticIf = b; }; }; The drawback is that there's no 'short-circuiting'; a and b are both evaluated. Cool, that would work. I don't think the lazy evaluation is a problem at compile time? Just makes for longer times, but should be pretty minuscule.
debug public release private
debug mixin("public"); else mixin("private"); Doesn't work. It's nice to have public members when debugging because they show up in the debugger and one can access internals for checking. One can enable per line using debug but it requires lots of duplicate code. Is there any easy way to do this?
Re: Randomized unittests
On Monday, 25 July 2016 at 02:36:04 UTC, Chris Wright wrote: On Mon, 25 Jul 2016 01:49:25 +, Gorge Jingale wrote: [...] http://code.dlang.org/packages/unit-threaded @Values() annotation on a unittest takes a range. Base that on a range that yields random values and Bob's your uncle. That range may need to be a compile-time constant. If so, it will be a little awkward to create, and you can ping Atila about possibly creating a @ValuesFrom annotation that will take a method or lambda that yields a range of values. Thanks, looks nice, a bit confusing but seems pretty useful. But why is Bob my uncle? ;)
Static ternary if
Is there a static ternary if? (A == B) ? C : D; for compile type that works like static if.
Randomized unittests
Is there any leverage in the D library for doing randomized unit testing? Testing things with a range of possibilities instead of fixed. Each time the test is ran a different version is executed. This provides more coverage. How does one create a random number at compile time? Is this the only way: http://dpaste.dzfl.pl/668646ce6d71?
Confused about referencing in D
I'm pretty confused why the following code doesn't work as expected. GetValue is a struct. auto value = GetValue(); memcpy(, , Val.sizeof); But if I plug in value direct to memset it works!! memcpy((), , Val.sizeof); GetValue returns memory to stick a value in and the memcpy is copying it over. It is very confusing logic. Should I not expect the two cases two be identical? I think that the assignment in the first case is not assigning the reference returned by auto ref GetValue(). I am expecting it to work like a pointer, void* value = (); memcpy(value, , Val.sizeof); so to speak but it works more like S value; value = GetValue(); memcpy(, , Val.sizeof); which copies the data to the memory created for value and not the one returned by GetValue.