View mode: basic / threaded / horizontal-split · Log in · Help
January 25, 2013
Re: Incorporating D
On Friday, 25 January 2013 at 22:30:46 UTC, Adam D. Ruppe wrote:
> LOL 3 of us said the same thing at the same time!

And everytime the example was more detailed. :)
January 25, 2013
Re: Incorporating D
On 1/25/2013 12:45 PM, Szymon wrote:
> I would really like to start using D in our small company as a
> C++ replacement. With that in mind I do have few questions:
>
> 1) Is D2 really ready for production code?

Yes, and it is in use for production code.

> I often hear ppl
> complaining about compiler bugs or regressions causing them to
> drop D "for now".

If you stick to bread and butter code, you shouldn't have problems. If you use 
advanced features out to the edge, you're more likely to run into issues. 
Furthermore, nothing says you have to upgrade to the latest version if it 
doesn't work for you. All released versions are available for download.

> Is it true that D has GC problems?

All GC's have problems. GC isn't a "fire and forget" way to deal with memory 
management. However, the GC is reliable and works well if you use it with 
awareness of how it works.


> 2) Is there a way to start adding D code to a C++ projects? For
> example build a dll in D that is loaded by C++ host app? I guess
> that is not possible because of GC not being there?

A much easier route is to add C++ code to a D project. I.e. make the D code have 
the 'main()'.

> 3) Is it possible to use D on iOS?

Not at the moment.
January 25, 2013
Re: Incorporating D
On 1/25/2013 1:06 PM, q66 wrote:
> As he apparently is on Windows, you can only do this with a D DLL,

Not true. Nothing says you have to use a DLL.

> which are
> likely to be a PITA (but at least they should work unlike on un*x); you can't
> really link D object files and C/C++ object files together, as on win32 OMF is
> used (you could use unilink, but that's so obscure I wouldn't expect a newbie to
> mess with this at all). So I'd take this as "no"

On win32, if your C++ code is compiled with DMC++, you can link them together. 
On Win64, you can link in code compiled with VC++.
January 25, 2013
Re: Incorporating D
On 1/25/2013 1:33 PM, q66 wrote:
> D's GC has inherent issues with false positives, sometimes freeing memory that
> you don't really want freed, causing (sometimes hidden) bugs that are pretty
> much impossible to debug.

There are zero reported examples of this happening.

I believe you have this confused with the GC being a conservative collector, 
where it will sometimes not free memory that it could free. This is not a bug.
January 25, 2013
Re: Incorporating D
On 1/25/13 4:39 PM, Namespace wrote:
> On Friday, 25 January 2013 at 20:45:22 UTC, Szymon wrote:
>> Hi,
>>
>> I would really like to start using D in our small company as a
>> C++ replacement. With that in mind I do have few questions:
>>
>> 1) Is D2 really ready for production code?
>
> Not really. A big pain in the ass is the missing rvalue ref that C++
> has. So using structs is a big disaster. But there are plenty of other
> missing features.

I have discussed a few possible designs at 
http://d.puremagic.com/issues/show_bug.cgi?id=9238. I actually have in 
mind a design that I'd choose, but haven't had the time to write it.

What other features are you referring to?


Andrei
January 25, 2013
Re: Incorporating D
On 1/25/13 5:07 PM, Szymon wrote:
> On Friday, 25 January 2013 at 22:00:02 UTC, Rob T wrote:
>> On Friday, 25 January 2013 at 21:39:58 UTC, Namespace wrote:
>>> On Friday, 25 January 2013 at 20:45:22 UTC, Szymon wrote:
>>>> Hi,
>>>>
>>>> I would really like to start using D in our small company as a
>>>> C++ replacement. With that in mind I do have few questions:
>>>>
>
> Wow, I may not fully like D after all those comments but I do certainly
> like its community :) You are as fast as this forums loading times.
>
> I actually played a bit with D in Visual Studio with VisualD and it was
> rather pleasant experience. I don't know why but release build crashed
> while debug run fine that is why I turned here with questions.
>
> I am definitely looking forward to D being more mature. And wish I could
> get to DConf (which I backed!) but it is bit too far ;)
>
> Thanks for all the answers!

Thank you for asking. We have been strongly focused on quality 
improvement since last year but judging from this thread we need to work 
more on it (and the derived community sentiment).

Andrei
January 25, 2013
Re: Incorporating D
On Friday, 25 January 2013 at 22:29:44 UTC, Adam D. Ruppe wrote:
> On Friday, 25 January 2013 at 22:22:44 UTC, Szymon wrote:
>> So structs in D are always passed by-value? That is 
>> unfortunate...
>
> It has both pointers and ref but they both only work with 
> lvalues, regardless of const:
>
> struct S {}
>
> void test(const ref S s) {}
> void test2(const S* s) {}
>
> S getS() { return S(); }
>
> void main() {
>         S s;
>         test(s); // ok
>         test2(&s); // ok
>         test(getS()); // not ok (line 12)
>         test2(&getS()); // not ok (line 13)
> }
>
> test.d(12): Error: function test.test (ref const(S) s) is not 
> callable using argument types (S)
> test.d(12): Error: getS() is not an lvalue
> test.d(13): Error: getS() is not an lvalue

It should be mentioned that there's a solution of sorts, but it 
is a pain to have to do and does not scale up when you have 
multiple ref arguments.

void test(const ref S s)
{
   // implementation
   ...
   return;
}
void test(const S s)
{
    test( s ); // calls test(const ref S s)
    return;
}

--rt
January 25, 2013
Re: Incorporating D
On Friday, 25 January 2013 at 23:16:09 UTC, Andrei Alexandrescu 
wrote:
> On 1/25/13 4:39 PM, Namespace wrote:
>> On Friday, 25 January 2013 at 20:45:22 UTC, Szymon wrote:
>>> Hi,
>>>
>>> I would really like to start using D in our small company as a
>>> C++ replacement. With that in mind I do have few questions:
>>>
>>> 1) Is D2 really ready for production code?
>>
>> Not really. A big pain in the ass is the missing rvalue ref 
>> that C++
>> has. So using structs is a big disaster. But there are plenty 
>> of other
>> missing features.
>
> I have discussed a few possible designs at 
> http://d.puremagic.com/issues/show_bug.cgi?id=9238. I actually 
> have in mind a design that I'd choose, but haven't had the time 
> to write it.

The choosen syntax was "auto ref".
There is still a Pull which waits for completeness and merging 
(#1019).
It hurts this much because this issue is dicussed since a year 
and there is still no implemented solution. structs are now 
lvalues, so this error is fixed, but the rvalue ref is still 
missing. So struct usage is more unhandy as anytime before.

> What other features are you referring to?

Oh I have a list, but the auto ref problem is my most favorite of 
missing features.
Another example would be the scope storage class (and with it 
also "in").
January 25, 2013
Re: Incorporating D
structs are now lvalues => structs are now rvalues.
January 26, 2013
Re: Incorporating D
On 1/25/13 6:53 PM, Namespace wrote:
> On Friday, 25 January 2013 at 23:16:09 UTC, Andrei Alexandrescu wrote:
>> On 1/25/13 4:39 PM, Namespace wrote:
>>> On Friday, 25 January 2013 at 20:45:22 UTC, Szymon wrote:
>>>> Hi,
>>>>
>>>> I would really like to start using D in our small company as a
>>>> C++ replacement. With that in mind I do have few questions:
>>>>
>>>> 1) Is D2 really ready for production code?
>>>
>>> Not really. A big pain in the ass is the missing rvalue ref that C++
>>> has. So using structs is a big disaster. But there are plenty of other
>>> missing features.
>>
>> I have discussed a few possible designs at
>> http://d.puremagic.com/issues/show_bug.cgi?id=9238. I actually have in
>> mind a design that I'd choose, but haven't had the time to write it.
>
> The choosen syntax was "auto ref".
> There is still a Pull which waits for completeness and merging (#1019).
> It hurts this much because this issue is dicussed since a year and there
> is still no implemented solution. structs are now lvalues, so this error
> is fixed, but the rvalue ref is still missing. So struct usage is more
> unhandy as anytime before.

We better get this right and not hurry about this.

>> What other features are you referring to?
>
> Oh I have a list, but the auto ref problem is my most favorite of
> missing features.
> Another example would be the scope storage class (and with it also "in").

What languages have that feature, and what makes it important? To me it 
seems rather niche and is easily worked around within the language.


Andrei
1 2 3 4 5 6 7 8
Top | Discussion index | About this forum | D home