Project deployment

2014-03-01 Thread Uranuz
It's not look like question about D, but because I developing 
some web site on D I asking this question there. The question is 
about how to organize automative deployment process which include 
building executables, shared libraries, running unittests etc. 
Then I need it to place these builded files, resources (like 
html-templates, images, style sheets and other documents) in 
directories from which application will run. Also creation of 
documentation for libraries, aplications is needed.


I have no experience in deployment process so I'll be thankful 
any advices how to start. It could be links for some articles, 
tools that helps to solve this problem.


What is about *dub*? What kind of programme is it. Is it tool for 
only building application but not deploying? If no where I could 
read about these features (may be some examples exist)


Re: Project deployment

2014-03-01 Thread Rikki Cattermole

On Saturday, 1 March 2014 at 10:18:09 UTC, Uranuz wrote:
It's not look like question about D, but because I developing 
some web site on D I asking this question there. The question 
is about how to organize automative deployment process which 
include building executables, shared libraries, running 
unittests etc. Then I need it to place these builded files, 
resources (like html-templates, images, style sheets and other 
documents) in directories from which application will run. Also 
creation of documentation for libraries, aplications is needed.


I have no experience in deployment process so I'll be thankful 
any advices how to start. It could be links for some articles, 
tools that helps to solve this problem.


What is about *dub*? What kind of programme is it. Is it tool 
for only building application but not deploying? If no where I 
could read about these features (may be some examples exist)


If your utilising e.g. Vibe-d or templ-d for templating then 
templates will be compiled into the application. The raw source 
files are not required at runtime.
It would be possible for the same thing for e.g. css files. 
However this is a little bit more difficult.


Dub is a build manager for D. Its responsibility is to compile 
the executable. In other words, make it ready for deployment. It 
may not create e.g. .deb files but it will provide you with your 
executable and resources should you configure it so. Although 
copying directories is a little intensive with raw cli commands 
to do so.


Dub can handle creation of documentation in the form of html 
files, as does dmd itself. Its just a switch you need to use. 
However you do need to adhere to ddoc for this.


The alternative to using the import(file) syntax to load a file 
at compile time (do note you need to add a string import path to 
the compiler i.e. -J.) is to use e.g. a binary file to D file 
converter [0]. Which would allow you to compile in all your 
resources.


Please note however, because of the differences in e.g. Linux 
distributions you will be required to compile for the target 
especially. So e.g. in a VM.


[0] https://github.com/rikkimax/Bin2D


Strange _xopEquals function

2014-03-01 Thread L!ort
I downloaded druntime from 
https://github.com/xomboverlord/xomb-bare-bones/tree/master. It's 
druntime made for bare bones XOmB OS. If I want to compile it to 
library, dmd return error undefined identifier _xopEquals. Then 
I  looked to official druntime and I found function _xopEquals. 
When I add this function to XOmB druntime, nothing changed 
(yielding undefined identifier _xopEquals did you mean function 
_xopEquals? ... funny error)...And second question, is there any 
documentation for druntime? And I don't mean source code ...


Re: GC.BlkAttr.FINALIZE

2014-03-01 Thread Namespace
On Saturday, 1 March 2014 at 01:28:06 UTC, Steven Schveighoffer 
wrote:
On Fri, 28 Feb 2014 18:45:50 -0500, Namespace 
rswhi...@googlemail.com wrote:


We need a precise GC to get struct dtors to work, the 
alternative would be extremely hackish.


Since I expect/fear that such a implementation is not done in 
the next 12 months: what would be the alternative?


Examine the GC code, and figure out a way to hook the 
finalizer. Look for FINALIZE.


Another crude but effective option would be to wrap the struct 
in a class. May not actually be that bad, depending on the size 
of the struct (blocks come in chunks of 16, 32, 64, etc.).


-Steve


I tried to enable the printf's in rt/lifetime.d (e.g.: 
https://github.com/D-Programming-Language/druntime/blob/e47a00bff935c3f079bb567a6ec97663ba384487/src/rt/lifetime.d#L1125) 
to see what happens if I/the GC delete an array. But I see no 
output, no matter what I try to allocate/deallocate.


What does to!someEnum(string) lower to? Comparing speed to someEnum[string] AA lookups

2014-03-01 Thread JR
In my pet project I'm casting a lot of strings to named enum 
members.


enum Animal { Gorilla, Shark, Alien, Rambo, Dolphin }
auto foo = Dolphin;
auto fooAsEnum = foo.to!Animal;

While micro-optimizing because it's fun, I see that it's much 
faster (by some factor of 3.5x) to do such casts as associative 
array lookups rather than by using std.conv.to as above. As in, 
populate an Animal[string] array with all enum members indexed by 
the strings of their names, allowing you to get the Animal you 
want via animalAA[foo] or (foo in animalAA).


In comparison, what code is generated from the foo.to!Animal 
cast? A big final switch? A long if-else-if-else chain?


http://dpaste.dzfl.pl/7e700a1053c0

(Can the compiler not generate such code instead?)


Re: What does to!someEnum(string) lower to? Comparing speed to someEnum[string] AA lookups

2014-03-01 Thread Adam D. Ruppe
enum to string uses a switch if possible (src/phobos/std/conv.d 
line 844)


I think the code that does string to enum is on line 2194, which 
is a foreach { if {} } loop that never breaks; it always checks 
all of them.


Re: Nobody understands templates?

2014-03-01 Thread Steve Teale

On Friday, 28 February 2014 at 19:06:26 UTC, Dicebot wrote:

On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
Is this typical - libraries use templates, applications don't, 
or

am I just being unimaginative?

Steve




Also every time you catch yourself doing any sort of 
copy-paste, it is quite possible that it can be replaced by 
mixin / template mixin instead. Application that are built in 
more declarative way benefit more from such tool set than 
traditional imperative ones.


In have a couple of case that always require me to find some 
other instance of it, and then copy/paste, But then I need to 
edit the pasted code anyway because in any particular case it 
needs to deal with different command info, so how can mixins help 
me? I have already dealt with the yada-yada cases by 
old-fashioned OOP.


From the various answers to this question I have concluded that I 
should not worry about it. If there's a need for a template I 
think I am already recognizing it.


Thanks!all()
Steve


Re: How to return range constructs?

2014-03-01 Thread Robin

Hiho,

@anonimous:
Thank you for that hint with rdmd, I was already wondering what 
that was.


@Mike Parker:
Thank you very much for clearing that up for me. I really needed 
such a clear answer about this topic. So D language is highly 
advanced in meta programming and I should really begin to use it. 
=)


Robin


Re: Template error on compiling ...

2014-03-01 Thread Robin

Hiho,

thank you for your responses.
This D language meta programming sounds funny and strange to
someone who has never really worked with something like this but
I understand its importance and will look more into working with
it. =)

Robin


Re: Colons and brackets

2014-03-01 Thread Etienne

On 2014-02-28 7:53 AM, anonymous wrote:

nope


nope?


Re: Colons and brackets

2014-03-01 Thread Etienne

On 2014-03-01 4:14 PM, Etienne wrote:

On 2014-02-28 7:53 AM, anonymous wrote:

nope


nope?


Can someone refute this anonymous nope?


Re: Colons and brackets

2014-03-01 Thread anonymous

On Saturday, 1 March 2014 at 21:14:53 UTC, Etienne wrote:

On 2014-02-28 7:53 AM, anonymous wrote:

nope


nope?


yep ;)

The nope was directed at this statement specifically:

On Friday, 28 February 2014 at 04:31:03 UTC, evilrat wrote:

add version(all): after code where specific version ends.


I.e. version(all): doesn't cancel a former version(foo):.
There may or may not be a way to cancel a version(foo):. I
can't think of anything. Also, I don't see the problem with
brackets.


Re: Nobody understands templates?

2014-03-01 Thread woh
 You probably don't have a good understanding of templates if you 
have only used 2 in your entire codebase.  Or you are talking 
about a very tiny codebase.




n Saturday, 1 March 2014 at 18:00:21 UTC, Steve Teale wrote:

On Friday, 28 February 2014 at 19:06:26 UTC, Dicebot wrote:

On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
Is this typical - libraries use templates, applications 
don't, or

am I just being unimaginative?

Steve




Also every time you catch yourself doing any sort of 
copy-paste, it is quite possible that it can be replaced by 
mixin / template mixin instead. Application that are built in 
more declarative way benefit more from such tool set than 
traditional imperative ones.


In have a couple of case that always require me to find some 
other instance of it, and then copy/paste, But then I need to 
edit the pasted code anyway because in any particular case it 
needs to deal with different command info, so how can mixins 
help me? I have already dealt with the yada-yada cases by 
old-fashioned OOP.


From the various answers to this question I have concluded that 
I should not worry about it. If there's a need for a template I 
think I am already recognizing it.


Thanks!all()
Steve




Re: D tools build problem

2014-03-01 Thread Martin Nowak
On Tuesday, 11 February 2014 at 23:06:27 UTC, Joseph Rushton 
Wakeling wrote:
With these flags in place, the following error message is 
produced:


(../dmd/src/dmd -m64 -I../druntime/import -I../phobos
-L-L../phobos/generated/linux/release/64  -w -v 
-ofgenerated/linux/64/dget
generated/linux/64/dget.o 2/dev/null | grep '\-Xlinker' | cut 
-f2- -d' ' ; echo

-lcurl  ) | xargs gcc


What are the actual gcc arguments?
For me running

../dmd/src/dmd -m64 -I../druntime/import -I../phobos 
-L-L../phobos/generated/linux/release/64  -w -v 
-ofgenerated/linux/64/dget generated/linux/64/dget.o 2/dev/null 
| grep '\-Xlinker'


prints

gcc generated/linux/64/dget.o -o generated/linux/64/dget -m64 
-L../phobos/generated/linux/release/64 -L/usr/lib64 -Xlinker 
--export-dynamic -l:libphobos2.a -lpthread -lm -lrt.


Also check wheter the dget.o object has a D main.

nm generated/linux/64/changed.o | grep _Dmain

 T _Dmain


Re: D tools build problem

2014-03-01 Thread Joseph Rushton Wakeling

On 02/03/14 00:07, Joseph Rushton Wakeling wrote:

config/etc/dmd.conf


This is interesting.  My system doesn't have an /etc/dmd.conf file: I always 
place dmd.conf in the same directory as the dmd binary.


Could it be that people not seeing my linker errors are doing so because the 
tools build is picking up on flags in an /etc/dmd.conf introduced with an 
earlier install?




Re: Colons and brackets

2014-03-01 Thread evilrat

On Saturday, 1 March 2014 at 21:42:56 UTC, anonymous wrote:

On Saturday, 1 March 2014 at 21:14:53 UTC, Etienne wrote:

On 2014-02-28 7:53 AM, anonymous wrote:

nope


nope?


yep ;)

The nope was directed at this statement specifically:

On Friday, 28 February 2014 at 04:31:03 UTC, evilrat wrote:

add version(all): after code where specific version ends.


I.e. version(all): doesn't cancel a former version(foo):.
There may or may not be a way to cancel a version(foo):. I
can't think of anything. Also, I don't see the problem with
brackets.


of course it doesn't cancel it. it just re-enables code after 
descending version operator. versions can only be enabled via 
compiler args or CTFE.


Re: Colons and brackets

2014-03-01 Thread evilrat

On Sunday, 2 March 2014 at 05:23:21 UTC, evilrat wrote:

On Saturday, 1 March 2014 at 21:42:56 UTC, anonymous wrote:

On Saturday, 1 March 2014 at 21:14:53 UTC, Etienne wrote:

On 2014-02-28 7:53 AM, anonymous wrote:

nope


nope?


yep ;)

The nope was directed at this statement specifically:

On Friday, 28 February 2014 at 04:31:03 UTC, evilrat wrote:

add version(all): after code where specific version ends.


I.e. version(all): doesn't cancel a former version(foo):.
There may or may not be a way to cancel a version(foo):. I
can't think of anything. Also, I don't see the problem with
brackets.


of course it doesn't cancel it. it just re-enables code after 
descending version operator. versions can only be enabled via 
compiler args or CTFE.


oh. sorry, i remembere i have same problems with version:, back 
then i switched to brackets.


Re: Nobody understands templates?

2014-03-01 Thread Steve Teale

On Saturday, 1 March 2014 at 22:16:54 UTC, woh wrote:
 You probably don't have a good understanding of templates if 
you have only used 2 in your entire codebase.  Or you are 
talking about a very tiny codebase.


That's just what us template-blind people want to hear - 
confirmation that we are in fact stupid.


The project I'm talking about is about 3 loc excluding blank 
lines and comments.


What I'd like to see is a tool, or a switch on the compiler that 
emits the code generated by templates. We - the template-blind -  
would have it sussed in a heartbeat then.


Steve