On Attributes

2017-11-27 Thread A Guy With a Question via Digitalmars-d-learn
Hi again! I've been trying to do my best to write idiomatically. One thing that is bugging me is having to mark up all of my declarations with attributes. Which means I'm having to remember them all. It's a bit much to keep in my head with every function. Is there a good way to reverse this

Re: Floating point types default to NaN?

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
Nonetheless, my original question was answered. Thanks for the insights!

Re: Linking multiple libraries

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:31:10 UTC, Mike Parker wrote: On Saturday, 25 November 2017 at 22:18:52 UTC, A Guy With a Question wrote: That's how I set up the linking in Visual D. Everything builds. But should the final exe try to link against all 3 libraries, library 3 link to

Linking multiple libraries

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
Hi, So I got this working, I would just like to see if I have done this correctly or if it's just working out of a fluke. I am using Visual D. Lets say I have four projects: Library 1: Common Library Library 2: Base Service Library - Dependent on the Common Library. Library 3: More Specified

Re: Floating point types default to NaN?

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:13:43 UTC, Adam D. Ruppe wrote: On Saturday, 25 November 2017 at 16:16:52 UTC, A Guy With a Question wrote: If D chooses it's defaults to make errors stick out, why not just error at declaration if they don't explicitly set it to something. It technically

Re: Floating point types default to NaN?

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 09:39:15 UTC, Dave Jones wrote: On Friday, 24 November 2017 at 22:38:49 UTC, Jonathan M Davis wrote: On Friday, November 24, 2017 20:43:14 A Guy With a Question via Digitalmars- d-learn wrote: On Friday, 24 November 2017 at 14:43:24 UTC, Adam D. Ruppe

Re: Linking multiple libraries

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:36:32 UTC, A Guy With a Question wrote: On Saturday, 25 November 2017 at 22:31:10 UTC, Mike Parker wrote: On Saturday, 25 November 2017 at 22:18:52 UTC, A Guy With a Question wrote: That's how I set up the linking in Visual D. Everything builds. But

Re: Linking multiple libraries

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:40:49 UTC, A Guy With a Question wrote: On Saturday, 25 November 2017 at 22:36:32 UTC, A Guy With a Question wrote: On Saturday, 25 November 2017 at 22:31:10 UTC, Mike Parker wrote: On Saturday, 25 November 2017 at 22:18:52 UTC, A Guy With a Question wrote:

Floating point types default to NaN?

2017-11-24 Thread A Guy With a Question via Digitalmars-d-learn
I would have expected 0 to be the default value. What's the logic behind having them being NaN by default? https://dlang.org/spec/type.html

Re: Floating point types default to NaN?

2017-11-24 Thread A Guy With a Question via Digitalmars-d-learn
On Friday, 24 November 2017 at 14:43:24 UTC, Adam D. Ruppe wrote: On Friday, 24 November 2017 at 14:30:44 UTC, A Guy With a Question wrote: I would have expected 0 to be the default value. What's the logic behind having them being NaN by default? It gives you a runtime error (sort of) if you

Re: Error: 'this' is only defined in non-static member functions

2017-11-22 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 22 November 2017 at 22:45:53 UTC, A Guy With a Question wrote: On Wednesday, 22 November 2017 at 22:37:46 UTC, Steven Schveighoffer wrote: On 11/22/17 5:36 PM, Steven Schveighoffer wrote: This allows access to the outer class's members. So you need an instance to instantiate. I

Error: 'this' is only defined in non-static member functions

2017-11-22 Thread A Guy With a Question via Digitalmars-d-learn
I have an interface where I have a classes embedded in it's scope (trying to create something for the classes that implement the interface can use for unittesting). interface IExample { // stuff ... class Tester { } } I'm trying to make an instance

Re: Error: 'this' is only defined in non-static member functions

2017-11-22 Thread A Guy With a Question via Digitalmars-d-learn
here as non-static, nested class is associated with a specific instance of the class and has access to that class instance via its outer member. - Jonathan M Davis Hmmm...now you have me very intrigued. What is a use-case where you'd want to use a non-static embedded class? Sorry if I'm

Re: Error: 'this' is only defined in non-static member functions

2017-11-22 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 22 November 2017 at 22:37:46 UTC, Steven Schveighoffer wrote: On 11/22/17 5:36 PM, Steven Schveighoffer wrote: This allows access to the outer class's members. So you need an instance to instantiate. I bet it's the same for interfaces. All that being said, the error message is

Re: Floating point types default to NaN?

2017-11-28 Thread A Guy With a Question via Digitalmars-d-learn
On Tuesday, 28 November 2017 at 20:00:53 UTC, Michael V. Franklin wrote: On Monday, 27 November 2017 at 23:05:55 UTC, Michael V. Franklin wrote: I think I'm going to implement a feature gate to require explicit initialization. It would be better to be strict up front and relax it as flow

Re: Floating point types default to NaN?

2017-11-28 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 01:25:47 UTC, Michael V. Franklin wrote: On Wednesday, 29 November 2017 at 01:24:21 UTC, A Guy With a Question wrote: I was just more curious of the design decisions that were made. So am I. I'm trying to get to the heart of in the the PR comments. Mike

Convert a single element into a range

2017-11-30 Thread A Guy With a Question via Digitalmars-d-learn
This is probably a dumb question, but what I did looks ugly. Is there a way (preferably a one liner) to convert a single element, like an int or char or bool, into a range?

Re: Convert a single element into a range

2017-11-30 Thread A Guy With a Question via Digitalmars-d-learn
On Thursday, 30 November 2017 at 22:52:33 UTC, Ali Çehreli wrote: On 11/30/2017 02:47 PM, A Guy With a Question wrote: This is probably a dumb question, but what I did looks ugly. Is there a way (preferably a one liner) to convert a single element, like an int or char or bool, into a range?

Re: On Attributes

2017-11-27 Thread A Guy With a Question via Digitalmars-d-learn
On Monday, 27 November 2017 at 19:41:03 UTC, Adam D. Ruppe wrote: On Monday, 27 November 2017 at 19:10:04 UTC, A Guy With a One thing that is bugging me is having to mark up all of my declarations with attributes. Meh, you could also just ignore the attribute crap. Only reason I ever mess

Re: Changing the class data underneath some reference

2017-11-29 Thread A Guy With a Question via Digitalmars-d-learn
On Thursday, 30 November 2017 at 00:40:51 UTC, David Colson wrote: Hello all! I'm getting settled into D and I came into a problem. A code sample shows it best: class SomeType { string text; this(string input) {text = input;} } void main() { SomeType foo = new

Really? -- Error: function `object.Throwable.message` is not nothrow

2017-11-28 Thread A Guy With a Question via Digitalmars-d-learn
What's the clean way to extract the message that passes the nothrow argument? Do I really have to embed another try catch?

Re: Really? -- Error: function `object.Throwable.message` is not nothrow

2017-11-28 Thread A Guy With a Question via Digitalmars-d-learn
.msg worked. I will let you all live.

Re: Really? -- Error: function `object.Throwable.message` is not nothrow

2017-11-28 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 00:52:41 UTC, A Guy With a Question wrote: .msg worked. I will let you all live. Thanks!

Re: Object oriented programming and interfaces

2017-12-04 Thread A Guy With a Question via Digitalmars-d-learn
On Monday, 4 December 2017 at 20:43:27 UTC, Dirk wrote: Hi! float distance( Medoid other ); float distance( Item i ) {...} The two signatures need to be the same. I think this is true of most OOP languages. Have them both be: float distance( Medoid other );

Visual D >> TRACKER : error TRK0004: Failed to locate: "FileTracker32.dll". The system cannot find the file specified.

2017-11-20 Thread A Guy With a Question via Digitalmars-d-learn
I'm trying to learn D using Visual D in Visual Studio Community 2015. Both dmd and ldc give me this error when building from Visual Studio. Any ideas? I'm able to build C++ projects...

Re: Visual D >> TRACKER : error TRK0004: Failed to locate: "FileTracker32.dll". The system cannot find the file specified.

2017-11-21 Thread A Guy With a Question via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 04:39:52 UTC, A Guy With a Question wrote: I'm trying to learn D using Visual D in Visual Studio Community 2015. Both dmd and ldc give me this error when building from Visual Studio. Any ideas? I'm able to build C++ projects... So I figured this one out. I set

Re: Embedded interfaces with generic members

2017-12-05 Thread A Guy With a Question via Digitalmars-d-learn
On Tuesday, 5 December 2017 at 19:27:37 UTC, Ali Çehreli wrote: On 12/05/2017 11:07 AM, A Guy With a Question wrote: > The following doesn't appear to be valid syntax. Array!Item!T You can ommit the template argument list parenteses only for single symbols. Starting with the full syntax:

Embedded interfaces with generic members

2017-12-05 Thread A Guy With a Question via Digitalmars-d-learn
The following doesn't appear to be valid syntax. Array!Item!T I get the following error: "multiple ! arguments are not allowed" Which is ok...I get THAT error, however, this does not work either: alias Items(T) = Array!Item(T); This gives me the error: Error: function declaration

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 18:09:45 UTC, Steven Schveighoffer wrote: On 12/6/17 12:17 PM, Steven Schveighoffer wrote: So why wouldn't the compiler fail? Because it has no idea yet what you mean by Nullable. It doesn't even know if Nullable will be available or not. You could even import

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 19:19:09 UTC, A Guy With a Question wrote: It seems D's fast compile times are achieved by skipping semantic checking and even parsing when it doesn't feel it's needed. I strongly disagree with this decision. This could leave complex dormant time bombs that

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:10:34 UTC, Atila Neves wrote: On Wednesday, 6 December 2017 at 16:07:41 UTC, A Guy With a Question wrote: Noticed several typos that dmd seems to have not picked up initially. Does dmd not compile all source code? I obviously wouldn't expect it to recompile

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:32:05 UTC, A Guy With a Question wrote: I have to be honest, I'm a little worried about all of this code I just translated and how much of it is actually valid...I hope I didn't waste my time. Ok, so I verified this much. I would expect an error from the

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:47:17 UTC, A Guy With a Question wrote: On Wednesday, 6 December 2017 at 16:32:05 UTC, A Guy With a Question wrote: I have to be honest, I'm a little worried about all of this code I just translated and how much of it is actually valid...I hope I didn't

Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
Noticed several typos that dmd seems to have not picked up initially. Does dmd not compile all source code? I obviously wouldn't expect it to recompile something unnecessarily, but in a few cases I've just seen it not throw errors where it should have.

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:49:51 UTC, A Guy With a Question wrote: module grrr.grr; abstract class Test(T) { private: T thing; public: this(T theThing) { thing = theThing; thisdoesnotexist(); // expect compiler error right here } } ...but this

Re: Does dmd not always compile all of the source code?

2017-12-06 Thread A Guy With a Question via Digitalmars-d-learn
I have to be honest, I'm a little worried about all of this code I just translated and how much of it is actually valid...I hope I didn't waste my time.

Re: Struct inside a class: How to get outer?

2017-12-04 Thread A Guy With a Question via Digitalmars-d-learn
On Monday, 4 December 2017 at 14:01:08 UTC, Steven Schveighoffer wrote: On 12/3/17 2:38 AM, Jonathan M Davis wrote: On Sunday, December 03, 2017 01:05:00 Nick Sabalausky via Digitalmars-d- learn wrote: Is this even possible? My attempts: class Outer { struct Inner { void foo() {

Is std.container.array more or less an equivalent of C#'s List?

2017-12-04 Thread A Guy With a Question via Digitalmars-d-learn
Reading this, the interface seems very similar, but I'm not sure. There's only like a two sentence general description, then it goes on to talk about a boolean specialization... https://dlang.org/phobos/std_container_array.html I'm looking for something that doesn't have to resize every

Re: Is std.container.array more or less an equivalent of C#'s List?

2017-12-04 Thread A Guy With a Question via Digitalmars-d-learn
On Monday, 4 December 2017 at 16:26:02 UTC, A Guy With a Question wrote: Reading this, the interface seems very similar, but I'm not sure. There's only like a two sentence general description, then it goes on to talk about a boolean specialization...