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-29 5:24

I could write a parser in HASKAL

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