Re: reimplementing an interface in a derived class

2019-01-03 Thread bauss via Digitalmars-d-learn
On Friday, 4 January 2019 at 00:19:05 UTC, Alex wrote: On Friday, 4 January 2019 at 00:15:28 UTC, Neia Neutuladh wrote: On Thu, 03 Jan 2019 23:44:15 +, Alex wrote: I assume that is another bug and has nothing to do with interfaces... B.foo is both overriding A.foo and implementing D.foo,

Re: changing the output of `std.stdio.write'

2019-01-03 Thread Manfred Nowak via Digitalmars-d-learn
On Thursday, 3 January 2019 at 18:11:43 UTC, Paul Backus wrote: [...] functions [...] default to `%s`. thx. I should have rtfm instead of looking for an example. -manfred

Re: What's wrong with this template function?

2019-01-03 Thread Machine Code via Digitalmars-d-learn
On Thursday, 3 January 2019 at 21:41:44 UTC, Neia Neutuladh wrote: On Thu, 03 Jan 2019 20:34:17 +, Machine Code wrote: Thank you very much, Ali. So the issue was basically I can't return from a static foreach() loop right? The static foreach is done at compile time and the return is done

Re: reimplementing an interface in a derived class

2019-01-03 Thread Neia Neutuladh via Digitalmars-d-learn
On Fri, 04 Jan 2019 00:19:05 +, Alex wrote: > B.foo overrides A.foo. By casting a B object to be an A object, A's > behavior should be granted, shouldn't it? I can't think of a single class system that works like that. C++, Java, C#, Dart, and TypeScript all work like D here. GObject in C

Re: Vibe.d throw link error

2019-01-03 Thread Seb via Digitalmars-d-learn
On Wednesday, 2 January 2019 at 20:52:26 UTC, greatsam4sure wrote: I am using windows 10. I could not run vibe project. It just give me the error: Error: linker exit with status 1 Dmd failed with exit code 1 I have use different dmd from 0.080 till 0.083. The same error. What is the

Re: reimplementing an interface in a derived class

2019-01-03 Thread Neia Neutuladh via Digitalmars-d-learn
On Thu, 03 Jan 2019 23:44:15 +, Alex wrote: > I assume that is another bug and has nothing to do with interfaces... B.foo is both overriding A.foo and implementing D.foo, so that's not a bug.

Re: reimplementing an interface in a derived class

2019-01-03 Thread Alex via Digitalmars-d-learn
On Friday, 4 January 2019 at 00:15:28 UTC, Neia Neutuladh wrote: On Thu, 03 Jan 2019 23:44:15 +, Alex wrote: I assume that is another bug and has nothing to do with interfaces... B.foo is both overriding A.foo and implementing D.foo, so that's not a bug. I don't have any interfaces in

Re: reimplementing an interface in a derived class

2019-01-03 Thread Alex via Digitalmars-d-learn
On Thursday, 3 January 2019 at 23:23:12 UTC, Neia Neutuladh wrote: On Thu, 03 Jan 2019 22:30:48 +, kdevel wrote: class A : D { int foo() { return 1; } } class B : A, D { [...] What is the meaning of the ", D"? It does not seem to make a difference if it is omitted. B must provide

Re: reimplementing an interface in a derived class

2019-01-03 Thread bauss via Digitalmars-d-learn
On Thursday, 3 January 2019 at 22:30:48 UTC, kdevel wrote: https://dlang.org/spec/interface.html #11 has this code example: ``` interface D { int foo(); } class A : D { int foo() { return 1; } } class B : A, D { override int foo() { return 2; } } ... B b = new B(); b.foo();

Re: reimplementing an interface in a derived class

2019-01-03 Thread Neia Neutuladh via Digitalmars-d-learn
On Thu, 03 Jan 2019 22:30:48 +, kdevel wrote: > class A : D { > int foo() { return 1; } > } > > class B : A, D { > [...] > > What is the meaning of the ", D"? It does not seem to make a difference > if it is omitted. B must provide its own implementation of D. It can't simply use A's

reimplementing an interface in a derived class

2019-01-03 Thread kdevel via Digitalmars-d-learn
https://dlang.org/spec/interface.html #11 has this code example: ``` interface D { int foo(); } class A : D { int foo() { return 1; } } class B : A, D { override int foo() { return 2; } } ... B b = new B(); b.foo();// returns 2 D d = cast(D) b; d.foo();//

Re: What's wrong with this template function?

2019-01-03 Thread Neia Neutuladh via Digitalmars-d-learn
On Thu, 03 Jan 2019 20:34:17 +, Machine Code wrote: > Thank you very much, Ali. So the issue was basically I can't return from > a static foreach() loop right? The static foreach is done at compile time and the return is done at runtime. After the template is expanded, your code ends up

Re: What's wrong with this template function?

2019-01-03 Thread Machine Code via Digitalmars-d-learn
On Thursday, 3 January 2019 at 19:38:39 UTC, Ali Çehreli wrote: On 01/03/2019 10:49 AM, Machine Code wrote: > I wrote a small routine to return the first member I see that that's possible because the values of such members are known at compile time in your case. Otherwise, you would need a

Re: What's wrong with this template function?

2019-01-03 Thread Ali Çehreli via Digitalmars-d-learn
On 01/03/2019 10:49 AM, Machine Code wrote: > I wrote a small routine to return the first member I see that that's possible because the values of such members are known at compile time in your case. Otherwise, you would need a mechanism that would return the value of the first member for any

What's wrong with this template function?

2019-01-03 Thread Machine Code via Digitalmars-d-learn
I wrote a small routine to return the first member of type T of a same type, like struct below, but the assert is reached albeit the "yes" message is printed. What am I missing? should I use something else than return keyword to return from a template function or what? struct Color {

Re: changing the output of `std.stdio.write'

2019-01-03 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 3 January 2019 at 17:59:28 UTC, Manfred Nowak wrote: According to this tutorial https://wiki.dlang.org/Defining_custom_print_format_specifiers it seems easy to change the format of the output for `std.stdio.writef'. But why is there no example for changing the output when there

changing the output of `std.stdio.write'

2019-01-03 Thread Manfred Nowak via Digitalmars-d-learn
According to this tutorial https://wiki.dlang.org/Defining_custom_print_format_specifiers it seems easy to change the format of the output for `std.stdio.writef'. But why is there no example for changing the output when there are no format specifiers? -manfred

Re: DIP 1000 and classes

2019-01-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, January 3, 2019 3:28:35 AM MST Nordlöw via Digitalmars-d-learn wrote: > How does DIP 1000 treat the lifetime scoped class parameters and > containers of classes? scope isn't transitive, and putting an object inside a container would be escaping it, which would violate scope. So, you

Re: Vibe.d throw link error

2019-01-03 Thread bauss via Digitalmars-d-learn
On Thursday, 3 January 2019 at 00:23:50 UTC, greatsam4sure wrote: On Wednesday, 2 January 2019 at 21:46:57 UTC, bauss wrote: Error: linker exit with status 1 Dmd failed with exit code 1 This is all the compiler emit I'm not asking for the error or what the compiler emits. I'm asking how

Re: Understanding SIGSEGV issues

2019-01-03 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 3 January 2019 at 08:35:17 UTC, Russel Winder wrote: Sorry about that, fairly obvious that the backtrace is needed in hindsight. :- ) #0 __GI___libc_free (mem=0xa) at malloc.c:3093 #1 0x5558f174 in dvb_file_free (dvb_file=0x555a1320) at dvb_file.d:282 #2

DIP 1000 and classes

2019-01-03 Thread Nordlöw via Digitalmars-d-learn
How does DIP 1000 treat the lifetime scoped class parameters and containers of classes?

Re: Understanding SIGSEGV issues

2019-01-03 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2019-01-03 at 07:52 +, Nicholas Wilson via Digitalmars-d-learn wrote: > On Thursday, 3 January 2019 at 06:25:46 UTC, Russel Winder wrote: > > So I have a D program that used to work. I come back to it, > > recompile it, and: > > > > [...] > > __GI___libc_free (mem=0xa) at