Re: Small or big dub packages

2018-11-02 Thread Igor via Digitalmars-d-learn
On Thursday, 1 November 2018 at 14:07:37 UTC, Guillaume Piolat 
wrote:

On Monday, 29 October 2018 at 11:31:55 UTC, Igor wrote:
The way I see it the advantage of smaller packages is that 
users can pick and choose and and only have the code they 
really need in their project, but the con could become 
managing a lot of dependencies. Also I am not sure how compile 
time on clean project and previously compiled project would be 
affected.


Pros:
  Users can pick exactly what they need.
  Encourages decoupling instead of too much cohesion.
  Less code to build and maintain.
  Less chances of breakage on upgrade since you depend on less.
  Improve build time since only modified sub-packages get 
rebuilt.

  Good for the ecosystem.

Cons:
  More link-time operations when not using --combined, each 
sub-package is compiled at once. Too much sub-package can slow 
down builds.
  Possibly hitting more DUB edge cases (less the case since DUB 
has tests)
  Directory layout may need to change for proper VisualD 
support.
  On the DUB registry, sub-packages are less popular than "big" 
packages because less discoverable and for some reasons some 
people won't just pick a sub-package when there is a toplevel 
package.


Thanks for the list Guillaume.

I don't think subpackages are a good choice for what I have in 
mind. For example there is a number of packages in repository 
that offer image loading and saving to multiple formats, but what 
I am looking for is the most simple PNG reader that just supports 
the most common formats, no indexed or interlaced, but is 
extensible and in case I do get to need those I can just add 
dependency to PngIndexed and PngInterlaced packages and get 
support for those too. After that I might need to also use PNG 
writer which would be a separate package. Subpackage in this 
scenario (and in my mind) would only make sense for some common 
code that these packages would share.


Of course it could be that I don't fully understand 
subpackages... What do you think about above scenario? Are there 
any points you would add or change regarding it specifically?


Re: how do I activate contracts for phobos functions in dmd

2018-11-02 Thread Richard Palme via Digitalmars-d-learn

On Friday, 2 November 2018 at 16:41:32 UTC, Stefan Koch wrote:

Which phobos functions are used in dmd?
there _should_ be none!


I think I didn't phrase the title correctly:

I'm using dmd as compiler and want to activate the contracts of 
phobos functions. For example there's a phobos function 
std.bitmanip.opIndex implemented like this:


bool opIndex(size_t i) const @nogc pure nothrow
in {
assert(i < _len);
}
do {
return cast(bool) bt(_ptr, i);
}

and when I call this function from my code I want the pre 
contract to be checked (assert(i < _len)


Re: how do I activate contracts for phobos functions in dmd

2018-11-02 Thread Stefan Koch via Digitalmars-d-learn

On Friday, 2 November 2018 at 14:10:35 UTC, Richard Palme wrote:

My guess is that I have to build phobos with:

$make -f posix.mak BUILD=debug

but then what do I do next? I'm using Linux and I built 
dmd+phobos manually by following this guide: 
https://wiki.dlang.org/Building_under_Posix


Which phobos functions are used in dmd?
there _should_ be none!


how do I activate contracts for phobos functions in dmd

2018-11-02 Thread Richard Palme via Digitalmars-d-learn

My guess is that I have to build phobos with:

$make -f posix.mak BUILD=debug

but then what do I do next? I'm using Linux and I built 
dmd+phobos manually by following this guide: 
https://wiki.dlang.org/Building_under_Posix


Re: Building GUI projects with D

2018-11-02 Thread aberba via Digitalmars-d-learn

On Saturday, 20 October 2018 at 15:40:07 UTC, karis njiru wrote:
Hi. Am a computer science student from Kenya and decided to use 
D for my class project on Principles of Programming Languages. 
Am having a lot of fun with D but have come across an issue. I 
have been using Visual D for the past 2 months for my coding 
but after a lot of research i found out that i cannot build GUI 
projects with visual D. So i took on Entice Designer which for 
the past week has been a nightmare for me to compile my code 
error being the system cannot find the path in the command 
prompt specified. I have installed DMD and DFL lots of times 
but there is still the same issue. Please help


Hi, Nice meeting you. I assume your on Window.


There

1. DlangUI which is the easiest (for beginners) in my experience: 
https://github.com/buggins/dlangui


2. QT (great documentation): 
https://forum.dlang.org/thread/leviwswvvcnqberaf...@forum.dlang.org#post-nk9alu:241tvq:241:40digitalmars.com


3. GTK-d would be what you'll use if on Linux:
https://github.com/gtkd-developers/GtkD/wiki/Installing-on-Windows



By the way, I'm from Ghana. Its good to know someone in Kenya is 
interested in D. You may hit me by email karabutawo...@gmail.com 
(Github: https://github.com/aberba)




Re: Dealing with raw types as attributes

2018-11-02 Thread Kagamin via Digitalmars-d-learn
On Thursday, 1 November 2018 at 16:14:45 UTC, Neia Neutuladh 
wrote:
The spec says that a user-defined attribute must be an 
expression, but DMD accepts a wide range of things as UDAs:


  struct Foo { string name = "unknown"; }
  @Foo int bar;


IIRC symbol reference is a primary expression.