Having comments for pragma?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
42 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Having comments for pragma?

abergel
Hi!

A pragma may be very obscure. For example, I do: 
Pragma allInstances anyOne
=> <debuggerCompleteToSender>

If I want to know more about this <debuggerCompleteToSender> is actually quite challenging. 
I see many methods having that pragma, but not idea what it is for. 
I see that Halt>>signalerContext and Process>>complete: that use that pragma somehow. But still, I have no idea when I should use that pragma in my method.

What about having a way to comment pragma? Maybe something like 
-=-=-=-=-=-=
Object subclass: #Pragma
instanceVariableNames: 'method keyword arguments comment'
-=-=-=-=-=-=

And a simple way to annotate pragmas?
Just an idea. 

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



Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Clément Béra
Hi.

Pragmas are selectors hence they're browsable. You can implement a method somewhere with the pragma selector name that includes the documentation. In VW they were careful about that and most, if not all, of their pragmas are carefully commented this way.

For example, if you have the pragma <foo> and you implement the method MyClass class >> #foo with some comments in it and you can double click on the pragma <foo> to select its content (foo) and press Cmd+M (or right click implementors) to get to the method having the documentation.

On Fri, Jun 24, 2016 at 3:54 PM, Alexandre Bergel <[hidden email]> wrote:
Hi!

A pragma may be very obscure. For example, I do: 
Pragma allInstances anyOne
=> <debuggerCompleteToSender>

If I want to know more about this <debuggerCompleteToSender> is actually quite challenging. 
I see many methods having that pragma, but not idea what it is for. 
I see that Halt>>signalerContext and Process>>complete: that use that pragma somehow. But still, I have no idea when I should use that pragma in my method.

What about having a way to comment pragma? Maybe something like 
-=-=-=-=-=-=
Object subclass: #Pragma
instanceVariableNames: 'method keyword arguments comment'
-=-=-=-=-=-=

And a simple way to annotate pragmas?
Just an idea. 

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




Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Eliot Miranda-2


On Jun 24, 2016, at 7:55 AM, Clément Bera <[hidden email]> wrote:

Hi.

Pragmas are selectors hence they're browsable. You can implement a method somewhere with the pragma selector name that includes the documentation. In VW they were careful about that and most, if not all, of their pragmas are carefully commented this way.

For example, if you have the pragma <foo> and you implement the method MyClass class >> #foo with some comments in it and you can double click on the pragma <foo> to select its content (foo) and press Cmd+M (or right click implementors) to get to the method having the documentation.

+1.  I can't stress enough how useful it is to make pragmas real selectors with implementations and to try and apply them using perform:withArguments:. That's when their real power comes in.

For example, if you have some method that wants to be added to some tool, make its pragma a message with all the information you need to add it as arguments (things like its position or priority relative to other additions, its name in the list of components, an icon to use, a string for fly-by help) and then implement a builder class whose methods match these pragmas so that when the builder performs the pragma it adds the method to the tool, in a given position, with a given icon and fly-by help etc.

In most other systems method annotations are simply that, just passive labels.  But in Smalltalk these are executable.  You can browse for senders and implementors, you can execute them using a visitor pattern.  Much more powerful.



On Fri, Jun 24, 2016 at 3:54 PM, Alexandre Bergel <[hidden email]> wrote:
Hi!

A pragma may be very obscure. For example, I do: 
Pragma allInstances anyOne
=> <debuggerCompleteToSender>

If I want to know more about this <debuggerCompleteToSender> is actually quite challenging. 
I see many methods having that pragma, but not idea what it is for. 
I see that Halt>>signalerContext and Process>>complete: that use that pragma somehow. But still, I have no idea when I should use that pragma in my method.

What about having a way to comment pragma? Maybe something like 
-=-=-=-=-=-=
Object subclass: #Pragma
instanceVariableNames: 'method keyword arguments comment'
-=-=-=-=-=-=

And a simple way to annotate pragmas?
Just an idea. 

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




Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Ben Coman
In reply to this post by Clément Béra


On Fri, Jun 24, 2016 at 10:55 PM, Clément Bera <[hidden email]> wrote:
Hi.

Pragmas are selectors hence they're browsable. You can implement a method somewhere with the pragma selector name that includes the documentation. In VW they were careful about that and most, if not all, of their pragmas are carefully commented this way.


Should this be concentrated in a class like PragmaDocumentation, or spread out (I don't know how).

cheers -ben 
 
For example, if you have the pragma <foo> and you implement the method MyClass class >> #foo with some comments in it and you can double click on the pragma <foo> to select its content (foo) and press Cmd+M (or right click implementors) to get to the method having the documentation.

 

On Fri, Jun 24, 2016 at 3:54 PM, Alexandre Bergel <[hidden email]> wrote:
Hi!

A pragma may be very obscure. For example, I do: 
Pragma allInstances anyOne
=> <debuggerCompleteToSender>

If I want to know more about this <debuggerCompleteToSender> is actually quite challenging. 
I see many methods having that pragma, but not idea what it is for. 
I see that Halt>>signalerContext and Process>>complete: that use that pragma somehow. But still, I have no idea when I should use that pragma in my method.

What about having a way to comment pragma? Maybe something like 
-=-=-=-=-=-=
Object subclass: #Pragma
instanceVariableNames: 'method keyword arguments comment'
-=-=-=-=-=-=

And a simple way to annotate pragmas?
Just an idea. 

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





Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Richard Sargent
Administrator
Ben Coman wrote
On Fri, Jun 24, 2016 at 10:55 PM, Clément Bera <[hidden email]>
wrote:

> Hi.
>
> Pragmas are selectors hence they're browsable. You can implement a method
> somewhere with the pragma selector name that includes the documentation. In
> VW they were careful about that and most, if not all, of their pragmas are
> carefully commented this way.
>
>
Should this be concentrated in a class like PragmaDocumentation, or spread
out (I don't know how).
Since pragmas are an open set and can be added by any package, concentrating them in one place doesn't sound like a good idea. The best place to have the comments is with the code. If the pragmas name real selectors, comment the implementation. If the pragmas are merely tags, comment the method that declares them as pragmas (e.g. VisualWorks requires you to declare the symbols as pragmas before using them).

Examples:
SUnit.TestCase class>>#testMethodTags declares a couple of pragma selectors for instance methods.
testMethodTags
        "Any method tagged with a <test> pragma is considered a test selector candidate"
        "<uses:> tags are used to compute instance specific resources for the tagged test. The argument is a symbol for the class name, or a binding reference to the same."
        <pragmas: #instance>

        ^#(#test #uses:)

SUnit.TestCase class>>#testResourceTags declares a class method pragma for resources.
testResourceTags
        "<resource:> tags are used to compute instance specific resources for the tagged test. The argument is a symbol for the class name, or a binding reference to the same."
        <pragmas: #class>

        ^#(#resource)

ApplicationModel class>>menuMethodPragmas declares a whole slew of selectors for menus. But it neglects to provide comments in it or in the list of selectors in the Menu class.
menuMethodPragmas
        <pragmas: #instance>
        <pragmas: #class>

        ^Menu pragmas

However, VW does comment the actual methods:
computedSubmenu: label nameKey: key menu: menuIDs position: position
        "This pragma expects the body of the method marked with it
        to answer a Menu that will be used as a submenu with the
        label and position specified by the pragma."



cheers -ben


> For example, if you have the pragma <foo> and you implement the method
> MyClass class >> #foo with some comments in it and you can double click on
> the pragma <foo> to select its content (foo) and press Cmd+M (or right
> click implementors) to get to the method having the documentation.
>



>
> On Fri, Jun 24, 2016 at 3:54 PM, Alexandre Bergel <[hidden email]
> > wrote:
>
>> Hi!
>>
>> A pragma may be very obscure. For example, I do:
>> Pragma allInstances anyOne
>> => <debuggerCompleteToSender>
>>
>> If I want to know more about this <debuggerCompleteToSender> is actually
>> quite challenging.
>> I see many methods having that pragma, but not idea what it is for.
>> I see that Halt>>signalerContext and Process>>complete: that use that
>> pragma somehow. But still, I have no idea when I should use that pragma in
>> my method.
>>
>> What about having a way to comment pragma? Maybe something like
>> -=-=-=-=-=-=
>> Object subclass: #Pragma
>> instanceVariableNames: 'method keyword arguments *comment*'
>> -=-=-=-=-=-=
>>
>> And a simple way to annotate pragmas?
>> Just an idea.
>>
>> Cheers,
>> Alexandre
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

stepharo
In reply to this post by Eliot Miranda-2

>
> +1.  I can't stress enough how useful it is to make pragmas real
> selectors with implementations and to try and apply them using
> perform:withArguments:. That's when their real power comes in.
>
> For example, if you have some method that wants to be added to some
> tool, make its pragma a message with all the information you need to
> add it as arguments (things like its position or priority relative to
> other additions, its name in the list of components, an icon to use, a
> string for fly-by help) and then implement a builder class whose
> methods match these pragmas so that when the builder performs the
> pragma it adds the method to the tool, in a given position, with a
> given icon and fly-by help etc.
>
> In most other systems method annotations are simply that, just passive
> labels.  But in Smalltalk these are executable.  You can browse for
> senders and implementors, you can execute them using a visitor
> pattern.  Much more powerful.
>
Hi eliot

For the pragmas paper I read about annotation in Java and from what I
learned they are more powerful in Java.
They can annotate any language elements and they can also be executed (I
have to discuss with a Java expert to get it).

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Tudor Girba-2
In reply to this post by abergel
Hi,

I believe we are missing a first class entity for a PragmaType. Essentially, I think that the class side of the Pragma class should become a full object.

In fact, we already have a rudimentary version of this in Spotter because we needed an object to be able to browse all definitions of a certain pragma.

So, now, I extended it with the concept of a user which is the list of all senders minus the methods that are annotated with a pragma. This helps distinguish the meaning of a pragma by looking at the code where it is being used. Perhaps we can find a better name than users.

You can see these users in the inspector and in spotter:


I think we should build on this.

What do you think?

Cheers,
Doru


On Jun 24, 2016, at 3:54 PM, Alexandre Bergel <[hidden email]> wrote:

Hi!

A pragma may be very obscure. For example, I do: 
Pragma allInstances anyOne
=> <debuggerCompleteToSender>

If I want to know more about this <debuggerCompleteToSender> is actually quite challenging. 
I see many methods having that pragma, but not idea what it is for. 
I see that Halt>>signalerContext and Process>>complete: that use that pragma somehow. But still, I have no idea when I should use that pragma in my method.

What about having a way to comment pragma? Maybe something like 
-=-=-=-=-=-=
Object subclass: #Pragma
instanceVariableNames: 'method keyword arguments comment'
-=-=-=-=-=-=

And a simple way to annotate pragmas?
Just an idea. 

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




--
www.tudorgirba.com
www.feenk.com

"What we can governs what we wish."




Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Clément Béra
In reply to this post by stepharo


On Sat, Jun 25, 2016 at 8:08 AM, stepharo <[hidden email]> wrote:


+1.  I can't stress enough how useful it is to make pragmas real selectors with implementations and to try and apply them using perform:withArguments:. That's when their real power comes in.

For example, if you have some method that wants to be added to some tool, make its pragma a message with all the information you need to add it as arguments (things like its position or priority relative to other additions, its name in the list of components, an icon to use, a string for fly-by help) and then implement a builder class whose methods match these pragmas so that when the builder performs the pragma it adds the method to the tool, in a given position, with a given icon and fly-by help etc.

In most other systems method annotations are simply that, just passive labels.  But in Smalltalk these are executable.  You can browse for senders and implementors, you can execute them using a visitor pattern.  Much more powerful.

Hi eliot

For the pragmas paper I read about annotation in Java and from what I learned they are more powerful in Java.
They can annotate any language elements and they can also be executed (I have to discuss with a Java expert to get it).


In Java you *cannot* annotate any language element. You can annotate class, methods, instance variables, method arguments and temporaries and packages.

Then when I take an annotation, for example an hibernate annotation:
@Entity
@Table(name = "EMPLOYEE")
In the case of Hibernate, these annotation are for a class and they are used at *runtime* to bind the class instances with database entries (elements of this class are stored in the table EMPLOYEE).

Now I've never seen anyone doing that, but as you can access the annotation at runtime, and you can extract from the annotation its name and its parameters (for example you could extract "Table" and "name -> EMPLOYEE". Then, using the Java reflective features, you can do something like:

method = obj.getClass().getMethod(methodName, param1.class, param2.class, ..);
method.invoke(obj, arg1, arg2,...);
And this way you execute a method named "Table", "name" or "EMPLOYEE" with the parameter you want, as you could execute a method from any string matching a method name. We have the same primitive in Pharo on CompiledMethod.


I would not say that pragmas are more powerful in Java. Can you give an example of something you can do with the Java annotation that you can't do with Pharo pragmas ?

In Slang we use pragma to annotate argument and temporary variables and it works just fine. When you describe in Pharo classes and instance variables using Magritte you can do the same thing as just annotating them. 



Stef


Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Jan Vrany

In Java you *cannot* annotate any language element. You can annotate class, methods, instance variables, method arguments and temporaries and packages.

Then when I take an annotation, for example an hibernate annotation:
@Entity
@Table(name = "EMPLOYEE")
In the case of Hibernate, these annotation are for a class and they are used at *runtime* to bind the class instances with database entries (elements of this class are stored in the table EMPLOYEE).

Now I've never seen anyone doing that, but as you can access the annotation at runtime, and you can extract from the annotation its name and its parameters (for example you could extract "Table" and "name -> EMPLOYEE". Then, using the Java reflective features, you can do something like:

method = obj.getClass().getMethod(methodName, param1.class, param2.class, ..);
method.invoke(obj, arg1, arg2,...);
And this way you execute a method named "Table", "name" or "EMPLOYEE" with the parameter you want, as you could execute a method from any string matching a method name. We have the same primitive in Pharo on CompiledMethod.


I would not say that pragmas are more powerful in Java. Can you give an example of something you can do with the Java annotation that you can't do with Pharo pragmas ?

Out of a curiosity,  how can I annotate class, instance variable, method argument or temporary, or package. 
How can I annotate the pragma definition itself? How can I retrieve annotations of a pragma definition? 

I mean, I understand that you can *achieve* same effect, but you *can* achieve it as well with no pragma support at all.

Jan

In Slang we use pragma to annotate argument and temporary variables and it works just fine. When you describe in Pharo classes and instance variables using Magritte you can do the same thing as just annotating them. 



Stef


Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Clément Béra


On Sat, Jun 25, 2016 at 11:52 AM, Jan Vrany <[hidden email]> wrote:

In Java you *cannot* annotate any language element. You can annotate class, methods, instance variables, method arguments and temporaries and packages.

Then when I take an annotation, for example an hibernate annotation:
@Entity
@Table(name = "EMPLOYEE")
In the case of Hibernate, these annotation are for a class and they are used at *runtime* to bind the class instances with database entries (elements of this class are stored in the table EMPLOYEE).

Now I've never seen anyone doing that, but as you can access the annotation at runtime, and you can extract from the annotation its name and its parameters (for example you could extract "Table" and "name -> EMPLOYEE". Then, using the Java reflective features, you can do something like:

method = obj.getClass().getMethod(methodName, param1.class, param2.class, ..);
method.invoke(obj, arg1, arg2,...);
And this way you execute a method named "Table", "name" or "EMPLOYEE" with the parameter you want, as you could execute a method from any string matching a method name. We have the same primitive in Pharo on CompiledMethod.


I would not say that pragmas are more powerful in Java. Can you give an example of something you can do with the Java annotation that you can't do with Pharo pragmas ?

Out of a curiosity,  how can I annotate class, instance variable, method argument or temporary, or package. 
How can I annotate the pragma definition itself? How can I retrieve annotations of a pragma definition? 

I mean, I understand that you can *achieve* same effect, but you *can* achieve it as well with no pragma support at all.

Agreed. We can do the same thing, but we do it differently.


Jan

In Slang we use pragma to annotate argument and temporary variables and it works just fine. When you describe in Pharo classes and instance variables using Magritte you can do the same thing as just annotating them. 



Stef



Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

abergel
In reply to this post by Tudor Girba-2
I am not sure to get it. Why not simply having a class PragmaDescription that simply associate a comment to a selector ?

Alexandre

> On Jun 25, 2016, at 3:18 AM, Tudor Girba <[hidden email]> wrote:
>
> Hi,
>
> I believe we are missing a first class entity for a PragmaType. Essentially, I think that the class side of the Pragma class should become a full object.
>
> In fact, we already have a rudimentary version of this in Spotter because we needed an object to be able to browse all definitions of a certain pragma.
>
> So, now, I extended it with the concept of a user which is the list of all senders minus the methods that are annotated with a pragma. This helps distinguish the meaning of a pragma by looking at the code where it is being used. Perhaps we can find a better name than users.
>
> You can see these users in the inspector and in spotter:
>
> <pragma-type-users.png>
>
> I think we should build on this.
>
> What do you think?
>
> Cheers,
> Doru
>
>
>> On Jun 24, 2016, at 3:54 PM, Alexandre Bergel <[hidden email]> wrote:
>>
>> Hi!
>>
>> A pragma may be very obscure. For example, I do:
>> Pragma allInstances anyOne
>> => <debuggerCompleteToSender>
>>
>> If I want to know more about this <debuggerCompleteToSender> is actually quite challenging.
>> I see many methods having that pragma, but not idea what it is for.
>> I see that Halt>>signalerContext and Process>>complete: that use that pragma somehow. But still, I have no idea when I should use that pragma in my method.
>>
>> What about having a way to comment pragma? Maybe something like
>> -=-=-=-=-=-=
>> Object subclass: #Pragma
>> instanceVariableNames: 'method keyword arguments comment'
>> -=-=-=-=-=-=
>>
>> And a simple way to annotate pragmas?
>> Just an idea.
>>
>> Cheers,
>> Alexandre
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "What we can governs what we wish."
>
>
>
>

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




Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

abergel
In reply to this post by Clément Béra
Annotate a class or an instance variable :-)

Alexandre

> On Jun 25, 2016, at 3:55 AM, Clément Bera <[hidden email]> wrote:
>
> I would not say that pragmas are more powerful in Java. Can you give an example of something you can do with the Java annotation that you can't do with Pharo pragmas ?

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




Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Tudor Girba-2
In reply to this post by abergel
Hi,

That is what I said. We need a meta-object that describes a Pragma instance. I said that we already had the need to have such a meta-object in Spotter and we created one that is called PragmaType. We can call it PramgaDescription as well, but the key point would be to casually connect the meta object and the instances.

For example, besides the description, you still would like to know which parts of the image actually react to such a pragma, and this is where getting an idea of the logic that is making use of a pragma is very useful. For example, in the case of the debuggerCompleteToSender pragma, we have:
- 15 annotations of methods
- 2 methods that use the pragma


So, you have 2 places to look for to understand that logic. You would not see this from a description only. Having a real meta-object allows us to complement a possible description with smarter analyses.

Cheers,
Doru


On Jun 26, 2016, at 2:29 PM, Alexandre Bergel <[hidden email]> wrote:

I am not sure to get it. Why not simply having a class PragmaDescription that simply associate a comment to a selector ?

Alexandre

On Jun 25, 2016, at 3:18 AM, Tudor Girba <[hidden email]> wrote:

Hi,

I believe we are missing a first class entity for a PragmaType. Essentially, I think that the class side of the Pragma class should become a full object.

In fact, we already have a rudimentary version of this in Spotter because we needed an object to be able to browse all definitions of a certain pragma.

So, now, I extended it with the concept of a user which is the list of all senders minus the methods that are annotated with a pragma. This helps distinguish the meaning of a pragma by looking at the code where it is being used. Perhaps we can find a better name than users.

You can see these users in the inspector and in spotter:

<pragma-type-users.png>

I think we should build on this.

What do you think?

Cheers,
Doru


On Jun 24, 2016, at 3:54 PM, Alexandre Bergel <[hidden email]> wrote:

Hi!

A pragma may be very obscure. For example, I do: 
Pragma allInstances anyOne
=> <debuggerCompleteToSender>

If I want to know more about this <debuggerCompleteToSender> is actually quite challenging. 
I see many methods having that pragma, but not idea what it is for. 
I see that Halt>>signalerContext and Process>>complete: that use that pragma somehow. But still, I have no idea when I should use that pragma in my method.

What about having a way to comment pragma? Maybe something like 
-=-=-=-=-=-=
Object subclass: #Pragma
instanceVariableNames: 'method keyword arguments comment'
-=-=-=-=-=-=

And a simple way to annotate pragmas?
Just an idea. 

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




--
www.tudorgirba.com
www.feenk.com

"What we can governs what we wish."





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





--
www.tudorgirba.com
www.feenk.com

"Problem solving efficiency grows with the abstractness level of problem understanding."




Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

stepharo
In reply to this post by stepharo
Clement

I do not think that we are talking about the same. You are not annotating an AST element.
Of course with a convention you can add a method pragma to annotate an source entity that you are the only one
to know that it is the right entity. To me this is different.

So in the paper I do not want to say that Smalltalk pragmas are equivalent to Java ones because do me they are not.
I think that Java annotations are nicely integrated into the language too. And we cannot annotate (the AST element
of temp, argument, class def, package and annotations themselves in Smalltalk). I will read more about Java Annotation
to be more precise.

In Slang we use pragma to annotate argument and temporary variables and it
works just fine.

        Can you give an example on how you annotated it?

        When you describe in Pharo classes and instance variables
    using Magritte you can do the same thing as just annotating them.
       
    (You see I cannot annotate instance variables directly I can define a method with an annotation that tell me that an instance
variable should be interpreted differently.).

Stef
Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

stepharo

https://docs.oracle.com/javase/7/docs/api/java/lang/annotation/ElementType.html

ANNOTATION_TYPE
Annotation type declaration
CONSTRUCTOR
Constructor declaration
FIELD
Field declaration (includes enum constants)
LOCAL_VARIABLE
Local variable declaration
METHOD
Method declaration
PACKAGE
Package declaration
PARAMETER
Parameter declaration
TYPE
Class, interface (including annotation type), or enum declaration



Le 26/6/16 à 20:14, stepharo a écrit :
Clement

I do not think that we are talking about the same. You are not annotating an AST element.
Of course with a convention you can add a method pragma to annotate an source entity that you are the only one
to know that it is the right entity. To me this is different.

So in the paper I do not want to say that Smalltalk pragmas are equivalent to Java ones because do me they are not.
I think that Java annotations are nicely integrated into the language too. And we cannot annotate (the AST element
of temp, argument, class def, package and annotations themselves in Smalltalk). I will read more about Java Annotation
to be more precise.

In Slang we use pragma to annotate argument and temporary variables and it
works just fine.

        Can you give an example on how you annotated it?

        When you describe in Pharo classes and instance variables
    using Magritte you can do the same thing as just annotating them.
       
    (You see I cannot annotate instance variables directly I can define a method with an annotation that tell me that an instance
variable should be interpreted differently.).

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

stepharo
Can be interesting for others:

     Java SE 8 allows type annotations anywhere that a type is used.
Previously, annotations were only allowed on definitions.

https://blogs.oracle.com/java-platform-group/entry/java_8_s_new_type


Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Denis Kudriashov
Hi.

In Java annotations are first class objects. You can put behaviour and state on them. In Smalltalk you can't do this.

2016-06-26 22:00 GMT+02:00 stepharo <[hidden email]>:
Can be interesting for others:

    Java SE 8 allows type annotations anywhere that a type is used. Previously, annotations were only allowed on definitions.

https://blogs.oracle.com/java-platform-group/entry/java_8_s_new_type



Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

EstebanLM

On 27 Jun 2016, at 10:36, Denis Kudriashov <[hidden email]> wrote:

Hi.

In Java annotations are first class objects. You can put behaviour and state on them. In Smalltalk you can't do this.

that’s why I was suggesting to make them objects instead simple selectors. but seems that people is scared :)


2016-06-26 22:00 GMT+02:00 stepharo <[hidden email]>:
Can be interesting for others:

    Java SE 8 allows type annotations anywhere that a type is used. Previously, annotations were only allowed on definitions.

https://blogs.oracle.com/java-platform-group/entry/java_8_s_new_type




Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Tudor Girba-2
Hi,

That is my proposal as well: introduce a first class entity that describes a Pragma instance. Who would be interested to play with this?

Cheers,
Doru


> On Jun 27, 2016, at 11:27 AM, Esteban Lorenzano <[hidden email]> wrote:
>
>
>> On 27 Jun 2016, at 10:36, Denis Kudriashov <[hidden email]> wrote:
>>
>> Hi.
>>
>> In Java annotations are first class objects. You can put behaviour and state on them. In Smalltalk you can't do this.
>
> that’s why I was suggesting to make them objects instead simple selectors. but seems that people is scared :)
>
>>
>> 2016-06-26 22:00 GMT+02:00 stepharo <[hidden email]>:
>> Can be interesting for others:
>>
>>     Java SE 8 allows type annotations anywhere that a type is used. Previously, annotations were only allowed on definitions.
>>
>> https://blogs.oracle.com/java-platform-group/entry/java_8_s_new_type
>>
>>
>>
>

--
www.tudorgirba.com
www.feenk.com

"Quality cannot be an afterthought."


Reply | Threaded
Open this post in threaded view
|

Re: Having comments for pragma?

Denis Kudriashov

2016-06-27 12:12 GMT+02:00 Tudor Girba <[hidden email]>:
Hi,

That is my proposal as well: introduce a first class entity that describes a Pragma instance. Who would be interested to play with this?

How it could be done? 
Probably compiler could search preferred Pragma class for given selector. And then we will have collection of real pragma instances inside CompiledMethod. What do you think?
123