Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-28 Thread kilon alios
Enviado: jueves, agosto 28, 2014 08:02 a.m. > Para: Any question about pharo is welcome > Asunto: Re: [Pharo-users] Unintuitive behavior of class-side initialize > > you can read the book here > > https://www.gitbook.io/book/kilon/pbe > > main repo is here > > https:

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-28 Thread Christophe Demarey
Le 27 août 2014 à 19:04, p...@highoctane.be a écrit : > Yeah don't do super initialize unless you know why on the class side. > > That being said class side initialize is pretty cool when loading new > packages and setting everything up automagically. > In my opinion, it would be better to hav

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-28 Thread Ignacio Sniechowski
, agosto 28, 2014 08:02 a.m. Para: Any question about pharo is welcome Asunto: Re: [Pharo-users] Unintuitive behavior of class-side initialize you can read the book here https://www.gitbook.io/book/kilon/pbe main repo is here https://github.com/SquareBracketAssociates/UpdatedPharoByExample Sure

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-28 Thread kilon alios
> the updated book. > Best > Nacho > > Enviado desde Molto <http://www.moltoapp.com/app?tag=ipad_sig> para iPad > > De: kilon alios > Enviado: miércoles, agosto 27, 2014 09:50 a.m. > Para: Any question about pharo is welcome > Asunto: Re: [Pharo-users] Unintui

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-28 Thread Ignacio Sniechowski
d De: kilon alios Enviado: miércoles, agosto 27, 2014 09:50 a.m. Para: Any question about pharo is welcome Asunto: Re: [Pharo-users] Unintuitive behavior of class-side initialize I will be adding an "Introduction to Object Orientation" chapter to the new updated Pharo By Example online

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread kilon alios
I assume you mean there will be an inheritance issue if I want the variables to be inherited with a default value by the subclasses, which is a valid concern. Other than that you can have accessors for it as far I know . But yeah in that case of inheritance you need some kind of initialise method.

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread Ben Coman
webwarrior wrote: As class is just an object in Smalltalk, it would be reasonable to believe that #initialize message is always sent to class on creation. However, that's not true. It is only sent to classes that redefine #initialize. Also sending super initialize may lead to problems. None of

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread webwarrior
I've also chosen ifNil route. However, in that case you either: - break encapsulation by providing accessors - have to invoke initializing method in every method that uses class instance variables or class variables 27.08.2014 20:31, kilon.alios [via Smalltalk] написав(ла): > yeah python does not

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread kilon alios
yeah python does not need initialisation for class variables like it does for instance variables, but then same applies for instance variables, for example you can add instance variables and even instance method after the instance is created , pharo does something similar too. Well OOP is a deep s

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread p...@highoctane.be
Yeah don't do super initialize unless you know why on the class side. That being said class side initialize is pretty cool when loading new packages and setting everything up automagically. Phil Le 27 août 2014 18:33, "webwarrior" a écrit : > class-side initialize. > > I don't think it can be c

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread webwarrior
class-side initialize. I don't think it can be considered a metaprogramming in Smalltalk. In Python, yes, messing with metaclass is metaprogramming. But things are a bit different there and metaclasses are very rarely used [explicitly]. 27.08.2014 19:05, kilon.alios [via Smalltalk] написав(ла):

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread kilon alios
ok officially I am confused are we talking about initialise at the instance side or class side (metaclass) side ? I am a python coder myself but I have not done any metaprogramming . If it is a metaprogramming thing then yes it wont go inside my intro chapter since this is advanced topic and me

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread webwarrior
This is not something fundamental to OOP, just specific to Pharo or Smalltalk. Take for example Python. It has similar object model (objects, classes, metaclasses). Every time class is defined (either by class keyword, or by type() function, or by calling a metaclass), its metaclass' __init__

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread kilon alios
I will be adding an "Introduction to Object Orientation" chapter to the new updated Pharo By Example online book, so I will add this to the chapter. The chapter will target people not familiar with Object Orientation and people new to coding. Its not an immediate target but it will happen till the

Re: [Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread Mariano Martinez Peck
On Wed, Aug 27, 2014 at 8:22 AM, webwarrior wrote: > As class is just an object in Smalltalk, it would be reasonable to believe > that #initialize message is always sent to class on creation. > > However, that's not true. It is only sent to classes that redefine > #initialize. Also sending super

[Pharo-users] Unintuitive behavior of class-side initialize

2014-08-27 Thread webwarrior
As class is just an object in Smalltalk, it would be reasonable to believe that #initialize message is always sent to class on creation. However, that's not true. It is only sent to classes that redefine #initialize. Also sending super initialize may lead to problems. None of these is mentioned i