Stakeout
Michael McCracken’s Stakeout uses kqueue to monitor source files and re-run the unit tests when they change.
Michael McCracken’s Stakeout uses kqueue to monitor source files and re-run the unit tests when they change.
Spirit is an object oriented recursive descent parser generator framework implemented using template meta-programming techniques. Expression templates allow us to approximate the syntax of Extended Backus Normal Form[1] (EBNF) completely in C++. Parser objects are composed through operator overloading and the result is a backtracking LL(inf) parser that is capable of parsing rather ambiguous grammars.
Nat!:
Because of the NDA requirement, I can’t spell the solution out, but people with access to Tiger will be able to find this hidden feature. Also it’s more fun this way.
When you decide what infrastructure to use for a project, you’re not just making a technical decision. You’re also making a social decision, and this may be the more important of the two.
The Mailsmith 2.1.2 update makes SpamSieve more accurate and makes some minor but very welcome enhancements to the Advanced Query window.
The initial release of PulpFiction, Freshly Squeezed Software’s news reader, wasn’t usable for me, but the new 1.0.1 squashes bugs and is much faster. I’m not sold on the idea that an Apple Mail–like interface is a good thing, and I don’t think I need its spiffy filtering capabilities. (If they could look at the entire article contents, not just the excerpt, that would be interesting.) That said, I like that the display is customizable using CSS and that it offers persistent storage (of excerpts, not full articles, alas) and full text search. It will be interesting to see how it compares with NetNewsWire 2.0.
John Gruber reports that Apple Mail in Tiger stores each POP message in its own file (à la Claris Emailer 1.0), rather than using one mbox file per mailbox. In previous versions of Mail, messages in mbox files were searchable using SearchKit, but in Tiger the messages must be available to Spotlight—and Spotlight uses files as the unit of search. Brent Simmons wonders whether other developers will change how their applications store data, in order to make it available to Spotlight. I think that would be a shame. If Mail does in fact shift to using one file per message, it will no longer be useful to me.
This scripting addition from Late Night Software lets you manipulate AppleScript records like real dictionaries and do set operations on lists.
get user property "myage" in {myAge:42} --> 42 intersection of {1, 2, 3} and {2, 3, 4} -- Result: -- { -- 2, -- 3 -- }
PHP 5 seems to mostly fix the most glaring problem in PHP 4, its non-intuitive handling of references. However, this issue is more complicated than it sounds. For starters, here is one of the unit tests from PHP 5:
<?php class Foo { var $name; function Foo() { $this->name = "I'm Foo!\n"; } } $foo = new Foo; echo $foo->name; $bar = $foo; $bar->name = "I'm Bar!\n"; // In ZE1, we would expect "I'm Foo!" echo $foo->name; ?>
With PHP 4, this prints:
I'm Foo! I'm Foo!
With PHP 5, it prints:
I'm Foo! I'm Bar!
To get this result in PHP 4, you need to use the &
operator:
<?php class Foo { var $name; function Foo() { $this->name = "I'm Foo!\n"; } } $foo = new Foo; echo $foo->name; $bar = &$foo; $bar->name = "I'm Bar!\n"; // In ZE1, we would expect "I'm Foo!" echo $foo->name; ?>
This is because PHP 4 copies objects by default; using &
makes it assign by reference instead of by copy. Copying by default is
pretty annoying if you’re used to other languages, but it does have the
virtue of consistency. Assignment without &
copies for
both scalars and objects; assignment with &
uses
references for both scalars and objects.
I’ve had trouble pinning down exactly how PHP 5 changes this. As far as I can tell, object references are not mentioned in the official PHP 5 ChangeLog. One article I found says this:
In PHP4, references were a subject of confusion, the default behaviour, when passing objects around, being to copy rather than reference the object.
With PHP5 the default behaviour is now to pass objects by reference (using the same approach as Java, in other words). What does this mean to you, the developer? Well, if you didn't understand how references worked in PHP4, you can now pretty much forget the subject completely.
But I find this confusing because the most confusing aspect of PHP 4 references goes unmentioned. In PHP 4, this code:
<?php class Label { var $text; function Label($text) { $this->text = $text; } } $foo = new Label("foo"); $bar =& $foo; $bar = new Label("bar"); print_r($foo); ?>
prints:
label Object ( [text] => bar )
This odd result is explained by the PHP manual thusly:
References in PHP are a means to access the same variable content by different names. They are not like C pointers, they are symbol table aliases. Note that in PHP, variable name and variable content are different, so the same content can have different names. The most close analogy is with Unix filenames and files - variable names are directory entries, while variable contents is the file itself. References can be thought of as hardlinking in Unix filesystem.
As noted, in PHP 4 objects and scalars were treated alike, hence this other example from the PHP manual:
$a = 1; $b =& $a; $b = 2; print "$a $b"; // 2 2
When I first read about PHP 5, I thought that it made &
implicit for objects. In other words, I thought that:
<?php class Label { var $text; function Label($text) { $this->text = $text; } } $foo = new Label("foo"); $bar = $foo; $bar = new Label("bar"); print_r($foo); ?>
would print:
label Object ( [text] => bar )
in PHP 5. I thought this because I kept reading that you don’t have to type &
in PHP 5. However, it now appears that I was wrong. My tests with the just-released PHP 5 show that &
works in the same, arguably broken, “hardlink” kind of way with both PHP 4 and PHP 5. The difference is that in PHP 4, if you don’t use &
, a copy of the object is made. In PHP 5, if you don’t use &
, a Java-style reference is used. Thus, this code:
<?php class Label { var $text; function Label($text) { $this->text = $text; } } $foo = new Label("foo"); $bar = $foo; $bar = new Label("bar"); print_r($foo); ?>
prints:
label Object ( [text] => foo )
in both PHP 4 and PHP 5. And this code:
<?php class Label { var $text; function Label($text) { $this->text = $text; } } $foo = new Label("foo"); $bar =& $foo; $bar = new Label("bar"); print_r($foo); ?>
prints:
label Object ( [text] => bar )
in both PHP 4 and PHP 5.
The bad news is that PHP 5 is in some sense less consistent than before. There are now three different kinds of assignment (copy, hardlink, and reference copy), and scalars and objects are now treated differently. The good news is that, if I understand this correctly, you can banish &
from all your PHP 5 code and then use it like Java.
It seems that I forgot to blog the July issue of ATPM: