Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Petar via Digitalmars-d-announce

On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote:

https://code.dlang.org/packages/tardy
https://github.com/atilaneves/tardy



Looks interesting, nice work!

How does it compare to:
https://dlang.org/phobos/std_experimental_typecons#.wrap ?

In the more longer-term, is the goal of the project to implement 
a Typescript / Go interfaces like structural type system in user 
space? Also how would it compare to Rust traits? I guess the main 
difference, would be that Rust enforces a nominal type system 
like approach, where 2 differently named traits that otherwise 
define the same interface are not considered interchangeable.


Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Stefan Koch via Digitalmars-d-announce

On Monday, 15 June 2020 at 20:54:27 UTC, 12345swordy wrote:

On Monday, 15 June 2020 at 20:51:38 UTC, Stefan Koch wrote:

On Monday, 15 June 2020 at 20:47:16 UTC, 12345swordy wrote:

On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote:

https://code.dlang.org/packages/tardy
https://github.com/atilaneves/tardy

[...]

Wouldn't a top type be a better way to achieve this?

-Alex


the Talias in type functions is a top type. (If I do 
understand correctly that it is something it's another word 
for an Any type.)
it's a pain in the ass, to work with if you are not 
dynamically typed language.


Speaking of type functions, have you been working on a dip for 
that? I am quite curious to see what it looks like currently.

-Alex


Oh no, I haven't. And I am not really a visionary.
I am trying to solve a few concrete problems.
To language addition is a means to an end, for a DIP which is is 
supposed to consider the language at large, I would need help.


Furthermore, I have to see how the implementation plays out.
It would be unwise to spec something that I couldn't implement.



Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread 12345swordy via Digitalmars-d-announce

On Monday, 15 June 2020 at 20:51:38 UTC, Stefan Koch wrote:

On Monday, 15 June 2020 at 20:47:16 UTC, 12345swordy wrote:

On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote:

https://code.dlang.org/packages/tardy
https://github.com/atilaneves/tardy

[...]

Wouldn't a top type be a better way to achieve this?

-Alex


the Talias in type functions is a top type. (If I do understand 
correctly that it is something it's another word for an Any 
type.)
it's a pain in the ass, to work with if you are not dynamically 
typed language.


Speaking of type functions, have you been working on a dip for 
that? I am quite curious to see what it looks like currently.

-Alex


Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Stefan Koch via Digitalmars-d-announce

On Monday, 15 June 2020 at 20:47:16 UTC, 12345swordy wrote:

On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote:

https://code.dlang.org/packages/tardy
https://github.com/atilaneves/tardy

[...]

Wouldn't a top type be a better way to achieve this?

-Alex


the Talias in type functions is a top type. (If I do understand 
correctly that it is something it's another word for an Any type.)
it's a pain in the ass, to work with if you are not dynamically 
typed language.


Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread 12345swordy via Digitalmars-d-announce

On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote:

https://code.dlang.org/packages/tardy
https://github.com/atilaneves/tardy

[...]

Wouldn't a top type be a better way to achieve this?

-Alex


Re: Origins of the D Programming Language now published by ACM!

2020-06-15 Thread Dennis via Digitalmars-d-announce

On Saturday, 13 June 2020 at 03:16:05 UTC, Walter Bright wrote:
Many, many thanks to Mike Parker and Andrei Alexandrescu for 
their endless hours spent fixing the mess I originally wrote.


It turned out great!


Re: Origins of the D Programming Language now published by ACM!

2020-06-15 Thread Bruce Carneal via Digitalmars-d-announce

On Saturday, 13 June 2020 at 03:16:05 UTC, Walter Bright wrote:

https://dl.acm.org/doi/abs/10.1145/3386323

Many, many thanks to Mike Parker and Andrei Alexandrescu for 
their endless hours spent fixing the mess I originally wrote.


Great read.  Many thanks for the time spent writing out the 
origin story of a wonderful language.






Re: Origins of the D Programming Language now published by ACM!

2020-06-15 Thread Ben Jones via Digitalmars-d-announce

On Saturday, 13 June 2020 at 03:16:05 UTC, Walter Bright wrote:

https://dl.acm.org/doi/abs/10.1145/3386323

Many, many thanks to Mike Parker and Andrei Alexandrescu for 
their endless hours spent fixing the mess I originally wrote.


Interesting history!  Did Eric Niebler lose interest in D?  I 
didn't realize he was involved early on.


Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread jmh530 via Digitalmars-d-announce

On Monday, 15 June 2020 at 14:12:17 UTC, Atila Neves wrote:

[snip]

Yep:

https://github.com/atilaneves/tardy/blob/d5f1102a6a791e77e0a27ee1a7920166fba8fcc8/tests/ut/polymorphic.d#L222


Thanks, I missed that.


Re: Interesting work on packing tuple layout

2020-06-15 Thread Max Samukha via Digitalmars-d-announce

On Monday, 15 June 2020 at 14:55:37 UTC, Andrej Mitrovic wrote:

On Monday, 15 June 2020 at 14:18:38 UTC, Timon Gehr wrote:

Apparently, it has been fixed in 2.092. Nice!


Oh wow that's fantastic. Does anyone know which changeset / PR 
fixed it?


The person who fixed that must be commended.


Re: Interesting work on packing tuple layout

2020-06-15 Thread Andrej Mitrovic via Digitalmars-d-announce

On Monday, 15 June 2020 at 15:00:12 UTC, Max Samukha wrote:

On Monday, 15 June 2020 at 14:55:37 UTC, Andrej Mitrovic wrote:

On Monday, 15 June 2020 at 14:18:38 UTC, Timon Gehr wrote:

Apparently, it has been fixed in 2.092. Nice!


Oh wow that's fantastic. Does anyone know which changeset / PR 
fixed it?


The person who fixed that must be commended.


I think it's this one? https://github.com/dlang/dmd/pull/10702


Re: Interesting work on packing tuple layout

2020-06-15 Thread Andrej Mitrovic via Digitalmars-d-announce

On Monday, 15 June 2020 at 14:18:38 UTC, Timon Gehr wrote:

Apparently, it has been fixed in 2.092. Nice!


Oh wow that's fantastic. Does anyone know which changeset / PR 
fixed it?


Re: Interesting work on packing tuple layout

2020-06-15 Thread Timon Gehr via Digitalmars-d-announce

On 15.06.20 16:03, Max Samukha wrote:

On Monday, 15 June 2020 at 13:57:01 UTC, Max Samukha wrote:


void main() {
    Tuple!(byte, int, short) t;
    writeln(t[0]);
}


test.d(57,23): Error: need `this` for `__value_field_2` of type `byte`


It should work. This works:

void main() {
    Tuple!(byte, int, short) t;

    t[0] = 0;
    t[1] = 2;
    t[2] = 3;

    auto a0 = t[0];
    auto a1 = t[1];
}
}


I cannot reproduce the error. writeln(t[0]) works here: 
https://run.dlang.io/is/kz6lFc




Apparently, it has been fixed in 2.092. Nice!


Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Atila Neves via Digitalmars-d-announce

On Saturday, 13 June 2020 at 18:39:14 UTC, Paul Backus wrote:

On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote:

https://code.dlang.org/packages/tardy
https://github.com/atilaneves/tardy



Cool stuff!

What's the reasoning behind implementing your own vtables 
instead of using D's built-in object system? Don't want to be 
stuck inheriting from Object?


That's one reason, but even more importantly this gives the 
implementation more freedom and potentially more options for 
client code. I haven't added it yet (mostly due to laziness) but 
I considered compile-time policies to inline the vtable in the 
object, or to determine ordering of the vtable and the 
implementation (might have performance considerations), and a few 
other things.


Also: more fun to implement, and shows that it can be done as a 
library.


Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Atila Neves via Digitalmars-d-announce

On Saturday, 13 June 2020 at 16:15:49 UTC, jmh530 wrote:

On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote:

https://code.dlang.org/packages/tardy
https://github.com/atilaneves/tardy

[snip]


This is pretty cool. Thanks for sharing.

I have a few questions/comments:

1) It might make a good blog post at some point to discuss this 
and the performance (perhaps with reference to the earlier open 
methods blog post).


I actually need to benchmark it though!

2) It looks like Polymorphic can only take one interface. Would 
you consider adding the ability to have more than one? I 
suppose a work-around would be to combine all the interfaces 
you would want to use into a new interface before combining.


I... completely forgot about that, thanks for bringing it up.

3) Do arrays work, as in Transformer(Adder(2), Plus1()) or 
[Transformer(Adder(2)), Transformer(Plus1())]


Yep:

https://github.com/atilaneves/tardy/blob/d5f1102a6a791e77e0a27ee1a7920166fba8fcc8/tests/ut/polymorphic.d#L222


Re: Interesting work on packing tuple layout

2020-06-15 Thread Max Samukha via Digitalmars-d-announce

On Monday, 15 June 2020 at 13:57:01 UTC, Max Samukha wrote:


void main() {
Tuple!(byte, int, short) t;
writeln(t[0]);
}

test.d(57,23): Error: need `this` for `__value_field_2` of 
type `byte`


It should work. This works:

void main() {
Tuple!(byte, int, short) t;

t[0] = 0;
t[1] = 2;
t[2] = 3;

auto a0 = t[0];
auto a1 = t[1];
}
}


I cannot reproduce the error. writeln(t[0]) works here: 
https://run.dlang.io/is/kz6lFc




Re: Interesting work on packing tuple layout

2020-06-15 Thread Max Samukha via Digitalmars-d-announce

On Monday, 15 June 2020 at 13:50:07 UTC, Andrej Mitrovic wrote:

typeof(t[0]) works fine, but reading or assigning to such a 
field will not work. For example:


void main() {
Tuple!(byte, int, short) t;
writeln(t[0]);
}

test.d(57,23): Error: need `this` for `__value_field_2` of 
type `byte`


It should work. This works:

void main() {
Tuple!(byte, int, short) t;

t[0] = 0;
t[1] = 2;
t[2] = 3;

auto a0 = t[0];
auto a1 = t[1];
}
}


Re: Interesting work on packing tuple layout

2020-06-15 Thread Andrej Mitrovic via Digitalmars-d-announce

On Monday, 15 June 2020 at 13:34:18 UTC, Max Samukha wrote:
On Sunday, 14 June 2020 at 23:30:03 UTC, Andrei Alexandrescu 
wrote:
It's really easy if members in the layout are given internal 
names that include information about the original index.


You can construct a list of member aliases in the original 
order and then 'alias this' that:


typeof(t[0]) works fine, but reading or assigning to such a field 
will not work. For example:


void main() {
Tuple!(byte, int, short) t;
writeln(t[0]);
}

test.d(57,23): Error: need `this` for `__value_field_2` of type 
`byte`




Re: Interesting work on packing tuple layout

2020-06-15 Thread Max Samukha via Digitalmars-d-announce
On Sunday, 14 June 2020 at 23:30:03 UTC, Andrei Alexandrescu 
wrote:
It's really easy if members in the layout are given internal 
names that include information about the original index.


You can construct a list of member aliases in the original order 
and then 'alias this' that:


import std.meta;

struct Tuple(A...) {
alias Reordered = AliasSeq!(A[1], A[2], A[0]);
Reordered value;

alias reordered = AliasSeq!(typeof(this).tupleof);
alias original = AliasSeq!(reordered[2], reordered[0], 
reordered[1]);

alias original this;
}

void main() {
Tuple!(byte, int, short) t;

static assert(is(typeof(t.tupleof) == AliasSeq!(int, short, 
byte)));


static assert(is(typeof(t[0]) == byte));
static assert(is(typeof(t[1]) == int));
static assert(is(typeof(t[2]) == short));
}


Re: This Right In: PLDI 2020 will take place online and registration is FREE. Closes on Jun 5, so hurry!

2020-06-15 Thread Timon Gehr via Digitalmars-d-announce

On 15.06.20 09:46, M.M. wrote:

On Sunday, 14 June 2020 at 20:22:41 UTC, Timon Gehr wrote:


For PLDI 2020, I have contributed to the following research papers:

https://pldi20.sigplan.org/details/pldi-2020-papers/47/Silq-A-High-Level-Quantum-Language-with-Safe-Uncomputation-and-Intuitive-Semantics 



https://pldi20.sigplan.org/details/pldi-2020-papers/46/-PSI-Exact-Inference-for-Higher-Order-Probabilistic-Programs 



Congratulations.
...


Thanks!

The only relation to D is that the implementations of the two 
presented programming languages are written in D.


Does that mean that your junior co-author(s) use D as well?



Occasionally.


Re: This Right In: PLDI 2020 will take place online and registration is FREE. Closes on Jun 5, so hurry!

2020-06-15 Thread Timon Gehr via Digitalmars-d-announce

On 15.06.20 08:58, Robert M. Münch wrote:

On 2020-06-14 20:22:41 +, Timon Gehr said:

https://pldi20.sigplan.org/details/pldi-2020-papers/46/-PSI-Exact-Inference-for-Higher-Order-Probabilistic-Programs 



This one sounds pretty interesting. Will there be a recording and a 
published paper be available?




The talk will be on YouTube.

Papers:
https://www.sri.inf.ethz.ch/publications/bichsel2020silq
https://www.sri.inf.ethz.ch/publications/gehr2020lpsi

Source code:
https://github.com/eth-sri/silq
https://github.com/eth-sri/psi/tree/new-types


Re: This Right In: PLDI 2020 will take place online and registration is FREE. Closes on Jun 5, so hurry!

2020-06-15 Thread Walter Bright via Digitalmars-d-announce

On 6/14/2020 1:22 PM, Timon Gehr wrote:
The only relation to D is that the implementations of the two presented 
programming languages are written in D.


Nice!


Re: This Right In: PLDI 2020 will take place online and registration is FREE. Closes on Jun 5, so hurry!

2020-06-15 Thread M.M. via Digitalmars-d-announce

On Sunday, 14 June 2020 at 20:22:41 UTC, Timon Gehr wrote:

For PLDI 2020, I have contributed to the following research 
papers:


https://pldi20.sigplan.org/details/pldi-2020-papers/47/Silq-A-High-Level-Quantum-Language-with-Safe-Uncomputation-and-Intuitive-Semantics

https://pldi20.sigplan.org/details/pldi-2020-papers/46/-PSI-Exact-Inference-for-Higher-Order-Probabilistic-Programs


Congratulations.

The only relation to D is that the implementations of the two 
presented programming languages are written in D.


Does that mean that your junior co-author(s) use D as well?




Re: This Right In: PLDI 2020 will take place online and registration is FREE. Closes on Jun 5, so hurry!

2020-06-15 Thread Robert M. Münch via Digitalmars-d-announce

On 2020-06-14 20:22:41 +, Timon Gehr said:

https://pldi20.sigplan.org/details/pldi-2020-papers/46/-PSI-Exact-Inference-for-Higher-Order-Probabilistic-Programs 



This one sounds pretty interesting. Will there be a recording and a 
published paper be available?


--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster