I just wrapped this in NB last week, so if you have NativeBoost and Windows
you can use: NBWin32Process getCurrentProcessId (requires the latest packages from http://smalltalkhub.com/#!/~Pharo/NativeBoost) I'm sure on any other platforms there are API's as well to get the PID, like getpid on Unix. Should be easy to wrap in NB if you follow this tutorial: https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/NativeBoost/NativeBoost.pier.html Bye T. |
Thanks for your hard work! 1 important remark: NBXLibTypes class>>initialize super initialize. Display := #NBXLibDisplay. Never use 'super initialize' for class initializers. On 20 August 2013 09:42, Torsten Bergmann <[hidden email]> wrote: I just wrapped this in NB last week, so if you have NativeBoost and Windows -- Best regards, Igor Stasenko. |
I'am just learning (a few weeks) ....
so why not use super in Class?
Thanks Tim Op 20-8-2013 11:29, Igor Stasenko schreef:
|
On Aug 20, 2013, at 11:34 , Tim Hendriks <[hidden email]> wrote: > I'am just learning (a few weeks) .... so why not use super in Class? > > Thanks Tim Nothing wrong with using super in Class, but using it in class initialize is a no-no. That method is treated specially and called once a Class is loaded into a system, usually to initialize class variables. So calling super from it will lead to re-initialization of existing class variables when you load code, which is generally not a kosher thing to do; if those have been changed since initialization, it's usually for a reason. Cheers, Henry signature.asc (859 bytes) Download Attachment |
In reply to this post by Tim Hendriks
Classes forming the tree structure (one class can have many subclasses). A class initialization usually done for initializing propertiesOn 20 August 2013 11:34, Tim Hendriks <[hidden email]> wrote:
-- Best regards, Igor Stasenko. |
In reply to this post by Tim Hendriks
Hi Tim,
the problem is not the send of #super to a class, but the call of #initialize of #super on the class side. As long as you are not interested in very confusing details about the inheritence hierarchy of Class and Metaclasses and stuff, don't ask, just do as you're told ;-) You can, however, have a look at chapter 13 Classes and Metaclasses of the "Pharo By Example" book (http://pharobyexample.org) if you want to know more. A very short and incomplete explanation is that the superclass of a class is never the superclass of the class of its instances, because all classes are instances of the same class ( I told you you prabably don't want to know right now ;-) ). Joachim Am 20.08.13 11:34, schrieb Tim Hendriks: > I'am just learning (a few weeks) .... so why not use super in Class? > > Thanks Tim > > Op 20-8-2013 11:29, Igor Stasenko schreef: >> Thanks for your hard work! >> >> 1 important remark: >> NBXLibTypes class>>initialize >> super initialize. >> Display := #NBXLibDisplay. >> >> >> Never use 'super initialize' for class initializers. >> >> >> >> >> On 20 August 2013 09:42, Torsten Bergmann <[hidden email] >> <mailto:[hidden email]>> wrote: >> >> I just wrapped this in NB last week, so if you have NativeBoost >> and Windows >> you can use: >> >> NBWin32Process getCurrentProcessId >> >> (requires the latest packages from >> http://smalltalkhub.com/#!/~Pharo/NativeBoost >> <http://smalltalkhub.com/#%21/%7EPharo/NativeBoost>) >> >> I'm sure on any other platforms there are API's as well to get >> the PID, like >> getpid on Unix. Should be easy to wrap in NB if you follow this >> tutorial: >> >> https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/NativeBoost/NativeBoost.pier.html >> >> Bye >> T. >> >> >> >> >> >> >> >> -- >> Best regards, >> Igor Stasenko. > -- -- ----------------------------------------------------------------------- Objektfabrik Joachim Tuchel mailto:[hidden email] Fliederweg 1 http://www.objektfabrik.de D-71640 Ludwigsburg http://joachimtuchel.wordpress.com Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1 |
Ok, I don't want to know :-)
Just as a rule: don't call super initialize on the Class site ? But I can use (the message) initialize on the Class site (for initializing applications roots in seaside for example) but just do'nt use super in it. Correct? Thanks Tim Op 20-8-2013 11:45, [hidden email] schreef: > Hi Tim, > > the problem is not the send of #super to a class, but the call of > #initialize of #super on the class side. > > As long as you are not interested in very confusing details about the > inheritence hierarchy of Class and Metaclasses and stuff, don't ask, > just do as you're told ;-) > You can, however, have a look at chapter 13 Classes and Metaclasses of > the "Pharo By Example" book (http://pharobyexample.org) if you want to > know more. > > A very short and incomplete explanation is that the superclass of a > class is never the superclass of the class of its instances, because > all classes are instances of the same class ( I told you you prabably > don't want to know right now ;-) ). > > Joachim > > > Am 20.08.13 11:34, schrieb Tim Hendriks: >> I'am just learning (a few weeks) .... so why not use super in Class? >> >> Thanks Tim >> >> Op 20-8-2013 11:29, Igor Stasenko schreef: >>> Thanks for your hard work! >>> >>> 1 important remark: >>> NBXLibTypes class>>initialize >>> super initialize. >>> Display := #NBXLibDisplay. >>> >>> >>> Never use 'super initialize' for class initializers. >>> >>> >>> >>> >>> On 20 August 2013 09:42, Torsten Bergmann <[hidden email] >>> <mailto:[hidden email]>> wrote: >>> >>> I just wrapped this in NB last week, so if you have NativeBoost >>> and Windows >>> you can use: >>> >>> NBWin32Process getCurrentProcessId >>> >>> (requires the latest packages from >>> http://smalltalkhub.com/#!/~Pharo/NativeBoost >>> <http://smalltalkhub.com/#%21/%7EPharo/NativeBoost>) >>> >>> I'm sure on any other platforms there are API's as well to get >>> the PID, like >>> getpid on Unix. Should be easy to wrap in NB if you follow this >>> tutorial: >>> >>> https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/NativeBoost/NativeBoost.pier.html >>> >>> Bye >>> T. >>> >>> >>> >>> >>> >>> >>> >>> -- >>> Best regards, >>> Igor Stasenko. >> > > |
no, you do not call super initialize in class side initialize method.
You do not do: MyClass class>>#initialize super initialize. "THIS IS BAD" ... rest of initialization. we should add a Lint rule with that, btw. On Aug 20, 2013, at 11:52 AM, Tim Hendriks <[hidden email]> wrote: > Ok, I don't want to know :-) > > Just as a rule: don't call super initialize on the Class site ? But I can use (the message) initialize on the Class site (for initializing applications roots in seaside for example) but just do'nt use super in it. Correct? > > Thanks Tim > > Op 20-8-2013 11:45, [hidden email] schreef: >> Hi Tim, >> >> the problem is not the send of #super to a class, but the call of #initialize of #super on the class side. >> >> As long as you are not interested in very confusing details about the inheritence hierarchy of Class and Metaclasses and stuff, don't ask, just do as you're told ;-) >> You can, however, have a look at chapter 13 Classes and Metaclasses of the "Pharo By Example" book (http://pharobyexample.org) if you want to know more. >> >> A very short and incomplete explanation is that the superclass of a class is never the superclass of the class of its instances, because all classes are instances of the same class ( I told you you prabably don't want to know right now ;-) ). >> >> Joachim >> >> >> Am 20.08.13 11:34, schrieb Tim Hendriks: >>> I'am just learning (a few weeks) .... so why not use super in Class? >>> >>> Thanks Tim >>> >>> Op 20-8-2013 11:29, Igor Stasenko schreef: >>>> Thanks for your hard work! >>>> >>>> 1 important remark: >>>> NBXLibTypes class>>initialize >>>> super initialize. >>>> Display := #NBXLibDisplay. >>>> >>>> >>>> Never use 'super initialize' for class initializers. >>>> >>>> >>>> >>>> >>>> On 20 August 2013 09:42, Torsten Bergmann <[hidden email] <mailto:[hidden email]>> wrote: >>>> >>>> I just wrapped this in NB last week, so if you have NativeBoost >>>> and Windows >>>> you can use: >>>> >>>> NBWin32Process getCurrentProcessId >>>> >>>> (requires the latest packages from >>>> http://smalltalkhub.com/#!/~Pharo/NativeBoost >>>> <http://smalltalkhub.com/#%21/%7EPharo/NativeBoost>) >>>> >>>> I'm sure on any other platforms there are API's as well to get >>>> the PID, like >>>> getpid on Unix. Should be easy to wrap in NB if you follow this >>>> tutorial: >>>> >>>> https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/NativeBoost/NativeBoost.pier.html >>>> >>>> Bye >>>> T. >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> Best regards, >>>> Igor Stasenko. >>> >> >> > > |
In reply to this post by Tim Hendriks
Ok, here's the mess we made ;-).
We've confused you. But don't worry, you've just touched an area of Smalltalk where the boundaries between computation and magic get very blurry. You can implement the method initialze (just like any other method) on the instance or class side. For instance side #initialize methods, it is completely okay to send "super initialize" if instances of this class need to do the same initialization as instances of its superclass. In some frameworks, it is a necessity to always send #initialize to super to make things work. For example, if you subclass WAComponent in a Seaside application and implement #initialize on this subclass' instance side, you MUST send super initialize, otherwise you get an exception when you try to render the component (UndefinedObject DNU #contents). But on the class side (class method #initialize) it is absolutely unlikely you ever want to send #initialize to the class' superclass. We've read a few explanations for this already. I hope things get a little clearer now. Joachim Am 20.08.13 11:52, schrieb Tim Hendriks: > Ok, I don't want to know :-) > > Just as a rule: don't call super initialize on the Class site ? But I > can use (the message) initialize on the Class site (for initializing > applications roots in seaside for example) but just do'nt use super in > it. Correct? > > Thanks Tim > > Op 20-8-2013 11:45, [hidden email] schreef: >> Hi Tim, >> >> the problem is not the send of #super to a class, but the call of >> #initialize of #super on the class side. >> >> As long as you are not interested in very confusing details about the >> inheritence hierarchy of Class and Metaclasses and stuff, don't ask, >> just do as you're told ;-) >> You can, however, have a look at chapter 13 Classes and Metaclasses >> of the "Pharo By Example" book (http://pharobyexample.org) if you >> want to know more. >> >> A very short and incomplete explanation is that the superclass of a >> class is never the superclass of the class of its instances, because >> all classes are instances of the same class ( I told you you prabably >> don't want to know right now ;-) ). >> >> Joachim >> >> >> Am 20.08.13 11:34, schrieb Tim Hendriks: >>> I'am just learning (a few weeks) .... so why not use super in Class? >>> >>> Thanks Tim >>> >>> Op 20-8-2013 11:29, Igor Stasenko schreef: >>>> Thanks for your hard work! >>>> >>>> 1 important remark: >>>> NBXLibTypes class>>initialize >>>> super initialize. >>>> Display := #NBXLibDisplay. >>>> >>>> >>>> Never use 'super initialize' for class initializers. >>>> >>>> >>>> >>>> >>>> On 20 August 2013 09:42, Torsten Bergmann <[hidden email] >>>> <mailto:[hidden email]>> wrote: >>>> >>>> I just wrapped this in NB last week, so if you have NativeBoost >>>> and Windows >>>> you can use: >>>> >>>> NBWin32Process getCurrentProcessId >>>> >>>> (requires the latest packages from >>>> http://smalltalkhub.com/#!/~Pharo/NativeBoost >>>> <http://smalltalkhub.com/#%21/%7EPharo/NativeBoost>) >>>> >>>> I'm sure on any other platforms there are API's as well to get >>>> the PID, like >>>> getpid on Unix. Should be easy to wrap in NB if you follow this >>>> tutorial: >>>> >>>> https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/NativeBoost/NativeBoost.pier.html >>>> >>>> >>>> Bye >>>> T. >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> Best regards, >>>> Igor Stasenko. >>> >> >> > > > -- -- ----------------------------------------------------------------------- Objektfabrik Joachim Tuchel mailto:[hidden email] Fliederweg 1 http://www.objektfabrik.de D-71640 Ludwigsburg http://joachimtuchel.wordpress.com Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1 |
In reply to this post by EstebanLM
OK Thanks a lot.
I won't call super initialize on de Class side.... Don't know why.... I just don't.... simpel.... Thanks for trying to explain why. Op 20-8-2013 12:00, Esteban Lorenzano schreef: > no, you do not call super initialize in class side initialize method. > > You do not do: > > MyClass class>>#initialize > super initialize. "THIS IS BAD" > ... rest of initialization. > > we should add a Lint rule with that, btw. > > > On Aug 20, 2013, at 11:52 AM, Tim Hendriks <[hidden email]> wrote: > >> Ok, I don't want to know :-) >> >> Just as a rule: don't call super initialize on the Class site ? But I can use (the message) initialize on the Class site (for initializing applications roots in seaside for example) but just do'nt use super in it. Correct? >> >> Thanks Tim >> >> Op 20-8-2013 11:45, [hidden email] schreef: >>> Hi Tim, >>> >>> the problem is not the send of #super to a class, but the call of #initialize of #super on the class side. >>> >>> As long as you are not interested in very confusing details about the inheritence hierarchy of Class and Metaclasses and stuff, don't ask, just do as you're told ;-) >>> You can, however, have a look at chapter 13 Classes and Metaclasses of the "Pharo By Example" book (http://pharobyexample.org) if you want to know more. >>> >>> A very short and incomplete explanation is that the superclass of a class is never the superclass of the class of its instances, because all classes are instances of the same class ( I told you you prabably don't want to know right now ;-) ). >>> >>> Joachim >>> >>> >>> Am 20.08.13 11:34, schrieb Tim Hendriks: >>>> I'am just learning (a few weeks) .... so why not use super in Class? >>>> >>>> Thanks Tim >>>> >>>> Op 20-8-2013 11:29, Igor Stasenko schreef: >>>>> Thanks for your hard work! >>>>> >>>>> 1 important remark: >>>>> NBXLibTypes class>>initialize >>>>> super initialize. >>>>> Display := #NBXLibDisplay. >>>>> >>>>> >>>>> Never use 'super initialize' for class initializers. >>>>> >>>>> >>>>> >>>>> >>>>> On 20 August 2013 09:42, Torsten Bergmann <[hidden email] <mailto:[hidden email]>> wrote: >>>>> >>>>> I just wrapped this in NB last week, so if you have NativeBoost >>>>> and Windows >>>>> you can use: >>>>> >>>>> NBWin32Process getCurrentProcessId >>>>> >>>>> (requires the latest packages from >>>>> http://smalltalkhub.com/#!/~Pharo/NativeBoost >>>>> <http://smalltalkhub.com/#%21/%7EPharo/NativeBoost>) >>>>> >>>>> I'm sure on any other platforms there are API's as well to get >>>>> the PID, like >>>>> getpid on Unix. Should be easy to wrap in NB if you follow this >>>>> tutorial: >>>>> >>>>> https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/NativeBoost/NativeBoost.pier.html >>>>> >>>>> Bye >>>>> T. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Best regards, >>>>> Igor Stasenko. >>> >> > |
but you can do
MyClass class>>#someOtherMethodWhichIsNotCalled"initialize" super someOtherMethodWhichIsNotCalled"initialize". etc... the restriction is just for the method called #initialize :) Esteban On Aug 20, 2013, at 12:22 PM, Tim Hendriks <[hidden email]> wrote: > OK Thanks a lot. > > I won't call super initialize on de Class side.... Don't know why.... I just don't.... simpel.... > > Thanks for trying to explain why. > > > Op 20-8-2013 12:00, Esteban Lorenzano schreef: >> no, you do not call super initialize in class side initialize method. >> >> You do not do: >> >> MyClass class>>#initialize >> super initialize. "THIS IS BAD" >> ... rest of initialization. >> >> we should add a Lint rule with that, btw. >> >> On Aug 20, 2013, at 11:52 AM, Tim Hendriks <[hidden email]> wrote: >> >>> Ok, I don't want to know :-) >>> >>> Just as a rule: don't call super initialize on the Class site ? But I can use (the message) initialize on the Class site (for initializing applications roots in seaside for example) but just do'nt use super in it. Correct? >>> >>> Thanks Tim >>> >>> Op 20-8-2013 11:45, [hidden email] schreef: >>>> Hi Tim, >>>> >>>> the problem is not the send of #super to a class, but the call of #initialize of #super on the class side. >>>> >>>> As long as you are not interested in very confusing details about the inheritence hierarchy of Class and Metaclasses and stuff, don't ask, just do as you're told ;-) >>>> You can, however, have a look at chapter 13 Classes and Metaclasses of the "Pharo By Example" book (http://pharobyexample.org) if you want to know more. >>>> >>>> A very short and incomplete explanation is that the superclass of a class is never the superclass of the class of its instances, because all classes are instances of the same class ( I told you you prabably don't want to know right now ;-) ). >>>> >>>> Joachim >>>> >>>> >>>> Am 20.08.13 11:34, schrieb Tim Hendriks: >>>>> I'am just learning (a few weeks) .... so why not use super in Class? >>>>> >>>>> Thanks Tim >>>>> >>>>> Op 20-8-2013 11:29, Igor Stasenko schreef: >>>>>> Thanks for your hard work! >>>>>> >>>>>> 1 important remark: >>>>>> NBXLibTypes class>>initialize >>>>>> super initialize. >>>>>> Display := #NBXLibDisplay. >>>>>> >>>>>> >>>>>> Never use 'super initialize' for class initializers. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On 20 August 2013 09:42, Torsten Bergmann <[hidden email] <mailto:[hidden email]>> wrote: >>>>>> >>>>>> I just wrapped this in NB last week, so if you have NativeBoost >>>>>> and Windows >>>>>> you can use: >>>>>> >>>>>> NBWin32Process getCurrentProcessId >>>>>> >>>>>> (requires the latest packages from >>>>>> http://smalltalkhub.com/#!/~Pharo/NativeBoost >>>>>> <http://smalltalkhub.com/#%21/%7EPharo/NativeBoost>) >>>>>> >>>>>> I'm sure on any other platforms there are API's as well to get >>>>>> the PID, like >>>>>> getpid on Unix. Should be easy to wrap in NB if you follow this >>>>>> tutorial: >>>>>> >>>>>> https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/NativeBoost/NativeBoost.pier.html >>>>>> >>>>>> Bye >>>>>> T. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Best regards, >>>>>> Igor Stasenko. >>>> >>> >> > > |
Op 20-8-2013 13:39, Esteban Lorenzano schreef:
> but you can do > > MyClass class>>#someOtherMethodWhichIsNotCalled"initialize" > super someOtherMethodWhichIsNotCalled"initialize". > etc... > > the restriction is just for the method called #initialize :) Just to make it simple, I guess :-) I write is somewhere down... Tim > > Esteban > > > On Aug 20, 2013, at 12:22 PM, Tim Hendriks <[hidden email]> wrote: > >> OK Thanks a lot. >> >> I won't call super initialize on de Class side.... Don't know why.... I just don't.... simpel.... >> >> Thanks for trying to explain why. >> >> >> Op 20-8-2013 12:00, Esteban Lorenzano schreef: >>> no, you do not call super initialize in class side initialize method. >>> >>> You do not do: >>> >>> MyClass class>>#initialize >>> super initialize. "THIS IS BAD" >>> ... rest of initialization. >>> >>> we should add a Lint rule with that, btw. >>> >>> On Aug 20, 2013, at 11:52 AM, Tim Hendriks <[hidden email]> wrote: >>> >>>> Ok, I don't want to know :-) >>>> >>>> Just as a rule: don't call super initialize on the Class site ? But I can use (the message) initialize on the Class site (for initializing applications roots in seaside for example) but just do'nt use super in it. Correct? >>>> >>>> Thanks Tim >>>> >>>> Op 20-8-2013 11:45, [hidden email] schreef: >>>>> Hi Tim, >>>>> >>>>> the problem is not the send of #super to a class, but the call of #initialize of #super on the class side. >>>>> >>>>> As long as you are not interested in very confusing details about the inheritence hierarchy of Class and Metaclasses and stuff, don't ask, just do as you're told ;-) >>>>> You can, however, have a look at chapter 13 Classes and Metaclasses of the "Pharo By Example" book (http://pharobyexample.org) if you want to know more. >>>>> >>>>> A very short and incomplete explanation is that the superclass of a class is never the superclass of the class of its instances, because all classes are instances of the same class ( I told you you prabably don't want to know right now ;-) ). >>>>> >>>>> Joachim >>>>> >>>>> >>>>> Am 20.08.13 11:34, schrieb Tim Hendriks: >>>>>> I'am just learning (a few weeks) .... so why not use super in Class? >>>>>> >>>>>> Thanks Tim >>>>>> >>>>>> Op 20-8-2013 11:29, Igor Stasenko schreef: >>>>>>> Thanks for your hard work! >>>>>>> >>>>>>> 1 important remark: >>>>>>> NBXLibTypes class>>initialize >>>>>>> super initialize. >>>>>>> Display := #NBXLibDisplay. >>>>>>> >>>>>>> >>>>>>> Never use 'super initialize' for class initializers. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 20 August 2013 09:42, Torsten Bergmann <[hidden email] <mailto:[hidden email]>> wrote: >>>>>>> >>>>>>> I just wrapped this in NB last week, so if you have NativeBoost >>>>>>> and Windows >>>>>>> you can use: >>>>>>> >>>>>>> NBWin32Process getCurrentProcessId >>>>>>> >>>>>>> (requires the latest packages from >>>>>>> http://smalltalkhub.com/#!/~Pharo/NativeBoost >>>>>>> <http://smalltalkhub.com/#%21/%7EPharo/NativeBoost>) >>>>>>> >>>>>>> I'm sure on any other platforms there are API's as well to get >>>>>>> the PID, like >>>>>>> getpid on Unix. Should be easy to wrap in NB if you follow this >>>>>>> tutorial: >>>>>>> >>>>>>> https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/NativeBoost/NativeBoost.pier.html >>>>>>> >>>>>>> Bye >>>>>>> T. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Best regards, >>>>>>> Igor Stasenko. >> > |
In reply to this post by Torsten Bergmann
On 20.08.13 09:42, Torsten Bergmann wrote:
> NBWin32Process getCurrentProcessId The NativeBoost approach is a really good idea! I'll check whether I can get this working on other platforms as Win32 as well. Thanks, Udo |
on windoze, getting pid of current process is piece of cake (GetModuleHangle). On 20 August 2013 19:16, Udo Schneider <[hidden email]> wrote: On 20.08.13 09:42, Torsten Bergmann wrote: -- Best regards, Igor Stasenko. |
see NativeBoostWin32 class>>getVMModuleHandle On 21 August 2013 04:42, Igor Stasenko <[hidden email]> wrote:
-- Best regards, Igor Stasenko. |
Free forum by Nabble | Edit this page |