Re: [Pharo-users] Adding method to class

2014-07-18 Thread Guillermo Polito
But wait. What happens here is that we are mixing concepts.

1) On one side, there is Pharo's class model (the one we program with) =>
classes, metaclasses, methods. Let's call them the *real* classes and
methods. So if you want to add a method to your *real* class, you usually
have to

 - compile a method
 - add it to the method dictionary of the class

There are some helper methods that do all the work in one step, as
mentioned by Esteban:

myClass compile: someCode classified: aProtocolName.


That, is what happens when you use the browser (Nautilus in our case).


2) On the other side, there is the Refactoring browser framework (that is,
all classes prefixed as RB (except the AST nodes now)). The refactoring
browser implements refactorings (renames of classes and methods, pushing
up/down instance variables in a hierarchy, extracting methods into
classes). Of course, to apply these refactoring it uses the model and API's
provided by 1). But it's a completely different monster.

That means, adding a RBMethod in a RBClass does not mean that you are
adding a *real* method into a *real* class. That will not happen unless
that change is inside a refactoring and you apply the refactoring.



On Fri, Jul 18, 2014 at 3:43 AM, Ben Coman  wrote:

>  This might be a good example to add to Deep Into Pharo (but I haven't
> read it yet, so its too much for me right now to work out where it should
> go).  Anyone interested in doing this? Otherwise maybe I could drop it into
> a scratchpad at the back of the book.
> cheers -ben
>
>
> Hernán Morales Durand wrote:
>
>  Yes you need it because when doing code generation you cannot always
> assume target class is present. Besides using RB you can confirm through
> the NautilusRefactoring which is useful for massive changes:
>
> | model |
> model := RBNamespace new.
> (model classNamed: #Model)
> compile: 'asString ^ String empty'
> classified: #(accessing).
> (ChangesBrowser changes: model changes changes) openWithSpec
>
>  Cheers,
>
> Hernán
>
>
> 2014-07-17 13:55 GMT-03:00 Esteban Lorenzano :
>
>>  Hi,
>>
>>  you do not need the RBNamespace mediation, just do:
>>
>>  Model compile: ‘method ...’ classified: ‘accessing’.
>>
>>  Esteban
>>
>>  On 17 Jul 2014, at 18:52, Mark Rizun  wrote:
>>
>>  Thanks Hernan
>> 17 лип. 2014 18:29, користувач "Hernán Morales Durand" <
>> hernan.mora...@gmail.com> написав:
>>
>>>   No. Adding a method is not a refactoring. You should use
>>> RBAddMethodChange:
>>>
>>>  | model |
>>> model := RBNamespace new.
>>> (model classNamed: #Model)
>>> compile: 'asString ^ String empty'
>>> classified: #(accessing).
>>> model changes execute.
>>>
>>>  and the new method is recorded in the .changes file
>>>
>>>  Cheers,
>>>
>>> Hernán
>>>
>>>
>>>
>>> 2014-07-17 11:08 GMT-03:00 Mark Rizun :
>>>
 Thank you all. Problem is solved, I just used RBAddMethodRefactoring.

  Mark


 2014-07-17 16:07 GMT+02:00 Baptiste Quide :

  I think you have to add a "RGMethodDefinition" or a "CompiledMethod".
> Obviously in a class methodDict the values are CompiledMethod.
>
>  Regards,
>
>  --
>
> *De: *"Sebastian Tleye" 
> *À: *"Any question about pharo is welcome" <
> pharo-users@lists.pharo.org>
> *Envoyé: *Jeudi 17 Juillet 2014 16:03:52
> *Objet: *Re: [Pharo-users] Adding method to class
>
>
>  I don't know what RBMethod is, but you can do
>
>  aClass compile: source.
>
>  For example:
>
>  Array compile: 'newMethod ^ 1'
>
>  I don't know if it answers your question.
>
>  Regards
>
>
>
>
>  2014-07-17 15:57 GMT+02:00 Mark Rizun :
>
>> P.S. obviously, my method is added to newMethods var, but it is not
>> disblayed in my class.
>>
>>
>>  2014-07-17 15:53 GMT+02:00 Mark Rizun :
>>
>> Hi guys!
>>>
>>> How can I add method (I have /RBMethod/) to a class in code?
>>> I'm asking because existing method /addMethod:/ in /RBAbstractClass/
>>> isn't
>>> working.
>>> Here is a piece of my code:
>>>
>>> /method:= RBMethod for: class source: ('^ ', newName asString)
>>> selector:
>>> newName asSymbol.
>>> class addMethod: getter./
>>>
>>> Best
>>> Mark
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://forum.world.st/Adding-method-to-class-tp4768282.html
>>> Sent from the Pharo Smalltalk Users mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
>
>

>>>
>>
>
>


Re: [Pharo-users] Adding method to class

2014-07-18 Thread Esteban Lorenzano
also you will still have an error if using the RBNamespace instead the direct 
method invocation, if class does not exist. 
So… I stand with my opinion :)

If you want to control existence, you could do something like this: 

#Model asClassIfPresent: [ :class | 
class compile: 'asString ^ String empty'  classified: #accessing ]

Esteban

On 18 Jul 2014, at 11:19, Guillermo Polito  wrote:

> But wait. What happens here is that we are mixing concepts.
> 
> 1) On one side, there is Pharo's class model (the one we program with) => 
> classes, metaclasses, methods. Let's call them the *real* classes and 
> methods. So if you want to add a method to your *real* class, you usually 
> have to
> 
>  - compile a method
>  - add it to the method dictionary of the class
> 
> There are some helper methods that do all the work in one step, as mentioned 
> by Esteban:
> 
> myClass compile: someCode classified: aProtocolName.
> 
> That, is what happens when you use the browser (Nautilus in our case).
> 
> 
> 2) On the other side, there is the Refactoring browser framework (that is, 
> all classes prefixed as RB (except the AST nodes now)). The refactoring 
> browser implements refactorings (renames of classes and methods, pushing 
> up/down instance variables in a hierarchy, extracting methods into classes). 
> Of course, to apply these refactoring it uses the model and API's provided by 
> 1). But it's a completely different monster.
> 
> That means, adding a RBMethod in a RBClass does not mean that you are adding 
> a *real* method into a *real* class. That will not happen unless that change 
> is inside a refactoring and you apply the refactoring.
> 
> 
> 
> On Fri, Jul 18, 2014 at 3:43 AM, Ben Coman  wrote:
> This might be a good example to add to Deep Into Pharo (but I haven't read it 
> yet, so its too much for me right now to work out where it should go).  
> Anyone interested in doing this? Otherwise maybe I could drop it into a 
> scratchpad at the back of the book.
> cheers -ben
> 
> 
> Hernán Morales Durand wrote:
>> 
>> Yes you need it because when doing code generation you cannot always assume 
>> target class is present. Besides using RB you can confirm through the 
>> NautilusRefactoring which is useful for massive changes:
>> 
>> | model |
>> model := RBNamespace new.
>> (model classNamed: #Model)
>> compile: 'asString ^ String empty'
>> classified: #(accessing).
>> (ChangesBrowser changes: model changes changes) openWithSpec 
>> 
>> Cheers,
>> 
>> Hernán
>> 
>> 
>> 2014-07-17 13:55 GMT-03:00 Esteban Lorenzano :
>> Hi,
>> 
>> you do not need the RBNamespace mediation, just do:
>> 
>> Model compile: ‘method ...’ classified: ‘accessing’. 
>> 
>> Esteban
>> 
>> On 17 Jul 2014, at 18:52, Mark Rizun  wrote:
>> 
>>> Thanks Hernan
>>> 
>>> 17 лип. 2014 18:29, користувач "Hernán Morales Durand" 
>>>  написав:
>>> No. Adding a method is not a refactoring. You should use RBAddMethodChange:
>>> 
>>> | model |
>>> model := RBNamespace new.
>>> (model classNamed: #Model)
>>> compile: 'asString ^ String empty'
>>> classified: #(accessing).
>>> model changes execute.
>>> 
>>> and the new method is recorded in the .changes file
>>> 
>>> Cheers,
>>> 
>>> Hernán
>>> 
>>> 
>>> 
>>> 2014-07-17 11:08 GMT-03:00 Mark Rizun :
>>> Thank you all. Problem is solved, I just used RBAddMethodRefactoring.
>>> 
>>> Mark
>>> 
>>> 
>>> 2014-07-17 16:07 GMT+02:00 Baptiste Quide :
>>> 
>>> I think you have to add a "RGMethodDefinition" or a "CompiledMethod".
>>> Obviously in a class methodDict the values are CompiledMethod.
>>> 
>>> Regards,
>>> 
>>> De: "Sebastian Tleye" 
>>> À: "Any question about pharo is welcome" 
>>> Envoyé: Jeudi 17 Juillet 2014 16:03:52
>>> Objet: Re: [Pharo-users] Adding method to class
>>> 
>>> 
>>> I don't know what RBMethod is, but you can do 
>>> 
>>> aClass compile: source.
>>> 
>>> For example: 
>>> 
>>> Array compile: 'newMethod ^ 1'
>>> 
>>> I don't know if it answers your question.
>>> 
>>> Regards
>>> 
>>> 
>>> 
>>> 
>>> 2014-07-17 15:57 GMT+02:00 Mark Rizun :
>>> P.S. obviously, my method is added to newMethods var, but it is not 
>>> disblayed in my class.
>>> 
>>> 
>>> 2014-07-17 15:53 GMT+02:00 Mark Rizun :
>>> 
>>> Hi guys!
>>> 
>>> How can I add method (I have /RBMethod/) to a class in code?
>>> I'm asking because existing method /addMethod:/ in /RBAbstractClass/ isn't
>>> working.
>>> Here is a piece of my code:
>>> 
>>> /method:= RBMethod for: class source: ('^ ', newName asString) selector:
>>> newName asSymbol.
>>> class addMethod: getter./
>>> 
>>> Best
>>> Mark
>>> 
>>> 
>>> 
>>> --
>>> View this message in context: 
>>> http://forum.world.st/Adding-method-to-class-tp4768282.html
>>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 
> 



Re: [Pharo-users] Adding method to class

2014-07-18 Thread Mark Rizun
Thank you very much guys. I think, now I can understand what is going on
with method adding:)
Best,
Mark


2014-07-18 12:09 GMT+02:00 Esteban Lorenzano :

> also you will still have an error if using the RBNamespace instead the
> direct method invocation, if class does not exist.
> So… I stand with my opinion :)
>
> If you want to control existence, you could do something like this:
>
> #Model asClassIfPresent: [ :class |
> class compile: 'asString ^ String empty'  classified: #accessing ]
>
> Esteban
>
> On 18 Jul 2014, at 11:19, Guillermo Polito 
> wrote:
>
> But wait. What happens here is that we are mixing concepts.
>
> 1) On one side, there is Pharo's class model (the one we program with) =>
> classes, metaclasses, methods. Let's call them the *real* classes and
> methods. So if you want to add a method to your *real* class, you usually
> have to
>
>  - compile a method
>  - add it to the method dictionary of the class
>
> There are some helper methods that do all the work in one step, as
> mentioned by Esteban:
>
> myClass compile: someCode classified: aProtocolName.
>
>
> That, is what happens when you use the browser (Nautilus in our case).
>
>
> 2) On the other side, there is the Refactoring browser framework (that is,
> all classes prefixed as RB (except the AST nodes now)). The refactoring
> browser implements refactorings (renames of classes and methods, pushing
> up/down instance variables in a hierarchy, extracting methods into
> classes). Of course, to apply these refactoring it uses the model and API's
> provided by 1). But it's a completely different monster.
>
> That means, adding a RBMethod in a RBClass does not mean that you are
> adding a *real* method into a *real* class. That will not happen unless
> that change is inside a refactoring and you apply the refactoring.
>
>
>
> On Fri, Jul 18, 2014 at 3:43 AM, Ben Coman  wrote:
>
>>  This might be a good example to add to Deep Into Pharo (but I haven't
>> read it yet, so its too much for me right now to work out where it should
>> go).  Anyone interested in doing this? Otherwise maybe I could drop it into
>> a scratchpad at the back of the book.
>> cheers -ben
>>
>>
>> Hernán Morales Durand wrote:
>>
>>  Yes you need it because when doing code generation you cannot always
>> assume target class is present. Besides using RB you can confirm through
>> the NautilusRefactoring which is useful for massive changes:
>>
>> | model |
>> model := RBNamespace new.
>> (model classNamed: #Model)
>> compile: 'asString ^ String empty'
>> classified: #(accessing).
>> (ChangesBrowser changes: model changes changes) openWithSpec
>>
>>  Cheers,
>>
>> Hernán
>>
>>
>> 2014-07-17 13:55 GMT-03:00 Esteban Lorenzano :
>>
>>>  Hi,
>>>
>>>  you do not need the RBNamespace mediation, just do:
>>>
>>>  Model compile: ‘method ...’ classified: ‘accessing’.
>>>
>>>  Esteban
>>>
>>>  On 17 Jul 2014, at 18:52, Mark Rizun  wrote:
>>>
>>> Thanks Hernan
>>> 17 лип. 2014 18:29, користувач "Hernán Morales Durand" <
>>> hernan.mora...@gmail.com> написав:
>>>
   No. Adding a method is not a refactoring. You should use
 RBAddMethodChange:

  | model |
 model := RBNamespace new.
 (model classNamed: #Model)
 compile: 'asString ^ String empty'
 classified: #(accessing).
 model changes execute.

  and the new method is recorded in the .changes file

  Cheers,

 Hernán



 2014-07-17 11:08 GMT-03:00 Mark Rizun :

> Thank you all. Problem is solved, I just used RBAddMethodRefactoring.
>
>  Mark
>
>
> 2014-07-17 16:07 GMT+02:00 Baptiste Quide :
>
>  I think you have to add a "RGMethodDefinition" or a "CompiledMethod".
>> Obviously in a class methodDict the values are CompiledMethod.
>>
>>  Regards,
>>
>>  --
>>
>> *De: *"Sebastian Tleye" 
>> *À: *"Any question about pharo is welcome" <
>> pharo-users@lists.pharo.org>
>> *Envoyé: *Jeudi 17 Juillet 2014 16:03:52
>> *Objet: *Re: [Pharo-users] Adding method to class
>>
>>
>>  I don't know what RBMethod is, but you can do
>>
>>  aClass compile: source.
>>
>>  For example:
>>
>>  Array compile: 'newMethod ^ 1'
>>
>>  I don't know if it answers your question.
>>
>>  Regards
>>
>>
>>
>>
>>  2014-07-17 15:57 GMT+02:00 Mark Rizun :
>>
>>> P.S. obviously, my method is added to newMethods var, but it is not
>>> disblayed in my class.
>>>
>>>
>>>  2014-07-17 15:53 GMT+02:00 Mark Rizun :
>>>
>>> Hi guys!

 How can I add method (I have /RBMethod/) to a class in code?
 I'm asking because existing method /addMethod:/ in
 /RBAbstractClass/ isn't
 working.
 Here is a piece of my code:

 /method:= RBMethod for: class source: ('^ ', newName asString)
 selector:
 newName asSymbol.

Re: [Pharo-users] Package Dependencies Analyzer

2014-07-18 Thread stepharo
I installed and after I do not see a menu in the Tools submenu or 
anywhere to open your tool and I want to use it :)


On 15/7/14 11:52, Baptiste Quidé wrote:

Stef,

please would like to explain how the problem appeared when you loaded 
the tool via the metacello browser?


Thanks!

/*Baptiste QUIDÉ*
/
/Étudiant ingénieur
/
/Polytech Lille
Département Informatique et Statistique
(+33)6 21 69 20 09 
/



2014-07-14 15:23 GMT+02:00 stepharo >:


thanks baptiste

I will try it on polymorph :)

Stef


On 12/7/14 12:34, Baptiste Quidé wrote:


Hi Stef,

I think it's not normal. I will fix it when I will be at home or
work. Try the gofer script and everything should be ok

Le 12 juil. 2014 12:26, "stepharo" mailto:steph...@free.fr>> a écrit :

Hi baptiste

I loaded your tools via the metacello browser in Pharo40 but
I do not get a menu to invoke it.
Is it normal?

Stef

On 11/7/14 18:42, Baptiste Quidé wrote:

Hello Pharo users,

let me introduce a new tool that I developed in the RMOD
team: package dependencies analyzer.

This project provides a tool able to analyze Smalltalk
project packages and detect dependencies to other
packages. It enables automatic dependency analysis to
detect wrong project description (declared dependencies).
It's very easy to use and i hope it will be helpful
during your development time.

As soon as possible, a next version will enable to detect
cycle dependencies among packages.

The description of the project is on this web-page :
http://www.baptistequide.fr/packagedependencies.php
It's already available on the Configuration Browser on Pharo.

Your feedback and suggestions are mostly welcome to
improve this project. I invite you to test the tool.

Cheers,

Baptiste











Re: [Pharo-users] Package Dependencies Analyzer

2014-07-18 Thread Baptiste Quide
It's normal the tool can be used only via the Nautilus Browser. 
Select your packages by highlighting them on Nautilis, right click and you can 
find "Browse dependencies..." in the contextual menu. 

However I think it's a good idea to access the tool via Tools submenu by this 
way : displaying all the packages in the system, select them and run. 
We should discuss about this point. 

- Mail original -

> De: "stepharo" 
> À: "Any question about pharo is welcome" 
> Envoyé: Vendredi 18 Juillet 2014 13:57:33
> Objet: Re: [Pharo-users] Package Dependencies Analyzer

> I installed and after I do not see a menu in the Tools submenu or anywhere to
> open your tool and I want to use it :)

> On 15/7/14 11:52, Baptiste Quidé wrote:

> > Stef,
> 

> > please would like to explain how the problem appeared when you loaded the
> > tool via the metacello browser?
> 

> > Thanks!
> 

> > Baptiste QUIDÉ
> 
> > Étudiant ingénieur
> 
> > Polytech Lille
> 
> > Département Informatique et Statistique
> 
> > (+33)6 21 69 20 09
> 

> > 2014-07-14 15:23 GMT+02:00 stepharo < steph...@free.fr > :
> 

> > > thanks baptiste
> > 
> 

> > > I will try it on polymorph :)
> > 
> 

> > > Stef
> > 
> 

> > > On 12/7/14 12:34, Baptiste Quidé wrote:
> > 
> 

> > > > Hi Stef,
> > > 
> > 
> 

> > > > I think it's not normal. I will fix it when I will be at home or work.
> > > > Try
> > > > the gofer script and everything should be ok
> > > 
> > 
> 
> > > > Le 12 juil. 2014 12:26, "stepharo" < steph...@free.fr > a écrit :
> > > 
> > 
> 

> > > > > Hi baptiste
> > > > 
> > > 
> > 
> 

> > > > > I loaded your tools via the metacello browser in Pharo40 but I do not
> > > > > get
> > > > > a
> > > > > menu to invoke it.
> > > > 
> > > 
> > 
> 
> > > > > Is it normal?
> > > > 
> > > 
> > 
> 

> > > > > Stef
> > > > 
> > > 
> > 
> 

> > > > > On 11/7/14 18:42, Baptiste Quidé wrote:
> > > > 
> > > 
> > 
> 

> > > > > > Hello Pharo users,
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > let me introduce a new tool that I developed in the RMOD team:
> > > > > > package
> > > > > > dependencies analyzer.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > This project provides a tool able to analyze Smalltalk project
> > > > > > packages
> > > > > > and
> > > > > > detect dependencies to other packages. It enables automatic
> > > > > > dependency
> > > > > > analysis to detect wrong project description (declared
> > > > > > dependencies).
> > > > > > It's
> > > > > > very easy to use and i hope it will be helpful during your
> > > > > > development
> > > > > > time.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > As soon as possible, a next version will enable to detect cycle
> > > > > > dependencies
> > > > > > among packages.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > The description of the project is on this web-page :
> > > > > > http://www.baptistequide.fr/packagedependencies.php
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > It's already available on the Configuration Browser on Pharo.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > Your feedback and suggestions are mostly welcome to improve this
> > > > > > project.
> > > > > > I
> > > > > > invite you to test the tool.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > Cheers,
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > Baptiste
> > > > > 
> > > > 
> > > 
> > 
> 


[Pharo-users] Roassal Tip #9: How to adjust edge transparency with moose hovering?

2014-07-18 Thread Alexandre Bergel
[ meta comment: We regularly publish in our Facebook and twitter some tips 
about Roassal. I am wondering whether you guys will be happy to see it in the 
pharo-users mailing list. Is this something you would like to see? Please help 
us adjusting our documentation effort ]

Here is a new tip:

Roassal Tip #9: How to adjust edge transparency with moose hovering? 

https://upload.facebook.com/ObjectProfile/photos/a.341189379300999.82969.340543479365589/667332073353393/?type=1

Cheers,
Alexandre

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






[Pharo-users] Tree/Outliners of playgrounds, markdown inside comments and some quick medium size dreams for Pharo/Smalltalk

2014-07-18 Thread Offray Vladimir Luna Cárdenas

Hi,

As I said, I have trying to find my way to keep Pharo relevant in my 
computing experience. Most of it happens on IPython/web2py for 
practical/aesthetic reasons, but I think that things with Roassal, Moose 
and Pharo are falling into place with data Narratives and visualization 
(on [1] and [2] I have writing some examples/details).


[1] 
http://mutabit.com/offray/static/blog/output/posts/pharo-by-visualization.html
[2] 
http://mutabit.com/offray/static/blog/output/posts/borrachos-bochinche-futbol.html 



I'm a newbie on Smalltalk/Pharo but I would like to start with practical 
examples from my own needs, so I have started with my idea of making an 
outliner/tree of playgrounds. For the moment I'm reading/learning with 
Deep Into Pharo and the chapter on Glamour (which by the way is a really 
good book) and after I finished with the examples in the doc, I would 
like to start trying to write my own outliner.


The first idea that comes to mind is using STON for storage nodes and 
tree information, so I can interchange it with the flatland files world 
and keep it readable. Sounds that reasonable?


The second thing I would like to do is to add pandoc's markdown inside 
comments, but I don't like the syntax of comments in Smalltalk because 
single quotes are fairly easy to find in light markup language like 
markdown. Is difficult to change it to create something more like python 
(with """) or Lua (with -[]- )?


The last thing I would like to quick mention that I think that there is 
a place for a light/live Open Notebook environment for Open/Garage 
Science and Data Visualization made in Pharo Smalltalk and 
Trees/Outliners of Playgrounds could be the emergent way to explore that 
space and I would like to help with that, even being a newbie. I think 
that is a place I can be comfortable and write/teach about in my blog 
and local hackerspace, so any idea or guidance about how to proceed 
would be greatly appreciated.


I will keep you posted this time (seriously!)

Cheers,

Offray