Re: Button: A fast, correct, and elegantly simple build system.

2016-06-16 Thread Jason White via Digitalmars-d-announce

On Thursday, 16 June 2016 at 13:39:20 UTC, Atila Neves wrote:
It would be a worthwhile trade-off, if those were the only two 
options available, but they're not. There are multiple build 
systems out there that do correct builds whilst being faster 
than make. Being faster is easy, because make is incredibly 
slow.


I didn't even find out about ninja because I read about it in a 
blog post, I actively searched for a make alternative because I 
was tired of waiting for it.


Make is certainly not slow for full builds. That is what I was 
testing.


I'm well aware of Ninja and it is maybe only 1% faster than Make 
for full builds[1]. There is only so much optimization that can 
be done when spawning processes as dictated by a DAG. 99% of the 
CPU's time is spent on running the tasks themselves.


Where Make gets slow is when checking for changes on a ton of 
files. I haven't tested it, but I'm sure Button is faster than 
Make in this case because it checks for changed files using 
multiple threads. Using the file system watcher can also bring 
this down to a near-zero time.


Speed is not the only virtue of a build system. A build system 
can be amazeballs fast, but if you can't rely on it doing 
incremental builds correctly in production, then you're probably 
doing full builds every single time. Being easy to use and robust 
is also pretty important.


[1] 
http://hamelot.io/programming/make-vs-ninja-performance-comparison/


Re: OpenGL Setup?

2016-06-16 Thread Peter Lewis via Digitalmars-d-learn

On Thursday, 16 June 2016 at 19:52:58 UTC, OpenJelly wrote:
I just want to install an IDE that's not prone to crashing and 
comes with standard features like D syntax highlighting, code 
completion, code folding, side bar with my project's directory, 
integrated console, bindable key commands (build (with dub), 
run, stop), and some debugging help doesn't hurt but I can get 
by without being able to set break points... and then I need to 
get the right libs and bindings in order nut half of them I 
can't figure out the instructions for.


I sadly can't help you there, as I use Vim. But i do have a basic 
set up of GLFW. It's for mac but it should be too hard to make it 
work for windows.


On Thursday, 16 June 2016 at 19:52:58 UTC, OpenJelly wrote:
If anyone's got a solid setup and can explain to me like I'm 5 
how they got it all nice, that'd really help me out a lot. 
Thanks.

If you have any questions about my code, just ask.



Re: ARSD PNG memory usage

2016-06-16 Thread Joerg Joergonson via Digitalmars-d-learn

On Friday, 17 June 2016 at 04:32:02 UTC, Adam D. Ruppe wrote:

On Friday, 17 June 2016 at 01:51:41 UTC, Joerg Joergonson wrote:
Are you keeping multiple buffers of the image around? A 
trueimage, a memoryimage, an opengl texture


MemoryImage and TrueImage are the same thing, memory is just 
the interface, true image is the implementation.


OpenGL texture is separate, but it references the same memory 
as a TrueColorImage, so it wouldn't be adding.




ok, then it's somewhere in TrueColorImage or the loading of the 
png.




You might have pinned temporary buffers though. That shouldn't 
happen on 64 bit, but on 32 bit I have seen it happen a lot.




Ok, IIRC LDC both x64 and x86 had high memory usage too, so if it 
shouldn't happen on 64-bit(if it applies to ldc), this then is 
not the problem. I'll run a -vgc on it and see if it shows up 
anything interesting.


When I do a bare loop minimum project(create2dwindow + event 
handler) I get 13% cpu(on 8-core skylake 4ghz) and 14MB memory.


I haven't seen that here but I have a theory now: you have 
some pinned temporary buffer on 32 bit (on 64 bit, the GC would 
actually clean it up) that keeps memory usage near the 
collection boundary.


Again, it might be true but I'm pretty sure I saw the problem 
with ldc x64.


Then, a small allocation in the loop - which shouldn't be 
happening, I don't see any in here... - but if there is a small 
allocation I'm missing, it could be triggering a GC collection 
cycle each time, eating CPU to scan all that wasted memory 
without being able to free anything.




Ok, Maybe... -vgc might show that.

If you can run it in the debugger and just see where it is by 
breaking at random, you might be able to prove it.




Good idea, not thought about doing that ;) Might be a crap shoot 
but who knows...


That's a possible theory I can reproduce the memory usage 
here, but not the CPU usage though. Sitting idle, it is always 
<1% here (0 if doing nothing, like 0.5% if I move the mouse in 
the window to generate some activity)


 I need to get to bed though, we'll have to check this out in 
more detail later.


me too ;) I'll try to test stuff out a little more when I get a 
chance.




Thanks!  Also, when I try to run the app in 64-bit windows, 
RegisterClassW throws for some reason ;/ I haven't been able 
to figure that one out yet ;/


err this is a mystery to me too... a hello world on 64 bit 
seems to work fine, but your program tells me error 998 
(invalid memory access) when I run it. WTF, both register class 
the same way.


I'm kinda lost on that.


Well, It works on LDC x64! again ;) This seems like an issue with 
DMD x64? I was thinking maybe it has to do the layout of the 
struct or something, but not sure.


---

I just run a quick test:

LDC x64 uses about 250MB and 13% cpu.

I couldn't check on x86 because of the error

phobos2-ldc.lib(gzlib.c.obj) : fatal error LNK1112: module 
machine type 'x64' conflicts with target machine type 'X86'


not sure what that means with gzlib.c.ojb. Must be another bug in 
ldc alpha ;/



Anyways, We'll figure it all out at some point ;) I'm really 
liking your lib by the way. It's let me build a gui and get a lot 
done and just "work". Not sure if it will work on X11 with just a 
recompile, but I hope ;)




Re: Button: A fast, correct, and elegantly simple build system.

2016-06-16 Thread Jason White via Digitalmars-d-announce

On Thursday, 16 June 2016 at 12:34:26 UTC, Kagamin wrote:

On Sunday, 12 June 2016 at 23:27:07 UTC, Jason White wrote:
However, I question the utility of even doing this in the 
first place. You miss out on the convenience of using the 
existing command line interface.


Why the build script can't have a command line interface?


It could, but now the build script is a more complicated and for 
little gain. Adding command line options on top of that to 
configure the build would be painful.


It would be simpler and cleaner to write a D program to generate 
the JSON build description for Button to consume. Then you can 
add a command line interface to configure how the build 
description is generated. This is how the Lua build descriptions 
work[1].


[1] 
http://jasonwhite.github.io/button/docs/tutorial#going-meta-building-the-build-description


Re: ARSD PNG memory usage

2016-06-16 Thread Adam D. Ruppe via Digitalmars-d-learn

On Friday, 17 June 2016 at 01:51:41 UTC, Joerg Joergonson wrote:
Are you keeping multiple buffers of the image around? A 
trueimage, a memoryimage, an opengl texture


MemoryImage and TrueImage are the same thing, memory is just the 
interface, true image is the implementation.


OpenGL texture is separate, but it references the same memory as 
a TrueColorImage, so it wouldn't be adding.



You might have pinned temporary buffers though. That shouldn't 
happen on 64 bit, but on 32 bit I have seen it happen a lot.


When I do a bare loop minimum project(create2dwindow + event 
handler) I get 13% cpu(on 8-core skylake 4ghz) and 14MB memory.


I haven't seen that here but I have a theory now: you have 
some pinned temporary buffer on 32 bit (on 64 bit, the GC would 
actually clean it up) that keeps memory usage near the collection 
boundary.


Then, a small allocation in the loop - which shouldn't be 
happening, I don't see any in here... - but if there is a small 
allocation I'm missing, it could be triggering a GC collection 
cycle each time, eating CPU to scan all that wasted memory 
without being able to free anything.


If you can run it in the debugger and just see where it is by 
breaking at random, you might be able to prove it.


That's a possible theory I can reproduce the memory usage 
here, but not the CPU usage though. Sitting idle, it is always 
<1% here (0 if doing nothing, like 0.5% if I move the mouse in 
the window to generate some activity)


 I need to get to bed though, we'll have to check this out in 
more detail later.



Thanks!  Also, when I try to run the app in 64-bit windows, 
RegisterClassW throws for some reason ;/ I haven't been able to 
figure that one out yet ;/


err this is a mystery to me too... a hello world on 64 bit 
seems to work fine, but your program tells me error 998 (invalid 
memory access) when I run it. WTF, both register class the same 
way.


I'm kinda lost on that.


Re: Garbage Collector

2016-06-16 Thread Jonathan Marler via Digitalmars-d

On Wednesday, 15 June 2016 at 13:38:33 UTC, ketmar wrote:

On Wednesday, 15 June 2016 at 13:19:31 UTC, Konstantin wrote:

I don’t believe a community is capable of creating a good GC.


you are wrong. and you definitely know nothing about garbage 
collection, virtual machines and code generation. i wonder why 
people keep coming with "suggestions" and "solutions" without 
even a small knowledge in problem field.


That's pretty harsh Ketmar.  It's obvious he knows the general 
ideas and was just wondering if using the .NET GC was a viable 
option.  I think responding to others in such a demeaning way is 
harmful to the D community as it isolates people.  It doesn't 
encourage people to be curious or want to start a discussion.  
Having people, especially newcomers to D come in and make 
suggestions and solutions is a great thing for a community.  It 
means they saw enough potential in the language to want to know 
more and maybe even how they could contribute.


Re: ARSD PNG memory usage

2016-06-16 Thread Adam D. Ruppe via Digitalmars-d-learn

On Friday, 17 June 2016 at 02:55:43 UTC, thedeemon wrote:
I've bumped into this previously. It allocates a lot of 
temporary arrays for decoded chunks of data, and I managed to 
reduce those allocations a bit, here's the version I used:


If you can PR any of it to me, I'll merge.

It actually has been on my todo list for a while to change the 
decoder to generate less garbage. I have had trouble in the past 
with temporary arrays being pinned by false pointers and the 
memory use ballooning from that, and the lifetime is really easy 
to manage so just malloc/freeing it would be an easy solution, 
just like you said, std.zlib basically sucks so I have to use the 
underlying C functions and I just haven't gotten around to it.





Re: Garbage Collector

2016-06-16 Thread thedeemon via Digitalmars-d

On Wednesday, 15 June 2016 at 13:19:31 UTC, Konstantin wrote:

Has anyone thought about taking GC from .NET and reusing it in 
D?


One significant point has been already mentioned: cost of write 
barriers.
I'd like to mention another factor: .NET GC is a copying one, it 
moves data around. One good feature of current D is it never 
moves data, so you can very easily call C and C++ code and pass 
pointers to your buffers and stuff and C/C++ code just takes 
these pointers and works with them as usual. No pinning, no 
marshaling, zero overhead. If you take a moving GC like .NET's, 
you immediately make all C/C++ interaction much harder, now you 
need to worry about pinning stuff or copying "managed" data to 
"unmanaged" memory and back. This is all costly both in terms of 
CPU cycles and of programmer cycles. You'll need "FFI", what most 
other GC-ed languages have to have, and D doesn't.


Re: Accessing COM Objects

2016-06-16 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 21:06:01 UTC, Joerg Joergonson 
wrote:

Ok, I've tried things like uncommenting

	Document Open(BSTR Document, VARIANT As, VARIANT 
AsSmartObject);

void Load(BSTR Document);

/*[id(0x70537673)]*/ BSTR get_ScriptingVersion();
  /*[id(0x70464D4D)]*/ double get_FreeMemory();
  /*[id(0x76657273)]*/ BSTR get_Version();
and everything crashes with bad reference.
...
My thinking is that CoCreateinstance is suppose to give us a 
pointer to the interface so we can use it, if all this stuff is 
crashing does that mean the interface is invalid or not being 
assigned properly or is there far more to it than this?


First of all, you can't just comment/uncomment parts of COM 
interface descriptions. Each COM interface has some specific 
layout of its functions, and if you list them in wrong order or 
skip some of them the virtual methods table gets completely 
screwed up, so you think you call one method but end up calling 
another, because you intended to call method #12 and instead 
called method #4. COM interface definitions in D must match their 
definitions in IDL exactly. One omission of a method, one mistake 
in its type, and you're fucked.


Re: ARSD PNG memory usage

2016-06-16 Thread thedeemon via Digitalmars-d-learn

On Friday, 17 June 2016 at 01:51:41 UTC, Joerg Joergonson wrote:
Hi, so, do you have any idea why when I load an image with 
png.d it takes a ton of memory?


I've bumped into this previously. It allocates a lot of temporary 
arrays for decoded chunks of data, and I managed to reduce those 
allocations a bit, here's the version I used:

http://stuff.thedeemon.com/png.d
(last changed Oct 2014, so may need some tweaks today)

But most of allocations are really caused by using std.zlib. This 
thing creates tons of temporary arrays/slices and they are not 
collected well by the GC. To deal with that I had to use GC 
arenas for each PNG file I decode. This way all the junk created 
during PNG decoding is eliminated completely after the decoding 
ends. See gcarena module here:

https://bitbucket.org/infognition/dstuff
You may see Adam's PNG reader was really the source of motivation 
for it. ;)


ARSD PNG memory usage

2016-06-16 Thread Joerg Joergonson via Digitalmars-d-learn
Hi, so, do you have any idea why when I load an image with png.d 
it takes a ton of memory?


I have a 3360x2100 that should take around 26mb of memory 
uncompressed and a bunch of other smaller png files.


Are you keeping multiple buffers of the image around? A 
trueimage, a memoryimage, an opengl texture thing that might be 
in main memory, etc? Total file space of all the images is only 
about 3MB compressed and 40MB uncompressed. So it's using around 
10x more memory than it should! I tried a GC collect and all that.


I don't think my program will have a chance in hell using that 
much memory. That's just a few images for gui work. I'll be 
loading full page png's later on that might have many pages(100+) 
that I would want to pre-cache. This would probably cause the 
program to use TB's of space.


I don't know where to begin diagnosing the problem. I am using 
openGL but I imagine that shouldn't really allocate anything new?


I have embedded the images using `import` but that shouldn't 
really add much size(since it is compressed) or change things.


You could try it out yourself on a test case to see? (might be a 
windows thing too) Create a high res image(3000x3000, say) and 
load it like


auto eImage = cast(ubyte[])import("mylargepng.png");

TrueColorImage image = 
imageFromPng(readPng(eImage)).getAsTrueColorImage;	
OpenGlTexture oGLimage = new OpenGlTexture(image); // Will crash 
without create2dwindow

//oGLimage.draw(0,0,3000,3000);


When I do a bare loop minimum project(create2dwindow + event 
handler) I get 13% cpu(on 8-core skylake 4ghz) and 14MB memory.


When I add the code above I get 291MB of memory(for one image.

Here's the full D code source:


module winmain;

import arsd.simpledisplay;
import arsd.png;
import arsd.gamehelpers;

void main()
{

auto window = create2dWindow(1680, 1050, "Test");

auto eImage = cast(ubyte[])import("Mock.png");

		TrueColorImage image = 
imageFromPng(readPng(eImage)).getAsTrueColorImage;   // 178MB	

OpenGlTexture oGLimage = new OpenGlTexture(image);   // 
291MB
//oGLimage.draw(0,0,3000,3000);

window.eventLoop(50,
delegate ()
{
window.redrawOpenGlSceneNow();
},

);
}

Note that I have modified create2dWindow to take the viewport and 
set it to 2x as large in my own code(I removed here). It 
shouldn't matter though as it's the png and OpenGlTexture that 
seem to have the issue.


Surely once the image is loaded by opengl we could potentially 
disregard the other images and virtually no extra memory would be 
required? I do use getpixel though, not sure it that could be 
used on OpenGLTexture's? I don't mind keeping a main memory copy 
though but I just need it to have a realistic size ;)


So two problems: 1 is the cpu usage, which I'll try to get more 
info on my side when I can profile and 2 is the 10x memory usage. 
If it doesn't happen on your machine can you try alternate(if 
'nix, go for win, or vice versa). This way we can get an idea 
where the problem might be.


Thanks!  Also, when I try to run the app in 64-bit windows, 
RegisterClassW throws for some reason ;/ I haven't been able to 
figure that one out yet ;/















[Issue 14532] switch block allows creating uninitialized variables

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14532

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

https://github.com/dlang/dmd/commit/1a26535fd627ca398d2609228bce20905440360d
fix Issue 14532 - switch block allows creating uninitialized variables

https://github.com/dlang/dmd/commit/039853c2a752c9bc3bef770610ac04cadbdeb51f
Merge pull request #5869 from WalterBright/fix14523

fix Issue 14532 - switch block allows creating uninitialized variables

--


[Issue 10524] Switch skips initialization of 'with' variable

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10524
Issue 10524 depends on issue 14532, which changed state.

Issue 14532 Summary: switch block allows creating uninitialized variables
https://issues.dlang.org/show_bug.cgi?id=14532

   What|Removed |Added

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

--


std.parallelism.taskPool daemon threads not terminating

2016-06-16 Thread Moritz Maxeiner via Digitalmars-d-learn

So, I am probably overlooking something obvious, but here goes:
According to my understanding of daemon threads and what is 
documented here[1],
this following program should terminate once the druntime shuts 
down, as the thread working on the task is supposed to be a 
daemon thread:



import std.parallelism;

void main()
{
taskPool.put(task({ while(true) {} }));
}


The actual behaviour (with dmd 2.071 and ldc2 1.0.0), however, is 
that the program keeps running.


In contract, this behaves as expected:


import core.thread;

void main()
{
   with (new Thread({ while(true) {} })) {
   isDaemon = true;
   start();
   }
}


Commenting out setting the isDaemon property will achieve the 
same behaviour as the taskPool example. Is this the intended 
behaviour of taskPool (because it does have isDaemon set)?



[1] https://dlang.org/library/std/parallelism/task_pool.html


[Issue 16178] New: Can't alias a mixin

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16178

  Issue ID: 16178
   Summary: Can't alias a mixin
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: minor
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: hba...@hotmail.com

A brief sample:

alias foo = mixin(bar!T);

where var!T returns the name of a valid variable, and thus mixin' it provides
access to said variable.

The previous code won't compile:

Error: basic type expected, not mixin

There is a known workaround around this issue:

alias hack(alias a) = a;
alias foo = hack!(mixin(bar!T));

But clearly it shouldn't have to be done like this.

--


[Issue 12527] Cannot make @system function/delegate alias in a @safe section

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12527

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

   What|Removed |Added

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

--


[Issue 12527] Cannot make @system function/delegate alias in a @safe section

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12527

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

https://github.com/dlang/dmd/commit/b33039ba827142547bf9107007154abea54c9c23
fix Issue 12527 - Cannot make @system function/delegate alias in a @safe
section

https://github.com/dlang/dmd/commit/b67694a0d74437d3a1581da2b9f1b785dc7b3c88
Merge pull request #5867 from WalterBright/fix12527

fix Issue 12527 - Cannot make @system function/delegate alias in a @s…

--


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread tsbockman via Digitalmars-d

On Thursday, 16 June 2016 at 22:30:48 UTC, Walter Bright wrote:

Andrei is in charge of the library and has my full support.

We've talked many times about raising the bar much higher on 
Phobos. It's a tough competitive environment for programming 
languages out there, and we should all expect the review 
process going forward for Phobos to be brutal.


On the other hand, getting an endorsement from Andrei for a 
design is something anyone should be proud of, and I suspect 
will be worth the blood, sweat and tears.


I know my own code has gotten a lot better from Andrei's 
professional criticism.


There are many ways to go about "raising the bar"; making Andrei 
the sole arbiter of a design's quality will not necessarily 
accomplish this, but will make the need for constant 
communication with him a major bottleneck for development, 
regardless. It also risks making him into a single point of 
failure.


I do not think this approach will scale in the long run, no 
matter who is given that role. Of course, I would be happy to be 
proven wrong.




[Issue 11047] UDA + getAttributes bypass purity/safety check

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11047

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

https://github.com/dlang/dmd/commit/55bd78ded94a1f40ee80c4e42791f216e5d58c41
fix Issue 11047 - UDA + getAttributes bypass purity/safety check

https://github.com/dlang/dmd/commit/d1c3b6a1eab3347d9b6eb832b99ee45f70bd3702
Merge pull request #5863 from WalterBright/fix11047

fix Issue 11047 - UDA + getAttributes bypass purity/safety check

--


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread Walter Bright via Digitalmars-d

On 6/16/2016 2:11 PM, tsbockman wrote:

My problem with `checkedint` was that I formed a wrong idea of whose approval I
needed (interested Phobos devs collectively, versus Andrei specifically).


Andrei is in charge of the library and has my full support.

We've talked many times about raising the bar much higher on Phobos. It's a 
tough competitive environment for programming languages out there, and we should 
all expect the review process going forward for Phobos to be brutal.


On the other hand, getting an endorsement from Andrei for a design is something 
anyone should be proud of, and I suspect will be worth the blood, sweat and tears.


I know my own code has gotten a lot better from Andrei's professional criticism.


[Issue 16177] New: Inner exception cannot be caught by specific type; becomes a collateral of the original exception

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16177

  Issue ID: 16177
   Summary: Inner exception cannot be caught by specific type;
becomes a collateral of the original exception
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: acehr...@yahoo.com

(This may be related to bug 15467.)

The inner exception cannot be caught by its own specific type. Because of that,
it becomes a collateral of the original exception.

/*
This BUG manifests itself on two conditions:

1) scope statement in main() must be 'exit' (change it to
   'failure' and there is no bug.)

2) bar() must catch by specific exception type Bar (alias
   TypeToCatch to Exception or Throwable in bar() and there is no
   bug.)
*/

class Foo : Exception { this() { super("Foo"); } }
class Bar : Exception { this() { super("Bar"); } }

void main() {
/* First, a sanity check that bar() does indeed handle its
 * own exception. */
bar();

try {
/* bar() will throw and handle it's own exception while a
 * Foo is in flight. */
scope (exit) bar();

/* This exception will be in flight while bar() throws
 * and handles its own exception. */
throw new Foo();

} catch (Foo e) {
/* Since bar() has supposedly handled its own exception,
 * we expect no collateral exception here.  */

assert(e.next is null);// THIS ASSERT FAILS
}
}

void bar() {
bool caught = false;

alias TypeToCatch = Bar;

try {
throw new Bar();

} catch (TypeToCatch e) {
caught = true;
}

assert(caught);
}

Ali

--


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread Jack Stouffer via Digitalmars-d

On Thursday, 16 June 2016 at 21:52:16 UTC, Walter Bright wrote:

https://www.digitalmars.com/sargon/halffloat.html


Your HTTPS cert seems to be broken



Re: Telegram Supergroup as an alternative to IRC

2016-06-16 Thread Dechcaudron via Digitalmars-d

On Thursday, 16 June 2016 at 17:22:47 UTC, Adam D. Ruppe wrote:
What clients are you using? You might look into another one and 
there's also the bots on the D irc that can help with other 
things, like ".note somebody the bot will give them this 
message when they are next active"


I think chat things accumulate too many features though... they 
lose their value if they aren't simple, I prefer email for 
anything more complex than throw-away lines.


Telegram is dead simple. Things like straight mentioning a user, 
"complex" in IRC if you don't have a proper client, can be done 
in telegram with a right click.


I understand many of you won't be interested. For the rest, the 
supergroup is already up. Just enter 
https://telegram.me/dlangTelegram


We're only two people so far, but don't push it, these things 
take time. For me, it's way more convenient to use Telegram than 
any IRC.


Cheers!


Re: Areas of D usage

2016-06-16 Thread crimaniak via Digitalmars-d

On Wednesday, 15 June 2016 at 20:01:09 UTC, Seb wrote:
...
The initial version is online now & please feel invited to 
improve upon this document:


http://dlang.org/areas-of-d-usage.html
 As engineer I don't like gears in the 'Embedded applications' 
paragraph: they are not match.




Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread Walter Bright via Digitalmars-d

On 6/16/2016 6:56 AM, Steven Schveighoffer wrote:

I understand your frustration. All I can say is, open source contributors have
to have a thicker skin (and I'm not saying you don't). We are all human and have
our faults, and any team in any context can have miscommunication, or
misunderstandings. I can assure you it's not the plan to waste people's time or
to cause frustration. Even with a mitigating plan in place, these can happen.
Have a plan that you can control, with a viable path if the things you can't
don't go your way.


+1

Also, if it isn't approved for Phobos, that doesn't necessarily mean the work is 
wasted. Dub is full of add on libraries, add it there. Approval from others is 
not necessary.


My own Sargon is for things I wrote that were not approved for Phobos for one 
reason or another:


https://www.digitalmars.com/sargon/halffloat.html

Work is wasted only when the author gives up on it.



Re: Linux and htod

2016-06-16 Thread yawniek via Digitalmars-d-learn

On Thursday, 16 June 2016 at 19:04:38 UTC, bachmeier wrote:

On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote:
How people use it on Linux, if htod is required to import C 
libraries and windows only?f


Just to clarify, so as to prevent confusion by someone that 
randomly stumbles across this post, you do not need htod, 
dstep, or any other tool to call C libraries from D. dstep 
generates bindings to C libraries for you.


You can create the bindings yourself in your D source files, 
and if you only want to call a couple of functions from a 
particular C library, that's the most convenient. 
http://dlang.org/spec/interfaceToC.html


The wording of the question implies that one of these tools is 
required to call into C libraries, which is not correct.


https://wiki.dlang.org/D_binding_for_C is also helpful
they should be put together.




[Issue 14496] void initialization of member with indirections must not be @safe

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14496

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

https://github.com/dlang/dmd/commit/fdfa834382f0fbd1486bd261df042e589dc29676
fix Issue 14496 - void initialization of member with indirections must not be
@safe

https://github.com/dlang/dmd/commit/3309b7adbb86b26240fcf473a3c6a57315304eec
Merge pull request #5861 from WalterBright/fix14496

fix Issue 14496 - void initialization of member with indirections mus…

--


[Issue 14496] void initialization of member with indirections must not be @safe

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14496

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

   What|Removed |Added

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

--


Re: OpenGL Setup?

2016-06-16 Thread wobbles via Digitalmars-d-learn

On Thursday, 16 June 2016 at 19:52:58 UTC, OpenJelly wrote:
Last time I worked on anything OpenGL in D I was using a Linux 
machine, and I had to really bend over backward to get set up. 
I'm using Windows 7 at the moment and I'd like to work on some 
graphics stuff but I'm pretty lost...


I just want to install an IDE that's not prone to crashing and 
comes with standard features like D syntax highlighting, code 
completion, code folding, side bar with my project's directory, 
integrated console, bindable key commands (build (with dub), 
run, stop), and some debugging help doesn't hurt but I can get 
by without being able to set break points... and then I need to 
get the right libs and bindings in order nut half of them I 
can't figure out the instructions for.


What I've been trying to do for the past few hours is set up 
SublimeText3 with dub and get the derelictGLFW3 binding to 
work, but I can't even get dkit working, and I'd honestly 
rather be using code::blocks but I've had trouble getting D 
code completion working in that before, and while I could 
probably get SFML bindings to work (as their documentation 
caters to idiots like me), I don't really want to use it, I 
just want something small that handles an OpenGL window without 
the other stuff.


If anyone's got a solid setup and can explain to me like I'm 5 
how they got it all nice, that'd really help me out a lot. 
Thanks.


I notice the ST3 plugin was a bit... flaky the last time I tried 
it (admittedly about 6 months ago).


I ended up settling on vim with a few plugins (and live without 
auto-complete, it's not that important for me), but when I was 
using GUI text editors, I settled on VS Code with the code-d 
plugin. Its autocomplete etc worked pretty much out of the box 
for me.


https://code.visualstudio.com/
https://marketplace.visualstudio.com/items?itemName=webfreak.code-d

Make sure you follow the 'dependencies' section of code-d through 
though to get your env set up. It worked outta the box for me, on 
both windows and linux.


You can get VS Code to compile via ctrl+B (I think that was the 
shortcut) but you've to make a modification to a json file to 
tell it to do it.


If you need more help let me know and I'll write up something 
proper for you.


Cheers!


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread tsbockman via Digitalmars-d

On Thursday, 16 June 2016 at 21:02:32 UTC, Walter Bright wrote:

On 6/15/2016 8:56 PM, tsbockman wrote:

Pull requests are routinely reviewed in an upside-down fashion:

1) Formatting
2) Typos
3) Names
4) Tests (and names again)
6) Docs (and names)
8) Design (and more about names)
9) Does this even belong in Phobos?


It's a consequence of starting to read a document cold, i.e. 
the first thing noticed is the formatting, then the typos, then 
the names, etc.


A deep understanding of the design comes much later, only after 
having thoroughly read it and hit all the speedbumps of typos, 
etc.


Yes I understand - it's a very natural thing to do (and I have 
done it myself).


I think my suggestion fundamentally boils down to, "Try to 
communicate to submitters early on who needs to approve their 
change, and that they may delay addressing all the lesser issues 
until after their basic proposal has been (tentatively) approved."


My problem with `checkedint` was that I formed a wrong idea of 
whose approval I needed (interested Phobos devs collectively, 
versus Andrei specifically).




[Issue 13536] Union of delegates breaks @safety

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13536

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

   What|Removed |Added

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

--


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread Walter Bright via Digitalmars-d

On 6/15/2016 8:56 PM, tsbockman wrote:

Pull requests are routinely reviewed in an upside-down fashion:

1) Formatting
2) Typos
3) Names
4) Tests (and names again)
6) Docs (and names)
8) Design (and more about names)
9) Does this even belong in Phobos?


It's a consequence of starting to read a document cold, i.e. the first thing 
noticed is the formatting, then the typos, then the names, etc.


A deep understanding of the design comes much later, only after having 
thoroughly read it and hit all the speedbumps of typos, etc.




[Issue 13536] Union of delegates breaks @safety

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13536

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

https://github.com/dlang/dmd/commit/8e480a56f514284d919e894c103288dda67ea243
fix Issue 13536 - Union of delegates breaks @safety

https://github.com/dlang/dmd/commit/82fa43ff6cdea746aa626af1f8bc1ac52b228e90
Merge pull request #5859 from WalterBright/fix13536

fix Issue 13536 - Union of delegates breaks @safety

--


Re: Debugging D in windows

2016-06-16 Thread moe via Digitalmars-d-debugger

On Thursday, 16 June 2016 at 07:40:17 UTC, moe wrote:

On Wednesday, 15 June 2016 at 21:05:43 UTC, moe wrote:
Thanks for the info! I will try it tomorrow, when I have some 
time and give some feedback then.


Ok, I have tried your suggestions. And I also followed these 
instructions: http://dlang.org/dmd-windows.html#environment



I can't get passed this error:
LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'
--- errorlevel 1104

I have also tried to change the environment variables to:
LIB=C:\dmd2\lib;\dm\lib;C:\Program Files (x86)\Microsoft Visual 
Studio 10.0\VC\lib\amd64


so that a path to the 'LIBCMT.lib' is included.

I still seam to be missing something, but I can't figure out 
what. Can you give me one more hint?



I still can't get past this error. It might be worth mentioning 
that the problem only occurs when building for 64bit with the 
-m64 flag. Is this a known issue? Does D have problems with 64bit 
on windows?


[Issue 12939] More uniform error messages for not nothrow and not @safe functions

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12939

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

https://github.com/dlang/dmd/commit/72e82e63d478b6f6d095255b020169a25b12154e
partially address Issue 12939

https://github.com/dlang/dmd/commit/35909fa6a77177147559255737517e041d4ff014
Merge pull request #5846 from WalterBright/fix12939

partially address Issue 12939

--


[Issue 12939] More uniform error messages for not nothrow and not @safe functions

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12939

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

   What|Removed |Added

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

--


Re: const types can't be specialized non-const, if arrays?

2016-06-16 Thread Steven Schveighoffer via Digitalmars-d-learn

On 6/16/16 3:43 PM, cy wrote:

I don't get it. Do I have to write a separate template for arrays
specifically or something?

NonConst foo(Constant: const NonConst, NonConst)(Constant bar) {
pragma(msg,"NonConst is ",NonConst);
pragma(msg,"Constant is ",Constant);
NonConst foo = bar;
return foo;
}

void main() {
const int bar = 42;
auto baz = foo(bar);
pragma(msg,typeof(baz));
baz = 23;
const(int[]) barr = [1,2,3];
auto bazz = foo(barr);
pragma(msg,typeof(bazz));
bazz[0] = 4;

}

/*

NonConst is int
Constant is const(int)
int
NonConst is const(int)[]
Constant is const(int)[]
const(int)[]
derp.d(16): Error: cannot modify const expression bazz[0]
Failed: ["dmd", "-v", "-o-", "derp.d", "-I."]

*/



1. Because const(int)[] is not the same as const(int[]). The former is a 
*mutable* array of *constant* integers.
2. Yes, I see that you passed in const(int[]). IFTI was changed a while 
back to automatically convert to tail-const versions when implying 
parameters (to save on template bloat). So it deduces "Constant" to be 
const(int)[].


Also, note that you cannot assign a const item containing references to 
a non-const version of it. So even if NonConst was properly deduced, the 
function would fail to compile.


-Steve


OpenGL Setup?

2016-06-16 Thread OpenJelly via Digitalmars-d-learn
Last time I worked on anything OpenGL in D I was using a Linux 
machine, and I had to really bend over backward to get set up. 
I'm using Windows 7 at the moment and I'd like to work on some 
graphics stuff but I'm pretty lost...


I just want to install an IDE that's not prone to crashing and 
comes with standard features like D syntax highlighting, code 
completion, code folding, side bar with my project's directory, 
integrated console, bindable key commands (build (with dub), run, 
stop), and some debugging help doesn't hurt but I can get by 
without being able to set break points... and then I need to get 
the right libs and bindings in order nut half of them I can't 
figure out the instructions for.


What I've been trying to do for the past few hours is set up 
SublimeText3 with dub and get the derelictGLFW3 binding to work, 
but I can't even get dkit working, and I'd honestly rather be 
using code::blocks but I've had trouble getting D code completion 
working in that before, and while I could probably get SFML 
bindings to work (as their documentation caters to idiots like 
me), I don't really want to use it, I just want something small 
that handles an OpenGL window without the other stuff.


If anyone's got a solid setup and can explain to me like I'm 5 
how they got it all nice, that'd really help me out a lot. Thanks.


Re: Beta D 2.071.1-b2

2016-06-16 Thread deadalnix via Digitalmars-d-announce

On Sunday, 29 May 2016 at 21:53:23 UTC, Martin Nowak wrote:

Second beta for the 2.071.1 release.

http://dlang.org/download.html#dmd_beta 
http://dlang.org/changelog/2.071.1.html


Please report any bugs at https://issues.dlang.org

-Martin


196418a8b3ec1c5f284da5009b4bb18e3f70d99f still not in after 3 
month. This is typesystem breaking. While I understand it wasn't 
picked for 2.071 , I'm not sure why it wasn't for 2.071.1 .


const types can't be specialized non-const, if arrays?

2016-06-16 Thread cy via Digitalmars-d-learn
I don't get it. Do I have to write a separate template for arrays 
specifically or something?


NonConst foo(Constant: const NonConst, NonConst)(Constant bar) {
pragma(msg,"NonConst is ",NonConst);
pragma(msg,"Constant is ",Constant);
NonConst foo = bar;
return foo;
}

void main() {
const int bar = 42;
auto baz = foo(bar);
pragma(msg,typeof(baz));
baz = 23;
const(int[]) barr = [1,2,3];
auto bazz = foo(barr);
pragma(msg,typeof(bazz));
bazz[0] = 4;

}

/*

NonConst is int
Constant is const(int)
int
NonConst is const(int)[]
Constant is const(int)[]
const(int)[]
derp.d(16): Error: cannot modify const expression bazz[0]
Failed: ["dmd", "-v", "-o-", "derp.d", "-I."]

*/



Re: Linux and htod

2016-06-16 Thread bachmeier via Digitalmars-d-learn

On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote:
How people use it on Linux, if htod is required to import C 
libraries and windows only?f


Just to clarify, so as to prevent confusion by someone that 
randomly stumbles across this post, you do not need htod, dstep, 
or any other tool to call C libraries from D. dstep generates 
bindings to C libraries for you.


You can create the bindings yourself in your D source files, and 
if you only want to call a couple of functions from a particular 
C library, that's the most convenient. 
http://dlang.org/spec/interfaceToC.html


The wording of the question implies that one of these tools is 
required to call into C libraries, which is not correct.


Re: Beta D 2.071.1-b2

2016-06-16 Thread Jack Stouffer via Digitalmars-d-announce

On Sunday, 29 May 2016 at 21:53:23 UTC, Martin Nowak wrote:

Second beta for the 2.071.1 release.

http://dlang.org/download.html#dmd_beta 
http://dlang.org/changelog/2.071.1.html


Please report any bugs at https://issues.dlang.org

-Martin


This release would fix some pretty serious bugs. What's the 
holdup?


Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-16 Thread TheDGuy via Digitalmars-d-learn

On Thursday, 16 June 2016 at 13:12:12 UTC, Gerald wrote:


It can be done fine with on the fly changes, i.e. random 
colors, it's somewhat more work then just calling a simple 
function call but CSS gives you a lot more power as well. I do 
this in Terminix where for certain themes I want to set the 
scrollbar background to be the same color as the terminal 
background.


Essentially, add a class to the widget and then construct the 
CSS for the class with your random background color as a 
string. Create a CSSProvider and use loadFromData, same as 
captaindet's example, to load the CSS in the string. Finally, 
use the widget's style context to add the CSS provider which 
you just constructed. If you want to change the color, remove 
that provider and add a new one.


Ahhh. Thas possible for sure, thanks alot!

I finally found the solution for my background-color problem: we 
have to remove the image first, so this works for me now:


#CssName{
background-image: none;
background-color:green;
color:green;
}


Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn

On Thursday, 16 June 2016 at 17:44:08 UTC, Basile B. wrote:

Please Stop your comedy.


Thanks a lot for your help!
This is my solution:

import gtk.Main;
import gtk.MainWindow;
import gtk.CssProvider;
import gtk.Button;
import gdk.Display;
import gdk.Screen;
import gtk.StyleContext;
import glib.GException;
import std.stdio;
import std.file;
import std.path;

class Window : MainWindow{
this(int width, int height, string title, string wd){
super(title);
setDefaultSize(width, height);
Button btn = new Button("Test");
btn.setName("CssName");

string cssPath = dirName(wd) ~ "\\" ~ "test.css";

CssProvider provider = new CssProvider();
provider.loadFromPath(cssPath);

Display display = Display.getDefault();
Screen screen = display.getDefaultScreen();
StyleContext.addProviderForScreen(screen, provider, 
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);


add(btn);
showAll();
}
}

void main(string[] args){
Main.init(args);
auto win = new Window(250,250,"Tutorial", args[0]);
Main.run();
}


Re: Auto Tester Failing

2016-06-16 Thread Steven Schveighoffer via Digitalmars-d

On 6/16/16 11:24 AM, Steven Schveighoffer wrote:

On 6/16/16 10:42 AM, Steven Schveighoffer wrote:

On 6/16/16 8:48 AM, Jack Stouffer wrote:

Just a heads up that the tests for Win_32_64 are failing due to a
missing timezone.

All auto merged PRs will not be merged until this is fixed.


https://github.com/dlang/phobos/pull/4433

Please don't pull without letting auto-tester run, I haven't tested on
Windows.


Didn't work. More time zones are missing. I'm going to figure it out and
fix.


New attempt: https://github.com/dlang/phobos/pull/4434

-Steve



Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn

On Thursday, 16 June 2016 at 15:57:36 UTC, TheDGuy wrote:

On Thursday, 16 June 2016 at 10:14:47 UTC, Basile B. wrote:


from args[0] you can get the base bath and since your css is 
relative to the base path:


string cssPath = "test.css";
CssProvider provider = new CssProvider();
provider.loadFromPath(cssPath);


add something like

import std.path;
basePath = args[0].dirName;

string cssPath = basePath ~ "\" ~ "test.css";

and you can remove all the stuff in the Run options.


But i don't call my CSS file in the main-function but instead i 
call it in the MainWindow:


import gtk.Main;
import gtk.MainWindow;
import gtk.CssProvider;
import gtk.Button;
import gdk.Display;
import gdk.Screen;
import gtk.StyleContext;
import glib.GException;

class Window : MainWindow{
this(int width, int height, string title){
super(title);
setDefaultSize(width, height);
Button btn = new Button("Test");
btn.setName("CssName");

string cssPath = "test.css";

CssProvider provider = new CssProvider();
provider.loadFromPath(cssPath);

Display display = Display.getDefault();
Screen screen = display.getDefaultScreen();
StyleContext.addProviderForScreen(screen, provider, 
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);


add(btn);
showAll();
}
}

void main(string[] args){
Main.init(args);
auto win = new Window(250,250,"Tutorial");
Main.run();
}


Please Stop your comedy.


Re: Telegram Supergroup as an alternative to IRC

2016-06-16 Thread Adam D. Ruppe via Digitalmars-d

On Thursday, 16 June 2016 at 14:33:07 UTC, Dechcaudron wrote:
I've been using D for the last couple of months already. I 
usually have to drop by the IRC to ask some fast questions and 
so on, but IRC and its clients' limitations make it kind of a 
pain to communicate through it.


What clients are you using? You might look into another one and 
there's also the bots on the D irc that can help with other 
things, like ".note somebody the bot will give them this message 
when they are next active"


I think chat things accumulate too many features though... they 
lose their value if they aren't simple, I prefer email for 
anything more complex than throw-away lines.


Re: Parsing D Maybe Not Such a Good Idea <_<;

2016-06-16 Thread cy via Digitalmars-d

On Wednesday, 15 June 2016 at 07:16:31 UTC, Basile B. wrote:

You're right it's not so simple and you're also right about 
"everything", my "everything" is not used adequatly...


Sorry, I don't mean to complain. Actually the work has already 
all been done, rather elegantly in fact. If libdparse can get 
through a significant subset of D2 code, I have to say I'm pretty 
impressed with the project, and can't praise it enough.


https://github.com/Hackerpilot/libdparse // disclaimer: this link 
not endorsed by the hackerpilot org ltd


It already has a D formatter in it, which dumps (prettified!) D 
code to any sort of output range, and there's a case in it for 
every single kind of node in the AST.


(speaking of which, when are we getting static switch statements?)

What I meant by "D is not simple" isn't that I'm up a creek, 
without a paddle, but that the paddle is really complex, and I'd 
have no hope of tackling it if it wasn't already done. The 
complexity of D's syntax is not so much a problem here, as a 
spectacle.


It depends on the grammatical construct you want to parse. But 
it's already much more simple when the comments are removed 
from the lexical token list.


I suppose. What's complicated is the shoving of expressions 
everywhere, since those spider out to all possible forms of 
construct. That means the difficulty of parsing does NOT depend 
on the grammatical construct you want to parse, except for a few, 
very minor constructs, only the ones that don't even 
*potentially* include expressions in their grammar.


So, regardless of what you're doing, you pretty much have to 
handle every single kind of construct, but if "handle" means 
"transform, then output" and you can separate those two steps, 
then if someone does all the output for you, the "transform" step 
can be very simple and specific. Not because you can remove the 
comment nodes, but because you can ignore ALL nodes that you're 
not interested in transforming.


Re: Release candidate 1.0.0-rc.1 is out

2016-06-16 Thread wobbles via Digitalmars-d-announce

On Wednesday, 15 June 2016 at 17:54:00 UTC, Sönke Ludwig wrote:

Am 07.06.2016 um 11:54 schrieb Sönke Ludwig:

[...]


The first release candidate is out now! If nothing else comes 
up, the release is scheduled for next Monday.


For this release, I've restricted the recipe comments to the /+ 
+/ style and to be the first thing in the file apart from the 
optional shebang line. This leaves all options open to relax 
the rules later without losing backwards compatibility and 
allows #872 [1] to be finished with less time pressure.


[1]: https://github.com/dlang/dub/pull/872


I think that's a good choice. +1


Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn

On Thursday, 16 June 2016 at 10:14:47 UTC, Basile B. wrote:


from args[0] you can get the base bath and since your css is 
relative to the base path:


string cssPath = "test.css";
CssProvider provider = new CssProvider();
provider.loadFromPath(cssPath);


add something like

import std.path;
basePath = args[0].dirName;

string cssPath = basePath ~ "\" ~ "test.css";

and you can remove all the stuff in the Run options.


But i don't call my CSS file in the main-function but instead i 
call it in the MainWindow:


import gtk.Main;
import gtk.MainWindow;
import gtk.CssProvider;
import gtk.Button;
import gdk.Display;
import gdk.Screen;
import gtk.StyleContext;
import glib.GException;

class Window : MainWindow{
this(int width, int height, string title){
super(title);
setDefaultSize(width, height);
Button btn = new Button("Test");
btn.setName("CssName");

string cssPath = "test.css";

CssProvider provider = new CssProvider();
provider.loadFromPath(cssPath);

Display display = Display.getDefault();
Screen screen = display.getDefaultScreen();
StyleContext.addProviderForScreen(screen, provider, 
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);


add(btn);
showAll();
}
}

void main(string[] args){
Main.init(args);
auto win = new Window(250,250,"Tutorial");
Main.run();
}


Re: Auto Tester Failing

2016-06-16 Thread Andrei Alexandrescu via Digitalmars-d

On 6/16/16 10:42 AM, Steven Schveighoffer wrote:

On 6/16/16 8:48 AM, Jack Stouffer wrote:

Just a heads up that the tests for Win_32_64 are failing due to a
missing timezone.

All auto merged PRs will not be merged until this is fixed.


https://github.com/dlang/phobos/pull/4433

Please don't pull without letting auto-tester run, I haven't tested on
Windows.


Great. Please issue the message to stderr. -- Andrei



Re: get number of columns and rows in an ndarray.

2016-06-16 Thread Ilya Yaroshenko via Digitalmars-d-learn

On Wednesday, 15 June 2016 at 21:51:25 UTC, learner wrote:

Hi,

How can i get the number of cols and rows in and ndarray that 
has already been created?


learner


Also `sl.length!0`, `sl.length!1`, etc --Ilya


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread tsbockman via Digitalmars-d
On Thursday, 16 June 2016 at 13:56:26 UTC, Steven Schveighoffer 
wrote:
And there is a further problem -- Walter and Andrei are 
gatekeepers, but are stretched incredibly thin.


Having had some time to think about all it now, I believe this 
was my actual problem.


When I started working on this, I was new to the D project and, 
based on following the GitHub discussions and observing the 
voting and review process for `std.logger` and `std.ndslice`, I 
believed that the acceptance process for Phobos was somewhat 
democratic: the more people who approved of a design, the more 
likely it would be accepted (with, of course, substantially more 
weight placed on the opinions of the leadership, who at the time 
I identified more or less as, "those with merge rights").


Having seen the outcome of the recent auto-decoding discussion, 
and the way that this review effectively ended abruptly the 
moment that Andrei Alexandrescu decided that he didn't like my 
design for `checkedint` - despite a number of other people 
earlier speaking positively of it - I now perceive that the 
democratic aspects of the Phobos process are essentially advisory 
in nature, with little-to-no real authority attached to them.


I do not intend this as a criticism, as I am not a stickler for 
democracy. I do think this should be communicated clearly to 
future new contributors, though, to avoid confusion. (Keep in 
mind that I joined the project before the "all new Phobos symbols 
must be approved by Andrei" rule was announced.)


Anyway, I think I see things from Andrei's perspective now, and 
would like to apologize for taking offense, now that I understand 
his role better.


I will, however, be ending my participation in the D development 
process, as I am not personally interested in working in an 
environment where everything I do needs pre-approval from someone 
with his opinions and leadership style (this is not specifically 
about `checkedint`) - especially since he seems too busy to 
effectively manage more contributors using the current system, 
anyway.


I will continue to be available for follow-up on the work I have 
already done, and will try to finish at least some of my current 
pending pull requests. I wish D well, and may still post on the 
forums once in a while.




Re: Auto Tester Failing

2016-06-16 Thread Steven Schveighoffer via Digitalmars-d

On 6/16/16 10:42 AM, Steven Schveighoffer wrote:

On 6/16/16 8:48 AM, Jack Stouffer wrote:

Just a heads up that the tests for Win_32_64 are failing due to a
missing timezone.

All auto merged PRs will not be merged until this is fixed.


https://github.com/dlang/phobos/pull/4433

Please don't pull without letting auto-tester run, I haven't tested on
Windows.


Didn't work. More time zones are missing. I'm going to figure it out and 
fix.


-Steve



Re: Anybody still using the chm docs

2016-06-16 Thread FrankLike via Digitalmars-d

On Wednesday, 15 June 2016 at 11:54:31 UTC, captaindet wrote:

It's a huge maintenance effort for us to produce the chm files.
...
So I'm wondering if in 2016 someone really needs an offline 
copy of a

website shipped with a binary release?


i am very glad the chm file exists whenever i am not online, 
e.g. on a plane or train (free wifi is not a given everywhere). 
finding something in the local html is quite awkward w/o 
google...


if it really takes up too much time i will understand if it has 
to go too, especially if i a am the minority. just saying: i do 
use it occasionally, and whenever i do it is a big help.


/det


+1


Re: Anybody still using the chm docs

2016-06-16 Thread Dejan Lekic via Digitalmars-d
What's the main difference between it and just pointing your 
browser at the downloaded html files? Search and index?


Well, seach and index are not the only operations you need.

One of the common operation with every CHM viewer is to bookmark 
something for an example. I've just checked the Zeal application 
and realised it does not have this simple feature (or I could not 
find it).


Also, I want it to open at the same place I was last time I used 
the viewer...


Simply run KChmViewer and open the CHM document from DMD package 
with it, and compare it with any other similar solution...


Re: Auto Tester Failing

2016-06-16 Thread Steven Schveighoffer via Digitalmars-d

On 6/16/16 8:48 AM, Jack Stouffer wrote:

Just a heads up that the tests for Win_32_64 are failing due to a
missing timezone.

All auto merged PRs will not be merged until this is fixed.


https://github.com/dlang/phobos/pull/4433

Please don't pull without letting auto-tester run, I haven't tested on 
Windows.


-Steve


Re: Telegram Supergroup as an alternative to IRC

2016-06-16 Thread rikki cattermole via Digitalmars-d

On 17/06/2016 2:33 AM, Dechcaudron wrote:

Hey there community,

I've been using D for the last couple of months already. I usually have
to drop by the IRC to ask some fast questions and so on, but IRC and its
clients' limitations make it kind of a pain to communicate through it.

If anybody uses Telegram around here, its Desktop client would prove an
amazing alternative and its supergroups can host up to 5000 people. I
understand there are some major differences, but all in all I understand
the advantages outweight the cons. Mentions, for example, are way
easier to use, as well as replies, link and media sharing...

So, anybody willing to join me? Even if it's 3 people in the beggining,
it'll be alright. Just send a message to @Dechcaudron from Telegram and
I'll answer so we can assemble the group :D


You're hard pressed to consider even XMPP as a replacement for IRC.
Its a highly mature technology with clear solutions for all necessary 
usage patterns. Not to mention there are clients on pretty every 
platform imaginable.


So no, Telegram has 0 advantages over IRC. It only has cons.
Don't expect anybody to consider it seriously and yes there are some of 
us on e.g. gitter and Discord its just not used in any real form.


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread tsbockman via Digitalmars-d

On Thursday, 16 June 2016 at 06:55:00 UTC, lobo wrote:

Has this work/design been submitted as a DIP? I cannot find it.

I thought all Phobos additions of any magnitude were required 
to pass the DIP submission first in order to avoid this sort of 
situation. If there is a DIP that was accepted then to have it 
knocked back now would suck.


Without a DIP you have to expect the design could be turned 
down by any core developer when they first get the opportunity 
to review it, no matter how long after the work was initiated.


bye,
lobo


My observation has been that the DIP process is not followed, in 
practice. The DIP for this project (which I did not start; I 
merely continued @burner's work) is actually the same one as that 
of the recently accepted `ndslice`: https://wiki.dlang.org/DIP80




Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread tsbockman via Digitalmars-d
On Thursday, 16 June 2016 at 12:25:39 UTC, Andrei Alexandrescu 
wrote:

Pull requests are routinely reviewed in an upside-down fashion:

1) Formatting
2) Typos
3) Names
4) Tests (and names again)
6) Docs (and names)
8) Design (and more about names)
9) Does this even belong in Phobos?

I don't think people are doing it on purpose - it's just 
easier to start
with the trivial nit-picks, because you don't need a deep 
understanding
of the code and the problem domain (or decision-making 
authority) to

complain about a missing ' ' or something.


I can see how that could be happening. Often (and in this case) 
there are different folks touching on the different points.


Yes, it's mostly a process issue, not an individual one. See my 
earlier reply to John Colvin, for a practical suggestion as to 
how to improve with this.




Telegram Supergroup as an alternative to IRC

2016-06-16 Thread Dechcaudron via Digitalmars-d

Hey there community,

I've been using D for the last couple of months already. I 
usually have to drop by the IRC to ask some fast questions and so 
on, but IRC and its clients' limitations make it kind of a pain 
to communicate through it.


If anybody uses Telegram around here, its Desktop client would 
prove an amazing alternative and its supergroups can host up to 
5000 people. I understand there are some major differences, but 
all in all I understand the advantages outweight the cons. 
Mentions, for example, are way easier to use, as well as 
replies, link and media sharing...


So, anybody willing to join me? Even if it's 3 people in the 
beggining, it'll be alright. Just send a message to @Dechcaudron 
from Telegram and I'll answer so we can assemble the group :D


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread tsbockman via Digitalmars-d

On Thursday, 16 June 2016 at 07:02:21 UTC, John Colvin wrote:
I think anything sufficiently large is likely to be reviewed in 
that order. In a lot of cases all the work for 1 - 8 is 
progressively done while working out 9. Should people not 
mention the smaller mistakes / disagreements they find along 
the way until they've reached the end and can provide a final 
judgement?


I think that consideration should be given to splitting reviews 
into two phases by policy:


1. The big picture: refining the overall design, and debating
   whether the change is worthwhile or not. This ends when the
   change has been formally approved by someone who has the
   authority to do so.

2. Completing and polishing the implementation, until it is
   actually ready to merge.

Distinguish clearly between these phases, and make it clear to 
submitters that they are not required or expected to fix/finish 
all the little stuff until (1) is over, since there's a good 
chance it will all be irrelevant, anyway.


Obviously there will be some fuzziness as to whether an issue 
belongs in (1) or (2), but there's lots and lots of stuff that 
clearly falls into one or the other.


One of the things that such a policy would accomplish is to 
highlight the essential (but often ignored) question, "Who 
actually has authority to approve this?"




Re: Is GC smart enough not to reallocate?

2016-06-16 Thread John Colvin via Digitalmars-d

On Thursday, 16 June 2016 at 13:54:11 UTC, MMJones wrote:

Suppose one has something like

class foo
{
   int[] x;
   void bar()
   {
  x = [];
   }
}

Does the GC trash the "cache" when calling bar or does it 
realize that it can use the same memory for x and essentially 
just shortens the array?


Is it equivalent to setting length = 0?

I'm a bit worried that setting a managed array to [] might 
cause a completely new reallocation, which is unnecessary and 
undesirable.


To prevent confusion, here's a related example:

void foo()
{
int[] x = [1,2,3];
x = [4];
}

in theory, the first allocation (for [1,2,3]) could be avoided. 
It wouldn't be the GC doing it though, it would just be the 
optimiser eliminating the redundant initialisation of x.


However:

class C
{
int[] x;
this()
{
x = [3,2,1];
}
void foo()
{
x = [0];
}
}

auto bar()
{
auto c = new C;
auto localX = c.x;
c.foo();
return localX;
}

the initialisation of c.x is no longer redundant, because the 
memory is referenced by localX, so a new allocation is necessary 
in foo.


P.S. remember that D's arrays/slices aren't "managed" as such. 
Only the memory backing them is managed, and then only if the 
memory was allocated by the GC.


Re: Anybody still using the chm docs

2016-06-16 Thread Adam D. Ruppe via Digitalmars-d

On Thursday, 16 June 2016 at 13:18:23 UTC, Dejan Lekic wrote:
I still use CHM document as it is absolutely the best solution 
compared to anything else.


What's the main difference between it and just pointing your 
browser at the downloaded html files? Search and index?


Is GC smart enough not to reallocate?

2016-06-16 Thread MMJones via Digitalmars-d

Suppose one has something like

class foo
{
   int[] x;
   void bar()
   {
  x = [];
   }
}

Does the GC trash the "cache" when calling bar or does it realize 
that it can use the same memory for x and essentially just 
shortens the array?


Is it equivalent to setting length = 0?

I'm a bit worried that setting a managed array to [] might cause 
a completely new reallocation, which is unnecessary and 
undesirable.









Re: Button: A fast, correct, and elegantly simple build system.

2016-06-16 Thread Kagamin via Digitalmars-d-announce

On Thursday, 16 June 2016 at 13:40:39 UTC, Atila Neves wrote:
The idea would be to build reggae with the system dmd first 
(since having a D compiler is now a pre-requisite)


If a D compiler is required, it means a prebuilt executable is 
not needed: rdmd should be enough to compile and run the build 
script.


Re: Is GC smart enough not to reallocate?

2016-06-16 Thread Steven Schveighoffer via Digitalmars-d

On 6/16/16 9:54 AM, MMJones wrote:

Suppose one has something like

class foo
{
   int[] x;
   void bar()
   {
  x = [];
   }
}

Does the GC trash the "cache" when calling bar or does it realize that
it can use the same memory for x and essentially just shortens the array?


If you reassign x, the compiler does not know enough context to assume 
nothing else has a reference to x's old data. So no, it would not re-use 
that same data.



Is it equivalent to setting length = 0?


Even this is not going to overwrite the data. You'd need to do:

x.length = 0;
x.assumeSafeAppend;


I'm a bit worried that setting a managed array to [] might cause a
completely new reallocation, which is unnecessary and undesirable.


Use assumeSafeAppend when you need to do this.

BTW, x = [] is equivalent to x = null. So this is most certainly going 
to cause a new allocation on the next append.


-Steve


Re: std.array : appender woes

2016-06-16 Thread Steven Schveighoffer via Digitalmars-d-learn

On 6/16/16 6:08 AM, abad wrote:

On Thursday, 16 June 2016 at 07:59:50 UTC, cym13 wrote:

On Thursday, 16 June 2016 at 07:47:03 UTC, abad wrote:

import std.array : appender;
import std.stdio : writeln;

void main() {
auto app = appender!(char[]);
app.put('x');
auto foo = app.data;
app.clear; // done, start a new array
app.put('y');
writeln(foo);
}

This prints out 'y'. It's not surprising because what I suppose
app.data is doing is just returning a slice of the dynamic array.
Clear() resets the counter of current position. But this behavior is
confusing in practical use, IMHO.

Should calling clear in your opinion guarantee that a new array gets
allocated?


I don't find it confusing at all, what did you expect?


Consider the word clear in this context. What is it that gets cleared?
The data in the array (which might imply reallocation)? Nope, what gets
"cleared" is the index to current position in the array. I think 'reset'
may have been a better name for the function.


In fact, what gets cleared is the data in the array. You have a dangling 
reference to the array, for which the data is not technically valid.


-Steve


Re: Anybody still using the chm docs

2016-06-16 Thread Dejan Lekic via Digitalmars-d

On Thursday, 16 June 2016 at 02:32:05 UTC, Jack Stouffer wrote:

On Wednesday, 15 June 2016 at 10:58:04 UTC, Martin Nowak wrote:
So I'm wondering if in 2016 someone really needs an offline 
copy of a website shipped with a binary release?


For offline browsing, Windows and Linux users can use Zeal [1] 
which is FOSS, and macOS users can use Dash[2], which is free 
as in beer. Both of which can use this D docset [3].


So no, there's no reason to maintain the chm docs.

[1] https://zealdocs.org/
[2] https://kapeli.com/dash
[3] 
https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/D#readme


Thanks for the Zeal, I did not know about it.
Both Gnome and KDE have their "help" tools that more/less do the 
same.


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread Steven Schveighoffer via Digitalmars-d

On 6/15/16 11:56 PM, tsbockman wrote:

On Thursday, 16 June 2016 at 02:53:38 UTC, Andrei Alexandrescu wrote:

On 6/15/16 9:34 PM, tsbockman wrote:

Why didn't you make your design requirements known at any earlier point
in this process? If you are ultimate gate keeper for Phobos (as you seem
to be), you ought to make your requirements known *before* the
implementation is finished.


Apologies about that. I've done a bit of spelunking to see what
happened. Indeed the first reference to SafeInt is on a forum post on
6/7/2015, followed immediately by
https://github.com/dlang/phobos/pull/3389 which entailed a long
discussion.

You first posted about checkedint here on 6/30/2015, in a large thread.

At that time, I had the std.allocator review going on (started on
6/11/2015), a newborn baby, and a move across the continent to worry
about (which happened at the end of June). It is entirely possible I
just missed that discussion, or more likely saw it and had no
meaningful input at the time. There has been a gap in forum posts with
"checkedint" in the title between 7/3/2015 and 6/7/2016,


Numerous other mentions were made of this project in various contexts on
the forums, in GitHub pull requests, and on the bug tracker - including
discussions in which you participated. 'posts with "checkedint" in the
title' is too narrow of a search filter.


so it's not like there was a continuing presence I was working hard to
ignore. I honestly think there's nothing to be offended over.


Malicious intent is not required to make the act offensive; you're still
jumping into a project a year in the making and demanding that I choose
between investing an additional six months (wild guess) of my time
working on things I don't care about (at best), or canceling the project
(which has otherwise received generally positive feedback so far).

I am not too upset mostly because I had a variety of reasons for
pursuing this, not all of which depend on getting it into Phobos.


This underlies a larger issue. There must be a protocol that
guarantees a proposal is brought to consideration to the D leadership.
Dicebot is leading such an initiative (which can be seen as a
revamping of DIPs) and we hope to get it finalized soon.


Andrei


That is part of the problem, but this is also a fine example of a
broader pattern that I have noticed in D's review process:

Pull requests are routinely reviewed in an upside-down fashion:

1) Formatting
2) Typos
3) Names
4) Tests (and names again)
6) Docs (and names)
8) Design (and more about names)
9) Does this even belong in Phobos?


This is a good point. I personally have avoided doing anything in 1-8 
unless I first agree it's a change I think we should accept. Which then 
results in 0) nobody is looking at this!???


I will occasionally chime in when there is a particular pain point with 
design philosophy, but the problem is, this gives the impression that I 
am willing to accept the change after X nitpicks are done. I try not to 
do this unless there is another reviewer that seems motivated to do a 
full review who has already posted, and they haven't covered that piece.


On the other hand, peoples minds can change.

e.g:

"The early iterations of `checkedint` worked this way (although I had no 
plans to support user-defined hooks). I implemented and debugged it, and 
thought it was about ready to submit many months ago.


Then I actually tried *using* it, and hated it."

And there is a further problem -- Walter and Andrei are gatekeepers, but 
are stretched incredibly thin. So a reviewer that is keen on a certain 
addition may put in a lot of time on steps 1-8 assuming that step 9 is a 
given, and when W/A come around to looking at it, they say no.


How to fix this? I don't know. The only recommendation I have is to do 2 
things:


1. Get pre-approval if you have your heart set on Phobos inclusion. Make 
SURE you understand the expectations from Andrei and Walter.
2. Be willing to put it on code.dlang.org instead, and Phobos as a 
secondary goal (your approach).


I had a similar experience with dcollections, though I never really 
intended on it being in Phobos, it was meant for Tango. But that didn't 
work out either, as the gatekeeper there was working on his own version 
of containers.



Unless the PR is a complete mess, (9) and (8) should be debated *first*,
before worrying about any of the other stuff. Why waste people's time
fixing trivialities, if it's all going to just be deleted or rewritten
anyway?


I understand your frustration. All I can say is, open source 
contributors have to have a thicker skin (and I'm not saying you don't). 
We are all human and have our faults, and any team in any context can 
have miscommunication, or misunderstandings. I can assure you it's not 
the plan to waste people's time or to cause frustration. Even with a 
mitigating plan in place, these can happen. Have a plan that you can 
control, with a viable path if the things you can't don't go your way.


Re: Why don't we write configuration files in D instead of JSON?

2016-06-16 Thread Guido via Digitalmars-d-learn
have a look at  `dub convert` - in your case e.g. `dub convert 
-f sdl`


This dub convert command is weird. It works as `cat dub.json | 
dub convert -sdl' and makes a nice SDL file called dub.sdl, but 
it blows away the source file, which I've never seen before with 
piped output from cat. I don't like deleting the source file 
being the default behavior.


Also, commands like `dub convert -f sdl dub.json' and variations 
of that sort don't seem to work as a command. They have errors.


What's the weirdness here?


Re: Button: A fast, correct, and elegantly simple build system.

2016-06-16 Thread Atila Neves via Digitalmars-d-announce

On Thursday, 16 June 2016 at 12:32:02 UTC, Kagamin wrote:

On Sunday, 12 June 2016 at 20:47:31 UTC, cym13 wrote:
Yeah, I have often thought that writing a self-contained D 
program to build D would work well. The full power of the 
language would be available, there'd be nothing new to learn, 
and all you'd need is an existing D compiler (which we 
already require to build).


What about Attila's work with reggae?


Reggae still needs a prebuilt reggae to run the build script.


The idea would be to build reggae with the system dmd first 
(since having a D compiler is now a pre-requisite), then build 
dmd, druntime and phobos.


There are no extra dependencies except on the reggae source 
files. Again, that's the idea, at least.


Atila


Re: Anybody still using the chm docs

2016-06-16 Thread rikki cattermole via Digitalmars-d

On 17/06/2016 1:22 AM, Dejan Lekic wrote:

I still use CHM document as it is absolutely the best solution
compared to anything else. I think it is a mistake to compare CHM with
PDF... They are made for different things...


I forgot to mention - I use CHM on Linux. It is not my fault that
opensource community could not come up with a better or/and standardised
solution... The only standard solution for this that Linux has are man
pages - clearly not suitable this purpose! Other, better solutions are
there, but are not adopted by all - Gnome has one format, KDE another,
etc... CHAOS. Therefore, I decided to use CHM.


It's doable to have epub generation[0].
PDF can do a heck a lot more then what most people even know[1].

[0] 
http://master.dl.sourceforge.net/project/d-apt/files/doc/2.071.0/dlangspec-2.071.0.epub
[1] 
http://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_AcroJSPreface%2FJS_API_AcroJSPreface.htm


Re: Button: A fast, correct, and elegantly simple build system.

2016-06-16 Thread Atila Neves via Digitalmars-d-announce

On Thursday, 16 June 2016 at 04:26:24 UTC, Jason White wrote:
On Wednesday, 15 June 2016 at 12:00:52 UTC, Andrei Alexandrescu 
wrote:
I'd say the gating factor is -j. If an build system doesn't 
implement the equivalent of make -j, that's a showstopper.


Don't worry, there is a --threads option and it defaults to the 
number of logical cores.


I just did some tests and the reason it is slower than Make is 
because of the automatic dependency detection on every single 
command. I disabled the automatic dependency detection and 
compared it with Make again. Button was then roughly the same 
speed as Make -- sometimes it was faster, sometimes slower. 
Although, I think getting accurate dependencies at the cost of 
slightly slower builds is very much a worthwhile trade-off.


It would be a worthwhile trade-off, if those were the only two 
options available, but they're not. There are multiple build 
systems out there that do correct builds whilst being faster than 
make. Being faster is easy, because make is incredibly slow.


I didn't even find out about ninja because I read about it in a 
blog post, I actively searched for a make alternative because I 
was tired of waiting for it.


Atila




Re: Why don't we write configuration files in D instead of JSON?

2016-06-16 Thread Seb via Digitalmars-d-learn

On Thursday, 16 June 2016 at 13:20:06 UTC, Guido wrote:

On Thursday, 16 June 2016 at 06:07:55 UTC, Seb wrote:

On Thursday, 16 June 2016 at 05:31:26 UTC, Guido wrote:
It would seem that by running the file through mixin, you can 
simply create the vars you want in scope. The drawback being 
random code execution. Is there any way to sanitize mixin 
code from user-configurable file?


Well it's a configuration file that e.g. the registry has to 
parse too, hence (as for all config files) random code 
execution is pretty bad.
Apart from that it's just about a small configuration file for 
the name, title etc. - you don't need a full-blown D 
interpreter for this.


Imho SDL does a good job at keeping the syntax rather minimal 
:)


Of course do one stops you to use D to generate a 
configuration file.


Once that's shot down, does anyone know a .json to .sdl 
converter program


have a look at  `dub convert` - in your case e.g. `dub convert 
-f sdl`


Thanks for the answer. I conceptually like SDL better than 
JSON. We'll see how I like it in practice. I went looking for 
examples of SDL online and found that even the SDlang-D project 
is using a dub.json configuration file. How weird is that?


Also, LOL @Ketmar.


Well fib initially started with Json, then wanted to switch to 
sdl, but never made the move.

See this issue for some details:

https://github.com/dlang/dub/issues/789

I think the only problem with sdl is that it's rather unknown and 
a _popular_ human-readable format like toml or yaml would have 
been a better choice.


[Issue 10378] Prevent local imports from hiding local symbols

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

Sobirari Muhomori  changed:

   What|Removed |Added

 CC||c...@dawg.eu

--- Comment #36 from Sobirari Muhomori  ---
*** Issue 12279 has been marked as a duplicate of this issue. ***

--


[Issue 12279] function local imports are not hijack safe

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12279

Sobirari Muhomori  changed:

   What|Removed |Added

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

--- Comment #1 from Sobirari Muhomori  ---
Fixed in issue 10378. Currently imported symbols are completely hidden by local
symbols.

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

--


Re: Why don't we write configuration files in D instead of JSON?

2016-06-16 Thread Guido via Digitalmars-d-learn

On Thursday, 16 June 2016 at 06:07:55 UTC, Seb wrote:

On Thursday, 16 June 2016 at 05:31:26 UTC, Guido wrote:
It would seem that by running the file through mixin, you can 
simply create the vars you want in scope. The drawback being 
random code execution. Is there any way to sanitize mixin code 
from user-configurable file?


Well it's a configuration file that e.g. the registry has to 
parse too, hence (as for all config files) random code 
execution is pretty bad.
Apart from that it's just about a small configuration file for 
the name, title etc. - you don't need a full-blown D 
interpreter for this.


Imho SDL does a good job at keeping the syntax rather minimal :)

Of course do one stops you to use D to generate a configuration 
file.


Once that's shot down, does anyone know a .json to .sdl 
converter program


have a look at  `dub convert` - in your case e.g. `dub convert 
-f sdl`


Thanks for the answer. I conceptually like SDL better than JSON. 
We'll see how I like it in practice. I went looking for examples 
of SDL online and found that even the SDlang-D project is using a 
dub.json configuration file. How weird is that?


Also, LOL @Ketmar.



Re: Anybody still using the chm docs

2016-06-16 Thread Dejan Lekic via Digitalmars-d
I still use CHM document as it is absolutely the best solution 
compared to anything else. I think it is a mistake to compare 
CHM with PDF... They are made for different things...


I forgot to mention - I use CHM on Linux. It is not my fault that 
opensource community could not come up with a better or/and 
standardised solution... The only standard solution for this that 
Linux has are man pages - clearly not suitable this purpose! 
Other, better solutions are there, but are not adopted by all - 
Gnome has one format, KDE another, etc... CHAOS. Therefore, I 
decided to use CHM.


Re: Anybody still using the chm docs

2016-06-16 Thread Dejan Lekic via Digitalmars-d

On Wednesday, 15 June 2016 at 10:58:04 UTC, Martin Nowak wrote:

It's a huge maintenance effort for us to produce the chm files.
We no longer generate documentation on Windows, but just for 
the chm generation we have dedicated tools [¹] to create an 
index (from a json generated via ddoc) and copy the html files.
So I'm wondering if in 2016 someone really needs an offline 
copy of a website shipped with a binary release?


https://github.com/dlang/dlang.org/pull/1374

[¹]:
https://github.com/dlang/dlang.org/blob/7cc6e938154f90aa49fa6451a85b13e35ab2de99/chmgen.d


I still use CHM document as it is absolutely the best solution 
compared to anything else. I think it is a mistake to compare CHM 
with PDF... They are made for different things...


If people want to get rid of PDF, then I propose we start 
providing ePub instead of CHM. That could be the only sane 
alternative to the CHM we have.


Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-16 Thread Gerald via Digitalmars-d-learn

On Thursday, 16 June 2016 at 07:58:56 UTC, TheDGuy wrote:

On Wednesday, 15 June 2016 at 22:34:05 UTC, Gerald wrote:

snip...

The text color is green but the button background color is 
still default-gray!


I don't see an obvious issue with your code, I usually use CSS 
classes personally and I know that works fine because I use 
this technique all over terminix. I would suggest using the 
GTK Inspector to debug the CSS issue, it's an awesome tool for 
figuring out GTK CSS issues as it let's you change CSS on the 
fly, see what CSS is being applied to an object, etc. You can 
see how to use it at the link below:


https://wiki.gnome.org/Projects/GTK%2B/Inspector



Do you know if this works on windows?


No idea, I don't use Windows.




Personally I just add and remove classes as needed:

getStyleContext().addClass()
getStyleContext().removeClass()


So you basically have to create 2 classes? And what would you 
do if you would have to change the color randomly (for a simon 
says game)? I still think it is a bad idea to claim the way 
with function calls as deprecated but introducing a new system 
which is not as flexible (but maybe more powerfull).

C# with Visual Studio does it, PyQT does it: Function calls.


It can be done fine with on the fly changes, i.e. random colors, 
it's somewhat more work then just calling a simple function call 
but CSS gives you a lot more power as well. I do this in Terminix 
where for certain themes I want to set the scrollbar background 
to be the same color as the terminal background.


Essentially, add a class to the widget and then construct the CSS 
for the class with your random background color as a string. 
Create a CSSProvider and use loadFromData, same as captaindet's 
example, to load the CSS in the string. Finally, use the widget's 
style context to add the CSS provider which you just constructed. 
If you want to change the color, remove that provider and add a 
new one.


Re: Linux and htod

2016-06-16 Thread fbmac via Digitalmars-d-learn

On Thursday, 16 June 2016 at 12:39:00 UTC, Dicebot wrote:

On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote:
How people use it on Linux, if htod is required to import C 
libraries and windows only?f


People don't use htod. https://github.com/jacob-carlborg/dstep 
is best what one can be for plain binding generation.


Thanks, I'll check it out. This was always a barrier for me to 
take the effort of learning D


Re: Button: A fast, correct, and elegantly simple build system.

2016-06-16 Thread John Colvin via Digitalmars-d-announce

On Thursday, 16 June 2016 at 12:32:02 UTC, Kagamin wrote:

On Sunday, 12 June 2016 at 20:47:31 UTC, cym13 wrote:
Yeah, I have often thought that writing a self-contained D 
program to build D would work well. The full power of the 
language would be available, there'd be nothing new to learn, 
and all you'd need is an existing D compiler (which we 
already require to build).


What about Attila's work with reggae?


Reggae still needs a prebuilt reggae to run the build script.


But seeing as you need a d compiler to build and anyway...


Re: Button: A fast, correct, and elegantly simple build system.

2016-06-16 Thread John Colvin via Digitalmars-d-announce

On Thursday, 16 June 2016 at 12:53:35 UTC, John Colvin wrote:

On Thursday, 16 June 2016 at 12:32:02 UTC, Kagamin wrote:

On Sunday, 12 June 2016 at 20:47:31 UTC, cym13 wrote:
Yeah, I have often thought that writing a self-contained D 
program to build D would work well. The full power of the 
language would be available, there'd be nothing new to 
learn, and all you'd need is an existing D compiler (which 
we already require to build).


What about Attila's work with reggae?


Reggae still needs a prebuilt reggae to run the build script.


But seeing as you need a d compiler to build and anyway...


Ugh, autocorrect. s/and/dmd


Auto Tester Failing

2016-06-16 Thread Jack Stouffer via Digitalmars-d
Just a heads up that the tests for Win_32_64 are failing due to a 
missing timezone.


All auto merged PRs will not be merged until this is fixed.


Re: Anybody still using the chm docs

2016-06-16 Thread Jack Stouffer via Digitalmars-d

On Thursday, 16 June 2016 at 11:04:48 UTC, Martin Nowak wrote:

On Thursday, 16 June 2016 at 02:32:05 UTC, Jack Stouffer wrote:
For offline browsing, Windows and Linux users can use Zeal [1] 
which is FOSS, and macOS users can use Dash[2], which is free 
as in beer. Both of which can use this D docset [3].


So no, there's no reason to maintain the chm docs.

[1] https://zealdocs.org/
[2] https://kapeli.com/dash
[3] 
https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/D#readme


Interesting, is this generated from the html pages?


Yeah


Re: Linux and htod

2016-06-16 Thread Dicebot via Digitalmars-d-learn

On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote:
How people use it on Linux, if htod is required to import C 
libraries and windows only?f


People don't use htod. https://github.com/jacob-carlborg/dstep is 
best what one can be for plain binding generation.


Re: Linux and htod

2016-06-16 Thread ketmar via Digitalmars-d-learn

On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote:
How people use it on Linux, if htod is required to import C 
libraries and windows only?f


we don't.


Re: Why don't we write configuration files in D instead of JSON?

2016-06-16 Thread ketmar via Digitalmars-d-learn

On Thursday, 16 June 2016 at 05:31:26 UTC, Guido wrote:
Is there any way to sanitize mixin code from user-configurable 
file?


yes. read json file and convert it to anything you want. ;-)


Re: Button: A fast, correct, and elegantly simple build system.

2016-06-16 Thread Kagamin via Digitalmars-d-announce

On Sunday, 12 June 2016 at 23:27:07 UTC, Jason White wrote:
However, I question the utility of even doing this in the first 
place. You miss out on the convenience of using the existing 
command line interface.


Why the build script can't have a command line interface?


Re: Button: A fast, correct, and elegantly simple build system.

2016-06-16 Thread Kagamin via Digitalmars-d-announce

On Sunday, 12 June 2016 at 20:47:31 UTC, cym13 wrote:
Yeah, I have often thought that writing a self-contained D 
program to build D would work well. The full power of the 
language would be available, there'd be nothing new to learn, 
and all you'd need is an existing D compiler (which we already 
require to build).


What about Attila's work with reggae?


Reggae still needs a prebuilt reggae to run the build script.


Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread Andrei Alexandrescu via Digitalmars-d

On 6/16/16 2:55 AM, lobo wrote:

Without a DIP you have to expect the design could be turned down by any
core developer when they first get the opportunity to review it, no
matter how long after the work was initiated.


We're still working on making DIPs a process that requires leadership to 
intervene, but I'd say this is already true now.


Per the title of this thread: "std.experimental.checkedint is ready for 
comments!". What kind of comments were expected?



Andrei



Re: std.experimental.checkedint is ready for comments!

2016-06-16 Thread Andrei Alexandrescu via Digitalmars-d

On 6/15/16 11:56 PM, tsbockman wrote:

Numerous other mentions were made of this project in various contexts on
the forums, in GitHub pull requests, and on the bug tracker - including
discussions in which you participated. 'posts with "checkedint" in the
title' is too narrow of a search filter.


I am sure there were, which was especially visible to you because you 
were following the project. Some examples would be helpful so I can 
learn from them.



so it's not like there was a continuing presence I was working hard to
ignore. I honestly think there's nothing to be offended over.


Malicious intent is not required to make the act offensive; you're still
jumping into a project a year in the making and demanding that I choose
between investing an additional six months (wild guess) of my time
working on things I don't care about (at best), or canceling the project
(which has otherwise received generally positive feedback so far).


Agreed malice is not required. But I'm still having trouble seeing the 
offense. Annoyance at a negative review, sure, we're all human. But 
taking offense? The closest anything came to "demanding" anything has been:



This suggests a much simpler design [...]
But I suggest you to reconsider.


How could I have phrased my review and follow-up in ways that are not 
offensive? Should I have just accepted the proposal on grounds that a 
lot of work has been put into it and the deadline has passed for 
influencing it? (Non-rhetorical questions.)



Pull requests are routinely reviewed in an upside-down fashion:

1) Formatting
2) Typos
3) Names
4) Tests (and names again)
6) Docs (and names)
8) Design (and more about names)
9) Does this even belong in Phobos?

I don't think people are doing it on purpose - it's just easier to start
with the trivial nit-picks, because you don't need a deep understanding
of the code and the problem domain (or decision-making authority) to
complain about a missing ' ' or something.


I can see how that could be happening. Often (and in this case) there 
are different folks touching on the different points.



Andrei




Linux and htod

2016-06-16 Thread fbmac via Digitalmars-d-learn
How people use it on Linux, if htod is required to import C 
libraries and windows only?f


Re: Example on dlang.org // Round floating point numbers

2016-06-16 Thread Dmitry Olshansky via Digitalmars-d

On 16-Jun-2016 14:55, Martin Tschierschke wrote:

The example
// Round floating point numbers

with the floating point substitution using the Regex:

 reFloatingPoint = ctRegex!`[0-9]+\.[0-9]+`;



To something like `[0-9]+\.[0-9]+(?![^.])`


Is not so nice, because it would match for dates like 16.06.2016, too.

(I remember having a simmilar problem when trying to substitute 123.44
Euro to
German format: 123,44 Euro ending up with a modified date: 16,06.2016)

Sure this may be not the point of the example, but I dislike it therefore.

How to expand the Regex not to match dates?

Regards
martin



--
Dmitry Olshansky


Example on dlang.org // Round floating point numbers

2016-06-16 Thread Martin Tschierschke via Digitalmars-d

The example
// Round floating point numbers

with the floating point substitution using the Regex:

 reFloatingPoint = ctRegex!`[0-9]+\.[0-9]+`;

Is not so nice, because it would match for dates like 16.06.2016, 
too.


(I remember having a simmilar problem when trying to substitute 
123.44 Euro to
German format: 123,44 Euro ending up with a modified date: 
16,06.2016)


Sure this may be not the point of the example, but I dislike it 
therefore.


How to expand the Regex not to match dates?

Regards
martin


Email snafu

2016-06-16 Thread Andrei Alexandrescu via Digitalmars-d
Hi folks, due to an email snafu I accidentally archived all of my Inbox 
email last night (I fell asleep pressing 'A'). I'm now going back 
through my archive trying to recover emails that are still waiting for 
an answer. Of those, some are related to D work that I might be missing. 
Kindly please resend if you can. Thanks! -- Andrei


Re: Anybody still using the chm docs

2016-06-16 Thread Martin Nowak via Digitalmars-d

On Thursday, 16 June 2016 at 02:32:05 UTC, Jack Stouffer wrote:

On Wednesday, 15 June 2016 at 10:58:04 UTC, Martin Nowak wrote:
So I'm wondering if in 2016 someone really needs an offline 
copy of a website shipped with a binary release?


For offline browsing, Windows and Linux users can use Zeal [1] 
which is FOSS, and macOS users can use Dash[2], which is free 
as in beer. Both of which can use this D docset [3].


So no, there's no reason to maintain the chm docs.

[1] https://zealdocs.org/
[2] https://kapeli.com/dash
[3] 
https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/D#readme


Interesting, is this generated from the html pages?


Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn

On Thursday, 16 June 2016 at 10:02:01 UTC, TheDGuy wrote:

On Thursday, 16 June 2016 at 09:27:38 UTC, Basile B. wrote:
FOrget any previous comment and in your program use the first 
argument of the command line to detect your resources, this 
will solve your problem. For the execution click compile and 
run or just run.


Okay:

void main(string[] args){
writeln(args[0]);
Main.init(args);
auto win = new Window(250,250,"Tutorial");
Main.run();
}

This gives me the location of the .exe. What should i do with 
it now?


On Win and Nux, the first argument of the command line is 
always the program filename so you just have to get the 
directory for this string and you'll get what you expected 
with cwd.


I don't care about cwd i want to get rid of the error!


from args[0] you can get the base bath and since your css is 
relative to the base path:


string cssPath = "test.css";
CssProvider provider = new CssProvider();
provider.loadFromPath(cssPath);


add something like

import std.path;
basePath = args[0].dirName;

string cssPath = basePath ~ "\" ~ "test.css";

and you can remove all the stuff in the Run options.



Re: std.array : appender woes

2016-06-16 Thread abad via Digitalmars-d-learn

On Thursday, 16 June 2016 at 07:59:50 UTC, cym13 wrote:

On Thursday, 16 June 2016 at 07:47:03 UTC, abad wrote:

import std.array : appender;
import std.stdio : writeln;

void main() {
auto app = appender!(char[]);
app.put('x');
auto foo = app.data;
app.clear; // done, start a new array
app.put('y');
writeln(foo);
}

This prints out 'y'. It's not surprising because what I 
suppose app.data is doing is just returning a slice of the 
dynamic array. Clear() resets the counter of current position. 
But this behavior is confusing in practical use, IMHO.


Should calling clear in your opinion guarantee that a new 
array gets allocated?


I don't find it confusing at all, what did you expect?


Consider the word clear in this context. What is it that gets 
cleared? The data in the array (which might imply reallocation)? 
Nope, what gets "cleared" is the index to current position in the 
array. I think 'reset' may have been a better name for the 
function.


  1   2   >