Re: deimos libX11 undefined reference

2012-07-15 Thread Ed McCardell
On 07/11/2012 07:50 PM, cal wrote: On Wednesday, 11 July 2012 at 23:18:25 UTC, cal wrote: I'm using the deimos libX11 bindings, DMD 2.058 OpenSUSE x86_64. In Xlibint.d, my linker can't resolve '_XData16' (it's proto is on line 624 of Xlibint). Does anyone who knows X11 know what library I

TypeInfo_Class getMembers() and offTi()

2012-07-15 Thread Benjamin Thaut
Do the getMembers() and offTi() functions of TypeInfo_Class already work? If yes who generates the information for them, or do I have to do that manually with a template? Are there any examples on this? I couldn't find anything in the documentation. Kind Regards Benjamin Thaut

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Alex Rønne Petersen
On 15-07-2012 15:43, Alexandr Druzhinin wrote: Hello, I need something like that - http://digitalmars.com/techtips/class_objects.html, but more portable. I saw it sometime ago, but now can not find anything. Could someone help me. This is how you do it in modern D: import core.stdc.stdlib,

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Alexandr Druzhinin
15.07.2012 20:50, Alex Rønne Petersen пишет: This is how you do it in modern D: import core.stdc.stdlib, std.conv; class A {} void main() { // allocate and initialize auto size = __traits(classInstanceSize, A); auto mem = malloc(size)[0 .. size]; auto a = emplace!A(mem);

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Alex Rønne Petersen
On 15-07-2012 16:46, Alexandr Druzhinin wrote: 15.07.2012 20:50, Alex Rønne Petersen пишет: This is how you do it in modern D: import core.stdc.stdlib, std.conv; class A {} void main() { // allocate and initialize auto size = __traits(classInstanceSize, A); auto mem =

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Alexandr Druzhinin
15.07.2012 22:03, Alex Rønne Petersen пишет: You pass those after the 'mem' argument to emplace. So, for example: auto a = emplace!A(mem, foo, bar, 'b', 'a', 'z'); thanks for your help!

Re: using GC needs particular skills?

2012-07-15 Thread Alex Rønne Petersen
On 15-07-2012 17:31, Alexandr Druzhinin wrote: I make simple learning project and encounter the problem that when my application exits I get access violations (yes, I use windows and moreover - XP version :) ). I don't know the reason of errors, I'm sure that exceptions are thrown by runtime,

using GC needs particular skills?

2012-07-15 Thread Alexandr Druzhinin
I make simple learning project and encounter the problem that when my application exits I get access violations (yes, I use windows and moreover - XP version :) ). I don't know the reason of errors, I'm sure that exceptions are thrown by runtime, not my code directly - its occurs right

Re: using GC needs particular skills?

2012-07-15 Thread Alexandr Druzhinin
15.07.2012 22:33, Alex Rønne Petersen пишет: It's really, really hard to say what's wrong from this information. You need to post some reduced test case demonstrating the problem. You're right, it's really hard. But I'd like to learn about using GC only. Of course I'll try to reduce my

Re: using GC needs particular skills?

2012-07-15 Thread Alexandr Druzhinin
15.07.2012 22:33, Alex Rønne Petersen пишет: test case: class A { } __gshared A a; void main(string[] args) { a = new A; } every time after finishing application I get core.exception.InvalidMemoryOperationError I suspect the problem is misusing __gshared

Re: ufcs and integer params

2012-07-15 Thread Philippe Sigaud
On Sunday, July 15, 2012 05:30:55 Jay Norwood wrote: I see from this other discussions that it looks like 2.059 ( or maybe 2.060) does support something like 3.cm(). Not sure from the discussion if it would also accept 3.cm as in the xtext/xtend example. Hi Jay, I had a little fun

Re: ufcs and integer params

2012-07-15 Thread Timon Gehr
On 07/15/2012 05:40 AM, Jonathan M Davis wrote: On Sunday, July 15, 2012 05:30:55 Jay Norwood wrote: I see from this other discussions that it looks like 2.059 ( or maybe 2.060) does support something like 3.cm(). Not sure from the discussion if it would also accept 3.cm as in the xtext/xtend

Re: ufcs and integer params

2012-07-15 Thread Jonathan M Davis
On Sunday, July 15, 2012 19:50:18 Timon Gehr wrote: On 07/15/2012 05:40 AM, Jonathan M Davis wrote: On Sunday, July 15, 2012 05:30:55 Jay Norwood wrote: I see from this other discussions that it looks like 2.059 ( or maybe 2.060) does support something like 3.cm(). Not sure from the

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Jonathan M Davis
On Sunday, July 15, 2012 18:34:44 bearophile wrote: Alex Rønne Petersen: This is how you do it in modern D: This seems fiddly and bug-prone (and eventually fit to go in the D FAQ). Maybe it needs to use an aligned_malloc, to avoid aligning troubles in the class. It'll probably become

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Benjamin Thaut
Am 15.07.2012 21:06, schrieb Jonathan M Davis: On Sunday, July 15, 2012 18:34:44 bearophile wrote: Alex Rønne Petersen: This is how you do it in modern D: This seems fiddly and bug-prone (and eventually fit to go in the D FAQ). Maybe it needs to use an aligned_malloc, to avoid aligning

Re: ufcs and integer params

2012-07-15 Thread Jonathan M Davis
On Sunday, July 15, 2012 11:56:57 Jonathan M Davis wrote: What is enforced here? Why would it matter if anything is 'enforced'? If you marked it as a property, then it's supposed to be abstracting a variable and should be treated as one, just like if it's a normal function, it should be

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Jonathan M Davis
On Sunday, July 15, 2012 21:14:40 Benjamin Thaut wrote: Am 15.07.2012 21:06, schrieb Jonathan M Davis: On Sunday, July 15, 2012 18:34:44 bearophile wrote: Alex Rønne Petersen: This is how you do it in modern D: This seems fiddly and bug-prone (and eventually fit to go in the D FAQ).

Re: ufcs and integer params

2012-07-15 Thread Timon Gehr
On 07/15/2012 09:41 PM, Jonathan M Davis wrote: On Sunday, July 15, 2012 11:56:57 Jonathan M Davis wrote: What is enforced here? Why would it matter if anything is 'enforced'? If you marked it as a property, then it's supposed to be abstracting a variable and should be treated as one, just

Re: ufcs and integer params

2012-07-15 Thread Timon Gehr
On 07/15/2012 08:56 PM, Jonathan M Davis wrote: On Sunday, July 15, 2012 19:50:18 Timon Gehr wrote: On 07/15/2012 05:40 AM, Jonathan M Davis wrote: On Sunday, July 15, 2012 05:30:55 Jay Norwood wrote: I see from this other discussions that it looks like 2.059 ( or maybe 2.060) does support

Re: ufcs and integer params

2012-07-15 Thread Jonathan M Davis
On Sunday, July 15, 2012 23:29:04 Timon Gehr wrote: The current plan is (and has been for some time) that -property will become the normal behavior, It is obvious that -property is broken and will not become the normal behaviour. It is obvious that -property needs to be fixed before it

Re: ufcs and integer params

2012-07-15 Thread Timon Gehr
On 07/15/2012 11:11 PM, Jonathan M Davis wrote: There are two levels to enforcement. Neither exist without -property. The absolutely minimal level is that anything marked with @property must be used as a property. Without this, you can't swap out a property function for a variable without

Re: ufcs and integer params

2012-07-15 Thread Jonathan M Davis
On Sunday, July 15, 2012 23:35:12 Timon Gehr wrote: The second level - i.e. strict property enforcement - also requires that non- property functions be called as functions. Exactly. This part is useless. And there, we will forever disagree. - Jonathan M Davis

Re: ufcs and integer params

2012-07-15 Thread Timon Gehr
On 07/15/2012 11:43 PM, Jonathan M Davis wrote: On Sunday, July 15, 2012 23:35:12 Timon Gehr wrote: The second level - i.e. strict property enforcement - also requires that non- property functions be called as functions. Exactly. This part is useless. And there, we will forever disagree.

Re: ufcs and integer params

2012-07-15 Thread Timon Gehr
On 07/15/2012 11:35 PM, Jonathan M Davis wrote: On Sunday, July 15, 2012 23:29:04 Timon Gehr wrote: The current plan is (and has been for some time) that -property will become the normal behavior, It is obvious that -property is broken and will not become the normal behaviour. It is obvious

Re: ufcs and integer params

2012-07-15 Thread Jonathan M Davis
On Sunday, July 15, 2012 23:47:58 Timon Gehr wrote: On 07/15/2012 11:43 PM, Jonathan M Davis wrote: On Sunday, July 15, 2012 23:35:12 Timon Gehr wrote: The second level - i.e. strict property enforcement - also requires that non- property functions be called as functions. Exactly. This

Re: ufcs and integer params

2012-07-15 Thread Timon Gehr
On 07/15/2012 11:56 PM, Jonathan M Davis wrote: On Sunday, July 15, 2012 23:47:58 Timon Gehr wrote: On 07/15/2012 11:43 PM, Jonathan M Davis wrote: On Sunday, July 15, 2012 23:35:12 Timon Gehr wrote: The second level - i.e. strict property enforcement - also requires that non- property

Object Pointer

2012-07-15 Thread Namespace
Is something like this possible? Foo* create_ptr(Foo f) { assert(f !is null); // ... } Foo* fp = create_ptr(new Foo()); with ref Foo f of course, there is no limitation.

Re: Object Pointer

2012-07-15 Thread Jonathan M Davis
On Monday, July 16, 2012 00:47:27 Namespace wrote: Is something like this possible? Foo* create_ptr(Foo f) { assert(f !is null); // ... } Foo* fp = create_ptr(new Foo()); with ref Foo f of course, there is no limitation. You cannot have pointers to classes. The language

Can't create immutable type in template

2012-07-15 Thread Nick Gurrola
import std.stdio; void main() { writeln(typeid(Test!int)); } template Test(T...) { alias immutable(T[0]) Test; } This prints int instead of immutable(int) like I would expect. Is this a bug, or is that what is supposed to happen?

Re: Can't create immutable type in template

2012-07-15 Thread Jonathan M Davis
On Monday, July 16, 2012 01:38:05 Nick Gurrola wrote: import std.stdio; void main() { writeln(typeid(Test!int)); } template Test(T...) { alias immutable(T[0]) Test; } It looks like a bug to me. - Jonathan M Davis

Re: using GC needs particular skills?

2012-07-15 Thread Mike Parker
On 7/16/2012 1:01 AM, Alexandr Druzhinin wrote: 15.07.2012 22:56, Alexandr Druzhinin пишет: 15.07.2012 22:33, Alex Rønne Petersen пишет: test case: class A { } __gshared A a; void main(string[] args) { a = new A; } every time after finishing application I get

Re: using GC needs particular skills?

2012-07-15 Thread Ellery Newcomer
On 07/15/2012 09:01 AM, Alexandr Druzhinin wrote: 15.07.2012 22:56, Alexandr Druzhinin пишет: 15.07.2012 22:33, Alex Rønne Petersen пишет: test case: class A { } __gshared A a; void main(string[] args) { a = new A; } every time after finishing application I get