Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"07-23-12 - Structs are not what you want"

5 Comments -

1 – 5 of 5
Blogger rogojin said...

I like this idea. Feels inspired by Go's interfaces, except this is compile-time and data-oriented (as opposed to function-oriented).

July 24, 2012 at 3:49 PM

Blogger Brian said...

I guess one tricky thing here is that this would play hell with some compiler optimizations. You couldn't optimize the address computations easily. A bigger problem is that reasoning about aliasing relationships would be all messed up.
But it does sound like a nice programming construct. Probably worth paying the performance penalty.

July 25, 2012 at 12:22 AM

Anonymous Anonymous said...

It's a little like ML-style function polymorphism, but different.

Back when I was working on designing a new programming language (which I stopped doing once I figured out how to do C better using stb.h), I had intended to do the duck typing version of this; you could define a function that operated on "x.foo" and "x.bar" even if x could be multiple unrelated types.

Actually, because of the potential performance overhead I had been considering using a different operator from "." to distinguish regular "." (must compile to fast code) and can-be-late-bound "." (which can be slow). It was also possible it could have done template-style instantiation to avoid late-binding.

It also by default would reorder structures for packing, but you could override and force a specific structure layout if needed.

July 25, 2012 at 7:08 AM

Blogger Per Vognsen said...

Prepare to be sick to your stomach. http://www.flipcode.com/archives/Flexible_Vertex_Format_Generator.shtml

July 25, 2012 at 1:45 PM

Comment deleted

This comment has been removed by the author.

July 25, 2012 at 1:45 PM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.