Thread overview
druntime vs phobos
Feb 02, 2012
Mattbeui
Feb 02, 2012
Marco Leise
Feb 02, 2012
Jonathan M Davis
Feb 02, 2012
Sean Kelly
Feb 02, 2012
Mattbeui
February 02, 2012
Hi,

What are the main differences between these two libs?

Since I saw:

On Github:

Druntime: Druntime is the minimum library required to support the D programming
language. It includes the system code required to support the garbage
collector, associative arrays, exception handling, array vector operations,
startup/shutdown, etc.

phobos: Runtime library for the D programming language — Read more d-programming-language.org


On this forum - Index:

D-runtime: Runtime library design and implementation

phobos: Phobos standard library design and implementation


1) Using D2 I need both?

2) Where phobos replaces druntime and vice-versa?

Thanks.
February 02, 2012
Don't worry about that. You will only be using Phobos2 with D2.
druntime was split out of Phobos, to provide the bare minimum (GC, arrays, ...) of D, so it was easier to use without Phobos or with a different library like Tango. Both are currently used and actively developed. druntime is compiled right into Phobos2, so you will probably not even find it as a separate file in your installation of D2, but the core.* modules are generally part of druntime. That is where you find the garbage collector and some basic OS bindings amongst other things.
February 02, 2012
On Thursday, February 02, 2012 02:33:39 Mattbeui wrote:
> Hi,
> 
> What are the main differences between these two libs?
> 
> Since I saw:
> 
> On Github:
> 
> Druntime: Druntime is the minimum library required to support the
> D programming
> language. It includes the system code required to support the
> garbage
> collector, associative arrays, exception handling, array vector
> operations,
> startup/shutdown, etc.
> 
> phobos: Runtime library for the D programming language — Read more d-programming-language.org
> 
> 
> On this forum - Index:
> 
> D-runtime: Runtime library design and implementation
> 
> phobos: Phobos standard library design and implementation
> 
> 
> 1) Using D2 I need both?
> 
> 2) Where phobos replaces druntime and vice-versa?

druntime contains the D runtime. It's required for any D program to work. Phobos is D's standard library and thus uses druntime. It's not actually required, but you're not likely to write a D program without it. Both are provided with dmd combined as a single library (libphobos.a or phobos.lib, depending on the OS). The core.* modules are in druntime, and the std.* modules are in Phobos.

- Jonathan M Davis
February 02, 2012
On Feb 1, 2012, at 5:33 PM, Mattbeui wrote:

> Hi,
> 
> What are the main differences between these two libs?

Druntime contains all the code that every D app needs to run.  This includes routines called by compiler-generated code, the garbage collector, and thread support (needed so the GC can find and scan user threads).  Phobos is the D standard library and its use is completely optional, though it's linked by default by DMD.


> 1) Using D2 I need both?

Strictly speaking: no.  You can use --defaultlib=druntime and --debuglib=druntime to avoid linking Phobos, assuming that you have the druntime library available.


> 2) Where phobos replaces druntime and vice-versa?

There are a few instances where Phobos aliases stuff in Druntime, but this is typically for compatibility reasons.  There should be little to no overlap in functionality between the two.  Think of core (druntime) as being roughly equivalent to java.lang.
February 02, 2012
I chose myself to reply this topic, but I would like to say thanks to:

Marco Leise, Jonathan M Davis and Sean Kelly for answering my questions.

I really understood now.

Thanks again.