[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: RubyTraits 0.1

Yukihiro Matsumoto

10/15/2007 5:30:00 PM

Hi,

In message "Re: RubyTraits 0.1"
on Tue, 16 Oct 2007 02:23:30 +0900, Daniel Berger <djberg96@gmail.com> writes:

|BTW, I uploaded some more examples here:
|
|http://rubyforge.org/docman/view.php/735/2472/exa...

How do you think one can choose use and include?
Should :alias be named :rename if it doesn't keep old name?

matz.

6 Answers

Daniel Berger

10/15/2007 6:55:00 PM

0



On Oct 15, 11:29 am, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: RubyTraits 0.1"
> on Tue, 16 Oct 2007 02:23:30 +0900, Daniel Berger <djber...@gmail.com> writes:
>
> |BTW, I uploaded some more examples here:
> |
> |http://rubyforge.org/docman/view.php/735/2472/exa...
>
> How do you think one can choose use and include?

I chose the word "use" because I thought it might be inappropriate to
redefine "include", not because I thought it needed a separate name in
order to distinguish behavior. Note that "use ModA" with no arguments
is the same as "include ModA".

> Should :alias be named :rename if it doesn't keep old name?

Hm, you're probably right about that. :)

Regards,

Dan


Phrogz

10/15/2007 8:14:00 PM

0

On Oct 15, 12:54 pm, Daniel Berger <djber...@gmail.com> wrote:
> On Oct 15, 11:29 am, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
> > How do you think one can choose use and include?
>
> I chose the word "use" because I thought it might be inappropriate to
> redefine "include", not because I thought it needed a separate name in
> order to distinguish behavior. Note that "use ModA" with no arguments
> is the same as "include ModA".

Although this syntax reads well:
include ModA, :exclude => :foo
I think this particular syntax appears odd:
include ModA, :include => :foo
where this is better:
include ModA, :include => :foo

If 'include' were to be preserved in place of 'use', perhaps instead:
include ModA, :exclude => :foo
include ModB, :only => :bar #instead of a 2nd 'include'

Jay Levitt

10/15/2007 9:25:00 PM

0

On Mon, 15 Oct 2007 13:13:40 -0700, Phrogz wrote:

> Although this syntax reads well:
> include ModA, :exclude => :foo
> I think this particular syntax appears odd:
> include ModA, :include => :foo
> where this is better:
> include ModA, :include => :foo

I'm staring and staring and staring, but #2 still looks the same as #3.

If I cross my eyes, they still look the same, but I also see a 3D Ferris
wheel pop out.

--
Jay Levitt |
Boston, MA | My character doesn't like it when they
Faster: jay at jay dot fm | cry or shout or hit.
http://... | - Kristoffer

Phrogz

10/15/2007 9:35:00 PM

0

On Oct 15, 3:24 pm, Jay Levitt <jay+n...@jay.fm> wrote:
> On Mon, 15 Oct 2007 13:13:40 -0700, Phrogz wrote:
> > Although this syntax reads well:
> > include ModA, :exclude => :foo
> > I think this particular syntax appears odd:
> > include ModA, :include => :foo
> > where this is better:
> > include ModA, :include => :foo
>
> I'm staring and staring and staring, but #2 still looks the same as #3.
>
> If I cross my eyes, they still look the same, but I also see a 3D Ferris
> wheel pop out.

Uhm. Yeah. Oops. :)

I had meant to type:
> Although this syntax reads well:
> include ModA, :exclude => :foo
> I think this particular syntax appears odd:
> include ModA, :include => :foo
> where this is better:
> use ModA, :include => :foo
....but apparently got lazy. Sorry 'bout that.

Have fun at the 3D circus. :)

Daniel Berger

10/15/2007 9:53:00 PM

0



On Oct 15, 3:35 pm, Phrogz <phr...@mac.com> wrote:
> On Oct 15, 3:24 pm, Jay Levitt <jay+n...@jay.fm> wrote:
>
> > On Mon, 15 Oct 2007 13:13:40 -0700, Phrogz wrote:
> > > Although this syntax reads well:
> > > include ModA, :exclude => :foo
> > > I think this particular syntax appears odd:
> > > include ModA, :include => :foo
> > > where this is better:
> > > include ModA, :include => :foo
>
> > I'm staring and staring and staring, but #2 still looks the same as #3.
>
> > If I cross my eyes, they still look the same, but I also see a 3D Ferris
> > wheel pop out.
>
> Uhm. Yeah. Oops. :)
>
> I had meant to type:> Although this syntax reads well:
> > include ModA, :exclude => :foo
> > I think this particular syntax appears odd:
> > include ModA, :include => :foo
> > where this is better:
> > use ModA, :include => :foo
>
> ...but apparently got lazy. Sorry 'bout that.

The :include option is the default if no keywords are supplied. So,
you can do this:

use ModA, :foo

If we override 'include', then it's just this:

include ModA, :foo

Regards,

Dan


Robert Dober

10/16/2007 9:38:00 AM

0

On 10/15/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

Matz
this is the link to the paper defining? traits, well it defines traits
pretty much as they
are defined in Squeak (and Scala AFAIK and maybe Fortress, not sure).

http://portal.acm.org/ft_gateway.cfm?id=1028771&type=pdf&coll=GUIDE&dl=GUIDE&CFID=7912496&CFTOKE...

--
what do I think about Ruby?
http://ruby-smalltalk.blo...