Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
core_refinements: core_extensions as ruby 2.0 refinements
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jeremy Evans  
View profile  
 More options Nov 6 2012, 7:08 pm
From: Jeremy Evans <jeremyeva...@gmail.com>
Date: Tue, 6 Nov 2012 16:08:35 -0800 (PST)
Local: Tues, Nov 6 2012 7:08 pm
Subject: core_refinements: core_extensions as ruby 2.0 refinements

Historically, one of the reasons some people have disliked Sequel is that
it modifies the core classes.  Since Sequel 2, I'm fairly sure we've made
fewer modifications than ActiveRecord and DataMapper, and since Sequel 3,
these modifications can be disabled entirely so that Sequel doesn't modify
core classes.  Unfortunately, Sequel is not as user friendly without the
modifications, though recent versions have made usage without the core
extensions easier.

Probably the most significant new feature in ruby 2.0 is the addition of
refinements, which basically allow scoped monkey patching, allowing you to
add methods to core classes in your own code, without affecting the core
classes outside your code.  This is a natural fit for Sequel's
core_extensions, so I've created an extension called core_refinements that
adds refinements for most of the methods added in core_extensions.

The core_refinements extension is available at
http://pastie.org/pastes/5337588/text, and should be placed in
lib/sequel/extensions/core_refinements.rb somewhere in your ruby load path
if you want to use it.  You'll also want to set the
SEQUEL_NO_CORE_EXTENSIONS constant or environment variable before requiring
Sequel so that the core extensions are not loaded.  As refinements are
still an experimental feature in ruby 2.0 preview1, and it is possible they
will be removed entirely before ruby 2.0 final, I have decided not to
commit this extension to the Sequel repository yet.  If the ruby core team
decides to include refinements in ruby 2.0 final, I will be committing this
extension to Sequel.

The ruby core team is looking for feedback on refinements, so if you want
to try out the core_refinements extension on ruby 2.0 and give the ruby
core team some feedback, I'm sure they'd appreciate it
(https://bugs.ruby-lang.org/issues/4085).

Thanks,
Jeremy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Evans  
View profile  
 More options Dec 17 2012, 2:13 pm
From: Jeremy Evans <jeremyeva...@gmail.com>
Date: Mon, 17 Dec 2012 11:13:50 -0800 (PST)
Local: Mon, Dec 17 2012 2:13 pm
Subject: Re: core_refinements: core_extensions as ruby 2.0 refinements

On Tuesday, November 6, 2012 4:08:35 PM UTC-8, Jeremy Evans wrote:

> The core_refinements extension is available at
> http://pastie.org/pastes/5337588/text, and should be placed in
> lib/sequel/extensions/core_refinements.rb somewhere in your ruby load path
> if you want to use it.  You'll also want to set the
> SEQUEL_NO_CORE_EXTENSIONS constant or environment variable before requiring
> Sequel so that the core extensions are not loaded.  As refinements are
> still an experimental feature in ruby 2.0 preview1, and it is possible they
> will be removed entirely before ruby 2.0 final, I have decided not to
> commit this extension to the Sequel repository yet.  If the ruby core team
> decides to include refinements in ruby 2.0 final, I will be committing this
> extension to Sequel.

Here's a diff for the addition of the core_refinements extension, with
specs and updates to the pg_* extensions so that they add appropriate
refinements: http://pastie.org/pastes/5543974/text

This has been tested against ruby 2.0.0-preview2.  After the release of
preview2, refinements have changed and now need to be activated manually.  
For that reason, I've decided not to merge this commit yet.  It'll probably
be merged next month after it has been tested against 2.0.0-rc1.

Thanks,
Jeremy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »