July 05, 2016
On Tuesday, 5 July 2016 at 10:52:10 UTC, zodd wrote:
> Property functions are used wrong by a compiler when it needs

i am sorry for my dumbness, what wrong with this code?

import std.stdio;

struct A {
    @property ref int value() {
        return value_;
    }

    @property void value(int v) {
	value_ = v;
    }

private:
	int value_;
}

int main(string[] args) {
	A a;
	a.value = 10;
	writeln(a.value);
	a.value += 20;
	writeln(a.value);
	return 0;
}

July 05, 2016
On Tue, Jul 05, 2016 at 04:11:58PM +0000, zabruk70 via Digitalmars-d-learn wrote:
> On Tuesday, 5 July 2016 at 10:52:10 UTC, zodd wrote:
> > Property functions are used wrong by a compiler when it needs
> 
> i am sorry for my dumbness, what wrong with this code?
> 
> import std.stdio;
> 
> struct A {
>     @property ref int value() {
>         return value_;
>     }
> 
>     @property void value(int v) {
> 	value_ = v;
>     }

This overload is redundant, now that the first overload is ref.


> private:
> 	int value_;
> }
[...]


T

-- 
He who does not appreciate the beauty of language is not worthy to bemoan its flaws.
July 05, 2016
On Tuesday, 5 July 2016 at 14:07:25 UTC, zodd wrote:
> http://forum.dlang.org/post/mailman.1463.1361561853.22503.digitalmars-d-learn@puremagic.com : "Don't use 'in', because it doesn't mean what it seems to mean, and it's not correctly implemented at the moment."

it is freakin' 2013! ;-)

> http://forum.dlang.org/post/lgqcjiuigsseoazirkor@forum.dlang.org - "cast `shared` away. yes, this is how you supposed to use it now: cast it away."

yes, `shared` need some love. it actually never moved from the concept to something really useful. alas.

> I don't want to say that "D is unfinished"

actually, it is unfinished. ;-) but it already has alot to offer.

> I'm just trying to figure out what D is and how can I use it.

sorry for overreacting. that "D is crap" thread makes me... nervous. ;-)

> Answering your other question: I think that production ready language should have a "finished" design and its detailed description (not a basic overview of the features).

Andrei's book is fairly detailed. And Ali's book is excellent too. it's hard to expect a small, but complete descrion for modern multiparadigm language. ;-)

so, my PoV is: yes, D has it's warts, but they are much more tolerable than C++ warts, for example. and D has alot to offer which C++ simply won't be able to offer, ever.
July 05, 2016
On Tuesday, 5 July 2016 at 16:11:58 UTC, zabruk70 wrote:
> On Tuesday, 5 July 2016 at 10:52:10 UTC, zodd wrote:
>> Property functions are used wrong by a compiler when it needs
>
> i am sorry for my dumbness, what wrong with this code?

as OP said, this one won't call setter on "+=" and company.
July 05, 2016
On Tuesday, 5 July 2016 at 16:20:52 UTC, ketmar wrote:
> so, my PoV is: yes, D has it's warts, but they are much more tolerable than C++ warts, for example. and D has alot to offer which C++ simply won't be able to offer, ever.

D has «static if», but what else are you thinking of? The only thing I can think of that is hard in C++ is to conditionally remove fields from a struct.

July 05, 2016
On Tuesday, 5 July 2016 at 17:50:46 UTC, Ola Fosheim Grøstad wrote:
> On Tuesday, 5 July 2016 at 16:20:52 UTC, ketmar wrote:
>> so, my PoV is: yes, D has it's warts, but they are much more tolerable than C++ warts, for example. and D has alot to offer which C++ simply won't be able to offer, ever.
>
> D has «static if», but what else are you thinking of?

C++ templates vs D templates. this alone is enough.
July 05, 2016
On Tuesday, 5 July 2016 at 21:46:19 UTC, ketmar wrote:
> C++ templates vs D templates. this alone is enough.

They are almost the same...

July 05, 2016
On Tuesday, 5 July 2016 at 21:58:39 UTC, Ola Fosheim Grøstad wrote:
> On Tuesday, 5 July 2016 at 21:46:19 UTC, ketmar wrote:
>> C++ templates vs D templates. this alone is enough.
>
> They are almost the same...

yep. just like C is *almost* the assembler.
July 06, 2016
On Tuesday, 5 July 2016 at 22:03:43 UTC, ketmar wrote:
> On Tuesday, 5 July 2016 at 21:58:39 UTC, Ola Fosheim Grøstad wrote:
>> On Tuesday, 5 July 2016 at 21:46:19 UTC, ketmar wrote:
>>> C++ templates vs D templates. this alone is enough.
>>
>> They are almost the same...
>
> yep. just like C is *almost* the assembler.

Maybe you could give me an useful example in D that does not involve «static if» or «string mixins» that would be difficult to represent in C++?

July 06, 2016
On Wednesday, 6 July 2016 at 05:51:04 UTC, Ola Fosheim Grøstad wrote:
> Maybe you could give me an useful example in D that does not involve «static if» or «string mixins» that would be difficult to represent in C++?

anything involving templates. c++ template syntax is awful.