On Friday, 23 May 2014 at 19:59:23 UTC, Mattcoder wrote:
Hehe, I'm just imagining what Walter will say: "Lack of images"!
Heh, I actually went through a few idea stages here:
1) I'd list the druntime functions. I determined this to be
boring and subject to change anyway. But I spent like a month
without better ideas and it was too boring for me to even do...
so yeah nothing got done.
2) I'd write a little bare metal program to use as the slide show
that demonstrates various language features and highlights their
source code with animations and responses to timers and keyboard
input. The "slides" would then be the source to that program.
Probably would have been cool, but I never found the time to
actually write it. (I wrote the foundation for it, the timer
interrupt handler, the text video output, the bulk of D
working... but the program itself just kept being put off in
favor of other things)
3) Then, a big breakthrough happened: I had that day with the
friends walking on that bridge guard rail. (BTW it wasn't
actually 50 miles high, but it is no exaggeration that I was
terrified for the guy who walked all the way across it. One other
person there walked across part, but she had the good sense to
get back on the regular road once we got over the water. But the
one guy is a madman, a madman!)
That got me thinking about cost/benefit with experimentation and
I realized that story made a good contrast with the test.d files
I make so often and the talk plan changed.
At this point, my plan was to get a handful of photographs to
illustrate each concept... but again, things just kept coming up.
Last week, I decided to stop stressing over it and just accept
that I was going to be unprepared. (Which actually worked out
well enough for me in church last month when I got a literally
last minute request to substitute teach there and it went ok for
everybody but my armpits lol. But if I can fill an hour
improvising a reasonably productive discussion on faith and
prophets, surely I can do it about D.)
Anyway, by moving the goalposts from "nice visual presentation"
to "I'll improvise it live!", I went from worrying about being
unprepared to being content with just knowing the big idea and
let my mind go back to other things.
That said, I didn't want to improvise *everything* because I had
an experience back in the 5th grade that taught me otherwise. The
science teacher gave me a chance to do a planetarium
presentation. I knew how to work the projection machine and knew
a little bit of material, but I didn't actually have even a
lesson outline prepared and I leaned HEAVILY on the teacher to
bail me out.
However, before I knew it, it was already May 22, I was in
California, and firewalled out of my desktop computer. So I did
the next best thing: got out my notebook and pen and scribbled
down a page of topics to touch.
I expected to have to open the floor to questions after like 20
minutes and spend the rest of the time just talking with people,
but to my surprise, it filled the whole hour. (Actually, that
shouldn't be so surprising, just Monday night I spent an hour
talking with a couple friends about half a page of notes. But
that's a totally different audience and a totally different set
of topics so I wasn't sure it would pad out the same way.)
Regardless, it was pretty ok, if a bit wandering at times. Could
have been a lot worse.
BTW re the last "cool stuff" header note, here's the code I
slapped together to demo that idea:
import std.stdio;
align(1)
struct foo {
//align(16):
ubyte c;
ushort d;
uint b;
ushort a;
}
pragma(msg, diagram!foo);
string diagram(T)() {
import std.string, std.conv;
string ret;
T t;
int offset = 0;
foreach(idx, item; t.tupleof) {
int off = t.tupleof[idx].offsetof;
int size = t.tupleof[idx].sizeof;
if(off > offset) {
// padding
foreach(i; 0 .. off-offset)
ret ~= format(" internal padding\n");
offset += off-offset;
}
foreach(i; 0 .. size)
ret ~= format(" %s\n", t.tupleof[idx].stringof[2..$]);
offset += size;
}
foreach(i; 0 .. T.sizeof-offset)
ret ~= format(" struct padding to %d\n", T.sizeof);
return ret;
}
Of course, I ultimately used my fingers as bytes but here you can
play with it a bit more and see different combinations as to
struct layout so have some fun with it!