foreach ... else statement

Bill Baxter wbaxter at gmail.com
Wed Jan 7 17:40:31 PST 2009


On Thu, Jan 8, 2009 at 10:28 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Walter Bright wrote:
>>
>> Bill Baxter wrote:
>>>
>>> On Thu, Jan 8, 2009 at 6:46 AM, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>>
>>>> Bill Baxter wrote:
>>>>>
>>>>> On Thu, Jan 8, 2009 at 5:54 AM, Walter Bright
>>>>> <newshound1 at digitalmars.com> wrote:
>>>>>>
>>>>>> Sean Kelly wrote:
>>>>>>>>
>>>>>>>> I keep thinking I should put on a "Compiler Construction" seminar!
>>>>>>>
>>>>>>> You should.  The academic courses do a good job with theory and
>>>>>>> general application, but that isn't quite the same as one based on
>>>>>>> practical experience.
>>>>>>
>>>>>> That's true. I learned the theory taking a compiler construction
>>>>>> course
>>>>>> at
>>>>>> Standford, and then tried to apply it. It turns out that there's a lot
>>>>>> they
>>>>>> left out <g> that's needed to actually get those optimizations to
>>>>>> work.
>>>>>>
>>>>>> Loop induction variables was a big one, because the theory never takes
>>>>>> into
>>>>>> account the fact that you're replacing a signed loop index with an
>>>>>> unsigned
>>>>>> loop pointer. Oops!
>>>>>>
>>>>>> It's like in physics class you're always dealing with frictionless
>>>>>> brakes
>>>>>> and pointless masses.
>>>>>
>>>>> You mean massless points?  Or was that deliberate?
>>>>
>>>> I think there were two jokes actually: frictionless brakes (used instead
>>>> of
>>>> e.g. frictionless pulleys) which is an oxymoron, and a pun on point
>>>> masses
>>>> (objects that can be approximated by a point).
>>>
>>> Hmmm.  Oh yeh.  I'm gonna claim lack of my first morning cup o coffee
>>> as my excuse for missing that.
>>> Cute.
>>
>> School physics problems always start out with "assume there is no
>> friction, and the point has no mass."
>>
>> Academic papers on compiler optimizations always start out with "assume
>> there are no pointers, no references, no arrays, no exceptions, no threads,
>> no aliasing, no overflows, no signed/unsigned, there are infinite registers
>> available, registers are orthogonal, etc." Or they just go ahead and let you
>> discover that they assumed that.
>
> Well that should be taken with the traditional grain of salt.

In my experience just about any academic paper has to be digest with a
large grain of salt.
Most of the ones I have become intimately familiar with have big
limitations not mentioned by the authors that only become apparent
once you start trying to repeat what they did.  But maybe graphics
papers are particularly susceptible to this phenomenon.   A typical
graphics paper shows three or four nice results, and says "see look!
it works!", but unfortunately that's no proof of general
effectiveness.  It just proves it works for those 3-4 images.

--bb



More information about the Digitalmars-d mailing list