On Apr 9, 3:36 pm, Jeremy Evans <[email protected]> wrote:

>
> I dislike using the bang in such cases as it's not obvious what it
> stands for.  ActiveRecord's save! is used for similar reasons as
> Sequel's raise_on_save_failure flag, so using save! for this new
> functionality is definitely not something I want to do.  Sequel
> actually did support save! when I took over maintenance, I removed it
> in 2.0 I think.
>
> Also, using bang versions to enable this would send the wrong message,
> as the bang implies additional danger.  Personally, I think that
> silently ignoring errors is more dangerous than raising them, so if I
> added the bang version, it would be for the current behavior, with the
> nonbang version raising the error.
>
> The Sequel approach to this is to have class and instance flags that
> affect the behavior of the object:
>
> A.strict_modification = false # class default
> a.strict_modification = true # instance override
> a.save

Two comments:

1. Rails ActiveRecord is used by an awful lot of people.  I would
caution against introducing things into Sequel that look like AR
idioms but have completely different effects to avoid the resulting
confusion and errors that would plague people transitioning from AR to
Sequel.  Sequel#save! == AR#save is not a good idea in my opinion.

2. Setting flags to change method behaviour strikes me as, well, anti-
pattern to the object paradigm. Better I think would be methods named
something like '#save_and_continue' and '#save_or_fail' which disables
or enables #strict_modification for that specific call.

FWIW

-- 
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