Re: Where is TypeInfo stored?

2018-03-27 Thread Jeremy DeHaan via Digitalmars-d-learn

On Tuesday, 27 March 2018 at 19:06:38 UTC, Adam D. Ruppe wrote:

On Tuesday, 27 March 2018 at 18:56:58 UTC, Jeremy DeHaan wrote:

Are these put into the text or data segments?


Yeah, they are in the data segment as static data (just like if 
you declared your own static array).


Awesome, thanks. That is what I was hoping for.


Where is TypeInfo stored?

2018-03-27 Thread Jeremy DeHaan via Digitalmars-d-learn
I was doing some experiments with the runtime and I didn't notice 
the TypeInfo instances being allocated by the GC. Are these put 
into the text or data segments? Is there anyway to find out more 
about this process?


Re: GSoC 2018 - Your project ideas

2017-12-09 Thread Jeremy DeHaan via Digitalmars-d-announce

On Friday, 8 December 2017 at 00:28:11 UTC, Adam Wilson wrote:
The 2016 student started playing around with a type-based 
pooling collector.


I actually ran with this idea and wrote a garbage collector from 
scratch for an independent study at my university. I haven't made 
much noise about it since I didn't have time to get it to pass 
all tests, but it had performance about on par with the current 
GC and it has a precise heap like in the open PR's.


I'm going to continue working on it in the spring, so who knows 
what'll happen? I would submit a proposal to continue working on 
it during the summer, but I don't think I can participate in 
another GSoC (I graduate as the summer starts).


Re: Note from a donor

2017-10-27 Thread Jeremy DeHaan via Digitalmars-d
On Friday, 27 October 2017 at 02:20:54 UTC, Jonathan M Davis 
wrote:
Well, if it's possible to use an SDK instead of VS, then 
ideally, we'd support with the installer that rather than 
requiring that VS be there, but obviously, someone will have to 
do the work to improve the installer.


Personally, I'm really not a Windows dev, though I've had to 
use Visual Studio for work often enough, so my understanding of 
what other SDKs might exist from Microsoft is quite poor. I've 
only ever used Windows for development when I've had to.


- Jonathan M Davis


A while back I played with the idea of a VS replacement for D and 
I made some progress using this:

http://www.smorgasbordet.com/pellesc/

I managed to swap out the VS linker and use the included linker 
to build a 64-bit D binary, but that was as far as I got at the 
time.


It's not open source, but the terms of use are pretty permissive. 
Maybe it's worth taking another look.




How to change the file extension of generated doc files

2017-09-03 Thread Jeremy DeHaan via Digitalmars-d-learn
I can't find anywhere describing how to change the extension of 
the generated doc files.


I've tried `-of.php`, but it still generates .html.

I'm probably missing something here that's going to make me feel 
silly.


Re: RFC: Implementation of binary assignment operators (e.g s.x += 2) for @property functions

2017-08-15 Thread Jeremy DeHaan via Digitalmars-d
On Tuesday, 15 August 2017 at 03:53:44 UTC, Michael V. Franklin 
wrote:
An implementation of binary assignment operators for @property 
functions has been submitted to the DMD pull request queue at 
https://github.com/dlang/dmd/pull/7079.  It addresses the 
following issues:


Issue 8006 - Implement proper in-place-modification for 
properties

https://issues.dlang.org/show_bug.cgi?id=8006
--
This is the primary issue motivating the pull request.  The 
pull request is only a partial resolution of this issue; it 
implements binary assignment operators (e.g. `s.x += 2`), but 
not unary assignment operators (e.g. `s.x++`).  The plan is to 
implement unary assignment operators in a separate pull request 
after the fate of the binary assignment operators pull request 
is decided.


I'm a huge fan of this, but then I am of the mindset that 
@property functions should act like variables much in the way 
that they do for C# properties.





Re: returning D string from C++?

2017-08-05 Thread Jeremy DeHaan via Digitalmars-d-learn

On Saturday, 5 August 2017 at 20:17:23 UTC, bitwise wrote:
I have a Windows native window class in C++, and I need a 
function to return the window title.


[...]


As long as you have a reachable reference to the GC memory 
SOMEWHERE, the GC won't reclaim it. It doesn't have to be on the 
stack as long as it is reachable through the stack.


Re: Size of D bool vs size of C++ bool

2017-08-05 Thread Jeremy DeHaan via Digitalmars-d-learn
On Friday, 4 August 2017 at 20:38:16 UTC, Steven Schveighoffer 
wrote:

On 8/4/17 4:16 PM, Jeremy DeHaan wrote:
I'm trying to do some binding code, and I know that C++ bool 
isn't defined to be a specific size like D's bool. That said, 
can I assume that the two are the same size on the most 
platforms?


I shudder to think that D may work with a platform that doesn't 
consider it to be 1 byte :)


The only platforms I'm really interested in are Windows, 
Linux, OSX, iOS, FreeBSD, Android. The only thing that might 
throw me off is if there are some things that Linux or FreeBSD 
target where this is not the case, but these machines are 
probably out of the scope of my project.


I would say any platform that D currently supports, C++ bool is 
defined to be 1 byte.


The ldc/gdc guys would know better.

-Steve


Thanks, Steve. I was hoping this was the case and it will 
significantly simplify a lot of my binding code.


I'm curious to see what systems don't have a bool size of 1 byte, 
but perhaps I'll put a check in my CMake file and prevent the 
project from building if it isn't.


Size of D bool vs size of C++ bool

2017-08-04 Thread Jeremy DeHaan via Digitalmars-d-learn
I'm trying to do some binding code, and I know that C++ bool 
isn't defined to be a specific size like D's bool. That said, can 
I assume that the two are the same size on the most platforms?


The only platforms I'm really interested in are Windows, Linux, 
OSX, iOS, FreeBSD, Android. The only thing that might throw me 
off is if there are some things that Linux or FreeBSD target 
where this is not the case, but these machines are probably out 
of the scope of my project.


Re: Adding deprecated to an enum member

2017-08-01 Thread Jeremy DeHaan via Digitalmars-d-learn

On Tuesday, 1 August 2017 at 02:06:27 UTC, dark777 wrote:
I did as follows using deprecated may help you to elucidate in 
relation to this

https://pastebin.com/NEHtWiGx


Deprecating an entire module isn't really a solution though. I 
only want parts of an existing enum to be deprecated when they 
are used.


Adding deprecated to an enum member

2017-07-31 Thread Jeremy DeHaan via Digitalmars-d-learn

I got an error today because I added deprecated to an enum member.

Is there a way to achieve this, or am I out of luck? If it isn't 
doable, should it be?


Here's what I want:

enum PrimitiveType
{
Points,
Lines,
LineStrip,
Triangles,
TriangleStrip,
TriangleFan,
Quads,

deprecated("Use LineStrip instead.")
LinesStrip = LineStrip,
deprecated("Use TriangleStrip instead.")
TrianglesStrip = TriangleStrip,
deprecated("Use TriangleFan instead.")
TrianglesFan   = TriangleFan
}


PrimitiveType ptype = LinesStrip; //error, Use LineStrip instead.


Issue in _d_dso_registry on Linux when unloading DSO's

2017-04-03 Thread Jeremy DeHaan via Digitalmars-d-learn
I'm running into this issue when I compile DRuntime in debug. In 
sections_elf_shared.d, there's an assert on line 454 
(assert(pdso._tlsSize == _tlsRanges.back.length);). Because of 
this line, I get an assertion thrown, where the actual issue is 
that _tlsRanges is empty and thus has no "back". The GC has been 
finalized at this point in the program and can't actually 
allocate the assertion, so I end up with a segfault.


The whole bit of code looks like this:

assert(pdso._tlsSize == _tlsRanges.back.length);
_tlsRanges.popBack();
assert(pdso == _loadedDSOs.back);
_loadedDSOs.popBack();


Right now my "fix" looks like this:

if(!_tlsRanges.empty)
{
    assert(pdso._tlsSize == _tlsRanges.back.length);
_tlsRanges.popBack();
}
assert(pdso == _loadedDSOs.back);
_loadedDSOs.popBack();


I have no idea if this is safe to do since I am not familiar with 
this code, but at least I don't have a segfault anymore. Can 
anyone help me figure out what is going on?


Re: Independent Study at my university using D

2017-03-05 Thread Jeremy DeHaan via Digitalmars-d-announce

On Saturday, 4 March 2017 at 16:59:05 UTC, bpr wrote:

On Friday, 3 March 2017 at 19:00:00 UTC, Jeremy DeHaan wrote:
This is exciting for me because I really enjoyed the work I 
did during the last GSoC, so I'm hoping to learn more about 
garbage collection and contribute to D's garbage collector 
more in the future.


What's the status of that work with respect to the D main line? 
Last I checked there's this 
https://github.com/dlang/druntime/pull/1603 which is just 
hanging.



The precise GC is going to continue to hang until it can be 
tweaked to be as fast or faster than the conservative GC we have 
now.


Me working on it has effectively stalled because school takes up 
much of my time and I'm still pretty lacking in experience with 
garbage collection. That's pretty much why I'm doing the study.




Independent Study at my university using D

2017-03-03 Thread Jeremy DeHaan via Digitalmars-d-announce
Something pretty exciting happened yesterday: I registered for an 
independent study to build a basic garbage collector in D at my 
university.


This is exciting for me because I really enjoyed the work I did 
during the last GSoC, so I'm hoping to learn more about garbage 
collection and contribute to D's garbage collector more in the 
future.


This is especially exciting for the D community because my 
professor wants me to give a presentation at the end, which will 
expose more professors and students to this language. I don't 
have many details about it, but I'm hoping to have it recorded so 
it can be posted.


Re: cost of calling class function

2017-02-22 Thread Jeremy DeHaan via Digitalmars-d

On Thursday, 23 February 2017 at 01:48:40 UTC, Seb wrote:
AFAICT though it was approved, the switch to final by default 
has never happened.


I believe Andrei made an executive decision to shut down final by 
default.


Re: GSoC 2017 Application Rejected

2017-02-10 Thread Jeremy DeHaan via Digitalmars-d-announce
On Friday, 10 February 2017 at 19:00:54 UTC, CRAIG DILLABAUGH 
wrote:

Hello D Community

Just coming here to inform everyone that our D application for 
GSoC 2017 was sadly rejected.  Unfortunately (for me) it is 
completely my fault, I failed to fill out one line on one of 
the three forms that comprised the application.  Even more 
frustrating I went online on the 8th to make sure that 
everything was in order and I noticed and filled in the 
offending line. However I must have either failed to hit 'save' 
or the save itself failed (I will assume the later since that 
makes me look less incompetent).


To make matters worse I got an automated email from Google at 
3am the morning of the deadline warning me, but since I had a 
particularly busy day at work on the 9th I didn't get a chance 
to check my email until shortly after noon on Feb 9th. At which 
point it was too late.


So I want to apologize to the D community for this mix up on my 
part, and in particular to those who invested time in helping 
get ready for this year's GSoC and to you students who were 
looking forward to applying.  However, for anyone who did work 
on the Ideas page that can at least be re-used and we now have 
a much fuller list.


Regards

Craig


Not sure how viable this is, but would the D Foundation be able 
to do its own version of the Summer of Code? The D Summer of Code?


Depending on how much money it has, it could pick some students 
that were working on proposals and pay them what Google would 
have paid them based on performance like in the real GSoC.


MSVC path on windows

2017-01-12 Thread Jeremy DeHaan via Digitalmars-d-learn
I'm trying to automate a build process for a project of mine, and 
I want to get the path to the MSVC toolchain DMD is using. I 
don't want to hard code any paths that may not work on some 
people's set-ups.


I know there are some environmental variables such as 
VS140COMNTOOLS, VS120COMNTOOLS, etc. Are these reliable to get 
the location for some MSVC toolchain?


I've also thought of parsing the PATH to figure out where dmd is 
installed and extract the info from the sc.ini file. Am I being 
ridiculous?





Re: Adding linker paths with spaces using dmd and msvc toolchain

2016-12-31 Thread Jeremy DeHaan via Digitalmars-d-learn
On Friday, 30 December 2016 at 21:51:32 UTC, Rainer Schuetze 
wrote:



On 30.12.2016 19:24, Jeremy DeHaan wrote:

On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan 
wrote:

How does one correctly add a linker path that has spaces?


The quotes get consumed by the command line. The way DMD 
spawns the

linker by creating a new string with all the flags.



Does this happen on other platforms too? There has to be a 
GOOD way to
pass a linker path that has spaces. Should this be considered 
as a bug?





Not sure if it qualifies as "GOOD", but this works:

dmd -m64 "-L/LIBPATH:\"path with spaces\"" main.d


Well, it's probably as good as it's going to get without dmd 
looking for this specifically or having something added. Thanks.


Re: Adding linker paths with spaces using dmd and msvc toolchain

2016-12-30 Thread Jeremy DeHaan via Digitalmars-d-learn

On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan 
wrote:

How does one correctly add a linker path that has spaces?


The quotes get consumed by the command line. The way DMD spawns 
the linker by creating a new string with all the flags.



Does this happen on other platforms too? There has to be a GOOD 
way to pass a linker path that has spaces. Should this be 
considered as a bug?





Re: Adding linker paths with spaces using dmd and msvc toolchain

2016-12-29 Thread Jeremy DeHaan via Digitalmars-d-learn

On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan 
wrote:

How does one correctly add a linker path that has spaces?


The quotes get consumed by the command line. The way DMD spawns 
the linker by creating a new string with all the flags. So it 
smashes everything into a new string, ignoring how the string 
was passed into DMD. I think you can use triple quotes, 
"""string with space""", and it should make the string passed 
to DMD include the string. Might be different for powershell.


You mean I could do -L/LIBPATH:"""path"""?


Adding linker paths with spaces using dmd and msvc toolchain

2016-12-29 Thread Jeremy DeHaan via Digitalmars-d-learn
I have a path to where some .libs are, and this path has some 
spaces in it. Using dmd and the msvc toolchain, I only seem to be 
able to correctly link .lib files if I pass them to the compiler 
with their full paths, or if I give the linker a relative path.


When I add -L/LIBPATH:"path" to the command line, it ends up 
looking like this:

-L/LIBPATH:"C:\Users\Jeremy DeHaan\Desktop\CODE\dsfml\lib".

The linker will complain that it cannot open input file 
'DeHaan\Desktop\CODE\dsfml\lib.obj'.


How does one correctly add a linker path that has spaces?


Re: [GSoC] Precise GC

2016-10-22 Thread Jeremy DeHaan via Digitalmars-d-announce

On Monday, 17 October 2016 at 02:59:15 UTC, Dsby wrote:

On Friday, 14 October 2016 at 03:26:31 UTC, FrankLike wrote:
On Friday, 2 September 2016 at 03:25:33 UTC, Jeremy DeHaan 
wrote:

Hi everyone,

I know I'm super late to the party for this, and sorry for 
that. While my work on the precise GC didn't go as planned, 
it is closer than it was to be getting merged.


[...]


On Friday, 2 September 2016 at 03:25:33 UTC, Jeremy DeHaan 
wrote:

Hi,how about the precise GC, now?


I want to known too.


I was asked the same question on github, but I'll answer it here 
too with a couple more details.


I've done a little work, but not enough to getit finished. I 
started school a couple of weeks ago and I'm still trying to get 
my schedule figured out, but I'm hoping to start putting some 
regular effort into it starting next week.


Re: [GSoC] Precise GC

2016-09-08 Thread Jeremy DeHaan via Digitalmars-d-announce

On Wednesday, 7 September 2016 at 02:15:30 UTC, Dsby wrote:
On Friday, 2 September 2016 at 03:25:33 UTC, Jeremy DeHaan 
wrote:

Hi everyone,

I know I'm super late to the party for this, and sorry for 
that. While my work on the precise GC didn't go as planned, it 
is closer than it was to be getting merged.


[...]


In Mac 32 bit. the test is not pass.


I didn't have a mac to test this on at the time. I currently have 
some things ordered so that I can see what is actually going on 
and fix this.


Re: [GSoC] Precise GC

2016-09-02 Thread Jeremy DeHaan via Digitalmars-d-announce

On Friday, 2 September 2016 at 06:54:57 UTC, Ali Çehreli wrote:

On 09/01/2016 08:25 PM, Jeremy DeHaan wrote:

> I will still continue working on it in the hopes it'll get in.

Great news! :)

> I
> discovered that I really enjoyed working on the garbage
collector

If that's not motivation enough...

> I was recently accepted to the University of Washington's
> computer science program

... now we have your address. We will hunt you if you don't 
complete the GC work. :p


Ali


There's more than one UW campus! Take that!


Re: [GSoC] Precise GC

2016-09-02 Thread Jeremy DeHaan via Digitalmars-d-announce

On Friday, 2 September 2016 at 05:19:57 UTC, thedeemon wrote:
On Friday, 2 September 2016 at 03:25:33 UTC, Jeremy DeHaan 
wrote:

Hi everyone,

I know I'm super late to the party for this, and sorry for 
that. While my work on the precise GC didn't go as planned, it 
is closer than it was to be getting merged.


My open PR for the actual inclusion of the precise GC is here:
https://github.com/dlang/druntime/pull/1603


So what's its current state, how is it different from the 
version Rainer had years ago? Is stack scan precise? Are 
closures scanned precisely? What about unions?


The version in the pull request is not different from the one 
Rainer presented at all. It's actually the same one, just updated 
with what has been changed in druntime recently and my attempts 
at making the marking phase faster. It isn't any faster, but I 
didn't realize this due to benchmarking differences on AMD and 
Intel platforms. I should correct this in the next couple of days 
and performance can be assessed again.


Scanning the stack would require some support from the compiler. 
Precisely scanning unions is tricky since they could mix pointer 
and non pointer types. I'm not sure about closures. If I've done 
anything with closures I'm not aware of it. I have yet to 
actually work with the compiler, but in the future I will have to 
I suppose.


We'd be happy to see some overview of this version, what it 
does and how it succeeds (or fails).


It is essentially in a similar state that it was when Rainer 
presented it at DConf2013. I spent a lot of time doing research 
on techniques to improve its performance and I did start working 
on a sort of proof of concept for some of these ideas, but 
implementing it in a cohesive way would have required a lot more 
than was possible in the GSoC timeframe and it just didn't 
happen. It's pretty late for me here, but I will definitely 
explain more about some of these things later. It's essentially 
stuff that I do on my own time.


[GSoC] Precise GC

2016-09-01 Thread Jeremy DeHaan via Digitalmars-d-announce

Hi everyone,

I know I'm super late to the party for this, and sorry for that. 
While my work on the precise GC didn't go as planned, it is 
closer than it was to be getting merged.


My open PR for the actual inclusion of the precise GC is here:
https://github.com/dlang/druntime/pull/1603

Even though GSoC is over and it isn't quite ready to be merged, I 
will still continue working on it in the hopes it'll get in. I 
have about a month until school starts up again, and I'm going to 
try to get it merged before that point.


Through the work I did and the research of a couple of GC topics, 
I discovered that I really enjoyed working on the garbage 
collector and I plan on continuing that. I was recently accepted 
to the University of Washington's computer science program and I 
am currently working on getting some independent study classes 
set up for future GC work. Once I have some better programming 
chops I'm hoping to help take D's GC to new heights.


Thanks to Martin Nowak and Adam Wilson for being my mentors and 
for keeping me going, to Rainer Schuetze for doing a significant 
portion of code review, and to the D community for giving me the 
opportunity to do this work.


Jeremy


What is the correct way to run the auto-tester tests on FreeBSD?

2016-08-20 Thread Jeremy DeHaan via Digitalmars-d-learn
I'm trying to figure out how to run the auto-tester tests locally 
on FreeBSD and I'm running into an issue. I managed to get the 
tests to run on a 32 bit after a fashion, but I can't seem to get 
the tests to run successfully on the 64 bit version.


Here's what I've done so far.

git cloned dmd, druntime, and phobos.

ran 'gmake -f posix.mak auto-tester-build' in the dmd directory

ran 'gmake -f posix.mak' in both druntime and phobos directories

ran 'gmake -f posix.mak auto-tester-test' in the dmd directory

The tests start, however after the first test (issue8671.d) I get 
a strange error message:

Error: module  is in file '.d' which cannot be read

Do I need to set up the system in a specific way to get these 
tests to properly run or is something else going on here? Note: 
this is using the master version of each repo, I'm not trying out 
my own branches yet.


Re: Auto-testing issue on FreeBSD

2016-08-20 Thread Jeremy DeHaan via Digitalmars-d
I apologize as this might be better in the learn section, but I'm 
having another issue trying to run tests on FreeBSD. On a 64 bit 
system (tests ran just fine on a 32 bit system) I'm getting this 
error on the first test ran:


Running runnable tests
 ... runnable/issue8671.d   (-inline -release -g -O -fPIC)
Error: module  is in file '.d' which cannot be read

Any idea what's going on here? I've never seen anything like this 
before.






Auto-testing issue on FreeBSD

2016-08-20 Thread Jeremy DeHaan via Digitalmars-d
Hey All. I'm trying to track down an auto-tester failure on 
FreeBSD, so I decided to run the same tests myself locally. I 
encountered the following error:


runnable/extra-files/cppb.cpp:297:37: error: 'va_list' has not 
been declared

 void myvprintfx(const char* format, va_list);

I added #include  to the file, and then everything ran 
fine. Should I have set up my system differently so that I didn't 
need to edit anything or should this be added to the file anyway?


   Jeremy


Re: What is up with building DMD (et al.) on Windows?

2016-05-24 Thread Jeremy DeHaan via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 14:30:44 UTC, Vladimir Panteleev 
wrote:

On Tuesday, 10 May 2016 at 04:48:23 UTC, Jeremy DeHaan wrote:
Building DMD, Phobos, and druntime on Linux is so easy and 
straight forward. It all works as expected. What's up with 
building DMD on Windows?


For historical reasons, the Windows makefiles take a different 
approach in many aspects. One important point is that they are 
limited to the feature set of the Digital Mars make 
implementation, which is extremely basic.


There is one thing that I don't understand about the Windows 
makefiles though. The Posix makefiles for druntime and phobos use 
the dmd executable found in dmd/src/ and that makes sense. It is 
the one you should be using. That is not the case for the Windows 
makefiles though. It uses the one found on PATH even though it 
would be easy to do the same as the Posix version. Why is that?





Re: What is up with building DMD (et al.) on Windows?

2016-05-24 Thread Jeremy DeHaan via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 14:30:44 UTC, Vladimir Panteleev 
wrote:

On Tuesday, 10 May 2016 at 04:48:23 UTC, Jeremy DeHaan wrote:
After DMD is built, other things keep getting built by DMC. I 
get more than a few errors due to having an eof character on 
the first line of some .h files, or something like that.


I've never seen such an error. Do you have the details?



Late reply, but I was building DMD on a different computer today 
and it reminded me of this.


After dmd.exe is built, I see the command `dmd -run 
checkwhitespace` with a bunch of files following it. The errors I 
see are from this.


Error - file 'aggregate.h' contains windows line endings at line 1
Error - file 'aliasthis.h' contains windows line endings at line 1
Error - file 'arraytypes.h' contains windows line endings at line 
1


And so on.


What is up with building DMD (et al.) on Windows?

2016-05-09 Thread Jeremy DeHaan via Digitalmars-d-learn
I went to build DMD on Windows for the first time tonight and I 
have to say that it was a terrible experience when compared with 
Linux.


First issue I ran into was having HOST_DC not being set. I'm not 
sure if the DMD installer is supposed to do this or if I needed 
to take care of it, but it wasn't mentioned anywhere I could 
find. I finally just set it myself.


Then it builds DMD, but gets placed in dmd/src/ instead of its 
own directory.


After DMD is built, other things keep getting built by DMC. I get 
more than a few errors due to having an eof character on the 
first line of some .h files, or something like that.


I also built druntime, but instead of trying to use a freshly 
built dmd.exe in the neighboring DMD source directory, it went 
for the one in PATH. I haven't bothered to build Phobos on 
Windows yet.


Building DMD, Phobos, and druntime on Linux is so easy and 
straight forward. It all works as expected. What's up with 
building DMD on Windows?


Re: How the heck is onInvalidMemoryOperationError() nothrow?

2016-05-06 Thread Jeremy DeHaan via Digitalmars-d-learn

On Friday, 6 May 2016 at 03:24:23 UTC, tsbockman wrote:

On Friday, 6 May 2016 at 02:57:59 UTC, Jeremy DeHaan wrote:

[...]


From the spec 
(https://dlang.org/spec/function.html#nothrow-functions):
"Nothrow functions can only throw exceptions derived from 
class Error."


Throwing an Error is, for many purposes, considered 
fundamentally different than throwing an Exception because 
Error objects aren't meant to be caught by user code. Throwing 
an Error is supposed to just be a way of crashing the program 
with a nice message and stack trace.


A key benefit of this distinction, is that it enables the use 
of `assert()` statements in `nothrow` code.


Oh, interesting. That makes sense, thanks.


How the heck is onInvalidMemoryOperationError() nothrow?

2016-05-05 Thread Jeremy DeHaan via Digitalmars-d-learn
In core.exception, we have a lovely function called 
onInvalidMemoryOperationError(). This function is marked as 
nothrow (plus other annotations). This function literally does 
nothing except throwing an error. How can it be marked as nothrow?


Re: GSoC 2016 - Precise GC

2016-05-05 Thread Jeremy DeHaan via Digitalmars-d-announce

On Wednesday, 4 May 2016 at 12:42:30 UTC, jmh530 wrote:

On Wednesday, 4 May 2016 at 02:50:08 UTC, Jeremy DeHaan wrote:


I'm not sure, but one would think that @safe code wouldn't 
need any extra information about the union. I wouldn't know 
how to differentiate between them though during runtime. 
Probably someone with more experience with the compiler would 
know more about that kind of thing.


You can identify safe functions with
https://dlang.org/phobos/std_traits.html#isSafe
or
https://dlang.org/phobos/std_traits.html#functionAttributes


All I meant was that I don't know enough about what the compiler 
does with built in types to make this work. It almost sounds like 
we would need a safe union and unsafe union type and do some 
extra stuff for the unsafe union, but I'm just starting to learn 
about this stuff.


Re: GSoC 2016 - Precise GC

2016-05-03 Thread Jeremy DeHaan via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 19:05:22 UTC, jmh530 wrote:

On Tuesday, 3 May 2016 at 18:15:20 UTC, Jeremy DeHaan wrote:


I am reading a paper on how one could use extra information 
about what was last assigned to a union in order to scan them 
precisely. I haven't read the whole thing yet, but it looks 
like it could be done.


Not sure if it is something I can get to in the course of my 
project though. Scanning only unions conservatively is still 
pretty good.


Does it matter that @safe code does not allow unions of 
pointers and non-pointers?


I'm not sure, but one would thing that @safe code wouldn't need 
any extra information about the union. I wouldn't know how to 
differentiate between them though during runtime. Probably 
someone with more experience with the compiler would know more 
about that kind of thing.


Re: GSoC 2016 - Precise GC

2016-05-03 Thread Jeremy DeHaan via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 16:44:32 UTC, Jack Stouffer wrote:

On Tuesday, 3 May 2016 at 16:15:27 UTC, Jeremy DeHaan wrote:
I agree, but a precise heap scan should be the easiest part of 
this project. Rainer Schuetze has already implemented this and 
presented it at a dconf a few years ago(2013?). My plan is to 
use that since I know it works, and that frees up my time to 
focus on pretty much everything else.


I don't remember all the details, but I'm pretty sure that 
Rainer, or maybe someone else, was talking about how a precise 
GC is not completely possible in D because D has unions.


I am reading a paper on how one could use extra information about 
what was last assigned to a union in order to scan them 
precisely. I haven't read the whole thing yet, but it looks like 
it could be done.


Not sure if it is something I can get to in the course of my 
project though. Scanning only unions conservatively is still 
pretty good.


Re: GSoC 2016 - Precise GC

2016-05-03 Thread Jeremy DeHaan via Digitalmars-d-announce

On Tuesday, 3 May 2016 at 06:23:51 UTC, Yura Sokolov wrote:

On Monday, 2 May 2016 at 15:29:15 UTC, Jeremy DeHaan wrote:

Hi everyone!

I'm a little late to the party as far as my announcement goes, 
but I have been busy reading code and doing research for my 
project.


[...]


Great! That is what should have been done long time ago.

I'm pretty sure, if you implement just precise heap scan (and 
lock removal), it will be already huge win.


I agree, but a precise heap scan should be the easiest part of 
this project. Rainer Schuetze has already implemented this and 
presented it at a dconf a few years ago(2013?). My plan is to use 
that since I know it works, and that frees up my time to focus on 
pretty much everything else.


GSoC 2016 - Precise GC

2016-05-02 Thread Jeremy DeHaan via Digitalmars-d-announce

Hi everyone!

I'm a little late to the party as far as my announcement goes, 
but I have been busy reading code and doing research for my 
project.


I was selected for this year's GSoC to implement a Precise GC, 
but I'm also planning to remove the lock on allocations as 
outlined in my proposal: 
https://drive.google.com/file/d/0B-UTFTbYro4vV0ljMUlSTEc2eEU/view?usp=sharing



My repository for the code can be found here: 
https://github.com/Jebbs/druntime



I will be posting of my progress in this thread throughout the 
course of the summer, but right now I am mainly focusing on 
familiarizing myself with all of the GC code since there is quite 
a lot of it. You will probably see me pushing some updates to 
documentation between now and when GSoC officially starts, but I 
hope to have already started making progress before then.


I'll do my best to not let you all down!


Re: Potential GSoC project - GC improvements

2016-03-19 Thread Jeremy deHaan via Digitalmars-d

On Friday, 18 March 2016 at 16:41:21 UTC, Rainer Schuetze wrote:



On 15.03.2016 02:34, Jeremy DeHaan wrote:

[...]


Being always way behind reading the forum these days, I'm a 
little late and have not read all the messages in this thread 
thoroughly. Here are some thoughts:


[...]


Thank you for the feedback. I'm still working on my proposal so 
nothing is set in stone just yet. I'm very interested in working 
on the GC for this GSoC, so what would you suggest be my main 
focus? It sounds like you already have a GC that is more or less 
what I was planning on implementing...


Re: Destructor order

2016-03-19 Thread Jeremy DeHaan via Digitalmars-d-learn

On Friday, 18 March 2016 at 15:07:53 UTC, Andrea Fontana wrote:
On Friday, 18 March 2016 at 15:03:14 UTC, Steven Schveighoffer 
wrote:

On 3/18/16 10:58 AM, Andrea Fontana wrote:
On Friday, 18 March 2016 at 14:53:20 UTC, Steven 
Schveighoffer wrote:

On 3/18/16 7:44 AM, Nicholas Wilson wrote:

[...]


I think technically not true. If you call __dtor directly, 
it does not

recurse. But this is an implementation detail.



Why doesn't this print ~B ~A?
http://dpaste.dzfl.pl/0bef0a4316b7

It raises a bug on my code because dtor are called in "wrong" 
order.

b holds a ref to a, why a is desctructed before b?


Structs are contained completely within the class instance 
memory block (e.g. the OP's code). Classes are references. 
They are not destroyed when you destroy the holder, that is 
left up to the GC, which can destroy in any order. And in 
fact, it's a programming error to destroy any GC-allocated 
memory inside your dtor, because it may already be gone!


-Steve


Not the case. I'm writing a binding for a library. Class A and 
B wrap c-struct and on d-tor I have to free underlying c object 
calling c-library destroyer. I'm not destroying any 
d/GC-allocated object. But of course i have to destroy c object 
in the correct order... How to?


You can't rely on classes to have their destructors call in any 
particular order. My guess is that the GC is going through and 
deallocating them in the order they appear on the heap.


If you need destructors called in a reliable manner, use structs 
instead of classes or call destroy on your objects manually.


Re: Potential GSoC project - GC improvements

2016-03-14 Thread Jeremy DeHaan via Digitalmars-d
I haven't had power for a couple of days, but it looks like the 
discussion has gone along pretty ok. After reading everything, I 
think I'm inclined to agree with Adam and the main focus of my 
proposal will be a precise GC (or as precise as we can get). I'll 
definitely need some guidance, but I'll be learning everything I 
can about GC's and precision until the start of the project.


On Monday, 14 March 2016 at 05:28:13 UTC, Adam Wilson wrote:
Maybe ... why don't instead of trying to compete with everybody 
else, we do our own thing, and do it very well. As long as 
we're just another "me too" operation people will treat us like 
we are. Let's focus on being the best D language out there. And 
D needs a GC, so let's build the best damn garbage collector 
the natively-compiled world has every seen.



That is what I hope to work towards. Hopefully next year I can 
work on making a generational GC, or something else depending on 
how much time I could dedicate between when this GSoC is finished 
and the next begins.


Adam, can you reach out to Craig and let him know you're willing 
to mentor this project if it get's accepted? I talked with him a 
few days ago via email and he said that someone would need to 
take it on but he wasn't sure who.






Re: Potential GSoC project - GC improvements

2016-03-12 Thread Jeremy DeHaan via Digitalmars-d

On Saturday, 12 March 2016 at 08:50:06 UTC, Adam Wilson wrote:
If I may make a suggestion. The lock free work is unlikely to 
require the entirety of GSoC. And the precise GC is the next 
most important thing on your list and will have the biggest 
impact on GC performance.


Rainer has two different precise GC's in pull requests right now 
and both are slower than the current one unless there are false 
pointers.  I would expect anything I come up with to largely act 
the same. The reason I keep pushing for a generational garbage 
collector is because I think it would be where we would see the 
most benefit in terms of general performance.



Once the GC is fully precise we can implement a fully 
compacting GC, which improves the usefulness of generational 
collection. Additionally, precision allows a significant amount 
of work to be done in improving the performance of the GC in 
multi-threaded scenarios. It should be quite possible to avoid 
needing fork() or anything like it altogether. I know that the 
.NET GC doesn't need to use anything like it.


A compacting GC could be built on top of a generational GC 
without much difficulty I would think, if we wanted to go that 
route. The compaction would just happen as part of a collection 
cycle when things are moved into the next generation. I have 
concerns about doing any compaction though, mostly because D can 
have both references and pointers to objects, and I don't know 
how we would want to go about updating pointers. Especially since 
pointers to D objects can exists in C and C++ code.


Another reason I want to work on a generational GC is because 
this can also lead into a concurrent GC without trying to emulate 
fork() on windows. The .Net GC has 3 generations with the last 
one having its collections running concurrently because it is 
unlikely to affect anything else going on. They don't bother 
running the other generations concurrently because their 
collections are really short. We could do something similar.


Perhaps someone more intimate with GC's than I am can speak up, 
but I think that a generational GC would be the best use of time 
in relation to performance gains. Other things can then be 
implemented on top of it later.



Also, I would strongly recommend getting this book and reading 
it cover to cover before starting:

http://www.amazon.com/gp/product/1420082795/ref=pd_lpo_sbs_dp_ss_1?pf_rd_p=1944687562_rd_s=lpo-top-stripe-1_rd_t=201_rd_i=0471941484_rd_m=ATVPDKIKX0DER_rd_r=0QD9X3E5QATSBCBT6BMM


Thank you for the link to the book. I was planning on this one 
http://www.amazon.com/gp/product/0471941484/ , but maybe I will 
buy them both.





Re: Potential GSoC project - GC improvements

2016-03-11 Thread Jeremy DeHaan via Digitalmars-d

Thank you all for the feedback.

I think I might still need a little more feedback as to what the 
project should actually entail, but here's what it's looking like 
so far:


Implement lock free allocation using std.experimental.allocator's 
freelists (SharedFreeList? It was the only thing in the 
documentation that specifically mentions lock free allocation)


Implement a generational garbage collector

Implement precise garbage collection (possibly piggybacking off 
of Rainer's work)



Does anyone think that might be too much to take on or does it 
sound pretty good? I have other garbage collector things I'd like 
to explore, but I they should probably go in the "if time allows" 
category at this point.


   Jeremy


Re: Potential GSoC project - GC improvements

2016-03-10 Thread Jeremy DeHaan via Digitalmars-d
On Thursday, 10 March 2016 at 15:24:48 UTC, Andrei Alexandrescu 
wrote:

On 3/9/16 10:40 PM, NX wrote:
I think the best possible improvement for GC is making it 
lock-free.

Currently, GC lock cause some serious performance penalties for
multithreaded code when frequent allocations take place.


I agree. A first step would be easy to do with std.allocator's 
thread-local freelists. -- Andrei


I was looking into this, but I am slightly hesitant. Should the 
gc use something in std.experimental? Or should we think that's 
ok?


I also know that there are some people that think we should avoid 
using Phobos in druntime.


Potential GSoC project - GC improvements

2016-03-09 Thread Jeremy DeHaan via Digitalmars-d

Hey all,

I'm trying to think of good project ideas for this years GSoC, 
and one in particular I thought would be a great was working on 
and improving the GC. I'm not sure what the scope of this project 
would be like, but at the moment I am thinking writing a 
generational collector would be a good place to start.


I have more ideas, but I don't have a proposal yet. I just wanted 
some initial feedback on the idea, perhaps some advice for scope 
with the time frame in mind, and hopefully someone on the mentor 
list willing to take this on if it were to be accepted.


Jeremy


Re: GSoC Project Feedback - iOS and Android versions of DSFML

2016-03-06 Thread Jeremy DeHaan via Digitalmars-d

On Monday, 7 March 2016 at 05:40:01 UTC, Joakim wrote:

On Monday, 7 March 2016 at 02:34:41 UTC, Jeremy DeHaan wrote:
For those interested in seeing the actual proposal I am 
working on, I have provided the link below. Just know that 
this is my first draft and *a lot* of revising and editing 
still needs to be done.


https://github.com/Jebbs/DSFML/files/160669/DSFML.Summer.of.Code.Proposal.-.FirstDraft.pdf


Please let me know if you think this is worth the effort and 
would make a good GSoF project.


Certainly worth the effort but I'm not sure it's a good GSoC 
project, as I wonder if this is the kind of grunt work that 
they want to sponsor and if it's enough work for a whole 
summer.  That would all depend on more details about what you 
think needs to be done.


Yeah, that's a pretty fair assessment I think. Not being sure if 
this would be good for GSoC is the reason I asked and it's also 
the reason why I am considering other projects as well. I just 
wanted to start with something I know I could do within the given 
time frame and something that I thought would be really useful 
for the D language and community. If I get similar feedback from 
other people, I will probably work on a different proposal.


GSoC Project Feedback - iOS and Android versions of DSFML

2016-03-06 Thread Jeremy DeHaan via Digitalmars-d

Hi all,

I have been working on a proposal for the upcoming GSoC, and its 
to a point where I wanted to get some feedback on things.


I maintain DSFML, a wrapper and binding to the C++ game library 
SFML. Essentially the core of my proposal is to add the ability 
for binding to build iOS and Android versions which can then 
leverage recent work on LDC to build and run on these mobile 
systems. SFML can already target these OS's, so most of the work 
is done there. Barring anything extreme, this would allow D 
programmers to easily work on games for mobile devices pretty 
much as soon as that functionality is officially released in the 
LDC compiler. I think that's pretty damn awesome. There are a few 
other things in my proposal, like updating some things and fixing 
some bugs, but Android and iOS support is pretty much the meat 
and potatoes.


For those interested in seeing the actual proposal I am working 
on, I have provided the link below. Just know that this is my 
first draft and *a lot* of revising and editing still needs to be 
done.


https://github.com/Jebbs/DSFML/files/160669/DSFML.Summer.of.Code.Proposal.-.FirstDraft.pdf


Please let me know if you think this is worth the effort and 
would make a good GSoF project.




Re: GSoC 2016 - D Foundation was accepted!

2016-02-29 Thread Jeremy DeHaan via Digitalmars-d-announce

On Tuesday, 1 March 2016 at 03:21:14 UTC, mate wrote:

On Tuesday, 1 March 2016 at 01:55:09 UTC, Jeremy DeHaan wrote:

Hello everyone!

I didn't see mention of this yet, but earlier today Google 
released their list of accepted Organizations for this year's 
GSoC. Guess what! The D Foundation made the cut!


Thank you to everyone that worked on the proposals and 
application. This is awesome and you all are awesome!




Now to get started on my own application...


I think it would have been polite and safe to wait for Craig’s 
announcement.


This was posted on the GSoC site for almost 6 hours when I posted 
it here and there was no announcement yet. Forgive me if I was 
overly excited.


GSoC 2016 - D Foundation was accepted!

2016-02-29 Thread Jeremy DeHaan via Digitalmars-d-announce

Hello everyone!

I didn't see mention of this yet, but earlier today Google 
released their list of accepted Organizations for this year's 
GSoC. Guess what! The D Foundation made the cut!


Thank you to everyone that worked on the proposals and 
application. This is awesome and you all are awesome!




Now to get started on my own application...


Re: Why does partial ordering of overloaded functions not take return type into account?

2016-02-20 Thread Jeremy DeHaan via Digitalmars-d-learn
On Saturday, 20 February 2016 at 12:29:21 UTC, Jonathan M Davis 
wrote:
On Saturday, February 20, 2016 03:24:45 Jeremy DeHaan via 
Digitalmars-d-learn wrote:


snip


I'm unaware of any language that takes the return type into 
account when overloading. The type the expression test.thing() 
has to be determined before the assignment is evaluated, and it 
would be very confusing if the return type were used for 
overload evaluation in a context like this, because there are 
other contexts where it would be impossible to do that even 
theoretically - the simplest being


auto thingOne = test.thing();

So, suddenly, which function gets called would depend on where 
the expression was used, which would just be confusing and 
error-prone.


- Jonathan M Davis


With the case of auto of course there is ambiguity, you don't 
know which one to pick. In my example there should have been no 
ambiguity at all as only one of the overloads would actually 
compile. That is what confuses me and why I think return type 
should be taken into account.


If there are multiple overloads that have the same number of 
parameters, a very simple addition to the rules of function 
overloading would be "does it compile?" If only one overload 
compiles, use it. If more than one compile, there is ambiguity 
and its an error.


Why does partial ordering of overloaded functions not take return type into account?

2016-02-19 Thread Jeremy DeHaan via Digitalmars-d-learn

module main;

struct ThingOne
{
int thing = 1;
}

struct ThingTwo
{
float thing = 2;
}


struct Test
{
 ThingOne thing()
{
 return ThingOne();
}

ThingTwo thing()
{
return ThingTwo();
}

}


void main()
{
Test test;

ThingOne thingOne = test.thing();
}


test.d(35): Error: main.Test.thing called with argument types () 
matches both:

test.d(17): main.Test.thing()
and:
test.d(22): main.Test.thing()

Why isn't the return type checked when resolving this? Only one 
of the choices would actually compile so there should be no 
ambiguity.


Re: Google Summer of Code 2016 Only A Few Hours Left

2016-02-19 Thread Jeremy DeHaan via Digitalmars-d-announce

On Friday, 19 February 2016 at 20:08:43 UTC, Alex Herrmann wrote:
On Friday, 19 February 2016 at 17:03:57 UTC, Craig Dillabaugh 
wrote:
The GSOC deadline is Feb 19th 19:00 UTC (or 2 PM Wawa time) so 
any last ideas for the Idea's page are welcome.


Our application is completed, but changes can still be made to 
the ideas page.  In fact I suppose we can go on making 
modifications even after the deadline, as I have no idea at 
what time Google takes the snapshots of these pages for 
evaluation.  Thanks to Martin Nowak's suggestion we are now 
participating as "The D Foundation" (rather than Digital Mars).


Thanks to all who have helped out to this point.

Cheers,

Craig


As a prospective student, fingers are crossed for D.


Same here. I started working on some proposals already. I really 
hope D gets accepted.


Re: Any actively maintained qt bindings for D?

2016-02-17 Thread Jeremy DeHaan via Digitalmars-d
On Wednesday, 17 February 2016 at 20:56:27 UTC, Rishub Nagpal 
wrote:

Qtd hasn't been updated in 3 years
Does anyone know of anactively maintained qt library?


I think QML bindings exists, but as far as I know direct Qt 
bindings don't exist/aren't updated.


I want to do a GSoC proposal for direct bindings to Qt, though. I 
have a lot of ideas for doing a binding to Qt proper, but the 
only way I can do it is if I have time.


Re: Struct destructors not always called?

2015-12-27 Thread Jeremy DeHaan via Digitalmars-d-learn

On Sunday, 27 December 2015 at 18:47:52 UTC, Adam D. Ruppe wrote:
On Sunday, 27 December 2015 at 18:40:55 UTC, Jeremy DeHaan 
wrote:
I was playing around with some code today and I noticed that 
in some cases struct destructors are not called.


struct destructors are called when the struct ceases to exist 
in the program.


A global variable never ceases to exist as long as the program 
lives.


So are these left dangling or do they actually get cleaned up at 
the program exit?


Struct destructors not always called?

2015-12-27 Thread Jeremy DeHaan via Digitalmars-d-learn
I was playing around with some code today and I noticed that in 
some cases struct destructors are not called.


for example:

impost std.stdio;

SomeStruct global;

void main()
{
   SomeStruct inMain;
   writeln(global.thing);
   writeln(inMain.thing);
   writeln(getSomeInt());
}

int getSomeInt()
{
static SomeStruct inner;
return inner.thing;
}

struct SomeStruct
{
int thing = 100;
~this()
{
writeln("destructor");
}



output is
100
100
100
destructor

Only inMain's destructor is ever called, or at least it is the 
only one that ever prints "destructor" to the console. Are there 
special rules for structs that I'm unaware of?


Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jeremy DeHaan via Digitalmars-d-learn

On Thursday, 17 December 2015 at 03:43:58 UTC, Jakob Ovrum wrote:
On Thursday, 17 December 2015 at 03:31:37 UTC, Jeremy DeHaan 
wrote:
Hi all. I'm interfacing to some C code which include an opaque 
type and some C functions that create and work with a pointer 
to that type. I want to wrap up everything in a struct, and 
the only thing that seems to bug me is initialization.


Since it is C code, I obviously can't read the function that 
creates the opaque type. Not only that, I can't define a 
default constructor. What are my options here?


This is for an API that is intended to be used by people other 
than myself, so I'd like to use something that doesn't look 
ugly or isn't a hack. I really don't like the idea of using a 
factory method or overriding opCall. Am I basically out of 
luck and need to resort to one of these methods?


Using a factory function alongside @disable this(); is the 
canonical way to do this. Although, if your struct is a 
reference type, you can simply allow default construction and 
have it mean a null reference.


Using static opCall here is just a factory function with 
special syntax, but I think it does more harm than good.


Thanks. I guess what bugs me is that I always try to hide the 
fact that the API is a wrapper around C stuff, ie, I want to make 
people feel as though they're using idiomatic D. Doing something 
like this makes it feel like less idiomatic D and more like a 
wrapper. I think I have a solution that I like in my own case 
though. Right now I'm considering something like this: 
http://dpaste.com/3FH3W13








Re: Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jeremy DeHaan via Digitalmars-d-learn

On Thursday, 17 December 2015 at 04:59:20 UTC, Jakob Ovrum wrote:
On Thursday, 17 December 2015 at 04:05:30 UTC, Jeremy DeHaan 
wrote:

http://dpaste.com/3FH3W13


Also, I would be wary of lazy initialization. We have bad 
experiences with it for AAs and standard containers. A typical 
example would be:


void foo(Wrapper w)
{
...
w.doTheThing();
...
}

void main()
{
Wrapper w;
foo();
w.inspect(); // `w` is still a null reference here
}



Thanks for the heads up. I'll think more on this, but you made a 
good point here.


And I guess what I was talking about before is that using a 
factory method feels klunky to me. If the things I am wrapping 
had been written in D they could use default initialization, so 
it feels wrong to do otherwise. I also just don't really like 
factory methods. They feel like a workaround that the end user 
has to deal with. But that's just me.




Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

2015-12-16 Thread Jeremy DeHaan via Digitalmars-d-learn
Hi all. I'm interfacing to some C code which include an opaque 
type and some C functions that create and work with a pointer to 
that type. I want to wrap up everything in a struct, and the only 
thing that seems to bug me is initialization.


Since it is C code, I obviously can't read the function that 
creates the opaque type. Not only that, I can't define a default 
constructor. What are my options here?


This is for an API that is intended to be used by people other 
than myself, so I'd like to use something that doesn't look ugly 
or isn't a hack. I really don't like the idea of using a factory 
method or overriding opCall. Am I basically out of luck and need 
to resort to one of these methods?


Re: DConf keynote speaker ideas

2015-11-21 Thread Jeremy DeHaan via Digitalmars-d
On Saturday, 21 November 2015 at 22:21:48 UTC, Walter Bright 
wrote:

On 11/17/2015 10:48 AM, Andrei Alexandrescu wrote:
I'm thinking of inviting a notable industry luminary to 
deliver a conference

keynote. Please reply to this with ideas! -- Andrei


Maybe someone from JPL who can talk about software on space 
probes.


Sounds like someone just watched The Martian.


Re: scope keyword

2015-11-19 Thread Jeremy DeHaan via Digitalmars-d-learn
On Thursday, 19 November 2015 at 23:16:04 UTC, Spacen Jasset 
wrote:
I thought scope was deprecated, but I see that this is still 
here: http://dlang.org/attribute.html#scope


Is it just the uses on classes and local variables that are 
discouraged, but the use in a function signature will continue? 
in == const scope?


Using scope to allocate on the stack is what you are thinking of, 
but it was only marked for deprecation.


http://dlang.org/deprecate.html#scope%20for%20allocating%20classes%20on%20the%20stack


Re: Here's looking at you, kid

2015-11-18 Thread Jeremy DeHaan via Digitalmars-d

On Sunday, 15 November 2015 at 13:50:36 UTC, Warwick wrote:

On Sunday, 15 November 2015 at 11:46:54 UTC, Saurabh Das wrote:
On Friday, 13 November 2015 at 22:34:18 UTC, Andrei 
Alexandrescu wrote:

[...]


This is slightly off-topic, but: I've been encouraging my 
friends and colleagues to use Dlang over the last year and the 
one pain point they constantly tell me about is that the 
documentation website is "difficult to use" and "looks 
intimidating".


The problem is you click on "Language Reference" and what you 
actually get is a "Language Specification".



Which is funny, because I think the specification page is 
actually a decent reference.


http://dlang.org/spec.html


Re: OSX Foundation framework D binding

2015-11-11 Thread Jeremy DeHaan via Digitalmars-d-learn
On Thursday, 12 November 2015 at 05:50:09 UTC, Vadim Lopatin 
wrote:
On Wednesday, 11 November 2015 at 16:04:44 UTC, Jacob Carlborg 
wrote:

On 2015-11-11 17:02, Jacob Carlborg wrote:

I would recommend creating new bindings which use the new 
Objective-C
interoperability feature that was added in the latest release 
(2.069.0).


You could use DStep [1] to generate the bindings. It will 
generate bindings which are not completely compatible with 
what the compiler can handle. But it can be used as a base.


[1] https://github.com/jacob-carlborg/dstep


Aren't there any ready set of translated and post-processed 
files for main OSX foundations in some repository? Could you 
point at it?


That's doubtful. OS X interoperability is pretty new. If anyone 
has done any bindings like what you want I don't think they've 
announced it.


Re: Is D so powerfull ??

2015-11-08 Thread Jeremy DeHaan via Digitalmars-d

On Monday, 9 November 2015 at 05:16:50 UTC, Daniel Murphy wrote:

On 9/11/2015 4:05 PM, Jeremy DeHaan wrote:



Because that's what this page says:
http://dlang.org/cpp_interface.html



That page is out of date.  Virtual and non-virtual member 
functions, static member functions, and free functions all work 
since ~2.066.


The biggest missing thing is special member functions, ie 
ctor/dtor/operators.


> Declaring it as a struct in D code is freaking genius. I
wonder if
> that works across the board with other compilers and OS's
though.

Mixing struct/class will only work properly with ABIs that 
mangle them the same way, so it's not portable.


We should really update that page then.

What is the correct way to use C++ class instances in D? Can you 
by chance give an example?


Re: Is D so powerfull ??

2015-11-08 Thread Jeremy DeHaan via Digitalmars-d

On Monday, 9 November 2015 at 06:27:22 UTC, Daniel Murphy wrote:

On 9/11/2015 4:26 PM, Jeremy DeHaan wrote:


What is the correct way to use C++ class instances in D? Can 
you by

chance give an example?


extern (C++) class X
{
...
}

extern (C++) void func(X x);

void main(string[] args)
{
func(new X());
}

etc


Didn't you say constructors and destructors are missing? What 
should one do in those cases?


Re: Is D so powerfull ??

2015-11-08 Thread Jeremy DeHaan via Digitalmars-d

On Monday, 9 November 2015 at 06:51:03 UTC, Jeremy DeHaan wrote:

On Monday, 9 November 2015 at 06:27:22 UTC, Daniel Murphy wrote:

On 9/11/2015 4:26 PM, Jeremy DeHaan wrote:


What is the correct way to use C++ class instances in D? Can 
you by

chance give an example?


extern (C++) class X
{
...
}

extern (C++) void func(X x);

void main(string[] args)
{
func(new X());
}

etc


Didn't you say constructors and destructors are missing? What 
should one do in those cases?


Additionally, should we use new in this case? Wouldn't new create 
a pointer to a C++ class? Or does it work differently for 
extern(c++) classes?


Re: Is D so powerfull ??

2015-11-08 Thread Jeremy DeHaan via Digitalmars-d

On Sunday, 8 November 2015 at 23:43:42 UTC, ZombineDev wrote:
On Saturday, 7 November 2015 at 21:02:26 UTC, Jeremy DeHaan 
wrote:

On Saturday, 7 November 2015 at 14:49:05 UTC, ZombineDev wrote:
On Saturday, 7 November 2015 at 14:25:01 UTC, ZombineDev 
wrote:


What standard C does not provide and D does: calling C++ 
free functions nested in namespaces, creating objects of C++ 
classes (with single inheritance), ...
... calling virtual and non-virtual methods on C++ classes 
from D


Actually, you can only call virtual methods on classes. Using 
non-virtual methods isn't supported.


Why do you think so?

See: https://gist.github.com/ZombineDev/19f966273b4a82a5c2f1
Output:

$ g++ --version
g++ (Ubuntu 4.9.2-10ubuntu13) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  
There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE.

$ dmd --version
DMD64 D Compiler v2.069.0-b2
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
$ ./build.sh
$ ./d_class
cpp.add(40, 2): 42
cpp.mul(1.5, 2f, 'B') 198
$ ./cpp_main
d.add(7, 8): 15
d.mul(3.0, 2.0f, 'A'): 390



Because that's what this page says:
http://dlang.org/cpp_interface.html

It's about halfway down, but here's the section I am referring to 
says:


Note:

non-virtual functions, and static member functions, cannot be 
accessed.


That's awesome if I am wrong, but that is what the C++ 
interfacing page says.


Declaring it as a struct in D code is freaking genius. I wonder 
if that works across the board with other compilers and OS's 
though.





Re: Is D so powerfull ??

2015-11-07 Thread Jeremy DeHaan via Digitalmars-d

On Saturday, 7 November 2015 at 14:49:05 UTC, ZombineDev wrote:

On Saturday, 7 November 2015 at 14:25:01 UTC, ZombineDev wrote:


What standard C does not provide and D does: calling C++ free 
functions nested in namespaces, creating objects of C++ 
classes (with single inheritance), ...
... calling virtual and non-virtual methods on C++ classes from 
D


Actually, you can only call virtual methods on classes. Using 
non-virtual methods isn't supported.




Re: -> and :: operators

2015-10-09 Thread Jeremy DeHaan via Digitalmars-d

On Friday, 9 October 2015 at 21:21:10 UTC, deadalnix wrote:

On Friday, 9 October 2015 at 19:54:19 UTC, Jeremy DeHaan wrote:

On Friday, 9 October 2015 at 18:44:50 UTC, Freddy wrote:

On Friday, 9 October 2015 at 04:15:42 UTC, Ali Çehreli wrote:

[...]


Stole from D? You mean java right?


Java doesn't have pointers.


-_-

Yeah reference are definitively not pointer. No they aren't. No 
I told you they aren't. Nope. Not even a little ! No way ! 
That's not true ! I told you that's not true. Nope !


I guess you could argue it that way, but I don't see references 
and pointers as the same. Similar, yes, but not the same.


Re: -> and :: operators

2015-10-09 Thread Jeremy DeHaan via Digitalmars-d

On Friday, 9 October 2015 at 18:44:50 UTC, Freddy wrote:

On Friday, 9 October 2015 at 04:15:42 UTC, Ali Çehreli wrote:
Semi-relatedly, a colleague who has heard many D sales pitches 
from me over the years is recently "looking at Go" and liking 
it very much. He came to me today telling me about this 
awesome Go feature where you just type a dot after a pointer 
and the language is so great that it works! You don't need to 
type (*p).member. Isn't Go awesome!


I responded "yep, it's a great feature and those gostards will 
never admit that they took that feature from D." (There is 
probably earlier precedence but it felt great to say it to my 
friend. :) )


Ali


Stole from D? You mean java right?


Java doesn't have pointers.


DSFML reaches version 2.1

2015-10-07 Thread Jeremy DeHaan via Digitalmars-d-announce
It is my pleasure to announce that DSFML hit version 2.1! This 
version has been a long time coming, but this represents a huge 
milestone for DSFML (and for me!)


DSFML(along with its backend DSFMLC) is a binding and a wrapper 
for SFML - the Simple and Fast Multimedia Library. It does 
input(mouse, keyboard, joysticks/gamepads), audio (buffered 
playback, streamed playback, recording), networking(tcp/udp 
sockets, ftp, http), window and OpenGL context creation, and 
simple 2D graphics using OpenGL (sprites, text, shapes, shaders, 
and vertex arrays). Currently works on Linux, Windows, and OS X.


Reasons that this took so long was:
- Many bug fixes
- Finally passed all included unit tests
- Things make more sense
- Created a website
- Added documentation
- Added tutorials
- School's a bitch

Visit the website at http://dsfml.com to view tutorials, 
documentation, forum, and downloads.


Just a heads up, I have never gotten a project to a point like 
this. I have never had to put a website or tutorials together for 
anything, and this is the first "real" release. I'm sure some 
things don't make as much sense as I think they do. Go easy on me 
;)


Plans for the future:
- Make things more idiomatic to D
- Update to most recent version of SFML
- Better everything (tests, documentation, tutorials, website)

Check it out, have fun, and most importantly let me know if you 
have issues!


https://github.com/Jebbs/DSFML
https://github.com/Jebbs/DSFMLC
http://code.dlang.org/packages/dsfml


Re: DSFML reaches version 2.1

2015-10-07 Thread Jeremy DeHaan via Digitalmars-d-announce

On Wednesday, 7 October 2015 at 17:13:13 UTC, Jeremy DeHaan wrote:

On Wednesday, 7 October 2015 at 16:44:30 UTC, Israel wrote:
On Wednesday, 7 October 2015 at 06:43:18 UTC, Jeremy DeHaan 
wrote:
It is my pleasure to announce that DSFML hit version 2.1! 
This version has been a long time coming, but this represents 
a huge milestone for DSFML (and for me!)


[...]


Oh and you forgot to include these in the prebuilt binaries 
for windows.


libgcc_s_dw2-1.dll
libsndfile-1.dll
libstdc++-6.dll
libwinpthread-1.dll
openal32.dll


Crap! Iknew I forgot something.  I'll get that fixed tonight. 
You should only be missing the libsndfile and openal dll's 
though. I statically linked to everything else.  Apparently 
MinGW doesn't like to do static links to these libraries?  
Maybe I'll rebuild it with VC instead.



Digging a bit, it looks like this happens in the CMake stuff. 
Basically, in normal SFML, the CMake file doesn't allow you to 
statically link to the std libs if you're building a .dll. I felt 
like with D we don't care as much about that, so I disabled the 
check. As far as I can tell it should work fine when built with 
VC(it forces /MT), but nothing special happens with MinGW so it 
still links dynamically to everything. I think I can fix it to 
work automatically, but for now I'll instead simply redo the 
packages to include those files. Thanks for catching that.


Re: DSFML reaches version 2.1

2015-10-07 Thread Jeremy DeHaan via Digitalmars-d-announce

On Wednesday, 7 October 2015 at 12:44:13 UTC, suliman wrote:
Perfect!!! Big thanks! I think not only one are tired from GTK, 
and need simple and compact gui lib


It's not really a gui library. I mean, you could use it as such I 
guess, but it's more for game development.


Re: DSFML reaches version 2.1

2015-10-07 Thread Jeremy DeHaan via Digitalmars-d-announce

On Wednesday, 7 October 2015 at 16:44:30 UTC, Israel wrote:
On Wednesday, 7 October 2015 at 06:43:18 UTC, Jeremy DeHaan 
wrote:
It is my pleasure to announce that DSFML hit version 2.1! This 
version has been a long time coming, but this represents a 
huge milestone for DSFML (and for me!)


[...]


Oh and you forgot to include these in the prebuilt binaries for 
windows.


libgcc_s_dw2-1.dll
libsndfile-1.dll
libstdc++-6.dll
libwinpthread-1.dll
openal32.dll


Crap! Iknew I forgot something.  I'll get that fixed tonight. You 
should only be missing the libsndfile and openal dll's though. I 
statically linked to everything else.  Apparently MinGW doesn't 
like to do static links to these libraries?  Maybe I'll rebuild 
it with VC instead.


Re: Anyone working on updated Qt bindings?

2015-10-03 Thread Jeremy DeHaan via Digitalmars-d

On Saturday, 3 October 2015 at 08:25:25 UTC, Manu wrote:
On 3 October 2015 at 11:58, Jeremy DeHaan via Digitalmars-d 
<digitalmars-d@puremagic.com> wrote:
I know a lot of people wish they had new bindings for Qt, so I 
was going to> give it a go soon. Is anyone currently working 
on such a thing? I'd rather

help someone than compete with them.


I've spent about 2 weeks trying to get the latest Qt bound 
up... it's

a LOT of work, but I have done a fair bit of core stuff.
I can commit it somewhere if you wanna hack at it too...


Yeah,that'd be great. I'm only interested in working on the 
latest Qt. You said two weeks and that's just been the core 
stuff. Are you doing the binding by hand?


Re: Anyone working on updated Qt bindings?

2015-10-03 Thread Jeremy DeHaan via Digitalmars-d

On Saturday, 3 October 2015 at 06:33:32 UTC, Israel wrote:
On Saturday, 3 October 2015 at 01:58:01 UTC, Jeremy DeHaan 
wrote:
I know a lot of people wish they had new bindings for Qt, so I 
was going to give it a go soon. Is anyone currently working on 
such a thing? I'd rather help someone than compete with them.


btw i see youve made some changes to DSFML. DSFML master is 
broke with symbol and linking problems. I dont know how to fix.


A little off topic to my question, don't you think? :P

Yes I did make a bunch of changes to DSFML, and unfortunately I 
got ahead of myself when I pushed the code back into master. I 
had some issues packaging stuff, and I couldn't finish so I 
didn't make an announcement like I had planned.


Basically there is a new back end that fixed a bunch of stuff, so 
that is your issue. You'll need to build it yourself, but it is 
super easy. See build tutorial here: 
http://dsfml.com/docs/buildingfromsource.html


Anyone working on updated Qt bindings?

2015-10-02 Thread Jeremy DeHaan via Digitalmars-d
I know a lot of people wish they had new bindings for Qt, so I 
was going to give it a go soon. Is anyone currently working on 
such a thing? I'd rather help someone than compete with them.


Re: Interface file

2015-10-01 Thread Jeremy DeHaan via Digitalmars-d

On Thursday, 1 October 2015 at 01:41:22 UTC, Jan Johansson wrote:


Thanks Jeremy,

Do you spot a weakness in your proposed code snip? The 
declaration for interface is done in two separate files, both 
test.d and test.di. Scattered declarations has never been a 
good idea. I know that I can ask the DMD to do declaration 
files for me, but the use case for that is to speed up building 
of executable.


But is it that the separation of declaration and implementation 
was never the intention in the design of D?


//Jan


Having the declarations in both files is the point though.

If you notice, the only difference between my test.d and test.di 
files is that test.di is only the declarations. The speed 
increase for compiling happens because of this. You still need 
all declarations to be there when you build, or at least the ones 
you use.


You build the library with test.d and then build using test.di 
when you use the library. You never use both test.d and test.di 
together. Double check my build commands.


Re: Interface file

2015-09-30 Thread Jeremy DeHaan via Digitalmars-d
On Wednesday, 30 September 2015 at 17:51:50 UTC, Jan Johansson 
wrote:

Hello all,

I'm testing D language, and the first thing I want to do is to 
separate declaration from implementation. I was happy to find 
support of interfaces in the D language, and set out to do a 
basic test. However, this test failed, and I want some newbie 
help to understand how it should be done in D language.


--

The interface file (I called it test.di):

// Interface
interface IMyTest {
  void Write(string message);
}

// Factory for type implementing IMyTest
IMyTest createInstance();

--

The library file (I called it test.d):

import std.stdio;

class MyTest : IMyTest {
void Write(string message) {
writeln(message);
}
}

IMyTest createInstance() {
return new MyTest;
}

--

And finally the main file (I called it main.d):

import test;
import std.stdio;

void main() {
auto p = createInstance();
p.Write("Hello, World!");
}

--

The assumption was that I could do:

  dmd test.d test.di -lib -oftest

and next do:

  dmd main.d test.di test.a


The shared information is in the test.di file.

However, this failed, since the first statement generates the 
following:


  dmd test.d test.di -lib -oftest
  Error: module test from file test.di conflicts with another 
module test from file test.d


I guess it is because the file name test.d and test.di creates 
conflict, surfaced as module test.


How can I accomplish what I want to do?

Kind regards,
Jan Johansson



Like Adam said, the real difference between a .d and a .di file 
is that the .di file has all the guts removed and is just the 
declarations.


If using a .di file is really what you want, you could try 
something like this?


test.d:
module test;

interface IMyTest {
   void Write(string message);
 }


 IMyTest createInstance() {
class MyTest : IMyTest {
 void Write(string message) {
 import std.stdio;
 writeln(message);
 }
 }

 return new MyTest;
 }

---

test.di:

module test;

interface IMyTest {
   void Write(string message);
 }


 IMyTest createInstance();

---

main.d:

import test;

void main() {
auto p = createInstance();
p.Write("Hello, World!");
}
--

and then

dmd test.d -lib -oftest

and

dmd main.d test.di test.a


Also like Adam said, dmd can create these .di files for you so 
you don't have to!


(This is untested, but should work/be close to working)


Re: 64bit linking on Windows without Visual Studio

2015-04-20 Thread Jeremy DeHaan via Digitalmars-d

On Monday, 20 April 2015 at 04:32:32 UTC, Joakim wrote:
There are three aspects of Visual Studio used for D's Win64 
support: the Microsoft C compiler to compile a few C files in 
COFF64 format, the Microsoft COFF64 linker, and the Microsoft C 
library in COFF64 format.  Replacing only one will not get you 
very far.


As ifor the C compiler, wth DDMD around the corner that seems 
like it well be a non issue very soon. Really, all we would need 
are the linker and the libraries, right? I could still do more 
fiddling, but when I used this linker I used the library files 
that came with it almost exclusively. There was only one that I 
needed to add, and I'm sure that it can be figured out.


I just really like the idea of a self contained D compiler set up 
that doesn't need any other downloads to get working.


Re: How to generate D binding with SWIG?

2015-04-06 Thread Jeremy DeHaan via Digitalmars-d-learn
Do you even need to use swig? It looks like gdal has  a C 
interface. I think that htod would be what you're looking for


http://dlang.org/htod.html



gdc and ldc command line examples?

2015-03-30 Thread Jeremy DeHaan via Digitalmars-d-learn

Hey all,

I am finally working on moving out of dmd territory and playing 
with gdc and ldc. I was hoping that I could get some links to 
some example command lines. I'm mainly interested command lines 
regarding linking to libraries and building static libraries.


My guess is that gdc will function essentially the same as gcc 
for these things, or at least close enough to where I can figure 
it out, but I have had no experience with ldc and I am having 
trouble tracking down documentation for it.


Thanks!


Re: DDMD just went green on all platforms for the first time

2015-02-21 Thread Jeremy DeHaan via Digitalmars-d
On Saturday, 21 February 2015 at 14:02:41 UTC, Daniel Murphy 
wrote:

https://auto-tester.puremagic.com/?projectid=10

This is a pretty big milestone for the project.  For the first 
time, an unpatched dmd can build ddmd, and that ddmd can build 
druntime and phobos and pass all the test suites.


Hopefully in the next couple of weeks the remaining minor 
issues will be fixed (eg makefile changes, ddmd runs out of 
memory compiling std.algorithm unittests on win64) and we can 
start adding ddmd to master alongside the C++ compiler.


A big thanks to Brad for upgrading the autotester, and to 
everyone who has helped fix bugs and get patches merged over 
the last couple of years.


Github shows 376 closed DDMD pull requests, which is about 8% 
of all dmd pull requests ever.



This is awesome! Does that mean we're going to see a DDMD release 
for 2.067?


Re: Are there any 2D games libraries available for D2?

2015-02-20 Thread Jeremy DeHaan via Digitalmars-d

On Friday, 20 February 2015 at 07:12:34 UTC, Gan wrote:

On Friday, 20 February 2015 at 04:52:29 UTC, Jeremy DeHaan

Chiming in with my own library. https://github.com/Jebbs/DSFML

Things are a bit of a mess, but I'm gearing up for a release 
soon and things will be all nice and tidy and structured.


I really want to check out DGame but I suggest withholding from 
it until it becomes actively maintained again.


I'm using DSFML and it is one of the easiest. Though I had 
strange issues like high ram usage and text not rendering. 
Though the ease of use and performance is phenomenal.


Thanks for the heads up. I'll open an issue to inspect RAM usage, 
but can you let me know when you were having Text rendering 
issues so I can inspect that too?


Re: Are there any 2D games libraries available for D2?

2015-02-20 Thread Jeremy DeHaan via Digitalmars-d

On Friday, 20 February 2015 at 18:23:09 UTC, Gan wrote:
On Friday, 20 February 2015 at 15:15:36 UTC, Jeremy DeHaan 
wrote:

On Friday, 20 February 2015 at 07:12:34 UTC, Gan wrote:

On Friday, 20 February 2015 at 04:52:29 UTC, Jeremy DeHaan
Chiming in with my own library. 
https://github.com/Jebbs/DSFML


Things are a bit of a mess, but I'm gearing up for a release 
soon and things will be all nice and tidy and structured.


I really want to check out DGame but I suggest withholding 
from it until it becomes actively maintained again.


I'm using DSFML and it is one of the easiest. Though I had 
strange issues like high ram usage and text not rendering. 
Though the ease of use and performance is phenomenal.


Thanks for the heads up. I'll open an issue to inspect RAM 
usage, but can you let me know when you were having Text 
rendering issues so I can inspect that too?


This link can give you more information about it:
http://en.sfml-dev.org/forums/index.php?topic=17550.0

I started getting text rendering issues when I was playing with 
my space background render textures. It's kinda strange cause 
they seem unrelated.


I'll check it out, thanks!


Re: How to make Application bundle from Executable? (Mac)

2015-02-19 Thread Jeremy DeHaan via Digitalmars-d-learn

On Friday, 20 February 2015 at 03:26:47 UTC, Gan wrote:
I managed to copy an application bundle and change stuff inside 
it to run my executable, but it was very manual and kinda 
hackish. Also I can't get my application to load images that I 
place in the Resources folder(or any folder in the bundle for 
that matter).



Is there an official way to turn a D executable into a Mac 
Application Bundle?


I don't have an answer, but I too am interested in hearing what 
others have to say about this.


Re: Are there any 2D games libraries available for D2?

2015-02-19 Thread Jeremy DeHaan via Digitalmars-d

On Friday, 20 February 2015 at 00:07:20 UTC, Kingsley wrote:

On Thursday, 19 February 2015 at 23:59:14 UTC, Kingsley wrote:

I use Dgame which has a really nice and simple interface

http://rswhite.de/dgame4/

From the web page:

Dgame is a 2D framework which is based on the SDL and OpenGL, 
and is designed for the D programming language. The design is 
based on Pygame and as well on the SFML from the C++ 
programming language.


Cheers,
Stew


I'm looking at DGame - I'm on osx - so I guess I have to build 
all the dependencies myself sigh - Once I get it installed 
and working - it looks like it may be enough for what I want.


I guess I'll have to make it work with dub myself to make it 
easier to get started with.


DGame has a dependency on Derelict 3 - but going to the link 
provided says that project is no longer maintained and doesn't 
work with the latest DMD compiler. It points to a new location 
where there are multiple different Derelict libraries - I'm 
hoping DGame will work with one of those still.



Chiming in with my own library. https://github.com/Jebbs/DSFML

Things are a bit of a mess, but I'm gearing up for a release soon 
and things will be all nice and tidy and structured.


Re: This Week in D: Issue #4

2015-02-03 Thread Jeremy DeHaan via Digitalmars-d-announce

On Tuesday, 3 February 2015 at 14:36:58 UTC, Adam D. Ruppe wrote:
On Tuesday, 3 February 2015 at 05:53:30 UTC, Jeremy DeHaan 
wrote:
Yes, they are not guaranteed to run, but isn't that only 
during run time? They are going to be called at the 
application exit to ensure everything is cleaned up.


If the application exits somewhat cleanly (through return from 
main or even a thrown exception in D), it will run, though I'm 
not sure if that's guaranteed or just an implementation 
convenience.


However, if the application exits differently, they won't 
necessarily be run. For example, a Unix signal terminating the 
process skips all the D cleanup tasks.


Often, this doesn't matter because the operating system will 
clean up a lot of resources anyway. But if you are using 
something like shared memory with another process, or expect a 
file to be written to in a destructor, you'll find those things 
never happen.


I had this problem once in simpledisplay.d. When it died by 
ctrl+c, the unix SIGINT was sent, and that skipped the 
destructors for shared images. As a result, the system 
eventually ran out of shared handles and most GUI programs 
wouldn't start up anymore until I cleaned it up some other way.


Yikes, that's good to know.

Still, I feel like it could be worded a little better in the docs
and anywhere else they are talked about. I feel like it is just
far too ambiguous.


Re: This Week in D: Issue #4

2015-02-02 Thread Jeremy DeHaan via Digitalmars-d-announce

On Monday, 2 February 2015 at 04:57:10 UTC, Adam D. Ruppe wrote:
I can't believe it, but yet another week has already passed, so 
up late to release this again!


http://arsdnet.net/this-week-in-d/feb-01.html

Early bird registration open for DConf, 2015 Vision released, 
GUI and Windows development on the forums.


Today's tip is about class destructors, and Project Spotlight 
makes a return to introduce simpledisplay.d, in the first in 
what will become a series that walks us through making a bit of 
a little game in D. (Expect this to not be each week, it takes 
me a long time to write the project spotlight and I've been 
very busy lately and expect to continue being busy in the 
coming weeks. I'll probably try to do it every other week 
rather than every week.)


http://www.reddit.com/r/programming/comments/2uhgzr/this_week_in_d_2015_vision_released_tip_on/

https://twitter.com/adamdruppe/status/562112301248290816


I've never liked the phrasing about destructors. Yes, they are 
not guaranteed to run, but isn't that only during run time? They 
are going to be called at the application exit to ensure 
everything is cleaned up.


Re: windows wininet library

2015-02-01 Thread Jeremy DeHaan via Digitalmars-d-learn

On Sunday, 1 February 2015 at 07:32:05 UTC, ketmar wrote:
how can i use wininet.dll from D? i got bindings from 
https://github.com/
CS-svnmirror/dsource-bindings-win32.git, and then i tried to 
create
wininet.lib with implib.exe from DMC package. no matter how i 
tried, the
resulting wininet.lib seems to not work, as linker keep 
complaining

about missing symbols like _InternetReadFile@16 and so on.

i'm building for win32.

ah, and yep, i compiled wininet.lib to lib dir, and added 
option to

dmd.exe: -L+wininet.lib.

i assume that i have to create corrent .def file to remap all 
the names,

am i right? oh, delightful...


What does your implib command look like?


Deducing a template retrun parameter type based on an assignment?

2015-01-29 Thread Jeremy DeHaan via Digitalmars-d-learn

I have a template fuction that looks like this:

immutable(T)[] getString(T)() const
if (is(T == dchar)||is(T == wchar)||is(T == char))

Basically, I was hoping that the type would be deduced based on 
the prameter that was being assigned to like so.


string ret = thing.getString();

Apparently that does not work, though. I get informed that the 
type of the template is not able to be deduced. I'm curious as to 
why it was not able to deduce it on its own.


Additionally, and I haven't run my code to try this yet, but 
giving T a default type compiled to my surprise.


immutable(T)[] getString(T=char)() const
if (is(T == dchar)||is(T == wchar)||is(T == char))

Is something like this supposed even to work?


Re: Deducing a template retrun parameter type based on an assignment?

2015-01-29 Thread Jeremy DeHaan via Digitalmars-d-learn

On Friday, 30 January 2015 at 06:58:58 UTC, Vlad Levenfeld wrote:

On Friday, 30 January 2015 at 06:35:31 UTC, Jeremy DeHaan wrote:


A bunch of stuff



for template type deduction to work, you have to supply an 
argument. Your type signature would need to look like this:


immutable(T)[] getString(T)(T arg) const

and then T would be deduced from arg.


That seems strange. I figured that it would be smart enough to
deduce the parameter type based on the type that it was trying to
be assigned to.



But string ret = thing.getString(); won't compile because it is 
rewritten to getString(thing), but your getString function 
takes no runtime parameters. It looks like the signature I 
wrote earlier is what you actually want.


Whoops. I should have mentioned that this is a member function in
a class and not a free fiction. Not that it changes much about
the deduction.



As to your second example, it'll work fine. Basically your 
signature says only accept dchar, wchar or char, but if 
nothing's been specified, default to char. But if you rewrite 
getString to take one parameter, then the default template arg 
is redundant.


That is good to hear. It seemed like that was the way it would
work, but I've never had to specify a default template parameter
type. I'm hoping to avoid having to specify a template parameter,
but it seems like it can't be helped if users want to get their
string type as a wstring or dstring though.


Re: Window creation, for phobos?

2015-01-28 Thread Jeremy DeHaan via Digitalmars-d
What about that Aurora project? Wasn't that supposed to fill this 
kind of role?


Re: DConf 2015 Call for Submissions is now open

2015-01-14 Thread Jeremy DeHaan via Digitalmars-d-announce
On Wednesday, 14 January 2015 at 14:13:04 UTC, Daniel Murphy 
wrote:
Brad Anderson  wrote in message 
news:jcidebafygjtdsabn...@forum.dlang.org...


Sounds like a good subject for Daniel Murphy to talk about. He 
spent a good hour explaining to me how a linker works in the 
Aloft bar after most people had retired (thanks for that, 
Daniel) and he certainly knows dmd extremely well.


I am considering proposing a talk about ddmd, which would touch 
on some of the compiler internals.  We'll see.


This. Please do this.


Re: We need a DConf 2015 logo

2015-01-08 Thread Jeremy DeHaan via Digitalmars-d

On Thursday, 8 January 2015 at 22:40:41 UTC, ponce wrote:


There: http://ovh.to/GAYPaom
- same vector logo but with text and gray background
- a render in 500x150 (I've used Firefox)
- instructions on how to render again

Let me know if you need any change.


I think that is a pretty sweet logo.


Re: I'll be presenting at NWCPP on Jan 21 at Microsoft

2015-01-05 Thread Jeremy DeHaan via Digitalmars-d-announce

On Monday, 5 January 2015 at 07:46:20 UTC, Walter Bright wrote:

http://nwcpp.org/

All are invited.

Now I just have to write the presentation :-(


That's really funny that this is your topic. I was planning on 
going a blog post on almost the exact same thing.


I really wish I could come and see it but I don't know how bad 
busing out there would be. :(


Re: xcb error for core.thread's Thread.join

2014-12-29 Thread Jeremy DeHaan via Digitalmars-d-learn
On Monday, 29 December 2014 at 07:23:32 UTC, Rikki Cattermole 
wrote:

On 29/12/2014 7:39 p.m., Jeremy DeHaan wrote:
On Monday, 29 December 2014 at 06:34:02 UTC, Jeremy DeHaan 
wrote:
On Monday, 29 December 2014 at 06:26:04 UTC, Jeremy DeHaan 
wrote:

Hey all,

I've never gotten any xcb errors with just regular D code 
before, but
maybe I just haven't done anything that would have caused 
them.


I can't say I actually know much about how these things 
work, but

does D not use xcb when it does threading on Linux?

I'm not really doing anything that I could call complicated. 
I am
creating a secondary thread and just outputting some text to 
the
console from both threads. The error itself seems to happen 
on a call

to Thread.join, though I can't say why.


Looks like it isn't the call to Thread.join, that was just a
coincidence for my writeln debugging. If I have the second 
thread

going it just happens.


Not sure if this makes any difference, but I don't get any 
errors when I
let the main thread sleep, but the main thread and secondary 
thread do

not run simultaneously.



XCB and xlib in general is not thread safe. They should only 
ever be called on one thread.
Although I'm guessing you're not directly interfacing with it 
in which case that little tidbit isn't much use to you.


But I thought that XCB was thread safe.


Re: xcb error for core.thread's Thread.join

2014-12-28 Thread Jeremy DeHaan via Digitalmars-d-learn

On Monday, 29 December 2014 at 06:26:04 UTC, Jeremy DeHaan wrote:

Hey all,

I've never gotten any xcb errors with just regular D code 
before, but maybe I just haven't done anything that would have 
caused them.


I can't say I actually know much about how these things work, 
but does D not use xcb when it does threading on Linux?


I'm not really doing anything that I could call complicated. I 
am creating a secondary thread and just outputting some text to 
the console from both threads. The error itself seems to happen 
on a call to Thread.join, though I can't say why.


Looks like it isn't the call to Thread.join, that was just a 
coincidence for my writeln debugging. If I have the second thread 
going it just happens.


Re: xcb error for core.thread's Thread.join

2014-12-28 Thread Jeremy DeHaan via Digitalmars-d-learn

On Monday, 29 December 2014 at 06:34:02 UTC, Jeremy DeHaan wrote:
On Monday, 29 December 2014 at 06:26:04 UTC, Jeremy DeHaan 
wrote:

Hey all,

I've never gotten any xcb errors with just regular D code 
before, but maybe I just haven't done anything that would have 
caused them.


I can't say I actually know much about how these things work, 
but does D not use xcb when it does threading on Linux?


I'm not really doing anything that I could call complicated. I 
am creating a secondary thread and just outputting some text 
to the console from both threads. The error itself seems to 
happen on a call to Thread.join, though I can't say why.


Looks like it isn't the call to Thread.join, that was just a 
coincidence for my writeln debugging. If I have the second 
thread going it just happens.


Not sure if this makes any difference, but I don't get any errors 
when I let the main thread sleep, but the main thread and 
secondary thread do not run simultaneously.




Re: Online documentation for DSFML exists!

2014-12-19 Thread Jeremy DeHaan via Digitalmars-d-announce

On Friday, 19 December 2014 at 20:03:39 UTC, Israel wrote:
On Friday, 19 December 2014 at 00:58:57 UTC, Jeremy DeHaan 
wrote:

It's not the best, but it's a start.

Check it out here: http://dsfml.com/doc.html

I would love some feed back on this. I already have a few 
things I would like to change, namely the layout and adding 
some examples, but I would like to hear what everyone thinks 
on what I have up.


Just a note about the rest of the site though, it is currently 
under construction so don't expect too much.


Would it be possible to contribute screenshots of code examples?
Or is it not necessary?


Adding example code is definitely on my todo list for the docs.


  1   2   >