|
Posted by Umberto Salsi on 05/25/05 20:36
"Oli Filth" <catch@olifilth.co.uk> wrote:
> I completely agree. Strong typing makes far more sense due to the
> compile-time constraints it enforces. Anyone who thinks otherwise is
> lazy, quite frankly, and isn't thinking in terms of long-term
> maintainability and debugging. [...]
There may be a third way: meta-code to direct a code checker. Think about
something like this, where the meta-code is given inside comments:
/*.void.*/ function PrintStrings(/*.string.*/ $s, /*.int.*/ $n)
{
/*. int $i; .*/
for($i=1; $i<=$n; $i++){
echo $s;
}
}
The meta-code declare the type of the returned value and the type of
the formal arguments using a syntax symilar to the C language. A source
code checker may use this information to report invalid usages of the
function, exactly as a strong typed language do. This is the direction
I taken developing phplint (www.icosaedro.it/phplint/), a source parser,
semantic and style validator for the PHP language.
Using the meta-code:
- the PHP language do not need to be modified
- the PHP interpreter do not need to be modified
- the meta-code may be added to the source after the prototyping phase,
just to check the source before the final release
Ciao,
___
/_|_\ Umberto Salsi
\/_\/ www.icosaedro.it
[Back to original message]
|