On May 25, 10:26 pm, Shawn <[email protected]> wrote:
> When the developer has specifically defined the singular and plural
> forms via the Inflections#irregular method, then there is no
> justification for the singularize and pluralize methods to return some
> other inflection attempt that isn't part of the English language
> rather than using the inflections has been taught.  This certainly
> violates the principle of least surprise.
>
> I've given you a code snippet to fix this.  Please include it in
> Sequel.
>
> Thanks,
> Shawn

I don't think you understand. An inflector rule of:

String.inflections do |inflect|
  inflect.irregular 'focus', 'foci'
end

means only two things:

1) If pluralizing 'focus', return 'foci'.
2) If singularizing 'foci', return 'focus'.

Attempting to pluralize a plural word or singularize a singular word
leads to problems in many cases:

$ ruby -I lib bin/sequel
Your database is stored in DB...
irb(main):001:0> Sequel.extension :inflector
=> [:inflector]
irb(main):002:0> 'people'.pluralize
=> "peoples"
irb(main):003:0> 'princess'.singularize
=> "princes"

Accepting a patch that tries to fix the situation for irregular words
will lead people to expect the same behavior of the other inflection
types (POLS), and as you can see, it doesn't work.

Honestly, I'm not sure why you would want such a patch.  If you know
whether a word is plural or singular, your patch is not necessary.  If
you aren't sure whether a word is plural or singular, you shouldn't be
attempting to inflect on it, and if you are attempting to do so, I'd
consider that a bug in your code.

In any case, it's trivial to set up your own irregular inflection
method that does what you want, so if you really want to do so, you
can.  If you do so, please vent elsewhere that singularize does not
work for your regular singular words and pluralize does not work for
your regular plural words.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to