On Wednesday, 6 July 2016 at 10:25:44 UTC, zodd wrote:
Thank you for a great example! D's power still surprises me a
lot.
just be careful to not carry wrapper around for too long, so it
won't outlive it's parent.
p.s. or this (abomination, i know!). ripped out of one of my
monkeycoding
On Wednesday, 6 July 2016 at 09:48:59 UTC, Lodovico Giaretta
wrote:
Nice work.
Personally, I'd do it this way: http://pastebin.com/38n0fEtF
This way:
- instead of 4 pointers (2 per delegate), the wrapper only
contains 1 pointer;
- once written, it only requires one line per property to be
On Wednesday, 6 July 2016 at 09:08:11 UTC, zodd wrote:
So, I've created a simple wrapper template to achieve what I
want. It reminds me of the C++ - a bunch of additional code to
solve a simple problem (which shouldn't be an issue at all).
I'm a newbie in D thus I could do something wrong or
So, I've created a simple wrapper template to achieve what I
want. It reminds me of the C++ - a bunch of additional code to
solve a simple problem (which shouldn't be an issue at all). I'm
a newbie in D thus I could do something wrong or nonoptimal.
Please, criticize my code:
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.
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
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.
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...
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.
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
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.
On Tuesday, 5 July 2016 at 14:07:25 UTC, zodd wrote:
http://forum.dlang.org/post/mailman.1463.1361561853.22503.digitalmars-d-le...@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! ;-)
On Tue, Jul 05, 2016 at 04:11:58PM +, 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
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)
On Tuesday, 5 July 2016 at 13:37:50 UTC, ketmar wrote:
you *can* workaround this limitation for now. it won't be the
cleanest code in the world, but you can do it. hint: alias this
+ returning temporary struct with pointer.
Of course, I can. I have been creating a lot of such workarounds
On Tuesday, 5 July 2016 at 13:37:50 UTC, ketmar wrote:
if this minor thing blocks you from using D... alas. otherwise,
just make a workaroung and keep going. *eventually* this will
be fixed, but you'd better don't wait for it.
No, this issue doesn't block me from using D. I'm asking because
On Tuesday, 5 July 2016 at 13:14:29 UTC, zodd wrote:
Why do you have so pessimistic opinion?
it is realistic.
Is D a perspective language to learn or it's stagnating and
never be production ready?
what do you want here: "non-stagnating" or "production ready"? D
is "production ready", and
On 7/5/16 6:52 AM, zodd wrote:
Is there a chance, that this weird behavior will be fixed in the near
future? What can I do to help fix it?
Properties do not support read-modify-write operations. You can return a
reference, or return a wrapper type to enable the operations you want.
D does
D is being used productively by some companies, so I guess we can call it
production-ready. This doesn't meant there are not rough corners. The
language is being actively developed, and I see that some work is being
done on those rough corners. However, keep in mind that:
1) Maybe what you
On Tuesday, 5 July 2016 at 12:45:33 UTC, ketmar wrote:
Is there a chance, that this weird behavior will be fixed in
the near future? What can I do to help fix it?
almost as much as you can expect snowfall in hell.
Why do you have so pessimistic opinion? Is D a perspective
language to learn
On Tuesday, 5 July 2016 at 10:52:10 UTC, zodd wrote:
It's a very inconvenient. Why don't just call a getter and then
a setter functions in such cases?
'cause property specs aren't even finalized yet.
Is there a chance, that this weird behavior will be fixed in
the near future? What can I do
On Tuesday, 5 July 2016 at 11:02:11 UTC, Satoshi wrote:
On Tuesday, 5 July 2016 at 10:52:10 UTC, zodd wrote:
Property functions are used wrong by a compiler when it needs
to get and set a value at the same time:
[...]
Try
@property ref int value() {
return value_;
}
On Tuesday, 5 July 2016 at 10:52:10 UTC, zodd wrote:
Property functions are used wrong by a compiler when it needs
to get and set a value at the same time:
[...]
Try
@property ref int value() {
return value_;
}
23 matches
Mail list logo