Last night I got a message entitled: yum: 1 Updates Available.
Of course, that's probably just a Python programmer giving up on doing
the right thing, but we see this sort of bletcherousness all the time.
After a recent exchange on PerlMonks about join, I've been thinking
about the problem of
On 26/01/2008, Larry Wall [EMAIL PROTECTED] wrote:
After a recent exchange on PerlMonks about join, I've been thinking
about the problem of pluralization in interpolated strings, where we
get things like:
say Received $m message{ 1==$m ?? '' !! 's' }.
...
Any other cute ideas?
No
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 '\sox oxen' or 'ox\sen'.
'\sa b' would mean 'a is singular; b is plural'
'\sa' would be
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
Jonathan Lang schreef:
I'm not fond of the 'ox\soxen' idea; but I could get behind something
like '\sox oxen' or 'ox\sen'.
$n ox\s en
$n\sone multiple no cat\s s fight\s s s
;)
--
Affijn, Ruud
Gewoon is een tijger.
Amir E. Aharoni wrote:
On 26/01/2008, Larry Wall [EMAIL PROTECTED] wrote:
After a recent exchange on PerlMonks about join, I've been thinking
about the problem of pluralization in interpolated strings, where we
get things like:
say Received $m message{ 1==$m ?? '' !! 's' }.
...
Any
To me this sounds like
use Lingua::EN::Pluralize::DSL;
which would overload your grammar locally to parse strings this way.
However, due to i18n reasons this should not be in the core.
It might make sense to ship a slightly modernized Locale::MakeText
with Perl 6 so that it can be used
On Saturday 26 January 2008 08:58:43 Larry Wall wrote:
That would cover most of the cases for English speakers using regular
nouns, but I wonder whether there's some kind of generalization that
would help for cases like:
say There was/were $o ox/oxen
That makes me wish for a
At 8:58 AM -0800 1/26/08, Larry Wall wrote:
My first thought is that this is such a common idiom that we ought
to have some syntactic sugar for it:
say Received $m message\s.
I don't think that a feature like this should be in the core
language; it is too complicated as well as an
On Sat, Jan 26, 2008 at 08:58:43AM -0800, Larry Wall wrote:
After a recent exchange on PerlMonks about join, I've been thinking
about the problem of pluralization in interpolated strings, where we
get things like:
say Received $m message{ 1==$m ?? '' !! 's' }.
My first thought is that
On 2008-01-26 Larry Wall [EMAIL PROTECTED] wrote:
Last night I got a message entitled: yum: 1 Updates Available.
[snip a lot]
I think that probably handles most of the Indo-European cases, and
anything more complicated can revert to explicit code. (Or go though
a localization dictionary...)
Its only English centric if the idea is fixed to plurals, because its
only for plurals where English words are mutated by grammar rules.
In other languages, words are mutated by other factors, such as the
gender of the word, the case, and the number.
The problem can be quite difficult, say
Gianni Ceccarelli wrote:
Please don't put this in the language. The problem is harder than it
seems (there are European languages that pluralize differently on $X %
10, IIRC; 0 is singular or plural depending on the language, etc etc).
-snip-
I know Perl is not minimal, but sometimes I feel
On Sat, Jan 26, 2008 at 08:58:43AM -0800, Larry Wall wrote:
Last night I got a message entitled: yum: 1 Updates Available.
Of course, that's probably just a Python programmer giving up on doing
the right thing, but we see this sort of bletcherousness all the time.
Any other cute ideas?
Yuval Kogman wrote:
You can subclass the grammar and change everything.
Theoretically that's a yes =)
Right. One last question: is this (i.e., extending a string's
grammar) a keep simple things simple thing, or a keep difficult
things doable thing?
--
Jonathan Dataweaver Lang
On Sat, Jan 26, 2008 at 18:43:50 -0800, Jonathan Lang wrote:
Right. One last question: is this (i.e., extending a string's
grammar) a keep simple things simple thing, or a keep difficult
things doable thing?
I'm going to guess somewhere in between.
It should be about the same level of
On Sat, Jan 26, 2008 at 18:12:17 -0800, Jonathan Lang wrote:
This _does_ appear to be something more suitable for a Locale::
module. I just wonder if there are enough hooks in the core to allow
for an appropriately brief syntax to be introduced in a module: can
one roll one's own string
17 matches
Mail list logo