Re: [Pharo-users] [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

2014-10-22 Thread Tudor Girba
You are welcome. You should expect more in this direction.

Doru

On Wed, Oct 22, 2014 at 11:02 AM, kilon alios kilon.al...@gmail.com wrote:

 very good feature that I was completely unaware of. I have actually
 examples in my Ephestos project that are at class side but I use ex instead
 of example. This will come very handy for my users thanks :)

 On Wed, Oct 22, 2014 at 11:43 AM, Tudor Girba tu...@tudorgirba.com
 wrote:

 Hi Torsten,

 Thanks for this. This is indeed the way to go.

 Just to let you know, the example infrastructure is also being developed
 in the context of GT, so we have a healthy interest overlap which is great.
 Only in our case, the discovery of the example happens through an example
 pragma. Would it be possible to change your slice to use this pragma
 instead of the example* convention?

 Cheers,
 Doru



 On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann asta...@gmx.de wrote:

 One addition I implemented for Nautilus is that one can run examples
 directly
 in the browser just by clicking on class side example methods icons.

 See
 https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus
 for a picture.


 SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON THE
 CLASS SIDE
AND LET THE SELECTOR START WITH example.

 This way people will easily see that it is an example and can run them.
 Additionally it
 would help to put them into a category like examples. So be a good
 citized and
 provide not only class comments but also examples for others to study.


 Side note:
 ==
 It is also possible to click on the icon of class side initialize
 methods so the
 class get reinitialized (after a confirmation to avoid false clicking).


 https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus

 Both issues are already integrated.




 --
 www.tudorgirba.com

 Every thing has its own flow





-- 
www.tudorgirba.com

Every thing has its own flow


Re: [Pharo-users] [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

2014-10-22 Thread Torsten Bergmann
Hi Tudor,

that should be easy now: look at CompiledMethod#isExampleMethod which can be 
adopted as needed.

Checking for the example pragma could be done this way:

   self pragmas anySatisfy: [:pragma | pragma keyword = #example ]

but we should think first if this is enough.

I already proposed to not only annotate with a pragma example but 
additionally give a category.
Like this:

   example: 'Graphics'
   example: 'Network'

This way we can easily build an example browser for our users where people can 
go through
their point of interest and browse the examples.

Maybe we should also rethink pragmas (in Pharo 5.0?) in general to be more 
Smalltalk 
like:
 
   Example category: 'Graphics'

where Example is a real class in the system (!). One can even make it more 
explicit 
then 

   ExampleCategory graphics

with ExampleCategory(class)graphics returning a translateable string. People 
can add
own categories and one easily knows about already available ones.


Now that classes can have properties in Pharo 4.0 already I would like to see a 
unification
for methods and classes here (with the general concept of an Annotation in 
our metamodel). 

In my opinion a method pragma is just a special form of annotating a method. 

And annotating classes is usefull as well (for instance you want to annotate a 
class with
the appropriate Table name in an ORM framework, ...)

A comment (in a method or in a class) is also nothing more than a special 
annotation.
A class/method category is also an annotation. If unified a method or a class 
could
be in one or more categories. Even a break point for an expression is IMHO just 
an 
annotation.   

Bye
T.


Gesendet: Mittwoch, 22. Oktober 2014 um 10:43 Uhr
Von: Tudor Girba tu...@tudorgirba.com
An: Pharo Development List pharo-...@lists.pharo.org
Cc: Any question about pharo is welcome pharo-users@lists.pharo.org
Betreff: Re: [Pharo-dev] Clickable class side example and initialize methods in 
Pharo 4.0

Hi Torsten,
 
Thanks for this. This is indeed the way to go.
 
Just to let you know, the example infrastructure is also being developed in the 
context of GT, so we have a healthy interest overlap which is great. Only in 
our case, the discovery of the example happens through an example pragma. 
Would it be possible to change your slice to use this pragma instead of the 
example* convention?
 
Cheers,
Doru
 
 
 
On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann asta...@gmx.de wrote:One 
addition I implemented for Nautilus is that one can run examples directly
in the browser just by clicking on class side example methods icons.

See 
https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus]
for a picture.


SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON THE CLASS 
SIDE
           AND LET THE SELECTOR START WITH example.

This way people will easily see that it is an example and can run them. 
Additionally it
would help to put them into a category like examples. So be a good citized and
provide not only class comments but also examples for others to study.


Side note:
==
It is also possible to click on the icon of class side initialize methods so the
class get reinitialized (after a confirmation to avoid false clicking).

https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus]

Both issues are already integrated.
  
 --
www.tudorgirba.com[http://www.tudorgirba.com]
 
Every thing has its own flow



Re: [Pharo-users] [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

2014-10-22 Thread Alexandre Bergel
Hi!

I have doubt that #example: will be enough in the case of Roassal. 
Having a code example browser is indeed important and having a descent way to 
search for the examples is also important. I am thinking to stick to #example 
and infer some categories from the source code (e.g., if the method contains a 
Zinc class, then it may be categorized in network).


Cheers,
Alexandre

 Le 22-10-2014 à 7:38, Torsten Bergmann asta...@gmx.de a écrit :
 
 Hi Tudor,
 
 that should be easy now: look at CompiledMethod#isExampleMethod which can 
 be adopted as needed.
 
 Checking for the example pragma could be done this way:
 
   self pragmas anySatisfy: [:pragma | pragma keyword = #example ]
 
 but we should think first if this is enough.
 
 I already proposed to not only annotate with a pragma example but 
 additionally give a category.
 Like this:
 
   example: 'Graphics'
   example: 'Network'
 
 This way we can easily build an example browser for our users where people 
 can go through
 their point of interest and browse the examples.
 
 Maybe we should also rethink pragmas (in Pharo 5.0?) in general to be more 
 Smalltalk 
 like:
  
   Example category: 'Graphics'
 
 where Example is a real class in the system (!). One can even make it more 
 explicit 
 then 
 
   ExampleCategory graphics
 
 with ExampleCategory(class)graphics returning a translateable string. 
 People can add
 own categories and one easily knows about already available ones.
 
 
 Now that classes can have properties in Pharo 4.0 already I would like to see 
 a unification
 for methods and classes here (with the general concept of an Annotation in 
 our metamodel). 
 
 In my opinion a method pragma is just a special form of annotating a method. 
 
 And annotating classes is usefull as well (for instance you want to annotate 
 a class with
 the appropriate Table name in an ORM framework, ...)
 
 A comment (in a method or in a class) is also nothing more than a special 
 annotation.
 A class/method category is also an annotation. If unified a method or a class 
 could
 be in one or more categories. Even a break point for an expression is IMHO 
 just an 
 annotation.   
 
 Bye
 T.
 
 
 Gesendet: Mittwoch, 22. Oktober 2014 um 10:43 Uhr
 Von: Tudor Girba tu...@tudorgirba.com
 An: Pharo Development List pharo-...@lists.pharo.org
 Cc: Any question about pharo is welcome pharo-users@lists.pharo.org
 Betreff: Re: [Pharo-dev] Clickable class side example and initialize methods 
 in Pharo 4.0
 
 Hi Torsten,
  
 Thanks for this. This is indeed the way to go.
  
 Just to let you know, the example infrastructure is also being developed in 
 the context of GT, so we have a healthy interest overlap which is great. Only 
 in our case, the discovery of the example happens through an example 
 pragma. Would it be possible to change your slice to use this pragma instead 
 of the example* convention?
  
 Cheers,
 Doru
  
  
  
 On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann asta...@gmx.de wrote:One 
 addition I implemented for Nautilus is that one can run examples directly
 in the browser just by clicking on class side example methods icons.
 
 See 
 https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus]
 for a picture.
 
 
 SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON THE CLASS 
 SIDE
AND LET THE SELECTOR START WITH example.
 
 This way people will easily see that it is an example and can run them. 
 Additionally it
 would help to put them into a category like examples. So be a good citized 
 and
 provide not only class comments but also examples for others to study.
 
 
 Side note:
 ==
 It is also possible to click on the icon of class side initialize methods so 
 the
 class get reinitialized (after a confirmation to avoid false clicking).
 
 https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus]
 
 Both issues are already integrated.
   
  --
 www.tudorgirba.com[http://www.tudorgirba.com]
  
 Every thing has its own flow
 



Re: [Pharo-users] [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

2014-10-22 Thread Thierry Goubier

Hi all,

by principle, I'd be against extending so much the pragmas... from a 
design point of view they look like #defines and macros, that is an 
additional language to learn, without a correct support of the tools (no 
debug on pragmas, non-obvious behavior triggers, search for pragma users 
difficult, not documented).


Alexandre, your idea of infering properties from the source code looks a 
lot more interesting (and with a lot more potential).


Thierry

Le 22/10/2014 19:38, Alexandre Bergel a écrit :

Hi!

I have doubt that #example: will be enough in the case of Roassal.
Having a code example browser is indeed important and having a descent way to 
search for the examples is also important. I am thinking to stick to #example 
and infer some categories from the source code (e.g., if the method contains a 
Zinc class, then it may be categorized in network).


Cheers,
Alexandre


Le 22-10-2014 à 7:38, Torsten Bergmann asta...@gmx.de a écrit :

Hi Tudor,

that should be easy now: look at CompiledMethod#isExampleMethod which can be 
adopted as needed.

Checking for the example pragma could be done this way:

   self pragmas anySatisfy: [:pragma | pragma keyword = #example ]

but we should think first if this is enough.

I already proposed to not only annotate with a pragma example but 
additionally give a category.
Like this:

   example: 'Graphics'
   example: 'Network'

This way we can easily build an example browser for our users where people can 
go through
their point of interest and browse the examples.

Maybe we should also rethink pragmas (in Pharo 5.0?) in general to be more 
Smalltalk
like:

   Example category: 'Graphics'

where Example is a real class in the system (!). One can even make it more 
explicit
then

   ExampleCategory graphics

with ExampleCategory(class)graphics returning a translateable string. People 
can add
own categories and one easily knows about already available ones.


Now that classes can have properties in Pharo 4.0 already I would like to see a 
unification
for methods and classes here (with the general concept of an Annotation in 
our metamodel).

In my opinion a method pragma is just a special form of annotating a method.

And annotating classes is usefull as well (for instance you want to annotate a 
class with
the appropriate Table name in an ORM framework, ...)

A comment (in a method or in a class) is also nothing more than a special 
annotation.
A class/method category is also an annotation. If unified a method or a class 
could
be in one or more categories. Even a break point for an expression is IMHO just 
an
annotation.

Bye
T.


Gesendet: Mittwoch, 22. Oktober 2014 um 10:43 Uhr
Von: Tudor Girba tu...@tudorgirba.com
An: Pharo Development List pharo-...@lists.pharo.org
Cc: Any question about pharo is welcome pharo-users@lists.pharo.org
Betreff: Re: [Pharo-dev] Clickable class side example and initialize methods in 
Pharo 4.0

Hi Torsten,

Thanks for this. This is indeed the way to go.

Just to let you know, the example infrastructure is also being developed in the 
context of GT, so we have a healthy interest overlap which is great. Only in our 
case, the discovery of the example happens through an example pragma. Would 
it be possible to change your slice to use this pragma instead of the example* 
convention?

Cheers,
Doru



On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann asta...@gmx.de wrote:One 
addition I implemented for Nautilus is that one can run examples directly
in the browser just by clicking on class side example methods icons.

See 
https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus]
for a picture.


SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON THE CLASS 
SIDE
AND LET THE SELECTOR START WITH example.

This way people will easily see that it is an example and can run them. 
Additionally it
would help to put them into a category like examples. So be a good citized and
provide not only class comments but also examples for others to study.


Side note:
==
It is also possible to click on the icon of class side initialize methods so the
class get reinitialized (after a confirmation to avoid false clicking).

https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus]

Both issues are already integrated.

  --
www.tudorgirba.com[http://www.tudorgirba.com]

Every thing has its own flow










Re: [Pharo-users] [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

2014-10-22 Thread Alexandre Bergel
I am also not a big fan of using pragmas. To me, it looks like an ad hoc 
approach to have examples close to the class. In the same spirit: Why not 
having tests in the same class? Would it not be cool? Of course not. 
In Roassal we have a class for examples (similar to TestCase). 

Alexandre

 Le 22-10-2014 à 14:51, Thierry Goubier thierry.goub...@gmail.com a écrit :
 
 Hi all,
 
 by principle, I'd be against extending so much the pragmas... from a design 
 point of view they look like #defines and macros, that is an additional 
 language to learn, without a correct support of the tools (no debug on 
 pragmas, non-obvious behavior triggers, search for pragma users difficult, 
 not documented).
 
 Alexandre, your idea of infering properties from the source code looks a lot 
 more interesting (and with a lot more potential).
 
 Thierry
 
 Le 22/10/2014 19:38, Alexandre Bergel a écrit :
 Hi!
 
 I have doubt that #example: will be enough in the case of Roassal.
 Having a code example browser is indeed important and having a descent way 
 to search for the examples is also important. I am thinking to stick to 
 #example and infer some categories from the source code (e.g., if the method 
 contains a Zinc class, then it may be categorized in network).
 
 
 Cheers,
 Alexandre
 
 Le 22-10-2014 à 7:38, Torsten Bergmann asta...@gmx.de a écrit :
 
 Hi Tudor,
 
 that should be easy now: look at CompiledMethod#isExampleMethod which can 
 be adopted as needed.
 
 Checking for the example pragma could be done this way:
 
   self pragmas anySatisfy: [:pragma | pragma keyword = #example ]
 
 but we should think first if this is enough.
 
 I already proposed to not only annotate with a pragma example but 
 additionally give a category.
 Like this:
 
   example: 'Graphics'
   example: 'Network'
 
 This way we can easily build an example browser for our users where people 
 can go through
 their point of interest and browse the examples.
 
 Maybe we should also rethink pragmas (in Pharo 5.0?) in general to be more 
 Smalltalk
 like:
 
   Example category: 'Graphics'
 
 where Example is a real class in the system (!). One can even make it more 
 explicit
 then
 
   ExampleCategory graphics
 
 with ExampleCategory(class)graphics returning a translateable string. 
 People can add
 own categories and one easily knows about already available ones.
 
 
 Now that classes can have properties in Pharo 4.0 already I would like to 
 see a unification
 for methods and classes here (with the general concept of an Annotation 
 in our metamodel).
 
 In my opinion a method pragma is just a special form of annotating a method.
 
 And annotating classes is usefull as well (for instance you want to 
 annotate a class with
 the appropriate Table name in an ORM framework, ...)
 
 A comment (in a method or in a class) is also nothing more than a special 
 annotation.
 A class/method category is also an annotation. If unified a method or a 
 class could
 be in one or more categories. Even a break point for an expression is IMHO 
 just an
 annotation.
 
 Bye
 T.
 
 
 Gesendet: Mittwoch, 22. Oktober 2014 um 10:43 Uhr
 Von: Tudor Girba tu...@tudorgirba.com
 An: Pharo Development List pharo-...@lists.pharo.org
 Cc: Any question about pharo is welcome pharo-users@lists.pharo.org
 Betreff: Re: [Pharo-dev] Clickable class side example and initialize 
 methods in Pharo 4.0
 
 Hi Torsten,
 
 Thanks for this. This is indeed the way to go.
 
 Just to let you know, the example infrastructure is also being developed in 
 the context of GT, so we have a healthy interest overlap which is great. 
 Only in our case, the discovery of the example happens through an example 
 pragma. Would it be possible to change your slice to use this pragma 
 instead of the example* convention?
 
 Cheers,
 Doru
 
 
 
 On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann asta...@gmx.de 
 wrote:One addition I implemented for Nautilus is that one can run examples 
 directly
 in the browser just by clicking on class side example methods icons.
 
 See 
 https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus]
 for a picture.
 
 
 SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON THE 
 CLASS SIDE
AND LET THE SELECTOR START WITH example.
 
 This way people will easily see that it is an example and can run them. 
 Additionally it
 would help to put them into a category like examples. So be a good 
 citized and
 provide not only class comments but also examples for others to study.
 
 
 Side note:
 ==
 It is also possible to click on the icon of class side initialize methods 
 so the
 class get reinitialized (after a confirmation to avoid false clicking).
 
 

Re: [Pharo-users] [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

2014-10-22 Thread stepharo

I agree with Thierry but I disagree with Alex :)
What is cool is that when you browse a widget class that you get all the 
examples for this class.


Stef

I am also not a big fan of using pragmas. To me, it looks like an ad hoc 
approach to have examples close to the class. In the same spirit: Why not 
having tests in the same class? Would it not be cool? Of course not.
In Roassal we have a class for examples (similar to TestCase).

Alexandre


Le 22-10-2014 à 14:51, Thierry Goubier thierry.goub...@gmail.com a écrit :

Hi all,

by principle, I'd be against extending so much the pragmas... from a design 
point of view they look like #defines and macros, that is an additional 
language to learn, without a correct support of the tools (no debug on pragmas, 
non-obvious behavior triggers, search for pragma users difficult, not 
documented).

Alexandre, your idea of infering properties from the source code looks a lot 
more interesting (and with a lot more potential).

Thierry

Le 22/10/2014 19:38, Alexandre Bergel a écrit :

Hi!

I have doubt that #example: will be enough in the case of Roassal.
Having a code example browser is indeed important and having a descent way to 
search for the examples is also important. I am thinking to stick to #example 
and infer some categories from the source code (e.g., if the method contains a 
Zinc class, then it may be categorized in network).


Cheers,
Alexandre


Le 22-10-2014 à 7:38, Torsten Bergmann asta...@gmx.de a écrit :

Hi Tudor,

that should be easy now: look at CompiledMethod#isExampleMethod which can be 
adopted as needed.

Checking for the example pragma could be done this way:

   self pragmas anySatisfy: [:pragma | pragma keyword = #example ]

but we should think first if this is enough.

I already proposed to not only annotate with a pragma example but 
additionally give a category.
Like this:

   example: 'Graphics'
   example: 'Network'

This way we can easily build an example browser for our users where people can 
go through
their point of interest and browse the examples.

Maybe we should also rethink pragmas (in Pharo 5.0?) in general to be more 
Smalltalk
like:

   Example category: 'Graphics'

where Example is a real class in the system (!). One can even make it more 
explicit
then

   ExampleCategory graphics

with ExampleCategory(class)graphics returning a translateable string. People 
can add
own categories and one easily knows about already available ones.


Now that classes can have properties in Pharo 4.0 already I would like to see a 
unification
for methods and classes here (with the general concept of an Annotation in 
our metamodel).

In my opinion a method pragma is just a special form of annotating a method.

And annotating classes is usefull as well (for instance you want to annotate a 
class with
the appropriate Table name in an ORM framework, ...)

A comment (in a method or in a class) is also nothing more than a special 
annotation.
A class/method category is also an annotation. If unified a method or a class 
could
be in one or more categories. Even a break point for an expression is IMHO just 
an
annotation.

Bye
T.


Gesendet: Mittwoch, 22. Oktober 2014 um 10:43 Uhr
Von: Tudor Girba tu...@tudorgirba.com
An: Pharo Development List pharo-...@lists.pharo.org
Cc: Any question about pharo is welcome pharo-users@lists.pharo.org
Betreff: Re: [Pharo-dev] Clickable class side example and initialize methods in 
Pharo 4.0

Hi Torsten,

Thanks for this. This is indeed the way to go.

Just to let you know, the example infrastructure is also being developed in the 
context of GT, so we have a healthy interest overlap which is great. Only in our 
case, the discovery of the example happens through an example pragma. Would 
it be possible to change your slice to use this pragma instead of the example* 
convention?

Cheers,
Doru



On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann asta...@gmx.de wrote:One 
addition I implemented for Nautilus is that one can run examples directly
in the browser just by clicking on class side example methods icons.

See 
https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus]
for a picture.


SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON THE CLASS 
SIDE
AND LET THE SELECTOR START WITH example.

This way people will easily see that it is an example and can run them. 
Additionally it
would help to put them into a category like examples. So be a good citized and
provide not only class comments but also examples for others to study.


Side note:
==
It is also possible to click on the icon of class side initialize methods so the
class get reinitialized (after a confirmation to avoid false clicking).


Re: [Pharo-users] [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

2014-10-22 Thread Thierry Goubier

Le 22/10/2014 21:14, stepharo a écrit :

I agree with Thierry but I disagree with Alex :)
What is cool is that when you browse a widget class that you get all the
examples for this class.


I use browse class refs for that. Works on average pretty well; if it 
doesn't I throw away the code and reuse something else ;)


Thierry



Stef

I am also not a big fan of using pragmas. To me, it looks like an ad
hoc approach to have examples close to the class. In the same spirit:
Why not having tests in the same class? Would it not be cool? Of
course not.
In Roassal we have a class for examples (similar to TestCase).

Alexandre


Le 22-10-2014 à 14:51, Thierry Goubier thierry.goub...@gmail.com a
écrit :

Hi all,

by principle, I'd be against extending so much the pragmas... from a
design point of view they look like #defines and macros, that is an
additional language to learn, without a correct support of the tools
(no debug on pragmas, non-obvious behavior triggers, search for
pragma users difficult, not documented).

Alexandre, your idea of infering properties from the source code
looks a lot more interesting (and with a lot more potential).

Thierry

Le 22/10/2014 19:38, Alexandre Bergel a écrit :

Hi!

I have doubt that #example: will be enough in the case of Roassal.
Having a code example browser is indeed important and having a
descent way to search for the examples is also important. I am
thinking to stick to #example and infer some categories from the
source code (e.g., if the method contains a Zinc class, then it may
be categorized in network).


Cheers,
Alexandre


Le 22-10-2014 à 7:38, Torsten Bergmann asta...@gmx.de a écrit :

Hi Tudor,

that should be easy now: look at CompiledMethod#isExampleMethod
which can be adopted as needed.

Checking for the example pragma could be done this way:

   self pragmas anySatisfy: [:pragma | pragma keyword = #example ]

but we should think first if this is enough.

I already proposed to not only annotate with a pragma example but
additionally give a category.
Like this:

   example: 'Graphics'
   example: 'Network'

This way we can easily build an example browser for our users where
people can go through
their point of interest and browse the examples.

Maybe we should also rethink pragmas (in Pharo 5.0?) in general to
be more Smalltalk
like:

   Example category: 'Graphics'

where Example is a real class in the system (!). One can even make
it more explicit
then

   ExampleCategory graphics

with ExampleCategory(class)graphics returning a translateable
string. People can add
own categories and one easily knows about already available ones.


Now that classes can have properties in Pharo 4.0 already I would
like to see a unification
for methods and classes here (with the general concept of an
Annotation in our metamodel).

In my opinion a method pragma is just a special form of annotating
a method.

And annotating classes is usefull as well (for instance you want to
annotate a class with
the appropriate Table name in an ORM framework, ...)

A comment (in a method or in a class) is also nothing more than a
special annotation.
A class/method category is also an annotation. If unified a method
or a class could
be in one or more categories. Even a break point for an expression
is IMHO just an
annotation.

Bye
T.


Gesendet: Mittwoch, 22. Oktober 2014 um 10:43 Uhr
Von: Tudor Girba tu...@tudorgirba.com
An: Pharo Development List pharo-...@lists.pharo.org
Cc: Any question about pharo is welcome
pharo-users@lists.pharo.org
Betreff: Re: [Pharo-dev] Clickable class side example and
initialize methods in Pharo 4.0

Hi Torsten,

Thanks for this. This is indeed the way to go.

Just to let you know, the example infrastructure is also being
developed in the context of GT, so we have a healthy interest
overlap which is great. Only in our case, the discovery of the
example happens through an example pragma. Would it be possible
to change your slice to use this pragma instead of the example*
convention?

Cheers,
Doru



On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann asta...@gmx.de
wrote:One addition I implemented for Nautilus is that one can run
examples directly
in the browser just by clicking on class side example methods icons.

See
https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus]

for a picture.


SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON
THE CLASS SIDE
AND LET THE SELECTOR START WITH example.

This way people will easily see that it is an example and can run
them. Additionally it
would help to put them into a category like examples. So be a
good citized and
provide not only class comments but also examples for others to study.


Side note:
==
It is also possible to click on the icon of class side initialize
methods so the
class get reinitialized (after a confirmation to avoid false
clicking).


Re: [Pharo-users] [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

2014-10-22 Thread Tudor Girba
Hi,

I also disagree with Alex.

Examples will become tests (see the work of Markus Gaelli and Adrian Kuhn)
and they should be casually connected with the class and intention they
test or provide example for. The other thing is that examples should be
composable via code. And of course, they should be browsable.

They will be close to the class by default, but it does not mean that in
the class will be the only way. For example, we can well imagine having
helper classes for holding examples, but most classes would not need that I
think.

As for pragmas, they are a better mechanism for describing intent than a
method naming convention is. If nothing else, it lets us freedom in naming
the method.

It's true that at this point, pragmas are hard to browse, but this will not
remain like this for long :)

Cheers,
Doru


On Wed, Oct 22, 2014 at 9:14 PM, stepharo steph...@free.fr wrote:

 I agree with Thierry but I disagree with Alex :)
 What is cool is that when you browse a widget class that you get all the
 examples for this class.

 Stef

  I am also not a big fan of using pragmas. To me, it looks like an ad hoc
 approach to have examples close to the class. In the same spirit: Why not
 having tests in the same class? Would it not be cool? Of course not.
 In Roassal we have a class for examples (similar to TestCase).

 Alexandre

  Le 22-10-2014 à 14:51, Thierry Goubier thierry.goub...@gmail.com a
 écrit :

 Hi all,

 by principle, I'd be against extending so much the pragmas... from a
 design point of view they look like #defines and macros, that is an
 additional language to learn, without a correct support of the tools (no
 debug on pragmas, non-obvious behavior triggers, search for pragma users
 difficult, not documented).

 Alexandre, your idea of infering properties from the source code looks a
 lot more interesting (and with a lot more potential).

 Thierry

 Le 22/10/2014 19:38, Alexandre Bergel a écrit :

 Hi!

 I have doubt that #example: will be enough in the case of Roassal.
 Having a code example browser is indeed important and having a descent
 way to search for the examples is also important. I am thinking to stick to
 #example and infer some categories from the source code (e.g., if the
 method contains a Zinc class, then it may be categorized in network).


 Cheers,
 Alexandre

  Le 22-10-2014 à 7:38, Torsten Bergmann asta...@gmx.de a écrit :

 Hi Tudor,

 that should be easy now: look at CompiledMethod#isExampleMethod
 which can be adopted as needed.

 Checking for the example pragma could be done this way:

self pragmas anySatisfy: [:pragma | pragma keyword = #example ]

 but we should think first if this is enough.

 I already proposed to not only annotate with a pragma example but
 additionally give a category.
 Like this:

example: 'Graphics'
example: 'Network'

 This way we can easily build an example browser for our users where
 people can go through
 their point of interest and browse the examples.

 Maybe we should also rethink pragmas (in Pharo 5.0?) in general to be
 more Smalltalk
 like:

Example category: 'Graphics'

 where Example is a real class in the system (!). One can even make it
 more explicit
 then

ExampleCategory graphics

 with ExampleCategory(class)graphics returning a translateable
 string. People can add
 own categories and one easily knows about already available ones.


 Now that classes can have properties in Pharo 4.0 already I would like
 to see a unification
 for methods and classes here (with the general concept of an
 Annotation in our metamodel).

 In my opinion a method pragma is just a special form of annotating a
 method.

 And annotating classes is usefull as well (for instance you want to
 annotate a class with
 the appropriate Table name in an ORM framework, ...)

 A comment (in a method or in a class) is also nothing more than a
 special annotation.
 A class/method category is also an annotation. If unified a method or
 a class could
 be in one or more categories. Even a break point for an expression is
 IMHO just an
 annotation.

 Bye
 T.


 Gesendet: Mittwoch, 22. Oktober 2014 um 10:43 Uhr
 Von: Tudor Girba tu...@tudorgirba.com
 An: Pharo Development List pharo-...@lists.pharo.org
 Cc: Any question about pharo is welcome pharo-users@lists.pharo.org
 
 Betreff: Re: [Pharo-dev] Clickable class side example and initialize
 methods in Pharo 4.0

 Hi Torsten,

 Thanks for this. This is indeed the way to go.

 Just to let you know, the example infrastructure is also being
 developed in the context of GT, so we have a healthy interest overlap 
 which
 is great. Only in our case, the discovery of the example happens through 
 an
 example pragma. Would it be possible to change your slice to use this
 pragma instead of the example* convention?

 Cheers,
 Doru



 On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann asta...@gmx.de
 wrote:One addition I implemented for Nautilus is that one can run examples
 directly
 in the browser just by 

Re: [Pharo-users] [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

2014-10-22 Thread Thierry Goubier

Hi Doru,

Le 22/10/2014 23:03, Tudor Girba a écrit :

Hi,

As for pragmas, they are a better mechanism for describing intent than a
method naming convention is. If nothing else, it lets us freedom in
naming the method.


And they add another programming language on top of another, and in most 
cases are redundant with the method name and protocol.


i.e.

exampleThis has pragma example
testThat has pragma test

Simply because for the method name to be suitable, it has to convey 
intent one way or another.


I can understand if you come and tell me that the pragma is to annotate 
for stuff that the compiler can't deduce, such as the #openmp pragmas. 
But I can't say that bringing in that kind of stuff would mean progress ;)



It's true that at this point, pragmas are hard to browse, but this will
not remain like this for long :)


Tools may help to overcome limitations of pragmas, yes ;) But this 
sounds like because pragmas may not be that good to start with :)


Thierry