This is a great account of a student fighting for non-left free speech rights as his school. I laughed out loud at some of the interactions he recounts:
On the sign saying "End the Arab Occupation of Jewish Land" she said "what if instead of Arab it said nigger!" I told her that wouldn't make sense because black people aren't occupying Jewish land, and that Arab was not a racial slur.
What's fascinating, reading the thing, is how anti-intellectual, and (dare I say it?) closed-minded the students are. It's amazing to see their inability to think. That the kid remained calm and composed the entire time is very impressive. Kudos to him.
Via The Smallest Minority
I've heard good things about SmartTemplate and I'm thinking of using it for my site. Syntax issues aside, one of the biggest distinctions between different templating systems is that of "push" vs. "pull" templating.
I don't know that anyone has used these terms before, so I'll define them:
- A "push" templating system is one in which you "assign" variables to the template processor and then are able to reference those variables in your template.
- A "pull" templating system is one in which you reference variables in your template and the templating system then figures out how to populate those variables before injecting the data into your template.
SmartTemplate is a classic "push" templating system, as you can see from their "hello world" example. So are all other templating systems I know of, including Smarty (see their crash course). I actually don't know of any templating systems that implement the "pull" style, though I was seriously planning to modify Cheetah to enable this. Unfortunately, I'm no longer planning to switch my web site to Python so that's not going to happen anytime soon.
I was going to write more here and provide examples, but suffice it to say that it seems like using a "pull" templating system can reduce the coupling between your template and your controller because the controller doesn't have to know what variables your template needs. All your system has to provide is a way for the template processor to know what functions you make available to fill data, and maybe what variable names are associated with what data (in other words, what functions can provide that data). This way, instead of populating the template with data "manually" for each template you have, you can, just once, create a table that maps functions to variable names, and then you can use the variables in that table for as many templates as you have. So, it's sort of like an O(1) algorithm vs. an O(n) algorithm.
This can be implemented in two ways:
- On each variable access, a lookup is done to see if that data has been retrieved yet. If it has, use it in the template. If not, cache it and then use it in the template.
- Do some static analysis on the templates and keep track of all variables that are used in each template. Then, on execution, the template processor pre-caches all variables that are used in the templates you're filling.
Option 2 saves a lookup on each variable access, but it's impossible to account for all conditionals and you may wind up caching more data than you actually use for the request. This also limits you on how much flexibility you can allow within the template to control exactly what data you get back since the template processor caches all data prior to template execution (though, arguably you shouldn't be able to have that much control within the template anyway).
So, assuming pull templating can be implemented efficiently, wouldn't this be a better way to do templating? Rather than maintaining the templates along with the code that populates the data for each template, with a pull templating system all you have to maintain is the one lookup table. You basically populate it with functions for all the different data your web site can provide, and then you can use those data at will within your templates.
There's a great article by Greg Colvin over at Artima on the Spirit of C. I'm a little indignant about some of his comments about Java on the third page (it pains me to count Java in C's lineage), but the article as a whole is very enjoyable.
The article is also very well written. Colvin weaves a discussion of typing throughout, and recounts the transition from B's typeless nature, to adding types in C and more in C++, to adding templates (generics) in C++, and continues on to discuss future possibilities for type inference that could bring C++, or another language such as D, back to the feel of typelessness that the C family of languages lost in their transition from B. His discussion of Java didn't have anything much to add to this thread in the article, which was another reason I disliked that part of it. However, the type inference mentioned is currenly a staple of languages in the ML family, and his account of the evolution of these languages makes it feel as if ML-style type inference will inexorably work its way into more mainstream languages over time.
There's also this neat tidbit about C++'s templates:
Although object-orientation was the initial motivation for extending C to C++, the most powerful extension has turned out to be the generic programming facility provided by templates. Templates were introduced to allow for type-safe containers, so that one could define a class like list<T> just once and then use it for any kind of list element. But in 1994 Erwin Unruh brought an innocent-looking little program to Santa Cruz that failed to compile, but caused the compiler to generate a sequence of prime numbers in its diagnostic output. I recall being mystified, then amused, then horrified. By introducing templates we had inadvertently added a Turing- complete meta-language to C++. At that point we could have restricted the template facility to prevent such meta-programming, but instead we took a gamble and embraced it, which cost us no end of pain as the impact of templates rumbled through the language and library.
Bush is officially not conservative. I've known this, of course, but this is one of the most clear illustrations I've seen (besides his signing of the enormous new medicare 'entitlement') of his non-conservatism[1]. This is why I find it so incredulous when people refer to Bush's administration as some kind of "extreme right wing" something or other.
Footnotes:
[1]: dare I say... liberalism
Oh goody, Paul links to this HTML fragment highlighter in Javascript. Now if I decide to implement this I might not have to write my own.
Though, Charles has something to say about the practice of using something like this to highlight search engine results. Charles may have changed my mind on this...
In case you're coming here to see what that spam from keithdevens.com is about, it's not from me. I've been joe jobbed.
new⇒If we had just listened to Cheney
46bdc9e730c5e0fb4d306ab94f7fd41c...
46bdc9e730c5e0fb4d306ab94f7fd41c: Sep 8, 9:44am