Re: What is RTInfo?

2015-01-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 29 January 2015 at 08:47:18 UTC, Mike wrote: It just seems to return a void*. But, searching the source code, it doesn't seem to be set by anything anywhere. It can actually return anything: RTInfo is a template that is automatically instantiated for each user-defined struct or

Re: What is RTInfo?

2015-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/15 3:47 AM, Mike wrote: object.d [1] says it's infomation for the precise GC (which I thought wasn't implemented yet). It just seems to return a void*. But, searching the source code, it doesn't seem to be set by anything anywhere. So, what is RTInfo and what is its purpose. And how

What is RTInfo?

2015-01-29 Thread Mike via Digitalmars-d-learn
object.d [1] says it's infomation for the precise GC (which I thought wasn't implemented yet). It just seems to return a void*. But, searching the source code, it doesn't seem to be set by anything anywhere. So, what is RTInfo and what is its purpose. And how is it different from

Re: Import paths do not work

2015-01-29 Thread Atila Neves via Digitalmars-d-learn
I would suggest instead of using make, use dub[0] build manager instead. It'll handle grabbing all the files and compiling them correctly. [0] http://code.dlang.org/package-format Or for simple projects such as this one seems to be, just use rdmd. Atila

Re: What is @return?

2015-01-29 Thread FG via Digitalmars-d-learn
@property auto info() @safe @nothrow @pure @return const { return this; } It is mesmerizing... (@ _ @)

Re: shared Variant[string]

2015-01-29 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 28 January 2015 at 12:29:09 UTC, Fyodor Ustinov wrote: On Wednesday, 28 January 2015 at 11:27:53 UTC, Kagamin wrote: Associative array doesn't support thread-safe operations, that's why they don't work on shared instance. You should use std.concurrency or implement low-level

Check if type is from specific template?

2015-01-29 Thread Tofu Ninja via Digitalmars-d-learn
Basically what the title says, how do I check if a type T is an instantiation of a specific template?

Re: Check if type is from specific template?

2015-01-29 Thread bearophile via Digitalmars-d-learn
Tofu Ninja: Basically what the title says, how do I check if a type T is an instantiation of a specific template? If you have an updated Phobos std.traits.isInstanceOf could be what you look for. Bye, bearophile

Re: Check if type is from specific template?

2015-01-29 Thread Tofu Ninja via Digitalmars-d-learn
On Thursday, 29 January 2015 at 12:10:41 UTC, bearophile wrote: Tofu Ninja: Basically what the title says, how do I check if a type T is an instantiation of a specific template? If you have an updated Phobos std.traits.isInstanceOf could be what you look for. Bye, bearophile Yep,

Re: Threads and stdio and HANDLE

2015-01-29 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 28 January 2015 at 11:50:46 UTC, Danny wrote: Hello, I'm trying to write some toy examples using threads in D. Is the std.stdio.File thread-local or shared? Is flockfile used when I synchronize on it? I tried checking phobos myself and found some things I don't get (in

Re: Overloading equality operator for classes

2015-01-29 Thread via Digitalmars-d-learn
On Thursday, 29 January 2015 at 17:48:04 UTC, rumbu wrote: bool opEquals(Object obj, int value) { //do something to compare them return false; } void main(string[] args) { Object obj; if (obj == 12) {} //ERROR function object.Object.opEquals (Object o) is not callable

Re: Check if type is from specific template?

2015-01-29 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jan 29, 2015 at 12:58:46PM +, Tofu Ninja via Digitalmars-d-learn wrote: [...] Incidentally, while trying to see how its used I found that a lot of the links on the std.traits doc page do not work and have no documentation. [...] Please file bugs for these. We need to fix the docs.

Overloading equality operator for classes

2015-01-29 Thread rumbu via Digitalmars-d-learn
bool opEquals(Object obj, int value) { //do something to compare them return false; } void main(string[] args) { Object obj; if (obj == 12) {} //ERROR function object.Object.opEquals (Object o) is not callable using argument types (int) } According to paragraph (2) -

Re: What is @return?

2015-01-29 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 29 January 2015 at 05:02:58 UTC, ketmar wrote: http://wiki.dlang.org/DIP25 this is a very recent thing, it wasn't coded when 2.066 was released. Thanks, I like it.

Re: What is @return?

2015-01-29 Thread Benjamin Thaut via Digitalmars-d-learn
On Thursday, 29 January 2015 at 11:50:29 UTC, FG wrote: @property auto info() @safe @nothrow @pure @return const { return this; } It is mesmerizing... (@ _ @) And soon its gong to look like this: export @property auto info() @safe @nothrow @pure @return const { return this; }

Re: Import paths do not work

2015-01-29 Thread tcak via Digitalmars-d-learn
On Thursday, 29 January 2015 at 10:26:56 UTC, Atila Neves wrote: I would suggest instead of using make, use dub[0] build manager instead. It'll handle grabbing all the files and compiling them correctly. [0] http://code.dlang.org/package-format Or for simple projects such as this one seems

Re: Overloading equality operator for classes

2015-01-29 Thread Ali Çehreli via Digitalmars-d-learn
On 01/29/2015 09:48 AM, rumbu wrote: bool opEquals(Object obj, int value) { //do something to compare them return false; } void main(string[] args) { Object obj; if (obj == 12) {} //ERROR function object.Object.opEquals (Object o) is not callable using argument types

Re: Virtual functions and inheritance

2015-01-29 Thread Baz via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 04:38:59 UTC, David Monagle wrote: Hi guys, I'm a former C++ developer and really enjoying working with D now. I have a question that I hope some of you may be able to answer. class Parent { @property string typeName() { return typeof(this).stringof; }

Re: Virtual functions and inheritance

2015-01-29 Thread Baz via Digitalmars-d-learn
even more weird: --- module test; import std.conv; interface Meh{ final string typeName() {return to!string(this);} } class Parent : Meh {} class Child : Parent {} void main() { auto p = new Parent; auto c = new Child; assert(p.typeName == __MODULE__ ~ .Parent);

Re: Virtual functions and inheritance

2015-01-29 Thread Tobias Pankrath via Digitalmars-d-learn
This is almost the same code as written initially, let somone explain why the hell this is working: --- module test; import std.conv; class Parent { @property final string typeName() { return to!string(this); } } class Child : Parent { } void main() { auto p = new Parent; auto c

Re: Import paths do not work

2015-01-29 Thread Jesse Phillips via Digitalmars-d-learn
Let me try to explain the compilation process which may help you to understand where your problem lies. * Build system * Maintain program/library dependencies * Execute commands resulting in a usable program/library * Compiler * Lexical Analysis * Parsing

Re: spawn/executeInNewThread and module this/~this

2015-01-29 Thread Fyodor Ustinov via Digitalmars-d-learn
On Thursday, 29 January 2015 at 20:50:16 UTC, ref2401 wrote: It's written here: http://dlang.org/module.html#staticorder Oops. Thnx!

Re: spawn/executeInNewThread and module this/~this

2015-01-29 Thread Ali Çehreli via Digitalmars-d-learn
On 01/29/2015 12:11 PM, Fyodor Ustinov wrote: Hi! Nowhere is it written that the start of a new thread also launch this() for module (and stop a thread launch ~this()). It really is not written anywhere or I just missed? WBR, Fyodor. I imply it here:

Re: spawn/executeInNewThread and module this/~this

2015-01-29 Thread ref2401 via Digitalmars-d-learn
It's written here: http://dlang.org/module.html#staticorder

Re: cpu % usage decreases when (unrelated) memory usage increases

2015-01-29 Thread Ali Çehreli via Digitalmars-d-learn
On 01/29/2015 12:33 PM, Christiaan wrote: Can someone please explain what might be the issue here? If the memory is too large, needing to be swapped to and from disk, then your program may be waiting for I/O instead of doing actual work. Ali

Re: Getting DAllegro 5 to work in Windows

2015-01-29 Thread Joel via Digitalmars-d-learn
On Friday, 26 December 2014 at 08:43:24 UTC, Joel wrote: On Wednesday, 24 December 2014 at 09:57:31 UTC, Kagamin wrote: Works for me on allegro-5.0.10-mt.dll, produced 391kb lib file. I think my Windows 7 on my Mac has system damage - I used a doggy flash drive. I plan to install Window 8.1,

Re: class is forward referenced when looking for 'v'

2015-01-29 Thread David Monagle via Digitalmars-d-learn
It's a bit hard to know where to start here. It's not obvious from your code what you are trying to achieve. In essence, you do have a circular reference as Base has functions that use a types A and B which are derived from the Base. I don't see how the complier could be asked to resolve

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

2015-01-29 Thread Vlad Levenfeld via Digitalmars-d-learn
On Friday, 30 January 2015 at 06:35:31 UTC, Jeremy DeHaan wrote: 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

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

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

2015-01-29 Thread Vlad Levenfeld via Digitalmars-d-learn
On Friday, 30 January 2015 at 07:13:09 UTC, Jeremy DeHaan wrote: 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. It seems sensible to me, as changing string to auto would leave the type of the

class is forward referenced when looking for 'v'

2015-01-29 Thread Amber Thralll via Digitalmars-d-learn
I ran into an issue with cross referencing to classes, that I can't figure out. I reproduced the issue below: import std.stdio; class Base(t) { public void Foo(A!(t) a) { writeln(Base.Foo(A a)); } public void Foo(B!(t) a) {

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)[]

Re: Getting DAllegro 5 to work in Windows

2015-01-29 Thread Kagamin via Digitalmars-d-learn
On Friday, 30 January 2015 at 06:16:21 UTC, Joel wrote: What happens is, that I run the script file (in DAllegro folder) and it is suppose to create lib files from the DLL ones. On my system, it says its done it but no lib files pop up! You can try procmon to watch, what happens with files.