Thank you for taking the time to explain this in such technical detail. I reread my answer to the example Stéphane Ducasse gave me, and i realize some of you might have gotten the impression in never fully understood the code and what i meant.
I may lack the technical background to express this, but i did fully figure out what it meant and how it would help me. Gathered more "intel" form other sources. "Check out our AST interpreter that will give you fine-grained control over the execution of Smalltalk code. With underlying AST as execution format it is very easy to map the currently executed code back to the source code." http://smalltalkhub.com/#!/~dh83/ast-interpreter The keywords contained in the answer have indeed assured me that in am indeed looking into the direction. I've since compiled a list of all the things i am supposed to know before i can attack the problem myself, and happily started my journey to knowledge. Conceptually i think i have the solution, as all the pieces seem to be available, but i think it will take some time before i slowly transition this mental model to a "working" model, given my lack of practical expertise. I have high hopes that what i'm trying to achieve will also help alleviate some of the caveats OO has now, a rather opaqueness of objects, a "hiding" of relevant information behind something else, and the need to "know" the model of all the separate packages involved, but which you don't actually need to build something rather small in between. I find it rather peculiar that it is in this field also, the best advice of how to fix things comes from people complaining. I found this http://blog.jot.fm/2010/08/26/ten-things-i-hate-about-object-oriented-programming/ I may not share the expertise of the writer but i can say, with confidence, that i am quite familiar with the feeling. Regards. Pe 26.01.2013, la 21:26, Jesus Nuñez <[email protected]> a scris: > About your pending question, you should read the very basics of smalltalk > before trying to understand its abstrations. Just to give you a hint (I will > use the Point example): > > > (Point>>#x) "==> (Point>>#x "a CompiledMethod(880017408)")" > > #aSymbol is just a singletone version of the string "aSymbol"; In what to > classes concerns it is used as a unique identifier in the method dictionary. > The rest is just syntax ">>" is the selector(s) (method(s)) accessor, it > will retrieve the keyed selector (in this case #x which again is unique in > the class) value, which is a CompiledMethod(atSomeAddress). > > Now you can also get the contents as a string if you want to parse it > yourself (compare to (Point>>#x) parseTree ): > > (Point>>#x) definition "==> 'x > "Answer the x coordinate." > ^x'" > Which is nothing more than the contents of the selector #x. I suggest, if you > want to get a "personalized" version of the parse tree, to try PetitParser, > there are many examples and even a Smalltalk80 parser in there. > > Hope this helps, > > > Jesus > > > 2013/1/26 mircea <[email protected]> > I will reply for each. Detailing my thought pattern. I know all the "rules > and conventions" of smalltalk but i "can't play" very well. > > At first > (Point>>#x) parseTree explore > just looks weird. > > Then things start to settle. () Paranthesis means i don't actually have to > care what is in there, conclusion is whatever happens the product of () will > be an object. I'm actually scared of >>, since i don't know what it does… > i've seen it in old code snippets of class definitions. > > parseTree seems to be a method, and so does explore. > > Going on… it seems to be a chain of unary messages. > > Based on first trial conclusion it might be a statement even though the "." > at the end is missing. > I paste in the Workspace and right click 'Do It' on the whole thing. > > A window opens with lots of information in it. I can't make sense of it since > i have no idea what i just did. > > I need more information on what i just did. > > Restart from the beginning. > > "Point" might be a point like in a cardinal system… x is there so i might be > right. > I replace x with y and 'Do It' again… another window pop open… seems to be > quite similar to the first one only it has y in it instead of x. > I continue the assumption and replace y with z. > I get a KeyNotFound:, i don't understand this but it's similar to > MessageNotUnderstood:. Since success would have meant i would get a similar > window as in the x y case, getting a different window means the test failed. > > I can only use x and y in the statement as it is now. > > Point might be a class, i search for it… it seems to have instance variable > names by that name. I add z to its list of instance variable names, save, > replace it in the command… error. Assumption was incorrect. I look at the > Point class again notice it also has accessor methods by that name, just x > and y … there is no z. Agrees with the failure of earlier experiment, i might > be on the right track. > I choose another method of Point. Execute the command again… get the > "success" window with lots of information on it. > I choose another class and one of its methods, execute the command again… get > the "success" windows with lots of information on it. > > Conclusion… I can put any class name and choose any method it has and the > command will pop up information about if. I don't understand the information > from the pop up. > > Restart from the beginning. > > I search for parseTree in the browser and there seems to be a lot of > implementors of that method. > I search for explore in the browser and Object seems to implement it. > I 'Inspect It' on just the (Point>>#x) part and it seems to be producing a > CompiledMethod object. > > Based on assumption from the beginning whatever happens between () is an > object this object then responds to parseTree. > I 'Inspect It' on just (Point>>#x) parseTree and get an RBMethodNode object. > Seems the parseTree gets CompiledMethod as input and outputs this different > kind of object called RBMethodNode. > > Adding explore, based on the fact that explore is a method of object, seems > to be just a generic printout of this entire object. > > The end. Time elapsed, a little over 3 min. Took longer to write the email. > > Pending questions: > > What exactly does >> do here? > I know # is followed by a string literal normally in '' but since there are > no spaces just the characters will do. > > > > > > > > > > Pe 26.01.2013, la 13:41, Stéphane Ducasse [via Smalltalk] <[hidden email]> a > scris: > >> > It's like being a two-eyed man in a dark room with no flashlight. Your >> > eyes are there, but without the flashlight there might as well be no room. >> > >> > Without previous knowledge of how this AST is implemented my best bet is >> > do the "architectural plan" example i gave Dale H. >> >> (Point>>#x) parseTree explore >> will show you the tree then you can navigate in it. > > > View this message in context: Re: How do i list the execution order of > statements inside a method? > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. >
