Re: Interpreter Mod We Can All Get Behind

new topic     » goto parent     » topic index » view thread      » older message » newer message

CChris wrote:
> 
> Pete Lomax wrote:
> > is "one\ntwo\nthree\n" not "one two three".
> > 
> 
> That's what I expect from a "verbatim string". Exactly what <pre>...</pre>
> does in HTML. I didn't fully understand Gary's point about text substitution,
> very
> likely because I don't speak Perl.

In Perl you can say (carrying on the HTML theme avoiding using tags):

$week = 48;
$author = "Gary Shingles";
$html = <<"EOF";
-HTML-
-HEAD--TITLE-Weekly report for week $week.-/TITLE--/HEAD-
-BODY-
-H1-Weekly report for week $week.-/H1-
-H2-Author: $author-/H2-
EOF
print $html;

And it will do what you expect.  But if you then say that $week = 49; it won't
update $html, it only subsitutes once what is currently defined.  In that sense
using sprintf is better (in Perl I generally search and replace tokens, like
__AUTHOR__, __WEEK__ etc on templates).

My point is though that you could never do this with Euphoria since variable
names are unadorned, that is there is nothing to distinguish that it is a
variable or a word within a string.

I'm also not saying this is a bad thing.  Perl is Perl and Euphoria is Euphoria
smile  Perl has a shell heritage where using something like $app =
"$EUDIR/bin/$appname"; is natural whereas Euphoria stems from the more formal
procedural languages.

So in summary, while I am in support of triple quotes for large strings I can
just see that its use will be limited.

Gary

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu