Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 16:19:38 UTC, Neia Neutuladh wrote: On Fri, 25 Jan 2019 09:34:47 +, AndreasDavour wrote: auto point3 = getResponse!Point!int("What's the point? "); This could be: getResponse!(Point!int) or: (getResponse!Point)!int D requires this to be

Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 14:25:33 UTC, AndreasDavour wrote: https://run.dlang.io/is/a4oDFZ is an example of how this looks. I feel like there's more to these templates than meet the eye. To clarify. I really don't understand the thinking behind these templates, and wonder a bit about

Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 12:11:51 UTC, AndreasDavour wrote: On Friday, 25 January 2019 at 12:09:34 UTC, AndreasDavour wrote: On Friday, 25 January 2019 at 09:36:24 UTC, rikki cattermole wrote: On 25/01/2019 10:34 PM, AndreasDavour wrote: [...] auto point3 =

Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 12:09:34 UTC, AndreasDavour wrote: On Friday, 25 January 2019 at 09:36:24 UTC, rikki cattermole wrote: On 25/01/2019 10:34 PM, AndreasDavour wrote: [...] auto point3 = getResponse!(Point!int)("What's the point? "); [...] I thought about that option, if it

Re: How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 25 January 2019 at 09:36:24 UTC, rikki cattermole wrote: On 25/01/2019 10:34 PM, AndreasDavour wrote: How am I supposed to use that??   auto point3 = getResponse!Point!int("What's the point? "); auto point3 = getResponse!(Point!int)("What's the point? ");   auto point4 =

How is this code supposed to work?

2019-01-25 Thread AndreasDavour via Digitalmars-d-learn
I'm reading the "Programming D" here: http://ddili.org/ders/d.en/templates.html and am a bit confused by the section on templates. with a struct template like this: struct Point(T) { T x; T y; T distanceTo(Point that) const { immutable real xDistance = x - that.x; immutable real

Re: Reversing a string

2019-01-11 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 11 January 2019 at 11:15:05 UTC, Mike James wrote: On Friday, 11 January 2019 at 09:41:30 UTC, bauss wrote: On Friday, 11 January 2019 at 08:25:41 UTC, Seb wrote: On Friday, 11 January 2019 at 08:05:39 UTC, AndreasDavour wrote: Hi. I've just started to learn some D, so maybe this

Re: Reversing a string

2019-01-11 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 11 January 2019 at 09:41:30 UTC, bauss wrote: On Friday, 11 January 2019 at 08:25:41 UTC, Seb wrote: On Friday, 11 January 2019 at 08:05:39 UTC, AndreasDavour wrote: Hi. I've just started to learn some D, so maybe this question is extremely stupid, but please bear with me. [...]

Re: Reversing a string

2019-01-11 Thread AndreasDavour via Digitalmars-d-learn
On Friday, 11 January 2019 at 08:45:12 UTC, JN wrote: On Friday, 11 January 2019 at 08:15:01 UTC, rikki cattermole wrote: Note the immutable, it means you cannot modify individual values. Which is a problem for reverse because it modifies in place. The error message is kind of unfortunate.

Reversing a string

2019-01-11 Thread AndreasDavour via Digitalmars-d-learn
Hi. I've just started to learn some D, so maybe this question is extremely stupid, but please bear with me. I have been trying to reverse a string, and through some googling found the std.algorithm.mutation.reverse method. But, when I try to use it I get some very verbose errors that just