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 perceiv

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 thinki

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 fo

Re: Coverage

2016-02-16 Thread Leandro Motta Barros via Digitalmars-d-learn
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 yo

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'

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, >>

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 t

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 tryin

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 ab

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

Re: package.d imports

2014-01-19 Thread Leandro Motta Barros
Hi! I made similar questions here a month ago, but also couldn't get definitive answers. I just sent a message about this to the main D forum. Let's see if we have better luck there :-) Cheers, LMB On Fri, Jan 17, 2014 at 5:39 PM, Lemonfiend wrote: > I think this is what you are looking for

Re: package.d

2013-12-18 Thread Leandro Motta Barros
On Wed, Dec 18, 2013 at 6:56 AM, Joseph Rushton Wakeling < joseph.wakel...@webdrake.net> wrote: > On 17/12/13 01:51, Leandro Motta Barros wrote: > >> I have some code using the old "all.d" idiom, which I am changing to use >> the new >> "package.d&

Re: package.d

2013-12-18 Thread Leandro Motta Barros
undefined identifier 'util' main.d(6): Error: mylib.util.Foo is used as a type Fishy, isn't it? Maybe I should report this as a bug? Cheers, LMB On Wed, Dec 18, 2013 at 6:09 AM, Andrej Mitrovic wrote: > On 12/17/13, Leandro Motta Barros wrote: > > Is there any documenta

Re: package.d

2013-12-17 Thread Leandro Motta Barros
. Thank again, LMB On Mon, Dec 16, 2013 at 10:51 PM, Leandro Motta Barros wrote: > Hello, > > I have some code using the old "all.d" idiom, which I am changing to use > the new "package.d" feature. > > Originally, I had something like this: > > // mylib

package.d

2013-12-16 Thread Leandro Motta Barros
Hello, I have some code using the old "all.d" idiom, which I am changing to use the new "package.d" feature. Originally, I had something like this: // mylib/util.d: module mylib.util; class Foo { } // mylib/all.d: module mylib.all; public import mylib.util; // main.d: import mylib.all; void ma

Re: TypeInfo.compare is not implemented

2013-11-30 Thread Leandro Motta Barros
I am terribly sorry, this was a completely lazy question. So far, I couldn't reproduce the problem in a small example. I'll look deeper into this before posting again about it. LMB On Sat, Nov 30, 2013 at 12:07 PM, Shammah Chancellor wrote: > On 2013-11-30 13:39:15 +0000,

TypeInfo.compare is not implemented

2013-11-30 Thread Leandro Motta Barros
Hello, I my FewDee game prototyping library (https://bitbucket.org/lmb/fewdee) I ignored most of the usual reccomendations like "be careful with the GC, it's slow" and "associative arrays are buggy in D, so avoid them". I just used whatever I found convenient to have my stuff running with minimal

Re: InExpression with custom type?

2013-08-23 Thread Leandro Motta Barros
Thanks! LMB On Fri, Aug 23, 2013 at 4:59 PM, Namespace wrote: > On Friday, 23 August 2013 at 19:57:42 UTC, Leandro Motta Barros wrote: > >> Hello! >> >> Is it possible to make an InExpression work with a used-defined type? >> >> struct MyCollection { ... }

InExpression with custom type?

2013-08-23 Thread Leandro Motta Barros
Hello! Is it possible to make an InExpression work with a used-defined type? struct MyCollection { ... } MyCollection mc; auto p = 123 in mc; if (p) { ... } Thanks! LMB

Re: How to disable the DOS window at the start of my program on D

2013-07-24 Thread Leandro Motta Barros
For Win32/OPTLINK, I passed the following flag to dmd in a lil' project of mine: -L/SUBSYSTEM:WINDOWS:4.0 Worked for me. LMB On Wed, Jul 24, 2013 at 5:24 AM, Rikki Cattermole wrote: > On Wednesday, 24 July 2013 at 08:16:39 UTC, MGW wrote: >> >> On Wednesday, 24 July 2013 at 08:08:19 UTC,

Re: Reference to D class instance with a C library

2013-07-14 Thread Leandro Motta Barros
too.) LMB On Sun, Jul 14, 2013 at 6:29 AM, Jacob Carlborg wrote: > On 2013-07-13 20:53, Leandro Motta Barros wrote: >> >> Hey, thanks! This makes sense :-) >> >> Am I now wondering... how safe, portable and future proof would this >> be? If some future version o

Re: Reference to D class instance with a C library

2013-07-13 Thread Leandro Motta Barros
> Also note that if the pointer in C land is the only reference to the > class, the garbage collector will destroy the instance when it gets > around to it. Yup, I am aware of this. I mentioned that I can guarantee that my object will outlive the C struct... > There's a function GC.addRoot[1] in

Re: Reference to D class instance with a C library

2013-07-13 Thread Leandro Motta Barros
Good. Thanks again! LMB On Sat, Jul 13, 2013 at 4:01 PM, Adam D. Ruppe wrote: > On Saturday, 13 July 2013 at 18:54:18 UTC, Leandro Motta Barros wrote: >> >> If some future version of D implements a garbage collector capable of >> moving objects around the heap, I could

Re: Reference to D class instance with a C library

2013-07-13 Thread Leandro Motta Barros
wrote: > On Saturday, 13 July 2013 at 18:30:24 UTC, Leandro Motta Barros wrote: >> >> So, is there some way to store a reference to a D class instance in that >> 'user_data' field? > > > Should be ok to cast the reference itself to that type - don't take

Reference to D class instance with a C library

2013-07-13 Thread Leandro Motta Barros
Hello, TL;DR: Can I somehow store a reference to a D class instance in a field of a struct from a C library I am using with my D code? The long story: I am writing some D code that uses a C library. This C library provides an event handling mechanism in which events are represented by (plain C)

Re: Finalizing GC

2013-04-01 Thread Leandro Motta Barros
On Mon, Apr 1, 2013 at 1:45 PM, H. S. Teoh wrote: > On Mon, Apr 01, 2013 at 01:07:56AM -0700, Jonathan M Davis wrote: >> On Sunday, March 31, 2013 20:51:52 H. S. Teoh wrote: >> > On Sun, Mar 31, 2013 at 06:29:21PM -0700, Jonathan M Davis wrote: >> > [...] > Seems to me like dtors should be removed

Re: Passing revision tag to the compiler

2013-03-31 Thread Leandro Motta Barros
On Sun, Mar 31, 2013 at 10:09 AM, Tobias Pankrath wrote: > On Sunday, 31 March 2013 at 02:00:46 UTC, Leandro Motta Barros wrote: >> >> Hello, >> >> >> I'd like to include the version control revision tag in a program. In >> the C/C++ world I'd

Passing revision tag to the compiler

2013-03-30 Thread Leandro Motta Barros
Hello, I'd like to include the version control revision tag in a program. In the C/C++ world I'd make my build system call the compiler like this: g++ -D . so that the revision is available as a preprocessor symbol. Is there an easy way to achieve the same in D? I can think of convoluted

Re: Why is null lowercase?

2013-01-24 Thread Leandro Motta Barros
Hi, In C, NULL is a #define, and #defines are typically all-caps. In D, null is real keyword recognized by the compiler, and those are typically lowercase. I am just guessing here, but I'd say the choice for 'null' instead of 'NULL' is just to be coherent with this. Personally, I kinda like 'null

Re: Global variables read at compile time?

2012-08-15 Thread Leandro Motta Barros
Another option is to use "module constructors", as shown below. (But somehow this all looks a bit fishy for me...) LMB import std.stdio; string a = "a"; string b; static this() { b = a; } void main() { writeln(b); } On Wed, Aug 15, 2012 at 11:03 AM, d_follower wrote: > On Wednes