Jonathan makes an excellent point about s and S. In fact, there's
probably a "little language" out there for this.
I don't think it needs to be in the core, though. But you could put in
some kind of "hook" mechanism, so that detecting the presence of \s or
whatever caused the string to be treated specially. Perhaps it gets a
different, possibly more sophisticated, type? A type that is only
in-core in a limited (English-only?) implementation, but which admins
can install at whim.
=Austin
Jonathan Lang wrote:
Larry Wall wrote:
Any other cute ideas?
If you have '\s', you'll also want '\S':
"$n cat\s fight\S" # 1 cat fights; 2 cats fight
I'm not fond of the 'ox\soxen' idea; but I could get behind something
like '\s<ox oxen>' or 'ox\s<en>'.
'\s<a b>' would mean 'a is singular; b is plural'
'\s<a>' would be short for '\s< a>'
'\s' would be short for '\s< s>'
\S<a b>' would reverse this.
Sometimes, you won't want the pluralization variable in the string
itself, or you won't know which one to use. You could use an adverb
for this:
:s<$n>"the cat\s \s<is are> fighting."
and/or find a way to tag a variable in the string:
"$owner's \s=$count cat\s"
'\s=$count' means "set plurality based on $count, and display $count normally."