Re: @property usage

2014-12-09 Thread Mike Parker via Digitalmars-d-learn
On 12/9/2014 4:31 PM, Nicholas Londey wrote: Does @property ever make sense for a free floating function? I would have thought no but was recently asked to add it if using the function with uniform call syntax. I use it from time-to-time. I assume you think of properties as belonging to

Re: @property usage

2014-12-09 Thread uri via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 07:31:21 UTC, Nicholas Londey wrote: as this can break some invalid code (the code where people using properties as functions) Does @property ever make sense for a free floating function? I would have thought no but was recently asked to add it if using the

Re: Derelict / SDL error

2014-12-09 Thread Paul via Digitalmars-d-learn
On Monday, 8 December 2014 at 21:01:40 UTC, Paul wrote: On Monday, 8 December 2014 at 17:48:55 UTC, Jack wrote: I'm running ArchLinux 64-bit on Vbox and tested out the code. There haven't been any problems. Have you tried updating whatever tools you're using?(dmd, dub, etc) Might've been

Re: How do i use std.functional.binaryFun?

2014-12-09 Thread Gary Willoughby via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 01:17:47 UTC, anonymous wrote: Looks like a compiler bug. Filed: https://issues.dlang.org/show_bug.cgi?id=13843

Re: Derelict / SDL error

2014-12-09 Thread Jack via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 10:19:38 UTC, Paul wrote: On Monday, 8 December 2014 at 21:01:40 UTC, Paul wrote: On Monday, 8 December 2014 at 17:48:55 UTC, Jack wrote: I'm running ArchLinux 64-bit on Vbox and tested out the code. There haven't been any problems. Have you tried updating

Garbage collector collects live objects

2014-12-09 Thread Ruslan Mullakhmetov via Digitalmars-d-learn
Hi, I experience very strange problem: GC somehow collects live objects. I found it because i got segfaults. After debugging and tracing i found this is because of accessing not allocated memory. I did the following checks: - added to some class invariant check for access to suspicious

Re: Garbage collector collects live objects

2014-12-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/9/14 8:54 AM, Ruslan Mullakhmetov wrote: Hi, I experience very strange problem: GC somehow collects live objects. I found it because i got segfaults. After debugging and tracing i found this is because of accessing not allocated memory. I did the following checks: - added to some

Re: Garbage collector collects live objects

2014-12-09 Thread Ruslan Mullakhmetov via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 14:23:06 UTC, Steven Schveighoffer wrote: On 12/9/14 8:54 AM, Ruslan Mullakhmetov wrote: Hi, I experience very strange problem: GC somehow collects live objects. I found it because i got segfaults. After debugging and tracing i found this is because of

Why does std.container.BinaryHeap use RefCounted?

2014-12-09 Thread Tobias Pankrath via Digitalmars-d-learn
std.container.BinrayHeap (http://dlang.org/library/std/container/BinaryHeap.html) implements a binary heap on top of a) a given random access range or b) another container that supports random access. Regardless of it's underlying data structure type, it wraps its store in RefCounted, but I

Re: Derelict / SDL error

2014-12-09 Thread Paul via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 13:34:56 UTC, Jack wrote: Can't really think of anything that can solve your problem. Only time I had a seg fault is calling a method from an uninitialized class. You can try to get a debugger and/or a gui that comes with it(personally I use gdb with ddd) to find

Re: Derelict / SDL error

2014-12-09 Thread Mike Parker via Digitalmars-d-learn
On 12/10/2014 12:19 AM, Paul wrote: I don't fancy introduing another layer of complexity in a debugger at present! I wonder if it's the .bmp that's causing the problem. I can't quite figure how to get Derelict SDL_Image into my project at present (dub doesn't fetch it if I add import

Re: Derelict / SDL error

2014-12-09 Thread Paul via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 15:40:00 UTC, Mike Parker wrote: On 12/10/2014 12:19 AM, Paul wrote: dub doesn't know anything about DerelictSDL2Image (and even if it did, just importing it isn't going to tell dub about it -- you would need to add it to your dub.json as a dependency). That's

Re: Derelict / SDL error

2014-12-09 Thread Paul via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 15:48:32 UTC, Paul wrote: On Tuesday, 9 December 2014 at 15:40:00 UTC, Mike Parker wrote: On 12/10/2014 12:19 AM, Paul wrote: dub doesn't know anything about DerelictSDL2Image (and even if it did, just importing it isn't going to tell dub about it -- you would

Re: Garbage collector collects live objects

2014-12-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/9/14 9:52 AM, Ruslan Mullakhmetov wrote: No, there is no accessing GC resources in dtors. the only usage of dtor in one class is ~this() { _file.close(); } where _file is of type std.file.File That should work I think. i'll try to extract problem to any

Re: Derelict / SDL error

2014-12-09 Thread Paul via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 15:53:11 UTC, Paul wrote: Whoa, I read that wrong - I'm sure I tried just adding DerelictSDL2Image.load() to my program an it didnt work. Trying again. The top of my app.d looks like this: import derelict.sdl2.sdl; import std.stdio; import std.conv; void

Re: Garbage collector collects live objects

2014-12-09 Thread Dicebot via Digitalmars-d-learn
It may happen if only reference to an object is stored in memory block marked as data-only (using ubyte[] for a buffer is probably most common reason I have encountered)

Re: Garbage collector collects live objects

2014-12-09 Thread ketmar via Digitalmars-d-learn
On Tue, 09 Dec 2014 14:52:53 + Ruslan Mullakhmetov via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Tuesday, 9 December 2014 at 14:23:06 UTC, Steven Schveighoffer wrote: On 12/9/14 8:54 AM, Ruslan Mullakhmetov wrote: Hi, I experience very strange problem: GC

Re: Garbage collector collects live objects

2014-12-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/9/14 11:17 AM, ketmar via Digitalmars-d-learn wrote: On Tue, 09 Dec 2014 14:52:53 + Ruslan Mullakhmetov via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Tuesday, 9 December 2014 at 14:23:06 UTC, Steven Schveighoffer wrote: On 12/9/14 8:54 AM, Ruslan Mullakhmetov

Re: Garbage collector collects live objects

2014-12-09 Thread Ruslan Mullakhmetov via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 16:53:02 UTC, Steven Schveighoffer wrote: On 12/9/14 11:17 AM, ketmar via Digitalmars-d-learn wrote: On Tue, 09 Dec 2014 14:52:53 + Ruslan Mullakhmetov via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Tuesday, 9 December 2014 at 14:23:06

Re: Garbage collector collects live objects

2014-12-09 Thread Ruslan Mullakhmetov via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 16:13:25 UTC, Dicebot wrote: It may happen if only reference to an object is stored in memory block marked as data-only (using ubyte[] for a buffer is probably most common reason I have encountered) Thanks for interesting hypothesis, but that's not the issue.

Can someone explain why this outputs garbage values?

2014-12-09 Thread Dustin via Digitalmars-d-learn
I'm trying to work with some c functions that make use of varargs and I'm trying to push my d varargs to c varargs. http://dpaste.dzfl.pl/ad08a6197963 Code: ___ import core.vararg; import std.string : toStringz; import std.c.stdio; char[256]

Re: Can someone explain why this outputs garbage values?

2014-12-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 19:44:42 UTC, Dustin wrote: snprintf(dest, 256UL, toStringz(fmt), _argptr); To forward varargs in C, you need to use a different function: vsnprintf instead of snprintf. (The new v at the beginning means varargs). I don't think that's completely

Re: Garbage collector collects live objects

2014-12-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/9/14 12:40 PM, Ruslan Mullakhmetov wrote: On Tuesday, 9 December 2014 at 16:13:25 UTC, Dicebot wrote: It may happen if only reference to an object is stored in memory block marked as data-only (using ubyte[] for a buffer is probably most common reason I have encountered) Thanks for

Re: Can someone explain why this outputs garbage values?

2014-12-09 Thread Adam D. Ruppe via Digitalmars-d-learn
Also, the reason why the special function is needed is that the argptr is just a pointer to the arguments. If you pass that to printf, how does it know that there's varargs on the other end instead of just being another pointer whose numeric value it is supposed to print out?

Re: Garbage collector collects live objects

2014-12-09 Thread Ruslan Mullakhmetov via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 19:56:30 UTC, Steven Schveighoffer wrote: On 12/9/14 12:40 PM, Ruslan Mullakhmetov wrote: On Tuesday, 9 December 2014 at 16:13:25 UTC, Dicebot wrote: i checked attributes for GC block holding this array: FINALIZE NO_SCAN NO_MOVE APPENDABLE NO_INTERIOR That does

Re: Garbage collector collects live objects

2014-12-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/9/14 3:18 PM, Ali Çehreli wrote: On 12/09/2014 11:56 AM, Steven Schveighoffer wrote: i checked attributes for GC block holding this array: ``` FINALIZE NO_SCAN NO_MOVE APPENDABLE NO_INTERIOR ``` That does not sound right at all. No block should ever have both FINALIZE

Re: Garbage collector collects live objects

2014-12-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/9/14 3:24 PM, Ruslan Mullakhmetov wrote: On Tuesday, 9 December 2014 at 19:56:30 UTC, Steven Schveighoffer wrote: On 12/9/14 12:40 PM, Ruslan Mullakhmetov wrote: On Tuesday, 9 December 2014 at 16:13:25 UTC, Dicebot wrote: i checked attributes for GC block holding this array: FINALIZE

Re: Can someone explain why this outputs garbage values?

2014-12-09 Thread Dustin via Digitalmars-d-learn
On Tuesday, 9 December 2014 at 20:24:18 UTC, Adam D. Ruppe wrote: Also, the reason why the special function is needed is that the argptr is just a pointer to the arguments. If you pass that to printf, how does it know that there's varargs on the other end instead of just being another pointer

How to share modules when using -shared?

2014-12-09 Thread Justin Whear via Digitalmars-d-learn
I'm trying to build components that I can dynamically link and keep running into an issue with sharing modules between the host and the pluggable components. Assuming a layout like this: host.d -- loads components at runtime a.d -- a module that builds to `a.so` b.d -- a module

Re: Garbage collector collects live objects

2014-12-09 Thread ketmar via Digitalmars-d-learn
On Tue, 09 Dec 2014 17:18:44 + Ruslan Mullakhmetov via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: thanks, I got it: either C++ or D dtors are minefield =) and in D this is filed *made* of mines. ;-) but i still have no clue how to overcome GC =( why do you want to fight

Cheap Kitchens London

2014-12-09 Thread nomnom via Digitalmars-d-learn
Cheap Kitchens London. Thirty Ex Display Kitchens To Clear. www.exdisplaykitchens1.co.uk £ 595 Each with appliances.Tel 01616-694785

Re: Source code annotations alla Java

2014-12-09 Thread Denis Gladkiy via Digitalmars-d-learn
On Thursday, 20 January 2011 at 13:49:30 UTC, Justin Johansson wrote: Not long ago the Java Language people introduced the idea of annotations together with an annotation processing tool (apt). Now perhaps the idea of source code annotations is not actually a Java invention per se, however