On Tuesday, 2 January 2018 at 00:54:13 UTC, Laeeth Isharc wrote:
On Friday, 29 December 2017 at 12:59:21 UTC, rjframe wrote:
On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote:
[...]
I've actually thought about doing this to get rid of a bunch
of if qualifiers in my function declarat
On Saturday, 30 December 2017 at 16:23:05 UTC, Steven
Schveighoffer wrote:
On 12/29/17 7:03 AM, Mike Franklin wrote:
Is that simply because it hasn't been implemented or suggested
yet for D, or was there a deliberate design decision?
It was deliberate, but nothing says it can't actually be do
On Tue, 02 Jan 2018 00:54:13 +, Laeeth Isharc wrote:
> On Friday, 29 December 2017 at 12:59:21 UTC, rjframe wrote:
>> On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote:
>>
>> I've actually thought about doing this to get rid of a bunch of if
>> qualifiers in my function declarations. `
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
In C#, structs can inherit from and implement interfaces.
using System;
interface IPrint
{
void Print();
}
struct MyStruct : IPrint
{
public void Print()
{
Console.WriteLine(ToString());
}
}
public
On Friday, 29 December 2017 at 12:59:21 UTC, rjframe wrote:
On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote:
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin
wrote:
The problem is that interfaces are a runtime thing (e.g. you
can cast a
class to an interface)
structs imp
On 12/29/17 7:03 AM, Mike Franklin wrote:
Is that simply because it hasn't been implemented or suggested yet for
D, or was there a deliberate design decision?
It was deliberate, but nothing says it can't actually be done. All an
interface call is, is a thunk to grab the actual object, and the
On Friday, 29 December 2017 at 13:08:38 UTC, rikki cattermole
wrote:
On 29/12/2017 12:59 PM, rjframe wrote:
On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote:
[...]
I've actually thought about doing this to get rid of a bunch
of if
qualifiers in my function declarations. `static int
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
In C#, structs can inherit from and implement interfaces.
Is that simply because it hasn't been implemented or suggested
yet for D, or was there a deliberate design decision?
Thanks for your insight,
Mike
I think it's deliber
On Friday, 29 December 2017 at 13:08:38 UTC, rikki cattermole
wrote:
On 29/12/2017 12:59 PM, rjframe wrote:
On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote:
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin
wrote:
The problem is that interfaces are a runtime thing (e.g. yo
On 29/12/2017 12:59 PM, rjframe wrote:
On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote:
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
The problem is that interfaces are a runtime thing (e.g. you can cast a
class to an interface)
structs implement compile time inte
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
In C#, structs can inherit from and implement interfaces.
using System;
interface IPrint
{
void Print();
}
struct MyStruct : IPrint
{
public void Print()
{
Console.WriteLine(ToString());
}
}
public
On Fri, 29 Dec 2017 12:39:25 +, Nicholas Wilson wrote:
> On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
>
> The problem is that interfaces are a runtime thing (e.g. you can cast a
> class to an interface)
> structs implement compile time interfaces via template duck typing
>
On Friday, December 29, 2017 12:18:57 Mike Franklin via Digitalmars-d-learn
wrote:
> On Friday, 29 December 2017 at 12:11:46 UTC, rikki cattermole
>
> wrote:
> > Structs are structs, classes are classes.
>
> I'm talking about interfaces, which are neither structs nor
> classes.
Interfaces are rel
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
Is that simply because it hasn't been implemented or suggested
yet for D, or was there a deliberate design decision?
It's a design decision.
Look carefully at structs vs. classes here:
https://dlang.org/spec/struct.html
There is
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
In C#, structs can inherit from and implement interfaces.
using System;
interface IPrint
{
void Print();
}
struct MyStruct : IPrint
{
public void Print()
{
Console.WriteLine(ToString());
}
}
public
On Friday, 29 December 2017 at 12:11:46 UTC, rikki cattermole
wrote:
Structs are structs, classes are classes.
I'm talking about interfaces, which are neither structs nor
classes.
C++ had the mixed model similar to what you suggested, we got
it right and kept it nice and separate. This was
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
In C#, structs can inherit from and implement interfaces.
using System;
interface IPrint
{
void Print();
}
struct MyStruct : IPrint
{
public void Print()
{
Console.WriteLine(ToString());
}
}
public
Structs are structs, classes are classes.
C++ had the mixed model similar to what you suggested, we got it right
and kept it nice and separate. This was done on purpose.
In C#, structs can inherit from and implement interfaces.
using System;
interface IPrint
{
void Print();
}
struct MyStruct : IPrint
{
public void Print()
{
Console.WriteLine(ToString());
}
}
public class Program
{
public static void Main()
{
MyStruc
19 matches
Mail list logo