Re: Boston D Meetup: Strawman Structs

2017-07-28 Thread Andrei Alexandrescu via Digitalmars-d-announce

On 7/25/17 5:50 AM, John Colvin wrote:

On Sunday, 2 July 2017 at 10:35:49 UTC, Steven Schveighoffer wrote:
I'll have a short presentation on a weird trick I discovered while 
writing some MySQL serialization code. Hope you can attend!


https://www.eventbrite.com/e/d-lang-presentation-strawman-structs-tickets-35120523431 



-Steve


Is there a written summary of the idea? Or is there a specific point in 
the video someone could point me to?


What I can definitely say is it's a very interesting technique worth 
slogging through probably poor audio etc. It's really a concept language 
without a language. Very inspiring work. -- Andrei


Re: Boston D Meetup: Strawman Structs

2017-07-25 Thread Nicholas Wilson via Digitalmars-d-announce

On Tuesday, 25 July 2017 at 09:50:46 UTC, John Colvin wrote:
On Sunday, 2 July 2017 at 10:35:49 UTC, Steven Schveighoffer 
wrote:
I'll have a short presentation on a weird trick I discovered 
while writing some MySQL serialization code. Hope you can 
attend!


https://www.eventbrite.com/e/d-lang-presentation-strawman-structs-tickets-35120523431

-Steve


Is there a written summary of the idea? Or is there a specific 
point in the video someone could point me to?


Basically using structs to describe layouts (among other 
relations) and in turn use that to drive DbI automated code. The 
DbI is the only "code" the rest is declarative using the type 
system.


Steven was using it to describe what columns ( name and type) a 
query should return from a DB and the using DbI to generate the 
Query.




Re: Boston D Meetup: Strawman Structs

2017-07-25 Thread John Colvin via Digitalmars-d-announce
On Sunday, 2 July 2017 at 10:35:49 UTC, Steven Schveighoffer 
wrote:
I'll have a short presentation on a weird trick I discovered 
while writing some MySQL serialization code. Hope you can 
attend!


https://www.eventbrite.com/e/d-lang-presentation-strawman-structs-tickets-35120523431

-Steve


Is there a written summary of the idea? Or is there a specific 
point in the video someone could point me to?


Re: Boston D Meetup: Strawman Structs

2017-07-24 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-announce

On 07/21/2017 05:55 PM, Steven Schveighoffer wrote:

On 7/2/17 6:35 AM, Steven Schveighoffer wrote:
I'll have a short presentation on a weird trick I discovered while 
writing some MySQL serialization code. Hope you can attend!


https://www.youtube.com/watch?v=ZxzczSDaobw



Very cool.


Re: Boston D Meetup: Strawman Structs

2017-07-24 Thread Steven Schveighoffer via Digitalmars-d-announce

On 7/23/17 9:50 AM, Moritz Maxeiner wrote:

On Sunday, 23 July 2017 at 02:15:18 UTC, Steven Schveighoffer wrote:


struct StrawmanRange(T)
{
  ...
  void popFront() {}
}


How do you deal with ranges where `.popFront` returns the old front 
element (`.front` requires copying the front element if the caller wants 
to store it, `.popFront` can move it)?


As I said in the talk, there's not an actual library for this, it's just 
an idea. I would say you could probably return Any here, and infer that 
means the return type doesn't matter. Or you could have an attribute. 
The idea is to communicate in some way to the "implements" function how 
to create the right constraint.


-Steve


Re: Boston D Meetup: Strawman Structs

2017-07-23 Thread Moritz Maxeiner via Digitalmars-d-announce
On Sunday, 23 July 2017 at 02:15:18 UTC, Steven Schveighoffer 
wrote:


struct StrawmanRange(T)
{
  ...
  void popFront() {}
}


How do you deal with ranges where `.popFront` returns the old 
front element (`.front` requires copying the front element if the 
caller wants to store it, `.popFront` can move it)?


Re: Boston D Meetup: Strawman Structs

2017-07-22 Thread Nicholas Wilson via Digitalmars-d-announce
On Sunday, 23 July 2017 at 02:15:18 UTC, Steven Schveighoffer 
wrote:

On 7/21/17 8:49 PM, Nicholas Wilson wrote:
On Friday, 21 July 2017 at 21:55:01 UTC, Steven Schveighoffer 
wrote:

On 7/2/17 6:35 AM, Steven Schveighoffer wrote:
I'll have a short presentation on a weird trick I discovered 
while writing some MySQL serialization code. Hope you can 
attend!


https://www.eventbrite.com/e/d-lang-presentation-strawman-structs-tickets-35120523431



I've set up a live stream for this. No guarantees of the 
quality, it will be audio + slideshow.


Waiting for people to arrive, so probably won't start until 
at least 6:30.


https://www.youtube.com/watch?v=ZxzczSDaobw



Great talk!


Thanks!



Regarding the inferred attribute problem with the concepts 
like Straw-man usage, this should not be a problem with my 
attributes DIP, since all special attributes become normal 
attributes and you could just have an AliasSeq of the required 
values.


Maybe I'm misunderstanding you, but my concern is that 
something like this:


struct StrawmanRange(T)
{
  ...
  void popFront() {}
}

So popFront would be inferred to be pure, @safe, and nothrow. 
However, since really we want to only do what was specified, we 
don't want the compiler inferring this. More specifically, I 
wouldn't want the `implements` function generating requirements 
that a suitable range struct must have @safe nothrow pure 
popFront. I don't think introspection can tell whether the 
attributes were specified or inferred.


I don't see how being able to combine attributes is going to be 
able to prevent compiler inference of them. Or maybe I am 
missing something?


-Steve


Its the combining with AliasSeq in conjunction with being normal 
(albeit compiler recognised) attributes that makes it work. It 
doesn't matter what the compiler infers because the struct knows, 
with RequiredAttributes, what attributes are _actually_ required 
E.g.


struct RequiredAttributes(Values...) 
if(AllSatisfy!(isCoreAttributeValue, Values))

{
alias values = AliasSeq!(Values);
}

 struct StrawmanRange(T)
 {
@RequiredAttributes!(): // i.e. no attributes required
// or use
//@RequiredAttributes!(safe,nothrow,nogc,pure): for very 
strict functions

// can apply this on a per symbol basis too.

@property T front();
bool empty();
void popFront() {}
 }

and reflect on the RequiredAttributes.values to force the 
"correct" attributes in `implements` and `describeDifferences`.


// roughly and ignoring optional methods
bool Implements(Strawman,T)()
{
foreach(m; __traits(allMembers, Strawman)
{
static if (!hasMember!(T,m)
return false;
else static if (!isCovariantWith!(__traits(getMember, T, 
m),getUDA!(__traits(getMember, Strawman, m), RequiredAttributes). 
values)

return false;
}
return true;
}



Re: Boston D Meetup: Strawman Structs

2017-07-21 Thread Nicholas Wilson via Digitalmars-d-announce
On Friday, 21 July 2017 at 21:55:01 UTC, Steven Schveighoffer 
wrote:

On 7/2/17 6:35 AM, Steven Schveighoffer wrote:
I'll have a short presentation on a weird trick I discovered 
while writing some MySQL serialization code. Hope you can 
attend!


https://www.eventbrite.com/e/d-lang-presentation-strawman-structs-tickets-35120523431


I've set up a live stream for this. No guarantees of the 
quality, it will be audio + slideshow.


Waiting for people to arrive, so probably won't start until at 
least 6:30.


https://www.youtube.com/watch?v=ZxzczSDaobw

-Steve


Great talk! It seems great mids think alike, I will be using this 
to implement OpenCL's horrible getInfo.

https://github.com/libmir/dcompute/blob/master/source/dcompute/driver/ocl120/util.d#L36
https://github.com/libmir/dcompute/blob/master/source/dcompute/driver/ocl120/device.d#L67

Regarding the inferred attribute problem with the concepts like 
Straw-man usage, this should not be a problem with my attributes 
DIP, since all special attributes become normal attributes and 
you could just have an AliasSeq of the required values.




Re: Boston D Meetup: Strawman Structs

2017-07-21 Thread Steven Schveighoffer via Digitalmars-d-announce

On 7/2/17 6:35 AM, Steven Schveighoffer wrote:
I'll have a short presentation on a weird trick I discovered while 
writing some MySQL serialization code. Hope you can attend!


https://www.eventbrite.com/e/d-lang-presentation-strawman-structs-tickets-35120523431 


I've set up a live stream for this. No guarantees of the quality, it 
will be audio + slideshow.


Waiting for people to arrive, so probably won't start until at least 6:30.

https://www.youtube.com/watch?v=ZxzczSDaobw

-Steve


Re: Boston D Meetup: Strawman Structs

2017-07-02 Thread Steven Schveighoffer via Digitalmars-d-announce

On 7/2/17 6:35 AM, Steven Schveighoffer wrote:
I'll have a short presentation on a weird trick I discovered while 
writing some MySQL serialization code. Hope you can attend!


https://www.eventbrite.com/e/d-lang-presentation-strawman-structs-tickets-35120523431 


I've moved this to Friday to accommodate more people.

-Steve