Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

String interpolation

Name: Anonymous 2015-04-28 23:25

What does /prog/ think of it?

I believe
print "My name is #[name], I am #[age] and my age in months is #[age / 12]. Today is #[time()]"
reads much better than
print "My name is %s, I am %d and my age in months is %f. Today is %s", name, age, age / 12, time()

The only serious drawbacks are the gaping anus this would open in your programs (#[] being syntax sugar for eval) and not being able to specify the formatting like printf already does. The latter is very useful to print integer and floating-point numbers up to some decimal precision with automatic zero/space padding, which we all know is really useful for tabulating results.

I've heard Ruby already does something like this. Too bad Ruby is shit.

Name: Anonymous 2015-04-28 23:29

not being able to specify the formatting like printf
"I am #[age / 12:.02f] months old"
"I am #[age / 12].02f months old"

Name: Anonymous 2015-04-28 23:46

>>2
"I am #[age / 12|.02f] months old"

Name: Anonymous 2015-04-29 3:50

You could implement this with lisp macros.

Name: Anonymous 2015-04-29 3:54

>>4
`(my name is ,name I am ,age ...) could be simpler

Name: Anonymous 2015-04-29 5:24

I could write a parser in HASKAL

Name: Anonymous 2015-04-29 5:35

>>6
on second thought, that's pretty tough

Name: Anonymous 2015-04-29 14:06

>>3
Disgusting.

Name: Anonymous 2015-04-29 15:19

so use perl;

Name: Anonymous 2015-04-29 23:18

>>9
$ is shit

Name: Anonymous 2015-04-29 23:34

>>10
Elaborate.

Name: Anonymous 2015-04-29 23:44

>>11
Pearl trade shouldn't be done in dollars because the currency is subject to US politics.

Name: Anonymous 2015-04-30 17:39

>>12
I don't want your snotballs anyway!

Name: Anonymous 2015-04-30 17:43

>>12
It's not subject to US politics, it's subject to the Federal Reserve politics. You know, the organization in control of US politics.

At any rate, US dollars are an illegitimate currency, because they aren't supported by anything (printed at sleight of Jewish hand) and the US government is long bankrupt, thus illegitimate.

Name: Anonymous 2015-04-30 22:32

String interpolation
U MENA Templating Engine

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List