Why I'm Excited about D
John Colvin via Digitalmars-d
digitalmars-d at puremagic.com
Tue Apr 7 01:33:56 PDT 2015
On Monday, 6 April 2015 at 23:51:17 UTC, Adam Hawkins wrote:
> Hello everyone, this is my first post on the forum. I've been
> investigating the language for the past few weeks. I was able
> to complete my first useful program thanks to very helpful
> people in #d on IRC . The experience made me very interested in
> the language and improving the community around it.
>
> I'm primarily Ruby developer (been so about the last 7-8 years)
> doing web stuff with significant JavaScript work as well. I
> wrote a blog post on why I'm excited about D. You can read it
> here: http://hawkins.io/2015/04/excited-about-d/.
>
> I've been reading the forums here so I can see that there is a
> focus on improving the marketing for the language and growing
> the community. I see most of the effort is geared towards C++
> programmers, but have you considered looking at us dynamic
> languages folk? I see a big upside for us. Moving from Ruby to
> D (my case) gives me power & performance. I still have OOP
> techniques but I still have functional things like closures and
> all that good stuff. Only trade off in the Ruby case is
> metaprogramming. All in all I think there is a significant
> value promise for those of us doing backend services for folks
> like me.
>
> Regardless, I figured it might be interesting to hear about
> some experience coming to the language from a different
> perspective. Cheers!
This is awesome :)
A few notes on the blog:
"peaked my interest" should be "piqued my interest"
You can have as many unittest blocks as you want in a file/module.
@property isn't really about parentheses-less calls (parentheses
are optional for all function calls), it's more for this sort of
thing:
struct S
{
private int a_;
enum flagMask = 1u << 31;
@property void val(int v)
{
a_ = (a_ & flagMask) & (v & ~flagMask);
}
@property int val()
{
return a_ & ~flagMask;
}
@property void flag(bool b)
{
a_ = ((cast(uint)b) << 31) & (a_ & ~mask);
}
@property bool flag()
{
return a_ & flagMask;
}
}
unittest
{
S s;
s.flag = true;
s.val = 75;
assert(s.flag);
assert(s.val == 75);
}
Note that the assignments are calling the property functions.
More information about the Digitalmars-d
mailing list