[#86984] Attempted roadmap of future instance variables.... — "David A. Black" <dblack@...>

Hi --

81 messages 2003/12/02
[#86998] Re: Attempted roadmap of future instance variables.... — Steve Tuckner <STUCKNER@...> 2003/12/02

So what is the relationship between @_ vars and @vars that are defined in a

[#87001] Re: Attempted roadmap of future instance variables.... — "David A. Black" <dblack@...> 2003/12/02

Hi --

[#87006] Re: Attempted roadmap of future instance variables.... — Steve Tuckner <STUCKNER@...> 2003/12/02

Maybe I am being dense, so bear with me...

[#87011] Re: Attempted roadmap of future instance variables.... — Lyle Johnson <lyle@...> 2003/12/02

Steve Tuckner wrote:

[#87013] Re: Attempted roadmap of future instance variables.... — Steve Tuckner <STUCKNER@...> 2003/12/02

OK so the jist of it is that @_var variables are stored with the class of

[#87095] Re: Attempted roadmap of future instance variables.... — "Robert Klemme" <bob.news@...> 2003/12/03

[#87098] Re: Attempted roadmap of future instance variables.... — "David A. Black" <dblack@...> 2003/12/03

Hi --

[#87102] Re: Attempted roadmap of future instance variables.... — ts <decoux@...> 2003/12/03

>>>>> "D" == David A Black <dblack@wobblini.net> writes:

[#87244] Re: Attempted roadmap of future instance variables.... — "Christoph" <chr_mail@...> 2003/12/05

ts wrote:

[#87275] Re: Attempted roadmap of future instance variables.... — ts <decoux@...> 2003/12/05

>>>>> "C" == Christoph <chr_mail@gmx.net> writes:

[#87286] Re: Attempted roadmap of future instance variables.... — "Christoph" <chr_mail@...> 2003/12/05

ts wrote:

[#87290] Re: Attempted roadmap of future instance variables.... — "David A. Black" <dblack@...> 2003/12/05

Hi --

[#87308] Re: Attempted roadmap of future instance variables.... — Austin Ziegler <austin@...> 2003/12/05

On Fri, 5 Dec 2003 22:56:41 +0900, David A. Black wrote:

[#87310] Re: Attempted roadmap of future instance variables.... — "Christoph" <chr_mail@...> 2003/12/05

Austin Ziegler wrote:

[#87320] Re: Attempted roadmap of future instance variables.... — Austin Ziegler <austin@...> 2003/12/05

On Sat, 6 Dec 2003 01:40:42 +0900, Christoph wrote:

[#87322] Re: Attempted roadmap of future instance variables.... — "T. Onoma" <transami@...> 2003/12/05

On Friday 05 December 2003 06:41 pm, Austin Ziegler wrote:

[#87314] Re: Attempted roadmap of future instance variables.... — "T. Onoma" <transami@...> 2003/12/05

On Friday 05 December 2003 05:40 pm, Christoph wrote:

[#87318] Re: Attempted roadmap of future instance variables.... — matz@... (Yukihiro Matsumoto) 2003/12/05

Hi,

[#87335] Re: Attempted roadmap of future instance variables.... — Nathaniel Talbott <nathaniel@...> 2003/12/05

On Dec 5, 2003, at 12:15, Yukihiro Matsumoto wrote:

[#87066] What's the best way to create methods dealing with an object of a certain class? — Leif K-Brooks <eurleif@...>

I want to add a method to be run on Strings. Currently, I'm just adding

14 messages 2003/12/03
[#87072] Re: What's the best way to create methods dealing with an object of a certain class? — Lyle Johnson <lyle@...> 2003/12/03

Leif K-Brooks wrote:

[#87083] Some Regexp — orlovdn@... (Dmitry N Orlov)

I want to get array from file like this:

20 messages 2003/12/03

[#87203] sorting — vanjac12@... (Van Jacques)

I'm not sure where to post about this problem, so

18 messages 2003/12/04

[#87233] Generalized break? — Hal Fulton <hal9000@...>

I hate to bring up possible language changes, since there is

14 messages 2003/12/04

[#87255] WeakRef and Object#hash — Samuel Tesla <samuel@...>

I'm trying to implement a weak key hash to use for generic objects.

37 messages 2003/12/05
[#87259] Dumb question to which I ought to know the answer by now — "Mark J. Reed" <markjreed@...> 2003/12/05

Is there an assignment version of Hash#values_at, so I can assign

[#87266] Re: Dumb question to which I ought to know the answer by now — Austin Ziegler <austin@...> 2003/12/05

On Fri, 5 Dec 2003 12:42:05 +0900, Mark J. Reed wrote:

[#87333] Re: Attempted roadmap of future instance variables.... — "Weirich, James" <James.Weirich@...>

From: David A. Black [mailto:dblack@wobblini.net]

18 messages 2003/12/05
[#87337] Re: Attempted roadmap of future instance variables.... — Chris Thomas <chris@...> 2003/12/05

[#87402] Re: Attempted roadmap of future instance variables.... — matz@... (Yukihiro Matsumoto) 2003/12/06

Hi,

[#87382] Idea: Linux PIM in Ruby — Hal Fulton <hal9000@...>

On my wishlist of top 20 things I'd like to do: A PIM for Linux.

30 messages 2003/12/06
[#87407] Re: Idea: Linux PIM in Ruby — Lyle Johnson <lyle@...> 2003/12/06

Hal Fulton wrote:

[#87409] rbbr-0.5.0 — Masao Mutoh <mutoh@...>

Hi,

18 messages 2003/12/06

[#87430] Ideas for replacing $0==__FILE__ — Hal Fulton <hal9000@...>

I've accepted now that my "generalized break" was a bad idea. In

26 messages 2003/12/06
[#87720] Re: Ideas for replacing $0==__FILE__ — Eric Hodel <drbrain@...7.net> 2003/12/10

Hal Fulton (hal9000@hypermetrics.com) wrote:

[#87723] Re: Ideas for replacing $0==__FILE__ — Hal Fulton <hal9000@...> 2003/12/10

Eric Hodel wrote:

[#87726] Re: Ideas for replacing $0==__FILE__ — Eric Hodel <drbrain@...7.net> 2003/12/10

Hal Fulton (hal9000@hypermetrics.com) wrote:

[#87459] Trying to create a Ruby daemon — Samuel Kvarnbrink <samuel.kvarnbrink@...>

Hi,

11 messages 2003/12/07

[#87553] format money — saggmannen@... (saggmannen)

Hello, is there a way to format "Money"-style floats in ruby. E.g:

25 messages 2003/12/08

[#87587] Adjusting the Scope of Blocks — Mark Cox <mark_cox@...>

Hi,

22 messages 2003/12/09
[#87606] Re: Adjusting the Scope of Blocks — "Robert Klemme" <bob.news@...> 2003/12/09

[#87620] Re: Adjusting the Scope of Blocks — "David A. Black" <dblack@...> 2003/12/09

Hi --

[#87626] ANN: REXML 2.7.2 — ser@... (Sean Russell)

Hi,

18 messages 2003/12/09

[#87638] Inheriting variables, super, and "not super"? — Hugh Sasse Staff Elec Eng <hgs@...>

Is there a way in a method to say

11 messages 2003/12/09

[#87706] Docs for Socket, OpenSSL, etc — "James F. Hranicky" <jfh@...>

Are there any plans to add docs for modules like Socket and OpenSSL, etc to

23 messages 2003/12/10
[#87766] Re: Docs for Socket, OpenSSL, etc — Simon Strandgaard <neoneye@...> 2003/12/11

On Wed, 10 Dec 2003 23:20:21 +0900, James F. Hranicky wrote:

[#87769] Re: Docs for Socket, OpenSSL, etc — "James F. Hranicky" <jfh@...> 2003/12/11

On Thu, 11 Dec 2003 20:57:00 +0900

[#87780] Re: Docs for Socket, OpenSSL, etc — Dave Thomas <dave@...> 2003/12/11

[#87781] Re: Docs for Socket, OpenSSL, etc — "James F. Hranicky" <jfh@...> 2003/12/11

On Fri, 12 Dec 2003 00:07:28 +0900

[#87775] prog for g.c.d. of 2 integers — vanjac12@... (Van Jacques)

Topics from mathematics make good practice programs, IMO.

13 messages 2003/12/11

[#87783] problems with racc: $end token — "Luke A. Kanies" <luke@...>

Hello,

14 messages 2003/12/11
[#87789] Re: problems with racc: $end token — Jim Freeze <jim@...> 2003/12/11

On Friday, 12 December 2003 at 0:42:30 +0900, Luke A. Kanies wrote:

[#87819] Ruby-Talk Subject Matters — "T. Onoma" <transami@...>

Out of curiosity, how do others feel about "suggestive" threads? Do you feel

15 messages 2003/12/11

[#87856] Simple issue giving problems — Brad <coish@...>

Hello all,

17 messages 2003/12/11

[#88031] inplace assignment — "T. Onoma" <transami@...>

is there anyway, anyway at all, ugly hacks accepted, of doing inplace

40 messages 2003/12/14
[#88032] Re: inplace assignment — Hal Fulton <hal9000@...> 2003/12/14

T. Onoma wrote:

[#88034] Re: inplace assignment — "T. Onoma" <transami@...> 2003/12/14

On Sunday 14 December 2003 05:51 am, Hal Fulton wrote:

[#88037] Re: inplace assignment — Hal Fulton <hal9000@...> 2003/12/14

T. Onoma wrote:

[#88041] Re: inplace assignment — "T. Onoma" <transami@...> 2003/12/14

On Sunday 14 December 2003 07:49 am, Hal Fulton wrote:

[#88056] Re: inplace assignment — "David A. Black" <dblack@...> 2003/12/14

On Sun, 14 Dec 2003, T. Onoma wrote:

[#88059] Re: inplace assignment — "T. Onoma" <transami@...> 2003/12/14

On Sunday 14 December 2003 03:59 pm, David A. Black wrote:

[#88064] Re: inplace assignment — "David A. Black" <dblack@...> 2003/12/14

On Mon, 15 Dec 2003, T. Onoma wrote:

[#88077] All there is to know about Duck Typing (was: inplace assignment) — "T. Onoma" <transami@...> 2003/12/14

Alright, a number of things related to Duck Tpying have been popping up and I

[#88081] Re: All there is to know about Duck Typing (was: inplace assignment) — "David Naseby" <david.naseby@...> 2003/12/14

> -----Original Message-----

[#88147] extremely strange segfault — "Luke A. Kanies" <luke@...>

Hi all,

14 messages 2003/12/15

[#88150] UnboundMethods Useless? — "T. Onoma" <transami@...>

Urrrr.....

34 messages 2003/12/15
[#88239] Re: UnboundMethods Useless? — Dan Doel <djd15@...> 2003/12/16

You can do stuff like this:

[#88309] Re: UnboundMethods Useless? — "T. Onoma" <transami@...> 2003/12/17

On Tuesday 16 December 2003 08:54 pm, Dan Doel wrote:

[#88322] Re: UnboundMethods Useless? — Chad Fowler <chad@...> 2003/12/17

On Wed, 17 Dec 2003, T. Onoma wrote:

[#88323] Re: UnboundMethods Useless? — ts <decoux@...> 2003/12/17

>>>>> "C" == Chad Fowler <chad@chadfowler.com> writes:

[#88327] Re: UnboundMethods Useless? — "T. Onoma" <transami@...> 2003/12/17

On Wednesday 17 December 2003 01:21 pm, ts wrote:

[#88328] Re: UnboundMethods Useless? — ts <decoux@...> 2003/12/17

>>>>> "T" == T Onoma <transami@runbox.com> writes:

[#88332] Re: UnboundMethods Useless? — "T. Onoma" <transami@...> 2003/12/17

On Wednesday 17 December 2003 01:59 pm, ts wrote:

[#88333] Re: UnboundMethods Useless? — "David A. Black" <dblack@...> 2003/12/17

On Wed, 17 Dec 2003, T. Onoma wrote:

[#88336] Re: UnboundMethods Useless? — Peter <Peter.Vanbroekhoven@...> 2003/12/17

> I don't know what you mean by (ir)reversible, but the point is that

[#88337] Re: UnboundMethods Useless? — ts <decoux@...> 2003/12/17

>>>>> "P" == Peter <Peter.Vanbroekhoven@cs.kuleuven.ac.be> writes:

[#88159] Re: Extracting multiple lines from a file — "Berger, Daniel" <djberge@...>

> -----Original Message-----

18 messages 2003/12/15
[#88161] Re: Extracting multiple lines from a file — "Ron Coutts" <rcoutts@...> 2003/12/15

[#88166] Re: Extracting multiple lines from a file — "Mark J. Reed" <markjreed@...> 2003/12/15

On Tue, Dec 16, 2003 at 07:16:23AM +0900, Ron Coutts wrote:

[#88199] Re: Extracting multiple lines from a file — Derek Lewis <lewisd@...00f.net> 2003/12/16

On Tue, 16 Dec 2003, Mark J. Reed wrote:

[#88172] Copying methods from one class to another — "T. Onoma" <transami@...>

Is there any way to copy a method from one class to another?

22 messages 2003/12/16
[#88174] Re: Copying methods from one class to another — Jamis Buck <jgb3@...> 2003/12/16

T. Onoma wrote:

[#88183] Re: Copying methods from one class to another — "T. Onoma" <transami@...> 2003/12/16

On Tuesday 16 December 2003 05:23 am, Jamis Buck wrote:

[#88189] Re: Copying methods from one class to another — "David A. Black" <dblack@...> 2003/12/16

On Tue, 16 Dec 2003, T. Onoma wrote:

[#88191] Re: Copying methods from one class to another — "T. Onoma" <transami@...> 2003/12/16

On Tuesday 16 December 2003 02:51 pm, David A. Black wrote:

[#88195] Re: Copying methods from one class to another — Hacksaw <hacksaw@...> 2003/12/16

Sorry to step into the middle of a conversation, but what does this mean:

[#88211] Newbie questions — jfrapper@... (Jim Frapper)

I was wondering what the equivalent tools were to perldoc(ri is not)

44 messages 2003/12/16
[#88259] Re: Newbie questions — Chad Fowler <chad@...> 2003/12/16

On Wed, 17 Dec 2003, Jim Frapper wrote:

[#88266] Re: Newbie questions — Gavin Sinclair <gsinclair@...> 2003/12/16

On Wednesday, December 17, 2003, 8:10:19 AM, Chad wrote:

[#88270] Re: Newbie questions — Daniel Carrera <dcarrera@...> 2003/12/16

>

[#88271] Re: Newbie questions — "Luke A. Kanies" <luke@...> 2003/12/16

On Wed, 17 Dec 2003, Daniel Carrera wrote:

[#88272] Re: Newbie questions — Daniel Carrera <dcarrera@...> 2003/12/16

On Wed, Dec 17, 2003 at 07:07:45AM +0900, Luke A. Kanies wrote:

[#88280] Re: Newbie questions — "Luke A. Kanies" <luke@...> 2003/12/16

On Wed, 17 Dec 2003, Daniel Carrera wrote:

[#88370] Re: Newbie questions — Derek Lewis <lewisd@...00f.net> 2003/12/17

[#88220] Re: Newbie questions — "Berger, Daniel" <djberge@...>

> -----Original Message-----

31 messages 2003/12/16
[#88224] Re: Newbie questions — Hal Fulton <hal9000@...> 2003/12/16

Berger, Daniel wrote:

[#88227] Re: Newbie questions — Thomas Adam <thomas_adam16@...> 2003/12/16

--- Hal Fulton <hal9000@hypermetrics.com> wrote:

[#88228] Re: Newbie questions — Hal Fulton <hal9000@...> 2003/12/16

Thomas Adam wrote:

[#88289] Very odd IO problem — Brad <coish@...>

All:

18 messages 2003/12/17

[#88414] Yukihiro - Please ensure backwards compatibility — jobeicus@... (Joseph Benik)

having recently migrated one of my machines from a 1.6 flavor to the

14 messages 2003/12/18

[#88494] How to return more than one result from a method? — Tim Hunter <cyclists@...>

I'm trying to code a method that has two result values. The values are

14 messages 2003/12/19

[#88581] replacing two EOL chars by one — xah@... (Xah Lee)

i have a bunch of java files that has spaced-out formatting that i

23 messages 2003/12/20

[#88643] Ruby 1.8.1 preview4 — matz@... (Yukihiro Matsumoto)

Hi,

32 messages 2003/12/22

[#88731] RubyGems and dependencies — sera@... (Francis Hwang)

Two RubyGems questions about dependencies:

16 messages 2003/12/23

[#88781] TkText freezes — quillion <me@...>

Hello all,

21 messages 2003/12/24

[#88814] ruby 1.8.1 — matz@... (Yukihiro Matsumoto)

Merry Christmas,

25 messages 2003/12/24

[#88936] Inconsistent value of uninitialized variable — Gavin Sinclair <gsinclair@...>

The following statement, free of all context, generates an error:

10 messages 2003/12/28

[#88954] An addition to Array (or Enumerable)? — Harry Ohlsen <harryo@...>

Yesterday, I wanted to get the output from "ls -l some_file" and pull out just the file size and the file name. As I start writing this, I realise, of course, that I'd have been better off just using the File#size method, but I still think the issue I hit is interesting.

12 messages 2003/12/28

[#89015] ruby-dev summary 22273-22434 — "Takaaki Tateishi" <ttate@...>

Hello,

16 messages 2003/12/30
[#89016] Re: ruby-dev summary 22273-22434 — Austin Ziegler <austin@...> 2003/12/30

On Wed, 31 Dec 2003 00:45:11 +0900, Takaaki Tateishi wrote:

Re: Underpinnings of Method Wrapping

From: Peter <Peter.Vanbroekhoven@...>
Date: 2003-12-11 17:43:08 UTC
List: ruby-talk #87802
> Some people...I tell you. Hey, I know! How about I put in an RCR for 'alias e
> end'
>
>    class X
>      def whatever
>        if something
>          # ...
>    e e e
>
> Now that's progress! :))

:O)

I'll start changing all my "rescue SomeException => e" statements right
away!

> Oh, nice. And actually it can be easily done. We already have the ability to
> define a named layer of singleton via #extend. This actually creates a mixin
> on the singleton class. So the extending module remains a seperate entity
> from the singleton itself, and having a descernable name shoudl be fairly
> easy to manipulate/remove/replace. Good thinking, Peter! I like it.

It's a better idea than what was originally in the back of my head: if
wraps have the same indicator, they belong to one layer, and you can
remove/redefine them based on indicator... But the new idea makes layers
more explicit, that's good!

> Definitely wouldn't want to scarfice optimization. A singleton layer only
> needs to be separate when it is explictly told to be so (i.e. extend) or when
> antoher method of the same name already exists in the default singleton, at
> which point it bumps up to a next layer, and thus acts as a wrap upon a wrap.

Of course. But it would still bother me when there's one method that is a
very popular wrappee. Then you get a picture like this:

w |  |  |  |
r-m1-|--|--|--
a |  |  |  |
p-m2-m2-m2-m2-
p |  |  |  |
e-m3-|--|--|--
e |  |  |  |

So the wrappee has three methods m1, m2 and m3, and m2 is wrapped and each
time there is a new singleton layer. When calling m2, we need to go over
all the layers anyhow. But for m1 and m2 we wouldn't. Ideally we would
have this picture:

w          |
r----------m1-
a          |
p-m2-m2-m2-m2-
p          |
e----------m3-
e          |

So rather a chain of methods than a chain of layers. Unless of course you
would indicate shortcuts:

w |  |  |  |
r-m1----------
a |  |  |  |
p-m2-m2-m2-m2-
p |  |  |  |
e-m3----------
e |  |  |  |

Don't know if those pictures make sense.

> Ah, I think I see what you're saying: If I just use def without a super, how
> is the interpretor to know that this amounts to a redef and therefore should
> drop the old wraps? So either we have to use redef on all occassions of
> redefinition, or have some sort of wrap gc. Such a gc could work by
> eliminating wraps that fail to execute after the execution of their
> corresponding method, but such gc adds additional overhead, which I don't
> like. Yet this also plays heavy into the fact of when and when not to
> eliminate wraps. Consider what happens if we use a separate keyword like
> def:wrap for defining wraps. If I first define a wrap and then add a second
> wrap, but this time with no super, we have the same difficulty, but also we
> now have something specifically called a wrap posing as the actual method!
> Moreover (and this applies to my notation as well) what if there is a way to
> redefine the outer most wrap layer, or even eliminate it. Would those "free
> floating" wraps now come back into play?

Actually such a gc wouldn't make things much better. Wraps can
conditionally call super. Suppose a wrap does a security check and
decides you shouldn't call the method it wraps and raises an exception
instead.

As for your way vs. the explicit wrap/redef way, I think either way there
is some ambiguity. But the latter allows the programmer to specify his
intention, and the Ruby interpreter can act accordingly. The programmer
can specify it wrongly, but Ruby shouldn't worry about that.

> It's funny that this comes up, b/c I have started to think, in the back of my
> mind, that inner wraps --and by that I specifically means wraps that are
> flushed with the redefinition of the core method, are really of less use than
> I had orginally thought.

Sorry, that's me putting subliminal messages in my mails...

> Certainly a tangle to unravel here. I pray you can shed some clarity on this.

Hey, you finally spelled clarity correctly :-)

Anyway, I was thinking about the relation wrapping-subclassing. When we
make a subclass, and define a method that already exists, then there are
two cases: we call super in the new method or not. The same thing applies
to wrapping. So why is there no problem in the case of subclassing, and is
there a problem in the case of wrapping? Maybe it is because subclassing
explicitly adds a layer over the superclass, while wrapping currently does
not. So what if we look at wrapping as sneaking layers into the class
hierarchy? Such a layer would use the same syntax as subclassing. So if we
add a layer L to class C, that would be the same as adding a subclass L to
C, but everywhere where C is used, really L is used behind the scene. It
combines well with the new idea of layers.

> Hmm... Not sure if I completely understand yet, but as far as I can at this
> point imagine, I can only really see data private to the aspect as module
> varaibles (or local instance variables when we get those), psuedo code:
>
>   module MyAspect
>     wrap somemethod
>       @@myaspect_private_info = :testmode
>     end
>   end
>
> @@myaspect_private_info could have no effect on the class that this aspect is
> applied to even if it oddly had a class variable of the same name --at least
> I think it could work like that. Actually I'm not sure. Other wise I don't
> know how to go about it.

OK, but recall my example of a bidirectional link. We could have an aspect
do all the dirty work of maintaining the link and keeping it consistent.
We can't use module variables for this, because we need to keep the links
for a bunch of classes. Well, actually we can, but we'd need to keep
hashes that map objects onto their linked counterparts. But it's more
logical to store the links between two objects in those objects
themselves. But to understand that this is AOP, you'd need to let go of
the fact that AOP isn't all wrapping. Even AspectJ is not all about
wrapping. In AspectJ, it would look like this (don't count on my syntax
being correct though, I easily mix up syntax):

  class A {}
  class B {}

  aspect BiDirLinkAB {

    private A B.linkToA = null;
    // a link to B in class A, but class A can't see 'linkToA'
    private B A.linkToB = null;
    // a link to A in class B, but class B can't see 'linkToB'

    public void A.linkTo(B obj) {
      if (linkToB) linkToB.linkToA = null;
      // Note that although this method goes into class A, it can access
      // linkToA in class B
      linkToB = obj;
      if (obj.linkToA) obj.linkToA.linkToB = null;
      obj.linkToA = this;
    }

    public void B.linkTo(A obj) {
      // analogous
    }

    public B A.getLinkToB() {
      return linkToB;
    }

    public A B.getLinkToA() {
      return linkToA;
    }

  }

There's no wrapping, but it's cross-cutting since you have one entity (the
aspect) containing the code for maintaining data in two separate classes.

> Already started-in on it. Give me a day or two. I am facing one problem
> though. Our use of the words inner and outer, up til now, have been a bit
> loose, either meaning tightly-linked and loosely-linked, or meaning
> non-persistent and persistent upon redef, respectively. So I'm not sure in
> which manner I should to give them a specific definition.

I remember we had terms for both tightly/loosely linked and
(non-)persistence, but they never caught on. But if it really makes a
difference, we should try to consistently use different terms.

> Oh, that's interesting. How do you do AOP without wraps? I do see what you
> mean though. Certainly wraps can be used as merely a generic/implict means of
> subclassing. Something we can already in part do using singletons. I wonder
> how one defines AOP exactly then. Are you thinking that if a wrap becomes
> intrinsic that it is no longer AOP? Or does an advice have to cross-cut over
> more than a single method to be AOP? What if it does the former intrinsic
> behavior, but in fact cross-cuts across different methods and classes.
> Perhaps tricky but certainly possible. How does one draw the line? What the
> heck is this thing AOP we keep talking about anyway!? ;)

Well, the example above of the bidirectional link is an example that
doesn't involve wrapping. It's a bit like a mixin, but one that is
partially mixed into one class and partially mixed into another class.
Anyway, your last question is a research question, I can't answer those
off the top of my head.

> Wow. Can you tell me more about how that works? That's sounds quite
> interseting. What level of granularity do you mean? How does it work?

I'll try, it's been a long time and Google can't find the website anymore
(I remember then it was the first hit I got, weird). But if you think
about it, optimizations are program transformations, and so is adding
wraps. The latter is less obvious in a language like Ruby, but one way to
look at AspectJ is that you describe the classes and the different
aspects, and they are really woven together to produce the complete,
full-fledged application. So that's the general idea of AOP: describe the
different aspects and how a code weaver can weave them together. Using
wraps is really just the tip of the iceberg, but the fact that AspectJ
uses that concept means that it is probably well understood at this
moment.

But about optimizations... The example I remember is that of merging
loops. Suppose you have code like this:

  data.each do |d|
    # process d, produce some data2
  end
  # use data 2
  data.each do |d|
    # process d, produce some data3
  end
  # use data 3

So given some 'data', we use it in two subsequent calculations. We're
running over the data twice, but if we merge the loop, we do it just once:

  data.each do |d|
    # process d, produce some data2
    # process d, produce some data3
  end
  # use data 2
  # use data 3

However the two separate calculations are not entangled. For this simple
case, that may be less of a problem, but for realistic examples it can
turn out bad. What we then want to do is write the program as in the first
version, but indicate that the loops should be merged and write an aspect
that shows how to do it.

  data.each:merge do |d|
    # process d, produce some data2
  end
  # use data 2
  data.each:merge do |d|
    # process d, produce some data3
  end
  # use data 3

I used indicators by lack of something better :-) Showing how to merge the
loops is then done by giving a template:

  data.each:merge do |<it>|
    <code1>
  end
  data.each:merge do |<it>|
    <code2>
  end

produces

  data.each:merge do |<it>|
    <code1>
    <code2>
  end

This is just a rough idea, but what I read was such a rough idea. But also
this is a research area still. As for different in granularity; the above
is statement based, while wrapping is method based.

> Great. Although I'm not sure I understood what the misunderstanding is/was.
> But just the same, I certainly think we have come along way toward common
> understanding.

/me thinks so too.

Peter


In This Thread