You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Damon Courtney <da...@tclhome.com> on 2012/09/13 17:36:10 UTC

The construct

Is this documented somewhere?  I poked around the docs a bit (which are hideous, by the way) and couldn't find it mentioned.  In fact, other than our examples, I found only a single mention anywhere that <? ?> was how you actually GET Rivet code into a webpage.

In using the source (Luke), it looks as though the <?= ?> construct is meant to be used as:

<?= $some_variable ?>

and that's about it.  If the parser sees = as the first character of the string, it append 'puts -nonewline' and then the rest of the string.  So, it looks like the = is only good for a single variable or value there since no effort is made to output or close a quote.  In other words:

<?= $foo $bar ?>

is going to blow up without doing:

<?= "$foo $bar" ?>

We either need to decide to upgrade this construct to quote the value, or we really need to document this behavior.  Actually, we need to document the behavior either way, but I think the single value thing could be better.  Although it will make the code a little more complicated.  The current code is quite small and simple, so there's a vote for that.
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: The construct

Posted by Massimo Manghi <ma...@unipr.it>.
The website shows the shorthand construct in the "Hello World" page 
(http://tcl.apache.org/rivet/static/hello_world.html).

Definitely worth a page on its own, maybe in the 'Tcl Commands' 
section.

It will go into the TODO list for 2.0.6

  -- Massimo

On 2012-09-13 17:55, Jeff Lawson wrote:
> Its used in a couple of the examples:
>
> doc/examples/hello1.rvt:<?= "Hello World" ?>
> doc/examples/vars.rvt:          <td><?= $title ?></td>
> doc/examples/vars.rvt:          <td><?= $boss ?></td>
> doc/examples/vars.rvt:          <td><?= $salary ?></td>
> doc/examples/vars.rvt:          <td><?= $skills ?></td>
>
> Also doc/xml/examples.xml describes the "shorthand" in prose.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: The construct

Posted by Jeff Lawson <je...@bovine.net>.
It's used in a couple of the examples:

doc/examples/hello1.rvt:<?= "Hello World" ?>
doc/examples/vars.rvt:          <td><?= $title ?></td>
doc/examples/vars.rvt:          <td><?= $boss ?></td>
doc/examples/vars.rvt:          <td><?= $salary ?></td>
doc/examples/vars.rvt:          <td><?= $skills ?></td>

Also doc/xml/examples.xml describes the "shorthand" in prose.


On Thu, Sep 13, 2012 at 10:36 AM, Damon Courtney <da...@tclhome.com> wrote:

> Is this documented somewhere?  I poked around the docs a bit (which are
> hideous, by the way) and couldn't find it mentioned.  In fact, other than
> our examples, I found only a single mention anywhere that <? ?> was how you
> actually GET Rivet code into a webpage.
>
> In using the source (Luke), it looks as though the <?= ?> construct is
> meant to be used as:
>
> <?= $some_variable ?>
>
> and that's about it.  If the parser sees = as the first character of the
> string, it append 'puts -nonewline' and then the rest of the string.  So,
> it looks like the = is only good for a single variable or value there since
> no effort is made to output or close a quote.  In other words:
>
> <?= $foo $bar ?>
>
> is going to blow up without doing:
>
> <?= "$foo $bar" ?>
>
> We either need to decide to upgrade this construct to quote the value, or
> we really need to document this behavior.  Actually, we need to document
> the behavior either way, but I think the single value thing could be
> better.  Although it will make the code a little more complicated.  The
> current code is quite small and simple, so there's a vote for that.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
> For additional commands, e-mail: rivet-dev-help@tcl.apache.org
>
>

Re: The construct

Posted by Massimo Manghi <ma...@unipr.it>.
On 2012-09-13 17:36, Damon Courtney wrote:
> Is this documented somewhere?  I poked around the docs a bit (which
> are hideous, by the way) and couldn't find it mentioned.  In fact,
> other than our examples, I found only a single mention anywhere that
> <? ?> was how you actually GET Rivet code into a webpage.
>
> In using the source (Luke), it looks as though the <?= ?> construct
> is meant to be used as:
>
> <?= $some_variable ?>
>
> and that's about it.

Yes, it's a shorthand notation for simple output of a single string.

> If the parser sees = as the first character of
> the string, it append 'puts -nonewline' and then the rest of the
> string.  So, it looks like the = is only good for a single variable 
> or
> value there since no effort is made to output or close a quote.  In
> other words:
>
> <?= $foo $bar ?>
>
> is going to blow up without doing:
>
> <?= "$foo $bar" ?>
>
> We either need to decide to upgrade this construct to quote the
> value, or we really need to document this behavior.  Actually, we 
> need
> to document the behavior either way, but I think the single value
> thing could be better.  Although it will make the code a little more
> complicated.  The current code is quite small and simple, so there's 
> a
> vote for that.

I think the construct supporting a single value is cleaner because if 
forces the programmer to delimit explicitly the output. In the implicit 
list form you would have some ambiguity about the spaces preceding, 
separating and trailing the list of variables (we could give it a sense 
anyway, but I don't see the plus)

  -- Massimo




---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org