Re: [PHP] Assignment operator proposal

2002-03-21 Thread Bogdan Stancescu

Egon Schmid wrote:

From: Enrico Weigelt [EMAIL PROTECTED]


Please note, there are many German PHP developers. Most of them are
not so stupid ...

I must say I fail to understand both the meaning and the reason for the 
harsness in your reply.

Bogdan




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Assignment operator proposal

2002-03-21 Thread Bogdan Stancescu

[EMAIL PROTECTED] wrote:

 I think this is a nice idea for php8 (or some release, I´ll never have 
 to use)
 The main thing in using php is that it is close to c.
 As there are so many new functions, some of them are not really 
 necessary,
 I would not prefer shortcuts like these. Who should help these guys, 
 which
 use these kind of abbrevations. We will get code like these real 
 C-freaks make
 when they get mad in optimizing.
 Its always a walk on a sharp edge, optimizimg and readability.
 For compatibility reasons, I would not like this kind of stuff. 

I don't agree with this. I find this kind of operator a specific 
necessity of PHP. In C you generally know when you have a variable 
assigned and when you don't. In PHP you have lots of situations where 
you have to test whether something has been set or not due to the nature 
of the environment (you don't know what happened in the previous page - 
in C you do know what a window does). That's because, as we all know too 
well, we operate PHP in a stateless environments - therefore you always 
have to check for stuff.


 and also, where can you write your comments
 old style
 if($whatever) // this option must be true
 {
 do something; // this operation does something
 } // end of whatever

 new style
 $whatever^=something // this option must be true an then it does 
 something

 (guaranteed to be more then 80 chars, have fun when reading this command
 under production pressure at 0:30 at the box using ed)
 oops I just wanted to add a comment, I find myself writing a book ;-) 

I merely proposed an assignment operator, not a new type of block. The 
funny thing is that you'd gain horizontal space instead of losing it:
if (!$whatever)
{
  $whatever=something; // defaulting to something
}

You just wasted a TAB for indentation - whatever the tab size is. Just 
to remind you, if you want to be formatting correct, the recommended TAB 
size is 8 chars. Whereas

$whatever^=something; // defaulting to something

wastes only one character (the caret).

What I have to agree with is that it's not standard. That is correct - 
but I would find this operator useful and I'd be willing to sacrifice a 
bit of standardness in favor of writing less.

Bogdan




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Assignment operator proposal

2002-03-21 Thread Rasmus Lerdorf

 Please note, there are many German PHP developers. Most of them are
 not so stupid ...

Oh, I don't know about that.  I have met a bunch of them...  ;)

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Assignment operator proposal

2002-03-20 Thread Bogdan Stancescu

Hi all!

I'd like to hear from a single one of you who isn't tired of code similar to

?
  if (!$whatever) {
$whatever=something;
  }
?

or else

?
  if ($whatever)
  {
$somethingelse=$whatever;
  }
?

How about a new asignment operator which would shut up all those Python 
enthusiasts - let's say the new operator would be caret - and we could 
replace the first example with

?
  $whatever^=something;
?

and the second example with

?
  $somethingelse=^$whatever;
?

What's more, we could also have

?
  $yetanother^=^$anything;
?

which would assign $anything to $yetanother if and only if both are note 
null.

What do you think?

Bogdan Stancescu



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Assignment operator proposal

2002-03-20 Thread Enrico Weigelt

On Thu, Mar 21, 2002 at 12:36:26AM +0200, Bogdan Stancescu wrote:

 Hi all!
 
 I'd like to hear from a single one of you who isn't tired of code similar to
 
i'm solving this with some little knowledge of shortcuts evaluation ...

 ?
  if (!$whatever) {
$whatever=something;
  }
 ?

(($whatever) || ($whatever = something));

 or else
 
 ?
  if ($whatever)
  {
$somethingelse=$whatever;
  }
 ?
(($whatever)  ($somethingelse=$whatever));

 How about a new asignment operator which would shut up all those Python 
 enthusiasts - let's say the new operator would be caret - and we could 
 replace the first example with
sounds interesting.

IMHO you have to rewrite some stuff in the php language parser
so it detects these expressions and generates an if-else-tree ...

~-n
--
 Enrico Weigelt==   meTUX IT services 
 software development, IT service, internet security solutions
 www: http://www.metux.de/phone: +49 36207 519931
 email:   [EMAIL PROTECTED]cellphone: +49 174 7066481

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Assignment operator proposal

2002-03-20 Thread Kevin Stone

There seems to be a parse error in your code.  The words Python and
enthusiast can not exist together in the same substr.  This will
result in the LMAO error you've been receiving.  :)
-Kevin

-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 20, 2002 3:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Assignment operator proposal

Hi all!

I'd like to hear from a single one of you who isn't tired of code
similar to

?
  if (!$whatever) {
$whatever=something;
  }
?

or else

?
  if ($whatever)
  {
$somethingelse=$whatever;
  }
?

How about a new asignment operator which would shut up all those Python 
enthusiasts - let's say the new operator would be caret - and we could 
replace the first example with

?
  $whatever^=something;
?

and the second example with

?
  $somethingelse=^$whatever;
?

What's more, we could also have

?
  $yetanother^=^$anything;
?

which would assign $anything to $yetanother if and only if both are note

null.

What do you think?

Bogdan Stancescu



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Assignment operator proposal

2002-03-20 Thread heinisch

At 21.03.2002  00:36, you wrote:
Hi all!

I'd like to hear from a single one of you who isn't tired of code similar to

?
  if (!$whatever) {
$whatever=something;
  }
?

or else

?
  if ($whatever)
  {
$somethingelse=$whatever;
  }
?

How about a new asignment operator which would shut up all those Python 
enthusiasts - let's say the new operator would be caret - and we could 
replace the first example with

?
  $whatever^=something;
?
snip
I think this is a nice idea for php8 (or some release, I´ll never have to use)
The main thing in using php is that it is close to c.
As there are so many new functions, some of them are not really necessary,
I would not prefer shortcuts like these. Who should help these guys, which
use these kind of abbrevations. We will get code like these real C-freaks 
make
when they get mad in optimizing.
Its always a walk on a sharp edge, optimizimg and readability.
For compatibility reasons, I would not like this kind of stuff.
and also, where can you write your comments
old style
if($whatever) // this option must be true
{
 do something; // this operation does something
} // end of whatever

new style
$whatever^=something // this option must be true an then it does something

(guaranteed to be more then 80 chars, have fun when reading this command
under production pressure at 0:30 at the box using ed)
oops I just wanted to add a comment, I find myself writing a book ;-)
Oliver


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Assignment operator proposal

2002-03-20 Thread Egon Schmid

From: Enrico Weigelt [EMAIL PROTECTED]

 On Thu, Mar 21, 2002 at 12:36:26AM +0200, Bogdan Stancescu wrote:

  Hi all!
 
  I'd like to hear from a single one of you who isn't tired of
code similar to

 i'm solving this with some little knowledge of shortcuts
evaluation ...

  ?
   if (!$whatever) {
 $whatever=something;
   }
  ?

 (($whatever) || ($whatever = something));

  or else
 
  ?
   if ($whatever)
   {
 $somethingelse=$whatever;
   }
  ?
 (($whatever)  ($somethingelse=$whatever));

  How about a new asignment operator which would shut up all those
Python
  enthusiasts - let's say the new operator would be caret - and we
could
  replace the first example with
 sounds interesting.

 IMHO you have to rewrite some stuff in the php language parser
 so it detects these expressions and generates an if-else-tree ...

Please note, there are many German PHP developers. Most of them are
not so stupid ...

-Egon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php