[Issue 17713] Template 'this' parameters for static methods

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17713

Timoses  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=14191

--


[Issue 14191] Failure to locate overload with template this parameter

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14191

Timoses  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=17713

--


[Issue 17714] Function template - this T for static methods

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17714

--- Comment #2 from Timoses  ---
(In reply to Steven Schveighoffer from comment #1)
> Huh, I think separately Timon Gehr added an almost identical issue right
> before you :)
> 
> *** This issue has been marked as a duplicate of issue 17713 ***

That's quite a coincidence : D.

Forum post discussion:
https://forum.dlang.org/post/tkrtxyvjknolkynzd...@forum.dlang.org

--


Re: How do you use D?

2017-08-03 Thread Neia Neutuladh via Digitalmars-d

On Friday, 28 July 2017 at 14:58:01 UTC, Ali wrote:

How do you use D?


I use D for pretty much everything in my personal life at the 
moment. I've found some things that I thought were better in 
other languages, but either D's ecosystem has improved (which is 
why I'm rewriting my RSS reader from C# to D -- when I wrote it, 
vibe.d wasn't a thing) or I was proven false (scraping websites 
in Python led to a ton of inscrutable encoding errors; 
implementing a parser in C# was about 900 times slower than the D 
version until I wrote my own UTF8 string struct and made some 
other optimizations, at which point it was merely 3.5 times 
slower).


By count, most of what I'm using it for is small scripts for 
simple simulations. Recurrences that I can't solve mentally in a 
reasonable amount of time, so I need a program for it. In ages 
past, I'd use Python, since it tends to be convenient. However, 
while it's a bit more convenient than D, type safety is worth a 
lot.


I tend not to finish projects, but the ones I've worked on in the 
past week or strongly intend to get back to are:


* An init system (mainly for learning).
* A procedural generator for a witch's spellbook [1]
* A rewrite of my RSS reader (70% complete)
* A MUD involving procedurally generated sky islands

As for the mechanism by which I use D: I've mainly stuck to vim. 
I've tried out vscode plus code-d, but that doesn't work for me. 
And in the past, I've used Eclipse plugins for D. Vim, NERDTree, 
and tmux make for a good editing experience -- it's what I use 
for Java at work.



Did you introduce D to your work place?


I used D to write a tool to extract and update vbulletin 
templates from a directory of templates. This meant we could 
store things in source control. (Vbulletin stores templates in 
its database. This makes their hosted solution much better, I'm 
sure. It makes my life more annoying.)


Unfortunately, I was the only one who preferred source control 
rather than editing live.



[1] Sample spellbook, only one spell (it needs some work):

The Book of Vile Darkness
a witch's guide to necromancy with friends

2 <  )4 ,$ " 3  4  96, a spell to banish spirits

You will need:
 * graveyard soil
 * bronze mirror

reduce graveyard soil to a paste
boil paste, bronze mirror in a size 6 cauldron
mix paste thoroughly


GtkD custom theme on Windows

2017-08-03 Thread Andres Clari via Digitalmars-d-learn
I've made a linux program with GtkD, and so far, it's been pretty 
awesome, however I'm thinking about porting it to Windows also, 
but the Adwaita theme is too fugly, and cringy, so I'd want to 
use a compatible theme, which is supposed to be doable.


What would be the way to go to make a GtkD app use a custom GTK 
theme in Windows?
I tried this in the past, but never succeeded following 
documentation found online.




Re: OT: What causes the Segfault in the following?

2017-08-03 Thread Andrew Edwards via Digitalmars-d-learn

Steven Schveighoffer wrote:

On 8/3/17 10:14 PM, Andrew Edwards wrote:


I certainly can, but the problem is completely in C, I'm not having
any problems in D. In this case, I've simply copied the two functions
to test.c and inserted main().


Oh. Then Ali is correct. I assumed that char *s was initialized to null
because it was D, and maybe you were passing s by reference incorrectly.
But actually, you are in c, so s can point anywhere.

Yeah, you need to declare an array instead of just a pointer.

char s[20] should work.

-Steve


Much appreciated.


Re: OT: What causes the Segfault in the following?

2017-08-03 Thread Andrew Edwards via Digitalmars-d-learn

Ali Çehreli wrote:

On 08/03/2017 06:02 PM, Andrew Edwards wrote:


char *s;


That's an uninitialized C string.


OK, I was is indeed the problem. I was thinking for some reason that s 
gets initialized inside nk_color_hex_rgb() but it's expecting to an 
array to work with. I actually noticed that couldn't, for the life of 
me, associate it to the cause of the resulting issue.





nk_color_hex_rgb(s, str);


That function is expecting it to have at least 7 chars when doing things
like

output[1] = (char)NK_TO_HEX((col.r & 0x0F));

So you have to have a proper pointer to the first element of an array to
pass to nk_color_hex_rgb. The following may work but you shouldn't be
needing to use magic constants like 7:
char[7] s;
nk_color_hex_rgb(s.ptr, str);
// ...
printf("%s\n", s.ptr);


got you... this makes sense, but I'm doing it differently in D. See my 
response to Steven. I was only experiencing this issue in C.



There's probably the proper C macro that defines it so that you can do

  char[BLAH_LENGTH] s:

Ali



Much appreciated.


Re: OT: What causes the Segfault in the following?

2017-08-03 Thread Andrew Edwards via Digitalmars-d-learn

Ali Çehreli wrote:

On 08/03/2017 06:02 PM, Andrew Edwards wrote:


char *s;


That's an uninitialized C string.


OK, I was is indeed the problem. I was thinking for some reason that s 
gets initialized inside nk_color_hex_rgb() but it's expecting to an 
array to work with. I actually noticed that couldn't, for the life of 
me, associate it to the cause of the resulting issue.





nk_color_hex_rgb(s, str);


That function is expecting it to have at least 7 chars when doing things
like

output[1] = (char)NK_TO_HEX((col.r & 0x0F));

So you have to have a proper pointer to the first element of an array to
pass to nk_color_hex_rgb. The following may work but you shouldn't be
needing to use magic constants like 7:
char[7] s;
nk_color_hex_rgb(s.ptr, str);
// ...
printf("%s\n", s.ptr);

There's probably the proper C macro that defines it so that you can do

  char[BLAH_LENGTH] s:

Ali





Re: OT: What causes the Segfault in the following?

2017-08-03 Thread Steven Schveighoffer via Digitalmars-d-learn

On 8/3/17 10:14 PM, Andrew Edwards wrote:

Steven Schveighoffer wrote:

On 8/3/17 9:12 PM, Andrew Edwards wrote:

Andrew Edwards wrote:

Just in case... here are the two functions being called in main():

https://github.com/vurtun/nuklear/blob/master/nuklear.h#L5695-L5722


Can you show how you declared these in D? It's important. I think what's
happening is that the nk_color_hex_rgb is incorrectly defined. I think
you should *always* get segfault, with or without any of those arrays.



I certainly can, but the problem is completely in C, I'm not having any 
problems in D. In this case, I've simply copied the two functions to 
test.c and inserted main().


Oh. Then Ali is correct. I assumed that char *s was initialized to null 
because it was D, and maybe you were passing s by reference incorrectly. 
But actually, you are in c, so s can point anywhere.


Yeah, you need to declare an array instead of just a pointer.

char s[20] should work.

-Steve


Re: OT: What causes the Segfault in the following?

2017-08-03 Thread Andrew Edwards via Digitalmars-d-learn

Steven Schveighoffer wrote:

On 8/3/17 9:12 PM, Andrew Edwards wrote:

Andrew Edwards wrote:

Just in case... here are the two functions being called in main():

https://github.com/vurtun/nuklear/blob/master/nuklear.h#L5695-L5722


Can you show how you declared these in D? It's important. I think what's
happening is that the nk_color_hex_rgb is incorrectly defined. I think
you should *always* get segfault, with or without any of those arrays.

-Steve


I certainly can, but the problem is completely in C, I'm not having any 
problems in D. In this case, I've simply copied the two functions to 
test.c and inserted main(). Here are my implementations though:


nk_color nk_rgb_hex(string rgb)
{
if (rgb[0] == '#') rgb = rgb[1..$];
return nk_color(cast(nk_byte)nk_parse_hex(rgb[0 .. 2]),
cast(nk_byte)nk_parse_hex(rgb[2 .. 4]),
cast(nk_byte)nk_parse_hex(rgb[4 .. $]), 255);
}

private void nk_color_hex_impl(int n)(out char[] output, nk_color col)
{
output.reserve(n);
alias NK_TO_HEX = (i) => i <= 9 ? '0' + i : 'A' - 10 + i;
foreach(color; col.tupleof) {
output ~= to!char(NK_TO_HEX((color & 0xF0) >> 4));
output ~= to!char(NK_TO_HEX(color & 0x0F));
}
}

void nk_color_hex_rgba(out char[] output, nk_color col)
{
nk_color_hex_impl!8(output, col);
}

void nk_color_hex_rgb(out char[] output, nk_color col)
{
 nk_color_hex_impl!6(output, col);
}

Not to happy with nk_color_hex_impl and family yet because I'm convinced 
there is a better way but for now that's what I've got.


Re: Fix gtkD api display

2017-08-03 Thread Johnson Jones via Digitalmars-d-learn

Also, interfaces are not linkable.

e.g., for gtk.ApplicationWindow, it inherits from gtk.Window but 
I have to go back to the packages and scroll down to find 
gtk.Window to see it's properties and methods. Would be nice if I 
could just click on the gtk.Window and it jump me to it.


https://api.gtkd.org/gtkd/gtk/ApplicationWindow.html

class ApplicationWindow : gtk.Window.Window, 
gio.ActionGroupIF.ActionGroupIF, gio.ActionMapIF.ActionMapIF;


since the hierarchy is gtk/Window/Window, click on gtk should 
take one to the gtk package, the first Window should take one to 
gtk.Window and the second should take one to gtk.Window.Window




Fix gtkD api display

2017-08-03 Thread Johnson Jones via Digitalmars-d-learn

https://api.gtkd.org

It is difficult to navigate.

1. clicking the documentation on the main site takes it to the 
gtk.AboutDialog api. That is all it shows, I was confused at 
first, as I'm sure most people would be.


2. The packages list lists all the packages, but all the sub 
elements are expanded, making it time consuming to hunt down 
anything specific. Initially collapsing them and adding a search 
box would be nice.


3. When clicking on any packages it reloads the page and shows 
only the package in the first tab. This requires one to then go 
back to packages and hunt for something else again. Because the 
position of the scroll is not saved, one has to scroll down 
through the entire list.


It would be better, I think, if it was one single tab all in a 
single hierarchy that never reloaded the page so that it is 
easier to navigate quickly.


e.g.,

instead of

Package
atk
  atk.ActionIF
  atk.Action
  ...

we have

atk
  atk.ActionIF
 GetActionStruct
 GetStruct
 ...
  atk.Action
 ...
...


and so effectually combining both tabs. It should solve the 
issues that the current way has without really causing any 
problems. Everything should be collapsed by default and since no 
reloading of the page should occur(which might require having the 
api descriptions in a separate frame that is loaded separately on 
package changes to avoid reloading the tree view which will 
recollapse everything).


It will make navigating the gtkD api much more fun ;)




Re: OT: What causes the Segfault in the following?

2017-08-03 Thread Steven Schveighoffer via Digitalmars-d-learn

On 8/3/17 9:12 PM, Andrew Edwards wrote:

Andrew Edwards wrote:

int main()
{
//int wierd[4];
struct nk_color str = nk_rgba_hex("#deadbeef");
//int wierd[4];
char *s;
//int wierd[4];
nk_color_hex_rgb(s, str);
//int wierd[4];
printf("(%d,%d,%d)\n",str.r, str.g, str.b);
//int wierd[4];
printf("%s\n", s);
//int wierd[4];
return 0;
}

The above produces as its output:

(222,173,190)
DEADBE

but if I introduce an int array on any of the commented lines, it
results in a runtime Segmentation fault: 11. Basically I'm just trying
to port Nuklear[1] to D as a first project after reading Ali and Mike's
awesome books. Moving one function at a time to an independent C file,
compiling it to observe the result and then from the understanding
gained, re-implementing it in D. The int array here is introduced to
prepare for port of the next function and has nothing to do with the
current content of main(), but I'm completely confused because I don't
see anything wrong with the code that is causing the error.

By the way, the program responds differently based on the type of the
array:

double => Bus error: 10
char => no error
short => Segmentation fault: 11
long => Bus error: 10

Obviously I'm missing something... please enlighten me.

Thanks,
Andrew

[1] Yes, I know there is already a port and bindings available... this
is purely for learning. My goal is actually to port imgui for a project
I committed myself to at DConf2017 but in the process of doing so, I
realized how woefully inadequate my knowledge of programming is. This is
my attempt at rectifying the situation.


Just in case... here are the two functions being called in main():

https://github.com/vurtun/nuklear/blob/master/nuklear.h#L5695-L5722


Can you show how you declared these in D? It's important. I think what's 
happening is that the nk_color_hex_rgb is incorrectly defined. I think 
you should *always* get segfault, with or without any of those arrays.


-Steve


Re: OT: What causes the Segfault in the following?

2017-08-03 Thread Ali Çehreli via Digitalmars-d-learn

On 08/03/2017 06:02 PM, Andrew Edwards wrote:

> char *s;

That's an uninitialized C string.

> nk_color_hex_rgb(s, str);

That function is expecting it to have at least 7 chars when doing things 
like


output[1] = (char)NK_TO_HEX((col.r & 0x0F));

So you have to have a proper pointer to the first element of an array to 
pass to nk_color_hex_rgb. The following may work but you shouldn't be 
needing to use magic constants like 7:

char[7] s;
nk_color_hex_rgb(s.ptr, str);
// ...
printf("%s\n", s.ptr);

There's probably the proper C macro that defines it so that you can do

  char[BLAH_LENGTH] s:

Ali



Re: Who maintains the D website?

2017-08-03 Thread Johnson Jones via Digitalmars-d

On Friday, 4 August 2017 at 00:52:34 UTC, captaindet wrote:

On 2017-08-04 12:13, Johnson Jones wrote:
No, sorry. The lead team uses nttp which is old school forum 
technology.
They won't move in to the present and instead insist everyone 
else stay
in the past with them. It's sort of like those guys that drive 
1970's
camaro's because they think it makes them look cool. I'm sure 
it's a

psychological condition but not much can be done about it.


hold your horses!

quite a number of users incl myself prefer nttp. nice as the 
forum web interface is, following a newsgroup with a newsgroup 
reader like eg the thunderbird built-in is way more 
comfortable, you should try it one day. eg: you don't have to 
sign in, can reply immediately, you can customize 
display/behaviour more thoroughly to your liking, and more.


/det


It's not! I've used nntp and it crap. You cannot edit your posts, 
simple as that! You can claim all you want that your method is 
better but it doesn't make it so.  Just based on human nature and 
the fact that you are saying with an ancient archaic system 
suggests it's all based in fear of change. The sad part about 
this is that it forces everyone else to stay in the same broken 
system.


How about this: Dlang.org keeps the old interface like nntp and 
adds a new one. Anyone that wants to continue to use the old one 
can and those that one to use the new one can. In a year we can 
see which one is the most popular and let everyone decide rather 
than a few old crusty goats.


Of course, it won't happen because those in power know the 
outcome. You can see how nntp is dead. There are few nntp servers 
and most of the groups are dead and only those that used in in 
the past still use it. There is not a migration towards nntp but 
away, and that is fact... which suggests that it is not as good 
as its opposition. Hence, if I'm right, and I almost surely 
am(surely you are not going to argue that nntp is becoming more 
popular, are you?) then those that think that nntp is a great 
thing and better than the alternatives have psychological issues 
with change.


You can make a forum that behaves similarly(no login), 
customizable, or whatever else you are saying that you like about 
nntp.


In fact, someone could write a nntp like interface for the forum 
in D just so to please you guys.


I personally have nothing against nntp... while it isn't great it 
does the job EXCEPT editing. I know people claim that editing 
posts causes problems but that is rarely the case and the 
benefits far out weight any negatives.


The reasons not to move forward are the same reasons that plague 
humans in many other areas and it is all 
psychological/evolutionary reasons rather than based on logic and 
facts. Familiarity is a prime factor. Many humans, specially 
older ones, fear change because it is unfamiliar and unknown. 
Those factors are the same that are at play here and it is 
unfortunate because I imagine there would be a lot more younger 
users that have the motivation to help D gain traction that do 
not participate because they feel like it is a step backwards 
rather than forwards.



One day all the old fogies will die and nntp will be gone.. and 
some young kid interested in D will start a modern D forum and 
maybe D will get back on track.


Think of it this way: D claims to be this sort of futuristic 
compiler(it can do thinks "light years" ahead of most other 
compilers...) yet it uses communications methods that are 50 
years old. That's a bit contradictory. It's like a young pretty 
woman who dresses like a skank and wears so much make up that it 
makes her look 20 years older than what she is. While she might 
think she looks good, the people that actually look at her think 
otherwise. This is sorta what happens with D. It's amazing in 
some ways but has so much baggage in so many areas that many 
people are not going to waste their time. The D community can be 
delusional all they want, but it just works against them instead 
of allowing D to really shine.












Re: OT: What causes the Segfault in the following?

2017-08-03 Thread Andrew Edwards via Digitalmars-d-learn

Andrew Edwards wrote:

int main()
{
//int wierd[4];
struct nk_color str = nk_rgba_hex("#deadbeef");
//int wierd[4];
char *s;
//int wierd[4];
nk_color_hex_rgb(s, str);
//int wierd[4];
printf("(%d,%d,%d)\n",str.r, str.g, str.b);
//int wierd[4];
printf("%s\n", s);
//int wierd[4];
return 0;
}

The above produces as its output:

(222,173,190)
DEADBE

but if I introduce an int array on any of the commented lines, it
results in a runtime Segmentation fault: 11. Basically I'm just trying
to port Nuklear[1] to D as a first project after reading Ali and Mike's
awesome books. Moving one function at a time to an independent C file,
compiling it to observe the result and then from the understanding
gained, re-implementing it in D. The int array here is introduced to
prepare for port of the next function and has nothing to do with the
current content of main(), but I'm completely confused because I don't
see anything wrong with the code that is causing the error.

By the way, the program responds differently based on the type of the
array:

double => Bus error: 10
char => no error
short => Segmentation fault: 11
long => Bus error: 10

Obviously I'm missing something... please enlighten me.

Thanks,
Andrew

[1] Yes, I know there is already a port and bindings available... this
is purely for learning. My goal is actually to port imgui for a project
I committed myself to at DConf2017 but in the process of doing so, I
realized how woefully inadequate my knowledge of programming is. This is
my attempt at rectifying the situation.


Just in case... here are the two functions being called in main():

https://github.com/vurtun/nuklear/blob/master/nuklear.h#L5695-L5722


OT: What causes the Segfault in the following?

2017-08-03 Thread Andrew Edwards via Digitalmars-d-learn

int main()
{
//int wierd[4];
struct nk_color str = nk_rgba_hex("#deadbeef");
//int wierd[4];
char *s;
//int wierd[4];
nk_color_hex_rgb(s, str);
//int wierd[4];
printf("(%d,%d,%d)\n",str.r, str.g, str.b);
//int wierd[4];
printf("%s\n", s);
//int wierd[4];
return 0;
}

The above produces as its output:

(222,173,190)
DEADBE

but if I introduce an int array on any of the commented lines, it 
results in a runtime Segmentation fault: 11. Basically I'm just trying 
to port Nuklear[1] to D as a first project after reading Ali and Mike's 
awesome books. Moving one function at a time to an independent C file, 
compiling it to observe the result and then from the understanding 
gained, re-implementing it in D. The int array here is introduced to 
prepare for port of the next function and has nothing to do with the 
current content of main(), but I'm completely confused because I don't 
see anything wrong with the code that is causing the error.


By the way, the program responds differently based on the type of the array:

double => Bus error: 10
char => no error
short => Segmentation fault: 11
long => Bus error: 10

Obviously I'm missing something... please enlighten me.

Thanks,
Andrew

[1] Yes, I know there is already a port and bindings available... this 
is purely for learning. My goal is actually to port imgui for a project 
I committed myself to at DConf2017 but in the process of doing so, I 
realized how woefully inadequate my knowledge of programming is. This is 
my attempt at rectifying the situation.


Re: Who maintains the D website?

2017-08-03 Thread captaindet via Digitalmars-d

On 2017-08-04 12:13, Johnson Jones wrote:

No, sorry. The lead team uses nttp which is old school forum technology.
They won't move in to the present and instead insist everyone else stay
in the past with them. It's sort of like those guys that drive 1970's
camaro's because they think it makes them look cool. I'm sure it's a
psychological condition but not much can be done about it.


hold your horses!

quite a number of users incl myself prefer nttp. nice as the forum web 
interface is, following a newsgroup with a newsgroup reader like eg the 
thunderbird built-in is way more comfortable, you should try it one day. 
eg: you don't have to sign in, can reply immediately, you can customize 
display/behaviour more thoroughly to your liking, and more.


/det


Re: [OT] Generative C++

2017-08-03 Thread Timon Gehr via Digitalmars-d

On 04.08.2017 01:26, 12345swordy wrote:




The C++ @nogc implementation would also not be built-in, and whether 
or not the memory allocator in question is built-in has no bearing on 
whether my question was ridiculous or not. (I.e. you are splitting 
hairs.)


I never said anything about a C++ @nogc implementation, that was you 
misreading my post.


Two parties are required for communication.

It was Kagamin who said:

The paper doesn't propose to enforce coding standards to the point you want.


This is in reference to your earlier:


Regardless, what impress me the most is the part where it came be used to 
enforce coding standards at compile time. Which I am trying to look if it's 
possible with d and sadly no luck.

Is it to much to ask for d developers to provide a way to enforce custom coding standards in a similar fashion that @nogc and @safe does? 


Your answer to Kagamin was basically, "yes it does". You implied that 
you want to be able to enforce custom coding standards similar to @nogc 
and @safe, and then you said that the C++ proposal allows it. My 
question was "why?". It would have been perfectly fine at that point for 
you to clarify that that is not in fact what you meant, so next time 
maybe just do that. :)


Which again is ridiculous, as c++ does not have gc 
built in. Apparently you don't understand that.


There is nothing to understand. A GC does not need to be built-in for 
someone to want to control its usage with an attribute.


Re: Who maintains the D website?

2017-08-03 Thread Steven Schveighoffer via Digitalmars-d

On 8/3/17 8:13 PM, Johnson Jones wrote:

On Thursday, 3 August 2017 at 23:28:36 UTC, 12345swordy wrote:

On Thursday, 3 August 2017 at 00:18:38 UTC, Andrej Mitrovic wrote:

Is there a single person who's the main maintainer of the D website..?


If not, I have some ideas on how to improve it. Not just ideas, I'd 
like to give a host at improving it myself, really.


Can we gain the ability to edit our own post? I typically make some 
grammar/spelling mistacks here and there and it would be nice for me 
to fix this.


Haha, did you make this mistack on purpose?



No, sorry. The lead team uses nttp which is old school forum technology. 
They won't move in to the present and instead insist everyone else stay 
in the past with them. It's sort of like those guys that drive 1970's 
camaro's because they think it makes them look cool. I'm sure it's a 
psychological condition but not much can be done about it.
You can take my NNTP support from my cold dead hands. Why should I have 
to give this up?


Some old codgers even use crusty old mailing lists I've heard.

Note, NNTP supports deleting your posts, I've done it before (on this 
site). It would be nice if the forum software detected that as well 
(maybe it does?).


-Steve


Re: Who maintains the D website?

2017-08-03 Thread Johnson Jones via Digitalmars-d

On Thursday, 3 August 2017 at 23:28:36 UTC, 12345swordy wrote:
On Thursday, 3 August 2017 at 00:18:38 UTC, Andrej Mitrovic 
wrote:
Is there a single person who's the main maintainer of the D 
website..?



If not, I have some ideas on how to improve it. Not just 
ideas, I'd like to give a host at improving it myself, really.


Can we gain the ability to edit our own post? I typically make 
some grammar/spelling mistacks here and there and it would be 
nice for me to fix this.


No, sorry. The lead team uses nttp which is old school forum 
technology. They won't move in to the present and instead insist 
everyone else stay in the past with them. It's sort of like those 
guys that drive 1970's camaro's because they think it makes them 
look cool. I'm sure it's a psychological condition but not much 
can be done about it.




Re: [OT] Generative C++

2017-08-03 Thread Stefan Koch via Digitalmars-d

On Thursday, 3 August 2017 at 23:59:01 UTC, jmh530 wrote:

On Thursday, 3 August 2017 at 22:38:08 UTC, Joakim wrote:


30-page long thread from four years ago, enjoy: :D

http://forum.dlang.org/thread/l5otb1$1dhi$1...@digitalmars.com

This post from Walter may summarize his feelings:

http://forum.dlang.org/post/l6co6u$vo$1...@digitalmars.com


Would it be possible to implement @safe/@nogc/pure/nothrow with 
AST macros?


Nope :)

It's doable with good introspection but local ast-node rewriting 
will not help.

Execpt if you can rewrite the macro itself.

But I'd strongly discourage such a solution.


Re: [OT] Generative C++

2017-08-03 Thread jmh530 via Digitalmars-d

On Thursday, 3 August 2017 at 22:38:08 UTC, Joakim wrote:


30-page long thread from four years ago, enjoy: :D

http://forum.dlang.org/thread/l5otb1$1dhi$1...@digitalmars.com

This post from Walter may summarize his feelings:

http://forum.dlang.org/post/l6co6u$vo$1...@digitalmars.com


Would it be possible to implement @safe/@nogc/pure/nothrow with 
AST macros?


Re: Who maintains the D website?

2017-08-03 Thread 12345swordy via Digitalmars-d

On Thursday, 3 August 2017 at 00:18:38 UTC, Andrej Mitrovic wrote:
Is there a single person who's the main maintainer of the D 
website..?



If not, I have some ideas on how to improve it. Not just ideas, 
I'd like to give a host at improving it myself, really.


Can we gain the ability to edit our own post? I typically make 
some grammar/spelling mistacks here and there and it would be 
nice for me to fix this.


Re: [OT] Generative C++

2017-08-03 Thread 12345swordy via Digitalmars-d

On Thursday, 3 August 2017 at 20:56:38 UTC, Timon Gehr wrote:

On 03.08.2017 22:06, 12345swordy wrote:

On Thursday, 3 August 2017 at 19:45:12 UTC, Timon Gehr wrote:

On 03.08.2017 21:28, 12345swordy wrote:

On Thursday, 3 August 2017 at 19:02:17 UTC, Timon Gehr wrote:

On 03.08.2017 20:32, 12345swordy wrote:

[...]


On 02.08.2017 15:50, 12345swordy wrote:

[...]


How would you use the proposed features to implement @safe 
or @nogc within C++?


I am not interested in arguing about what I said or I didn't 
said.


I don't understand the relevance of this sentence.

Regardless what you asking is ridiculous, as 1.) there is no 
gc exist in c++ in the first place

https://en.wikipedia.org/wiki/Boehm_garbage_collector

2.)it's still a concept at this point of time which may be 
rejected in the future.


How does that make my question ridiculous?

You are splinting hairs here.


That's a quite poetic way to describe the futility of my 
endeavor to engage you in a productive discussion. Also see 
http://medical-dictionary.thefreedictionary.com/splinting . [1]


Not my problem if you don't like my answer. If you going to 
dispute my usage of the phrase "splinting hairs" by post a link 
to the said phrase and not actually point of the error of it then 
don't be surprised that if I dismiss it.


The gc that you linked is a third party library, that is not 
the same as having it built into the language itself.


The C++ @nogc implementation would also not be built-in, and 
whether or not the memory allocator in question is built-in has 
no bearing on whether my question was ridiculous or not. (I.e. 
you are splitting hairs.)


I never said anything about a C++ @nogc implementation, that was 
you misreading my post. Which again is ridiculous, as c++ does 
not have gc built in. Apparently you don't understand that.



Clear difference.


Clear, yet irrelevant.

Nope very relevant. Otherwise by that logic then c++03 have 
variadic templates by using the boost tuple library.


BTW: If you are not interested in actually discussing the 
applicability of the proposal to enforcing coding standards to 
the point you outlined (@safe and @nogc), we can stop at any 
time. I was just curious how you would achieve this.



It quite understandable that you misunderstood my post that I had 
wrote.





Re: [OT] Generative C++

2017-08-03 Thread Joakim via Digitalmars-d

On Thursday, 3 August 2017 at 22:17:57 UTC, Yuxuan Shui wrote:

On Tuesday, 1 August 2017 at 22:06:28 UTC, Walter Bright wrote:

On 7/31/2017 5:41 AM, Joakim wrote:
If he's right that C++ use is so balkanized, this will 
simplify some code but further balkanize the language.  That 
might be worth it for them, but rather than simplifying the 
language, it makes it more powerful and more complex, heading 
higher up into the hills rather than the lower ground he 
claims to be heading for.


I can't say I understand the proposal, but if it is similar to 
AST macros, my argument against that is well known and similar 
to yours.


Can you give us a pointer to your arguments? Some of us (me) 
are not familiar with them.


Thanks!


30-page long thread from four years ago, enjoy: :D

http://forum.dlang.org/thread/l5otb1$1dhi$1...@digitalmars.com

This post from Walter may summarize his feelings:

http://forum.dlang.org/post/l6co6u$vo$1...@digitalmars.com


Re: [OT] Generative C++

2017-08-03 Thread Yuxuan Shui via Digitalmars-d

On Tuesday, 1 August 2017 at 22:06:28 UTC, Walter Bright wrote:

On 7/31/2017 5:41 AM, Joakim wrote:
If he's right that C++ use is so balkanized, this will 
simplify some code but further balkanize the language.  That 
might be worth it for them, but rather than simplifying the 
language, it makes it more powerful and more complex, heading 
higher up into the hills rather than the lower ground he 
claims to be heading for.


I can't say I understand the proposal, but if it is similar to 
AST macros, my argument against that is well known and similar 
to yours.


Can you give us a pointer to your arguments? Some of us (me) are 
not familiar with them.


Thanks!


Re: D books for $5

2017-08-03 Thread Michael via Digitalmars-d-announce

On Friday, 16 December 2016 at 05:43:02 UTC, Kai Nacke wrote:

Hi all,

Packt Publishing offers eBooks for $5 for a limited time. If 
your collection of D eBooks is still incomplete then this is a 
great chance for you. :-)


D Cookbook by Adam D. Ruppe 
(https://www.packtpub.com/application-development/d-cookbook)
Learning D by Michael Parker 
(https://www.packtpub.com/application-development/learning-d)
D Web Development by myself 
(https://www.packtpub.com/web-development/d-web-development)


Regards,
Kai


Any chance the print books are going on sale? I buy too many 
books as a student but would love to learn web dev in D.


Re: Why free and realloc seem to include .

2017-08-03 Thread Michael via Digitalmars-d-learn

On Thursday, 3 August 2017 at 15:29:29 UTC, Adam D. Ruppe wrote:

On Thursday, 3 August 2017 at 15:18:17 UTC, Michael wrote:
I've not seen that either, though I'm not a C++ programmer. 
Does using free() on its own not assume access of a global 
namespace?


Consider the following:

class Foo {
   void free(void*);

   void other_method() {
  free(ptr); // calls the member function
   }
}


The leading dot in D just ensures it calls the global one 
instead of a member (if present).


So it could be used without, but you risk conflicts with other 
functions. I got it, thanks to both of you.


Re: Bug in gtkd?

2017-08-03 Thread Johnson Jones via Digitalmars-d-learn

On Thursday, 3 August 2017 at 21:00:17 UTC, Mike Wey wrote:

On 03-08-17 22:40, Johnson Jones wrote:
Ok, so, I linked the gtk to the msys gtk that I installed 
before when trying to get glade to work and it worked!


seems that msys is much more up to date than anything else as 
it just works(I need to remember than in the future).


The problem I see is this:

When I get ready to release my app to the public, I can't 
expect them to all have to install msys and build.


msys seems to clump everything together and I don't know what 
files I need to extract to be able to bundle everything 
together.


Any ideas how to solve that problem? At least now I can move 
ahead and actually make some progress on my app.


Would still be nice to get the x86 vs x64 issue resolved so I 
don't have to keep switching between the two for testing 
purposes. Since Visual D was just patched to handle x64 BP's I 
guess I can stay with that for now.




I'll try to build and test some new installers tomorrow that 
will include the loaders.


Thanks. Could you take a look at the loading image thread I 
started when you get time? I can't seem to get an image to load 
even though it seems straight forward.


These are the pixbufs I'm using

mingw32/mingw-w64-i686-gdk-pixbuf2 2.36.6-2 [installed]
An image loading library (mingw-w64)
mingw64/mingw-w64-x86_64-gdk-pixbuf2 2.36.6-2 [installed]
An image loading library (mingw-w64)

in x64 it crashes completely without an exception though... which 
is why I want an easy way to switch between the two 
architectures... since x64 seems to be more unstable than x86 but 
sometimes it's the reverse, and ultimately I'll want to release 
in x64.


Also, do I ever need to rebuild gdk when changing gtk 
installations? Does it ever grab anything from them at compile 
time or is it all at runtime?












Re: gtkD load images

2017-08-03 Thread Johnson Jones via Digitalmars-d-learn

On Thursday, 3 August 2017 at 13:12:03 UTC, Mengu wrote:

On Thursday, 3 August 2017 at 03:59:40 UTC, Johnson Jones wrote:
How can be use gtkD to load images, I assume through 
gdkpixbuf? While I am getting errors loading images through 
glade's image:


(test.exe:8188): Gtk-WARNING **: Could not load 
image 'a.jpg': Couldn't recognize the image file format for 
file 'test\a.jpg'


(loads fine in glade)

which needs to be resolved, I'd also like to be able to use 
gdkpixbuf to load images programmatically. There seems to be 
no demos on the gtkD github page that deals with image loading.


I've tried to do something like

import gtkc.gdkpixbuf;
auto x = c_gdk_pixbuf_get_formats().data;

but I don't know how to interpret x.

Also something like

import gtkc.gdkpixbuf;
void* x;
auto p = c_gdk_pixbuf_get_formats();
for(int i = 0; i < 10; i++)
{   
x = p.data;
p = p.next;
}

which doesn't offer any help.


Aside: How can we call the gtk functions directly using gtkD? 
Seems it uses stuff like


Linker.link(gdk_pixbuf_get_formats, "gdk_pixbuf_get_formats", 
LIBRARY_GDKPIXBUF);


It does seem to alias to these function but something is off 
and I'm not sure what.


hi

- is the gtk.Image class not working for you? 
https://api.gtkd.org/gtkd/gtk/Image.html


- there's also a gdkpixbuf.Pixbuf that you can use. 
https://api.gtkd.org/gtkd/gdkpixbuf/Pixbuf.html


- you can import those functions from gdkpixbuf.c.functions.


So, like I said, I've tried

import gdkpixbuf.Pixbuf;
auto x = Pixbuf.newFromResource("C:\\a.jpg");

which gives me that error I stated before for x86. For x64 it 
simply crashes and no exception is given.


If I use a dummy image I get the same error:

"Unhandled exception: glib.GException.GException The resource at 
“C:\adf.jpg” does not exist at 
generated\gtkd\glib\GException.d(40)"


The error message makes look like like it should be


"Unhandled exception: glib.GException.GException The resource at 
“C:\adf.jpg” does not exist at “C:\” 
generated\gtkd\glib\GException.d(40)"



I'd rather use Pixbuf than image because I don't need to generate 
a full blow image widget.


If I do

GError* err = null;
auto p = gdk_pixbuf_new_from_resource(Str.toStringz("C:\\a.jpg"), 
);


p is null and err is

The resource at “D:\a.jpgâ€. does not exist.

which is clearly not true.

So not sure what is going on ;/ Seems to be a bug in pixbuf or am 
I specifying the path wrong? If gtk.Image uses these internally 
then it is working so...




Re: [OT] Generative C++

2017-08-03 Thread Timon Gehr via Digitalmars-d

On 03.08.2017 22:54, Joakim wrote:

On Thursday, 3 August 2017 at 19:02:17 UTC, Timon Gehr wrote:

On 03.08.2017 20:32, 12345swordy wrote:

On Thursday, 3 August 2017 at 10:43:50 UTC, Kagamin wrote:

On Wednesday, 2 August 2017 at 20:28:38 UTC, 12345swordy wrote:

...No? I was referring to the c++ proposal paper.


The paper doesn't propose to enforce coding standards to the point 
you want. D already does what the paper proposes.

Page 2:

"Enable writing
compiler-enforced
patterns for any purpose:
coding standards
(e.g., many
Core Guidelines
“enforce” rules)
"

Yes, it does, right there. Are you reading the same paper that I am?


On 02.08.2017 15:50, 12345swordy wrote:
  > Is it to much to ask for d developers to provide a way to enforce 
custom

coding standards in a similar fashion that @nogc and @safe does?


How would you use the proposed features to implement @safe or @nogc 
within C++?


I think you misread him.


It's very possible that there has been a misunderstanding, but I think 
then it happened earlier in the thread.


He wants to enforce custom coding standards in 
D similar to how that proposal would allow, and he's comparing it to how 
D does it with attributes for @safe and @nogc, but he's not asking about 
@safe and @nogc specifically.


Presumably, he's wondering if he can apply 
other attributes in D that could be used to enforce coding standards 
similar to the ones that C++ proposal enables.


If this is the case, then the answer is that D has similarly powerful 
compile-time reflection. The C++ proposal additionally has nice syntax 
to invoke the checks and can conveniently rewrite the implementation 
in-place (which is not possible in D in the same way). Another thing the 
C++ proposal has that is not in D is the ability to conveniently 
integrate custom error messages with built-in ones.


Re: Weka.IO in the news... but not mentioning Dlang... why?

2017-08-03 Thread Joakim via Digitalmars-d

On Thursday, 3 August 2017 at 20:55:35 UTC, Pradeep Gowda wrote:

On Thursday, 3 August 2017 at 20:47:30 UTC, Joakim wrote:
Please tell me which enterprise storage company advertises the 
programming languages they implemented their product in. ;) We 
hope to have a post on the D blog with info from Weka sometime 
soon, that should be a good way to get the word out.


They do mention it on their jobs page - 
http://www.weka.io/company/careers/

(see under "Data Path Developer" position).


Sure, a lot of companies do that, not what I meant by 
advertising, ie in their news articles and press releases.  Weka 
has been very open by giving talks at DConf, that's going to be 
noticed more than some job opening buried in their website:


http://dconf.org/2015/talks/zvibel.html
http://dconf.org/2016/talks/zvibel.html


Re: Bug in gtkd?

2017-08-03 Thread Mike Wey via Digitalmars-d-learn

On 03-08-17 22:40, Johnson Jones wrote:
Ok, so, I linked the gtk to the msys gtk that I installed before when 
trying to get glade to work and it worked!


seems that msys is much more up to date than anything else as it just 
works(I need to remember than in the future).


The problem I see is this:

When I get ready to release my app to the public, I can't expect them to 
all have to install msys and build.


msys seems to clump everything together and I don't know what files I 
need to extract to be able to bundle everything together.


Any ideas how to solve that problem? At least now I can move ahead and 
actually make some progress on my app.


Would still be nice to get the x86 vs x64 issue resolved so I don't have 
to keep switching between the two for testing purposes. Since Visual D 
was just patched to handle x64 BP's I guess I can stay with that for now.




I'll try to build and test some new installers tomorrow that will 
include the loaders.


--
Mike Wey


Re: [OT] Generative C++

2017-08-03 Thread Timon Gehr via Digitalmars-d

On 03.08.2017 22:06, 12345swordy wrote:

On Thursday, 3 August 2017 at 19:45:12 UTC, Timon Gehr wrote:

On 03.08.2017 21:28, 12345swordy wrote:

On Thursday, 3 August 2017 at 19:02:17 UTC, Timon Gehr wrote:

On 03.08.2017 20:32, 12345swordy wrote:

[...]


On 02.08.2017 15:50, 12345swordy wrote:

[...]


How would you use the proposed features to implement @safe or @nogc 
within C++?


I am not interested in arguing about what I said or I didn't said.


I don't understand the relevance of this sentence.

Regardless what you asking is ridiculous, as 1.) there is no gc exist 
in c++ in the first place

https://en.wikipedia.org/wiki/Boehm_garbage_collector

2.)it's still a concept at this point of time which may be rejected 
in the future.


How does that make my question ridiculous?

You are splinting hairs here.


That's a quite poetic way to describe the futility of my endeavor to 
engage you in a productive discussion. Also see 
http://medical-dictionary.thefreedictionary.com/splinting . [1]


The gc that you linked is a third party 
library, that is not the same as having it built into the language 
itself.


The C++ @nogc implementation would also not be built-in, and whether or 
not the memory allocator in question is built-in has no bearing on 
whether my question was ridiculous or not. (I.e. you are splitting hairs.)



Clear difference.


Clear, yet irrelevant.


BTW: If you are not interested in actually discussing the applicability 
of the proposal to enforcing coding standards to the point you outlined 
(@safe and @nogc), we can stop at any time. I was just curious how you 
would achieve this.




[1] Note that here I was deliberately splitting hairs, to demonstrate 
the difference.


Re: Weka.IO in the news... but not mentioning Dlang... why?

2017-08-03 Thread Pradeep Gowda via Digitalmars-d

On Thursday, 3 August 2017 at 20:47:30 UTC, Joakim wrote:
Please tell me which enterprise storage company advertises the 
programming languages they implemented their product in. ;) We 
hope to have a post on the D blog with info from Weka sometime 
soon, that should be a good way to get the word out.


They do mention it on their jobs page - 
http://www.weka.io/company/careers/

(see under "Data Path Developer" position).



[Issue 17719] New: compiler generates code for CTFE-only templates

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17719

  Issue ID: 17719
   Summary: compiler generates code for CTFE-only templates
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: c...@dawg.eu

Quite a few template functions that are only used as CTFE helpers end up in
final binaries, unnecessarily slowing down compilation and blowing up object
sizes.
Would be great if we could dismiss any instantions that are not used during
runtime.

--


Re: dlang-requetst: openssl 1.1 compatible release

2017-08-03 Thread Cym13 via Digitalmars-d-announce

On Thursday, 3 August 2017 at 18:04:33 UTC, Suliman wrote:
Moving any third party code to std library have both "pro" and 
"contra" and it was discussed several times. From my point of 
view there is nothing wrong with modules outside of std 
library as long as these modules are visible to newcomers, 
well documented and have developer support.


HTTP *very* important part in present time. Every modern 
language should have good native http-lib out of the box. I 
understand that it's can be done as outside module, but JSON 
also can be outside, and files can be outside. But I do not 
think that it's good idea.


http-request is much more friendly and powerful than curl. It's 
much better to move curl as external package.


I think it shouldn't be included in Phobos *because* it's a good 
library that we want to see growing.


Let's compare with the case of the original Requests library, in 
Python. As it is the most downloaded Python library ever there 
have been discussions about including it in the standard library. 
After much deliberations Kenneth Reitz (the author) decided that 
integrating requests in the stdlib would harm it by imposing a 
slower release cycle not fitting the fast iterations needed by 
the package. Furthermore so many python programs need requests 
that most people get to install it one time or another, making it 
a de facto standard that is standard enough for its purpose. 
Clearly that decision did not slow Requests development, nor did 
it hit its popularity. People just do a "pip install requests" 
and don't care about it anymore.


In D the situation is even easier because it is compiled: the 
developer is the only one having to add a line to its dub.json, 
the user doesn't have to care at all. And given that the package 
still has much room for improvement freezing it in Phobos doesn't 
strike me as a good idea at all.


Of course Phobos must propose an HTTP interface, but it must 
propose one that allows you to build better ones, it doesn't have 
to propose a perfect one (although it would obviously be nice).


Re: [OT] Generative C++

2017-08-03 Thread Joakim via Digitalmars-d

On Thursday, 3 August 2017 at 19:02:17 UTC, Timon Gehr wrote:

On 03.08.2017 20:32, 12345swordy wrote:

On Thursday, 3 August 2017 at 10:43:50 UTC, Kagamin wrote:
On Wednesday, 2 August 2017 at 20:28:38 UTC, 12345swordy 
wrote:

...No? I was referring to the c++ proposal paper.


The paper doesn't propose to enforce coding standards to the 
point you want. D already does what the paper proposes.

Page 2:

"Enable writing
compiler-enforced
patterns for any purpose:
coding standards
(e.g., many
Core Guidelines
“enforce” rules)
"

Yes, it does, right there. Are you reading the same paper that 
I am?


On 02.08.2017 15:50, 12345swordy wrote:
  > Is it to much to ask for d developers to provide a way to 
enforce custom
coding standards in a similar fashion that @nogc and @safe 
does?


How would you use the proposed features to implement @safe or 
@nogc within C++?


I think you misread him.  He wants to enforce custom coding 
standards in D similar to how that proposal would allow, and he's 
comparing it to how D does it with attributes for @safe and 
@nogc, but he's not asking about @safe and @nogc specifically.  
Presumably, he's wondering if he can apply other attributes in D 
that could be used to enforce coding standards similar to the 
ones that C++ proposal enables.


Re: dlang-requetst: openssl 1.1 compatible release

2017-08-03 Thread Cym13 via Digitalmars-d-announce

On Thursday, 3 August 2017 at 06:33:38 UTC, ikod wrote:

Hello,

Since version 0.5.0 dlang-requests has become compatible with 
both 1.0.x and 1.1.x versions of openssl library.


Please try and report any issues on github.
Thanks!

dlang-requests is HTTP/FTP client library, inspired by 
python-requests with goals:


small memory footprint
performance
simple, high level API
native D implementation

https://code.dlang.org/packages/requests
https://github.com/ikod/dlang-requests


Thank you very much for this, the openssl issue was a point I 
really wanted to be fixed :)


Re: Weka.IO in the news... but not mentioning Dlang... why?

2017-08-03 Thread Joakim via Digitalmars-d

On Thursday, 3 August 2017 at 19:58:57 UTC, notna wrote:
What a missed marketing opportunity for Dlang... nevertheless, 
good news as sooner or later people will get it... and congrats 
to Weka.IO on "going public"...


https://www.theregister.co.uk/2017/07/13/wekaio_surfaces_after_swimming_submerged_against_the_current/


Please tell me which enterprise storage company advertises the 
programming languages they implemented their product in. ;) We 
hope to have a post on the D blog with info from Weka sometime 
soon, that should be a good way to get the word out.


Re: Template mixins and selective imports

2017-08-03 Thread jmh530 via Digitalmars-d-learn

On Thursday, 3 August 2017 at 19:05:47 UTC, Meta wrote:

On Thursday, 3 August 2017 at 19:03:55 UTC, Meta wrote:

`mixin vectorize!sin vsin; alias sin = vsin;` and see if it


Should be `alias sin = vsin.sin;`


Thanks, this pointed me in the right direction. I got the line 
below working.


mixin vectorize!sin temp;
alias vsin = temp.sin;
auto z = vsin(x);

I couldn't give it the name of sin or the name of the identifier.

This is a little ugly and would require the user to make the 
adjustment themselves.


Below seems to work if the user doesn't import the relevant 
function, though it will still result in errors if they 
selectively import that function. I think the combination of the 
two will be sufficient.



private enum _vectorizeAlt(string mod, string func) = "
auto " ~ func ~ "(SliceKind kind, size_t[] packs, Iterator)
   (Slice!(kind, packs, 
Iterator) slice)

{
import mir.ndslice.topology : map;
return slice.map!(" ~ mod ~ "." ~ func ~ ");
}
";

mixin template vectorizeAlt(string mod, string func)
{
mixin("static import " ~ mod ~ ";");
import mir.ndslice.slice : SliceKind, Slice;

mixin(_vectorizeAlt!(mod, func));
}

unittest
{
import std.stdio : writeln;
import mir.ndslice.slice : sliced;
import mir.ndslice.topology : map;

auto x = [0.0, 1.0, 2.0, 3.0].sliced;

mixin vectorizeAlt!("std.math", "sin");
auto y = sin(x);
}


Re: Bug in gtkd?

2017-08-03 Thread Johnson Jones via Digitalmars-d-learn

On Thursday, 3 August 2017 at 15:11:46 UTC, Mike Wey wrote:

On 03-08-17 05:00, Johnson Jones wrote:

On Wednesday, 2 August 2017 at 14:51:45 UTC, Mike Wey wrote:

On 02-08-17 08:04, Johnson Jones wrote:
Ok, Using msys I was able to get glade 3.20 running. Maybe 
that will fix everything.


Great, unfortunately "Use msys2" seems to be the official way 
to install anything GTK related on windows.


... Also, I cannot seem to load a jpg using an imageview

(test.exe:1628): Gtk-WARNING **: Could not load 
image 'a.jpg': Couldn't recognize the image file format for 
file 'a.jpg'


Just a normal jpg. Tried a bmp, same thing. It shows fine in 
glade itself.




It looks like the pixbuf loaders are missing from the installer.


Ok, so, I linked the gtk to the msys gtk that I installed before 
when trying to get glade to work and it worked!


seems that msys is much more up to date than anything else as it 
just works(I need to remember than in the future).


The problem I see is this:

When I get ready to release my app to the public, I can't expect 
them to all have to install msys and build.


msys seems to clump everything together and I don't know what 
files I need to extract to be able to bundle everything together.


Any ideas how to solve that problem? At least now I can move 
ahead and actually make some progress on my app.


Would still be nice to get the x86 vs x64 issue resolved so I 
don't have to keep switching between the two for testing 
purposes. Since Visual D was just patched to handle x64 BP's I 
guess I can stay with that for now.






Re: Weka.IO in the news... but not mentioning Dlang... why?

2017-08-03 Thread Ali via Digitalmars-d

On Thursday, 3 August 2017 at 19:58:57 UTC, notna wrote:
What a missed marketing opportunity for Dlang... nevertheless, 
good news as sooner or later people will get it... and congrats 
to Weka.IO on "going public"...


https://www.theregister.co.uk/2017/07/13/wekaio_surfaces_after_swimming_submerged_against_the_current/


because , this is an article about the product weka sell , not an 
article about programming , an article written for users and 
buyers not programmers


had the article been written to target programmers, i am sure d 
would have been mentioned


Re: Bug in gtkd?

2017-08-03 Thread Johnson Jones via Digitalmars-d-learn

On Thursday, 3 August 2017 at 15:11:46 UTC, Mike Wey wrote:

On 03-08-17 05:00, Johnson Jones wrote:

On Wednesday, 2 August 2017 at 14:51:45 UTC, Mike Wey wrote:

On 02-08-17 08:04, Johnson Jones wrote:
Ok, Using msys I was able to get glade 3.20 running. Maybe 
that will fix everything.


Great, unfortunately "Use msys2" seems to be the official way 
to install anything GTK related on windows.


... Also, I cannot seem to load a jpg using an imageview

(test.exe:1628): Gtk-WARNING **: Could not load 
image 'a.jpg': Couldn't recognize the image file format for 
file 'a.jpg'


Just a normal jpg. Tried a bmp, same thing. It shows fine in 
glade itself.




It looks like the pixbuf loaders are missing from the installer.


I tried to use the mingw version of gtk with no luck. It first 
looks in C:\MinGW even though I have MinGW installed somewhere 
else. Using a junction doesn't help becomes then it when it finds 
the dll it has missing symbols


"The Procedure Entry Point gdk_pixbuf_gettext could not be 
located in the dynamic link library 
C:\MinGW\lib\gdk-pix-buf-2.0\2.10.0\loaders\libpixbufloader-gdip-jpeg.dll".


I actually just copied over the loaders rather than using the 
full gtk mingw install because when I do that it complains about 
some lib??svg missing. I guess one can't mix mingw installs with 
non-mingw... but the gtk mingw install is incomplete too ;/


I hope this isn't going to be an on going thing... seems I've 
wasted quite a bit of time to try and get gdk to work. I probably 
could have written my own gui by now.


Re: Visual D no bp's on x64

2017-08-03 Thread Johnson Jones via Digitalmars-d-debugger

On Thursday, 3 August 2017 at 07:06:06 UTC, Rainer Schuetze wrote:



On 31.07.2017 19:51, Johnson Jones wrote:
On Saturday, 22 July 2017 at 12:54:17 UTC, Rainer Schuetze 
wrote:



On 18.06.2017 20:25, Mike B Johnson wrote:

[...]


After installing VS2017 on a fresh Win10 install I could 
reproduce this issue: the mago debug engine failed to load 
the symbols when only VS2017 is installed, because the 
COM-CLSID to load msdia140.dll changed. Switching to the VS 
debug engine worked, though.


Should be fixed in the next release.


I installed a fresh VS2017 and the latest beta visual D and 
same issues. As of today, was this suppose to be fixed?


It hasn't been released until now: 
https://github.com/dlang/visuald/releases/tag/v0.45.0


Thanks! Seems to be working.


Re: Visual D 0.45 released - better VS2017 integration

2017-08-03 Thread 12345swordy via Digitalmars-d-announce

On Thursday, 3 August 2017 at 07:04:55 UTC, Rainer Schuetze wrote:

Hi,

there is a new version 0.45 of Visual D available at 
http://rainers.github.io/visuald/visuald/StartPage.html


Most changes are bug fixes and incremental improvements, maybe 
standing out:


* improved VS 2017 integration
* task list support
* dparser update to recent language additions

See 
http://rainers.github.io/visuald/visuald/VersionHistory.html 
for the full version history.


Visual D is a Visual Studio extension that adds D language 
support to VS2008-2017. It is written in D, its source code can 
be found on github: 
https://github.com/D-Programming-Language/visuald, pull 
requests welcome.


Rainer


Much appreciated for your efforts.

Alex.


Re: [OT] Generative C++

2017-08-03 Thread 12345swordy via Digitalmars-d

On Thursday, 3 August 2017 at 19:45:12 UTC, Timon Gehr wrote:

On 03.08.2017 21:28, 12345swordy wrote:

On Thursday, 3 August 2017 at 19:02:17 UTC, Timon Gehr wrote:

On 03.08.2017 20:32, 12345swordy wrote:

[...]


On 02.08.2017 15:50, 12345swordy wrote:

[...]


How would you use the proposed features to implement @safe or 
@nogc within C++?


I am not interested in arguing about what I said or I didn't 
said.


I don't understand the relevance of this sentence.

Regardless what you asking is ridiculous, as 1.) there is no 
gc exist in c++ in the first place

https://en.wikipedia.org/wiki/Boehm_garbage_collector

2.)it's still a concept at this point of time which may be 
rejected in the future.


How does that make my question ridiculous?
You are splinting hairs here. The gc that you linked is a third 
party library, that is not the same as having it built into the 
language itself. Clear difference.


Alex


[Issue 14793] net.curl.download https broken - windows

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14793

--- Comment #7 from Vladimir Panteleev  ---
If there is a reproducible problem with the installer not installing libcurl
properly, please file that separately.

--


[Issue 14793] net.curl.download https broken - windows

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14793

Vladimir Panteleev  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED
 Resolution|FIXED   |INVALID

--


Weka.IO in the news... but not mentioning Dlang... why?

2017-08-03 Thread notna via Digitalmars-d
What a missed marketing opportunity for Dlang... nevertheless, 
good news as sooner or later people will get it... and congrats 
to Weka.IO on "going public"...


https://www.theregister.co.uk/2017/07/13/wekaio_surfaces_after_swimming_submerged_against_the_current/



Re: gtkD load images

2017-08-03 Thread Johnson Jones via Digitalmars-d-learn

On Thursday, 3 August 2017 at 13:12:03 UTC, Mengu wrote:

On Thursday, 3 August 2017 at 03:59:40 UTC, Johnson Jones wrote:
How can be use gtkD to load images, I assume through 
gdkpixbuf? While I am getting errors loading images through 
glade's image:


(test.exe:8188): Gtk-WARNING **: Could not load 
image 'a.jpg': Couldn't recognize the image file format for 
file 'test\a.jpg'


(loads fine in glade)

which needs to be resolved, I'd also like to be able to use 
gdkpixbuf to load images programmatically. There seems to be 
no demos on the gtkD github page that deals with image loading.


I've tried to do something like

import gtkc.gdkpixbuf;
auto x = c_gdk_pixbuf_get_formats().data;

but I don't know how to interpret x.

Also something like

import gtkc.gdkpixbuf;
void* x;
auto p = c_gdk_pixbuf_get_formats();
for(int i = 0; i < 10; i++)
{   
x = p.data;
p = p.next;
}

which doesn't offer any help.


Aside: How can we call the gtk functions directly using gtkD? 
Seems it uses stuff like


Linker.link(gdk_pixbuf_get_formats, "gdk_pixbuf_get_formats", 
LIBRARY_GDKPIXBUF);


It does seem to alias to these function but something is off 
and I'm not sure what.


hi

- is the gtk.Image class not working for you? 
https://api.gtkd.org/gtkd/gtk/Image.html


- there's also a gdkpixbuf.Pixbuf that you can use. 
https://api.gtkd.org/gtkd/gdkpixbuf/Pixbuf.html


- you can import those functions from gdkpixbuf.c.functions.


no, they are not... I haven't tried though, but there seems to be 
a problem with the pixbuf not having loaders for any images. 
using a gtk Image widget does not load the image and complains 
about the image format.


If I do something like

import gdkpixbuf.Pixbuf;
Pixbuf.newFromResource("C:\\a.jpg");

Unhandled exception: glib.GException.GException The resource at 
'C:\a.jpg' does not exist at generated\gtkd\glib\GException.d(40) 
occurred


which doesn't seem to make much sense.

The resource exists where I say it is and not sure if this is 
related to the missing pixbuf loaders.


Re: [OT] Generative C++

2017-08-03 Thread Timon Gehr via Digitalmars-d

On 03.08.2017 21:28, 12345swordy wrote:

On Thursday, 3 August 2017 at 19:02:17 UTC, Timon Gehr wrote:

On 03.08.2017 20:32, 12345swordy wrote:

On Thursday, 3 August 2017 at 10:43:50 UTC, Kagamin wrote:

On Wednesday, 2 August 2017 at 20:28:38 UTC, 12345swordy wrote:

...No? I was referring to the c++ proposal paper.


The paper doesn't propose to enforce coding standards to the point 
you want. D already does what the paper proposes.

Page 2:

"Enable writing
compiler-enforced
patterns for any purpose:
coding standards
(e.g., many
Core Guidelines
“enforce” rules)
"

Yes, it does, right there. Are you reading the same paper that I am?


On 02.08.2017 15:50, 12345swordy wrote:
  > Is it to much to ask for d developers to provide a way to enforce 
custom

coding standards in a similar fashion that @nogc and @safe does?


How would you use the proposed features to implement @safe or @nogc 
within C++?


I am not interested in arguing about what I said or I didn't said. 


I don't understand the relevance of this sentence.

Regardless what you asking is ridiculous, as 1.) there is no gc exist in 
c++ in the first place

https://en.wikipedia.org/wiki/Boehm_garbage_collector

2.)it's still a concept at this point of time 
which may be rejected in the future.


How does that make my question ridiculous?


Re: Bug in gtkd?

2017-08-03 Thread Johnson Jones via Digitalmars-d-learn

On Thursday, 3 August 2017 at 15:11:46 UTC, Mike Wey wrote:

On 03-08-17 05:00, Johnson Jones wrote:

On Wednesday, 2 August 2017 at 14:51:45 UTC, Mike Wey wrote:

On 02-08-17 08:04, Johnson Jones wrote:
Ok, Using msys I was able to get glade 3.20 running. Maybe 
that will fix everything.


Great, unfortunately "Use msys2" seems to be the official way 
to install anything GTK related on windows.


... Also, I cannot seem to load a jpg using an imageview

(test.exe:1628): Gtk-WARNING **: Could not load 
image 'a.jpg': Couldn't recognize the image file format for 
file 'a.jpg'


Just a normal jpg. Tried a bmp, same thing. It shows fine in 
glade itself.




It looks like the pixbuf loaders are missing from the installer.


How do I remedy this?


Re: [OT] Generative C++

2017-08-03 Thread 12345swordy via Digitalmars-d

On Thursday, 3 August 2017 at 19:02:17 UTC, Timon Gehr wrote:

On 03.08.2017 20:32, 12345swordy wrote:

On Thursday, 3 August 2017 at 10:43:50 UTC, Kagamin wrote:
On Wednesday, 2 August 2017 at 20:28:38 UTC, 12345swordy 
wrote:

...No? I was referring to the c++ proposal paper.


The paper doesn't propose to enforce coding standards to the 
point you want. D already does what the paper proposes.

Page 2:

"Enable writing
compiler-enforced
patterns for any purpose:
coding standards
(e.g., many
Core Guidelines
“enforce” rules)
"

Yes, it does, right there. Are you reading the same paper that 
I am?


On 02.08.2017 15:50, 12345swordy wrote:
  > Is it to much to ask for d developers to provide a way to 
enforce custom
coding standards in a similar fashion that @nogc and @safe 
does?


How would you use the proposed features to implement @safe or 
@nogc within C++?


I am not interested in arguing about what I said or I didn't 
said. Regardless what you asking is ridiculous, as 1.) there is 
no gc exist in c++ in the first place 2.)it's still a concept at 
this point of time which may be rejected in the future.


Re: Template mixins and selective imports

2017-08-03 Thread Meta via Digitalmars-d-learn

On Thursday, 3 August 2017 at 19:03:55 UTC, Meta wrote:

`mixin vectorize!sin vsin; alias sin = vsin;` and see if it


Should be `alias sin = vsin.sin;`




Re: [OT] Generative C++

2017-08-03 Thread Timon Gehr via Digitalmars-d

On 03.08.2017 20:32, 12345swordy wrote:

On Thursday, 3 August 2017 at 10:43:50 UTC, Kagamin wrote:

On Wednesday, 2 August 2017 at 20:28:38 UTC, 12345swordy wrote:

...No? I was referring to the c++ proposal paper.


The paper doesn't propose to enforce coding standards to the point you 
want. D already does what the paper proposes.

Page 2:

"Enable writing
compiler-enforced
patterns for any purpose:
coding standards
(e.g., many
Core Guidelines
“enforce” rules)
"

Yes, it does, right there. Are you reading the same paper that I am?


On 02.08.2017 15:50, 12345swordy wrote:

  > Is it to much to ask for d developers to provide a way to enforce custom
coding standards in a similar fashion that @nogc and @safe does?


How would you use the proposed features to implement @safe or @nogc 
within C++?


Re: Template mixins and selective imports

2017-08-03 Thread Meta via Digitalmars-d-learn

On Thursday, 3 August 2017 at 15:29:47 UTC, jmh530 wrote:
I am trying to create a vectorize function that mixes in a new 
version of function with the same name that applies the 
function (to an ndslice).


The code below compiles without error and has the behavior I 
would expect.


However, when I change the function import to a selective 
import (e.g. from import std.math; to import std.math : sin;), 
then I get errors implying that the overload is not actually 
created.


Ideally, I would like to get this working with any kind of 
import.


One thing I noticed is that the fullyQualifiedName of sin 
changes quite a bit depending on whether you use one or the 
other.


This may be related to either of the following:
https://issues.dlang.org/show_bug.cgi?id=16287
https://issues.dlang.org/show_bug.cgi?id=16023



---

import std.traits : isFunction;

private enum _vectorize(string f) = "
import mir.ndslice.slice : SliceKind, Slice;

auto " ~ f ~ "(SliceKind kind, size_t[] packs, Iterator)
   (Slice!(kind, packs, 
Iterator) slice)

{
import mir.ndslice.topology : map;
return slice.map!(f);
}
";

mixin template vectorize(alias f)
if (isFunction!f)
{
mixin(_vectorize!(__traits(identifier, f)));
}

unittest
{
import std.stdio : writeln;
import mir.ndslice.slice : sliced;
import mir.ndslice.topology : map;
import std.math; //import std.math : sin;

auto x = [0.0, 1.0, 2.0, 3.0].sliced;

auto y = x.map!(sin);
writeln(y);

mixin vectorize!(sin);
auto z = sin(x);
writeln(z);
}


I'm not 100% certain, but I believe you have to bring the 
vectorized overload of sin into the overload set, so first try 
`mixin vectorize!sin vsin; alias sin = vsin;` and see if it works.


https://dlang.org/spec/function.html#overload-sets


[Issue 17703] __traits(compiles, AssignmentExpression) no longer compiles without surrounding parens

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17703

Martin Nowak  changed:

   What|Removed |Added

 CC||c...@dawg.eu
   Severity|regression  |normal

--- Comment #1 from Martin Nowak  ---
Looks like the assignment expression parsing isn't fully working, below example
works.

void works(int a, int b)
{
static assert(__traits(compiles, a = b));
}

Also the specs support the case
http://dlang.org/spec/grammar.html#TraitsArgument

I went back until 2.050 and it still wouldn't accept the code, downgrading to a
normal bug.

Simple workaround:

  __traits(compiles, { exp; })

--


Re: Netflix opensources its first D library: Vectorflow

2017-08-03 Thread Joakim via Digitalmars-d-announce

On Thursday, 3 August 2017 at 14:00:31 UTC, Matt wrote:
Meanwhile, the blog post Laeeth gave you shows Mir doing 
better on matrix multiplication benchmarks than Eigen, 
significantly better when dealing with complex numbers.


I mean by now we should all be jaded enough not to simply take 
toy benchmarks as gospel for which is actually fastest in a 
non-trivial application.


That's why I didn't make such a general claim and noted that the 
linked benchmarks only dealt with matrix multiplication. :P



I don't doubt mir is really fast, though.


Yes, the benchmarks are indicative, but it's up to you come up 
with a benchmark that characterizes your workload better.


[Issue 17661] New isInputRange rejects valid input range

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17661

Martin Nowak  changed:

   What|Removed |Added

 CC||c...@dawg.eu

--- Comment #5 from Martin Nowak  ---
Well in, (R r) return => r.front, the return applies to the delegate context,
but you're escaping a reference to the argument.
What you want to check is `(return ref R r) => r.front`.

Also rewriting your front methods to a free functions helps understanding.

  C front(return ref S _this) { return C(&_this); }

Obviously allowing

  (R r) => front(r)

would return a dangling reference to the value parameter.

NB, if your front methods leaked a field of the range (e.g. a pointer), you'd
need a `return scope` front methods, but the `(R r) => r.front` check is fine,
since the parameter `r` isn't scoped, i.e. it might leak any pointer fields.

--


[Issue 17718] New: [scope] function literal arguments can be escaped

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17718

  Issue ID: 17718
   Summary: [scope] function literal arguments can be escaped
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: safe
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: c...@dawg.eu

cat > bug.d << CODE
@safe:

struct S
{
int* p;
int* leak() return scope { return p; }
}

alias f = function int*(scope S s) { return s.leak; }; // broken
int* f(scope S s) { return s.leak; } // works
CODE

dmd -c -dip1000 bug

--


Re: [OT] Generative C++

2017-08-03 Thread 12345swordy via Digitalmars-d

On Thursday, 3 August 2017 at 10:43:50 UTC, Kagamin wrote:

On Wednesday, 2 August 2017 at 20:28:38 UTC, 12345swordy wrote:

...No? I was referring to the c++ proposal paper.


The paper doesn't propose to enforce coding standards to the 
point you want. D already does what the paper proposes.

Page 2:

"Enable writing
compiler-enforced
patterns for any purpose:
coding standards
(e.g., many
Core Guidelines
“enforce” rules)
"

Yes, it does, right there. Are you reading the same paper that I 
am?


[Issue 14793] net.curl.download https broken - windows

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14793

Yury Korchemkin  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Yury Korchemkin  ---
Figured that out — the problem was with libcurl.dll being not installed on the
machine and not copied into the folder with executable.

Copying the DLL solved the problem.

Resolving the bug.

--


[Issue 17601] [REG2.075.0-b1] segmentation fault for dmd -deps

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17601

Martin Nowak  changed:

   What|Removed |Added

   Priority|P3  |P1

--


[Issue 17717] New: C++ files not always recompiled when changed

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17717

  Issue ID: 17717
   Summary: C++ files not always recompiled when changed
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: normal
  Priority: P1
 Component: visuald
  Assignee: nob...@puremagic.com
  Reporter: nicolas.jincher...@gmail.com

C++ files included in my Visual D project don't always get recompiled after
they've been changed. I have to clean the solution to get them to recompile.

--


Re: dlang-requetst: openssl 1.1 compatible release

2017-08-03 Thread Suliman via Digitalmars-d-announce
Moving any third party code to std library have both "pro" and 
"contra" and it was discussed several times. From my point of 
view there is nothing wrong with modules outside of std library 
as long as these modules are visible to newcomers, well 
documented and have developer support.


HTTP *very* important part in present time. Every modern language 
should have good native http-lib out of the box. I understand 
that it's can be done as outside module, but JSON also can be 
outside, and files can be outside. But I do not think that it's 
good idea.


http-request is much more friendly and powerful than curl. It's 
much better to move curl as external package.




[Issue 17601] [REG2.075.0-b1] segmentation fault for dmd -deps

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17601

--- Comment #7 from Martin Nowak  ---
I'd say that the change in https://github.com/dlang/dmd/pull/6748 and using
-deps without -o- are suboptimal, as you'd end up with all the codegen from the
semantic3 in imported methods in your object files, not particularly nice.
This is unfortunately similar to how inlining is implemented in dmd :/.

--


[Issue 17716] wrong result of IsExpression when not in static assert

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17716

--- Comment #1 from ag0ae...@gmail.com ---
Inside functions everything works as expected:


struct S { shared int* foo; int* bar; }
pragma(msg, is(shared S : S)); /* "true" - wrong */
void f()
{
pragma(msg, is(shared S : S)); /* "false" - correct */
}


--


[Issue 17601] [REG2.075.0-b1] segmentation fault for dmd -deps

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17601

--- Comment #6 from Martin Nowak  ---
Happens because a function ends up in the glue layer in PASSsemantic2 state
(std.range.SortedRange!(string[], "a < b").SortedRange.__xopEquals).
It's a side-effect of bluntly trying to run semantic3 on all imported modules
(https://github.com/dlang/dmd/pull/6748).
Seems like the deferred STCinference mechanism added in
https://github.com/dlang/dmd/pull/5075 isn't run for the compiler generated
__x* methods.

--


[Issue 17601] [REG2.075.0-b1] segmentation fault for dmd -deps

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17601

--- Comment #5 from Martin Nowak  ---
@Mario, try to avoid external dependencies in bug reports, but if you include
them, please use a fixed commit/tag, so we can reproduce the issue.

--


[Issue 17601] [REG2.075.0-b1] segmentation fault for dmd -deps

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17601

--- Comment #4 from Martin Nowak  ---
The reduced case segfaults on invalid code, seems to be different from the
reported issue.

--


Re: why won't byPair work with a const AA?

2017-08-03 Thread Steven Schveighoffer via Digitalmars-d-learn

On 8/3/17 4:30 AM, Olivier FAURE wrote:

I understand the general concept you're describing, but what exactly are 
tail modifiers? It's the first time I see this name, and my google-fu 
gives me nothing.


tail modifiers are modifiers that only apply to the "tail" of the type.

For example const(int)* is applying const to the "tail" of the int 
pointer, that is, the int that it points at. It's not applying to the 
actual pointer itself (we call that the "head").


Another way to look at it is that when you copy a variable you always 
make a copy of the head, and you don't make a copy of the tail. For this 
reason, the fully-modified and tail-modified types are implicitly 
castable, and this is the important property we need to duplicate.


A tail-modified struct would be something like this:

struct S
{
   int * x;
}

const(S) s;

This looks like this:

struct ConstS
{
   const(int *) x;
}

A tail-const S would look like this:

struct TailConstS
{
   const(int)* x;
}

That is, everything the struct points at remains const, but the actual 
data of the struct is now mutable.


Note that TailConstS and ConstS can implicitly convert.

This is how arrays work. An array T[] is really:

struct Array
{
   size_t length;
   T* ptr;
}

A tail-const array const(T)[] is really:

struct TailConstArray
{
   size_t length; // mutable
   const(T)* ptr; // mutable, but points at const data
}

This property of implicit casting is what's needed to fully realize 
custom ranges and const together. The way to get it is to define 
tail-modifier syntax for all types, not just arrays and pointers.


-Steve


[Issue 17716] New: wrong result of IsExpression when not in static assert

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17716

  Issue ID: 17716
   Summary: wrong result of IsExpression when not in static assert
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ag0ae...@gmail.com


struct S { shared int* foo; int* bar; }
static assert(!is(shared S : S)); /* passes */
pragma(msg, is(shared S : S)); /* "true" */
static if (is(shared S : S))
{
static assert(false); /* is triggered */
}


The `static assert` is correct.
The `pragma(msg, ...);` should print "false":
The body of the `static if` should not be entered.

Also happens with other qualifiers (const, immutable).
Depends on the order of the struct fields. When the unqualified fields comes
first, everything works as expected.

--


[Issue 17622] [REG2.075.0-b1] Wrong code with appender and -inline

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17622

--- Comment #10 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/c73fe970c2014058b9544524d1809180db13cfbb
fix Issue 17622 - [REG2.075.0-b1] Wrong code with appender and -inline

https://github.com/dlang/dmd/commit/17473d2e6248da9fbb746ed8314b0ee488961156
Merge pull request #7056 from WalterBright/fix17622

fix Issue 17622 - [REG2.075.0-b1] Wrong code with appender and -inline
merged-on-behalf-of: Martin Nowak 

--


[Issue 17622] [REG2.075.0-b1] Wrong code with appender and -inline

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17622

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 17713] Template 'this' parameters for static methods

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17713

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||timos...@gmail.com

--- Comment #2 from Steven Schveighoffer  ---
*** Issue 17714 has been marked as a duplicate of this issue. ***

--


[Issue 17714] Function template - this T for static methods

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17714

Steven Schveighoffer  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||schvei...@yahoo.com
 Resolution|--- |DUPLICATE

--- Comment #1 from Steven Schveighoffer  ---
Huh, I think separately Timon Gehr added an almost identical issue right before
you :)

*** This issue has been marked as a duplicate of issue 17713 ***

--


[Issue 17632] [REG 2.075-b1] opBinary and delegate code generation

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17632

Martin Nowak  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #5 from Martin Nowak  ---


*** This issue has been marked as a duplicate of issue 17622 ***

--


[Issue 17622] [REG2.075.0-b1] Wrong code with appender and -inline

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17622

Martin Nowak  changed:

   What|Removed |Added

 CC||briancsch...@gmail.com

--- Comment #9 from Martin Nowak  ---
*** Issue 17632 has been marked as a duplicate of this issue. ***

--


[Issue 17713] Template 'this' parameters for static methods

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17713

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--


[Issue 17715] New: Floating point numbers are printed as integers

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17715

  Issue ID: 17715
   Summary: Floating point numbers are printed as integers
   Product: D
   Version: D2
  Hardware: All
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: pgkos.bugzi...@yahoo.com

Currently, this example:

writeln(1.01);

prints just "1", probably because the call to snprintf inside
phobos/format.d formatValue implementation for floats uses "%g" by default.

It would be nice if the default formatter was e.g.:
%.8g for float type
%.16g for double type

--


Re: Netflix opensources its first D library: Vectorflow

2017-08-03 Thread Samuel Lampa via Digitalmars-d-announce

On Wednesday, 2 August 2017 at 22:56:32 UTC, Joakim wrote:

Not doing well on HN though:

https://hn.algolia.com/?query=vectorflow


HN is very sensitive to time of day when submitting. Did a new 
try:


https://news.ycombinator.com/item?id=14920608


Re: D books - 3 eBooks, videos, and courses for $25 right now

2017-08-03 Thread Martin Tschierschke via Digitalmars-d-announce
On Thursday, 27 July 2017 at 08:29:14 UTC, Martin Tschierschke 
wrote:

On Friday, 16 December 2016 at 05:43:02 UTC, Kai Nacke wrote:

Hi all,

Packt Publishing offers eBooks for $5 for a limited time. If 
your collection of D eBooks is still incomplete then this is a 
great chance for you. :-)


D Cookbook by Adam D. Ruppe 
(https://www.packtpub.com/application-development/d-cookbook)
Learning D by Michael Parker 
(https://www.packtpub.com/application-development/learning-d)
D Web Development by myself 
(https://www.packtpub.com/web-development/d-web-development)


Regards,
Kai

3 eBooks, videos, and courses for $25 right now

Not as cheap as in December but a good opportunity to take them 
all...

And now as well, for $10 each.



[Issue 17684] [REG 2.062] `static alias this` bug or incomplete implementation?

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17684

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/9cdaed6e4b2259e883b6d716472516ac994e9d1e
Fix Issue 17684 - [REG 2.062] static alias this

Added newline at end of file

https://github.com/dlang/dmd/commit/9df55228d2311e518c3fa4dfd7348facbcbcf775
Merge pull request #7055 from JinShil/stable

Fix Issue 17684 - [REG 2.062] static alias this

--


[Issue 17684] [REG 2.062] `static alias this` bug or incomplete implementation?

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17684

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


Template mixins and selective imports

2017-08-03 Thread jmh530 via Digitalmars-d-learn
I am trying to create a vectorize function that mixes in a new 
version of function with the same name that applies the function 
(to an ndslice).


The code below compiles without error and has the behavior I 
would expect.


However, when I change the function import to a selective import 
(e.g. from import std.math; to import std.math : sin;), then I 
get errors implying that the overload is not actually created.


Ideally, I would like to get this working with any kind of import.

One thing I noticed is that the fullyQualifiedName of sin changes 
quite a bit depending on whether you use one or the other.


This may be related to either of the following:
https://issues.dlang.org/show_bug.cgi?id=16287
https://issues.dlang.org/show_bug.cgi?id=16023



---

import std.traits : isFunction;

private enum _vectorize(string f) = "
import mir.ndslice.slice : SliceKind, Slice;

auto " ~ f ~ "(SliceKind kind, size_t[] packs, Iterator)
   (Slice!(kind, packs, 
Iterator) slice)

{
import mir.ndslice.topology : map;
return slice.map!(f);
}
";

mixin template vectorize(alias f)
if (isFunction!f)
{
mixin(_vectorize!(__traits(identifier, f)));
}

unittest
{
import std.stdio : writeln;
import mir.ndslice.slice : sliced;
import mir.ndslice.topology : map;
import std.math; //import std.math : sin;

auto x = [0.0, 1.0, 2.0, 3.0].sliced;

auto y = x.map!(sin);
writeln(y);

mixin vectorize!(sin);
auto z = sin(x);
writeln(z);
}


Re: Why free and realloc seem to include .

2017-08-03 Thread Adam D. Ruppe via Digitalmars-d-learn

On Thursday, 3 August 2017 at 15:18:17 UTC, Michael wrote:
I've not seen that either, though I'm not a C++ programmer. 
Does using free() on its own not assume access of a global 
namespace?


Consider the following:

class Foo {
   void free(void*);

   void other_method() {
  free(ptr); // calls the member function
   }
}


The leading dot in D just ensures it calls the global one instead 
of a member (if present).


Re: Why free and realloc seem to include .

2017-08-03 Thread Michael via Digitalmars-d-learn

On Thursday, 3 August 2017 at 14:15:40 UTC, Temtaime wrote:

On Thursday, 3 August 2017 at 14:03:56 UTC, Michael wrote:
So this might be a bit of a stupid question, but looking at 
the DMD source code (dmodule.d in particular) I see the 
following code:



[...]


and I was just wondering why certain functions seem to be 
called using the dot operator on its own, unattached to some 
object. This is probably a naive question but I haven't seen 
this in my limited experience using D and I was just wondering 
why this is. I have only really seen this relating to D's 
manual memory management. But in the same file, I see examples 
like this:



[...]


so what is the case when you should use .free() and why not 
just free()? Thanks.


Dot is equal to C++'s :: operator to access a global namespace.
Aka ::free(ptr);


I've not seen that either, though I'm not a C++ programmer. Does 
using free() on its own not assume access of a global namespace?


Re: Bug in gtkd?

2017-08-03 Thread Mike Wey via Digitalmars-d-learn

On 03-08-17 05:00, Johnson Jones wrote:

On Wednesday, 2 August 2017 at 14:51:45 UTC, Mike Wey wrote:

On 02-08-17 08:04, Johnson Jones wrote:
Ok, Using msys I was able to get glade 3.20 running. Maybe that will 
fix everything.


Great, unfortunately "Use msys2" seems to be the official way to 
install anything GTK related on windows.


... Also, I cannot seem to load a jpg using an imageview

(test.exe:1628): Gtk-WARNING **: Could not load image 
'a.jpg': Couldn't recognize the image file format for file 'a.jpg'


Just a normal jpg. Tried a bmp, same thing. It shows fine in glade itself.



It looks like the pixbuf loaders are missing from the installer.

--
Mike Wey


Re: Visual D 0.45 released - better VS2017 integration

2017-08-03 Thread kinke via Digitalmars-d-announce

On Thursday, 3 August 2017 at 07:04:55 UTC, Rainer Schuetze wrote:
there is a new version 0.45 of Visual D available at 
http://rainers.github.io/visuald/visuald/StartPage.html


Thanks a lot, Rainer.


[Issue 17712] [REG 2.074] [LINK] Undefined reference to std.conv.toChars!(10, char, 1, uint).toChars(uint)

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17712

--- Comment #7 from Johannes Pfau  ---
For reference: the missing symbol also causes a backend ICE for GCC <= 4.9:

https://bugzilla.gdcproject.org/show_bug.cgi?id=157

This is fortunately of lower priority as an (unrelated) GCC change works around
this problem in all new GCC versions. Fortunately we're already at GCC-7
released / GCC-8 in development :-)

--


[Issue 17712] [REG 2.074] [LINK] Undefined reference to std.conv.toChars!(10, char, 1, uint).toChars(uint)

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17712

--- Comment #6 from ki...@gmx.net ---
(In reply to ZombineDev from comment #5)
> > For LDC, I'm planning to allow the user to prevent template culling via a 
> > command-line switch, as the current implementation doesn't seem very mature.
> 
> I think that's what dmd's -allinst switch does currently.

[LDC uses the same logic and command-line switch.] I find it quite hard to tell
the exact difference when using `-allinst` (and whether that includes
speculative ones), as it's an early return of that function and the remaining
needsCodegen() logic isn't trivial; the interaction with the tnext chain
doesn't make it any simpler unfortunately.

--


Re: dlang-requetst: openssl 1.1 compatible release

2017-08-03 Thread ikod via Digitalmars-d-announce

On Thursday, 3 August 2017 at 14:03:02 UTC, aberba wrote:

On Thursday, 3 August 2017 at 10:02:24 UTC, Temtaime wrote:

On Thursday, 3 August 2017 at 09:57:11 UTC, Suliman wrote:

On Thursday, 3 August 2017 at 06:33:38 UTC, ikod wrote:

Hello,

Since version 0.5.0 dlang-requests has become compatible 
with both 1.0.x and 1.1.x versions of openssl library.


Please try and report any issues on github.
Thanks!

dlang-requests is HTTP/FTP client library, inspired by 
python-requests with goals:


small memory footprint
performance
simple, high level API
native D implementation

https://code.dlang.org/packages/requests
https://github.com/ikod/dlang-requests


Vote for including it in Phobos instead curl!


Curl is well-tested and has a great number of features.


So the assumption is that curl has been there since forever, so 
its well tested. Anything new cannot be stable enough for 
everyday use?


If there's anything keeping dlang-requests from been integrated 
into Phobos (or a derivative), then lets report it as a 
bug...cus curl is not convenient to use without some 
abstraction layer.



HTTP is the most used protocol for everything. JavaScript is 
the most used language and pretty much everything done with 
JavaScript has HTTP involved.


Moving any third party code to std library have both "pro" and 
"contra" and it was discussed several times. From my point of 
view there is nothing wrong with modules outside of std library 
as long as these modules are visible to newcomers, well 
documented and have developer support.




Re: Why free and realloc seem to include .

2017-08-03 Thread Temtaime via Digitalmars-d-learn

On Thursday, 3 August 2017 at 14:03:56 UTC, Michael wrote:
So this might be a bit of a stupid question, but looking at the 
DMD source code (dmodule.d in particular) I see the following 
code:



if (srcfile._ref == 0)
   .free(srcfile.buffer);
srcfile.buffer = null;
srcfile.len = 0;


and I was just wondering why certain functions seem to be 
called using the dot operator on its own, unattached to some 
object. This is probably a naive question but I haven't seen 
this in my limited experience using D and I was just wondering 
why this is. I have only really seen this relating to D's 
manual memory management. But in the same file, I see examples 
like this:



FileName.free(n);


so what is the case when you should use .free() and why not 
just free()? Thanks.


Dot is equal to C++'s :: operator to access a global namespace.
Aka ::free(ptr);


Re: Access derived type in baseclass static function template

2017-08-03 Thread Timoses via Digitalmars-d-learn
On Wednesday, 2 August 2017 at 15:38:12 UTC, Steven Schveighoffer 
wrote:

On 8/2/17 11:06 AM, Timoses wrote:
On Wednesday, 2 August 2017 at 13:51:01 UTC, Steven 
Schveighoffer wrote:
However, your original code has potential as an enhancement 
request, as the type is known at compile-time and could 
certainly be resolved to pass in as the `this` template 
parameter.


I guess the `this` is really misleading it being a static 
method.
I suppose 
https://issues.dlang.org/buglist.cgi?bug_severity=enhancement_status=NEW_status=ASSIGNED_status=REOPENED=D_format=report-table_axis_field=bug_severity would be the place for an enhancement request?

Possibly related:
https://issues.dlang.org/show_bug.cgi?id=14191


Yes, that's exactly it.

Note that typeof(this) has special meaning for static methods:

class C
{
   static typeof(this) foo() { return new typeof(this); }
}

So there is precedence for the meaning of `this` in a static 
context.


-Steve


Oh, just now get it after creating the issue ^^. Makes sense. I 
kind of connected the "this" to existing instances because the 
DMD compiler often complains about something like "need this 
for..." when calling something from a static method that... 
well... needs "this" or instantiation..

E.g.:

class A
{
static void a()
{
b();
}
void b();
}

will throw
  Error: need 'this' for 'b' of type 'void()'


[Issue 17712] [REG 2.074] [LINK] Undefined reference to std.conv.toChars!(10, char, 1, uint).toChars(uint)

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17712

--- Comment #5 from ZombineDev  ---
> For LDC, I'm planning to allow the user to prevent template culling via a 
> command-line switch, as the current implementation doesn't seem very mature.

I think that's what dmd's -allinst switch does currently.

--


[Issue 17712] [REG 2.074] [LINK] Undefined reference to std.conv.toChars!(10, char, 1, uint).toChars(uint)

2017-08-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17712

ki...@gmx.net changed:

   What|Removed |Added

 CC||ki...@gmx.net

--- Comment #4 from ki...@gmx.net ---
LDC ran into the same issue when moving to Phobos 2.074. I ended up switching
from individual druntime/Phobos object file compilation to all-D-files-at-once
compilation (like DMD), as that reduces the template instantiation culling [1].
See LDC PR [2].

This template culling, in combination with restructured Phobos, also leads to
sometimes dramatic performance decreases due to less inlining potential with
non-instantiated (culled) templates, rendering cross-module-inlining/LTO
essential for best performance. See this (lenghty but interesting) LDC issue
[3]. There's a link to a Weka.io-specific patch where they had to disable the
culling due to linker errors.

For LDC, I'm planning to allow the user to prevent template culling via a
command-line switch, as the current implementation doesn't seem very mature.

[1]:
https://github.com/dlang/dmd/blob/v2.075.0/src/ddmd/dtemplate.d#L7197-L7205
[2]: https://github.com/ldc-developers/ldc/pull/2076#issuecomment-315175464
[3]: https://github.com/ldc-developers/ldc/issues/2168

--


Re: Access derived type in baseclass static function template

2017-08-03 Thread Timoses via Digitalmars-d-learn

On Wednesday, 2 August 2017 at 12:07:46 UTC, Timoses wrote:

Hey,

wondering whether it's possible to access the derived type from 
a function template in the base class or interface.


[...]


Created an enhancement issue:

https://issues.dlang.org/show_bug.cgi?id=17714


Re: dlang-requetst: openssl 1.1 compatible release

2017-08-03 Thread aberba via Digitalmars-d-announce

On Thursday, 3 August 2017 at 10:02:24 UTC, Temtaime wrote:

On Thursday, 3 August 2017 at 09:57:11 UTC, Suliman wrote:

On Thursday, 3 August 2017 at 06:33:38 UTC, ikod wrote:

Hello,

Since version 0.5.0 dlang-requests has become compatible with 
both 1.0.x and 1.1.x versions of openssl library.


Please try and report any issues on github.
Thanks!

dlang-requests is HTTP/FTP client library, inspired by 
python-requests with goals:


small memory footprint
performance
simple, high level API
native D implementation

https://code.dlang.org/packages/requests
https://github.com/ikod/dlang-requests


Vote for including it in Phobos instead curl!


Curl is well-tested and has a great number of features.


So the assumption is that curl has been there since forever, so 
its well tested. Anything new cannot be stable enough for 
everyday use?


If there's anything keeping dlang-requests from been integrated 
into Phobos (or a derivative), then lets report it as a bug...cus 
curl is not convenient to use without some abstraction layer.



HTTP is the most used protocol for everything. JavaScript is the 
most used language and pretty much everything done with 
JavaScript has HTTP involved.


  1   2   >