Hi Jeremy,
I use the symbol splitting feature a lot, but always in the specific
situation of a query where I need to specify a table name on a column, eg.
`user.id` rather than just `id`.
The shorthand is nice in that case, but I agree it's a bit of an odd
behavior and I can understand how it leads to lots of buggy edge cases.
Would it be practical to add an alternative -- or perhaps this already
works -- of just using strings? eg.
foo.join('users.id' => 'id')
That, or perhaps the symbolized equivalent ( `:"users.id"`) would solve
pretty much every use of symbol splitting for me.
Actually, if symbols are going to be used as a literal identifier going
forward then I assume symbolizing a string with a dot in it would already
work, right?
Cheers,
Andrew
On Thursday, March 16, 2017 at 2:14:03 PM UTC-7, Jeremy Evans wrote:
>
> I recently pushed a commit that adds the first Sequel 5 deprecation
> warnings, which are for using dataset mutation methods. This is one of the
> changes I want to make that is most likely to break existing code
>
> One of the other changes I want to make in Sequel 5 that is likely to
> break existing code is the removal of symbol splitting by default (so that
> Sequel.split_symbols = false is the default). This will mean that all
> symbols are treated as plain identifiers. To extract from the Sequel
> 4.40.0 release notes:
>
> # Sequel.split_symbols = true (current default)
> :column # "column"
> :table__column # "table"."column"
> :column___alias # "column" AS "alias"
> :table__column___alias # "table"."column" AS "alias"
> Sequel.expr{table__column} # "table"."column"
>
> # Sequel.split_symbols = false (proposed default)
> :column # "column"
> :table__column # "table__column"
> :column___alias # "column___alias"
> :table__column___alias # "table__column___alias"
> Sequel.expr{table__column} # "table__column"
>
> Symbol splitting has been the source of many, many bugs in the past.
> Disabling it by default will make it much less likely that users will hit
> such bugs in the future, unless they turn the feature on.
>
> Symbol splitting has existing in Sequel since the first commit that
> imported code. As I am not the original author of Sequel, I do not know
> for sure why it was done, but my guess is that qualification and aliasing
> were very common, and having the information embedded in a symbol was a
> nice terse way of expressing the need, and few people use double/triple
> underscores in their database identifiers.
>
> With recent versions of Sequel (starting in 4.40.0), there are many
> alternative ways to create qualified/aliased identifiers, from the built in
> Sequel[:qualifier][:identifier] to the shorter forms supported by the
> symbol_aref (:qualifier[:identifier]), symbol_as (:identifer.as(:alias)),
> and s (S(:qualifier)[:identifier]) extensions, or just doing ::S = ::Sequel
> and using S[:qualifier][:identifier].
>
> Before deprecating symbol splitting, I'd like to get some feedback from
> the community. If you are in favor or opposed, please post your reasons
> why. Absent any feedback, I will probably disable symbol splitting by
> default.
>
> 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 https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.