In this video, I'd like to show you how an
object can define tabs displayed in the inspector.
How will we see that?
We're going to use Spotter to do this.
In Spotter I remember that I search for
a #pragma, a method annotation, beginning with gt.
I know there is "inspector" inside so I'm going to look at this.
In my inspector I can see there are #Pragmas and
#Senders, I keep the #Pragma.
Now I can look for instance at
Morph's one.
We open the code.
This is the one corresponding to.. You remember, if I do
"Inspect", an inspector opens and
this inspector has this tab,
let's compare.
You see we create a 'Morph' composite, there is
a title and there'll be an action done with
an error management in case the 'Morph' wouldn't display well.
We convert and display a 'Morph'.
You also have "act" which is the way for
associating operations to
this tab.
Let's look at another example.
Here and there.
I want to see "Date".
If you remember, we had "Date today inspect".
We had Details and Calendar.
How to create this 'Morph'?
You just create the 'Morph' by using this message.
And Details, how does it work?
I ask for the creation of a table, I assign it a
title, key value, evaluate, return
the key and compute the value.
The last example I wanted to show you was:
what happens when you do the job done
by a method inspector?
You remember, we had a method which was
Bytecode, at least a table containing Bytecode and
we had the Source or the AST or Bytecode.
Let's look at AST. I'm gonna ask to my dear
Spotter. I'm gonna look for Compiled
method. Let's consider the Source,
it seems good.
For the Source, which is this panel here, we can
see that we define the Source and here there is a pharoMethod.
I don't know exactly what it is but it must tell
that it has to create an object able to display
a Pharo method, by calling the Syntaxhighlighter or
something like this. And if I look at AST,
it returns
a tree,
it returns the AST which will be displayed in the tree.
The aim is not for you to understand precisely
how it works, it is to show you a little bit
the complexity of this thing.
You see that in general it is not very complicated.
Here, it is for the Bytecode, the IR is something else.
Besides, there is job-related logic inside because you
have to think about how you compute the intermediary
representation, etc. But it is still something manageable.
I wanted to show you this because it is nice, you
can sometimes do it on your job-related objects and
it enables you to go faster.