Re: Equivalent to nullptr

2017-05-03 Thread Stanislav Blinov via Digitalmars-d-learn
In the meantime, you can get around the issue by redeclaring the function with another name and loading it manually just after calling DerelictSDL2.load(): import derelict.sdl2.sdl; __gshared SDL_bool function (const(SDL_Point)*, int, const(SDL_Rect)*, SDL_Rect*) SDL_EnclosePoints_; void m

Re: Equivalent to nullptr

2017-05-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Thursday, 4 May 2017 at 03:59:36 UTC, Leonardo wrote: On Thursday, 4 May 2017 at 02:45:30 UTC, Adam D. Ruppe wrote: On Thursday, 4 May 2017 at 02:12:13 UTC, Leonardo wrote: nullptr word. How I use this? Does it work if you just use `null` ? No. First I got: source/app.d(45,69): Error: e

Re: Equivalent to nullptr

2017-05-03 Thread Leonardo via Digitalmars-d-learn
On Thursday, 4 May 2017 at 02:45:30 UTC, Adam D. Ruppe wrote: On Thursday, 4 May 2017 at 02:12:13 UTC, Leonardo wrote: nullptr word. How I use this? Does it work if you just use `null` ? No. First I got: source/app.d(45,69): Error: expression (*SDL_EnclosePoints)(& mousePos, 1, &ball.bbox,

Re: Equivalent to nullptr

2017-05-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 4 May 2017 at 02:12:13 UTC, Leonardo wrote: nullptr word. How I use this? Does it work if you just use `null` ?

Equivalent to nullptr

2017-05-03 Thread Leonardo via Digitalmars-d-learn
I was trying to use Derelict-SDL2 library, and the tutorial do this code below, as C++ code has nullptr word. How I use this? - struct Ball { SDL_Rect bbox = {0, 0, 100, 100}; SDL_Point vel = {1, 1}; } - case SDL_MOUSEBUTTONDOW

Re: How to check if object is an instance of generic class?

2017-05-03 Thread Nothing via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 17:54:13 UTC, H. S. Teoh wrote: On Wed, May 03, 2017 at 05:26:27PM +, Nothing via Digitalmars-d-learn wrote: Hi, Honestly I am new to D and templates system so excuse me But of course, if you wish to write your own Box type, then to answer your question: [...]

Re: How to check if object is an instance of generic class?

2017-05-03 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, May 03, 2017 at 08:24:31PM +0200, ag0aep6g via Digitalmars-d-learn wrote: > On 05/03/2017 08:04 PM, H. S. Teoh via Digitalmars-d-learn wrote: > > You only need a common interface if you wish to do something more > > with Box!X instantiations that's common across all Boxes. > > The goal is

Re: How to check if object is an instance of generic class?

2017-05-03 Thread ag0aep6g via Digitalmars-d-learn
On 05/03/2017 08:04 PM, H. S. Teoh via Digitalmars-d-learn wrote: You only need a common interface if you wish to do something more with Box!X instantiations that's common across all Boxes. The goal is to return `true` for two empty boxes with different payload types. From the OP: "Empty boxes

Re: How to check if object is an instance of generic class?

2017-05-03 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, May 03, 2017 at 08:04:20PM +0200, ag0aep6g via Digitalmars-d-learn wrote: > On 05/03/2017 07:26 PM, Nothing wrote: [...] > > So is there an idiomatic approach to know if the Object is an > > instance of Box (regardless of content type T) and than if necessary > > to know exactly if two box

Re: How to check if object is an instance of generic class?

2017-05-03 Thread ag0aep6g via Digitalmars-d-learn
On 05/03/2017 07:26 PM, Nothing wrote: Equality checking is where I stuck. It should work as follows: 0. If we compare the Box [b]b[/b] to an object [b]o[/b] that is not an instance of Box, it should return false. 1. Empty boxes are equal no matter the type. 2. If type of payload for two boxes th

Re: How to check if object is an instance of generic class?

2017-05-03 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, May 03, 2017 at 05:26:27PM +, Nothing via Digitalmars-d-learn wrote: > Hi, Honestly I am new to D and templates system so excuse me if my > question will seem trivial. > > I want to develop a generic Box(T) class that can be either empty or > hold a value of arbitrary type T. Have a l

Productive vibe.d dev environment (IDE, debugger) on Linux?

2017-05-03 Thread kinke via Digitalmars-d-learn
Hey guys, can anyone recommend a more or less production-ready dev environment for vibe.d on Linux? I'm evaluating vibe.d against Phoenix (Elixir/Erlang) for a new project. Today I gave Visual Studio Code a quick shot (with LDC 1.1.1 and DMD 2.071/72/74), with Webfreak's plugins, but I'm not

How to check if object is an instance of generic class?

2017-05-03 Thread Nothing via Digitalmars-d-learn
Hi, Honestly I am new to D and templates system so excuse me if my question will seem trivial. I want to develop a generic Box(T) class that can be either empty or hold a value of arbitrary type T. // class Box(T) { override bool opEquals(Object o) { //...

Re: visibility deprecation with last dmd compiler

2017-05-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 14:14:16 UTC, jacob wrote: But how can I use private fields from descedant class? You don't, the whole point of private is that they aren't used from outside the module. Try `protected` instead, it is similar to private, but still allows use from a subclass.

visibility deprecation with last dmd compiler

2017-05-03 Thread jacob via Digitalmars-d-learn
I have 2 files file abc.d: == module my.abc; class Abc { private int x; this() { this.x = 1; } } == and xyz.d: == module my.xyz; import my.abc; class Xyz: Abc { this() { super(); this.x = 2; } } == Compilation fails with "Deprecation: my.abc.Abc.x is not visible from module xyz"

Re: COM Expertise needed: COM Callbacks

2017-05-03 Thread Mike B Johnson via Digitalmars-d-learn
On Friday, 28 April 2017 at 09:25:31 UTC, John Chapman wrote: On Thursday, 27 April 2017 at 20:20:23 UTC, Nierjerson wrote: I think the main issue though, is that I really don't know what is going on when I invoke the PS function. It seems to call the server method that takes the interface an

Re: Why does this compile (method in class without return type)

2017-05-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 07:37:31 UTC, Jacob Carlborg wrote: It might be by accident but I think the compiler is inferring the return type. Just as "auto" is not necessary to infer the type of a variable if there's another attribute: No accident there, the spec says any storage class will d

Re: The .obj file, what is it?

2017-05-03 Thread Adam D. Ruppe via Digitalmars-d-learn
Basically, .obj is a temporary file the compiler uses to store its half-finished work on the way to producing the exe. Once you have the exe, the obj is no longer necessary, but keeping them around can sometimes speed up recompiles by reusing the left over work from last time. (Not so much in

Re: The .obj file, what is it?

2017-05-03 Thread I Lindström via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 11:09:33 UTC, Stanislav Blinov wrote: The source is not compiled into the executable. The source is compiled into a "object code", output into an "object file" - in this case, the .obj file. Afterwards, object files are linked by a linker (usually also taking other

Re: The .obj file, what is it?

2017-05-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 10:55:44 UTC, I Lindström wrote: So, a question from a beginner. What is the .obj file that appears after the source is compiled into the executable? I can't find a good explanation on the Net for it. I take it the file has to accompany the executable for the program

The .obj file, what is it?

2017-05-03 Thread I Lindström via Digitalmars-d-learn
So, a question from a beginner. What is the .obj file that appears after the source is compiled into the executable? I can't find a good explanation on the Net for it. I take it the file has to accompany the executable for the program to function since the online explanations I've found say it

Re: Why does this compile (method in class without return type)

2017-05-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 09:21:47 UTC, nkm1 wrote: On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote: print in A is template: What :) How does it interact with 'final'? If it were a template (and it's not), then final would not be applicable, because templated functions cann

Re: Why does this compile (method in class without return type)

2017-05-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote: V Wed, 03 May 2017 06:54:15 + nkm1 via Digitalmars-d-learn napsáno: Consider: import std.stdio; class A { final print() { writeln(this); } // no return type } class B : A { final void print() { writeln(this); } } v

Re: Why does this compile (method in class without return type)

2017-05-03 Thread Daniel Kozák via Digitalmars-d-learn
V Wed, 03 May 2017 09:21:47 + nkm1 via Digitalmars-d-learn napsáno: > On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote: > > > > print in A is template: > > > > What :) > How does it interact with 'final'? hmm obviously it is problem only with final

Re: Why does this compile (method in class without return type)

2017-05-03 Thread Daniel Kozák via Digitalmars-d-learn
V Wed, 03 May 2017 09:21:47 + nkm1 via Digitalmars-d-learn napsáno: > On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote: > > > > print in A is template: > > > > What :) > How does it interact with 'final'? final is not important here

Re: Why does this compile (method in class without return type)

2017-05-03 Thread nkm1 via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 07:34:03 UTC, Daniel Kozák wrote: print in A is template: What :) How does it interact with 'final'?

Re: alias can't find symbol or can't use symbol

2017-05-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, 30 April 2017 at 00:17:37 UTC, Carl Sturtivant wrote: Consider the following. struct member { int n; } struct outer { member x; alias x this; alias n2 = n; } This does not compile: alias n2 = n; Error: undefined identifier 'n' That makes perfect sense, as n is not

Re: Why does this compile (method in class without return type)

2017-05-03 Thread nkm1 via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 06:54:15 UTC, nkm1 wrote: final method type inference stuff Jacob and Jonathan - thank you, this is clear to me now. Hopefully it will get fixed at some point.

Re: Why does this compile (method in class without return type)

2017-05-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 08:10:04 UTC, Jonathan M Davis wrote: So, I'd say that there's definitely a bug here. https://issues.dlang.org/show_bug.cgi?id=17366

Re: Why does this compile (method in class without return type)

2017-05-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 07:37:31 UTC, Jacob Carlborg wrote: It might be by accident but I think the compiler is inferring the return type. Just as "auto" is not necessary to infer the type of a variable if there's another attribute: auto a = 3; const auto b = 4; // here "auto" is redundant

Re: Why does this compile (method in class without return type)

2017-05-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-05-03 08:54, nkm1 wrote: Consider: import std.stdio; class A { final print() { writeln(this); } // no return type } class B : A { final void print() { writeln(this); } } void main() { auto b = new B; b.print(); A a1 = b; a1.print(); A a2 = new A;

Re: Why does this compile (method in class without return type)

2017-05-03 Thread Daniel Kozák via Digitalmars-d-learn
V Wed, 03 May 2017 06:54:15 + nkm1 via Digitalmars-d-learn napsáno: > Consider: > > import std.stdio; > > class A > { > final print() { writeln(this); } // no return type > } > > class B : A > { > final void print() { writeln(this); } > } > > void main() > { > auto b = new