thank you for your reply,

i'll change to c# as soon as i've finished my current projects.

regards,
ilker

"J Smith" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I seem to remember strong typing being brought up before, and I also seem
to
> remember it being shot down.
>
> The consensus seemed to be if you want a strongly-typed language, use
Java.
> Or C. Or C++. Or something other than PHP that has strong data typing.
>
> Have things changed since then?
>
> J
>
>
> Ilker Cetinkaya wrote:
>
> > i'd like to discuss with you a growing problem regarding php
applications.
> >
> > i see the features taken into account for ze2 have been made regarding
the
> > needs of advanced php developers who design complete applications with
php
> > instead of just dumping out some dynamic content.
> >
> > php is ease of use because you don't have to care about important
language
> > needs like types.
> > that makes following code possible
> >
> > $a = "hello u ";
> > $b = 2;
> > echo $a.$b;
> >
> > imho that is a good feature for coding simple things fast "from brain to
> > keys".
> > however in a more complicated and larger context, as in frameworks and
> > libraries for example,
> > this leads the coder to produce more code to get the things bugfree.
> >
> > consider a function inserting a row into a table with id and name:
> >
> > function ins($id, $name) {
> >     if (is_numeric($id) && is_string($name)) {
> >         // do insert
> >         return true;
> >     }
> >     return false;
> > }
> >
> > through loose typing a value of $id = "1 " (note whitespace) is possible
> > and insert would fail.
> > no problem, extending condition to is_numeric(trim($id)) does it.
> > anyways, a value of $name=444 causes failing this condition too,
although
> > it should be dyncasted into a string.
> >
> > instead consider this:
> >
> > bool function ins(int $id, string name) {
> >     //do insert
> >     return true;
> > }
> >
> > and everything is right.
> >
> > what i want to point out is the loose vs. strong type issue - certainly
> > discussed prior this post.
> >
> > i'd like to propose the introduction of an explicit command for ze2 to
> > resolve this issue.
> > as known of vb for example, explicit forces coder to explicitly declare
> > variables.
> > this would require to be "explicit" as a language directive or option.
> >
> > example:
> >
> > #!php --explicit (or something similar, perhaps a php.ini entry)
> >
> > mixed $mixed = "hello";
> > string $str = "string";
> > int $num = 5;
> > bool $ok = false;
> > array $ar;
> > float $rate;
> >
> > bool function ins(int $id, string $name);
> >
> > class test {
> >     private bool $done; //private
> >     var string $name; //public;
> >     private object $o;
> >
> >     string print() {
> >         return $name;
> >     }
> > }
> >
> > object $o = new test();
> > echo $o->print();
> >
> >
> > i don't have any clue about implications regarding parsing and handling
> > such explicit behaviour,
> > especially considering type juggling, but juggling could be disabled
when
> > explicit is turned on.
> >
> > is there a chance to realize this ? and moreover, is this a desired,
> > planned feature ?
> > i'd welcome this....
> >
> > just my 2c;
> >
> > ilker
>



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to