On Saturday, August 29, 2015 at 12:56:41 PM UTC-7, Chris Hanks wrote:
>
> Just ran into this, which I wasn't expecting:
>
> > DB[:table].freeze == DB[:table]
> => false
>
> This is because the frozen state is stored in the opts hash, and
> Dataset#== compares the opts hashes. This might seem reasonable, but it
> clashes with Ruby's behavior more generally:
>
> > "string".freeze == "string"
> => true
> > [].freeze == []
> => true
> > {}.freeze == {}
> => true
>
> Not sure if this should be changed or not, and even if everyone agrees it
> should, some people might rely on the old behavior. Maybe something to
> revisit in the next major version?
>
Possibly, or it could be changed to store the frozen state in an instance
variable instead of the opts hash. I think it would be better if ruby's
default frozen flag was used, but I think that would break how datasets
work in regards to Dataset#clone. If someone can think of a way to get
datasets to use ruby's frozen flag without breaking things, I'm all ears.
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.