You are here: Re: Will php ever do strong typing? « PHP Programming Language « IT news, forums, messages
Re: Will php ever do strong typing?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация