Re: Properties don't work as expected

2016-07-05 Thread Leandro Motta Barros via Digitalmars-d-learn
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 perceive as a strong deficiency isn't seen as a top
priority for the D developers. This issue with properties, for instance, is
annoying (I agree with you!), but most of the time (if not ever) it can be
easily circumvented (as Satoshi has shown).

2) Sometimes, changing language features have subtle side effects, and the
devs must take everything into account. A fix that looks obvious for us
mere mortals can actually open a can of worms and introduce many new issues.

Hope this answers your quesiton,

LMB


On Tue, Jul 5, 2016 at 10:14 AM, zodd via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:

> 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 or it's stagnating and never be production ready?
>


Re: blog.dlang.org

2016-06-21 Thread Leandro Motta Barros via Digitalmars-d-learn
Try http://dlang.org/blog/

But, indeed, I would expect blog.dlang.org to work...

Cheers,

LMB

On Tue, Jun 21, 2016 at 6:47 PM, Christian Köstlin <
digitalmars-d-learn@puremagic.com> wrote:

> I just wanted to have a look at the new blog post about ldc, and entered
> blog.dlang.org without thinking into the browser.
>
> This does not lead to the official blog anymore, but to the old
> digitalmars website.
>
>


Re: OpenGL Setup?

2016-06-17 Thread Leandro Motta Barros via Digitalmars-d-learn
I have been using Textadept ( http://foicica.com/textadept/ ) with
Textadept-d ( https://github.com/Hackerpilot/textadept-d ). I use mostly on
Linux for development, but I've recently spent two or three days on Windows
and things worked well enough for me.

(Coming for someone who has used Emacs for everything int he last 15+
years, this must mean something :-) )

Hope this helps,

LMB


On Fri, Jun 17, 2016 at 8:51 AM, OpenJelly via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:

> On Thursday, 16 June 2016 at 19:52:58 UTC, OpenJelly wrote:
>
>>
>> Trying to get VS Code to work with code-d... can't get dcd to work with
> it. It says it's failed to kill the dcd server when I try to reload it. It
> wasn't appearing in task manager (but dcd-client was) and manually starting
> it up didn't make it work in vs code. Trying to restart it in cmd freezes
> that window and the task refuses to kill. I'm trying to fix it now but I
> don't even know why it's not working...
>
> The arsd stuff just gives me a thick list of internal errors when I try to
> import it through dub. But I might almost have GLFW working... I can't
> really tell yet, but I did finally find the right dll to link to (files in
> the Windows x64 binaries kept giving me an error, but the one x64 dll in
> the x86 download ended up working).
>
> Not keen to try vim if it doesn't have the features I need to compensate
> for being a shitty programmer.
>


Re: Coverage

2016-02-16 Thread Leandro Motta Barros via Digitalmars-d-learn
I had one case these days in which I also had a lot of data to use in the
test. I was able to put the data as very large regular D arrays, but this
increased my compilation times a lot (not to mention the time to run the
unit tests).

I decided to enclose this specific unit test (including the `import
test_data` statement) in `version ExtraUnitTests { ... }`. This way, I can
run the bulk of my unit tests very frequently without wasting time with
this special case I want to run only sometimes.

I can't say I am 100% happy with this, but it worked for me and didn't
require any additional dependency.

LMB





On Tue, Feb 16, 2016 at 4:58 PM, Sebastiaan Koppe via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:

> On Tuesday, 16 February 2016 at 12:35:38 UTC, Leandro Motta Barros wrote:
>
>> You probably already though of it, but: can't you create a unittest that
>> calls your code as many times as desired, passing different input each time?
>>
>
> That is a viable option yes. I will probably end up doing it like that.
>
> I don't like it though. Since the input is pretty big, it would need to be
> kept in an external file. And I don't like my unittests reading files. Plus
> they aren't really unittests either. Oh well. Moving on.
>


Re: Coverage

2016-02-16 Thread Leandro Motta Barros via Digitalmars-d-learn
You probably already though of it, but: can't you create a unittest that
calls your code as many times as desired, passing different input each time?

LMB


On Tue, Feb 16, 2016 at 10:16 AM, Sebastiaan Koppe via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:

> I currently run dmd's coverage on my unittests.
>
> But now I also want to execute my program with different inputs and then
> merge all that coverage info from each run.
>
> Any chance there is something for that?
>


Module-level attributes and unit tests

2014-08-23 Thread Leandro Motta Barros via Digitalmars-d-learn
Hello,

I have a module which is completelly @nogc, and as such I'd like to just say

   @nogc:

at the top of the file and be happy.

However, my unit tests for this same module do some GC allocation, so the
module fails to compile.

Is there a way to disable @nogc for the unit tests only? Would this be a
bad idea in some way I cannot see?

I suppose the same question is valid for other attributes, like 'nothrow'
and '@safe'.

Thank you,

LMB


Re: Module-level attributes and unit tests

2014-08-23 Thread Leandro Motta Barros via Digitalmars-d-learn
Thanks, this was helpful!

LMB


On Sat, Aug 23, 2014 at 1:22 PM, monarch_dodra via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com wrote:

 On Saturday, 23 August 2014 at 15:26:02 UTC, Leandro Motta Barros via
 Digitalmars-d-learn wrote:

 Hello,

 I have a module which is completelly @nogc, and as such I'd like to just
 say

@nogc:

 at the top of the file and be happy.

 However, my unit tests for this same module do some GC allocation, so the
 module fails to compile.

 Is there a way to disable @nogc for the unit tests only? Would this be a
 bad idea in some way I cannot see?


 Nope. At best, you might be able to *declare* a function that is GC, but
 even then, you wouldn't be able to call it.


  I suppose the same question is valid for other attributes, like 'nothrow'
 and '@safe'.


 Actually, you can undo @safe with an explicit @system. nothrow (and
 pure) are in the same boat as @nogc

  Thank you,

 LMB


 Solutions I can see would be to:
 a) Put your unittests in a separate module.
 b) Place your unittests before your @nogc:
 c) Instead of using @nogc:, use @nogc {}: This will make @nogc run
 until the end of the block.



Re: pointer array?

2014-07-30 Thread Leandro Motta Barros via Digitalmars-d-learn
Justin's  answers seems correct to me, and I don't know anything about your
specific use case, but I cannot resist to add:

Think twice before doing this kind of things. I know that sometimes this is
necessary or handy, but one of the great things about D is that it provides
so many higher-level abstractions that we should feel ashamed to not use
them.

So, yes, an array of void* will work in D, as will many of the classic
lower-level tricks used in, say, C. But when using them, the compiler will
not be able to help you much finding errors and such. As rule I'd say that,
if you can (and we usually can), try using something higher level. (In your
case, perhaps an array of objects of some base class, or implementing a
certain interface? Or some more radical redesign?)

Cheers,

LMB



On Wed, Jul 30, 2014 at 11:33 AM, seany via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com wrote:

 In Ali's excllent book, somehow one thing has escaped my attention, and
 that it the mentioning of pointer arrays.

 Can pointers of any type of pointed variable be inserted in an int array?
 Using to!(int) perhaps? If not directly, then what else would achieve the
 same effect?



Re: pointer array?

2014-07-30 Thread Leandro Motta Barros via Digitalmars-d-learn
Can't you call it directly?

extern(C)
{
   int add (int a, int b)';
}

// ...

auto ret = add(123, 456);



LMB




On Wed, Jul 30, 2014 at 2:55 PM, seany via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com wrote:



 Can you post the signatures of some of the C functions you're trying to
 interface with?


 let us take a simple function :

 int add (int a, int b)



Re: Any GPL video games in D2

2014-06-25 Thread Leandro Motta Barros via Digitalmars-d-learn
Hi,

Some time ago I wrote this Tetris-like game:
https://bitbucket.org/lmb/anytris (also on GitHub:
https://github.com/lmbarros/Anytris)

Nothing fancy. I am sure there are better examples out there. And maybe
this is not the best code to show to students ;-)

Also, license is ZLib -- I assume it will be good for your purposes.

LMB



On Wed, Jun 25, 2014 at 11:24 AM, Binarydepth via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com wrote:

 I would like to show D in action to other programmers/students.

 Anyone knows of a Video Game coded in D2 ?

 Thank you