Re: Overriding opEquals in classes, for comparison with things that aren't Objects

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 January 2016 at 15:00:59 UTC, pineapple wrote: With this bit of code, the first method seems to work fine - things go as expected. But I get a compile error with the second method, and I'm not sure how else to write this. override bool opEquals(Object value) const{

Re: Why is it a memory ERRO.

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 January 2016 at 13:22:07 UTC, Mike Parker wrote: Your problem is probably that you are calling GC.free in the destructor. Don't do this. You don't need to call GC.free at all. The GC will collect both your object instance and the memory you allocated with new. Never, ever,

Overriding opEquals in classes, for comparison with things that aren't Objects

2016-01-29 Thread pineapple via Digitalmars-d-learn
With this bit of code, the first method seems to work fine - things go as expected. But I get a compile error with the second method, and I'm not sure how else to write this. override bool opEquals(Object value) const{ return this.equals(cast(typeof(this)) value); }

Re: Overriding opEquals in classes, for comparison with things that aren't Objects

2016-01-29 Thread pineapple via Digitalmars-d-learn
It also occurred to me to do something like this, but it isn't accepted either. override bool opEquals(T)(T value){ return this.equals(value); }

Re: Why is it a memory ERRO.

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 January 2016 at 12:43:53 UTC, Dsby wrote: the Code: ~this(){ GC.free(by.ptr); by = null; writeln("free"); } Your problem is probably that you are calling GC.free in the destructor. Don't do this. You don't need

d plugin for Intelij Idea debuging support

2016-01-29 Thread Pavel via Digitalmars-d-learn
Hello! Is there any debuging support for Intelij Idea's D plugin? Thanks!

Why is it a memory ERRO.

2016-01-29 Thread Dsby via Digitalmars-d-learn
the Code: class MyClass { this(){ by = new ubyte[1]; ++i; } ~this(){ GC.free(by.ptr); by = null; writeln("free"); } void show(){ writeln(i); };

Re: Why is it a memory ERRO.

2016-01-29 Thread Dsby via Digitalmars-d-learn
On Friday, 29 January 2016 at 12:43:53 UTC, Dsby wrote: the Code: class MyClass { this(){ by = new ubyte[1]; ++i; } ~this(){ GC.free(by.ptr); by = null; writeln("free"); }

Re: merging map/filter/reduce/... in D

2016-01-29 Thread glathoud via Digitalmars-d-learn
Thanks. I am glad be wrong on that one. I had a look at map & filter in the source code ; pleased to see they're lazily implemented! map https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/iteration.d#L425 filter

Re: merging map/filter/reduce/... in D

2016-01-29 Thread cym13 via Digitalmars-d-learn
On Friday, 29 January 2016 at 08:06:14 UTC, glathoud wrote: Thanks. I am glad be wrong on that one. I had a look at map & filter in the source code ; pleased to see they're lazily implemented! map https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/iteration.d#L425

Re: Overriding opEquals in classes, for comparison with things that aren't Objects

2016-01-29 Thread pineapple via Digitalmars-d-learn
On Friday, 29 January 2016 at 15:13:45 UTC, Mike Parker wrote: The first implementation is fine because you're overriding the implementation in the base class (Object). However, the second one fails because it's a template. Templates are non-virtual and cannot override anything. Even if you

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 January 2016 at 15:28:29 UTC, Adrian Matoga wrote: How can I reliably test if CallsFoo can be instantiated? You can use a constraint to prevent invalid instantiation: struct HasFoo { void foo() {} } struct NoFoo {} struct CallsFoo(T) if (__traits(hasMember, T, "foo")) {

Re: Assert failure on 2.070.0 without stack trace

2016-01-29 Thread Benjamin Thaut via Digitalmars-d-learn
On Thursday, 28 January 2016 at 18:33:19 UTC, Nordlöw wrote: Thanks, I'm aware of these tools. But it's easier to use the stacktrace...if I only get one. The function where the assert() is called is, in turn, called in hundreds of places. Which platform are you on? Are all your binaries

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 10:28 AM, Adrian Matoga wrote: Code: struct HasFoo { void foo() {} } struct NoFoo {} struct CallsFoo(T) { T t; void bar() { t.foo(); } } static assert(is(CallsFoo!HasFoo)); alias Bar = CallsFoo!HasFoo; static assert(is(CallsFoo!NoFoo)); // (1) //alias Baz =

is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Adrian Matoga via Digitalmars-d-learn
Code: struct HasFoo { void foo() {} } struct NoFoo {} struct CallsFoo(T) { T t; void bar() { t.foo(); } } static assert(is(CallsFoo!HasFoo)); alias Bar = CallsFoo!HasFoo; static assert(is(CallsFoo!NoFoo)); // (1) //alias Baz = CallsFoo!NoFoo; // (2) This

InSituRegion + allocatorObject compile time error

2016-01-29 Thread ref2401 via Digitalmars-d-learn
Getting this error, could someone explain why? void main(string[] args) { InSituRegion!(1024) stackAlloc; IAllocator alloc = allocatorObject(stackAlloc); } ..\src\phobos\std\conv.d(5055): Error: static assert "Don't know how to initialize an object of type

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Adrian Matoga via Digitalmars-d-learn
On Friday, 29 January 2016 at 16:36:01 UTC, Steven Schveighoffer wrote: On 1/29/16 10:28 AM, Adrian Matoga wrote: Code: struct HasFoo { void foo() {} } struct NoFoo {} struct CallsFoo(T) { T t; void bar() { t.foo(); } } static assert(is(CallsFoo!HasFoo)); alias Bar =

opApply @safety

2016-01-29 Thread Chris Wright via Digitalmars-d-learn
I want to create an opApply for a type. I've marked my code @safe, because everything I wrote was @safe. The body of opApply is @safe, but it calls a delegate that may or may not be @safe. How do I make it so I can iterate through this type safely and systemly? I want to support iteration

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 6:44 PM, Basile B. wrote: Haven't you seen my answer about constraint ? If you put a constraint on your function template then invalid instantiations are rejected. I mean... this language feature is not just ornamental... What do you think constraints are used for otherwise ^^ A

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 January 2016 at 17:01:46 UTC, Adrian Matoga wrote: On Friday, 29 January 2016 at 16:36:01 UTC, Steven Schveighoffer wrote: On 1/29/16 10:28 AM, Adrian Matoga wrote: [...] is(T) is supposed to be false if T is not a valid type. I would agree with you that the static assert

Re: UTF-16 endianess

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 6:03 PM, Marek Janukowicz wrote: On Fri, 29 Jan 2016 17:43:26 -0500, Steven Schveighoffer wrote: Is there anything I should know about UTF endianess? It's not any different from other endianness. In other words, a UTF16 code unit is expected to be in the endianness of the platform

Re: Relocatable objects and internal pointers

2016-01-29 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jan 30, 2016 at 01:21:27AM +, Matt Elkins via Digitalmars-d-learn wrote: > On Saturday, 30 January 2016 at 01:18:33 UTC, Ali Çehreli wrote: > >Definitely so. Rvalues are moved around all the time. The following > >program has two rvalue moves without calling post-blits or >

Re: Relocatable objects and internal pointers

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
On Saturday, 30 January 2016 at 01:28:54 UTC, H. S. Teoh wrote: On Sat, Jan 30, 2016 at 01:21:27AM +, Matt Elkins via Digitalmars-d-learn wrote: On Saturday, 30 January 2016 at 01:18:33 UTC, Ali Çehreli wrote: >Definitely so. Rvalues are moved around all the time. The >following program

Re: Relocatable objects and internal pointers

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 8:07 PM, Matt Elkins wrote: [snip] on D and came across a section in TDPL which said internal pointers are verboten because objects must be relocatable. Does this mean my example is invalid (e.g., the invariant will not hold in all circumstances)? If it is invalid, does that mean

UTF-16 endianess

2016-01-29 Thread Marek Janukowicz via Digitalmars-d-learn
I have trouble understanding how endianess works for UTF-16. For example UTF-16 code for 'ł' character is 0x0142. But this program shows otherwise: import std.stdio; public void main () { ubyte[] properOrder = [0x01, 0x42]; ubyte[] reverseOrder = [0x42, 0x01]; writefln(

Re: opApply @safety

2016-01-29 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 January 2016 at 17:44:34 UTC, Chris Wright wrote: I want to create an opApply for a type. I've marked my code @safe, because everything I wrote was @safe. The body of opApply is @safe, but it calls a delegate that may or may not be @safe. How do I make it so I can iterate

Re: UTF-16 endianess

2016-01-29 Thread Johannes Pfau via Digitalmars-d-learn
Am Fri, 29 Jan 2016 18:58:17 -0500 schrieb Steven Schveighoffer : > On 1/29/16 6:03 PM, Marek Janukowicz wrote: > > On Fri, 29 Jan 2016 17:43:26 -0500, Steven Schveighoffer wrote: > >>> Is there anything I should know about UTF endianess? > >> > >> It's not any different

Re: Relocatable objects and internal pointers

2016-01-29 Thread Ali Çehreli via Digitalmars-d-learn
On 01/29/2016 05:07 PM, Matt Elkins wrote: > this(/* arguments to populate stuff */) > { > m_this = > /* ... populate stuff ... */ > } > a section in TDPL which said internal pointers are > verboten because objects must be relocatable. Does this mean my example

Re: Dub packages: Best practices for windows support

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Friday, 29 January 2016 at 19:46:40 UTC, Johannes Pfau wrote: Now on windows, things are more complicated. First of all, I can't seem to simply use "libs": ["foo"] as the linker won't find the C import .lib file. Then apparently there's no way to add a library search path with the MSVC

Re: Dub packages: Best practices for windows support

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 30 January 2016 at 01:17:13 UTC, Mike Parker wrote: There's an issue for this at [1]. Until support for -m32mscoff is baked in, distributing any libraries with a dub project will be problematic. [1] https://github.com/D-Programming-Language/dub/issues/628

Re: Dub packages: Best practices for windows support

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 30 January 2016 at 01:17:13 UTC, Mike Parker wrote: Hopefully one day dub will have the ability to pull down library dependencies on demand, or based on the current platform and architecture by default, then this problem goes away. I should say "precompiled library

Re: UTF-16 endianess

2016-01-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 29 January 2016 at 22:36:37 UTC, Marek Janukowicz wrote: I have trouble understanding how endianess works for UTF-16. UTF-16 (as well as UTF-32) comes in both little-endian and big-endian variants. A byte-order marker in the file can help you detect which one it is in. See t his

To cast a uint to float to compute k/n, use to! or cast()?

2016-01-29 Thread Enjoys Math via Digitalmars-d-learn
I want to compute the points of a regular polygon in a loop: float r = 1.0; for (uint k=0; k < numVerts; k++) { vertlist ~= Vec2D(r * cos(k/n * 2 * PI), ...) } How do I make sure k/n is a float or double?

Re: is(some template instantiation) is true, but the actual instantiation fails

2016-01-29 Thread Ali Çehreli via Digitalmars-d-learn
On 01/29/2016 09:01 AM, Adrian Matoga wrote: > Oh, there's more: > // this should fail: > static assert(is(CallsFoo!NoFoo)); > // this should fail too: > static assert(is(typeof({ alias Baz = CallsFoo!NoFoo; return Baz.init; > }(; > // and this: > static assert(__traits(compiles, { alias Baz

Re: opApply @safety

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 3:08 PM, Chris Wright wrote: On Fri, 29 Jan 2016 14:00:08 -0500, Steven Schveighoffer wrote: On 1/29/16 12:44 PM, Chris Wright wrote: I want to create an opApply for a type. I've marked my code @safe, because everything I wrote was @safe. The body of opApply is @safe, but it calls

Re: opApply @safety

2016-01-29 Thread Chris Wright via Digitalmars-d-learn
On Fri, 29 Jan 2016 23:35:35 +, Basile B. wrote: > You can implement an input range and annotate all the primitives as > @safe. I hadn't realized that if front() returns a tuple, it's automatically expanded. Works for me.

Re: To cast a uint to float to compute k/n, use to! or cast()?

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 6:48 PM, Enjoys Math wrote: I want to compute the points of a regular polygon in a loop: float r = 1.0; for (uint k=0; k < numVerts; k++) { vertlist ~= Vec2D(r * cos(k/n * 2 * PI), ...) } How do I make sure k/n is a float or double? uint is promoted to float/double with a

Re: UTF-16 endianess

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 5:36 PM, Marek Janukowicz wrote: I have trouble understanding how endianess works for UTF-16. For example UTF-16 code for 'ł' character is 0x0142. But this program shows otherwise: import std.stdio; public void main () { ubyte[] properOrder = [0x01, 0x42]; ubyte[]

Relocatable objects and internal pointers

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
Hi all, I'm a C++ programmer trying to decide whether to switch my main focus to D, and so I'm working on a pet project using it. So far I really like some of the practical aspects of the language (built-in contracts are great, the metaprogramming is very accessible, and I can't enough of

Re: Relocatable objects and internal pointers

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 9:35 PM, Matt Elkins wrote: On Saturday, 30 January 2016 at 02:09:55 UTC, Steven Schveighoffer wrote: I figured out a way to have them. You just have to guarantee you don't copy the actual "pointer" out of the struct: https://forum.dlang.org/post/mk5k4l$s5r$1...@digitalmars.com

Re: Relocatable objects and internal pointers

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 10:13 PM, Matt Elkins wrote: On Saturday, 30 January 2016 at 03:00:11 UTC, Steven Schveighoffer wrote: There are some really smart people who frequent these forums, if you post your actual use case, you may get an answer that you hadn't thought of. Yeah, I tried that first (on the

Re: Access Violation in @safe Code

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
On Saturday, 30 January 2016 at 05:18:08 UTC, Steven Schveighoffer wrote: https://issues.dlang.org/enter_bug.cgi -Steve Added! https://issues.dlang.org/show_bug.cgi?id=15627 Thanks for the help.

Re: Relocatable objects and internal pointers

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
On Saturday, 30 January 2016 at 02:09:55 UTC, Steven Schveighoffer wrote: I figured out a way to have them. You just have to guarantee you don't copy the actual "pointer" out of the struct: https://forum.dlang.org/post/mk5k4l$s5r$1...@digitalmars.com Unfortunately, that won't work for what I

Re: Relocatable objects and internal pointers

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
On Saturday, 30 January 2016 at 03:00:11 UTC, Steven Schveighoffer wrote: There are some really smart people who frequent these forums, if you post your actual use case, you may get an answer that you hadn't thought of. Yeah, I tried that first (on the general forum, since at the time I

Re: Can D interface with Free Pascal?

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 30 January 2016 at 03:43:59 UTC, Taylor Hillegeist wrote: Working through a simple example. I tried the cdecl option but for some reason i can compile but when i run my Gethello it cant find the shared library in the same folder? taylor@taylor-NE510:~/Projects/PASCAL$ nm

Computing the min() / max() of a slice of doubles.

2016-01-29 Thread Enjoys Math via Digitalmars-d-learn
I want to use std.algorithm.min/max, how would I apply that to a slice of doubles and not a tuple of args? Thanks.

Re: Can D interface with Free Pascal?

2016-01-29 Thread Taylor Hillegeist via Digitalmars-d-learn
On Saturday, 30 January 2016 at 04:49:39 UTC, Taylor Hillegeist wrote: On Saturday, 30 January 2016 at 04:35:29 UTC, Taylor Hillegeist wrote: On Saturday, 30 January 2016 at 04:11:07 UTC, Mike Parker wrote: [...] Now I'm wishing that was the problem. Interestingly enough when i link to a C

Re: Access Violation in @safe Code

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 11:53 PM, Matt Elkins wrote: Title says it; I get an access violation in code marked @safe. Here's a minimal example: [code] @safe: struct Foo(alias Callback) { ~this() {Callback();} } unittest { uint stackVar; alias FooType = Foo!((){++stackVar;}); FooType[1]

Conditional nothrow/safe/nogc/etc?

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
Is there any way to specify that a generic function is conditionally nothrow (or other function decorators), based on whether the template instantiation is nothrow? I'm looking for something akin to C++'s noexcept(noexcept()), e.g.: template void foo() noexcept(noexcept(T())) {} I don't see

Re: Weird multithreading stuff

2016-01-29 Thread asdf via Digitalmars-d-learn
Okay so it turns out putting something in another thread is like throwing it into an alternate universe where only my functions exist, and instead of telling me my data doesn't exist, it just silently behaves as if it's all empty Man, threads are weird. I'll just pass the data in as an

Re: Weird multithreading stuff

2016-01-29 Thread tsbockman via Digitalmars-d-learn
On Saturday, 30 January 2016 at 05:15:58 UTC, asdf wrote: Okay so it turns out putting something in another thread is like throwing it into an alternate universe where only my functions exist, and instead of telling me my data doesn't exist, it just silently behaves as if it's all empty Are

Re: Weird multithreading stuff

2016-01-29 Thread tsbockman via Digitalmars-d-learn
On Saturday, 30 January 2016 at 05:57:20 UTC, asdf wrote: No I've fixed it now All I was asking for anyway was a little bit of help as to how threads work, which "variables declared "static" or at global scope in D are actually thread-local by default" definitely satisfies. I wasn't really

Re: Why is it a memory ERRO.

2016-01-29 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 30 January 2016 at 05:50:33 UTC, Dsby wrote: Ok.Thank you. and i want to know how to know when the GC start runing? For the current implementation, any time you allocate memory through the GC it will determine if a collection cycle is needed, but it will not run otherwise.

Re: Weird multithreading stuff

2016-01-29 Thread asdf via Digitalmars-d-learn
Okay it somehow just got even stranger that condition 'tokenIsAnOperator' in that code is a function to test whether the token is contained within the array ["+", "-", "*", "/"] It seems that sometimes it returns true for "*", and sometimes false, but only when I have "parallel" in that

Access Violation in @safe Code

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
Title says it; I get an access violation in code marked @safe. Here's a minimal example: [code] @safe: struct Foo(alias Callback) { ~this() {Callback();} } unittest { uint stackVar; alias FooType = Foo!((){++stackVar;}); FooType[1] foos; foos[0] = FooType.init; } [/code]

Re: Weird multithreading stuff

2016-01-29 Thread asdf via Digitalmars-d-learn
On Saturday, 30 January 2016 at 05:41:10 UTC, tsbockman wrote: On Saturday, 30 January 2016 at 05:15:58 UTC, asdf wrote: Okay so it turns out putting something in another thread is like throwing it into an alternate universe where only my functions exist, and instead of telling me my data

Re: Conditional nothrow/safe/nogc/etc?

2016-01-29 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jan 30, 2016 at 05:37:07AM +, Matt Elkins via Digitalmars-d-learn wrote: > On Saturday, 30 January 2016 at 05:25:49 UTC, Rikki Cattermole wrote: > >On 30/01/16 6:17 PM, Matt Elkins wrote: > >>[...] > > > >templated functions have attribute inference. Meaning if it can be > >nothrow it

Weird multithreading stuff

2016-01-29 Thread asdf via Digitalmars-d-learn
I'm writing a program to parse and evaluate mathematical expressions the parse tree is in the format: struct node { string token; node*[] children; } it is parsed such that for the input 1*(2+3)-4*(5+6), the tree ends up looking like - * * 1 + 4 +

Re: Can D interface with Free Pascal?

2016-01-29 Thread Taylor Hillegeist via Digitalmars-d-learn
On Saturday, 30 January 2016 at 04:11:07 UTC, Mike Parker wrote: On Saturday, 30 January 2016 at 03:43:59 UTC, Taylor Hillegeist wrote: Working through a simple example. I tried the cdecl option but for some reason i can compile but when i run my Gethello it cant find the shared library in

Re: Computing the min() / max() of a slice of doubles.

2016-01-29 Thread Enjoys Math via Digitalmars-d-learn
On Saturday, 30 January 2016 at 04:13:09 UTC, Enjoys Math wrote: I want to use std.algorithm.min/max, how would I apply that to a slice of doubles and not a tuple of args? Thanks. Oh I got it: import std.algorithm; reduce!(max)(slice); I'ma D wizard!

Re: Conditional nothrow/safe/nogc/etc?

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
On Saturday, 30 January 2016 at 05:25:49 UTC, Rikki Cattermole wrote: On 30/01/16 6:17 PM, Matt Elkins wrote: [...] templated functions have attribute inference. Meaning if it can be nothrow it will be. Regarding your real use case, again struct if templated so it should be inferred.

How do you get mouse movement info in GtkD?

2016-01-29 Thread Enjoys Math via Digitalmars-d-learn
I'm able to get the mouse click positions with event.button().x/y But what .x/y do you query inside of an onMotionNotify event handler? Thanks!

Re: Computing the min() / max() of a slice of doubles.

2016-01-29 Thread cym13 via Digitalmars-d-learn
On Saturday, 30 January 2016 at 04:13:09 UTC, Enjoys Math wrote: I want to use std.algorithm.min/max, how would I apply that to a slice of doubles and not a tuple of args? Thanks. Combine it with reduce: import std.algorithm; void main() { double[] arr = [1.0, 2.1, 3.2,

Re: Can D interface with Free Pascal?

2016-01-29 Thread Taylor Hillegeist via Digitalmars-d-learn
On Saturday, 30 January 2016 at 04:35:29 UTC, Taylor Hillegeist wrote: On Saturday, 30 January 2016 at 04:11:07 UTC, Mike Parker wrote: [...] Now I'm wishing that was the problem. Interestingly enough when i link to a C shared library it works... but also it isn't show in the needed shared

Re: Conditional nothrow/safe/nogc/etc?

2016-01-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 30/01/16 6:17 PM, Matt Elkins wrote: Is there any way to specify that a generic function is conditionally nothrow (or other function decorators), based on whether the template instantiation is nothrow? I'm looking for something akin to C++'s noexcept(noexcept()), e.g.: template void foo()

Re: Why is it a memory ERRO.

2016-01-29 Thread Dsby via Digitalmars-d-learn
Ok.Thank you. and i want to know how to know when the GC start runing?

Re: Conditional nothrow/safe/nogc/etc?

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
On Saturday, 30 January 2016 at 05:57:34 UTC, H. S. Teoh wrote: A common idiom that we use is to write an attributed unittest to verify that the function itself is @safe/etc.. This way, if instantiated with safe/etc. types, the template will also be safe/etc., but if instantiated with an

Re: Can D interface with Free Pascal?

2016-01-29 Thread Taylor Hillegeist via Digitalmars-d-learn
On Friday, 29 January 2016 at 01:47:11 UTC, Mike Parker wrote: On Thursday, 28 January 2016 at 19:49:22 UTC, Taylor Hillegeist wrote: On Thursday, 28 January 2016 at 19:33:22 UTC, bearophile wrote: FreeSlave: On Thursday, 28 January 2016 at 08:15:38 UTC, FreeSlave wrote: Not directly. You can

Re: How do you get mouse movement info in GtkD?

2016-01-29 Thread Enjoys Math via Digitalmars-d-learn
On Saturday, 30 January 2016 at 06:33:55 UTC, Enjoys Math wrote: I'm able to get the mouse click positions with event.button().x/y But what .x/y do you query inside of an onMotionNotify event handler? Thanks! I see now: bool onMouseMove(GdkEventMotion* eventMotion, Widget widget)

Re: UTF-16 endianess

2016-01-29 Thread Marek Janukowicz via Digitalmars-d-learn
On Fri, 29 Jan 2016 17:43:26 -0500, Steven Schveighoffer wrote: >> Is there anything I should know about UTF endianess? > > It's not any different from other endianness. > > In other words, a UTF16 code unit is expected to be in the endianness of > the platform you are running on. > > If you are

Re: Relocatable objects and internal pointers

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
On Saturday, 30 January 2016 at 01:18:33 UTC, Ali Çehreli wrote: Definitely so. Rvalues are moved around all the time. The following program has two rvalue moves without calling post-blits or destructors. Oi, that makes life tough. Ok, I'll figure something else out, then... Thanks for the

Re: d plugin for Intelij Idea debuging support

2016-01-29 Thread Matt Elkins via Digitalmars-d-learn
On Friday, 29 January 2016 at 12:00:25 UTC, Pavel wrote: Hello! Is there any debuging support for Intelij Idea's D plugin? Thanks! I can't say for certain, but the website (https://github.com/kingsleyh/DLanguage) lists this as an upcoming feature by the end of 2016, so I think there

Re: Compiling dmd -m64 on windows?

2016-01-29 Thread Tofu Ninja via Digitalmars-d-learn
On Friday, 29 January 2016 at 18:26:15 UTC, Tofu Ninja wrote: For some reason it complains that link.exe is missing. Anyone know what's up? dmd test.d dmd test.d -m64 Can't run '\bin\link.exe', check PATH link.exe is definitely on PATH... where link.exe C:\D\dmd2\windows\bin\link.exe

Re: opApply @safety

2016-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/29/16 12:44 PM, Chris Wright wrote: I want to create an opApply for a type. I've marked my code @safe, because everything I wrote was @safe. The body of opApply is @safe, but it calls a delegate that may or may not be @safe. How do I make it so I can iterate through this type safely and

Re: Compiling dmd -m64 on windows?

2016-01-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 29 January 2016 at 18:27:50 UTC, Tofu Ninja wrote: where link.exe C:\D\dmd2\windows\bin\link.exe -m64 needs a different link.exe. It uses the Microsoft linker so you've gotta be sure that one is installed and the path of the VS bin is in there too. The dmd install exe will do

Compiling dmd -m64 on windows?

2016-01-29 Thread Tofu Ninja via Digitalmars-d-learn
For some reason it complains that link.exe is missing. Anyone know what's up? dmd test.d dmd test.d -m64 Can't run '\bin\link.exe', check PATH

View model separation X and D.

2016-01-29 Thread Igor via Digitalmars-d-learn
Suppose I create a model in D and would like it to support a gui written in another language such as Qt C++ or WPF .NET. Can anyone think of an efficient and very easy way to hook up the "bindings"? The gui doesn't need to be updated more than about 30 times a second and it should run in it's

Dub packages: Best practices for windows support

2016-01-29 Thread Johannes Pfau via Digitalmars-d-learn
I want to add proper windows support to the cairoD dub package. cairoD is a wrapper for the [cairo](http://cairographics.org/) C library. As it can be difficult to obtain cairo DLLs on windows I want to ship these DLLs with cairoD. It is also possible to enable or disable additional cairo

Re: opApply @safety

2016-01-29 Thread Chris Wright via Digitalmars-d-learn
On Fri, 29 Jan 2016 14:00:08 -0500, Steven Schveighoffer wrote: > On 1/29/16 12:44 PM, Chris Wright wrote: >> I want to create an opApply for a type. >> >> I've marked my code @safe, because everything I wrote was @safe. The >> body of opApply is @safe, but it calls a delegate that may or may not

Re: View model separation X and D.

2016-01-29 Thread Igor via Digitalmars-d-learn
On Friday, 29 January 2016 at 20:04:59 UTC, Igor wrote: Suppose I create a model in D and would like it to support a gui written in another language such as Qt C++ or WPF .NET. Can anyone think of an efficient and very easy way to hook up the "bindings"? The gui doesn't need to be updated

Re: Dub packages: Best practices for windows support

2016-01-29 Thread Johannes Pfau via Digitalmars-d-learn
Am Fri, 29 Jan 2016 20:46:40 +0100 schrieb Johannes Pfau : > DFLAGS="-m32mscoff" doesn't work with dub test as the dub test > command ignores the DFLAGS variable. I'd have to check whether it > works for applications, but then there's still no way to use the > correct