digitalmars.D.announce - Boston D Meetup: Strawman Structs
- Steven Schveighoffer (4/4) Jul 02 2017 I'll have a short presentation on a weird trick I discovered while
- Steven Schveighoffer (3/7) Jul 02 2017 I've moved this to Friday to accommodate more people.
- Steven Schveighoffer (6/10) Jul 21 2017 I've set up a live stream for this. No guarantees of the quality, it
- Nicholas Wilson (10/22) Jul 21 2017 Great talk! It seems great mids think alike, I will be using this
- Steven Schveighoffer (17/40) Jul 22 2017 Maybe I'm misunderstanding you, but my concern is that something like th...
- Nicholas Wilson (39/85) Jul 22 2017 Its the combining with AliasSeq in conjunction with being normal
- Moritz Maxeiner (5/10) Jul 23 2017 How do you deal with ranges where `.popFront` returns the old
- Steven Schveighoffer (7/18) Jul 24 2017 As I said in the talk, there's not an actual library for this, it's just...
- Nick Sabalausky (Abscissa) (2/8) Jul 24 2017 Very cool.
- John Colvin (4/9) Jul 25 2017 Is there a written summary of the idea? Or is there a specific
- Nicholas Wilson (8/19) Jul 25 2017 Basically using structs to describe layouts (among other
- Steven Schveighoffer (23/42) Jul 25 2017 Not exactly :)
- Andrei Alexandrescu (4/15) Jul 28 2017 What I can definitely say is it's a very interesting technique worth
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
Jul 02 2017
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-35120523431I've moved this to Friday to accommodate more people. -Steve
Jul 02 2017
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-35120523431I'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
Jul 21 2017
On Friday, 21 July 2017 at 21:55:01 UTC, Steven Schveighoffer wrote:On 7/2/17 6:35 AM, Steven Schveighoffer wrote: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.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-35120523431I'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
Jul 21 2017
On 7/21/17 8:49 PM, Nicholas Wilson wrote:On Friday, 21 July 2017 at 21:55:01 UTC, Steven Schveighoffer wrote:Thanks!On 7/2/17 6:35 AM, Steven Schveighoffer wrote:Great talk!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-35120523431I'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=ZxzczSDaobwRegarding 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
Jul 22 2017
On Sunday, 23 July 2017 at 02:15:18 UTC, Steven Schveighoffer wrote:On 7/21/17 8:49 PM, Nicholas Wilson wrote: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; }On Friday, 21 July 2017 at 21:55:01 UTC, Steven Schveighoffer wrote:Thanks!On 7/2/17 6:35 AM, Steven Schveighoffer wrote:Great talk!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-35120523431I'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=ZxzczSDaobwRegarding 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
Jul 22 2017
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)?
Jul 23 2017
On 7/23/17 9:50 AM, Moritz Maxeiner wrote:On Sunday, 23 July 2017 at 02:15:18 UTC, Steven Schveighoffer wrote: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. -Stevestruct 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)?
Jul 24 2017
On 07/21/2017 05:55 PM, Steven Schveighoffer wrote:On 7/2/17 6:35 AM, Steven Schveighoffer wrote:Very cool.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
Jul 24 2017
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 -SteveIs there a written summary of the idea? Or is there a specific point in the video someone could point me to?
Jul 25 2017
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: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.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 -SteveIs there a written summary of the idea? Or is there a specific point in the video someone could point me to?
Jul 25 2017
On 7/25/17 6:15 AM, Nicholas Wilson wrote:On Tuesday, 25 July 2017 at 09:50:46 UTC, John Colvin wrote:Not exactly :) I wrote a database serializer that uses introspecting members, types, and attributes of a struct to correctly populate members of the struct with data from the rows. So yes, I'm using introspection, but only for the serialization, the query is hand-written. In some cases (particularly when you are joining 2 tables that have conflicting columns), I needed to change how the serialization worked (e.g. the column names had to change). In order to do this, I created descriptors that are built from the combination of attributes and other introspected items. Then my thought was I would pass in the descriptors directly in order to control how serialization works. I found it unwieldy and difficult to write the low-level descriptors by hand. But I thought of making a dummy or strawman struct with all the attributes the way I wanted, and still serializing to the real struct. It worked really well. I also go over some other possible ideas for using this concept. Start watching from here: https://youtu.be/ZxzczSDaobw?t=18m24s Andrei suggested doing a blog article (and actually I had started writing one, but it turned into this talk instead). I'll probably still do this. -SteveOn Sunday, 2 July 2017 at 10:35:49 UTC, Steven Schveighoffer wrote: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.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-35120523431Is there a written summary of the idea? Or is there a specific point in the video someone could point me to?
Jul 25 2017
On 7/25/17 5:50 AM, John Colvin wrote:On Sunday, 2 July 2017 at 10:35:49 UTC, Steven Schveighoffer wrote: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. -- AndreiI'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 -SteveIs there a written summary of the idea? Or is there a specific point in the video someone could point me to?
Jul 28 2017