Re: bool passed by ref, safe or not ?

2024-06-04 Thread Olivier Pisano via Digitalmars-d-learn

On Wednesday, 5 June 2024 at 05:15:42 UTC, Olivier Pisano wrote:


This is technically not a memory corruption, because as 
bool.sizeof < int.sizeof, you just write the low order byte of 
an int you allocated on the stack.


It was not an int, it was a ushort. Anyway, what I wrote still 
applies.


Re: bool passed by ref, safe or not ?

2024-06-04 Thread Olivier Pisano via Digitalmars-d-learn

On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote:
question in the header, code in the body, execute on a X86 or 
X86_64 CPU



I understand that the notion of `bool` doesn't exist on X86, 
hence what will be used is rather an instruction that write on 
the lower 8 bits, but with a 7 bits corruption.


Do I corrupt memory here or not ?
Is that a safety violation ?



The problem is that while setIt() is @safe, your main function is 
not. So the pointer cast (which is not @safe) is permitted.


A bool is a 1 byte type with two possible values : false (0) and 
true (1).


When you set the value to false, you write 0 to the byte it 
points to.


This is technically not a memory corruption, because as 
bool.sizeof < int.sizeof, you just write the low order byte of an 
int you allocated on the stack.


Re: How best to implement items and weapons in my RPG. Nested classes? Delegates?

2024-04-04 Thread Olivier Pisano via Digitalmars-d-learn

Hi,

You should have a look at the decorator design pattern, it 
reduces the amount of classes to implement if you need to combine 
different effects such as elemental damage to your weapons (e.g. 
if you want flame arrows).


https://en.wikipedia.org/wiki/Decorator_pattern
https://refactoring.guru/design-patterns/decorator




Re: length's type.

2024-01-28 Thread Olivier Pisano via Digitalmars-d-learn

On Sunday, 28 January 2024 at 08:55:54 UTC, zjh wrote:
On Sunday, 28 January 2024 at 06:34:13 UTC, Siarhei Siamashka 
wrote:


The explicit conversion `.length.to!int` has an extra benefit



I rarely use numbers over one million.

But do I have to consider numbers over `4 billion` every day?


If .length were to be an int, D could not handle array of more 
than 2G bytes. The whole language would be useless on 64 bit 
systems.





Re: Is sizeof() available in D language?

2023-09-04 Thread Olivier Pisano via Digitalmars-d-learn

On Monday, 4 September 2023 at 09:41:54 UTC, BoQsc wrote:

I've seen everyone using **datatype**`.sizeof` property.

https://dlang.org/spec/property.html#sizeof

It's great, but I wonder if it differ in any way from the 
standard C function `sizeof()`.



Technically speaking, in C, sizeof is not a function, it is an 
operator. This is why it is not available in D (replaced by the 
.sizeof property).




https://www.geeksforgeeks.org/sizeof-operator-c/
https://en.cppreference.com/w/cpp/language/sizeof

I'm seeking for some speed/performance, so that's why the 
question.

Overall I'm alright with continuing using it.


There is absolutely no difference in terms of runtime 
performance. In both cases, the compiler replaces it by the size 
of the type at compile-time.


Re: Evolving the D Language

2023-07-08 Thread Olivier Pisano via Digitalmars-d-announce

On Friday, 7 July 2023 at 10:45:33 UTC, Guillaume Piolat wrote:

On Friday, 7 July 2023 at 09:35:14 UTC, Paolo Invernizzi wrote:


I respectfully disagree, and prefer to keep going on with the 
current deprecation and cleanup policy: Scott Meyers' DConf 
2014 keynote all the way down.


+1

I've always agreed with the deprecation in the end, even 
complex numbers.

alias this was a relatively bad idea, even if an iconic feature.
I don't remember people from outside the community being 
impressed by alias this.
We have the right to backtrack on bad ideas instead of keeping 
them forever.
The __traits changed feature was aout fixing an incorrect 
behaviour. It took 10 min to fix.

The current deprecation system is very good.


I agree with these two messages.


Connecting to D-Bus signals

2022-10-04 Thread Olivier Pisano via Digitalmars-d-learn

Hi,

I am currently trying to connect to a signal on UDisks2 to be 
notified whenever the user plugs a USB drive on the system, but 
my method never gets called.


Here is my code :

import ddbus;
import ddbus.c_lib;

import std.stdio;

final class UsbDevice
{
void onInterfacesAdded(ObjectPath path, 
Variant!DBusAny[string][string] params)

{
writeln("Interfaces added");
}
}


void main()
{
auto conn = connectToBus(DBusBusType.DBUS_BUS_SYSTEM);
auto router = new MessageRouter();
auto dev = new UsbDevice();

MessagePattern ifaceAdded = MessagePattern(
ObjectPath("/org/freedesktop/UDisks2"),   

interfaceName("org.freedesktop.DBus.ObjectManager"),
   
"InterfacesAdded",

   true);
router.setHandler(ifaceAdded, );
registerRouter(conn, router);

simpleMainLoop(conn);
}


What am I doing wrong ?

Thanks in advance,

Ol


Re: How to get rid of "nothrow" ?

2020-05-17 Thread Olivier Pisano via Digitalmars-d-learn

On Sunday, 17 May 2020 at 09:27:40 UTC, Vinod K Chandran wrote:

Hi all,
I am trying to create a win32 based gui in dlang. So far so 
good. I can create and display my window on screen. But for 
handling messages, i planned to write something like message 
crackers in c++. But since, my WndProc function is a "nothrow" 
function, i cannot use any function without "nothorw" in that 
WndProc. How to solve this problem ?


Hi,

You need to catch any exceptions inside of your WndProc so they 
don't propagate:


LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, 
LPARAM lParam) nothrow

{
try
{
// your code logic here may call throwing functions
}
catch (Exception e)
{
// You should log exceptions here
}
}


Re: XMM Intrinsics

2020-05-09 Thread Olivier Pisano via Digitalmars-d-learn

On Friday, 8 May 2020 at 12:38:51 UTC, Marcio Martins wrote:

Hi,

I am building a CRC32C implementation using SSE for D, because 
I couldn't find any readily available :[


Here is mine:

https://github.com/opisano/crc32c/blob/master/crc32c.d






Re: Idomatic way to guarantee to run destructor?

2020-05-04 Thread Olivier Pisano via Digitalmars-d-learn

On Monday, 4 May 2020 at 09:20:06 UTC, Ali Çehreli wrote:
On 4/30/20 10:04 AM, Ben Jones wrote:> On Thursday, 30 April 
2020 at 16:55:36 UTC, Robert M. Münch wrote:


> I think you want to use scope rather than auto which will put
the class
> on the stack and call its destructor:
> https://dlang.org/spec/attribute.html#scope

That is correct about calling the destructor but the object 
would still be allocated with 'new', hence be on the heap. 
There is also library feature 'scoped', which places the object 
on the stack:


  https://dlang.org/phobos/std_typecons.html#scoped

Ali


https://godbolt.org/z/SEVsp5

My ASM skills are pretty limited, but it seems to me that the 
call to _d_allocclass is omitted when using scope. At least with 
LDC and GDC.


Am I missing something ?


Re: How do I extract and convert datatypes from ResultRange

2019-08-26 Thread Olivier Pisano via Digitalmars-d-learn

On Monday, 26 August 2019 at 13:49:21 UTC, Anders S wrote:

Hi guys,

I'm trying to read a post of different datatypes from MariaDB 
table into another message and pass it on into a FIFO pipe to 
an other application.


My code :
   string sql = "SELECT * FROM guirequest WHERE read_request = 
-1;";

ResultRange range = conn.query(sql);
Row row = range.front;
int i, count = (to!int(range.rowCount));
writeln("rowCount ", range.rowCount, "\n"); // sofar so good

The problem occurs when I wish to extract row data into string, 
int or short datatypes.

It complains on  int i = row[2]; with
Error: cannot implicitly convert expression row.opIndex(2u) of 
type VariantN!24u to int


Same for other datatypes.

Any ideas?
/a


I don't have a compiler accessible right now, but according to 
https://dlang.org/phobos/std_variant.html :


int i;
if (row[2].peek!int !is null)
i = row[2].get!int



Re: How to ensure string compatibility In D?

2019-01-22 Thread Olivier Pisano via Digitalmars-d-learn

On Tuesday, 22 January 2019 at 13:55:30 UTC, FrankLike wrote:

Hi,everyone,
  In C++, _T can guarantee that when converting from ascii 
encoding type to unicode encoding type, the program does not 
need to be modified. What do I need to do in D?


Thanks.


Hi,

_T is not relevant to C++, but to Windows programming.

In D, there is only Unicode. The language doesn't manipulate 
strings encoded in Windows local code-pages.


char means UTF-8 (Unicode encoded in 8bit units).
wchar means UTF-16 (Unicode encoded in 16bit units, what Windows 
documentation calls "Unicode").

dchar means UTF-32 (Unicode encoded in 32bit units).

When manipulating data encoded in Windows local code page, use 
the ubyte[] type.


Re: [OT] "I like writing in D" - Hans Zimmer

2018-08-26 Thread Olivier Pisano via Digitalmars-d

On Wednesday, 22 August 2018 at 22:51:58 UTC, Piotrek wrote:
You may already know that from youtube. It seems D starts 
getting traction even among musicians:


https://www.youtube.com/watch?v=yCX1Ze3OcKo=youtu.be=64

That really put a smile on my face :D

And it would be a nice example of a D advertising campaign ;)

Cheers,
Piotrek


Moreover, D is written using two sharp signs, which gives me 
ideas.





Re: Article: Running D without its runtime

2016-11-10 Thread Olivier Pisano via Digitalmars-d-announce
On Thursday, 10 November 2016 at 11:11:17 UTC, Guillaume Piolat 
wrote:
On Thursday, 10 November 2016 at 06:52:12 UTC, Olivier Pisano 
wrote:
I cannot read your website on Firefox 45 (no text is 
displayed). It works on chromium anyway.


I develop it on Firefox. What is your OS?


I am on Debian Jessie, with Firefox ESR 45.4.0.


Re: Article: Running D without its runtime

2016-11-09 Thread Olivier Pisano via Digitalmars-d-announce
I cannot read your website on Firefox 45 (no text is displayed). 
It works on chromium anyway.


Re: Recommended coding convention for combining unix and windows code ?

2016-06-08 Thread Olivier Pisano via Digitalmars-d-learn

Hi,

I personally separate OS-specific implementations in modules with 
the same name, in different directories. From the filesystem 
perspective:


widget.d
linux/widgetimpl.d
windows/widgetimpl.d

From the code perspective, the *impl modules would present 
homonymic types with the same public interface.


module widget;

class Widget
{
version(Windows)
{
import windows.widgetimpl;
}
version(linux)
{
import linux.widgetimpl;
}

void systemSpecificTask()
{
auto s = SystemSpecificStruct(); // defined in every 
widgetimpl.d

s.execute();
}
}


Re: D equivalent of C++ bind ?

2016-05-10 Thread Olivier Pisano via Digitalmars-d-learn

Salut Christophe,

Did you have a look at 
https://dlang.org/phobos/std_functional.html#partial ?


Re: How about use Gc as a big memory pool?

2016-04-07 Thread Olivier Pisano via Digitalmars-d-learn

On Friday, 8 April 2016 at 03:27:04 UTC, Dsby wrote:

when the soft start, call GC.disable().
use "new " create a class , struct or a array. and use 
destory(T/void *) to call the ~this(), then GC.free to free the 
memory, and use RAII in class or Struct.
And user the Timer, or in some where to call : GC.enable(), 
GC.collect(), GC.disable();


In this way , i can know and control when is GC runing.

Is This way   feasible? will It  have a problem?


It should work, but you cannot predict how much time collect() 
will take, since it depends on the system state (how much work it 
has to do). So instead of calling it at fixed intervals, you'd 
better call it when your application is idle.


Why don't you try to use 
https://dlang.org/phobos/std_experimental_allocator.html ?


Re: nogc Array

2016-01-26 Thread Olivier Pisano via Digitalmars-d-learn

On Tuesday, 26 January 2016 at 05:53:29 UTC, Igor wrote:
On Tuesday, 26 January 2016 at 04:38:13 UTC, Adam D. Ruppe 
wrote:

On Tuesday, 26 January 2016 at 04:31:07 UTC, Igor wrote:

then std.algorithm.find!("a.myInt == b")(classes, 3)


Try

std.algorithm.find!("a.myInt == b")(classes[], 3)

notice the [] after classes


I guess std.container.array isn't a range? Or am I using it 
wrong?


Containers aren't really ranges, they instead *offer* ranges 
that iterate over them. Built in arrays are a bit special in 
that they do this implicitly so the line is more blurred 
there, but it is a general rule that you need to get a range 
out of a container.


Otherwise, consider that iterating over it with popFront would 
result in the container being automatically emptied and not 
reusable!


Ok, does the [] do any conversion or any thing I don't want or 
does it just make the template know we are working over an 
array?


Are there any performance issues? I am already using a for loop 
to find the type, it's 6 lines of code. I was hoping to get 
that down to one or 2 and make it a bit easier to understand.


App app = null;
for(int i = 0; i < Apps.length(); i++)
if ((Apps[i] !is null) && (Apps[i].hWnd == hWnd))
{
app = Apps[i];
break;
}

versus

find!("a.hWnd == b")(Apps[], hWnd);

Does [] take time to convert to a built in a array or range or 
whatever or will it be just as fast as the above code?


The [] operator returns a Range object iterating over the Array 
elements, similarly to what the begin()/end() cbegin()/cend() 
function pairs do in C++. The range object does not copy the 
array element, only contains a slice to them.
So your question ends up in comparing hand-written loops over 
std::find_if().


Re: static array crashes my program

2015-12-05 Thread Olivier Pisano via Digitalmars-d-learn

On Saturday, 5 December 2015 at 09:49:06 UTC, ref2401 wrote:
I want to create a static array large enough to store 1MB of 
float values.

What am I doing wrong?
Here is a sample code with notes:

void main(string[] args) {
enum size_t COUNT = 1024 * 512 / float.sizeof; // works OK :)
	//enum size_t COUNT = 1024 * 512 * 2 / float.sizeof; // 
constantly crashes :(

float[COUNT] arr;
writeln(arr.length);
}

DMD: 2069.2
OS: Win 8.1 Pro


I suppose you overflow the stack.
I am not a Windows dev, but I suppose there is a linker option to 
increase the stack size.
Or you can try to use a global __gshared variable or allocate 
your array on the heap.


Re: DConf keynote speaker ideas

2015-11-17 Thread Olivier Pisano via Digitalmars-d
On Tuesday, 17 November 2015 at 18:47:58 UTC, Andrei Alexandrescu 
wrote:
I'm thinking of inviting a notable industry luminary to deliver 
a conference keynote. Please reply to this with ideas! -- Andrei


Erik Meijer?


Re: `clear`ing a dynamic array

2015-10-25 Thread Olivier Pisano via Digitalmars-d-learn
On Sunday, 25 October 2015 at 04:04:29 UTC, Shriramana Sharma 
wrote:

rsw0x wrote:


use std.container.array


Thanks all for all the recommendations. When would one use 
std.array.appender with a built-in array vs 
std.container.array.Array? What are the pros and cons on either 
side?


Appender is a small wrapper that enables you to get an output 
range from a built-in array. It allocates using the GC. If you 
have an array and you need to pass it to a function that takes an 
output range, you can use it.


std.container.Array is a reference counted container that is 
equivalent to std::shared_ptr in C++. It is not 
reliant on the GC.


Re: Walter and I talk about D in Romania

2015-10-04 Thread Olivier Pisano via Digitalmars-d-announce

On Saturday, 3 October 2015 at 23:05:41 UTC, deadalnix wrote:

On Saturday, 3 October 2015 at 12:29:17 UTC, Marco Leise wrote:
That's a lot of people. You must be some kind of programming 
national hero in Romania. Good luck and watch out for those 
C++ moroi in the audience!


Time to get a Dman costume and some lycra costume !


And climb some walls !

http://www.factornews.com/images/670x320/12/120318.png


Re: Reading and converting binary file 2 bits at a time

2015-08-27 Thread Olivier Pisano via Digitalmars-d-learn

On Thursday, 27 August 2015 at 09:38:52 UTC, Andrew Brown wrote:



That's lovely, thank you. One quick question, the length of the 
file is not a multiple of the length of ubyte,  but the cast 
still seems to work. Do you know how it converts a truncated 
final section?


Thanks again

Andrew


Well, since the length of ubyte is 1, the length of the file is 
necessarily a multiple of the length of ubyte.


Re: Arrays of structs

2015-08-27 Thread Olivier Pisano via Digitalmars-d-learn

On Thursday, 27 August 2015 at 10:49:02 UTC, John Burton wrote:


To be honest I'm finding it very hard to find the right idioms 
in D for safe and efficient programming when I'm so used to C++ 
/ RAII everywhere. I'll adapt though :P


This is true for every new language you learn. You first stick to 
the idioms you already know before getting the right style.
My first Python code looked like C and my first D code looked 
like Java.


BTW, if you need a growable array with deterministic destruction, 
you should have a look at std.container.array.Array(T), which is 
equivalent to a shared_ptrvectorT.


Re: Programming in D paper book is available for purchase

2015-08-20 Thread Olivier Pisano via Digitalmars-d-announce

On Wednesday, 19 August 2015 at 00:57:32 UTC, Ali Çehreli wrote:

I am very happy! :)

It will be available on many other distribution channels like 
Amazon in a few days as well but the following is the link that 
pays me the most royalty:


  https://www.createspace.com/5618128

This revision has many corrections and improvements over the 
one on the web site, which was from December 2014. (Thank you, 
Luís Marques!)


I am too excited to list the changes right now but I can say 
that it is up to date with 2.068. :D


eBook formats will follow but here are two 
almost-production-ready versions, which, hopefully apparent 
from their names, will disappear soon:


  http://ddili.org/deleteme.epub

  http://ddili.org/deleteme.azw3

And the book will always be freely available as well but I 
haven't updated the web site yet.


Enjoy, and go buy some books! ;)

Ali


I ordered my copy this morning. This book is fantastic and it 
deserves its place near Andrei's and Adam's books on one's 
bookshelf.


Congratulations for this achievement, Ali.


Re: Difference between __gshared and shared.

2015-07-08 Thread Olivier Pisano via Digitalmars-d

On Wednesday, 8 July 2015 at 09:20:58 UTC, wobbles wrote:
After reading the recent Lessons Learned article [1], and 
reading a few comments on the thread, there was a mention of 
using __gshared over shared.


What exactly is the difference here?
Are they 2 keywords to do the same thing, or are there specific 
use cases to both?

Is there plans to 'converge' them at some point?

[1] 
https://www.reddit.com/r/programming/comments/3cg1r0/lessons_learned_writing_a_filesystem_in_d/


You can read it there : 
http://dlang.org/migrate-to-shared.html#gshared


Basically, __gshared is for interfacing with C (where everything 
is shared by default) without marking data as shared.


Re: [NEEDING HELP] Translation of Ali Cehreli's book in French

2015-03-14 Thread Olivier Pisano via Digitalmars-d

On Saturday, 14 March 2015 at 08:38:06 UTC, Raphaël Jakse wrote:

Le 13/03/2015 16:45, Olivier Pisano a écrit :

What is the next chapter to need translation ?


It should be const ref Parameters and const Member Functions 
but Scroph might want to translate it as it seems to be the 
following of his chapter. I don't know what he wants to do.


So you could translate Constructor and Other Special Functions?


Hum, I have just translated const ref Parameters and const Member 
Functions this week (it is the chapter I sent you on Thursday).


I am going to do Constructor and Other Special Functions, then. :)


Re: [NEEDING HELP] Translation of Ali Cehreli's book in French

2015-03-13 Thread Olivier Pisano via Digitalmars-d

What is the next chapter to need translation ? 


Re: [NEEDING HELP] Translation of Ali Cehreli's book in French

2015-03-02 Thread Olivier Pisano via Digitalmars-d

The chapter on function overloading is translated. If it is OK
with you, I acquire the mutex on const ref Parameters and const
Member Functions, then :o)


Re: [NEEDING HELP] Translation of Ali Cehreli's book in French

2015-02-22 Thread Olivier Pisano via Digitalmars-d

I did send you a first draft of the variable number of parameters
chapter on Friday, on your gmail address. Did you get it ? 


Re: [NEEDING HELP] Translation of Ali Cehreli's book in French

2015-02-22 Thread Olivier Pisano via Digitalmars-d

On Sunday, 22 February 2015 at 22:27:42 UTC, Raphaël Jakse wrote:

Le 22/02/2015 14:00, Olivier Pisano a écrit :
I did send you a first draft of the variable number of 
parameters

chapter on Friday, on your gmail address. Did you get it ?


Yes, I thought I answered to your mail. Sorry if I didn't.

I read it quickly, it looks very well. Great, thank you very 
much for your work. I must find time to handle it, surely in 
the week.


I also received proofreads for the first chapters, I will fix 
the translation soon.


Thank you all for your work, that's great!

Raphaël.


Great, if you think something needs to be changed, do not
hesitate. I started the translation of the next chapter this
weekend and I should have something to show in the next few days.


Re: D plan to do RAII(Resource Acquisition Is Initialization)?

2015-02-21 Thread Olivier Pisano via Digitalmars-d

On Saturday, 21 February 2015 at 10:06:26 UTC, FrankLike wrote:
RAII(Resource Acquisition Is Initialization) is a good 
thing,will D plan to do it?


It's already here :


import std.stdio;

struct Test
{
~this() { writeln(RAII); }
}

void main()
{
 Test t; // prints RAII when goes out of scope
}


Re: [NEEDING HELP] Translation of Ali Cehreli's book in French

2015-02-18 Thread Olivier Pisano via Digitalmars-d

On Tuesday, 17 February 2015 at 22:46:01 UTC, Raphaël Jakse wrote:


To begin the translation of a chapter, I suggest you tell it 
here so two people are not translating the same chapter at the 
same time.


Ok, I am gonna start with the Variable number of parameters 
chapter, then.
I am thinking about using ODT/LibreOffice at the moment, since I 
don't know much about whata and don't have a bitbucket account 
yet. I'll get into this when I have some translated work to show.


Regards,

Olivier


Re: [NEEDING HELP] Translation of Ali Cehreli's book in French

2015-02-17 Thread Olivier Pisano via Digitalmars-d

On Tuesday, 17 February 2015 at 17:29:15 UTC, Raphaël Jakse wrote:
Is anybody interested? Don't hesitate to send me an email if 
you are willing to get involved, even for the smallest task. 
There are no small tasks when a work is to get completed. I 
will tell you how to help.


I suppose I could give it some time.


Re: RFC: reference counted Throwable

2014-09-20 Thread Olivier Pisano via Digitalmars-d

On Saturday, 20 September 2014 at 06:28:11 UTC, Paulo Pinto wrote:


This is one of the reasons why the Objective-C GC failed.

Mixing Frameworks compiled with both modes never worked 
properly.


--
Paulo


Yes this was a huge failure to take into account.

Linking code where Throwable inherits from Object with code where
Throwable inherits from RCObject... :(

If making the GC completely optional is a must, then error
handling shouldn't rely on it at all, no? What about completely
switching exception handling to RC ? Would it have an impact on
memory safety since exeption handling mecanism is somehow
magical code generated by the compiler ?


Re: Concatenates int

2014-07-10 Thread Olivier Pisano via Digitalmars-d-learn

Hello,

I may have not understood what you actually want to do, but
aren't std.bitmanip.peek or std.bitmanip.read what you are
looking for ?

http://dlang.org/phobos/std_bitmanip.html#.peek


Re: What exactly module in D means?

2014-07-05 Thread Olivier Pisano via Digitalmars-d-learn

No, import is different from include. It does not stupidly copy
and paste its content but tells the compiler to take the module
into account for name resolution. The result may seem similar,
but is much more efficient.

A D module is also a unit of encapsulation (a private declaration
in a module is only accessible from this module, and not from
another one importing it).


Re: Equivalent of C++ std::function

2014-06-24 Thread Olivier Pisano via Digitalmars-d-learn

On Wednesday, 25 June 2014 at 03:33:15 UTC, Yuushi wrote:


Thanks a ton - I guess I need to do a fair bit more reading 
about alias.


In this case, alias acts as typedef in C++. What is important 
here is the function pointers/delegates syntax.




Re: Adam D. Ruppe's D Cookbook now available!

2014-05-28 Thread Olivier Pisano via Digitalmars-d-announce

I have just ordered mine. I can't wait to get it ! 


Re: Does D support plugins with dll written in D ?

2014-05-27 Thread Olivier Pisano via Digitalmars-d

Hello :)

AFAIK, Higher-level library support is planned for next release 
(v2.066) [1].


Meanwhile, you'll have to rely on your own exported factory 
functions to create objects instead of Object.factory().



1 : http://wiki.dlang.org/Agenda#high-level_shared_library_support