Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ruby]Add new BlankSlate snippet using BasicObject #3425

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

toshimaru
Copy link

@toshimaru toshimaru commented Jun 5, 2022

Description

Since Ruby 1.9, BasicObject is available to create BlankSlate class.

BasicObject is the parent class of all classes in Ruby. It's an explicit blank class.

BasicObject can be used for creating object hierarchies independent of Ruby's object hierarchy, proxy objects like the Delegator class, or other uses where namespace pollution from Ruby's methods and classes must be avoided.

ref. https://ruby-doc.org/core-1.9.3/BasicObject.html

I re-create BlankSlate snippet and modify tabTrigger in order to distinguish from other Ruby class snippets.

image

Changes

  • Use BasicObject for Ruby BlankSlate since BasicObject is available as of Ruby v1.9
  • Change tabTrigger from cla to clab since we already have some snippets triggered by cla
  • Simplify snippet file name

BlankSlate Example

The following is an example of BlankSlate class with BasicObject

class BlankSlate < BasicObject
end

@deathaxe
Copy link
Collaborator

deathaxe commented Jun 8, 2022

How about just not using that snippet?

Removed things tend to cause someone to complain for whatever reason. Just imagine maintainer of old code bases maybe relying on older ruby builds for some reason, which still might want that snippet.

@jrappen
Copy link
Contributor

jrappen commented Jun 14, 2022

The linked page from above says that extended maintenance for v1.9.3 ended in 2015, so I guess he has a point.

@deathaxe
Copy link
Collaborator

deathaxe commented Jun 14, 2022

I have this Erlang conversation in mind when it comes to supporting legacy stuff. So if we don't remove keywords from a language, which have been deprecated since 2007, why should we remove things, which only date back to 2015?

The point is: There are probably dozens of out dated snippets like that. No one revized snippets for years. Removing one snippet doesn't change things nor does is it "much simpler". It's rather minor or even negligible.

@jrappen
Copy link
Contributor

jrappen commented Jun 14, 2022

Right. I'm saying both your points are valid.

@toshimaru
Copy link
Author

toshimaru commented Jun 17, 2022

@deathaxe thanks for your feedback :)

Removed things tend to cause someone to complain

Yes, that was my concern.

How about just not using that snippet?

I'm willing to do that, but I have another suggestion for this,
what about adding another trigger for that because we already have a lot of snippet for cla.

image

I'd like to assign another trigger for BlankSlate class like Ruby methods (def + any char).

image

How about adding clab for the trigger?
What do you think about my idea?

@jrappen
Copy link
Contributor

jrappen commented Jun 17, 2022

Just in case you didn't know:

@toshimaru
Copy link
Author

That's good to know!

I'm lazy, so it'll be great if nice snippets are available by default rather than customizing. 😸

@deathaxe
Copy link
Collaborator

How about adding clab for the trigger?

Looks like a reasonable change / trigger.

@toshimaru toshimaru force-pushed the remove-ruby-BlankSlate-snippet branch from e9f9ce6 to 6f6fd6d Compare June 20, 2022 00:35
- Use BasicObject for Ruby BlankSlate since `BasicObject` is available as of Ruby v1.9[^1].
- Change tabTrigger from `cla` to `clab` since we already have some snippets triggered by `cla`
- Simplify snippet file name

[^1]: https://ruby-doc.org/core-1.9.3/BasicObject.html
@toshimaru toshimaru force-pushed the remove-ruby-BlankSlate-snippet branch from 6f6fd6d to 65b13ae Compare June 20, 2022 00:43
@toshimaru
Copy link
Author

@deathaxe Hey, I've re-added Ruby BlankSlate snippets. Could you review it ❓

@toshimaru toshimaru changed the title [Ruby]Delete Ruby old-style BlankSlate snippet [Ruby]Add new BlankSlate snippet using BasicObject Jun 23, 2022
@deathaxe
Copy link
Collaborator

I hesitate approving this change because snippet's content is significantly changed. Changing trigger to reduce duplicates might be ok, but I am not sure whether changed content may cause complains.

@toshimaru
Copy link
Author

toshimaru commented Jun 26, 2022

may cause complains.

I don't think so. BasicObject is available as of Ruby v1.9.3 and Ruby 1.9.3 EoL-ed on February 23, 2015.

I know many people are still using Ruby v2.x, but I don't know people still using Ruby v1.9 in 2023.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants