As I said. The assumption that '<?php echo $var ?>' is more readable than
'<?php= $var ?>' is not universally supported. I'm not alone in finding the
latter easier to read.
To answer your aside, I spend alot of time writing code followed by reading
and maintaining that code.
I prefer the '<?php' opening tag to '<?' or '<%', but I find '{opentag}= '
more readable than '{opentag} echo ', which means I have to either make my
code harder for me to read, or I have to use tag styles which are not
portable, and/or cause other issues.
- Theo
-----Original Message-----
From: Lukas Smith [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 12:38 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DEV] <?= and <%= both work, why not <?php=
> If, as you imply, '<?=' and '<%=' are such a horrible "disease" that
their
> very existance is proof that '<?php=' would be a syntactic travesty.
Why
> were they allowed in the first place? If they were implemented "due
to
> popular demand", why is popular demand not sufficient for '<?php='?
I think the argument was that <?php was ment to be the standard (and
therefore clean way)
while <? And <% is for the short hand freaks :-)
Remember that one of the huge advantages of php is code readability. If
you want short hand you can either use stuff like <% or move over to
perl.
As an aside: what do you do most? Write or read/maintain code? Then
think again about short hand stuff.
So Rasmus's argument seems quite sound in my eyes.
Best regards,
Lukas Smith
[EMAIL PROTECTED]
_______________________________
DybNet Internet Solutions GbR
Reuchlinstr. 10-11
Geb�ude 4 1.OG Raum 6 (4.1.6)
10553 Berlin
Germany
Tel. : +49 30 83 22 50 00
Fax : +49 30 83 22 50 07
www.dybnet.de [EMAIL PROTECTED]
_______________________________
> -----Original Message-----
> From: Brinkman, Theodore
[mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 26, 2002 6:37 PM
> To: 'PHP Developers Mailing List'
> Subject: RE: [PHP-DEV] <?= and <%= both work, why not <?php=
>
> Ok. #1 is the first logical, technical reason I've seen against the
> shorthand being fully implemented (though it begs the question why it
was
> partially implemented in the first place).
>
> I'm not to knowledgeable about SGML specifics (and I can't afford to
spend
> $200+ for a copy of the spec so I can spend a few weeks learning it
just
> for
> this), so I can't go into that, but extending this to XML is a falacy,
> because PHP comparison syntax breaks the XML spec. I'm pretty sure
that
> <%
> echo $var %> (valid PHP) would cause most XML parsers to choke.
>
> As for #2 there's no flaw with the logic until you assume that '<?php
echo
> '
> is somehow inherently more readable than '<?php= '. That's a matter
of
> opinion either way.
>
> By the time you get to #3, however, you've resorted to dreaming up new
> unrequested language extensions, and references to 'magic' to support
your
> argument. I, and others, would argue that '<?php=' is no more 'magic'
> than
> '<?php echo'. We know what it means.
>
>
> If you really do want some equivalent to your proposed '<?php~
$foo:$bar
> ?>', then I might suggest '<?php= isset($foo)?$foo:$bar ?>', which I
> believe
> would already work as '<?php echo isset($foo)?$foo:$bar ?>', '<?=
> isset($foo)?$foo:$bar ?>'.
>
> - Theo
>
> -----Original Message-----
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 26, 2002 10:42 AM
> To: Sam Liddicott
> Cc: Brinkman, Theodore; 'PHP Developers Mailing List'
> Subject: RE: [PHP-DEV] <?= and <%= both work, why not <?php=
>
>
> Guys, this argument has been killed many times. Please stop. The
reasons
> it won't change:
>
> 1. <?php is the SGML-compliant PI tag-style that is supposed to play
> nice with other technologies. <?php= would completely break that
as
> the SGML spec (and the XML spec) says to use <?php<whitespace> so
it
> would have to be <?php =$foo?> which is even uglier and would cause
a
> bit of trouble at the parser level.
>
> 2. The only reason for using <?php =$foo?> is to save a few
keystrokes.
> We have short_tags and asp_tags for example that reason. These are
> the non-compliant tag style that people have been taught are ok for
> local code, but shouldn't be used for distributed code. Therefore
> if you really do want to save keystrokes, which I am all for, use
> <?=$foo?> or <%=$foo%> and you are happy. If you ever need to
> distribute your code, write a 30-second sed script that changes
these
> to <?php echo $foo?> for you. That way local hacks/shortcuts stay
> local, but the distributed code is proper and readable and people
> won't be wondering what the heck this = thing is.
>
> 3. The whole concept of =$var sucks. Magic tokens with no visible
meaning
> is against the spirit of PHP. Yes, it has snuck in due to popular
> demand, but I see no reason to help the disease spread any further
and
> give people precedence for then wanting stuff like ~$foo:$bar which
> might echo $foo if it is non-empty, $bar otherwise. A useful
operation
> to be sure, but we don't want a language that looks like
> <?php~SID:"new user"?> blah blah <?php=$user_name?>
> It goes back to the old concept of keeping things readable.
Figuring
> out what = and ~ do in this particular context is difficult. You
can't
> just look them up in the index of a PHP book because first of all
they
> are single-character common tokens, but worse, they are modal
tokens.
>
> -Rasmus
>
> On Fri, 26 Apr 2002, Sam Liddicott wrote:
>
> >
> >
> > > -----Original Message-----
> > > From: Brinkman, Theodore
> > > [mailto:[EMAIL PROTECTED]]
> > > Sent: 26 April 2002 14:55
> > > To: 'PHP Developers Mailing List'
> > > Subject: RE: [PHP-DEV] <?= and <%= both work, why not <?php=
> > >
> > >
> > > Sure, and its only an extra 4 character, really. But that's
> > > not the issue
> > > at hand. The issue at hand is that the inconsistency of
> > > supporting <?= and
> > > <%= but not <?php= encourages quite a few people to use the
> > > 'optional' short
> > > form tags, meaning that their code isn't portable.
> >
> > I guy here who till recently poo-poo'd asp tags is now using them
> because
> > <%=$VAR;%> is emminently more readable than the alternative.
> >
> > > For each person who says <?php= $variable ?> is hard to read
> > > at least one
> > > other person says they find <?php echo $variable ?> harder to
read. I
> > > personally find the first easier to read when it is embedded
> > > in the middle
> > > of a long line of HTML (like an input tag for example).
> >
> > Yep.
> >
> > > What possible harm comes from improving the internal
> > > consistency of the
> > > language? Why is a two-line patch that would completely remove an
> > > inconsistency so bitterly fought against?
> >
> > To emphasise; people here are adopting bad-old short tags in order
to
> keep
> > readability of code. It makes it easy to see the code is passive,
> echoing
> > only.
> >
> > Sam
> >
> >
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php