Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Ben Tilly
ps too subtle a point that isn't worth trying > to capturing. Anyway, my analogy isn't exact since my "book" is really just > a reference to the > title page. :) > > >> Date: Sat, 1 Nov 2014 22:44:50 -0700 >> Subject: Re: [Boston.pm] object composition (

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Ben Tilly
This works in Ruby: class Integer def hello () puts self end end 5.hello() # outputs 5 For performance reasons there is a slight bit of cheating for some numerical types. For example you cannot add a method to the number 5 only. See http://ruby-doc.org/core-2.1.4/Fixnum.htm

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Bill Ricker
On Sun, Nov 2, 2014 at 5:39 PM, Ben Tilly wrote: >> Do smalltalkers accept Ruby's claims? Their native OO is more OO than >> P5's (but we have choices), but is arithmetic really done with messages? > > Yes. Ruby's OO model is an exact copy of Smalltalk's. Arithmetic > works the same way once yo

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Ben Tilly
On Sun, Nov 2, 2014 at 1:00 PM, Bill Ricker wrote: > On Sun, Nov 2, 2014 at 3:29 PM, Adam Russell wrote: >> >> I've been doing OO for years with pure-OO type environments such as Ruby > > Do smalltalkers accept Ruby's claims? Their native OO is more OO than > P5's (but we have choices), but is a

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Bill Ricker
On Sun, Nov 2, 2014 at 5:13 PM, Ben Tilly wrote: > So my experience is, "Arrays are a better answer than linked lists in > Perl except when Perl is a bad choice of language." I can agree with that. Especially since i said for pure-OO exploration, Perl5 native OO was a poor choice, and the right l

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Ben Tilly
On Sun, Nov 2, 2014 at 8:02 AM, Bill Ricker wrote: > On Sun, Nov 2, 2014 at 10:14 AM, Greg London wrote: > >> My experience has been that having a page instance be mangled >> in some way to behave like a book is almost always going to be >> a regrettable coding decision. >> > > Nice analogy. Agre

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Bill Ricker
On Sun, Nov 2, 2014 at 3:29 PM, Adam Russell wrote: > > I've been doing OO for years with pure-OO type environments such as Ruby Do smalltalkers accept Ruby's claims? Their native OO is more OO than P5's (but we have choices), but is arithmetic really done with messages? > but now that I have

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Adam Russell
experiment with SmallTalk if I had the time but for now, when I have a spare couple of hours on a Saturday night I need something with less syntactic ramp up time. From: bill.n1...@gmail.com Date: Sun, 2 Nov 2014 15:04:16 -0500 Subject: Re: [Boston.pm] object composition (has-a) with built-in OO

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Bill Ricker
On Sun, Nov 2, 2014 at 12:11 PM, Adam Russell wrote: > I approached this purely from an OO design perspective without regard to > the language much less the implementation. ​​I *do* recommend learning true OO style in a pure-OO environment (somewhere were 1 and 0 are objects responding to metho

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Adam Russell
implementation. From: bill.n1...@gmail.com Date: Sun, 2 Nov 2014 11:51:47 -0500 Subject: Re: [Boston.pm] object composition (has-a) with built-in OO system To: ac.russ...@live.com CC: boston-pm@mail.pm.org On Sun, Nov 2, 2014 at 11:39 AM, Adam Russell wrote: Ah, ok, thanks for spelling that out!In my code

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Bill Ricker
On Sun, Nov 2, 2014 at 11:39 AM, Adam Russell wrote: > Ah, ok, thanks for spelling that out! > In my code I used a scalar reference so I seem to have stumbled onto that > without really appreciating it. > ​In strongly typed OO, particularly where the only automatic GC is stack-based, embedded ​h

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Adam Russell
Ah, ok, thanks for spelling that out! In my code I used a scalar reference so I seem to have stumbled onto that without really appreciating it. This is the answer I seek. :) Sent from my iPhone > On Nov 2, 2014, at 11:30 AM, Bill Ricker wrote: > > >> On Sun, Nov 2, 2014 at 11:08 AM, Adam Rus

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Bill Ricker
On Sun, Nov 2, 2014 at 11:08 AM, Adam Russell wrote: > My question arose because it seems that Perl's built in OO system allows > you to do "has-a" but only asa slight twist on "is-a". Or may be not. Has > there been an answer to that yet? If so, I didn't see it. I touched on this. ​Since Perl

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Adam Russell
n1...@gmail.com Date: Sun, 2 Nov 2014 11:02:08 -0500 Subject: Re: [Boston.pm] object composition (has-a) with built-in OO system To: em...@greglondon.com CC: ac.russ...@live.com; boston-pm@mail.pm.org On Sun, Nov 2, 2014 at 10:14 AM, Greg London wrote: My experience has been that having a pa

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Adam Russell
iki/Has-a I was thinking along the lines of the example there of a car that "has-a" chassis when making my LinkedList that "has-a" head node. I'm not making an bold claims that this is the best way to do it, again, this was just my experimenting with some code late at nigh

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Bill Ricker
On Sun, Nov 2, 2014 at 10:14 AM, Greg London wrote: > My experience has been that having a page instance be mangled > in some way to behave like a book is almost always going to be > a regrettable coding decision. > ​Nice analogy. Agreed. As to Ben's comments on Linked lists ​vs Perl arrays, li

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-02 Thread Greg London
My experience has been that having a page instance be mangled in some way to behave like a book is almost always going to be a regrettable coding decision. What I sometimes do would be to have the page contain a pointer to the book in which it is bound, so that the page can call book level methods

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-01 Thread Adam Russell
nt that isn't worth trying to capturing. Anyway, my analogy isn't exact since my "book" is really just a reference to the title page. :) > Date: Sat, 1 Nov 2014 22:44:50 -0700 > Subject: Re: [Boston.pm] object composition (has-a) with built-in OO system > From: b

Re: [Boston.pm] object composition (has-a) with built-in OO system

2014-11-01 Thread Ben Tilly
Just so that you know, it is very hard to find a use case for linked lists in Perl where a native array is not a better option. That said, why draw a distinction between a node in a linked list and a linked list? I would just have one class, that is a reference to a node. (That itself might have

[Boston.pm] object composition (has-a) with built-in OO system

2014-11-01 Thread Adam Russell
I was experimenting with some code, jogging my memory of linked lists. The approach I took was to define a package LinkedListNode and then a package LinkedList. My idea is that my LinkedList package is a wrapper around the head node which would also define some useful methods such as print_list()